Multichain
  • Getting Started
    • Introduction
      • Supported Chains
      • Supported Tokens
    • How it works
      • Cross-Chain Bridge
      • Cross-Chain Router
    • Governance Token
      • VeMulti
      • How to Convert ANY to MULTI
    • Security
      • Security model
      • Bug bounty (Immunefi)
      • Bug bounty (alternative)
    • How to Use
      • Fees
    • Road Map
    • FAQ
    • Careers
      • Front-end developer
      • Back-end developer
      • Test Engineer
      • Test Development Engineer
      • Security Engineer (Code Auditing)
      • Blockchain Development Engineer
      • Senior Content Editor
      • Event Manager
  • Listing and Integration
    • Token Listing
      • ERC20 Cross-chain Options
      • Difference between V2&V3
    • Chain Integration
      • EVM Networks Integration
      • Non-EVM Networks Integration
    • FAQ
  • Developer Guide
    • How to Integrate Front-end Router
    • Bridge API (Token list/Tx Status)
    • Scan API (Tx Status/Account History)
    • Token Router Testnet
    • anyCall V7
      • How to integrate anyCall V7?
      • API/Explorer
      • Quickstart (Cross-chain text example)
      • Estimate Fee/Pay Fees on destination chain
    • anyCall V6
      • How to integrate anyCall V6?
      • anyFallback
      • anyCall V6 Testnet Environments
      • Fees Paid on Source Chain
      • Context (Verify msg.sender)
    • $USDC CCTP X anyCall
      • Contract Addresses and example
    • anyCall NFT Bridge
    • Permissionless Token bridging
    • How to develop under Anyswap ERC20 standards
    • Bridge funds and anyCall (Router V7)
      • Mainnet
      • Testnet (Quick Start Example)
    • How to Integrate Front-end Bridges
Powered by GitBook
On this page
  • 1. Token Contract: Deploy tokens compatible with anyswaperc20 standards. Refer to the guide below:
  • 2. Bridge Contract: Deploy your own bridge contract that uses anyCall to pass messages cross-chain.
  • 3. Set Minters for your token
  • 4. Set Token peers and Client peers on your Bridge Contract
  • 4. Issue cross-chain bridge tx
  • 5 . User Interface
  1. Developer Guide

Permissionless Token bridging

PreviousanyCall NFT BridgeNextHow to develop under Anyswap ERC20 standards

Last updated 2 years ago

Permissionless bridging is easy with anyCall. Anyone can deploy a working bridge for any tokens in minutes.

When users bridge, the tokens are burnt on the source chain and you use anyCall to pass a message cross-chain to mint the same amount of tokens on the destination chain.

The following instructions would be partnered with examples. We would showcase this with a permissionless bridge from fantom testnet to rinkeby.

1. Token Contract: Deploy tokens compatible with anyswaperc20 standards. Refer to the guide below:

Example:

Fantom Testnet
Rinkeby

Erc20 address

2. Bridge Contract: Deploy your own bridge contract that uses anyCall to pass messages cross-chain.

Fork the following contract and constructor arguments should be anycall contract address and admin address.

Callproxy should be set to anycall contract address. This information can be found here:

Example:

Fantom Testnet
Rinkeby

Bridge Contract address

3. Set Minters for your token

Minting and burning rights need to be given on both the destination and source chain:

a. Bridge Contract: Your bridge contract will be burning and minting tokens in the bridge process.

The default anyerc20 implementation contains a timelock, you have to call applyMinter after timelock is finished.

Example:

Fantom Testnet
Rinkeby

Give Minter to Bridge Contract

4. Set Token peers and Client peers on your Bridge Contract

Client peers: setClientPeers(uint256[] _chainIds, address[] _peers) This stores information of the destination chain bridge contract address to issue anycall on the correct destination contracts.

Token peers: setTokenPeers(address srcToken, uint256[] chainIds, address[] dstTokens) This stores information of destination chain token address. This makes sure the right token is interacted.

Example:

Fantom Testnet
Rinkeby

Set Client Peers

Set Token Peers

4. Issue cross-chain bridge tx

This is an example of the bridge process in production. We are bridging from fantom testnet to rinkeby.

The fantom testnet tx is done with flags 2 as the argument and the tx was sent with some ftm as msg.value. This means we would cover the gas fee of destination chain execution on the source chain.

Fantom Testnet
Rinkeby

Step 1: Swapout (Bridge out/Burn the tokens)

Step 2: AnyExec (Bridge In/Mint the tokens)

5 . User Interface

After you build out the permissionless bridge, you can host the frontend on your ui or apply to be included on our website. If you wish to be listed on our website, please contact our team through this email: contact@multichain.org.

How to integrate anyCall V6?
https://testnet.ftmscan.com/address/0x8b38492ebb4f36564dd72e5583fa233a3fbf12cc#code
https://rinkeby.etherscan.io/address/0x8f9ad58819cb11036d5ff69d0e1a6392f9e9172a
https://testnet.ftmscan.com/address/0xad4791B8813620185699035F7DEC3cbDb8e39e2d
https://rinkeby.etherscan.io/address/0xc29d6110f18b1d03c75e8756617e7d0a5f5f9d70#code
https://testnet.ftmscan.com/tx/0x9264cdd77d043711a32fc2ed393f6474151244952905750a24508b2b79034a3e
https://rinkeby.etherscan.io/tx/0x85f03d4875a8f9daf214a3b522c3af83c9b9ce3a09a4a4ac44210dd46b41d69e
https://testnet.ftmscan.com/tx/0x817613572e8264f8a522a5461b959f45908e7f93387b6f086e1abadc9b29b2a4
https://rinkeby.etherscan.io/tx/0xc473a68d1e07b314a25a867a66ad70d20651dc19bbef0df2bb305e29a49222da
https://testnet.ftmscan.com/tx/0x41e4de809cf6619feb788adb920d384677223fb59cf71b1119c5df0cd3d6e510
https://rinkeby.etherscan.io/tx/0x3e89112a47a5f33db37cdb7ebe0e572fb5988da50ff0e7ab409b4be926da6391
https://testnet.ftmscan.com/tx/0x2b392d8b8fe72ec119bbd5a172c091521d5b509ea7208f64bd65922a45f69b90
https://rinkeby.etherscan.io/tx/0x2368cf7fe5a9c3f0d4aec9bd129155c22565430d9dbb0d7757cfedec77cadf51
How to develop under Anyswap ERC20 standards
Logomultichain-smart-contracts/AnyswapTokenAnycallClient.sol at main · anyswap/multichain-smart-contractsGitHub