Deploy Native Token Home

Deploy the NativeTokenHome contract on the Avalanche L1 blockchain.

You may already have TELEPORTER_REGISTRY_L1 and SOURCE_BLOCKCHAIN_ID_HEX set from previous sections. If you do, you can skip to step 5.

Get the Teleporter Registry Address of myblockchain

avalanche blockchain describe myblockchain
+-------------------------------------------------------------------------------------------+
|                                         ICM                                               |
+---------------+------------------------------+--------------------------------------------+
| Local Network | ICM Messenger Address        | 0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf |
|               +------------------------------+--------------------------------------------+
|               | ICM Registry Address         | 0xB4DC3d786D658d118631F5C6B75CB5935be8407C | // [!code highlight]
+---------------+------------------------------+--------------------------------------------+

Save the Teleporter Registry Address

Note

The address 0xB4DC3d786D658d118631F5C6B75CB5935be8407C is your receiver contract address.

Most other environment variables we will need are already set in the devcontainer or from the previous section.

export TELEPORTER_REGISTRY_L1=0x...

Get the Blockchain ID (hex) of myblockchain

+---------------------------------------------------------------------------------------------------------------+
|                                                 MYBLOCKCHAIN                                                  |
+---------------+-----------------------------------------------------------------------------------------------+
| Name          | myblockchain                                                                                  |
+---------------+-----------------------------------------------------------------------------------------------+
| VM ID         | qDNV9vtxZYYNqm7TSa9KnDTRabGxtBLv6vd888791J9a89kTF                                             |
+---------------+-----------------------------------------------------------------------------------------------+
| VM Version    | v0.6.9                                                                                        |
+---------------+--------------------------+--------------------------------------------------------------------+
| Local Network | ChainID                  | 1                                                                  |
|               +--------------------------+--------------------------------------------------------------------+
|               | SubnetID                 | 2KhsQJhH3VqS7WWMreodAAHpGfGCUNuGQDSaP2vUT29p1HELBV                 |
|               +--------------------------+--------------------------------------------------------------------+
|               | Owners (Threhold=1)      | P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p                    |
|               +--------------------------+--------------------------------------------------------------------+
|               | BlockchainID (CB58)      | 2ZempAyezixFRdJhJribDdj2wiK6YFF63CkXKaimfPb3hWeWVH                 |
|               +--------------------------+--------------------------------------------------------------------+
|               | BlockchainID (HEX)       | 0xcdd5b2b99ae462c32a8e4ea47e94f2c7804519353558fd4127cf7ae11d8a6e52 | // [!code highlight]
+---------------+--------------------------+--------------------------------------------------------------------+

Save the Blockchain ID (hex)

Note

The address 0xcdd5b2b99ae462c32a8e4ea47e94f2c7804519353558fd4127cf7ae11d8a6e52 is your receiver contract address.

export SOURCE_BLOCKCHAIN_ID_HEX=0x...

Deploy NativeTokenHome on myblockchain

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

  • Interchain Messaging Registry (for our Avalanche L1)
  • Interchain Messaging Manager (our funded address)
  • Wrapped Token Address (deployed in the last step)
forge create --rpc-url myblockchain --private-key $PK lib/icm-contracts/contracts/ictt/TokenHome/NativeTokenHome.sol:NativeTokenHome --optimize --optimizer-runs 200 --broadcast --constructor-args $TELEPORTER_REGISTRY_L1 $FUNDED_ADDRESS "1" $WRAPPED_ERC20_L1 
[⠊] Compiling...
[⠊] Compiling 22 files with Solc 0.8.18
[⠒] Solc 0.8.18 finished in 1.95s
Compiler run successful!
Deployer: 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
Deployed to: 0x17aB05351fC94a1a67Bf3f56DdbB941aE6c63E25 // [!code highlight]
Transaction hash: 0x91c60be19a69aadb1415112dd42302764b30bc48f09957c3a191021d70ccc9d4

Save the Native Token Home Address

Note

The address 0x17aB05351fC94a1a67Bf3f56DdbB941aE6c63E25 is your receiver contract address.

export ERC20_HOME_BRIDGE_L1=0x...

Is this guide helpful?