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
approveis done otherwise the transfered amount is attached to the next method. - The
sendmethod ofWhiteDebridgecontract is called. Theamountof asset is locked on the contract, the fee is charged from theamountand theSentevent is emited. - The ChainLink nodes listen to the event on the
WhiteDebridgecontract and after 3 blocks confirmations submit the sent request identifier(submissionId) which is hash of concatination ofdebridgeId,amount,receiver,nonce.DebridgeIdis 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
mintmethod ofWhiteDebridgecontract with the correctdebridgeId,amount,receiver,nonceparameters that results intosubmissionId. If the submission is confirmed the wrapped asset is minted to thereceiveraddress.
The transfer of the wrapped asset on chain B back to the original chain A to chain B goes through the followed steps:
- The
approveto spent the wrapped asset byWhiteDebridgeis done. - The
burnmethod ofWhiteDebridgecontract is called. Theamountof the asset is burnt and theBurntevent is emited. - The ChainLink nodes listen to the event on the
WhiteDebridgecontract and after 3 blocks confirmations submit the burnt request identifier(submissionId) which is hash of concatination ofdebridgeId,amount,receiver,nonce.DebridgeIdis 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
claimmethod ofWhiteDebridgecontract with the correctdebridgeId,amount,receiver,nonceparameters that results intosubmissionId. If the submission is confirmed the fee is transfer fee is charged and original asset is sent to thereceiveraddress.
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