Cross-Chain Transfer
Cross-chain transfers only support bound BEP2 or BEP8 tokens on BC and BEP20 tokens on BSC.
Verify Token Info
First, you should make sure that it's already bound. For example, you could see the binding info of BNB:
As BNB is the native token on both chains, so we use 0x0000000000000000000000000000000000000000
as the corresponding contract address. Besides, on BSC, the native token decimals is 18, while the decimals on BC is 8. So if you transfer 1e8:BNB to BSC, the recipient balance will gain 1e18.
Transfer BNB from BC to BSC
Example:
Result:
Transfer BNB from BSC to BC
transferOut
Call transferOut of TokenHub contract in MyEtherWallet:
img
The value here should follow this equation:
RelayFee
should be 0.01BNB and it can be updated by on-chain governance. For example, if you transfer 1BNB from BSC to BC, the value should be at least 1.01BNB.
After all the above parameters have been set to proper values, users can click the transact button to build transactions, and metamask plugin will be ejected. Then users can click the confirm button in metamask to sign and broadcast transactions.
batchTransferOutBNB
Call batchTransferOutBNB of TokenHub contract in MyEtherWallet:
img
The value here should follow this equation:
Transfer BEP2 to BSC
Execute the following command to transfer ABC-A64 token to BSC:
Transfer BEP20 to BC
Before calling transferOut or batchTransferOut, users need to call approve method to grant enough allowance to TokenHub contract. For transferOut method, the allowance should equal the transfer amount. For batchTransferOut, the allowance should be the sum of the amount array.
transferOut
img
The value here should be RelayFee.
Mint
If both the BEP20 token and bep2 token are mintable, then token owners can still mint their tokens even after token binding. Besides, token owners need to ensure the total supply and the locked amount on both chains are still matched, otherwise, users might can’t transfer their tokens to another chain.
Mint token on BC
Execute the following command to mint 10000 ABC-A64:
Mint token on BSC and lock the new minted token:
Call mint method of BEP20 contract, the mint amount should be 1e22.
Transfer all minted ABC token to tokenHub contract:
0x0000000000000000000000000000000000001004
Mint token on BSC
Call mint of BEP20 contract to mint 10000 ABC, the mint amount should be 1e22(18 decimals).
Mint token on BC and lock the new minted token:
Execute the following command to mint 10000 ABC-A64:
Transfer all minted ABC-A64 token to the pure-code-controlled address:
tbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xnc4wpr
(mainnet address:bnb1v8vkkymvhe2sf7gd2092ujc6hweta38xadu2pj
)
Last updated
Was this helpful?