Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Nov 10, 2023
1 parent 90e1981 commit d03ee9d
Show file tree
Hide file tree
Showing 36 changed files with 1,219 additions and 1,176 deletions.
2 changes: 1 addition & 1 deletion contracts/modules/CMTAT_BASE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ abstract contract CMTAT_BASE is
__ERC20MintModule_init_unchained();
// EnforcementModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__EnforcementModule_init_unchained();
__ERC20Module_init_unchained(decimalsIrrevocable);
__ERC20BaseModule_init_unchained(decimalsIrrevocable);
// PauseModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__PauseModule_init_unchained();
__ValidationModule_init_unchained();
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/wrapper/core/ERC20BaseModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract contract ERC20BaseModule is ERC20Upgradeable {
* this value is immutable: it can only be set once during
* construction/initialization.
*/
function __ERC20Module_init_unchained(
function __ERC20BaseModule_init_unchained(
uint8 decimals_
) internal onlyInitializing {
_decimals = decimals_;
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/CMTATSnapshot/CMTAT_BASE_SnapshotTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ abstract contract CMTAT_BASE_SnapshotTest is
__ERC20MintModule_init_unchained();
// EnforcementModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__EnforcementModule_init_unchained();
__ERC20Module_init_unchained(decimalsIrrevocable);
__ERC20BaseModule_init_unchained(decimalsIrrevocable);
// PauseModule_init_unchained is called before ValidationModule_init_unchained due to inheritance
__PauseModule_init_unchained();
__ValidationModule_init_unchained();
Expand Down
31 changes: 31 additions & 0 deletions doc/general/Proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Proxy

This documents explains some details about the proxy architecture


## Initialize function

For wrapper modules, we have removed the public function `{ContractName}_init`to reduce the size of the contracts since inside the public initializer function to initialize your proxy, you have to call the difference functions `__{ContractName}_init_unchained`.

Do not forget to call the functions `init_unchained` from the parent initializer if you create your own contract from the different modules.

As indicated in the [OpenZeppelin documentation](https://docs.openzeppelin.com/contracts/5.x/upgradeable#multiple-inheritance):

> Initializer functions are not linearized by the compiler like constructors. Because of this, each `__{ContractName}_init` function embeds the linearized calls to all parent initializers. As a consequence, calling two of these `init` functions can potentially initialize the same contract twice.
>
> The function `__{ContractName}_init_unchained` found in every contract is the initializer function minus the calls to parent initializers, and can be used to avoid the double initialization problem, but doing this manually is not recommended. We hope to be able to implement safety checks for this in future versions of the Upgrades Plugins.
## Deployment with a proxy

The CMTAT supports deployment via a proxy contract. Furthermore, using a proxy permits to upgrade the contract, using a standard proxy upgrade pattern.

The contract version to use as an implementation is the `CMTAT_PROXY`.

Please see the OpenZeppelin [upgradeable contracts documentation](https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable) for more information about the proxy requirements applied to the contract.

Please see the OpenZeppelin [Upgrades plugins](https://docs.openzeppelin.com/upgrades-plugins/1.x/) for more information about plugin upgrades in general.

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


###
Binary file modified doc/general/contract-size.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions doc/modules/presentation/controllers/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ This document defines the Validation Module for the CMTA Token specification. Th
#### Files Description Table


| File Name | SHA-1 Hash |
| ------------------------------------------------- | ---------------------------------------- |
| ./modules/wrapper/controller/ValidationModule.sol | 109054150a46ef0f010693889f9c1c44e151719b |
| File Name | SHA-1 Hash |
| -------------------------------------------------- | ---------------------------------------- |
| ./modules/wrapper/controllers/ValidationModule.sol | 109054150a46ef0f010693889f9c1c44e151719b |


#### Contracts Description Table
Expand Down
1 change: 0 additions & 1 deletion doc/modules/presentation/core/ERC20Burn.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ This document defines the ERC20Burn Module for the CMTA Token specification.
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **ERC20BurnModule** | Implementation | ERC20Upgradeable, AuthorizationModule | | |
|| __ERC20BurnModule_init | Internal 🔒 | 🛑 | onlyInitializing |
|| __ERC20BurnModule_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| forceBurn | Public ❗️ | 🛑 | onlyRole |
|| forceBurnBatch | Public ❗️ | 🛑 | onlyRole |
Expand Down
1 change: 0 additions & 1 deletion doc/modules/presentation/core/ERC20Mint.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ This document defines ERC20Mint Module for the CMTA Token specification.
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **ERC20MintModule** | Implementation | ERC20Upgradeable, AuthorizationModule | | |
|| __ERC20MintModule_init | Internal 🔒 | 🛑 | onlyInitializing |
|| __ERC20MintModule_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| mint | Public ❗️ | 🛑 | onlyRole |
|| mintBatch | Public ❗️ | 🛑 | onlyRole |
Expand Down
21 changes: 10 additions & 11 deletions doc/modules/presentation/core/ERC20base.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ The ERC20Base Module sets forth the ERC20 basic functionalities a token must hav
### Contracts Description Table


| Contract | Type | Bases | | |
| :-----------------: | :--------------------------: | :--------------: | :------------: | :--------------: |
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **ERC20BaseModule** | Implementation | ERC20Upgradeable | | |
|| __ERC20Module_init | Internal 🔒 | 🛑 | onlyInitializing |
|| __ERC20Module_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| decimals | Public ❗️ | | NO❗️ |
|| transferBatch | Public ❗️ | 🛑 | NO❗️ |
|| transferFrom | Public ❗️ | 🛑 | NO❗️ |
|| approve | Public ❗️ | 🛑 | NO❗️ |
| Contract | Type | Bases | | |
| :-----------------: | :------------------------------: | :--------------: | :------------: | :--------------: |
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **ERC20BaseModule** | Implementation | ERC20Upgradeable | | |
|| __ERC20BaseModule_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| decimals | Public ❗️ | | NO❗️ |
|| transferBatch | Public ❗️ | 🛑 | NO❗️ |
|| transferFrom | Public ❗️ | 🛑 | NO❗️ |
|| approve | Public ❗️ | 🛑 | NO❗️ |

### Legend

Expand Down
1 change: 0 additions & 1 deletion doc/modules/presentation/core/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ This document defines Base Module for the CMTA Token specification.
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **BaseModule** | Implementation | AuthorizationModule | | |
|| __Base_init | Internal 🔒 | 🛑 | onlyInitializing |
|| __Base_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| setTokenId | Public ❗️ | 🛑 | onlyRole |
|| setTerms | Public ❗️ | 🛑 | onlyRole |
Expand Down
1 change: 0 additions & 1 deletion doc/modules/presentation/core/enforcement.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ This document defines Enforcement Module for the CMTA Token specification.
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **EnforcementModule** | Implementation | EnforcementModuleInternal, AuthorizationModule | | |
|| __EnforcementModule_init | Internal 🔒 | 🛑 | onlyInitializing |
|| __EnforcementModule_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| freeze | Public ❗️ | 🛑 | onlyRole |
|| unfreeze | Public ❗️ | 🛑 | onlyRole |
Expand Down
1 change: 0 additions & 1 deletion doc/modules/presentation/core/pause.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ This document defines the Pause Module for the CMTA Token specification.
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **PauseModule** | Implementation | PausableUpgradeable, AuthorizationModule | | |
|| __PauseModule_init | Internal 🔒 | 🛑 | onlyInitializing |
|| __PauseModule_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| pause | Public ❗️ | 🛑 | onlyRole |
|| unpause | Public ❗️ | 🛑 | onlyRole |
Expand Down
25 changes: 13 additions & 12 deletions doc/modules/presentation/extensions/Debt/creditEvents.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,24 @@ This document defines CreditEvents Module for the CMTA Token specification.
### Files Description Table


| File Name | SHA-1 Hash |
| ------------------------------------------ | ---------------------------------------- |
| ./modules/security/AuthorizationModule.sol | 652daabbe1ec856e47690c07206fe785f2c4ae8f |
| File Name | SHA-1 Hash |
| ------------------------------------------------------------ | ---------------------------------------- |
| ./modules/wrapper/extensions/DebtModule/CreditEventsModule.sol | 166aee930aee560044280eb305ebb8a477fc9c49 |


### Contracts Description Table


| Contract | Type | Bases | | |
| :---------------------: | :----------------------------------: | :---------------------------------------: | :------------: | :--------------: |
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **AuthorizationModule** | Implementation | AccessControlDefaultAdminRulesUpgradeable | | |
|| __AuthorizationModule_init | Internal 🔒 | 🛑 | onlyInitializing |
|| __AuthorizationModule_init_unchained | Internal 🔒 | | onlyInitializing |
|| hasRole | Public ❗️ | | NO❗️ |
|| transferAdminshipDirectly | Public ❗️ | 🛑 | onlyRole |
| Contract | Type | Bases | | |
| :--------------------: | :---------------------------: | :----------------------------------------------------------: | :------------: | :--------------: |
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **CreditEventsModule** | Implementation | IDebtGlobal, Initializable, ContextUpgradeable, AuthorizationModule | | |
|| __CreditEvents_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| setCreditEvents | Public ❗️ | 🛑 | onlyRole |
|| setFlagDefault | Public ❗️ | 🛑 | onlyRole |
|| setFlagRedeemed | Public ❗️ | 🛑 | onlyRole |
|| setRating | Public ❗️ | 🛑 | onlyRole |


### Legend
Expand Down
39 changes: 39 additions & 0 deletions doc/modules/presentation/extensions/Debt/debtBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,46 @@ This document defines DebtBase Module for the CMTA Token specification.

![surya_graph_DebtBaseModule.sol](../../../../schema/surya_graph/surya_graph_DebtBaseModule.sol.png)

## Sūrya's Description Report

### Files Description Table


| File Name | SHA-1 Hash |
| ---------------------------------------------------------- | ---------------------------------------- |
| ./modules/wrapper/extensions/DebtModule/DebtBaseModule.sol | c01d4bc33e2e5531cf1a9800eff532a38f07b674 |


### Contracts Description Table


| Contract | Type | Bases | | |
| :----------------: | :-----------------------------: | :----------------------------------------------------------: | :------------: | :--------------: |
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
| | | | | |
| **DebtBaseModule** | Implementation | IDebtGlobal, Initializable, ContextUpgradeable, AuthorizationModule | | |
|| __DebtBaseModule_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| setDebt | Public ❗️ | 🛑 | onlyRole |
|| setInterestRate | Public ❗️ | 🛑 | onlyRole |
|| setParValue | Public ❗️ | 🛑 | onlyRole |
|| setGuarantor | Public ❗️ | 🛑 | onlyRole |
|| setBondHolder | Public ❗️ | 🛑 | onlyRole |
|| setMaturityDate | Public ❗️ | 🛑 | onlyRole |
|| setInterestScheduleFormat | Public ❗️ | 🛑 | onlyRole |
|| setInterestPaymentDate | Public ❗️ | 🛑 | onlyRole |
|| setDayCountConvention | Public ❗️ | 🛑 | onlyRole |
|| setBusinessDayConvention | Public ❗️ | 🛑 | onlyRole |
|| setPublicHolidaysCalendar | Public ❗️ | 🛑 | onlyRole |
|| setIssuanceDate | Public ❗️ | 🛑 | onlyRole |
|| setCouponFrequency | Public ❗️ | 🛑 | onlyRole |


### Legend

| Symbol | Meaning |
| :----: | ------------------------- |
| 🛑 | Function can modify state |
| 💵 | Function is payable |

## API for Ethereum

Expand Down
Loading

0 comments on commit d03ee9d

Please sign in to comment.