I have some questions about the anyswapV5ERC20.sol contract.

First of all, are there some more detailed docs than the guide of andre cronje?

My main question is: How can I set the totalSupply or mint at deployment when I follow this guide (https://andrecronje.medium.com/deploying-your-own-cross-chain-token-101-240420efd0d9)

If I understand the contract right, the minter role is the given mpc address and that which mint/burn depending on the bridge use. But how can I set the initial supply? Is there another way then wrap an existing ERC20 for the anyswap contract without changing the anyswapV5ERC20.sol (like mint in the constructor)?


So basically Andre Cronje is saying that in order to have token compliant with the cross-chain swaps your token must inherit the AnyswapV5ERC20 class from the AnyswapV5ERC20.sol.

contract MyCrossChainERC20 is AnyswapV5ERC20 {
    constructor() AnyswapV5ERC20("Token Name", "Token Symbol", "Decimals", "Address to real erc20 token or zero address", "Vault address") { }

The total supply of the MyCrossChainERC20 is a dynamic value which is increased by the functions:

  1. mint(address to, uint256 amount)
  2. all deposit methods
  3. Swapin(bytes32 txhash, address account, uint256 amount) - this is the cross-chain functionality

Also the totalSupply is decreased by the following functions:

  1. burn(address to, uint256 amount)
  2. all withdraw methods
  3. Swapout(uint256 amount, address bindaddr) - this is the cross-chain functionality

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.