Skip to content

Commit

Permalink
Clean up tests + update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed May 2, 2024
1 parent 4316ce8 commit 2ee8bc1
Show file tree
Hide file tree
Showing 34 changed files with 135 additions and 66 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ bin/*
.vscode/
#PlantUML
out
docOut
#drawio
*.bkp
*.dtmp
Expand All @@ -17,4 +18,4 @@ cache
#manticore
mcore_*
#secrets
.env
.env
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

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

## 2.4.0

The modifications between the version v2.3.0 and this version are not audited !!!

- Improve tests & update the code
- `ERC20SnapshotInternal` inherits from `ICMTATSnapshot`



## 2.4.0-rc.1 - 20240319

The modifications between the version v2.3.0 and this version are not audited !!!
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/schema/surya_graph/surya_graph_CMTAT_TP_FACTORY.sol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/schema/surya_graph/surya_graph_ICMTATSnapshot.sol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
|| decimals | Public ❗️ | |NO❗️ |
|| transferBatch | Public ❗️ | 🛑 |NO❗️ |
|| transferFrom | Public ❗️ | 🛑 |NO❗️ |
|| balanceInfo | Public ❗️ | |NO❗️ |


### Legend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:|
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
||||||
| **ERC20SnapshotModuleInternal** | Implementation | SnapshotModuleBase, ERC20Upgradeable |||
| **ERC20SnapshotModuleInternal** | Implementation | ICMTATSnapshot, SnapshotModuleBase, ERC20Upgradeable |||
|| __ERC20Snapshot_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| snapshotInfo | Public ❗️ | |NO❗️ |
|| snapshotInfoBatch | Public ❗️ | |NO❗️ |
|| snapshotInfoBatch | Public ❗️ | |NO❗️ |
|| snapshotBalanceOf | Public ❗️ | |NO❗️ |
|| snapshotTotalSupply | Public ❗️ | |NO❗️ |
|| _snapshotUpdate | Internal 🔒 | 🛑 | |
|| _updateAccountSnapshot | Private 🔐 | 🛑 | |
|| _updateTotalSupplySnapshot | Private 🔐 | 🛑 | |
|| getSnapshotInfoBatch | Public ❗️ | |NO❗️ |
|| snapshotBalanceOf | Public ❗️ | |NO❗️ |
|| snapshotTotalSupply | Public ❗️ | |NO❗️ |


### Legend
Expand Down
26 changes: 26 additions & 0 deletions doc/schema/surya_report/surya_report_FactoryErrors.sol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Sūrya's Description Report

### Files Description Table


| File Name | SHA-1 Hash |
|-------------|--------------|
| ./libraries/FactoryErrors.sol | [object Promise] |


### Contracts Description Table


| Contract | Type | Bases | | |
|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:|
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
||||||
| **FactoryErrors** | Library | |||


### Legend

| Symbol | Meaning |
|:--------:|-----------|
| 🛑 | Function can modify state |
| 💵 | Function is payable |
31 changes: 31 additions & 0 deletions doc/schema/surya_report/surya_report_ICMTATSnapshot.sol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Sūrya's Description Report

### Files Description Table


| File Name | SHA-1 Hash |
|-------------|--------------|
| ./interfaces/ICMTATSnapshot.sol | [object Promise] |


### Contracts Description Table


| Contract | Type | Bases | | |
|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:|
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
||||||
| **ICMTATSnapshot** | Interface | |||
|| snapshotBalanceOf | External ❗️ | |NO❗️ |
|| snapshotTotalSupply | External ❗️ | |NO❗️ |
|| snapshotInfo | External ❗️ | |NO❗️ |
|| snapshotInfoBatch | External ❗️ | |NO❗️ |
|| snapshotInfoBatch | External ❗️ | |NO❗️ |


### Legend

| Symbol | Meaning |
|:--------:|-----------|
| 🛑 | Function can modify state |
| 💵 | Function is payable |
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
||||||
| **SnapshotModuleBase** | Implementation | Initializable |||
|| __SnapshotModuleBase_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| getAllSnapshots | Public ❗️ | |NO❗️ |
|| getNextSnapshots | Public ❗️ | |NO❗️ |
|| _scheduleSnapshot | Internal 🔒 | 🛑 | |
|| _scheduleSnapshotNotOptimized | Internal 🔒 | 🛑 | |
|| _rescheduleSnapshot | Internal 🔒 | 🛑 | |
|| _unscheduleLastSnapshot | Internal 🔒 | 🛑 | |
|| _unscheduleSnapshotNotOptimized | Internal 🔒 | 🛑 | |
|| getNextSnapshots | Public ❗️ | |NO❗️ |
|| getAllSnapshots | Public ❗️ | |NO❗️ |
|| _valueAt | Internal 🔒 | | |
|| _updateSnapshot | Internal 🔒 | 🛑 | |
|| _setCurrentSnapshot | Internal 🔒 | 🛑 | |
Expand Down
4 changes: 2 additions & 2 deletions doc/schema/surya_report/surya_report_ValidationModule.sol.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
| **ValidationModule** | Implementation | ValidationModuleInternal, PauseModule, EnforcementModule, IERC1404Wrapper |||
|| __ValidationModule_init_unchained | Internal 🔒 | 🛑 | onlyInitializing |
|| setRuleEngine | External ❗️ | 🛑 | onlyRole |
|| detectTransferRestriction | Public ❗️ | |NO❗️ |
|| messageForTransferRestriction | External ❗️ | |NO❗️ |
|| validateTransferByModule | Internal 🔒 | | |
|| detectTransferRestriction | Public ❗️ | |NO❗️ |
|| validateTransfer | Public ❗️ | |NO❗️ |
|| _validateTransferByModule | Internal 🔒 | | |
|| _operateOnTransfer | Internal 🔒 | 🛑 | |


Expand Down
26 changes: 26 additions & 0 deletions doc/schema/surya_report/surya_report_draft-IERC1404EnumCode.sol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Sūrya's Description Report

### Files Description Table


| File Name | SHA-1 Hash |
|-------------|--------------|
| ./interfaces/draft-IERC1404/draft-IERC1404EnumCode.sol | [object Promise] |


### Contracts Description Table


| Contract | Type | Bases | | |
|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:|
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
||||||
| **IERC1404EnumCode** | Interface | |||


### Legend

| Symbol | Meaning |
|:--------:|-----------|
| 🛑 | Function can modify state |
| 💵 | Function is payable |
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
|:----------:|:-------------------:|:----------------:|:----------------:|:---------------:|
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
||||||
| **IERC1404Wrapper** | Interface | IERC1404 |||
| **IERC1404Wrapper** | Interface | IERC1404, IERC1404EnumCode |||
|| validateTransfer | External ❗️ | |NO❗️ |


Expand Down
6 changes: 3 additions & 3 deletions doc/script/script_surya_graph.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#/bin/bash
cd '../../'
DIR=$(pwd)
DIR_OUT=${DIR}/out/surya_graph
DIR_OUT=${DIR}/docOut/surya_graph
if ! [ -d "$DIR_OUT" ]; then
mkdir -p ./out/surya_graph
mkdir -p ./docOut/surya_graph
fi
cd './contracts'
DIR=$(pwd)
Expand All @@ -13,6 +13,6 @@ do
filename=${i##*/}
ext=${i##*.}
if [[ $ext == 'sol' ]]; then
npx surya graph $i | dot -Tpng > ../out/surya_graph/surya_graph_$filename.png;
npx surya graph $i | dot -Tpng > ../docOut/surya_graph/surya_graph_$filename.png;
fi
done;
6 changes: 3 additions & 3 deletions doc/script/script_surya_inheritance.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#/bin/bash
cd '../../'
DIR=$(pwd)
DIR_OUT=${DIR}/out/inheritance
DIR_OUT=${DIR}/docOut/inheritance
if ! [ -d "$DIR_OUT" ]; then
mkdir -p ./out/surya_inheritance
mkdir -p ./docOut/surya_inheritance
fi
cd './contracts'
DIR=$(pwd)
Expand All @@ -12,6 +12,6 @@ do
filename=${i##*/}
ext=${i##*.}
if [[ $ext == 'sol' ]]; then
npx surya inheritance $i | dot -Tpng > ../out/surya_inheritance/surya_inheritance_$filename.png;
npx surya inheritance $i | dot -Tpng > ../docOut/surya_inheritance/surya_inheritance_$filename.png;
fi
done;
6 changes: 3 additions & 3 deletions doc/script/script_surya_report.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#/bin/bash
cd '../../'
DIR=$(pwd)
DIR_OUT=${DIR}/out/surya_report
DIR_OUT=${DIR}/docOut/surya_report
if ! [ -d "$DIR_OUT" ]; then
mkdir ./out/surya_report
mkdir ./docOut/surya_report
fi
cd './contracts'
DIR=$(pwd)
Expand All @@ -12,6 +12,6 @@ do
filename=${i##*/}
ext=${i##*.}
if [[ $ext == 'sol' ]]; then
npx surya mdreport ../out/surya_report/surya_report_$filename.md $i;
npx surya mdreport ../docOut/surya_report/surya_report_$filename.md $i;
fi
done;
1 change: 0 additions & 1 deletion test/proxy/general/UpgradeProxy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const { BN } = require('@openzeppelin/test-helpers')
const { should } = require('chai').should()
const { ZERO_ADDRESS } = require('../../utils')
const {
deployCMTATProxy,
DEPLOYMENT_FLAG,
DEPLOYMENT_DECIMAL
} = require('../../deploymentUtils')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ const CMTAT_BEACON_FACTORY = artifacts.require('CMTAT_BEACON_FACTORY')
const { should } = require('chai').should()
const {
expectRevertCustomError
} = require('../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
} = require('../../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
const CMTAT = artifacts.require('CMTAT_PROXY')
const { DEFAULT_ADMIN_ROLE, CMTAT_DEPLOYER_ROLE } = require('../../utils')
const { ZERO_ADDRESS } = require('../../utils')
const { CMTAT_DEPLOYER_ROLE } = require('../../../utils.js')
const { ZERO_ADDRESS } = require('../../../utils.js')
const {
DEPLOYMENT_FLAG,
deployCMTATProxyImplementation
} = require('../../deploymentUtils')
const { upgrades } = require('hardhat')
} = require('../../../deploymentUtils.js')
const DEPLOYMENT_DECIMAL = 0
const { BN, expectEvent } = require('@openzeppelin/test-helpers')
contract(
'Proxy - Security Test',
'Deploy Beacon with Factory',
function ([_, admin, attacker, deployerAddress]) {
beforeEach(async function () {
this.CMTAT_PROXY_IMPL = await deployCMTATProxyImplementation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ const CMTAT_BEACON_FACTORY = artifacts.require('CMTAT_BEACON_FACTORY')
const { should } = require('chai').should()
const {
expectRevertCustomError
} = require('../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
const CMTAT = artifacts.require('CMTAT_PROXY')
const { DEFAULT_ADMIN_ROLE, CMTAT_DEPLOYER_ROLE } = require('../../utils.js')
const { ZERO_ADDRESS } = require('../../utils.js')
} = require('../../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
const { ZERO_ADDRESS } = require('../../../utils.js')
const {
DEPLOYMENT_FLAG,
deployCMTATProxyImplementation
} = require('../../deploymentUtils.js')
const { upgrades } = require('hardhat')
const DEPLOYMENT_DECIMAL = 0
const { BN, expectEvent } = require('@openzeppelin/test-helpers')
} = require('../../../deploymentUtils.js')
contract(
'Deploy Beacon with Factory',
function ([_, admin, attacker, deployerAddress]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ const CMTAT_TP_FACTORY = artifacts.require('CMTAT_TP_FACTORY')
const { should } = require('chai').should()
const {
expectRevertCustomError
} = require('../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
} = require('../../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
const CMTAT = artifacts.require('CMTAT_PROXY')
const { ZERO_ADDRESS, CMTAT_DEPLOYER_ROLE } = require('../../../utils.js')
const {
DEFAULT_ADMIN_ROLE,
PAUSER_ROLE,
CMTAT_DEPLOYER_ROLE
} = require('../../utils.js')
const { ZERO_ADDRESS } = require('../../utils.js')
const DECIMAL = 0
const {
deployCMTATProxy,
DEPLOYMENT_FLAG,
deployCMTATProxyImplementation
} = require('../../deploymentUtils.js')
} = require('../../../deploymentUtils.js')
const { upgrades } = require('hardhat')
const DEPLOYMENT_DECIMAL = 0
const { BN, expectEvent } = require('@openzeppelin/test-helpers')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,11 @@ const CMTAT_TP_FACTORY = artifacts.require('CMTAT_TP_FACTORY')
const { should } = require('chai').should()
const {
expectRevertCustomError
} = require('../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
const CMTAT = artifacts.require('CMTAT_PROXY')
} = require('../../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js')
const { ZERO_ADDRESS } = require('../../../utils.js')
const {
DEFAULT_ADMIN_ROLE,
PAUSER_ROLE,
CMTAT_DEPLOYER_ROLE
} = require('../../utils.js')
const { ZERO_ADDRESS } = require('../../utils.js')
const DECIMAL = 0
const {
deployCMTATProxy,
DEPLOYMENT_FLAG,
deployCMTATProxyImplementation
} = require('../../deploymentUtils.js')
const { upgrades } = require('hardhat')
const DEPLOYMENT_DECIMAL = 0
const { BN, expectEvent } = require('@openzeppelin/test-helpers')
} = require('../../../deploymentUtils.js')
contract(
'Deploy TP with Factory',
function ([_, admin, attacker, deployerAddress]) {
Expand Down
2 changes: 1 addition & 1 deletion test/proxy/modules/ERC20BurnModule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const BurnModuleCommon = require('../../common/ERC20BurnModuleCommon')
const { deployCMTATProxy } = require('../../deploymentUtils')

contract(
'Proxy - BurnModule',
'Proxy - ERC20BurnModule',
function ([_, admin, address1, address2, address3, deployerAddress]) {
beforeEach(async function () {
this.cmtat = await deployCMTATProxy(_, admin, deployerAddress)
Expand Down
2 changes: 1 addition & 1 deletion test/proxy/modules/ERC20MintModule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const ERC20MintModuleCommon = require('../../common/ERC20MintModuleCommon')
const { deployCMTATProxy } = require('../../deploymentUtils')

contract(
'Proxy - MintModule',
'Proxy - ERC20MintModule',
function ([_, admin, address1, address2, deployerAddress]) {
beforeEach(async function () {
this.cmtat = await deployCMTATProxy(_, admin, deployerAddress)
Expand Down
2 changes: 1 addition & 1 deletion test/proxy/modules/ERC20SnapshotModule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ERC20SnapshotModuleOnePlannedSnapshotTest = require('../../common/ERC20Sna
const ERC20SnapshotModuleZeroPlannedSnapshotTest = require('../../common/ERC20SnapshotModuleCommon/global/ERC20SnapshotModuleZeroPlannedSnapshot')

contract(
'Proxy - SnapshotModule',
'Proxy - ERC20SnapshotModule',
function ([_, admin, address1, address2, address3, deployerAddress]) {
beforeEach(async function () {
this.cmtat = await deployCMTATProxyWithSnapshot(
Expand Down
2 changes: 1 addition & 1 deletion test/standard/modules/ERC20BurnModule.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const ERC20BurnModuleCommon = require('../../common/ERC20BurnModuleCommon')
const { deployCMTATStandalone } = require('../../deploymentUtils')
contract(
'Standard - BurnModule',
'Standard - ERC20BurnModule',
function ([_, admin, address1, address2, address3, deployerAddress]) {
beforeEach(async function () {
this.cmtat = await deployCMTATStandalone(_, admin, deployerAddress)
Expand Down
2 changes: 1 addition & 1 deletion test/standard/modules/ERC20MintModule.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const ERC20MintModuleCommon = require('../../common/ERC20MintModuleCommon')
const { deployCMTATStandalone } = require('../../deploymentUtils')
contract(
'Standard - MintModule',
'Standard - ERC20MintModule',
function ([_, admin, address1, address2, deployerAddress]) {
beforeEach(async function () {
this.cmtat = await deployCMTATStandalone(_, admin, deployerAddress)
Expand Down
Loading

0 comments on commit 2ee8bc1

Please sign in to comment.