Skip to main content

Use Case to bridge ERC20 Tokens by directly interacting with the contracts

Description We will be using a blockchain explorer (e.g., Etherscan) as an example to demonstrate how to interact with the smart contracts for bridging ERC20 tokens from one EVM compatible chain to another compatible chain.

Preconditions

  • You must have a wallet (MetaMask, WalletConnect, etc.).
  • You must have ERC20 tokens and sufficient funds to pay gas fees.

Steps

  1. Go to Supported Networks and copy the address of the ERC20Router.

  2. Go to the Blockchain Explorer (e.g., Etherscan).

  3. Enter the ERC20Router address in the search bar.

  4. Connect your MetaMask wallet (or use WalletConnect, etc.).

  5. Navigate to the "Contract" tab of the smart contract and then to the "Write as Proxy" tab.

  6. Select the function egress.

  7. Fill in the required fields:

    • egress: Enter the amount of Ether (payableAmount) you want to send.
    • targetChainId_: Enter the ID of the target chain (e.g., 1 for Ethereum).
    • feeToken_: Enter the address of the token used to pay the fee.
    • token_: Enter the address of the ERC20 token you want to transfer.
    • amount_: Enter the amount of the ERC20 token you want to transfer.
    • receiver_: Enter the receiver's address in bytes.
    • deliveryFeeData_: Enter the tuple containing the following:
      • fee: Enter the fee amount in uint256.
      • expiry: Enter the expiry time in uint256.
      • signature: Enter the signature in bytes.
  8. Verify and Confirm:

    • Double-check all the entered information to ensure it's correct.
    • Click on the "Write" button to initiate the transaction.
  9. Approve the Transaction:

    • Your wallet will prompt you to approve the transaction.
    • Confirm the transaction and pay the gas fees.
  10. Wait for Confirmation:

  • The transaction will be processed on the network.
  • Once confirmed, the tokens will be locked on the source chain, and an equivalent will be generated on the destination chain.
  1. Check the Status:
  • You can check the status of the transaction on the Blockchain Explorer by entering the transaction ID in the search bar.

Notes If the provider is not configured to do the automatic claim of the message on the target chain, an extra step will be required to execute the deliver manually. This step will vary depending on the actual bridge provider that is used.

Postconditions

  • The ERC20 tokens are locked on the source chain.
  • Equivalent tokens are issued on the destination chain.