Enable your tokens in CCIP (Burn & Mint): Register from an EOA using Hardhat

This tutorial will guide you through the process of enabling your own tokens in CCIP using Hardhat. You will learn how to deploy tokens and set up Burn & Mint token pools. After that, you will register them in CCIP and configure them without needing manual intervention. Finally, you will test the Burn & Mint token handling mechanism, where tokens are burned on the source blockchain and an equivalent amount is minted on the destination blockchain.

We will cover the following key steps:

  1. Deploying Tokens: You will deploy your BurnMintERC677 tokens on the Avalanche Fuji and Arbitrum Sepolia testnets.

  2. Deploying Token Pools: Once your tokens are deployed, you will deploy BurnMintTokenPool token pools on Avalanche Fuji and Arbitrum Sepolia. These pools are essential for minting and burning tokens during cross-chain transfers. Each token will be linked to a pool, which will manage token transfers and ensure proper handling of assets across chains.

  3. Claiming Mint and Burn Roles: You will claim the mint and burn roles for the token pools, allowing your token pools to control how tokens are minted and burned during cross-chain transfers.

  4. Claiming and Accepting the Admin Role: This is a two-step process:

    1. You will call the RegistryModuleOwnerCustom contract's registerAdminViaOwner function to register your EOA as the token admin. This role is required to enable your token in CCIP.

    2. Once claimed, you will call the TokenAdminRegistry contract's acceptAdminRole function to complete the registration process.

  5. Linking Tokens to Pools: You will call the TokenAdminRegistry contract's setPool function to associate each token with its respective token pool.

  6. Configuring Token Pools: You will call the applyChainUpdates function on your token pools to configure each pool by setting cross-chain transfer parameters, such as token pool rate limits and enabled destination chains.

  7. Minting Tokens: You will call the mint function to mint tokens on Avalanche Fuji for your EOA. These tokens will later be used to test cross-chain transfers to Arbitrum Sepolia.

  8. Transferring Tokens: Finally, you will transfer tokens from Avalanche Fuji to Arbitrum Sepolia using CCIP. You will have the option to pay CCIP fees in either LINK tokens or native gas tokens.

By the end of this tutorial, you will have successfully deployed, registered, configured, and enabled your tokens and token pools for use in CCIP.

Before You Begin

  1. Make sure you have Node.js v18 or above installed. If not, install Node.js v18:
    Download Node.js 18 if you don't have it installed. Optionally, you can use the nvm package to switch between Node.js versions:

    nvm use 18
    

    Verify that the correct version of Node.js is installed:

    node -v
    

    Example output:

    $ node -v
    v18.7.0
    
  2. Clone the repository and navigate to the project directory:

    git clone https://github.com/smartcontractkit/smart-contract-examples.git
    cd smart-contract-examples/ccip/cct/hardhat
    
  3. Install dependencies for the project:

    npm install
    
  4. Compile the project:

    npm run compile
    
  5. Encrypt your environment variables for higher security:
    The project uses @chainlink/env-enc to encrypt your environment variables at rest. Follow the steps below to configure your environment securely:

    1. Set an encryption password for your environment variables:

      npx env-enc set-pw
      
    2. Set up a .env.enc file with the necessary variables for Avalanche Fuji and Arbitrum Sepolia testnets. Use the following command to add the variables:

      npx env-enc set
      

      Variables to configure:

      • AVALANCHE_FUJI_RPC_URL: A URL for the Avalanche Fuji testnet. You can get a personal endpoint from services like Alchemy or Infura.
      • ARBITRUM_SEPOLIA_RPC_URL: A URL for the Arbitrum Sepolia testnet. You can sign up for a personal endpoint from Alchemy or Infura.
      • PRIVATE_KEY: The private key for your testnet wallet. If you use MetaMask, you can follow this guide to export your private key. Note: This key is required for signing transactions like token transfers.
      • ETHERSCAN_API_KEY: An API key from Etherscan to verify your contracts. You can obtain one from Etherscan.
      • ARBISCAN_API_KEY: An Arbitrum explorer API key, used to verify your contract. Follow this guide to get one from Arbiscan.
  6. Fund your EOA with LINK and native gas tokens:
    Make sure your EOA has enough LINK and native gas tokens on Avalanche Fuji to cover transaction fees. You can use the Chainlink faucets to get testnet tokens.

Tutorial

Deploy Tokens

In this step, you will use the deployToken.ts task to deploy tokens on two testnets, Avalanche Fuji and Arbitrum Sepolia. Below is an explanation of the parameters used during deployment:

ParameterDescriptionDefaultRequired
nameThe name of the token. This is the full name by which the token will be identified.N/AYes
symbolThe symbol of the token. This is the shorthand (usually 3-5 letters) representing the token.N/AYes
decimalsThe number of decimals the token will use. For instance, 18 decimals means 1 token is represented as 1e18 smallest units.18No
initialsupplyThe initial supply of tokens to be created upon deployment. Use 0 to start with no initial supply.0No
withgetccipadminA flag to determine whether the token contract has a getCCIPAdmin() function. If set to true, a CCIP admin is required. When false, token admin registration will use the token owner() function.falseNo
ccipadminaddressThe address of the CCIP admin, only applicable if withgetccipadmin is set to true.N/ANo
verifycontractWhether to verify the contract on Etherscan or a similar blockchain explorer.falseNo
networkThe blockchain on which the token will be deployed. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes

Deploy tokens, use the following commands, substituting the token name and symbol as needed:

  1. Deploy the token on Avalanche Fuji:

    npx hardhat deployToken --name "BnM aem" --symbol BnMaem --decimals 18 --initialsupply 0 --withgetccipadmin false --verifycontract true --network avalancheFuji
    

    Example output:

    2024-10-08T00:16:29.359Z info: Deploying BurnMintERC677 contract to avalancheFuji
    2024-10-08T00:16:29.360Z info: Waiting 2 blocks for transaction 0xa9873913d9d2afc94c8622ad1b6cc9f52c088a514472f729b383287d74f87cae to be confirmed...
    2024-10-08T00:16:31.920Z info: Token deployed to: 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF
    2024-10-08T00:16:31.980Z info: Granting mint and burn roles to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:16:35.542Z info: Verifying contract...
    Successfully submitted source code for contract
    @chainlink/contracts-ccip/src/v0.8/shared/token/ERC677/BurnMintERC677.sol:BurnMintERC677 at 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF
    for verification on the block explorer. Waiting for verification result...
    
    Successfully verified contract BurnMintERC677 on the block explorer.
    https://testnet.snowtrace.io/address/0x15A5e7ca5043798F1E1983d048D9600F4752dfcF#code
    
    2024-10-08T00:17:02.884Z info: Token contract deployed and verified
    
  2. Deploy the token on Arbitrum Sepolia:

    npx hardhat deployToken --name "BnM aem" --symbol BnMaem --decimals 18 --initialsupply 0 --withgetccipadmin false --verifycontract true --network arbitrumSepolia
    

    Example output:

    2024-10-08T00:17:18.521Z info: Deploying BurnMintERC677 contract to arbitrumSepolia
    2024-10-08T00:17:18.523Z info: Waiting 2 blocks for transaction 0x40e659655e4bf7d213da43040b38df6f9f09ae9e2b3ceaa2f4e260f46f4c6861 to be confirmed...
    2024-10-08T00:17:18.931Z info: Token deployed to: 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52
    2024-10-08T00:17:19.117Z info: Granting mint and burn roles to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:17:21.396Z info: Verifying contract...
    The contract 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 has already been verified on the block explorer. If you're trying to verify a partially verified contract, please use the --force flag.
    https://sepolia.arbiscan.io/address/0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52#code
    
    2024-10-08T00:17:21.956Z info: Token contract deployed and verified
    

Deploy Token Pools

In this step, you will use the deployTokenPool.ts task to deploy token pools for the tokens on both testnets, Avalanche Fuji and Arbitrum Sepolia. Below is an explanation of the parameters used during deployment:

ParameterDescriptionDefaultRequired
tokenaddressThe address of the token for which the pool is being created.N/AYes
verifycontractWhether to verify the contract on Etherscan or a similar blockchain explorer.falseNo
networkThe blockchain on which the token pool will be deployed. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes

Deploy token pools using the following commands, replacing the token address with the one deployed in the previous step:

  1. Deploy the burn and mint token pool on Avalanche Fuji:

    npx hardhat deployTokenPool --tokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --verifycontract true --network avalancheFuji
    

    Example output:

    2024-10-08T00:19:32.054Z info: Waiting 2 blocks for transaction 0x62a37f36d09e39e17556021710e596af8804b8b830a7898373dd65cc59b62c98 to be confirmed...
    2024-10-08T00:19:35.225Z info: Token pool deployed to: 0x02552EAE370aeb997015dA41398F0a53F693d77E
    2024-10-08T00:19:35.226Z info: Granting mint and burn roles to 0x02552EAE370aeb997015dA41398F0a53F693d77E on token 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF
    2024-10-08T00:19:52.240Z info: Verifying contract...
    Successfully submitted source code for contract
    @chainlink/contracts-ccip/src/v0.8/ccip/pools/BurnMintTokenPool.sol:BurnMintTokenPool at 0x02552EAE370aeb997015dA41398F0a53F693d77E
    for verification on the block explorer. Waiting for verification result...
    
    Successfully verified contract BurnMintTokenPool on the block explorer.
    https://testnet.snowtrace.io/address/0x02552EAE370aeb997015dA41398F0a53F693d77E#code
    
    2024-10-08T00:20:19.900Z info: Token pool contract deployed and verified
    
  2. Deploy the burn and mint token pool on Arbitrum Sepolia:

    npx hardhat deployTokenPool --tokenaddress 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 --verifycontract true --network arbitrumSepolia
    

    Example output:

    2024-10-08T00:20:26.228Z info: Waiting 2 blocks for transaction 0x35b0be621896b9d508035873b754dd0c5fb2dca0c728acf3cdcacfeba368da04 to be confirmed...
    2024-10-08T00:20:26.625Z info: Token pool deployed to: 0x41833AE7B0BCa169E090C752021070aC947d1821
    2024-10-08T00:20:26.626Z info: Granting mint and burn roles to 0x41833AE7B0BCa169E090C752021070aC947d1821 on token 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52
    2024-10-08T00:20:29.071Z info: Verifying contract...
    Successfully submitted source code for contract
    @chainlink/contracts-ccip/src/v0.8/ccip/pools/BurnMintTokenPool.sol:BurnMintTokenPool at 0x41833AE7B0BCa169E090C752021070aC947d1821
    for verification on the block explorer. Waiting for verification result...
    
    Successfully verified contract BurnMintTokenPool on the block explorer.
    https://sepolia.arbiscan.io/address/0x41833AE7B0BCa169E090C752021070aC947d1821#code
    
    2024-10-08T00:20:38.456Z info: Token pool contract deployed and verified
    

Claim Admin

In this step, you will use the claimAdmin.ts task to register your EOA as the administrator for the deployed tokens on both testnets, Avalanche Fuji and Arbitrum Sepolia. This process involves calling the RegistryModuleOwnerCustom contract, which will fetch the token owner and set it up as the admin.

Below is an explanation of the parameters used during the admin claim process:

ParameterDescriptionDefaultRequired
tokenaddressThe address of the token for which the admin role is being claimed.N/AYes
withccipadminA flag indicating whether the token contract has a CCIP admin. If false, the token admin is registered using the owner() function.falseNo
networkThe blockchain on which the claim admin process will be executed. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes

Claim the admin role by using the following commands, replacing the token address with the one you deployed in the previous steps:

  1. Claim the admin role on Avalanche Fuji:

    npx hardhat claimAdmin --tokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --withccipadmin false --network avalancheFuji
    

    Example output:

    2024-10-08T00:21:38.765Z info: Current token owner: 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:21:38.766Z info: Claiming admin of 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF via owner() for signer 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:21:45.440Z info: Claimed admin of 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF tx: 0xa867bab10d7744e175b1a270653f1a5b3c718427988b6c4fc3d41105b0d86a04
    
  2. Claim the admin role on Arbitrum Sepolia:

    npx hardhat claimAdmin --tokenaddress 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 --withccipadmin false --network arbitrumSepolia
    

    Example output:

    2024-10-08T00:22:22.067Z info: Current token owner: 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:22:22.069Z info: Claiming admin of 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 via owner() for signer 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:22:25.875Z info: Claimed admin of 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 tx: 0x00520e8d17cb30f05cb6bcb268b62966b26b10a7a77d26579745ed50a7b8e86
    

Accept Admin Role

In this step, you will use the acceptAdminRole.ts task to accept the admin role for the deployed tokens on both testnets, Avalanche Fuji and Arbitrum Sepolia. Once you have claimed the role, accepting the role finalizes your control over the token administration.

Below is an explanation of the parameters used during the admin role acceptance process:

ParameterDescriptionDefaultRequired
tokenaddressThe address of the token for which the admin role is being accepted.N/AYes
networkThe blockchain on which the accept admin process will be executed. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes

Accept the admin role by using the following commands, replacing the token address with the one deployed in the previous steps:

  1. Accept the admin role on Avalanche Fuji:

    npx hardhat acceptAdminRole --tokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --network avalancheFuji
    

    Example output:

    2024-10-08T00:23:13.267Z info: Accepted admin role for token 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF tx: 0x42fe550b01056593458d079b54f689f0f78e01b20974e2b3bbdee4d688547664
    
  2. Accept the admin role on Arbitrum Sepolia:

    npx hardhat acceptAdminRole --tokenaddress 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 --network arbitrumSepolia
    

    Example output:

    2024-10-08T00:23:36.511Z info: Accepted admin role for token 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 tx: 0x37d31f671ab7f9690add28a915cafb539f62d73718fd967c9c14be1c7955e355
    

Set Pool

In this step, you will use the setPool.ts task to link each token with its respective token pool on both testnets.

Below is an explanation of the parameters used during the pool setting process:

ParameterDescriptionDefaultRequired
tokenaddressThe address of the token to be linked to a pool.N/AYes
pooladdressThe address of the pool associated with the token.N/AYes
networkThe blockchain on which the pool setting will be executed. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes

Link each token with its respective token pool by using the following commands, replacing the token and pool addresses with the ones you deployed in the previous steps:

  1. Set the pool for Avalanche Fuji:

    npx hardhat setPool --tokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --pooladdress 0x02552EAE370aeb997015dA41398F0a53F693d77E --network avalancheFuji
    

    Example output:

    2024-10-08T00:25:39.180Z info: Setting pool for token 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0x02552EAE370aeb997015dA41398F0a53F693d77E by 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:25:52.555Z info: Pool set for token 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0x02552EAE370aeb997015dA41398F0a53F693d77E
    
  2. Set the pool for Arbitrum Sepolia:

    npx hardhat setPool --tokenaddress 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 --pooladdress 0x41833AE7B0BCa169E090C752021070aC947d1821 --network arbitrumSepolia
    

    Example output:

    2024-10-08T00:27:02.239Z info: Setting pool for token 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 to 0x41833AE7B0BCa169E090C752021070aC947d1821 by 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T00:27:04.782Z info: Pool set for token 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 to 0x41833AE7B0BCa169E090C752021070aC947d1821
    

Configure Pool

In this step, you will use the applyChainUpdates.ts task to configure the token pools on each blockchain to enable cross-chain transfers between Avalanche Fuji and Arbitrum Sepolia. This involves linking the token pool on one blockchain to a corresponding pool on another blockchain, allowing cross-chain token transfers. You will interact with the TokenPool contract, specifically calling the applyChainUpdates() function to configure the cross-chain parameters and rate limits.

Below is an explanation of the parameters used during the pool configuration process:

ParameterDescriptionDefaultRequired
pooladdressThe address of the token pool being configured.N/AYes
remotechainThe remote blockchain to which this pool will be linked. Examples include avalancheFuji, arbitrumSepolia,baseSepolia, and sepolia.N/AYes
remotepooladdressThe address of the token pool on the remote blockchain.N/AYes
remotetokenaddressThe address of the token on the remote blockchain.N/AYes
outboundratelimitenabledA flag indicating whether to enable outbound rate limits for cross-chain transfers.falseNo
outboundratelimitcapacityThe maximum number of tokens allowed in the bucket for outbound transfers. Note: This parameter is applicable if you enable outbound rate limits.0No
outboundratelimitrateThe number of tokens per second that the bucket is refilled for outbound transfers. Note: This parameter is applicable if you enable outbound rate limits.0No
inboundratelimitenabledA flag indicating whether to enable inbound rate limits for cross-chain transfers.falseNo
inboundratelimitcapacityThe maximum number of tokens allowed in the bucket for inbound transfers. Note: This parameter is applicable if you enable inbound rate limits.0No
inboundratelimitrateThe number of tokens per second that the bucket is refilled for inbound transfers. Note: This parameter is applicable if you enable inbound rate limits.0No

Configure the pools using the following commands, replacing the pool, token, and remote pool addresses with those you deployed in the previous steps:

  1. Configure the pool on Avalanche Fuji:

    npx hardhat applyChainUpdates --pooladdress 0x02552EAE370aeb997015dA41398F0a53F693d77E --remotechain arbitrumSepolia --remotetokenaddress 0xf76a43fBe5fe929acc5F8596cf3BB52102f6eC52 --remotepooladdress 0x41833AE7B0BCa169E090C752021070aC947d1821 --network avalancheFuji
    

    Example output:

    2024-10-08T01:01:35.559Z info: Applying chain update to pool at address: 0x02552EAE370aeb997015dA41398F0a53F693d77E
    2024-10-08T01:01:41.178Z info: Chain update applied successfully
    
  2. Configure the pool on Arbitrum Sepolia:

    npx hardhat applyChainUpdates --pooladdress 0x41833AE7B0BCa169E090C752021070aC947d1821 --remotechain avalancheFuji --remotetokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --remotepooladdress 0x02552EAE370aeb997015dA41398F0a53F693d77E --network arbitrumSepolia
    

    Example output:

    2024-10-08T01:02:38.283Z info: Applying chain update to pool at address: 0x41833AE7B0BCa169E090C752021070aC947d1821
    2024-10-08T01:02:43.476Z info: Chain update applied successfully
    

Mint Tokens

In this step, you will use the mintTokens.ts task to mint tokens on Avalanche Fuji for your Externally Owned Account (EOA). Since you assigned mint and burn privileges to your EOA when deploying the tokens in the first step, you can now mint tokens for testing purposes. This is to ensure that you have enough tokens in your EOA to perform cross-chain transfers in the next step.

You will interact with the BurnMintERC677 token contract, specifically calling the mint() function to mint tokens to your EOA.

Below is an explanation of the parameters used during the minting process:

ParameterDescriptionDefaultRequired
tokenaddressThe address of the token for which tokens are being minted.N/AYes
amountThe amount of tokens to mint (in wei).N/AYes
receiveraddressThe address of the receiver of the minted tokens. If not provided, defaults to your EOA.N/ANo
networkThe blockchain on which the minting process will be executed. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes

Mint tokens to your EOA using the following command, replacing the token address with the one you deployed in the previous steps:

  1. Mint tokens on Avalanche Fuji:

    npx hardhat mintTokens --tokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --amount 1000000000000000000000 --network avalancheFuji
    

    Example output:

    2024-10-08T01:03:35.219Z info: Minting 1000000000000000000000 of BnMaem tokens to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d
    2024-10-08T01:03:40.247Z info: Minted 1000000000000000000000 of BnMaem tokens to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d - transaction hash: 0x27587fb3bae6a002cfee9b83aefe3216a35baac0e611671f774d66d0bd5d427c
    2024-10-08T01:03:40.374Z info: Current balance of 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d is 1000000000000000000000 BnMae
    

Transfer Tokens

In this step, you will use the transferTokens task to transfer tokens from Avalanche Fuji to Arbitrum Sepolia using CCIP. You have two options for paying CCIP fees: using LINK tokens or native gas tokens.

You will interact with the IRouterClient contract, specifically calling the ccipSend() function to initiate the token transfer.

Below is an explanation of the parameters used during the token transfer process:

ParameterDescriptionDefaultRequired
tokenaddressThe address of the token being transferred.N/AYes
amountThe amount of tokens to transfer.N/AYes
destinationchainThe blockchain to which the tokens will be transferred. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes
receiveraddressThe address of the receiver on the destination blockchain.N/AYes
feeThe type of fee used for the transfer, either LINK or native.LINKNo
networkThe blockchain on which the token transfer will be initiated. Examples include avalancheFuji, arbitrumSepolia, baseSepolia, and sepolia.N/AYes

Call the CCIP Router to transfer tokens from Avalanche Fuji to Arbitrum Sepolia, paying the CCIP fees in LINK tokens. Replace the token address, amount, receiver address, and blockchain with the appropriate values:

npx hardhat transferTokens --tokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --amount 100 --destinationchain arbitrumSepolia --receiveraddress 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d --network avalancheFuji

Example output:

2024-10-08T01:04:41.532Z info: Estimated fees: 10188000000000000
2024-10-08T01:04:41.535Z info: Approving 100 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0xf85E941163a8B35F48bD8814227665d82Fd4dd65
2024-10-08T01:04:46.430Z info: Approving 10188000000000000 LINK to 0xf85E941163a8B35F48bD8814227665d82Fd4dd65
2024-10-08T01:04:49.924Z info: Transferring 100 of 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d on chain arbitrumSepolia with 10188000000000000 of LINK as fees
2024-10-08T01:04:53.929Z info: Transaction hash: 0x1cf2c2cfb0f6f7a51d09c445b2c49cec04674bcbae6268a1049ce94dfa222efd
2024-10-08T01:04:53.995Z info: ✅ Transferred 100 of 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d on chain arbitrumSepolia. Transaction hash: 0x1cf2c2cfb0f6f7a51d09c445b2c49cec04674bcbae6268a1049ce94dfa222efd - CCIP message id: 0x635aa40064d2e2d1a4d79e7ad90b77c6e127c3f54b7c7f28bc1d1ed7c3d8f6a1
2024-10-08T01:04:53.995Z info: Check status of message on https://ccip.chain.link/msg/0x635aa40064d2e2d1a4d79e7ad90b77c6e127c3f54b7c7f28bc1d1ed7c3d8f6a1

Pay fees in native gas tokens

Call the CCIP Router to transfer tokens from Avalanche Fuji to Arbitrum Sepolia, paying the CCIP fees in native gas tokens. Replace the token address, amount, receiver address, and blockchain with the appropriate values:

npx hardhat transferTokens --tokenaddress 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF --amount 100 --destinationchain arbitrumSepolia --receiveraddress 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d --fee native --network avalancheFuji

Example output:

2024-10-08T01:05:23.673Z info: Estimated fees: 14586666666666666
2024-10-08T01:05:23.675Z info: Approving 100 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0xf85E941163a8B35F48bD8814227665d82Fd4dd65
2024-10-08T01:05:27.159Z info: Transferring 100 of 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d on chain arbitrumSepolia with 14586666666666666 of native token as fees
2024-10-08T01:05:31.862Z info: Transaction hash: 0x323a24d4cfebeaa9c2f031eb721ea16db1baeb50d514310023995998a0675bff
2024-10-08T01:05:31.920Z info: ✅ Transferred 100 of 0x15A5e7ca5043798F1E1983d048D9600F4752dfcF to 0x45C90FBb5acC1a5c156a401B56Fea55e69E7669d on chain arbitrumSepolia. Transaction hash: 0x323a24d4cfebeaa9c2f031eb721ea16db1baeb50d514310023995998a0675bff - CCIP message id: 0xb6d03ffedec68f1934fca7e64d8535b55464f70c2bdb108b4ec2a26f788c8092
2024-10-08T01:05:31.920Z info: Check status of message on https://ccip.chain.link/msg/0xb6d03ffedec68f1934fca7e64d8535b55464f70c2bdb108b4ec2a26f788c8092

Get the latest Chainlink content straight to your inbox.