logoAcademy

Deploy ERC20 Token Remote

Deploy and register the ERC20TokenRemote contract to the Dijets Utility Chain.

Deploy ERC20TokenRemote on Utility Chain

Using the forge create command, we will deploy the ERC20TokenRemote.sol contract, passing in the following constructor arguments:

  • InterECC Messaging Registry Address (for Utility Chain)
  • InterECC Messaging Manager (our funded address)
  • Source Blockchain ID (hexidecimal representation of our Dijets ECC's Blockchain ID mydijetschain)
  • Token Home Address (address of NativeTokenHome.sol deployed on our Dijets ECC mydijetschain 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; typically 18 decimals)
forge create --rpc-url local-c --private-key $PK lib/dijets-interchain-token-transfer/contracts/src/TokenRemote/ERC20TokenRemote.sol:ERC20TokenRemote \
--constructor-args "(${TELEPORTER_REGISTRY_C_CHAIN}, ${FUNDED_ADDRESS}, ${SOURCE_BLOCKCHAIN_ID_HEX}, ${ERC20_HOME_BRIDGE_ECC}, 18)" "Wrapped NATV" "WNATV" 18
[⠊] Compiling...
[⠆] Compiling 5 files with Solc 0.8.18
[⠰] Solc 0.8.18 finished in 1.23s
Compiler run successful!
Deployer: 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
Deployed to: 0x5DB9A7629912EBF95876228C24A848de0bfB43A9
Transaction hash: 0x3d437a3421f7b2b1bf0276e9a80f57815291e62313584ff48afb69fb206b5daf

Save the ERC20 Token Remote Address

export ERC20_TOKEN_REMOTE_C_CHAIN=0x5DB9A7629912EBF95876228C24A848de0bfB43A9

Register ERC20TokenRemote on Utility Chain with NativeTokenHome on mydijetschain

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.

cast send --rpc-url local-c --private-key $PK $ERC20_TOKEN_REMOTE_C_CHAIN "registerWithHome((address, uint256))" "(0x0000000000000000000000000000000000000000, 0)"

On this page