Deploy a Remote Contract
Deploy the Token Remote on your own blockchain
ERC20 Remote
To ensure the wrapped token is bridged into the destination chain (in this case, C-Chain) you'll need to deploy a remote contract that implements the IERC20Bridge
interface, as well as inheriting the properties of TeleporterTokenRemote
. In order for the bridged tokens to have all the normal functionality of a locally deployed ERC20 token, this remote contract must also inherit the properties of a standard ERC20
contract.
First, get the Source Blockchain ID
in hexidecimal format, which in this example is the BlockchainID of your Avalanche L1, run:
Source Blockchain ID
is in the field: Local Network BlockchainID (HEX)
.
Do the same for the C-Chain:
Destination Blockchain ID
is in the field: BlockchainID (HEX)
.
Using the (forge create
)[https://book.getfoundry.sh/reference/forge/forge-create) command, we will deploy the [ERC20Remote.sol](./NativeTokenHome.sol] contract, passing in the following constructor arguments:
- Interchain Messaging Registry Address (for C-Chain)
- Interchain Messaging Manager (our funded address)
- Source Blockchain ID (hexidecimal representation of our Avalanche L1's Blockchain ID)
- Token Home Address (address of NativeTokenHome.sol deployed on Avalanche L1 in the last step)
- 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.)
Note the address the remote contract was "Deployed to".
Register Remote Bridge with Home Bridge
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 Home Bridge contract
You can increase/decrease the numbers here as per your requirements. (All values are mentioned in wei)