How to develop under Anyswap ERC20 standards

This article would help you develop and deploy your own tokens compatible with our bridge

Compaitibility requirements:

In order to be compaitible with our router, your token needs to have the following functions:

  1. Mint function

function mint(address to, uint256 amount) external onlyAuth returns (bool) {
        _mint(to, amount);
        return true;

2. Burn Function

function burn(address from, uint256 amount) external onlyAuth returns (bool) {
        require(from != address(0), "AnyswapV3ERC20: address(0x0)");
        _burn(from, amount);
        return true;

3. underlying variable. For our frontend to recognize your token. This should be set as address (0) if your token natively supports our system.

address public immutable underlying;

Development Methods

If your token is completely new/new on certain chains:

Forking our template is the easiest way to develop with our standards. The template is linked below and it includes backward compatibility with our older system as well. Simply fork the contract and set the underlying as address(0)

In most cases, our team can deploy the standard contracts on any chains for you. This guide is specifically for projects who want to implement custom methods or properties in their cross-chain tokens.

Here is another guide if you wish to use create2, however this is limited to Ethereum, Fantom, Binance Smart Chain, xDAI, and Polygon.

Commonly asked questions:

1. Which router address should I give minting right to?

Our team will provide the most up-to-date router address for you to give minting right to. This information will be more available through apis in the future.

2. Who do I set as owner for the token?

You can simply set your project admin as owner.

3. There are a lot of functions in AnyswapV6ERC20. Which ones can I safely remove?

For router to work, the most important things we need are minting right and burning right. Please ensure our routers can mint and burn tokens. Other functions can be safely removed, they're there to be backward compatible with the bridge V2 system.

We also need underlying as a variable for our frontend to work.

4. What do I set as vault, underlying?

Vault is the same as the owner for the token, you can simply set it as your own address. Underlying is used when your token employs a wrapper or liquidity model, if your token is supporting our system natively. Simply set underlying as address(0)

Last updated