Deploy Token Remote for Multi-hop
Deploy and configure the ERC20TokenRemote contract on the second blockchain.
Deploy the Remote Contract
Using the forge create
command, we will deploy the ERC20TokenRemote.sol
contract, passing in the following constructor arguments:
- Interchain Messaging Registry Address (for
myblockchain2
) - Interchain Messaging Manager (our funded address)
- Source Blockchain ID (hexidecimal representation of Avalanche C-Chain)
- Token Home Address (address of
NativeTokenHome.sol
deployed on Avalanche C-Chain in the Deploy a Home Contract section) - Token Name (input in the constructor of the wrapped token contract)
- Token Symbol (input in the constructor of the wrapped token contract)
- Token Decimals (uint8 integer representing number of decimal places for the ERC20 token being created. Most ERC20 tokens follow the Ethereum standard, which defines 18 decimal places.)
Save the Remote Contract Address
Note the address the remote contract was "Deployed to".
Register Remote Contract with Home Contract
After deploying the bridge contracts, you'll need to register the remote bridge by sending a dummy message using the registerWithHome
method. This message includes details which inform the Home Bridge about your destination blockchain and bridge settings, eg. initialReserveImbalance
.
Approve tokens for the Token Remote contract on myblockchain
Now that our ERC20TokenRemote
contract is deployed and configured on myblockchain2
, we need to prepare myblockchain
for the token transfer.
We will approve the ERC20TokenRemote
contract to spend a certain amount of tokens on behalf of the sender.
You can increase/decrease the numbers here as per your requirements. (All values are mentioned in wei)