The transfer of the asset from chain A to chain B goes through the followed steps:
- If the transfered asset isn't the native blockchain token (i.e ETH, BNB) the
approve
is done otherwise the transfered amount is attached to the next method. - The
send
method ofWhiteDebridge
contract is called. Theamount
of asset is locked on the contract, the fee is charged from theamount
and theSent
event is emited. - The ChainLink nodes listen to the event on the
WhiteDebridge
contract and after 3 blocks confirmations submit the sent request identifier(submissionId
) which is hash of concatination ofdebridgeId
,amount
,receiver
,nonce
.DebridgeId
is hash of network id of the chain where the original token exists and token address on the original chain. The oracles are rewarded with LINKs immediatly after the submission. - After enough confirmations from Chainlink oracles (lets say 3 out of 5) the send request status becomes
confirmed
. - The user or any other party can call
mint
method ofWhiteDebridge
contract with the correctdebridgeId
,amount
,receiver
,nonce
parameters that results intosubmissionId
. If the submission is confirmed the wrapped asset is minted to thereceiver
address.
The transfer of the wrapped asset on chain B back to the original chain A to chain B goes through the followed steps:
- The
approve
to spent the wrapped asset byWhiteDebridge
is done. - The
burn
method ofWhiteDebridge
contract is called. Theamount
of the asset is burnt and theBurnt
event is emited. - The ChainLink nodes listen to the event on the
WhiteDebridge
contract and after 3 blocks confirmations submit the burnt request identifier(submissionId
) which is hash of concatination ofdebridgeId
,amount
,receiver
,nonce
.DebridgeId
is hash of network id of the chain where the original token exists and token address on the original chain. The oracles are rewarded with LINKs immediatly after the submission. - After enough confirmations from Chainlink oracles (lets say 3 out of 5) the burnt request status becomes
confirmed
. - The user or any other party can call
claim
method ofWhiteDebridge
contract with the correctdebridgeId
,amount
,receiver
,nonce
parameters that results intosubmissionId
. If the submission is confirmed the fee is transfer fee is charged and original asset is sent to thereceiver
address.
Note: the chainlink node can only submit up to 32 bytes per one transaction to the chain that is why debridgeId
, amount
, receiver
, nonce
can't be submitted by the node in one transaction. To solve it the hash of the parameters is used.
yarn start-ganache &
yarn test
-
use assets in other protocols
-
support NFT to make transfer fee lower