Skip to content

Commit

Permalink
Update doc, small code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Sep 10, 2024
1 parent 8ba25e7 commit f71f425
Show file tree
Hide file tree
Showing 42 changed files with 6,940 additions and 6,177 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

Please follow <https://changelog.md/> conventions.

## 2.5.0

- Change Solidity version to 0.8.27 (latest)
- Small improvement in documentation

## 2.5.0-rc.0 - 20240809

Expand Down
34 changes: 34 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,40 @@
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](https://chain.link/cross-chain) by Chainlink, [LayerZero](https://layerzero.network) and [AxelarNetwork](https://www.axelar.network)

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](https://github.com/smartcontractkit/ccip/blob/948882675ad1c6604d4b911071fc3881148abe66/contracts/src/v0.8/shared/token/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 `burnFrom`and `mint` are available and compatible with the last CMTAT version, see [github.com/CMTA/CMTAT/blob/master/contracts/interfaces/ICCIPToken.sol](https://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](https://github.com/CMTA/CMTAT/blob/master/contracts/modules/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](https://github.com/smartcontractkit/ccip/blob/948882675ad1c6604d4b911071fc3881148abe66/contracts/src/v0.8/shared/token/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](https://github.com/LayerZero-Labs/LayerZero-v2/blob/main/packages/layerzero-v2/evm/oapp/contracts/oft/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 ?
Expand Down
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# CMTA Token

> To use the CMTAT, we recommend the latest audited version, from the [Releases](https://github.com/CMTA/CMTAT/releases) page. Currently, it is the version [v2.3.0](https://github.com/CMTA/CMTAT/releases/tag/v2.3.0)
Expand Down Expand Up @@ -113,9 +111,9 @@ Generally, these modules are not required to be compliant with the CMTA specific
| Name | Documentation | Main File |
| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| MetaTxModule | [metatx.md](doc/modules/presentation/extensions/metatx.md) | [MetaTxModule.sol](./contracts/modules/wrapper/extensions/MetaTxModule.sol) |
| SnapshotModule | [snapshot.md](doc/modules/presentation/extensions/snapshot.md) | [SnapshotModule.sol](./contracts/modules/wrapper/extensions/SnapshotModule.sol) |
| DebtModule | <Todo> | [DebtModule.sol](./contracts/modules/wrapper/extensions/DebtModule.sol) |
| DocumentModue | <Todo> | [Document.sol](./contracts/modules/wrapper/extensions/DocumentModule.sol) |
| SnapshotModule | [snapshot.md](doc/modules/presentation/extensions/snapshot.md) | [ERC20SnapshotModule.sol](./contracts/modules/wrapper/extensions/ERC20SnapshotModule.sol) |
| DebtModule | [debt.md](doc/modules/presentation/extensions/debt.md) | [DebtModule.sol](./contracts/modules/wrapper/extensions/DebtModule.sol) |
| DocumentModue | [document.md](doc/modules/presentation/extensions/document.md) | [Document.sol](./contracts/modules/wrapper/extensions/DocumentModule.sol) |

##### Security

Expand All @@ -139,7 +137,7 @@ The `RuleEngine` is an external contract used to apply transfer restriction to t

This contract is defined in the `ValidationModule`.

An example of RuleEngine is also available on [Github](https://github.com/CMTA/RuleEngine).
An example of RuleEngine is also available on [GitHub](https://github.com/CMTA/RuleEngine).

Here is the list of the different version available for each CMTAT version.

Expand All @@ -164,6 +162,8 @@ Before each transfer, the CMTAT calls the function `operateOnTransfer` which is

#### AuthorizationEngine

> Warning: this engine may be deleted in the future
The `AuthorizationEngine` is an external contract to add supplementary check on the functions `grantRole` and `revokeRole`from the CMTAT.

This contract is managed in the `AuthorizationModule`.
Expand All @@ -190,7 +190,11 @@ Use an external contract provides two advantages:
- Reduce code size of CMTAT, which is near of the maximal size limit
- Allow to manage this information for several different tokens (CMTAT or not).

Currently, there is no implementation of a DebtEngine available
Here is the list of the different version available for each CMTAT version.

| Name | DebtEngine |
| ------------------------ | ------------------------------------------------------------ |
| CMTAT v2.5.0 (unaudited) | [DebtEngine v0.2.0](https://github.com/CMTA/DebtEngine/releases/tag/v0.2.0) |

#### DocumentEngine (IERC-1643)

Expand Down Expand Up @@ -218,14 +222,18 @@ Use an external contract provides two advantages:
- Reduce code size of CMTAT, which is near of the maximal size limit
- Allow to manage documents for several different tokens (CMTAT or not).

Currently, there is no implementation of a DocumentEngine available
Here is the list of the different version available for each CMTAT version.

| Name | DocumentEngine |
| ------------------------ | ------------------------------------------------------------ |
| CMTAT v2.5.0 (unaudited) | [DocumentEngine v0.3.0](https://github.com/CMTA/DocumentEngine/releases/tag/v0.3.0) |

## Deployment model

| Model | Contract |
| --------------------------- | ---------------------------------------------------- |
| Standalone | [CMTAT_STANDALONE](./contracts/CMTAT_STANDALONE.sol) |
| Transparent ou Beacon Proxy | [CMTAT_PROXY](./contracts/CMTAT_PROXY.sol) |
| Transparent or Beacon Proxy | [CMTAT_PROXY](./contracts/CMTAT_PROXY.sol) |
| UUPS Proxy | [CMTAT_PROXY_UUPS](./contracts/CMTAT_PROXY_UUPS.sol) |


Expand All @@ -247,8 +255,6 @@ Please see the OpenZeppelin [Upgrades plugins](https://docs.openzeppelin.com/upg

Note that deployment via a proxy is not mandatory, but is recommended by CMTA.



### Factory

Factory contracts are available to deploy the CMTAT with a beacon proxy, a transparent proxy or an UUPS proxy.
Expand Down Expand Up @@ -358,11 +364,14 @@ CMTA providers further documentation describing the CMTAT framework in a platfor
- [Taurus - Security Token Standards: A Closer Look at CMTAT](https://www.taurushq.com/blog/security-token-standards-a-closer-look-at-cmtat/)
- [Taurus - Equity Tokenization: How to Pay Dividend On-Chain Using CMTAT](https://www.taurushq.com/blog/equity-tokenization-how-to-pay-dividend-on-chain-using-cmtat/)
- [Taurus - Token Transfer Management: How to Apply Restrictions with CMTAT and ERC-1404](https://www.taurushq.com/blog/token-transfer-management-how-to-apply-restrictions-with-cmtat-and-erc-1404/)
- [Taurus - Addressing the Privacy and Compliance Challenge in Public Blockchain Token Transactions](https://www.taurushq.com/blog/enhancing-token-transaction-privacy-on-public-blockchains-while-ensuring-compliance/)

## Others implementations
Two versions are available for the blockchain [Tezos](https://tezos.com)
- [CMTAT FA2](https://github.com/CMTA/CMTAT-Tezos-FA2) Official version written in SmartPy
- [@ligo/cmtat](https://github.com/ligolang/CMTAT-Ligo/) Unofficial version written in Ligo
- See also [Tokenization of securities on Tezos by Frank Hillard](https://medium.com/@frank.hillard_62931/tokenization-of-securities-on-tezos-2e3c3e90fc5a)


## Contract size

Expand Down
3 changes: 1 addition & 2 deletions contracts/deployment/CMTAT_BEACON_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";

import '@openzeppelin/contracts/utils/Create2.sol';
import '@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol';
import "../CMTAT_PROXY.sol";
import "../modules/CMTAT_BASE.sol";
import "./libraries/CMTATFactoryRoot.sol";


Expand Down
1 change: 0 additions & 1 deletion contracts/deployment/CMTAT_TP_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "../CMTAT_PROXY.sol";
import "../libraries/FactoryErrors.sol";
import '@openzeppelin/contracts/utils/Create2.sol';
import "./libraries/CMTATFactoryInvariant.sol";
import "./libraries/CMTATFactoryBase.sol";
Expand Down
2 changes: 0 additions & 2 deletions contracts/deployment/CMTAT_UUPS_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "../CMTAT_PROXY_UUPS.sol";
import "../libraries/FactoryErrors.sol";
import '@openzeppelin/contracts/utils/Create2.sol';
import '@openzeppelin/contracts/access/AccessControl.sol';
import "./libraries/CMTATFactoryInvariant.sol";
import "./libraries/CMTATFactoryBase.sol";
/**
Expand Down
1 change: 0 additions & 1 deletion contracts/deployment/libraries/CMTATFactoryBase.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "./CMTATFactoryRoot.sol";

/**
Expand Down
5 changes: 1 addition & 4 deletions contracts/deployment/libraries/CMTATFactoryRoot.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "../../CMTAT_PROXY.sol";
import "../../libraries/FactoryErrors.sol";
import '@openzeppelin/contracts/utils/Create2.sol';
import '@openzeppelin/contracts/access/AccessControl.sol';
import "./CMTATFactoryInvariant.sol";
/**
Expand All @@ -15,7 +12,7 @@ abstract contract CMTATFactoryRoot is AccessControl, CMTATFactoryInvariant {
/* ============ State Variables ============ */
// Public
address[] public cmtatsList;
bool public useCustomSalt;
bool immutable public useCustomSalt;
uint256 public cmtatCounterId;
/// mapping
mapping(uint256 => address) internal cmtats;
Expand Down
3 changes: 0 additions & 3 deletions contracts/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ library Errors {
// DebtModule
error CMTAT_DebtModule_SameValue();

// BaseModule
error CMTAT_BaseModule_SameValue();

// ValidationModule
error CMTAT_ValidationModule_SameValue();

Expand Down
2 changes: 0 additions & 2 deletions contracts/modules/wrapper/core/BaseModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

pragma solidity ^0.8.20;

// required OZ imports here
import "../../security/AuthorizationModule.sol";
import "../../../libraries/Errors.sol";

abstract contract BaseModule is AuthorizationModule {
/* ============ State Variables ============ */
Expand Down
Loading

0 comments on commit f71f425

Please sign in to comment.