×

注意!页面内容来自https://docs.multichain.org/developer-guide/permissionless-token-bridging,本站不储存任何内容,为了更好的阅读体验进行在线解析,若有广告出现,请及时反馈。若您觉得侵犯了您的利益,请通知我们进行删除,然后访问 原网页

Permissionless Token bridging

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

When users bridgethe 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:

How to develop under Anyswap ERC20 standards

Example:

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:

How to integrate anyCall V6?

Example:

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 timelockyou have to call applyMinter after timelock is finished.

Example:

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

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

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

Example:

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.

5 . User Interface

After you build out the permissionless bridgeyou can host the frontend on your ui or apply to be included on our website. If you wish to be listed on our websiteplease contact our team through this email: [email protected].

Last updated