Deploying your own cross-chain token 101

Readme

connext/chaindata

Prerequisites

Step 1: Fork AnyswapV4ERC20 and implement any additional functionality as required.

AnyswapV4ERC20 supports the following

  • ERC2612 (Adds permit)
  • ERC677 (Adds approveAndCall and transferAndCall)
  • transferWithPermit
  • Verify EIP712 and Verify personalSign

AnyswapV4ERC20 needs to support mint, burn, Swapin, and Swapout to be compatible with multiple bridges.

Multichain MPC address (detailed below) should be set via initVault(address _vault)

Step 1.1: I already deployed my token

Deploy a wrapper for your token that supports mint, burn, Swapin, and Swapout, add this wrapper as a minter role in the ACL. In the wrapper add the MPC address (found below) as a minter

Step 2: Deploy AnyswapV4ERC20 via AnyswapCREATE2

AnyswapCREATE2 is available on Ethereum, Fantom, Binance Smart Chain, xDAI, and Matic. More deployments to follow

Address: 0x54f5a04417e29ff5d7141a6d33cb286f50d5d50e

Edit lines 39 to 55

  • provider ~ choose from provider list for the chain
  • privateKey ~ address being used to deploy with
  • mpcAddress ~ address for MPC address on given chain
  • constructorArgs ~ token details (Token Name, Symbol, Decimals, Underlying token (optional))
  • verifyURL (optional) if you want to programmatically verify via etherscan/ftmscan/bscscan api
  • verifykey (optional) key to be used to verify via etherscan/ftmscan/bscscan

Deploy with the same code and salt to all the chains you wish to have your token on.

**NOTE** if you prefer to manually deploy, be sure to immediately call initVault(address _mpc) on the contract, as the default owner should be set to the deployer so the code matches on all deployments. Not even the constructor arguments should change on cross-chain deployments

Step 3: Verify your contract on each individual chain (optional if deploy.js was not used)

Verify via;

Step 4: Create a PR for your token into the token registry

Clone the connext/chaindata repo and submit a PR to chains.json with the following format;

If you are not sure on the chainID, you can confirm them on chainid.network

Once the PR is accepted, the token will be merged and become available on multichain.xyz

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store