Contract Interface

Contract Specification

Here’s what you need to implement to get started:

interface ITAI {
  event BridgeLimitsSet(uint256 _mintingLimit, uint256 _burningLimit, address indexed _bridge);
  error IXERC20_NotHighEnoughLimits();

  struct BridgeParameters {
    uint256 timestamp;
    uint256 ratePerSecond;
    uint256 maxLimit;
    uint256 currentLimit;
  }

  struct Bridge {
    BridgeParameters minterParams;
    BridgeParameters burnerParams;
  }

  function setLimits(address _bridge, uint256 _mintingLimit, uint256 _burningLimit) external;
  function mintingMaxLimitOf(address _bridge) external view returns (uint256 _limit);
  function burningMaxLimitOf(address _bridge) external view returns (uint256 _limit);
  function mintingCurrentLimitOf(address _bridge) external view returns (uint256 _limit);
  function burningCurrentLimitOf(address _bridge) external view returns (uint256 _limit);
  function mint(address _user, uint256 _amount) external;
  function burn(address _user, uint256 _amount) external;
}

Requirements:

  • mint should only proceed if the current limit is enough for the amount being minted, and it should reduce the limit accordingly.

  • burn functions the same way, ensuring the limit is sufficient before proceeding and then reducing it.

All ICrosschainERC20 tokens should also support the standard ERC-20 functions but are not required to fully support ERC777.

Example Implementation

Here’s a basic contract setup:

Last updated