Skip to content

Latest commit

 

History

History
107 lines (58 loc) · 5.89 KB

FAQ.md

File metadata and controls

107 lines (58 loc) · 5.89 KB

FAQ

This FAQ is intended to developers familiar with smart contracts development.

Cross-chain bridge support

With which bridge can the CMTAT be used?

We will analyze the three main bridges: CCIP by Chainlink, LayerZero and AxelarNetwork

Generally, in term of implementation, it depends of the model to handle cross-chain token transfer. There are three main models: Burn & Mint, Lock & Mint, Lock & Unlock

To use one of these models, you must implement in the token the functions required and used by the bridge (typically burn and mint). The model "lock and lock" is a little different from the first two models because it does not in principle require any particular implementation.

For example the interface for CCIP is available here: github.com/smartcontractkit/ccip - ERC20/IBurnMintERC20.sol

Axelar Network has also a similar behavior and requirement to create what they call a custom interchain token: https://docs.axelar.dev/dev/send-tokens/interchain-tokens/create-token#create-a-custom-interchain-token

We haven't done any testing but in principle the functions burnFromand mint are available and compatible with the last CMTAT version, see github.com/CMTA/CMTAT/blob/master/contracts/interfaces/ICCIPToken.sol.

For the public burn function, unfortunately, we currently have a reason argument in the function which is not compatible with bridges because their burn function only have two arguments (account and value): github.com/CMTA/CMTAT - wrapper/core/ERC20BurnModule.sol#L32

Chainlink CCIP

For chainlink, the difficulty is that for the moment only tokens whitelisted by chainlink (e.g USDC) can use the bridge, which is not the case for Axelar Network.

The ERC-20 interface for CCIP is available here: github.com/smartcontractkit/ccip - ERC20/IBurnMintERC20.sol

LayerZero

There are two possibilities to use LayerZero with a CMTAT:

The first one is to add a module inside CMTAT to include the Omnichain Fungible Token (OFT) Standard; see github.com/LayerZero-Labs - OFT.sol

The second possibility is to deploy an OFT Adapter to act as an intermediary lockbox for the token.

More information in LayerZero documentation: [docs.layerzero.network/v2/developers/evm/oft/quickstart](

Toolkit support

Which is the main development tool you use ?

Since the sunset of Truffle by Consensys, we use Hardhat

Regarding Foundry:

  • All our tests are written in Javascript and migrating them to Foundry will require a lot of work

  • The tests for the gasless module (MetaTx) would be difficult to write in Solidity, as Foundry requires, see https://github.com/CMTA/CMTAT/blob/master/test/common/MetaTxModuleCommon.js

  • The OpenZeppelin libraries that we use have their tests mainly written in JavaScript, which provides a good basis for our tests

Do you plan to fully support Foundry in the near future?

For the foreseeable future, we plan to keep Hardhat as the main development and testing suite.

Can Truffle be used to run tests?

No. Since the version v.2.31 and the use of custom errors, the tests no longer work with Truffle.

You can only run the tests with Hardhat.

Modules

What is the reason the Snapshot module wasn't audited in version v2.3.0?

This module was left out of scope because it is not used yet (and not included in a default deployment) and will be subject to changes soon.

What is the status of ERC1404 compatibility?

We have not planned to be fully compatible with ERC1404 (which, in fact, is only an EIP at the time of writing). CMTAT includes the two functions defind by ERC1404, namely detectTransferRestriction and messageForTransferRestriction. Thus CMTAT can provide the same functionality as ERC1404.

However, from a pure technical perspective, CMTAT is not fully compliant with the ERC1404 specification, due the way it inherits the ERC20 interface.

Is the Validation module optional?

Generally, for a CMTAT token, the Validation functionality is optional from the legal perspective (please contact admin@cmta.ch for detailed information).

However, in order to use the functions from the Pause and Enforcement modules, our CMTAT implementation requires the Validation module. Therefore, the Validation module is effectively required in this implementation.

If you remove the Validation module and want to use the Pause or the Enforcement module, you have to call the functions of modules inside the main contracts. It was initially the case but we have changed this behavior when addressing an issue reported by a security audit. Here is an old version:

require(!paused(), "CMTAT: token transfer while paused");
, and the relevant Pull Request.

Documentation

What is the code coverage of the test suite?

A code coverage report is available.

Normally, you can run the test suite and generate a code coverage report with npx hardhat coverage.

Please clone the repository and open the file inside your browser.