diff --git a/CHANGELOG.md b/CHANGELOG.md
index f97df12..086b2c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,9 +2,32 @@
Please follow [https://changelog.md/](https://changelog.md/) conventions.
+## Checklist
+> Before a new release, perform the following tasks
-## v2.0.3
+- Code: Update the version name, variable VERSION
+- Run linter
+
+> npm run-script lint:all:prettier
+
+- Documentation
+ - Perform a code coverage and update the files in the corresponding directory [./doc/coverage](./doc/coverage)
+ - Perform an audit with several audit tools (Mythril and Slither), update the report in the corresponding directory [./doc/security/audits/tools](./doc/security/audits/tools)
+ - Update surya doc by running the 3 scripts in [./doc/script](./doc/script)
+ - Update changelog
+
+## v2.0.4
+
+- Fix a bug present in the Conditional Transfer rule and the corresponding test.
+- Config file:
+ - Set Solidity version to 0.8.27 in config file
+ - Set EVM version to `Cancun`
+- Add events for the following rules : whitelist/blacklist and sanctionList rules
+- Some improvements in testing
+ - Integration test with CMTAT: set the CMTAT version to [v2.5.1](https://github.com/CMTA/CMTAT/releases/tag/v2.5.1)
+
+## v2.0.3 - 20240910
- Small optimization in WhitelistWrapper; add a break in a loop
- Set Solidity version to 0.8.26 in config file
diff --git a/README.md b/README.md
index c884de6..ac25652 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,10 @@ The RuleEngine is an external contract used to apply transfer restrictions to an
The toolchain includes the following components, where the versions are the latest ones that we tested:
-- Foundry
-- Solidity 0.8.26 (via solc-js)
-- OpenZeppelin Contracts (submodule) [v5.0.2](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.2)
+- Foundry [v1.9.4](https://github.com/foundry-rs/forge-std/releases/tag/v1.9.4)
+- Solidity 0.8.27 (via solc-js)
+- OpenZeppelin Contracts (submodule) [v5.1.0](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.2)
+- CMTAT [v2.5.1](https://github.com/CMTA/CMTAT/releases/tag/v2.5.1)
## How to include it
@@ -33,6 +34,8 @@ Before each transfer, your contract must call the function `operateOnTransfer` w
#### Global
> npm run-script uml
+>
+> No longer works, generate the following error: RangeError: Maximum call stack size exceeded
![uml](./doc/schema/classDiagram.svg)
@@ -41,6 +44,12 @@ Before each transfer, your contract must call the function `operateOnTransfer` w
#### RuleEngine
> npm run-script uml:ruleEngine
+>
+> No longer works, instead:
+>
+> forge flatten src/RuleEngine.sol -o RuleEngine.sol
+>
+> npx sol2uml class RuleEngine.sol
![uml](./doc/schema/RuleEngine.svg)
@@ -111,8 +120,6 @@ You will find the report performed with [Slither](https://github.com/crytic/slit
| Version | File |
| ------- | ------------------------------------------------------------ |
| latest | [slither-report.md](./doc/security/audits/tools/slither-report.md) |
-| v1.0.2 | [v1.0.2-slither-report.md](./doc/security/audits/archive/v1.0.2-slither-report.md) |
-| v1.0.3 | [v1.0.3-slither-report.md](./doc/security/audits/archive/v1.0.3-slither-report.md) |
diff --git a/doc/coverage/coverage/index-sort-b.html b/doc/coverage/coverage/index-sort-b.html
index a3bbeed..48c5eac 100644
--- a/doc/coverage/coverage/index-sort-b.html
+++ b/doc/coverage/coverage/index-sort-b.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,107 +87,119 @@
0.0 %
- 0 / 27
+ 0 / 26
0.0 %
0 / 2
0.0 %
0 / 2
- src/rules/validation/abstract/RuleAddressList
+ test/RuleConditionalTransfer
-
+
- 97.1 %
- 34 / 35
- 93.8 %
- 15 / 16
- 75.0 %
- 6 / 8
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
- src
+ test/utils
-
+
- 96.6 %
- 28 / 29
85.7 %
6 / 7
80.0 %
- 8 / 10
+ 4 / 5
+ -
+ 0 / 0
- src/rules/operation
+ src/rules/validation/abstract
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 3 / 3
+ 100.0 %
+ 4 / 4
- src/rules/validation
+ src/rules/validation/abstract/RuleAddressList
-
+
- 96.6 %
- 56 / 58
- 86.7 %
- 13 / 15
- 93.8 %
- 30 / 32
+ 97.8 %
+ 44 / 45
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 6 / 6
- src/modules
+ src
-
+
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
100.0 %
- 82 / 82
- 100.0 %
- 27 / 27
- 95.8 %
- 23 / 24
+ 8 / 8
- src/rules/operation/abstract
+ src/modules
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 81 / 81
+ 100.0 %
+ 27 / 27
+ 100.0 %
+ 12 / 12
- test/utils
+ src/rules/operation
-
+
- 66.7 %
- 2 / 3
- 66.7 %
- 2 / 3
- -
- 0 / 0
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
- src/rules/validation/abstract
+ src/rules/operation/abstract
100.0 %
- 11 / 11
+ 113 / 113
100.0 %
- 3 / 3
+ 20 / 20
100.0 %
- 4 / 4
+ 31 / 31
+
+
+ src/rules/validation
+
+
+
+ 97.3 %
+ 72 / 74
+ 90.9 %
+ 20 / 22
+ 100.0 %
+ 32 / 32
diff --git a/doc/coverage/coverage/index-sort-f.html b/doc/coverage/coverage/index-sort-f.html
index d4d585f..7596014 100644
--- a/doc/coverage/coverage/index-sort-f.html
+++ b/doc/coverage/coverage/index-sort-f.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,7 +87,7 @@
0.0 %
- 0 / 27
+ 0 / 26
0.0 %
0 / 2
0.0 %
@@ -96,74 +96,74 @@
test/utils
-
+
- 66.7 %
- 2 / 3
- 66.7 %
- 2 / 3
+ 85.7 %
+ 6 / 7
+ 80.0 %
+ 4 / 5
-
0 / 0
src
-
+
- 96.6 %
- 28 / 29
- 85.7 %
- 6 / 7
- 80.0 %
- 8 / 10
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
+ 100.0 %
+ 8 / 8
src/rules/validation
-
+
- 96.6 %
- 56 / 58
- 86.7 %
- 13 / 15
- 93.8 %
- 30 / 32
+ 97.3 %
+ 72 / 74
+ 90.9 %
+ 20 / 22
+ 100.0 %
+ 32 / 32
- src/rules/operation
+ src/rules/validation/abstract/RuleAddressList
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 97.8 %
+ 44 / 45
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 6 / 6
- src/rules/validation/abstract/RuleAddressList
+ src/rules/operation
-
+
- 97.1 %
- 34 / 35
- 93.8 %
- 15 / 16
- 75.0 %
- 6 / 8
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
- src/rules/operation/abstract
+ test/RuleConditionalTransfer
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
src/rules/validation/abstract
@@ -171,23 +171,35 @@
100.0 %
- 11 / 11
+ 10 / 10
100.0 %
3 / 3
100.0 %
4 / 4
+
+ src/rules/operation/abstract
+
+
+
+ 100.0 %
+ 113 / 113
+ 100.0 %
+ 20 / 20
+ 100.0 %
+ 31 / 31
+
src/modules
100.0 %
- 82 / 82
+ 81 / 81
100.0 %
27 / 27
- 95.8 %
- 23 / 24
+ 100.0 %
+ 12 / 12
diff --git a/doc/coverage/coverage/index-sort-l.html b/doc/coverage/coverage/index-sort-l.html
index 026a8e5..f725c93 100644
--- a/doc/coverage/coverage/index-sort-l.html
+++ b/doc/coverage/coverage/index-sort-l.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,7 +87,7 @@
0.0 %
- 0 / 27
+ 0 / 26
0.0 %
0 / 2
0.0 %
@@ -96,62 +96,74 @@
test/utils
-
+
- 66.7 %
- 2 / 3
- 66.7 %
- 2 / 3
+ 85.7 %
+ 6 / 7
+ 80.0 %
+ 4 / 5
-
0 / 0
- src
+ src/rules/validation
-
+
- 96.6 %
- 28 / 29
- 85.7 %
- 6 / 7
- 80.0 %
- 8 / 10
+ 97.3 %
+ 72 / 74
+ 90.9 %
+ 20 / 22
+ 100.0 %
+ 32 / 32
- src/rules/validation
+ src
-
+
- 96.6 %
- 56 / 58
- 86.7 %
- 13 / 15
- 93.8 %
- 30 / 32
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
+ 100.0 %
+ 8 / 8
src/rules/validation/abstract/RuleAddressList
-
+
- 97.1 %
- 34 / 35
- 93.8 %
- 15 / 16
- 75.0 %
- 6 / 8
+ 97.8 %
+ 44 / 45
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 6 / 6
src/rules/operation
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
+
+
+ test/RuleConditionalTransfer
+
+
+
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
src/rules/validation/abstract
@@ -159,7 +171,7 @@
100.0 %
- 11 / 11
+ 10 / 10
100.0 %
3 / 3
100.0 %
@@ -171,11 +183,11 @@
100.0 %
- 82 / 82
+ 81 / 81
100.0 %
27 / 27
- 95.8 %
- 23 / 24
+ 100.0 %
+ 12 / 12
src/rules/operation/abstract
@@ -183,11 +195,11 @@
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 113 / 113
+ 100.0 %
+ 20 / 20
+ 100.0 %
+ 31 / 31
diff --git a/doc/coverage/coverage/index.html b/doc/coverage/coverage/index.html
index 5be2146..7fae7e6 100644
--- a/doc/coverage/coverage/index.html
+++ b/doc/coverage/coverage/index.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,7 +87,7 @@
0.0 %
- 0 / 27
+ 0 / 26
0.0 %
0 / 2
0.0 %
@@ -96,14 +96,14 @@
src
-
+
- 96.6 %
- 28 / 29
- 85.7 %
- 6 / 7
- 80.0 %
- 8 / 10
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
+ 100.0 %
+ 8 / 8
src/modules
@@ -111,23 +111,23 @@
100.0 %
- 82 / 82
+ 81 / 81
100.0 %
27 / 27
- 95.8 %
- 23 / 24
+ 100.0 %
+ 12 / 12
src/rules/operation
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
src/rules/operation/abstract
@@ -135,23 +135,23 @@
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 113 / 113
+ 100.0 %
+ 20 / 20
+ 100.0 %
+ 31 / 31
src/rules/validation
-
+
- 96.6 %
- 56 / 58
- 86.7 %
- 13 / 15
- 93.8 %
- 30 / 32
+ 97.3 %
+ 72 / 74
+ 90.9 %
+ 20 / 22
+ 100.0 %
+ 32 / 32
src/rules/validation/abstract
@@ -159,7 +159,7 @@
100.0 %
- 11 / 11
+ 10 / 10
100.0 %
3 / 3
100.0 %
@@ -168,24 +168,36 @@
src/rules/validation/abstract/RuleAddressList
-
+
+
+ 97.8 %
+ 44 / 45
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 6 / 6
+
+
+ test/RuleConditionalTransfer
+
+
- 97.1 %
- 34 / 35
- 93.8 %
- 15 / 16
- 75.0 %
- 6 / 8
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
test/utils
-
+
- 66.7 %
- 2 / 3
- 66.7 %
- 2 / 3
+ 85.7 %
+ 6 / 7
+ 80.0 %
+ 4 / 5
-
0 / 0
diff --git a/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func-sort-c.html b/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func-sort-c.html
index 02dc237..9abe59d 100644
--- a/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func-sort-c.html
+++ b/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func-sort-c.html
@@ -32,12 +32,12 @@
-
+
-
+
diff --git a/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func.html b/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func.html
index 29633eb..ef1e98d 100644
--- a/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func.html
+++ b/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.func.html
@@ -32,12 +32,12 @@
-
+
-
+
diff --git a/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.gcov.html b/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.gcov.html
index 0957194..66de358 100644
--- a/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.gcov.html
+++ b/doc/coverage/coverage/script/CMTATWithRuleEngineScript.s.sol.gcov.html
@@ -32,12 +32,12 @@
-
+
-
+
@@ -75,56 +75,43 @@
4 : : pragma solidity ^0.8.17;
5 : :
6 : : import "forge-std/Script.sol";
- 7 : : import "CMTAT/CMTAT_STANDALONE.sol";
+ 7 : : import "../test/HelperContract.sol";
8 : : import "src/RuleEngine.sol";
9 : : import "src/rules/validation/RuleWhitelist.sol";
10 : :
11 : : /**
12 : : @title Deploy a CMTAT, a RuleWhitelist and a RuleEngine
13 : : */
- 14 : : contract CMTATWithRuleEngineScript is Script {
+ 14 : : contract CMTATWithRuleEngineScript is Script, HelperContract {
15 : : function run() external {
16 : : // Get env variable
17 : 0 : uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
18 : 0 : address ADMIN = vm.addr(deployerPrivateKey);
19 : 0 : address trustedForwarder = address(0x0);
20 : 0 : vm.startBroadcast(deployerPrivateKey);
- 21 : 0 : uint256 flag = 5;
- 22 : 0 : uint8 decimals = 0;
- 23 : : // CMTAT
- 24 : 0 : CMTAT_STANDALONE CMTAT_CONTRACT = new CMTAT_STANDALONE(
- 25 : : trustedForwarder,
- 26 : : ADMIN,
- 27 : : IAuthorizationEngine(address(0)),
- 28 : : "CMTA Token",
- 29 : : "CMTAT",
- 30 : : decimals,
- 31 : : "CMTAT_ISIN",
- 32 : : "https://cmta.ch",
- 33 : : IRuleEngine(address(0)),
- 34 : : "CMTAT_info",
- 35 : : flag
+ 21 : : // CMTAT
+ 22 : 0 : cmtatDeployment = new CMTATDeployment();
+ 23 : 0 : CMTAT_CONTRACT = cmtatDeployment.cmtat();
+ 24 : 0 : console.log("CMTAT CMTAT_CONTRACT : ", address(CMTAT_CONTRACT));
+ 25 : : // whitelist
+ 26 : 0 : RuleWhitelist ruleWhitelist = new RuleWhitelist(
+ 27 : : ADMIN,
+ 28 : : trustedForwarder
+ 29 : : );
+ 30 : 0 : console.log("whitelist: ", address(ruleWhitelist));
+ 31 : : // ruleEngine
+ 32 : 0 : RuleEngine RULE_ENGINE = new RuleEngine(
+ 33 : : ADMIN,
+ 34 : : trustedForwarder,
+ 35 : : address(CMTAT_CONTRACT)
36 : : );
- 37 : 0 : console.log("CMTAT CMTAT_CONTRACT : ", address(CMTAT_CONTRACT));
- 38 : : // whitelist
- 39 : 0 : RuleWhitelist ruleWhitelist = new RuleWhitelist(
- 40 : : ADMIN,
- 41 : : trustedForwarder
- 42 : : );
- 43 : 0 : console.log("whitelist: ", address(ruleWhitelist));
- 44 : : // ruleEngine
- 45 : 0 : RuleEngine RULE_ENGINE = new RuleEngine(
- 46 : : ADMIN,
- 47 : : trustedForwarder,
- 48 : : address(CMTAT_CONTRACT)
- 49 : : );
- 50 : 0 : console.log("RuleEngine : ", address(RULE_ENGINE));
- 51 : 0 : RULE_ENGINE.addRuleValidation(ruleWhitelist);
- 52 : 0 : CMTAT_CONTRACT.setRuleEngine(RULE_ENGINE);
- 53 : :
- 54 : 0 : vm.stopBroadcast();
- 55 : : }
- 56 : : }
+ 37 : 0 : console.log("RuleEngine : ", address(RULE_ENGINE));
+ 38 : 0 : RULE_ENGINE.addRuleValidation(ruleWhitelist);
+ 39 : 0 : CMTAT_CONTRACT.setRuleEngine(RULE_ENGINE);
+ 40 : :
+ 41 : 0 : vm.stopBroadcast();
+ 42 : : }
+ 43 : : }
diff --git a/doc/coverage/coverage/script/RuleEngineScript.s.sol.func-sort-c.html b/doc/coverage/coverage/script/RuleEngineScript.s.sol.func-sort-c.html
index b17bfa2..a3a8550 100644
--- a/doc/coverage/coverage/script/RuleEngineScript.s.sol.func-sort-c.html
+++ b/doc/coverage/coverage/script/RuleEngineScript.s.sol.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
diff --git a/doc/coverage/coverage/script/RuleEngineScript.s.sol.func.html b/doc/coverage/coverage/script/RuleEngineScript.s.sol.func.html
index fd4ce5f..967d63b 100644
--- a/doc/coverage/coverage/script/RuleEngineScript.s.sol.func.html
+++ b/doc/coverage/coverage/script/RuleEngineScript.s.sol.func.html
@@ -37,7 +37,7 @@
-
+
diff --git a/doc/coverage/coverage/script/RuleEngineScript.s.sol.gcov.html b/doc/coverage/coverage/script/RuleEngineScript.s.sol.gcov.html
index 6e9857d..d004e29 100644
--- a/doc/coverage/coverage/script/RuleEngineScript.s.sol.gcov.html
+++ b/doc/coverage/coverage/script/RuleEngineScript.s.sol.gcov.html
@@ -37,7 +37,7 @@
-
+
diff --git a/doc/coverage/coverage/script/index-sort-b.html b/doc/coverage/coverage/script/index-sort-b.html
index 58d4173..80a522c 100644
--- a/doc/coverage/coverage/script/index-sort-b.html
+++ b/doc/coverage/coverage/script/index-sort-b.html
@@ -32,12 +32,12 @@
-
+
-
+
@@ -99,7 +99,7 @@
0.0 %
- 0 / 15
+ 0 / 14
0.0 %
0 / 1
-
diff --git a/doc/coverage/coverage/script/index-sort-f.html b/doc/coverage/coverage/script/index-sort-f.html
index 2c13af8..d4d37ee 100644
--- a/doc/coverage/coverage/script/index-sort-f.html
+++ b/doc/coverage/coverage/script/index-sort-f.html
@@ -32,12 +32,12 @@
-
+
-
+
@@ -87,7 +87,7 @@
0.0 %
- 0 / 15
+ 0 / 14
0.0 %
0 / 1
-
diff --git a/doc/coverage/coverage/script/index-sort-l.html b/doc/coverage/coverage/script/index-sort-l.html
index 3dbf5b4..265a85d 100644
--- a/doc/coverage/coverage/script/index-sort-l.html
+++ b/doc/coverage/coverage/script/index-sort-l.html
@@ -32,12 +32,12 @@
-
+
-
+
@@ -99,7 +99,7 @@
0.0 %
- 0 / 15
+ 0 / 14
0.0 %
0 / 1
-
diff --git a/doc/coverage/coverage/script/index.html b/doc/coverage/coverage/script/index.html
index 6c9ce43..7973acc 100644
--- a/doc/coverage/coverage/script/index.html
+++ b/doc/coverage/coverage/script/index.html
@@ -32,12 +32,12 @@
-
+
-
+
@@ -87,7 +87,7 @@
0.0 %
- 0 / 15
+ 0 / 14
0.0 %
0 / 1
-
diff --git a/doc/coverage/coverage/src/RuleEngine.sol.func-sort-c.html b/doc/coverage/coverage/src/RuleEngine.sol.func-sort-c.html
index d947f4d..b0956d5 100644
--- a/doc/coverage/coverage/src/RuleEngine.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/RuleEngine.sol.func-sort-c.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -69,32 +69,40 @@
Hit count
- RuleEngine._msgData
+ RuleEngine._msgData
0
- RuleEngine.validateTransfer
- 9
+ RuleEngine.validateTransfer
+ 10
- RuleEngine.detectTransferRestriction
+ RuleEngine.detectTransferRestriction
17
- RuleEngine.messageForTransferRestriction
+ RuleEngine.messageForTransferRestriction
18
- RuleEngine.operateOnTransfer
- 52
+ RuleEngine.operateOnTransfer
+ 54
+
+
+ RuleEngine.
+ 190
+
+
+ RuleEngine.hasRole
+ 269
- RuleEngine._contextSuffixLength
- 263
+ RuleEngine._contextSuffixLength
+ 528
- RuleEngine._msgSender
- 263
+ RuleEngine._msgSender
+ 528
diff --git a/doc/coverage/coverage/src/RuleEngine.sol.func.html b/doc/coverage/coverage/src/RuleEngine.sol.func.html
index 62237e1..e8728dc 100644
--- a/doc/coverage/coverage/src/RuleEngine.sol.func.html
+++ b/doc/coverage/coverage/src/RuleEngine.sol.func.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -69,32 +69,40 @@
Hit count
- RuleEngine._contextSuffixLength
- 263
+ RuleEngine.
+ 190
+
+
+ RuleEngine._contextSuffixLength
+ 528
- RuleEngine._msgData
+ RuleEngine._msgData
0
- RuleEngine._msgSender
- 263
+ RuleEngine._msgSender
+ 528
- RuleEngine.detectTransferRestriction
+ RuleEngine.detectTransferRestriction
17
- RuleEngine.messageForTransferRestriction
+ RuleEngine.hasRole
+ 269
+
+
+ RuleEngine.messageForTransferRestriction
18
- RuleEngine.operateOnTransfer
- 52
+ RuleEngine.operateOnTransfer
+ 54
- RuleEngine.validateTransfer
- 9
+ RuleEngine.validateTransfer
+ 10
diff --git a/doc/coverage/coverage/src/RuleEngine.sol.gcov.html b/doc/coverage/coverage/src/RuleEngine.sol.gcov.html
index 78e2c78..09ddcda 100644
--- a/doc/coverage/coverage/src/RuleEngine.sol.gcov.html
+++ b/doc/coverage/coverage/src/RuleEngine.sol.gcov.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -87,172 +87,190 @@
16 : : RuleEngineValidation,
17 : : MetaTxModuleStandalone
18 : : {
- 19 : : error RuleEngine_TransferInvalid();
- 20 : :
- 21 : : /**
- 22 : : * @param admin Address of the contract (Access Control)
- 23 : : * @param forwarderIrrevocable Address of the forwarder, required for the gasless support
- 24 : : */
- 25 : : constructor(
- 26 : : address admin,
- 27 : : address forwarderIrrevocable,
- 28 : : address tokenContract
- 29 : : ) MetaTxModuleStandalone(forwarderIrrevocable) {
- 30 : : if (admin == address(0)) {
- 31 : : revert RuleEngine_AdminWithAddressZeroNotAllowed();
- 32 : : }
- 33 : : if (tokenContract != address(0)) {
- 34 : : _grantRole(TOKEN_CONTRACT_ROLE, tokenContract);
- 35 : : }
- 36 : : _grantRole(DEFAULT_ADMIN_ROLE, admin);
- 37 : : _grantRole(RULE_ENGINE_OPERATOR_ROLE, admin);
- 38 : : }
- 39 : :
- 40 : : /**
- 41 : : * @notice Go through all the rule to know if a restriction exists on the transfer
- 42 : : * @param _from the origin address
- 43 : : * @param _to the destination address
- 44 : : * @param _amount to transfer
- 45 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
- 46 : : **/
- 47 : : function detectTransferRestriction(
- 48 : : address _from,
- 49 : : address _to,
- 50 : : uint256 _amount
- 51 : : ) public view override returns (uint8) {
- 52 : : // Validation
- 53 : 78 : uint8 code = RuleEngineValidation.detectTransferRestrictionValidation(
- 54 : : _from,
- 55 : : _to,
- 56 : : _amount
- 57 : : );
- 58 [ + + ]: 78 : if (code != uint8(REJECTED_CODE_BASE.TRANSFER_OK)) {
- 59 : 30 : return code;
- 60 : : }
- 61 : :
- 62 : : // Operation
- 63 : 22 : uint256 rulesLength = _rulesOperation.length;
- 64 : 35 : for (uint256 i = 0; i < rulesLength; ++i) {
- 65 : 18 : uint8 restriction = IRuleValidation(_rulesOperation[i])
- 66 : : .detectTransferRestriction(_from, _to, _amount);
- 67 [ + + ]: 12 : if (restriction > 0) {
- 68 : 10 : return restriction;
- 69 : : }
- 70 : : }
- 71 : :
- 72 : 18 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
- 73 : : }
+ 19 : : /**
+ 20 : : * @notice
+ 21 : : * Get the current version of the smart contract
+ 22 : : */
+ 23 : : string public constant VERSION = "2.0.4";
+ 24 : :
+ 25 : : /**
+ 26 : : * @param admin Address of the contract (Access Control)
+ 27 : : * @param forwarderIrrevocable Address of the forwarder, required for the gasless support
+ 28 : : */
+ 29 : : constructor(
+ 30 : : address admin,
+ 31 : : address forwarderIrrevocable,
+ 32 : : address tokenContract
+ 33 : : ) MetaTxModuleStandalone(forwarderIrrevocable) {
+ 34 [ + ]: 190 : if (admin == address(0)) {
+ 35 : 1 : revert RuleEngine_AdminWithAddressZeroNotAllowed();
+ 36 : : }
+ 37 [ + ]: 189 : if (tokenContract != address(0)) {
+ 38 : 71 : _grantRole(TOKEN_CONTRACT_ROLE, tokenContract);
+ 39 : : }
+ 40 : 189 : _grantRole(DEFAULT_ADMIN_ROLE, admin);
+ 41 : : }
+ 42 : :
+ 43 : : /**
+ 44 : : * @notice Go through all the rule to know if a restriction exists on the transfer
+ 45 : : * @param _from the origin address
+ 46 : : * @param _to the destination address
+ 47 : : * @param _amount to transfer
+ 48 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
+ 49 : : **/
+ 50 : : function detectTransferRestriction(
+ 51 : : address _from,
+ 52 : : address _to,
+ 53 : : uint256 _amount
+ 54 : : ) public view override returns (uint8) {
+ 55 : : // Validation
+ 56 : 27 : uint8 code = RuleEngineValidation.detectTransferRestrictionValidation(
+ 57 : : _from,
+ 58 : : _to,
+ 59 : : _amount
+ 60 : : );
+ 61 [ + ]: 27 : if (code != uint8(REJECTED_CODE_BASE.TRANSFER_OK)) {
+ 62 : 15 : return code;
+ 63 : : }
+ 64 : :
+ 65 : : // Operation
+ 66 : 12 : uint256 rulesLength = _rulesOperation.length;
+ 67 : 12 : for (uint256 i = 0; i < rulesLength; ++i) {
+ 68 : 7 : uint8 restriction = IRuleValidation(_rulesOperation[i])
+ 69 : : .detectTransferRestriction(_from, _to, _amount);
+ 70 [ + ]: 7 : if (restriction > 0) {
+ 71 : 6 : return restriction;
+ 72 : : }
+ 73 : : }
74 : :
- 75 : : /**
- 76 : : * @notice Validate a transfer
- 77 : : * @param _from the origin address
- 78 : : * @param _to the destination address
- 79 : : * @param _amount to transfer
- 80 : : * @return True if the transfer is valid, false otherwise
- 81 : : **/
- 82 : : function validateTransfer(
- 83 : : address _from,
- 84 : : address _to,
- 85 : : uint256 _amount
- 86 : : ) public view override returns (bool) {
- 87 : 18 : return
- 88 : 27 : detectTransferRestriction(_from, _to, _amount) ==
- 89 : 18 : uint8(REJECTED_CODE_BASE.TRANSFER_OK);
- 90 : : }
- 91 : :
- 92 : : /**
- 93 : : * @notice Return the message corresponding to the code
- 94 : : * @param _restrictionCode The target restriction code
- 95 : : * @return True if the transfer is valid, false otherwise
- 96 : : **/
- 97 : : function messageForTransferRestriction(
- 98 : : uint8 _restrictionCode
- 99 : : ) external view override returns (string memory) {
- 100 : : // Validation
- 101 : 36 : uint256 rulesLength = _rulesValidation.length;
- 102 : 60 : for (uint256 i = 0; i < rulesLength; ++i) {
- 103 [ # + ]: : if (
- 104 : 26 : IRuleValidation(_rulesValidation[i])
- 105 : : .canReturnTransferRestrictionCode(_restrictionCode)
- 106 : : ) {
- 107 : 20 : return
- 108 : 20 : IRuleValidation(_rulesValidation[i])
- 109 : : .messageForTransferRestriction(_restrictionCode);
- 110 : : }
- 111 : : }
- 112 : : // operation
- 113 : 16 : rulesLength = _rulesOperation.length;
- 114 : 26 : for (uint256 i = 0; i < rulesLength; ++i) {
- 115 [ # + ]: : if (
- 116 : 4 : IRuleValidation(_rulesOperation[i])
- 117 : : .canReturnTransferRestrictionCode(_restrictionCode)
- 118 : : ) {
- 119 : 2 : return
- 120 : 2 : IRuleValidation(_rulesOperation[i])
- 121 : : .messageForTransferRestriction(_restrictionCode);
- 122 : : }
- 123 : : }
- 124 : 14 : return "Unknown restriction code";
- 125 : : }
- 126 : :
- 127 : : /*
- 128 : : * @notice function protected by access control
- 129 : : */
- 130 : : function operateOnTransfer(
- 131 : : address from,
- 132 : : address to,
- 133 : : uint256 amount
- 134 : : ) external override onlyRole(TOKEN_CONTRACT_ROLE) returns (bool isValid) {
- 135 : : // Validate the transfer
- 136 [ + + ]: : if (
- 137 : 102 : !RuleEngineValidation.validateTransferValidation(from, to, amount)
- 138 : : ) {
- 139 : 20 : return false;
- 140 : : }
- 141 : : // Apply operation on RuleEngine
- 142 : 123 : return RuleEngineOperation._operateOnTransfer(from, to, amount);
- 143 : : }
- 144 : :
- 145 : : /*//////////////////////////////////////////////////////////////
- 146 : : ERC-2771
- 147 : : //////////////////////////////////////////////////////////////*/
- 148 : :
+ 75 : 6 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 76 : : }
+ 77 : :
+ 78 : : /**
+ 79 : : * @notice Validate a transfer
+ 80 : : * @param _from the origin address
+ 81 : : * @param _to the destination address
+ 82 : : * @param _amount to transfer
+ 83 : : * @return True if the transfer is valid, false otherwise
+ 84 : : **/
+ 85 : : function validateTransfer(
+ 86 : : address _from,
+ 87 : : address _to,
+ 88 : : uint256 _amount
+ 89 : : ) public view override returns (bool) {
+ 90 : 10 : return
+ 91 : 10 : detectTransferRestriction(_from, _to, _amount) ==
+ 92 : : uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 93 : : }
+ 94 : :
+ 95 : : /**
+ 96 : : * @notice Return the message corresponding to the code
+ 97 : : * @param _restrictionCode The target restriction code
+ 98 : : * @return True if the transfer is valid, false otherwise
+ 99 : : **/
+ 100 : : function messageForTransferRestriction(
+ 101 : : uint8 _restrictionCode
+ 102 : : ) external view override returns (string memory) {
+ 103 : : // Validation
+ 104 : 18 : uint256 rulesLength = _rulesValidation.length;
+ 105 : 18 : for (uint256 i = 0; i < rulesLength; ++i) {
+ 106 : : if (
+ 107 : 13 : IRuleValidation(_rulesValidation[i])
+ 108 : : .canReturnTransferRestrictionCode(_restrictionCode)
+ 109 [ + ]: 10 : ) {
+ 110 : 10 : return
+ 111 : 10 : IRuleValidation(_rulesValidation[i])
+ 112 : : .messageForTransferRestriction(_restrictionCode);
+ 113 : : }
+ 114 : : }
+ 115 : : // operation
+ 116 : 8 : rulesLength = _rulesOperation.length;
+ 117 : 8 : for (uint256 i = 0; i < rulesLength; ++i) {
+ 118 : : if (
+ 119 : 2 : IRuleValidation(_rulesOperation[i])
+ 120 : : .canReturnTransferRestrictionCode(_restrictionCode)
+ 121 [ + ]: 1 : ) {
+ 122 : 1 : return
+ 123 : 1 : IRuleValidation(_rulesOperation[i])
+ 124 : : .messageForTransferRestriction(_restrictionCode);
+ 125 : : }
+ 126 : : }
+ 127 : 7 : return "Unknown restriction code";
+ 128 : : }
+ 129 : :
+ 130 : : /*
+ 131 : : * @notice function protected by access control
+ 132 : : */
+ 133 : : function operateOnTransfer(
+ 134 : : address from,
+ 135 : : address to,
+ 136 : : uint256 amount
+ 137 : : ) external override onlyRole(TOKEN_CONTRACT_ROLE) returns (bool isValid) {
+ 138 : : // Validate the transfer
+ 139 : : if (
+ 140 : 53 : !RuleEngineValidation.validateTransferValidation(from, to, amount)
+ 141 [ + ]: 10 : ) {
+ 142 : 10 : return false;
+ 143 : : }
+ 144 : : // Apply operation on RuleEngine
+ 145 : 43 : return RuleEngineOperation._operateOnTransfer(from, to, amount);
+ 146 : : }
+ 147 : :
+ 148 : : /* ============ ACCESS CONTROL ============ */
149 : : /**
- 150 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 150 : : * @dev Returns `true` if `account` has been granted `role`.
151 : : */
- 152 : : function _msgSender()
- 153 : : internal
- 154 : : view
- 155 : : override(ERC2771Context, Context)
- 156 : : returns (address sender)
- 157 : : {
- 158 : 789 : return ERC2771Context._msgSender();
- 159 : : }
- 160 : :
- 161 : : /**
- 162 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 163 : : */
- 164 : : function _msgData()
- 165 : : internal
- 166 : : view
- 167 : : override(ERC2771Context, Context)
- 168 : : returns (bytes calldata)
- 169 : : {
- 170 : 0 : return ERC2771Context._msgData();
- 171 : : }
- 172 : :
- 173 : : /**
- 174 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 175 : : */
- 176 : : function _contextSuffixLength()
- 177 : : internal
- 178 : : view
- 179 : : override(ERC2771Context, Context)
- 180 : : returns (uint256)
- 181 : : {
- 182 : 789 : return ERC2771Context._contextSuffixLength();
- 183 : : }
- 184 : : }
+ 152 : : function hasRole(
+ 153 : : bytes32 role,
+ 154 : : address account
+ 155 : : ) public view virtual override(AccessControl) returns (bool) {
+ 156 : : // The Default Admin has all roles
+ 157 [ + ]: 537 : if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ 158 : 205 : return true;
+ 159 : : }
+ 160 : 332 : return AccessControl.hasRole(role, account);
+ 161 : : }
+ 162 : :
+ 163 : : /*//////////////////////////////////////////////////////////////
+ 164 : : ERC-2771
+ 165 : : //////////////////////////////////////////////////////////////*/
+ 166 : :
+ 167 : : /**
+ 168 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 169 : : */
+ 170 : : function _msgSender()
+ 171 : : internal
+ 172 : : view
+ 173 : : override(ERC2771Context, Context)
+ 174 : : returns (address sender)
+ 175 : : {
+ 176 : 528 : return ERC2771Context._msgSender();
+ 177 : : }
+ 178 : :
+ 179 : : /**
+ 180 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 181 : : */
+ 182 : : function _msgData()
+ 183 : : internal
+ 184 : : view
+ 185 : : override(ERC2771Context, Context)
+ 186 : : returns (bytes calldata)
+ 187 : : {
+ 188 : 0 : return ERC2771Context._msgData();
+ 189 : : }
+ 190 : :
+ 191 : : /**
+ 192 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 193 : : */
+ 194 : : function _contextSuffixLength()
+ 195 : : internal
+ 196 : : view
+ 197 : : override(ERC2771Context, Context)
+ 198 : : returns (uint256)
+ 199 : : {
+ 200 : 528 : return ERC2771Context._contextSuffixLength();
+ 201 : : }
+ 202 : : }
diff --git a/doc/coverage/coverage/src/index-sort-b.html b/doc/coverage/coverage/src/index-sort-b.html
index 9dd0b4e..7546912 100644
--- a/doc/coverage/coverage/src/index-sort-b.html
+++ b/doc/coverage/coverage/src/index-sort-b.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -84,14 +84,14 @@
RuleEngine.sol
-
+
- 96.6 %
- 28 / 29
- 85.7 %
- 6 / 7
- 80.0 %
- 8 / 10
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
+ 100.0 %
+ 8 / 8
diff --git a/doc/coverage/coverage/src/index-sort-f.html b/doc/coverage/coverage/src/index-sort-f.html
index 961141b..da325bc 100644
--- a/doc/coverage/coverage/src/index-sort-f.html
+++ b/doc/coverage/coverage/src/index-sort-f.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -84,14 +84,14 @@
RuleEngine.sol
-
+
- 96.6 %
- 28 / 29
- 85.7 %
- 6 / 7
- 80.0 %
- 8 / 10
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
+ 100.0 %
+ 8 / 8
diff --git a/doc/coverage/coverage/src/index-sort-l.html b/doc/coverage/coverage/src/index-sort-l.html
index ef0ece2..aad9a38 100644
--- a/doc/coverage/coverage/src/index-sort-l.html
+++ b/doc/coverage/coverage/src/index-sort-l.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -84,14 +84,14 @@
RuleEngine.sol
-
+
- 96.6 %
- 28 / 29
- 85.7 %
- 6 / 7
- 80.0 %
- 8 / 10
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
+ 100.0 %
+ 8 / 8
diff --git a/doc/coverage/coverage/src/index.html b/doc/coverage/coverage/src/index.html
index b017dd1..2325d70 100644
--- a/doc/coverage/coverage/src/index.html
+++ b/doc/coverage/coverage/src/index.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -84,14 +84,14 @@
RuleEngine.sol
-
+
- 96.6 %
- 28 / 29
- 85.7 %
- 6 / 7
- 80.0 %
- 8 / 10
+ 97.4 %
+ 38 / 39
+ 88.9 %
+ 8 / 9
+ 100.0 %
+ 8 / 8
diff --git a/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func-sort-c.html b/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func-sort-c.html
index b2d8f3a..4b20f11 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
@@ -49,8 +49,8 @@
-
-
+
+
@@ -101,16 +101,16 @@
22
- RuleEngineOperation._operateOnTransfer
+ RuleEngineOperation.rulesCountOperation
41
- RuleEngineOperation.rulesCountOperation
- 41
+ RuleEngineOperation._operateOnTransfer
+ 43
RuleEngineOperation.addRuleOperation
- 68
+ 70
diff --git a/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func.html b/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func.html
index 0b88d8b..0a529ba 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.func.html
@@ -37,7 +37,7 @@
-
+
@@ -49,8 +49,8 @@
-
-
+
+
@@ -74,7 +74,7 @@
RuleEngineOperation._operateOnTransfer
- 41
+ 43
RuleEngineOperation._removeRuleOperation
@@ -82,7 +82,7 @@
RuleEngineOperation.addRuleOperation
- 68
+ 70
RuleEngineOperation.clearRulesOperation
diff --git a/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.gcov.html b/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.gcov.html
index cd0ef49..5bdd2e0 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.gcov.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineOperation.sol.gcov.html
@@ -37,7 +37,7 @@
-
+
@@ -49,8 +49,8 @@
-
-
+
+
@@ -97,11 +97,11 @@
26 : : function setRulesOperation(
27 : : address[] calldata rules_
28 : : ) public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 29 [ + + ]: 22 : if (_rulesOperation.length > 0) {
- 30 : 20 : _clearRulesOperation();
+ 29 [ + ]: 11 : if (_rulesOperation.length > 0) {
+ 30 : 10 : _clearRulesOperation();
31 : : }
- 32 : 22 : _setRules(rules_);
- 33 : 16 : _rulesOperation = rules_;
+ 32 : 11 : _setRules(rules_);
+ 33 : 8 : _rulesOperation = rules_;
34 : : }
35 : :
36 : : /**
@@ -109,7 +109,7 @@
38 : : *
39 : : */
40 : : function clearRulesOperation() public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 41 : 8 : _clearRulesOperation();
+ 41 : 4 : _clearRulesOperation();
42 : : }
43 : :
44 : : /**
@@ -117,16 +117,16 @@
46 : : *
47 : : */
48 : : function _clearRulesOperation() internal {
- 49 : 28 : uint256 index;
+ 49 : 14 : uint256 index;
50 : : // we remove the last element first since it is more optimized.
- 51 : 76 : for (uint256 i = _rulesOperation.length; i > 0; --i) {
+ 51 : 14 : for (uint256 i = _rulesOperation.length; i > 0; --i) {
52 : : unchecked {
53 : : // don't underflow since i > 0
- 54 : 34 : index = i - 1;
+ 54 : 17 : index = i - 1;
55 : : }
- 56 : 34 : _removeRuleOperation(_rulesOperation[index], index);
+ 56 : 17 : _removeRuleOperation(_rulesOperation[index], index);
57 : : }
- 58 : 28 : emit ClearRules(_rulesOperation);
+ 58 : 14 : emit ClearRules(_rulesOperation);
59 : : }
60 : :
61 : : /**
@@ -137,8 +137,8 @@
66 : : function addRuleOperation(
67 : : IRuleOperation rule_
68 : : ) public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 69 : 136 : RuleInternal._addRule(_rulesOperation, address(rule_));
- 70 : 132 : emit AddRule(address(rule_));
+ 69 : 70 : RuleInternal._addRule(_rulesOperation, address(rule_));
+ 70 : 68 : emit AddRule(address(rule_));
71 : : }
72 : :
73 : : /**
@@ -155,7 +155,7 @@
84 : : IRuleOperation rule_,
85 : : uint256 index
86 : : ) public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 87 : 10 : _removeRuleOperation(address(rule_), index);
+ 87 : 5 : _removeRuleOperation(address(rule_), index);
88 : : }
89 : :
90 : : /**
@@ -169,15 +169,15 @@
98 : : *
99 : : */
100 : : function _removeRuleOperation(address rule_, uint256 index) internal {
- 101 : 44 : RuleInternal._removeRule(_rulesOperation, rule_, index);
- 102 : 42 : emit RemoveRule(address(rule_));
+ 101 : 22 : RuleInternal._removeRule(_rulesOperation, rule_, index);
+ 102 : 21 : emit RemoveRule(address(rule_));
103 : : }
104 : :
105 : : /**
106 : : * @return The number of rules inside the array
107 : : */
108 : : function rulesCountOperation() external view override returns (uint256) {
- 109 : 82 : return _rulesOperation.length;
+ 109 : 41 : return _rulesOperation.length;
110 : : }
111 : :
112 : : /**
@@ -187,7 +187,7 @@
116 : : function getRuleIndexOperation(
117 : : IRuleOperation rule_
118 : : ) external view returns (uint256 index) {
- 119 : 9 : return RuleInternal._getRuleIndex(_rulesOperation, address(rule_));
+ 119 : 3 : return RuleInternal._getRuleIndex(_rulesOperation, address(rule_));
120 : : }
121 : :
122 : : /**
@@ -198,7 +198,7 @@
127 : : function ruleOperation(
128 : : uint256 ruleId
129 : : ) external view override returns (address) {
- 130 : 2 : return _rulesOperation[ruleId];
+ 130 : 1 : return _rulesOperation[ruleId];
131 : : }
132 : :
133 : : /**
@@ -211,7 +211,7 @@
140 : : override
141 : : returns (address[] memory)
142 : : {
- 143 : 10 : return _rulesOperation;
+ 143 : 5 : return _rulesOperation;
144 : : }
145 : :
146 : : /**
@@ -225,18 +225,18 @@
154 : : address _to,
155 : : uint256 _amount
156 : : ) internal returns (bool isValid) {
- 157 : 82 : uint256 rulesLength = _rulesOperation.length;
- 158 : 155 : for (uint256 i = 0; i < rulesLength; ++i) {
- 159 : 99 : bool result = IRuleOperation(_rulesOperation[i]).operateOnTransfer(
+ 157 : 43 : uint256 rulesLength = _rulesOperation.length;
+ 158 : 43 : for (uint256 i = 0; i < rulesLength; ++i) {
+ 159 : 35 : bool result = IRuleOperation(_rulesOperation[i]).operateOnTransfer(
160 : : _from,
161 : : _to,
162 : : _amount
163 : : );
- 164 [ + + ]: 66 : if (!result) {
- 165 : 34 : return false;
+ 164 [ + ]: 35 : if (!result) {
+ 165 : 17 : return false;
166 : : }
167 : : }
- 168 : 48 : return true;
+ 168 : 26 : return true;
169 : : }
170 : : }
diff --git a/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func-sort-c.html b/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func-sort-c.html
index 5369cc5..f670d0f 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func-sort-c.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -49,8 +49,8 @@
-
-
+
+
diff --git a/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func.html b/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func.html
index 338ecf8..816d60c 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.func.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -49,8 +49,8 @@
-
-
+
+
diff --git a/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.gcov.html b/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.gcov.html
index 7427b98..65e2e88 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.gcov.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineValidation.sol.gcov.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -49,8 +49,8 @@
-
-
+
+
@@ -102,16 +102,16 @@
31 : : address _to,
32 : : uint256 _amount
33 : : ) public view override returns (uint8) {
- 34 : 164 : uint256 rulesLength = _rulesValidation.length;
- 35 : 276 : for (uint256 i = 0; i < rulesLength; ++i) {
- 36 : 129 : uint8 restriction = IRuleValidation(_rulesValidation[i])
+ 34 : 85 : uint256 rulesLength = _rulesValidation.length;
+ 35 : 85 : for (uint256 i = 0; i < rulesLength; ++i) {
+ 36 : 43 : uint8 restriction = IRuleValidation(_rulesValidation[i])
37 : : .detectTransferRestriction(_from, _to, _amount);
- 38 [ + + ]: 86 : if (restriction > 0) {
- 39 : 56 : return restriction;
+ 38 [ + ]: 43 : if (restriction > 0) {
+ 39 : 28 : return restriction;
40 : : }
41 : : }
42 : :
- 43 : 162 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 43 : 57 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
44 : : }
45 : :
46 : : /**
@@ -126,9 +126,9 @@
55 : : address _to,
56 : : uint256 _amount
57 : : ) public view override returns (bool) {
- 58 : 106 : return
- 59 : 159 : detectTransferRestrictionValidation(_from, _to, _amount) ==
- 60 : 106 : uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 58 : 55 : return
+ 59 : 55 : detectTransferRestrictionValidation(_from, _to, _amount) ==
+ 60 : : uint8(REJECTED_CODE_BASE.TRANSFER_OK);
61 : : }
62 : : }
diff --git a/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func-sort-c.html b/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func-sort-c.html
index 305045b..1405993 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
@@ -49,8 +49,8 @@
-
-
+
+
@@ -69,44 +69,44 @@
Hit count
- RuleEngineValidationCommon.ruleValidation
+ RuleEngineValidationCommon.ruleValidation
1
- RuleEngineValidationCommon.getRuleIndexValidation
+ RuleEngineValidationCommon.getRuleIndexValidation
3
- RuleEngineValidationCommon.rulesValidation
+ RuleEngineValidationCommon.rulesValidation
5
- RuleEngineValidationCommon.clearRulesValidation
+ RuleEngineValidationCommon.clearRulesValidation
6
- RuleEngineValidationCommon.removeRuleValidation
+ RuleEngineValidationCommon.removeRuleValidation
6
- RuleEngineValidationCommon.setRulesValidation
+ RuleEngineValidationCommon.setRulesValidation
22
- RuleEngineValidationCommon._clearRulesValidation
+ RuleEngineValidationCommon._clearRulesValidation
25
- RuleEngineValidationCommon._removeRuleValidation
+ RuleEngineValidationCommon._removeRuleValidation
33
- RuleEngineValidationCommon.rulesCountValidation
+ RuleEngineValidationCommon.rulesCountValidation
69
- RuleEngineValidationCommon.addRuleValidation
- 115
+ RuleEngineValidationCommon.addRuleValidation
+ 119
diff --git a/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func.html b/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func.html
index 5e3b0cb..236b1cc 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.func.html
@@ -37,7 +37,7 @@
-
+
@@ -49,8 +49,8 @@
-
-
+
+
@@ -69,43 +69,43 @@
Hit count
- RuleEngineValidationCommon._clearRulesValidation
+ RuleEngineValidationCommon._clearRulesValidation
25
- RuleEngineValidationCommon._removeRuleValidation
+ RuleEngineValidationCommon._removeRuleValidation
33
- RuleEngineValidationCommon.addRuleValidation
- 115
+ RuleEngineValidationCommon.addRuleValidation
+ 119
- RuleEngineValidationCommon.clearRulesValidation
+ RuleEngineValidationCommon.clearRulesValidation
6
- RuleEngineValidationCommon.getRuleIndexValidation
+ RuleEngineValidationCommon.getRuleIndexValidation
3
- RuleEngineValidationCommon.removeRuleValidation
+ RuleEngineValidationCommon.removeRuleValidation
6
- RuleEngineValidationCommon.ruleValidation
+ RuleEngineValidationCommon.ruleValidation
1
- RuleEngineValidationCommon.rulesCountValidation
+ RuleEngineValidationCommon.rulesCountValidation
69
- RuleEngineValidationCommon.rulesValidation
+ RuleEngineValidationCommon.rulesValidation
5
- RuleEngineValidationCommon.setRulesValidation
+ RuleEngineValidationCommon.setRulesValidation
22
diff --git a/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.gcov.html b/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.gcov.html
index c3354cb..357b381 100644
--- a/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.gcov.html
+++ b/doc/coverage/coverage/src/modules/RuleEngineValidationCommon.sol.gcov.html
@@ -37,7 +37,7 @@
-
+
@@ -49,8 +49,8 @@
-
-
+
+
@@ -89,139 +89,138 @@
18 : : /// @dev Array of rules
19 : : address[] internal _rulesValidation;
20 : :
- 21 : :
- 22 : : /*//////////////////////////////////////////////////////////////
- 23 : : PUBLIC/EXTERNAL FUNCTIONS
- 24 : : //////////////////////////////////////////////////////////////*/
- 25 : : /**
- 26 : : * @notice Set all the rules, will overwrite all the previous rules. \n
- 27 : : * Revert if one rule is a zero address or if the rule is already present
- 28 : : * @dev take address[] instead of IRuleEngineValidation[] since it is not possible to cast IRuleEngineValidation[] -> address[]
- 29 : : *
- 30 : : */
- 31 : : function setRulesValidation(
- 32 : : address[] calldata rules_
- 33 : : ) public override onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 34 [ + + ]: 42 : if (_rulesValidation.length > 0) {
- 35 : 40 : _clearRulesValidation();
- 36 : : }
- 37 : 42 : _setRules(rules_);
- 38 : 36 : _rulesValidation = rules_;
- 39 : : }
- 40 : :
- 41 : : /**
- 42 : : * @notice Clear all the rules of the array of rules
- 43 : : *
- 44 : : */
- 45 : : function clearRulesValidation() public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 46 : 10 : _clearRulesValidation();
- 47 : : }
- 48 : :
- 49 : : /**
- 50 : : * @notice Add a rule to the array of rules
- 51 : : * Revert if one rule is a zero address or if the rule is already present
- 52 : : *
- 53 : : */
- 54 : : function addRuleValidation(
- 55 : : IRuleValidation rule_
- 56 : : ) public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 57 : 228 : RuleInternal._addRule(_rulesValidation, address(rule_));
- 58 : 224 : emit AddRule(address(rule_));
- 59 : : }
- 60 : :
- 61 : : /**
- 62 : : * @notice Remove a rule from the array of rules
- 63 : : * Revert if the rule found at the specified index does not match the rule in argument
- 64 : : * @param rule_ address of the target rule
- 65 : : * @param index the position inside the array of rule
- 66 : : * @dev To reduce the array size, the last rule is moved to the location occupied
- 67 : : * by the rule to remove
+ 21 : : /*//////////////////////////////////////////////////////////////
+ 22 : : PUBLIC/EXTERNAL FUNCTIONS
+ 23 : : //////////////////////////////////////////////////////////////*/
+ 24 : : /**
+ 25 : : * @notice Set all the rules, will overwrite all the previous rules. \n
+ 26 : : * Revert if one rule is a zero address or if the rule is already present
+ 27 : : * @dev take address[] instead of IRuleEngineValidation[] since it is not possible to cast IRuleEngineValidation[] -> address[]
+ 28 : : *
+ 29 : : */
+ 30 : : function setRulesValidation(
+ 31 : : address[] calldata rules_
+ 32 : : ) public override onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
+ 33 [ + ]: 21 : if (_rulesValidation.length > 0) {
+ 34 : 20 : _clearRulesValidation();
+ 35 : : }
+ 36 : 21 : _setRules(rules_);
+ 37 : 18 : _rulesValidation = rules_;
+ 38 : : }
+ 39 : :
+ 40 : : /**
+ 41 : : * @notice Clear all the rules of the array of rules
+ 42 : : *
+ 43 : : */
+ 44 : : function clearRulesValidation() public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
+ 45 : 5 : _clearRulesValidation();
+ 46 : : }
+ 47 : :
+ 48 : : /**
+ 49 : : * @notice Add a rule to the array of rules
+ 50 : : * Revert if one rule is a zero address or if the rule is already present
+ 51 : : *
+ 52 : : */
+ 53 : : function addRuleValidation(
+ 54 : : IRuleValidation rule_
+ 55 : : ) public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
+ 56 : 118 : RuleInternal._addRule(_rulesValidation, address(rule_));
+ 57 : 116 : emit AddRule(address(rule_));
+ 58 : : }
+ 59 : :
+ 60 : : /**
+ 61 : : * @notice Remove a rule from the array of rules
+ 62 : : * Revert if the rule found at the specified index does not match the rule in argument
+ 63 : : * @param rule_ address of the target rule
+ 64 : : * @param index the position inside the array of rule
+ 65 : : * @dev To reduce the array size, the last rule is moved to the location occupied
+ 66 : : * by the rule to remove
+ 67 : : *
68 : : *
- 69 : : *
- 70 : : */
- 71 : : function removeRuleValidation(
- 72 : : IRuleValidation rule_,
- 73 : : uint256 index
- 74 : : ) public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
- 75 : 10 : _removeRuleValidation(address(rule_), index);
- 76 : : }
- 77 : :
- 78 : : /**
- 79 : : * @return The number of rules inside the array
- 80 : : */
- 81 : : function rulesCountValidation() external view override returns (uint256) {
- 82 : 138 : return _rulesValidation.length;
- 83 : : }
- 84 : :
- 85 : : /**
- 86 : : * @notice Get the index of a rule inside the list
- 87 : : * @return index if the rule is found, _rulesValidation.length otherwise
- 88 : : */
- 89 : : function getRuleIndexValidation(
- 90 : : IRuleValidation rule_
- 91 : : ) external view returns (uint256 index) {
- 92 : 9 : return RuleInternal._getRuleIndex(_rulesValidation, address(rule_));
- 93 : : }
- 94 : :
- 95 : : /**
- 96 : : * @notice Get the rule at the position specified by ruleId
- 97 : : * @param ruleId index of the rule
- 98 : : * @return a rule address
- 99 : : */
- 100 : : function ruleValidation(
- 101 : : uint256 ruleId
- 102 : : ) external view override returns (address) {
- 103 : 2 : return _rulesValidation[ruleId];
- 104 : : }
- 105 : :
- 106 : : /**
- 107 : : * @notice Get all the rules
- 108 : : * @return An array of rules
- 109 : : */
- 110 : : function rulesValidation()
- 111 : : external
- 112 : : view
- 113 : : override
- 114 : : returns (address[] memory)
- 115 : : {
- 116 : 10 : return _rulesValidation;
- 117 : : }
- 118 : :
- 119 : : /*//////////////////////////////////////////////////////////////
- 120 : : INTERNAL FUNCTIONS
- 121 : : //////////////////////////////////////////////////////////////*/
- 122 : : /**
- 123 : : * @notice Clear all the rules of the array of rules
- 124 : : *
- 125 : : */
- 126 : : function _clearRulesValidation() internal {
- 127 : 50 : uint256 index;
- 128 : : // we remove the last element first since it is more optimized.
- 129 : 131 : for (uint256 i = _rulesValidation.length; i > 0; --i) {
- 130 : : unchecked {
- 131 : : // don't underflow since i > 0
- 132 : 56 : index = i - 1;
- 133 : : }
- 134 : 56 : _removeRuleValidation(_rulesValidation[index], index);
- 135 : : }
- 136 : 50 : emit ClearRules(_rulesValidation);
- 137 : : }
- 138 : :
- 139 : : /**
- 140 : : * @notice Remove a rule from the array of rules
- 141 : : * Revert if the rule found at the specified index does not match the rule in argument
- 142 : : * @param rule_ address of the target rule
- 143 : : * @param index the position inside the array of rule
- 144 : : * @dev To reduce the array size, the last rule is moved to the location occupied
- 145 : : * by the rule to remove
+ 69 : : */
+ 70 : : function removeRuleValidation(
+ 71 : : IRuleValidation rule_,
+ 72 : : uint256 index
+ 73 : : ) public onlyRole(RULE_ENGINE_OPERATOR_ROLE) {
+ 74 : 5 : _removeRuleValidation(address(rule_), index);
+ 75 : : }
+ 76 : :
+ 77 : : /**
+ 78 : : * @return The number of rules inside the array
+ 79 : : */
+ 80 : : function rulesCountValidation() external view override returns (uint256) {
+ 81 : 69 : return _rulesValidation.length;
+ 82 : : }
+ 83 : :
+ 84 : : /**
+ 85 : : * @notice Get the index of a rule inside the list
+ 86 : : * @return index if the rule is found, _rulesValidation.length otherwise
+ 87 : : */
+ 88 : : function getRuleIndexValidation(
+ 89 : : IRuleValidation rule_
+ 90 : : ) external view returns (uint256 index) {
+ 91 : 3 : return RuleInternal._getRuleIndex(_rulesValidation, address(rule_));
+ 92 : : }
+ 93 : :
+ 94 : : /**
+ 95 : : * @notice Get the rule at the position specified by ruleId
+ 96 : : * @param ruleId index of the rule
+ 97 : : * @return a rule address
+ 98 : : */
+ 99 : : function ruleValidation(
+ 100 : : uint256 ruleId
+ 101 : : ) external view override returns (address) {
+ 102 : 1 : return _rulesValidation[ruleId];
+ 103 : : }
+ 104 : :
+ 105 : : /**
+ 106 : : * @notice Get all the rules
+ 107 : : * @return An array of rules
+ 108 : : */
+ 109 : : function rulesValidation()
+ 110 : : external
+ 111 : : view
+ 112 : : override
+ 113 : : returns (address[] memory)
+ 114 : : {
+ 115 : 5 : return _rulesValidation;
+ 116 : : }
+ 117 : :
+ 118 : : /*//////////////////////////////////////////////////////////////
+ 119 : : INTERNAL FUNCTIONS
+ 120 : : //////////////////////////////////////////////////////////////*/
+ 121 : : /**
+ 122 : : * @notice Clear all the rules of the array of rules
+ 123 : : *
+ 124 : : */
+ 125 : : function _clearRulesValidation() internal {
+ 126 : 25 : uint256 index;
+ 127 : : // we remove the last element first since it is more optimized.
+ 128 : 25 : for (uint256 i = _rulesValidation.length; i > 0; --i) {
+ 129 : : unchecked {
+ 130 : : // don't underflow since i > 0
+ 131 : 28 : index = i - 1;
+ 132 : : }
+ 133 : 28 : _removeRuleValidation(_rulesValidation[index], index);
+ 134 : : }
+ 135 : 25 : emit ClearRules(_rulesValidation);
+ 136 : : }
+ 137 : :
+ 138 : : /**
+ 139 : : * @notice Remove a rule from the array of rules
+ 140 : : * Revert if the rule found at the specified index does not match the rule in argument
+ 141 : : * @param rule_ address of the target rule
+ 142 : : * @param index the position inside the array of rule
+ 143 : : * @dev To reduce the array size, the last rule is moved to the location occupied
+ 144 : : * by the rule to remove
+ 145 : : *
146 : : *
- 147 : : *
- 148 : : */
- 149 : : function _removeRuleValidation(address rule_, uint256 index) internal {
- 150 : 66 : RuleInternal._removeRule(_rulesValidation, rule_, index);
- 151 : 64 : emit RemoveRule(address(rule_));
- 152 : : }
- 153 : : }
+ 147 : : */
+ 148 : : function _removeRuleValidation(address rule_, uint256 index) internal {
+ 149 : 33 : RuleInternal._removeRule(_rulesValidation, rule_, index);
+ 150 : 32 : emit RemoveRule(address(rule_));
+ 151 : : }
+ 152 : : }
diff --git a/doc/coverage/coverage/src/modules/RuleInternal.sol.func-sort-c.html b/doc/coverage/coverage/src/modules/RuleInternal.sol.func-sort-c.html
index 4d4410d..12c3e74 100644
--- a/doc/coverage/coverage/src/modules/RuleInternal.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/modules/RuleInternal.sol.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -82,7 +82,7 @@
RuleInternal._addRule
- 182
+ 188
diff --git a/doc/coverage/coverage/src/modules/RuleInternal.sol.func.html b/doc/coverage/coverage/src/modules/RuleInternal.sol.func.html
index 2c23e22..c32d37a 100644
--- a/doc/coverage/coverage/src/modules/RuleInternal.sol.func.html
+++ b/doc/coverage/coverage/src/modules/RuleInternal.sol.func.html
@@ -37,7 +37,7 @@
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -70,7 +70,7 @@
RuleInternal._addRule
- 182
+ 188
RuleInternal._getRuleIndex
diff --git a/doc/coverage/coverage/src/modules/RuleInternal.sol.gcov.html b/doc/coverage/coverage/src/modules/RuleInternal.sol.gcov.html
index 2189f88..3b5b318 100644
--- a/doc/coverage/coverage/src/modules/RuleInternal.sol.gcov.html
+++ b/doc/coverage/coverage/src/modules/RuleInternal.sol.gcov.html
@@ -37,7 +37,7 @@
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -88,20 +88,20 @@
17 : : *
18 : : */
19 : : function _setRules(address[] calldata rules_) internal {
- 20 [ + + ]: 64 : if (rules_.length == 0) {
- 21 : 4 : revert RuleEngine_ArrayIsEmpty();
+ 20 [ + ]: 32 : if (rules_.length == 0) {
+ 21 : 2 : revert RuleEngine_ArrayIsEmpty();
22 : : }
- 23 : 134 : for (uint256 i = 0; i < rules_.length; ) {
- 24 [ + + ]: 192 : if (address(rules_[i]) == address(0x0)) {
- 25 : 4 : revert RuleEngine_RuleAddressZeroNotAllowed();
+ 23 : 30 : for (uint256 i = 0; i < rules_.length; ) {
+ 24 [ + ]: 48 : if (address(rules_[i]) == address(0x0)) {
+ 25 : 2 : revert RuleEngine_RuleAddressZeroNotAllowed();
26 : : }
- 27 [ + + ]: 46 : if (_ruleIsPresent[rules_[i]]) {
- 28 : 4 : revert RuleEngine_RuleAlreadyExists();
+ 27 [ + ]: 2 : if (_ruleIsPresent[rules_[i]]) {
+ 28 : 2 : revert RuleEngine_RuleAlreadyExists();
29 : : }
- 30 : 88 : _ruleIsPresent[rules_[i]] = true;
- 31 : 88 : emit AddRule(rules_[i]);
+ 30 : 44 : _ruleIsPresent[rules_[i]] = true;
+ 31 : 44 : emit AddRule(rules_[i]);
32 : : unchecked {
- 33 : 88 : ++i;
+ 33 : 44 : ++i;
34 : : }
35 : : }
36 : : }
@@ -112,14 +112,14 @@
41 : : *
42 : : */
43 : : function _addRule(address[] storage _rules, address rule_) internal {
- 44 [ + + ]: 728 : if (address(rule_) == address(0x0)) {
- 45 : 4 : revert RuleEngine_RuleAddressZeroNotAllowed();
+ 44 [ + ]: 188 : if (address(rule_) == address(0x0)) {
+ 45 : 2 : revert RuleEngine_RuleAddressZeroNotAllowed();
46 : : }
- 47 [ + + ]: 180 : if (_ruleIsPresent[rule_]) {
- 48 : 4 : revert RuleEngine_RuleAlreadyExists();
+ 47 [ + ]: 2 : if (_ruleIsPresent[rule_]) {
+ 48 : 2 : revert RuleEngine_RuleAlreadyExists();
49 : : }
- 50 : 356 : _rules.push(rule_);
- 51 : 356 : _ruleIsPresent[rule_] = true;
+ 50 : 184 : _rules.push(rule_);
+ 51 : 184 : _ruleIsPresent[rule_] = true;
52 : : }
53 : :
54 : : /**
@@ -137,15 +137,15 @@
66 : : address rule_,
67 : : uint256 index
68 : : ) internal {
- 69 [ + + ]: 110 : if (_rules[index] != rule_) {
- 70 : 4 : revert RuleEngine_RuleDoNotMatch();
+ 69 [ + ]: 55 : if (_rules[index] != rule_) {
+ 70 : 2 : revert RuleEngine_RuleDoNotMatch();
71 : : }
- 72 [ # + ]: 159 : if (index != _rules.length - 1) {
- 73 : 8 : _rules[index] = _rules[_rules.length - 1];
+ 72 [ + ]: 53 : if (index != _rules.length - 1) {
+ 73 : 4 : _rules[index] = _rules[_rules.length - 1];
74 : : }
- 75 : 106 : _rules.pop();
- 76 : 106 : _ruleIsPresent[rule_] = false;
- 77 : 106 : emit RemoveRule(rule_);
+ 75 : 53 : _rules.pop();
+ 76 : 53 : _ruleIsPresent[rule_] = false;
+ 77 : 53 : emit RemoveRule(rule_);
78 : : }
79 : :
80 : : /**
@@ -156,16 +156,16 @@
85 : : address[] storage _rules,
86 : : address rule_
87 : : ) internal view returns (uint256 index) {
- 88 : 12 : uint256 rulesLength = _rules.length;
- 89 : 24 : for (index = 0; index < rulesLength; ) {
- 90 [ + + ]: 20 : if (_rules[index] == rule_) {
- 91 : 8 : return index;
+ 88 : 6 : uint256 rulesLength = _rules.length;
+ 89 : 6 : for (index = 0; index < rulesLength; ) {
+ 90 [ + ]: 10 : if (_rules[index] == rule_) {
+ 91 : 4 : return index;
92 : : }
93 : : unchecked {
- 94 : 12 : ++index;
+ 94 : 6 : ++index;
95 : : }
96 : : }
- 97 : 4 : return _rules.length;
+ 97 : 2 : return _rules.length;
98 : : }
99 : : }
diff --git a/doc/coverage/coverage/src/modules/index-sort-b.html b/doc/coverage/coverage/src/modules/index-sort-b.html
index d4aaed9..de7034e 100644
--- a/doc/coverage/coverage/src/modules/index-sort-b.html
+++ b/doc/coverage/coverage/src/modules/index-sort-b.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -82,16 +82,16 @@
Branches
- RuleInternal.sol
+ RuleEngineValidation.sol
100.0 %
- 29 / 29
+ 8 / 8
100.0 %
- 4 / 4
- 93.8 %
- 15 / 16
+ 2 / 2
+ 100.0 %
+ 1 / 1
RuleEngineValidationCommon.sol
@@ -103,31 +103,31 @@
100.0 %
10 / 10
100.0 %
- 2 / 2
+ 1 / 1
- RuleEngineValidation.sol
+ RuleEngineOperation.sol
100.0 %
- 9 / 9
+ 25 / 25
100.0 %
- 2 / 2
+ 11 / 11
100.0 %
2 / 2
- RuleEngineOperation.sol
+ RuleInternal.sol
100.0 %
- 25 / 25
- 100.0 %
- 11 / 11
+ 29 / 29
100.0 %
4 / 4
+ 100.0 %
+ 8 / 8
diff --git a/doc/coverage/coverage/src/modules/index-sort-f.html b/doc/coverage/coverage/src/modules/index-sort-f.html
index 6d8c9aa..2c1a718 100644
--- a/doc/coverage/coverage/src/modules/index-sort-f.html
+++ b/doc/coverage/coverage/src/modules/index-sort-f.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -87,11 +87,11 @@
100.0 %
- 9 / 9
+ 8 / 8
100.0 %
2 / 2
100.0 %
- 2 / 2
+ 1 / 1
RuleInternal.sol
@@ -102,8 +102,8 @@
29 / 29
100.0 %
4 / 4
- 93.8 %
- 15 / 16
+ 100.0 %
+ 8 / 8
RuleEngineValidationCommon.sol
@@ -115,7 +115,7 @@
100.0 %
10 / 10
100.0 %
- 2 / 2
+ 1 / 1
RuleEngineOperation.sol
@@ -127,7 +127,7 @@
100.0 %
11 / 11
100.0 %
- 4 / 4
+ 2 / 2
diff --git a/doc/coverage/coverage/src/modules/index-sort-l.html b/doc/coverage/coverage/src/modules/index-sort-l.html
index f02bd59..afc3be8 100644
--- a/doc/coverage/coverage/src/modules/index-sort-l.html
+++ b/doc/coverage/coverage/src/modules/index-sort-l.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -87,11 +87,11 @@
100.0 %
- 9 / 9
+ 8 / 8
100.0 %
2 / 2
100.0 %
- 2 / 2
+ 1 / 1
RuleEngineValidationCommon.sol
@@ -103,7 +103,7 @@
100.0 %
10 / 10
100.0 %
- 2 / 2
+ 1 / 1
RuleEngineOperation.sol
@@ -115,7 +115,7 @@
100.0 %
11 / 11
100.0 %
- 4 / 4
+ 2 / 2
RuleInternal.sol
@@ -126,8 +126,8 @@
29 / 29
100.0 %
4 / 4
- 93.8 %
- 15 / 16
+ 100.0 %
+ 8 / 8
diff --git a/doc/coverage/coverage/src/modules/index.html b/doc/coverage/coverage/src/modules/index.html
index 76fbf45..241dc35 100644
--- a/doc/coverage/coverage/src/modules/index.html
+++ b/doc/coverage/coverage/src/modules/index.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -91,7 +91,7 @@
100.0 %
11 / 11
100.0 %
- 4 / 4
+ 2 / 2
RuleEngineValidation.sol
@@ -99,11 +99,11 @@
100.0 %
- 9 / 9
+ 8 / 8
100.0 %
2 / 2
100.0 %
- 2 / 2
+ 1 / 1
RuleEngineValidationCommon.sol
@@ -115,7 +115,7 @@
100.0 %
10 / 10
100.0 %
- 2 / 2
+ 1 / 1
RuleInternal.sol
@@ -126,8 +126,8 @@
29 / 29
100.0 %
4 / 4
- 93.8 %
- 15 / 16
+ 100.0 %
+ 8 / 8
diff --git a/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func-sort-c.html
index b22fc0f..35b44d1 100644
--- a/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func-sort-c.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -69,68 +69,76 @@
Hit count
- RuleConditionalTransfer._msgData
+ RuleConditionalTransfer._msgData
0
- RuleConditionalTransfer.canReturnTransferRestrictionCode
+ RuleConditionalTransfer.canReturnTransferRestrictionCode
2
- RuleConditionalTransfer.cancelTransferRequestBatch
+ RuleConditionalTransfer.cancelTransferRequestBatch
3
- RuleConditionalTransfer.createTransferRequestBatch
+ RuleConditionalTransfer.createTransferRequestBatch
3
- RuleConditionalTransfer.messageForTransferRestriction
+ RuleConditionalTransfer.messageForTransferRestriction
3
- RuleConditionalTransfer.cancelTransferRequest
+ RuleConditionalTransfer.cancelTransferRequest
6
- RuleConditionalTransfer._cancelTransferRequest
+ RuleConditionalTransfer._cancelTransferRequest
9
- RuleConditionalTransfer.detectTransferRestriction
- 11
+ RuleConditionalTransfer.detectTransferRestriction
+ 31
- RuleConditionalTransfer.operateOnTransfer
- 33
+ RuleConditionalTransfer.getRequestByStatus
+ 35
- RuleConditionalTransfer.getRequestByStatus
+ RuleConditionalTransfer.operateOnTransfer
35
- RuleConditionalTransfer._validateApproval
- 37
+ RuleConditionalTransfer.getRequestTrade
+ 57
- RuleConditionalTransfer._validateBurnMint
- 41
+ RuleConditionalTransfer._validateApproval
+ 59
- RuleConditionalTransfer.getRequestTrade
- 57
+ RuleConditionalTransfer._validateBurnMint
+ 63
+
+
+ RuleConditionalTransfer._validateTransfer
+ 66
+
+
+ RuleConditionalTransfer.createTransferRequest
+ 104
- RuleConditionalTransfer.createTransferRequest
- 102
+ RuleConditionalTransfer.
+ 143
- RuleConditionalTransfer._contextSuffixLength
- 452
+ RuleConditionalTransfer._contextSuffixLength
+ 745
- RuleConditionalTransfer._msgSender
- 452
+ RuleConditionalTransfer._msgSender
+ 745
diff --git a/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func.html b/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func.html
index c8dd088..6ab25e2 100644
--- a/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func.html
+++ b/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.func.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -69,68 +69,76 @@
Hit count
- RuleConditionalTransfer._cancelTransferRequest
+ RuleConditionalTransfer.
+ 143
+
+
+ RuleConditionalTransfer._cancelTransferRequest
9
- RuleConditionalTransfer._contextSuffixLength
- 452
+ RuleConditionalTransfer._contextSuffixLength
+ 745
- RuleConditionalTransfer._msgData
+ RuleConditionalTransfer._msgData
0
- RuleConditionalTransfer._msgSender
- 452
+ RuleConditionalTransfer._msgSender
+ 745
- RuleConditionalTransfer._validateApproval
- 37
+ RuleConditionalTransfer._validateApproval
+ 59
- RuleConditionalTransfer._validateBurnMint
- 41
+ RuleConditionalTransfer._validateBurnMint
+ 63
- RuleConditionalTransfer.canReturnTransferRestrictionCode
+ RuleConditionalTransfer._validateTransfer
+ 66
+
+
+ RuleConditionalTransfer.canReturnTransferRestrictionCode
2
- RuleConditionalTransfer.cancelTransferRequest
+ RuleConditionalTransfer.cancelTransferRequest
6
- RuleConditionalTransfer.cancelTransferRequestBatch
+ RuleConditionalTransfer.cancelTransferRequestBatch
3
- RuleConditionalTransfer.createTransferRequest
- 102
+ RuleConditionalTransfer.createTransferRequest
+ 104
- RuleConditionalTransfer.createTransferRequestBatch
+ RuleConditionalTransfer.createTransferRequestBatch
3
- RuleConditionalTransfer.detectTransferRestriction
- 11
+ RuleConditionalTransfer.detectTransferRestriction
+ 31
- RuleConditionalTransfer.getRequestByStatus
+ RuleConditionalTransfer.getRequestByStatus
35
- RuleConditionalTransfer.getRequestTrade
+ RuleConditionalTransfer.getRequestTrade
57
- RuleConditionalTransfer.messageForTransferRestriction
+ RuleConditionalTransfer.messageForTransferRestriction
3
- RuleConditionalTransfer.operateOnTransfer
- 33
+ RuleConditionalTransfer.operateOnTransfer
+ 35
diff --git a/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.gcov.html b/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.gcov.html
index 802a866..8040d48 100644
--- a/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/operation/RuleConditionalTransfer.sol.gcov.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -82,7 +82,7 @@
11 : : import "CMTAT/interfaces/engine/IRuleEngine.sol";
12 : :
13 : : /**
- 14 : : * @title a whitelist manager
+ 14 : : * @title RuleConditionalTransfer
15 : : */
16 : :
17 : : contract RuleConditionalTransfer is
@@ -101,366 +101,364 @@
30 : : IRuleEngine ruleEngineContract,
31 : : OPTION memory options_
32 : : ) MetaTxModuleStandalone(forwarderIrrevocable) {
- 33 : : if (admin == address(0)) {
- 34 : : revert RuleConditionalTransfer_AdminWithAddressZeroNotAllowed();
+ 33 [ + ]: 143 : if (admin == address(0)) {
+ 34 : 1 : revert RuleConditionalTransfer_AdminWithAddressZeroNotAllowed();
35 : : }
- 36 : : _grantRole(DEFAULT_ADMIN_ROLE, admin);
- 37 : : _grantRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE, admin);
- 38 : : if (address(ruleEngineContract) != address(0x0)) {
- 39 : : _grantRole(RULE_ENGINE_CONTRACT_ROLE, address(ruleEngineContract));
- 40 : : }
- 41 : : if (options_.timeLimit.timeLimitToApprove == 0) {
- 42 : : options_.timeLimit.timeLimitToApprove = type(uint64).max;
- 43 : : }
- 44 : : if (options_.timeLimit.timeLimitToTransfer == 0) {
- 45 : : options_.timeLimit.timeLimitToTransfer = type(uint64).max;
- 46 : : }
- 47 : : options = options_;
- 48 : : }
- 49 : :
- 50 : : /*//////////////////////////////////////////////////////////////
- 51 : : PUBLIC/EXTERNAL FUNCTIONS
- 52 : : //////////////////////////////////////////////////////////////*/
- 53 : : /**
- 54 : : * @notice function called by the RuleEngine
- 55 : : * @dev Returns true if the transfer is valid, and false otherwise.
- 56 : : * Add access control with the RuleEngine
- 57 : : */
- 58 : : function operateOnTransfer(
- 59 : : address _from,
- 60 : : address _to,
- 61 : : uint256 _amount
- 62 : : )
- 63 : : public
- 64 : : override
- 65 : : onlyRole(RULE_ENGINE_CONTRACT_ROLE)
- 66 : : returns (bool isValid)
- 67 : : {
- 68 : : // No need of approval if from and to are in the whitelist
- 69 [ + + ]: 132 : if (address(whitelistConditionalTransfer) != address(0)) {
- 70 [ + + ]: : if (
- 71 : 54 : whitelistConditionalTransfer.addressIsListed(_from) &&
- 72 : 6 : whitelistConditionalTransfer.addressIsListed(_to)
- 73 : : ) {
- 74 : 4 : return true;
- 75 : : }
- 76 : : }
- 77 : :
- 78 : : // Mint & Burn
- 79 [ + + ]: 62 : if (_validateBurnMint(_from, _to)) {
- 80 : 8 : return true;
- 81 : : }
- 82 : 81 : bytes32 key = keccak256(abi.encode(_from, _to, _amount));
- 83 [ + + ]: 54 : if (_validateApproval(key)) {
- 84 : 20 : _updateProcessedTransfer(key);
- 85 : 20 : return true;
- 86 : : } else {
- 87 : 34 : return false;
- 88 : : }
- 89 : : }
- 90 : :
- 91 : : /**
- 92 : : * @notice Create a request of transfer for yourselves
- 93 : : * @param to recipient of tokens
- 94 : : * @param value amount of tokens to transfer
- 95 : : */
- 96 : : function createTransferRequest(address to, uint256 value) public {
- 97 : : // WAIT => Will set a new delay to approve
- 98 : : // APPROVED => will overwrite previous status
- 99 : : // DENIED => reject
- 100 : 315 : address from = _msgSender();
- 101 : 315 : bytes32 key = keccak256(abi.encode(from, to, value));
- 102 [ + + ]: 210 : if (transferRequests[key].status == STATUS.DENIED) {
- 103 : 2 : revert RuleConditionalTransfer_TransferDenied();
- 104 : : }
- 105 [ # + ]: 208 : if (_checkRequestStatus(key)) {
- 106 : 202 : uint256 requestIdLocal = requestId;
- 107 : 303 : TransferRequest memory newTransferApproval = TransferRequest({
- 108 : : key: key,
- 109 : : id: requestIdLocal,
- 110 : : keyElement: TransferRequestKeyElement({
- 111 : : from: from,
- 112 : : to: to,
- 113 : : value: value
- 114 : : }),
- 115 : : askTime: block.timestamp,
- 116 : : maxTime: 0,
- 117 : : status: STATUS.WAIT
- 118 : : });
- 119 : 202 : transferRequests[key] = newTransferApproval;
- 120 : 202 : IdToKey[requestIdLocal] = key;
- 121 : 202 : emit transferWaiting(key, from, to, value, requestId);
- 122 : 202 : ++requestId;
- 123 : : } else {
- 124 : : // Overwrite previous approval
- 125 : 6 : transferRequests[key].askTime = block.timestamp;
- 126 : 6 : transferRequests[key].status = STATUS.WAIT;
- 127 : 6 : emit transferWaiting(
- 128 : : key,
- 129 : : from,
- 130 : : to,
- 131 : : value,
- 132 : : transferRequests[key].id
- 133 : : );
- 134 : : }
- 135 : : }
- 136 : :
- 137 : : /**
- 138 : : * @notice Batch version of {createTransferRequest}
- 139 : : */
- 140 : : function createTransferRequestBatch(
- 141 : : address[] memory tos,
- 142 : : uint256[] memory values
- 143 : : ) public {
- 144 [ + + ]: 6 : if (tos.length == 0) {
- 145 : 2 : revert RuleConditionalTransfer_EmptyArray();
- 146 : : }
- 147 [ + + ]: 4 : if (tos.length != values.length) {
- 148 : 2 : revert RuleConditionalTransfer_InvalidLengthArray();
- 149 : : }
- 150 : 9 : for (uint256 i = 0; i < tos.length; ++i) {
- 151 : 6 : createTransferRequest(tos[i], values[i]);
- 152 : : }
- 153 : : }
- 154 : :
- 155 : : /**
- 156 : : * @notice allow a token holder to cancel/reset his own request
- 157 : : */
- 158 : : function cancelTransferRequest(uint256 requestId_) public {
- 159 : 12 : _cancelTransferRequest(requestId_);
- 160 : : }
- 161 : :
- 162 : : /**
- 163 : : * @notice allow a token holder to cancel/reset his own request
- 164 : : */
- 165 : : function cancelTransferRequestBatch(uint256[] memory requestIds) public {
- 166 [ + + ]: 6 : if (requestIds.length == 0) {
- 167 : 2 : revert RuleConditionalTransfer_EmptyArray();
- 168 : : }
- 169 : : // Check id validity before performing actions
- 170 : 14 : for (uint256 i = 0; i < requestIds.length; ++i) {
- 171 [ + + ]: 15 : if (requestIds[i] + 1 > requestId) {
- 172 : 2 : revert RuleConditionalTransfer_InvalidId();
- 173 : : }
- 174 : : }
- 175 : 9 : for (uint256 i = 0; i < requestIds.length; ++i) {
- 176 : 6 : _cancelTransferRequest(requestIds[i]);
- 177 : : }
- 178 : : }
- 179 : :
- 180 : : function getRequestTrade(
- 181 : : address from,
- 182 : : address to,
- 183 : : uint256 value
- 184 : : ) public view returns (TransferRequest memory) {
- 185 : 171 : bytes32 key = keccak256(abi.encode(from, to, value));
- 186 : 114 : return transferRequests[key];
- 187 : : }
- 188 : :
- 189 : : /**
- 190 : : * @notice get Trade by status
- 191 : : * @param _targetStatus The status of the transactions you want to retrieve
- 192 : : * @return array with corresponding transactions
- 193 : : */
- 194 : : function getRequestByStatus(
- 195 : : STATUS _targetStatus
- 196 : : ) public view returns (TransferRequest[] memory) {
- 197 : 70 : uint totalRequestCount = requestId;
- 198 : 70 : uint requestCount = 0;
- 199 : 70 : uint currentIndex = 0;
- 200 : :
- 201 : : // We count the number of requests matching the criteria
- 202 : 181 : for (uint i = 0; i < totalRequestCount; ++i) {
- 203 [ + + ]: 76 : if (transferRequests[IdToKey[i]].status == _targetStatus) {
- 204 : 72 : requestCount += 1;
- 205 : : }
- 206 : : }
+ 36 : 142 : _grantRole(DEFAULT_ADMIN_ROLE, admin);
+ 37 [ + ]: 142 : if (address(ruleEngineContract) != address(0x0)) {
+ 38 : 138 : _grantRole(RULE_ENGINE_CONTRACT_ROLE, address(ruleEngineContract));
+ 39 : : }
+ 40 : 142 : options = options_;
+ 41 : : }
+ 42 : :
+ 43 : : /*//////////////////////////////////////////////////////////////
+ 44 : : PUBLIC/EXTERNAL FUNCTIONS
+ 45 : : //////////////////////////////////////////////////////////////*/
+ 46 : : /**
+ 47 : : * @notice function called by the RuleEngine
+ 48 : : * @dev Returns true if the transfer is valid, and false otherwise.
+ 49 : : * Add access control with the RuleEngine
+ 50 : : */
+ 51 : : function operateOnTransfer(
+ 52 : : address _from,
+ 53 : : address _to,
+ 54 : : uint256 _amount
+ 55 : : )
+ 56 : : public
+ 57 : : override
+ 58 : : onlyRole(RULE_ENGINE_CONTRACT_ROLE)
+ 59 : : returns (bool isValid)
+ 60 : : {
+ 61 [ + + ]: 35 : if (_validateTransfer(_from, _to)) {
+ 62 : 6 : return true;
+ 63 : : } else {
+ 64 : 29 : bytes32 key = keccak256(abi.encode(_from, _to, _amount));
+ 65 [ + + ]: 29 : if (_validateApproval(key)) {
+ 66 : 12 : _updateProcessedTransfer(key);
+ 67 : 12 : return true;
+ 68 : : } else {
+ 69 : 17 : return false;
+ 70 : : }
+ 71 : : }
+ 72 : : }
+ 73 : :
+ 74 : : /**
+ 75 : : * @notice Create a request of transfer for yourselves
+ 76 : : * @param to recipient of tokens
+ 77 : : * @param value amount of tokens to transfer
+ 78 : : */
+ 79 : : function createTransferRequest(address to, uint256 value) public {
+ 80 : : // WAIT => Will set a new delay to approve
+ 81 : : // APPROVED => will overwrite previous status
+ 82 : : // DENIED => reject
+ 83 : 107 : address from = _msgSender();
+ 84 : 107 : bytes32 key = keccak256(abi.encode(from, to, value));
+ 85 [ + ]: 107 : if (transferRequests[key].status == STATUS.DENIED) {
+ 86 : 1 : revert RuleConditionalTransfer_TransferDenied();
+ 87 : : }
+ 88 [ + + ]: 106 : if (_checkRequestStatus(key)) {
+ 89 : 103 : uint256 requestIdLocal = requestId;
+ 90 : 103 : TransferRequest memory newTransferApproval = TransferRequest({
+ 91 : : key: key,
+ 92 : : id: requestIdLocal,
+ 93 : : keyElement: TransferRequestKeyElement({
+ 94 : : from: from,
+ 95 : : to: to,
+ 96 : : value: value
+ 97 : : }),
+ 98 : : askTime: block.timestamp,
+ 99 : : maxTime: 0,
+ 100 : : status: STATUS.WAIT
+ 101 : : });
+ 102 : 103 : transferRequests[key] = newTransferApproval;
+ 103 : 103 : IdToKey[requestIdLocal] = key;
+ 104 : 103 : emit transferWaiting(key, from, to, value, requestId);
+ 105 : 103 : ++requestId;
+ 106 : : } else {
+ 107 : : // Overwrite previous approval
+ 108 : 3 : transferRequests[key].askTime = block.timestamp;
+ 109 : 3 : transferRequests[key].status = STATUS.WAIT;
+ 110 : 3 : emit transferWaiting(
+ 111 : : key,
+ 112 : : from,
+ 113 : : to,
+ 114 : : value,
+ 115 : : transferRequests[key].id
+ 116 : : );
+ 117 : : }
+ 118 : : }
+ 119 : :
+ 120 : : /**
+ 121 : : * @notice Batch version of {createTransferRequest}
+ 122 : : */
+ 123 : : function createTransferRequestBatch(
+ 124 : : address[] memory tos,
+ 125 : : uint256[] memory values
+ 126 : : ) public {
+ 127 [ + ]: 3 : if (tos.length == 0) {
+ 128 : 1 : revert RuleConditionalTransfer_EmptyArray();
+ 129 : : }
+ 130 [ + ]: 2 : if (tos.length != values.length) {
+ 131 : 1 : revert RuleConditionalTransfer_InvalidLengthArray();
+ 132 : : }
+ 133 : 1 : for (uint256 i = 0; i < tos.length; ++i) {
+ 134 : 3 : createTransferRequest(tos[i], values[i]);
+ 135 : : }
+ 136 : : }
+ 137 : :
+ 138 : : /**
+ 139 : : * @notice allow a token holder to cancel/reset his own request
+ 140 : : */
+ 141 : : function cancelTransferRequest(uint256 requestId_) public {
+ 142 : 6 : _cancelTransferRequest(requestId_);
+ 143 : : }
+ 144 : :
+ 145 : : /**
+ 146 : : * @notice allow a token holder to cancel/reset his own request
+ 147 : : */
+ 148 : : function cancelTransferRequestBatch(uint256[] memory requestIds) public {
+ 149 [ + ]: 3 : if (requestIds.length == 0) {
+ 150 : 1 : revert RuleConditionalTransfer_EmptyArray();
+ 151 : : }
+ 152 : : // Check id validity before performing actions
+ 153 : 2 : for (uint256 i = 0; i < requestIds.length; ++i) {
+ 154 [ + ]: 5 : if (requestIds[i] + 1 > requestId) {
+ 155 : 1 : revert RuleConditionalTransfer_InvalidId();
+ 156 : : }
+ 157 : : }
+ 158 : 1 : for (uint256 i = 0; i < requestIds.length; ++i) {
+ 159 : 3 : _cancelTransferRequest(requestIds[i]);
+ 160 : : }
+ 161 : : }
+ 162 : :
+ 163 : : function getRequestTrade(
+ 164 : : address from,
+ 165 : : address to,
+ 166 : : uint256 value
+ 167 : : ) public view returns (TransferRequest memory) {
+ 168 : 57 : bytes32 key = keccak256(abi.encode(from, to, value));
+ 169 : 57 : return transferRequests[key];
+ 170 : : }
+ 171 : :
+ 172 : : /**
+ 173 : : * @notice get Trade by status
+ 174 : : * @param _targetStatus The status of the transactions you want to retrieve
+ 175 : : * @return array with corresponding transactions
+ 176 : : */
+ 177 : : function getRequestByStatus(
+ 178 : : STATUS _targetStatus
+ 179 : : ) public view returns (TransferRequest[] memory) {
+ 180 : 35 : uint totalRequestCount = requestId;
+ 181 : 35 : uint requestCount = 0;
+ 182 : 35 : uint currentIndex = 0;
+ 183 : :
+ 184 : : // We count the number of requests matching the criteria
+ 185 : 35 : for (uint i = 0; i < totalRequestCount; ++i) {
+ 186 [ + ]: 38 : if (transferRequests[IdToKey[i]].status == _targetStatus) {
+ 187 : 36 : requestCount += 1;
+ 188 : : }
+ 189 : : }
+ 190 : :
+ 191 : : // We reserve the memory to store the trade
+ 192 : 35 : TransferRequest[] memory requests = new TransferRequest[](requestCount);
+ 193 : :
+ 194 : : // We create an array with the list of trade
+ 195 : 35 : for (uint i = 0; i < totalRequestCount; ++i) {
+ 196 [ + ]: 38 : if (transferRequests[IdToKey[i]].status == _targetStatus) {
+ 197 : : //uint currentId = i + 1;
+ 198 : 36 : TransferRequest memory currentRequest = transferRequests[
+ 199 : : IdToKey[i]
+ 200 : : ];
+ 201 : 36 : requests[currentIndex] = currentRequest;
+ 202 : 36 : currentIndex += 1;
+ 203 : : }
+ 204 : : }
+ 205 : 35 : return requests;
+ 206 : : }
207 : :
- 208 : : // We reserve the memory to store the trade
- 209 : 105 : TransferRequest[] memory requests = new TransferRequest[](requestCount);
- 210 : :
- 211 : : // We create an array with the list of trade
- 212 : 181 : for (uint i = 0; i < totalRequestCount; ++i) {
- 213 [ # + ]: 76 : if (transferRequests[IdToKey[i]].status == _targetStatus) {
- 214 : : //uint currentId = i + 1;
- 215 : 72 : TransferRequest memory currentRequest = transferRequests[
- 216 : : IdToKey[i]
- 217 : : ];
- 218 : 72 : requests[currentIndex] = currentRequest;
- 219 : 72 : currentIndex += 1;
- 220 : : }
- 221 : : }
- 222 : 70 : return requests;
- 223 : : }
- 224 : :
- 225 : : /**
- 226 : : * @notice Check if the transfer is valid
- 227 : : * @param _from the origin address
- 228 : : * @param _to the destination address
- 229 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
- 230 : : **/
- 231 : : function detectTransferRestriction(
- 232 : : address _from,
- 233 : : address _to,
- 234 : : uint256 _amount
- 235 : : ) public view override returns (uint8) {
- 236 : : // No need of approval if from and to are in the whitelist
- 237 [ # + ]: 44 : if (address(whitelistConditionalTransfer) != address(0)) {
- 238 [ # + ]: : if (
- 239 : 9 : whitelistConditionalTransfer.addressIsListed(_from) &&
- 240 : 4 : whitelistConditionalTransfer.addressIsListed(_to)
- 241 : : ) {
- 242 : 3 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
- 243 : : }
- 244 : : }
- 245 : 30 : bytes32 key = keccak256(abi.encode(_from, _to, _amount));
- 246 [ + + ]: 40 : if (!_validateBurnMint(_from, _to) && !_validateApproval(key)) {
- 247 : 16 : return CODE_TRANSFER_REQUEST_NOT_APPROVED;
- 248 : : } else {
- 249 : 6 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
- 250 : : }
- 251 : : }
- 252 : :
- 253 : : /**
- 254 : : * @notice To know if the restriction code is valid for this rule or not.
- 255 : : * @param _restrictionCode The target restriction code
- 256 : : * @return true if the restriction code is known, false otherwise
- 257 : : **/
- 258 : : function canReturnTransferRestrictionCode(
- 259 : : uint8 _restrictionCode
- 260 : : ) external pure override returns (bool) {
- 261 : 6 : return _restrictionCode == CODE_TRANSFER_REQUEST_NOT_APPROVED;
- 262 : : }
- 263 : :
- 264 : : /**
- 265 : : * @notice Return the corresponding message
- 266 : : * @param _restrictionCode The target restriction code
- 267 : : * @return true if the transfer is valid, false otherwise
- 268 : : **/
- 269 : : function messageForTransferRestriction(
- 270 : : uint8 _restrictionCode
- 271 : : ) external pure override returns (string memory) {
- 272 [ + + ]: 6 : if (_restrictionCode == CODE_TRANSFER_REQUEST_NOT_APPROVED) {
- 273 : 4 : return TEXT_TRANSFER_REQUEST_NOT_APPROVED;
- 274 : : } else {
- 275 : 2 : return TEXT_CODE_NOT_FOUND;
- 276 : : }
- 277 : : }
- 278 : :
- 279 : :
- 280 : : /*//////////////////////////////////////////////////////////////
- 281 : : INTERNAL FUNCTIONS
- 282 : : //////////////////////////////////////////////////////////////*/
- 283 : :
- 284 : : function _cancelTransferRequest(uint256 requestId_) internal {
- 285 [ + + ]: 27 : if (requestId_ + 1 > requestId) {
- 286 : 2 : revert RuleConditionalTransfer_InvalidId();
- 287 : : }
- 288 : 16 : bytes32 key = IdToKey[requestId_];
- 289 : : // Check Sender
- 290 [ + + ]: 24 : if (transferRequests[key].keyElement.from != _msgSender()) {
- 291 : 2 : revert RuleConditionalTransfer_InvalidSender();
- 292 : : }
- 293 : : // Check status
- 294 [ + + ]: : if (
- 295 : 21 : transferRequests[key].status != STATUS.WAIT &&
- 296 : 4 : transferRequests[key].status != STATUS.APPROVED
- 297 : : ) {
- 298 : 2 : revert RuleConditionalTransfer_Wrong_Status();
- 299 : : }
- 300 : 12 : _resetRequestStatus(key);
- 301 : : }
- 302 : :
- 303 : : /**
- 304 : : *
- 305 : : * @dev
- 306 : : * Test burn and mint condition
- 307 : : * Returns true if the transfer is valid, and false otherwise.
- 308 : : *
- 309 : : */
- 310 : : function _validateBurnMint(
- 311 : : address _from,
- 312 : : address _to
- 313 : : ) internal view returns (bool isValid) {
- 314 : : // Mint & Burn
- 315 [ + + ]: : if (
- 316 : 82 : (_from == address(0) &&
- 317 : : options.issuance.authorizedMintWithoutApproval) ||
- 318 : : (_to == address(0) &&
- 319 : : options.issuance.authorizedBurnWithoutApproval)
- 320 : : ) {
- 321 : 8 : return true;
- 322 : : }
- 323 : 74 : return false;
- 324 : : }
- 325 : :
- 326 : : /**
- 327 : : *
- 328 : : * @dev
- 329 : : * Test transfer approval condition
- 330 : : * Returns true if the transfer is valid, and false otherwise.
- 331 : : */
- 332 : : function _validateApproval(
- 333 : : bytes32 key
- 334 : : ) internal view returns (bool isValid) {
- 335 : : // If automatic approval is activate and time to approve the request has passed
- 336 : 111 : bool automaticApprovalCondition = options
- 337 : : .automaticApproval
- 338 : : .isActivate &&
- 339 : : ((transferRequests[key].askTime +
- 340 : : options.automaticApproval.timeLimitBeforeAutomaticApproval) >=
- 341 : : block.timestamp);
- 342 : : // If the transfer is approved and delay to perform the transfer is respected
- 343 : 111 : bool isTransferApproved = (transferRequests[key].status ==
- 344 : : STATUS.APPROVED) &&
- 345 : : (transferRequests[key].maxTime >= block.timestamp);
- 346 [ + + ]: 74 : if (automaticApprovalCondition || isTransferApproved) {
- 347 : 24 : return true;
- 348 : : } else {
- 349 : 50 : return false;
- 350 : : }
- 351 : : }
- 352 : :
- 353 : : /*//////////////////////////////////////////////////////////////
- 354 : : ERC-2771
- 355 : : //////////////////////////////////////////////////////////////*/
- 356 : :
- 357 : : /**
- 358 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 359 : : */
- 360 : : function _msgSender()
- 361 : : internal
- 362 : : view
- 363 : : override(ERC2771Context, Context)
- 364 : : returns (address sender)
- 365 : : {
- 366 : 1356 : return ERC2771Context._msgSender();
- 367 : : }
- 368 : :
- 369 : : /**
- 370 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 371 : : */
- 372 : : function _msgData()
- 373 : : internal
- 374 : : view
- 375 : : override(ERC2771Context, Context)
- 376 : : returns (bytes calldata)
- 377 : : {
- 378 : 0 : return ERC2771Context._msgData();
- 379 : : }
- 380 : :
- 381 : : /**
- 382 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 383 : : */
- 384 : : function _contextSuffixLength()
- 385 : : internal
- 386 : : view
- 387 : : override(ERC2771Context, Context)
- 388 : : returns (uint256)
- 389 : : {
- 390 : 1356 : return ERC2771Context._contextSuffixLength();
- 391 : : }
- 392 : : }
+ 208 : : /**
+ 209 : : * @notice Check if the transfer is valid
+ 210 : : * @param _from the origin address
+ 211 : : * @param _to the destination address
+ 212 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
+ 213 : : **/
+ 214 : : function detectTransferRestriction(
+ 215 : : address _from,
+ 216 : : address _to,
+ 217 : : uint256 _amount
+ 218 : : ) public view override returns (uint8) {
+ 219 : : // No need of approval if from and to are in the whitelist
+ 220 [ + ]: 31 : if (_validateTransfer(_from, _to)) {
+ 221 : 1 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 222 : : }
+ 223 : 30 : bytes32 key = keccak256(abi.encode(_from, _to, _amount));
+ 224 [ + + ]: 30 : if (_validateApproval(key)) {
+ 225 : 6 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 226 : : } else {
+ 227 : 24 : return CODE_TRANSFER_REQUEST_NOT_APPROVED;
+ 228 : : }
+ 229 : : }
+ 230 : :
+ 231 : : /**
+ 232 : : * @notice To know if the restriction code is valid for this rule or not.
+ 233 : : * @param _restrictionCode The target restriction code
+ 234 : : * @return true if the restriction code is known, false otherwise
+ 235 : : **/
+ 236 : : function canReturnTransferRestrictionCode(
+ 237 : : uint8 _restrictionCode
+ 238 : : ) external pure override returns (bool) {
+ 239 : 2 : return _restrictionCode == CODE_TRANSFER_REQUEST_NOT_APPROVED;
+ 240 : : }
+ 241 : :
+ 242 : : /**
+ 243 : : * @notice Return the corresponding message
+ 244 : : * @param _restrictionCode The target restriction code
+ 245 : : * @return true if the transfer is valid, false otherwise
+ 246 : : **/
+ 247 : : function messageForTransferRestriction(
+ 248 : : uint8 _restrictionCode
+ 249 : : ) external pure override returns (string memory) {
+ 250 [ + + ]: 3 : if (_restrictionCode == CODE_TRANSFER_REQUEST_NOT_APPROVED) {
+ 251 : 2 : return TEXT_TRANSFER_REQUEST_NOT_APPROVED;
+ 252 : : } else {
+ 253 : 1 : return TEXT_CODE_NOT_FOUND;
+ 254 : : }
+ 255 : : }
+ 256 : :
+ 257 : : /*//////////////////////////////////////////////////////////////
+ 258 : : INTERNAL FUNCTIONS
+ 259 : : //////////////////////////////////////////////////////////////*/
+ 260 : : function _validateTransfer(
+ 261 : : address _from,
+ 262 : : address _to
+ 263 : : ) internal view returns (bool) {
+ 264 : : // No need of approval if from and to are in the whitelist
+ 265 [ + ]: 66 : if (address(whitelistConditionalTransfer) != address(0)) {
+ 266 : : if (
+ 267 : 30 : whitelistConditionalTransfer.addressIsListed(_from) &&
+ 268 : 5 : whitelistConditionalTransfer.addressIsListed(_to)
+ 269 [ + ]: 3 : ) {
+ 270 : 3 : return true;
+ 271 : : }
+ 272 : : }
+ 273 : :
+ 274 : : // Mint & Burn
+ 275 [ + ]: 63 : if (_validateBurnMint(_from, _to)) {
+ 276 : 4 : return true;
+ 277 : : }
+ 278 : 59 : return false;
+ 279 : : }
+ 280 : :
+ 281 : : function _cancelTransferRequest(uint256 requestId_) internal {
+ 282 [ + ]: 9 : if (requestId_ + 1 > requestId) {
+ 283 : 1 : revert RuleConditionalTransfer_InvalidId();
+ 284 : : }
+ 285 : 8 : bytes32 key = IdToKey[requestId_];
+ 286 : : // Check Sender
+ 287 [ + ]: 8 : if (transferRequests[key].keyElement.from != _msgSender()) {
+ 288 : 1 : revert RuleConditionalTransfer_InvalidSender();
+ 289 : : }
+ 290 : : // Check status
+ 291 : : if (
+ 292 : 7 : transferRequests[key].status != STATUS.WAIT &&
+ 293 : 2 : transferRequests[key].status != STATUS.APPROVED
+ 294 [ + ]: 1 : ) {
+ 295 : 1 : revert RuleConditionalTransfer_Wrong_Status();
+ 296 : : }
+ 297 : 6 : _resetRequestStatus(key);
+ 298 : : }
+ 299 : :
+ 300 : : /**
+ 301 : : *
+ 302 : : * @dev
+ 303 : : * Test burn and mint condition
+ 304 : : * Returns true if the transfer is valid, and false otherwise.
+ 305 : : *
+ 306 : : */
+ 307 : : function _validateBurnMint(
+ 308 : : address _from,
+ 309 : : address _to
+ 310 : : ) internal view returns (bool isValid) {
+ 311 : : // Mint & Burn
+ 312 : : if (
+ 313 : 63 : (_from == address(0) &&
+ 314 : : options.issuance.authorizedMintWithoutApproval) ||
+ 315 : : (_to == address(0) &&
+ 316 : : options.issuance.authorizedBurnWithoutApproval)
+ 317 [ + ]: 4 : ) {
+ 318 : 4 : return true;
+ 319 : : }
+ 320 : 59 : return false;
+ 321 : : }
+ 322 : :
+ 323 : : /**
+ 324 : : *
+ 325 : : * @dev
+ 326 : : * Test transfer approval condition
+ 327 : : * Returns true if the transfer is valid, and false otherwise.
+ 328 : : */
+ 329 : : function _validateApproval(
+ 330 : : bytes32 key
+ 331 : : ) internal view returns (bool isValid) {
+ 332 : : // If automatic approval is activate and time to approve the request has passed
+ 333 : : // Warning: overflow possible if timeLimitBeforeAutomaticApproval == max(uint256)
+ 334 : 59 : bool automaticApprovalCondition = options
+ 335 : : .automaticApproval
+ 336 : : .isActivate &&
+ 337 : 21 : block.timestamp >=
+ 338 : : (transferRequests[key].askTime +
+ 339 : : options.automaticApproval.timeLimitBeforeAutomaticApproval);
+ 340 : : // If the transfer is approved and delay to perform the transfer is respected
+ 341 : 59 : bool isTransferApproved = (transferRequests[key].status ==
+ 342 : : STATUS.APPROVED) &&
+ 343 : : (transferRequests[key].maxTime >= block.timestamp);
+ 344 [ + + ]: 59 : if (automaticApprovalCondition || isTransferApproved) {
+ 345 : 18 : return true;
+ 346 : : } else {
+ 347 : 41 : return false;
+ 348 : : }
+ 349 : : }
+ 350 : :
+ 351 : : /*//////////////////////////////////////////////////////////////
+ 352 : : ERC-2771
+ 353 : : //////////////////////////////////////////////////////////////*/
+ 354 : :
+ 355 : : /**
+ 356 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 357 : : */
+ 358 : : function _msgSender()
+ 359 : : internal
+ 360 : : view
+ 361 : : override(ERC2771Context, Context)
+ 362 : : returns (address sender)
+ 363 : : {
+ 364 : 745 : return ERC2771Context._msgSender();
+ 365 : : }
+ 366 : :
+ 367 : : /**
+ 368 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 369 : : */
+ 370 : : function _msgData()
+ 371 : : internal
+ 372 : : view
+ 373 : : override(ERC2771Context, Context)
+ 374 : : returns (bytes calldata)
+ 375 : : {
+ 376 : 0 : return ERC2771Context._msgData();
+ 377 : : }
+ 378 : :
+ 379 : : /**
+ 380 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 381 : : */
+ 382 : : function _contextSuffixLength()
+ 383 : : internal
+ 384 : : view
+ 385 : : override(ERC2771Context, Context)
+ 386 : : returns (uint256)
+ 387 : : {
+ 388 : 745 : return ERC2771Context._contextSuffixLength();
+ 389 : : }
+ 390 : : }
diff --git a/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func-sort-c.html
index 280a1ff..1071825 100644
--- a/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func-sort-c.html
@@ -31,27 +31,27 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -68,10 +68,6 @@
Function Name
Hit count
-
- RuleConditionalTransferOperator._createTransferRequestWithApproval
- 0
-
RuleConditionalTransferOperator.createTransferRequestWithApprovalBatch
3
@@ -96,10 +92,6 @@
RuleConditionalTransferOperator.approveTransferRequestWithId
5
-
- RuleConditionalTransferOperator.setAutomaticApproval
- 5
-
RuleConditionalTransferOperator.setIssuanceOptions
5
@@ -117,32 +109,44 @@
7
- RuleConditionalTransferOperator._resetRequestStatus
- 10
+ RuleConditionalTransferOperator.setAutomaticApproval
+ 7
- RuleConditionalTransferOperator._updateProcessedTransfer
+ RuleConditionalTransferOperator._resetRequestStatus
10
+
+ RuleConditionalTransferOperator._updateProcessedTransfer
+ 12
+
+
+ RuleConditionalTransferOperator._createTransferRequestWithApproval
+ 15
+
RuleConditionalTransferOperator.setConditionalWhitelist
- 25
+ 26
RuleConditionalTransferOperator.approveTransferRequest
33
- RuleConditionalTransferOperator._approveTransferRequestKeyElement
+ RuleConditionalTransferOperator._approveTransferRequestKeyElement
41
- RuleConditionalTransferOperator._approveRequest
+ RuleConditionalTransferOperator._approveRequest
46
- RuleConditionalTransferOperator._checkRequestStatus
- 119
+ RuleConditionalTransferOperator._checkRequestStatus
+ 121
+
+
+ RuleConditionalTransferOperator.hasRole
+ 280
diff --git a/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func.html b/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func.html
index dfbb084..33ceb63 100644
--- a/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func.html
+++ b/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.func.html
@@ -31,27 +31,27 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -69,28 +69,28 @@
Hit count
- RuleConditionalTransferOperator._approveRequest
+ RuleConditionalTransferOperator._approveRequest
46
- RuleConditionalTransferOperator._approveTransferRequestKeyElement
+ RuleConditionalTransferOperator._approveTransferRequestKeyElement
41
- RuleConditionalTransferOperator._checkRequestStatus
- 119
+ RuleConditionalTransferOperator._checkRequestStatus
+ 121
- RuleConditionalTransferOperator._createTransferRequestWithApproval
- 0
+ RuleConditionalTransferOperator._createTransferRequestWithApproval
+ 15
- RuleConditionalTransferOperator._resetRequestStatus
+ RuleConditionalTransferOperator._resetRequestStatus
10
- RuleConditionalTransferOperator._updateProcessedTransfer
- 10
+ RuleConditionalTransferOperator._updateProcessedTransfer
+ 12
RuleConditionalTransferOperator.approveTransferRequest
@@ -116,6 +116,10 @@
RuleConditionalTransferOperator.createTransferRequestWithApprovalBatch
3
+
+ RuleConditionalTransferOperator.hasRole
+ 280
+
RuleConditionalTransferOperator.resetRequestStatus
3
@@ -126,7 +130,7 @@
RuleConditionalTransferOperator.setAutomaticApproval
- 5
+ 7
RuleConditionalTransferOperator.setAutomaticTransfer
@@ -134,7 +138,7 @@
RuleConditionalTransferOperator.setConditionalWhitelist
- 25
+ 26
RuleConditionalTransferOperator.setIssuanceOptions
diff --git a/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.gcov.html b/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.gcov.html
index 2179f73..54a9877 100644
--- a/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/operation/abstract/RuleConditionalTransferOperator.sol.gcov.html
@@ -31,27 +31,27 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -103,28 +103,28 @@
32 : : function setConditionalWhitelist(
33 : : RuleWhitelist newWhitelistConditionalTransfer
34 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 35 : 50 : whitelistConditionalTransfer = newWhitelistConditionalTransfer;
- 36 : 50 : emit WhitelistConditionalTransfer(newWhitelistConditionalTransfer);
+ 35 : 26 : whitelistConditionalTransfer = newWhitelistConditionalTransfer;
+ 36 : 26 : emit WhitelistConditionalTransfer(newWhitelistConditionalTransfer);
37 : : }
38 : :
39 : : /**
- 40 : : * @notice set/unset the issuance options (mint & burn)
- 41 : : */
+ 40 : : * @notice set/unset the issuance options (mint & burn)
+ 41 : : */
42 : : function setIssuanceOptions(
43 : : ISSUANCE calldata issuance_
44 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 45 [ + + ]: : if (
- 46 : 8 : options.issuance.authorizedMintWithoutApproval !=
+ 45 : : if (
+ 46 : 4 : options.issuance.authorizedMintWithoutApproval !=
47 : : issuance_.authorizedMintWithoutApproval
- 48 : : ) {
- 49 : 4 : options.issuance.authorizedMintWithoutApproval = issuance_
+ 48 [ + ]: 2 : ) {
+ 49 : 2 : options.issuance.authorizedMintWithoutApproval = issuance_
50 : : .authorizedMintWithoutApproval;
51 : : }
- 52 [ + + ]: : if (
- 53 : 8 : options.issuance.authorizedBurnWithoutApproval !=
+ 52 : : if (
+ 53 : 4 : options.issuance.authorizedBurnWithoutApproval !=
54 : : issuance_.authorizedBurnWithoutApproval
- 55 : : ) {
- 56 : 4 : options.issuance.authorizedBurnWithoutApproval = issuance_
+ 55 [ + ]: 2 : ) {
+ 56 : 2 : options.issuance.authorizedBurnWithoutApproval = issuance_
57 : : .authorizedBurnWithoutApproval;
58 : : }
59 : : }
@@ -137,19 +137,19 @@
66 : : function setAutomaticTransfer(
67 : : AUTOMATIC_TRANSFER calldata automaticTransfer_
68 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 69 [ + + ]: : if (
- 70 : 4 : automaticTransfer_.isActivate !=
+ 69 : : if (
+ 70 : 2 : automaticTransfer_.isActivate !=
71 : : options.automaticTransfer.isActivate
- 72 : : ) {
- 73 : 4 : options.automaticTransfer.isActivate = automaticTransfer_
+ 72 [ + ]: 2 : ) {
+ 73 : 2 : options.automaticTransfer.isActivate = automaticTransfer_
74 : : .isActivate;
75 : : }
76 : : // No need to put the cmtat to zero to deactivate automaticTransfer
- 77 [ + + ]: : if (
- 78 : 6 : address(automaticTransfer_.cmtat) !=
- 79 : 4 : address(options.automaticTransfer.cmtat)
- 80 : : ) {
- 81 : 4 : options.automaticTransfer.cmtat = automaticTransfer_.cmtat;
+ 77 : : if (
+ 78 : 2 : address(automaticTransfer_.cmtat) !=
+ 79 : : address(options.automaticTransfer.cmtat)
+ 80 [ + ]: 2 : ) {
+ 81 : 2 : options.automaticTransfer.cmtat = automaticTransfer_.cmtat;
82 : : }
83 : : }
84 : :
@@ -161,18 +161,18 @@
90 : : function setTimeLimit(
91 : : TIME_LIMIT memory timeLimit_
92 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 93 [ + + ]: : if (
- 94 : 6 : options.timeLimit.timeLimitToApprove !=
+ 93 : : if (
+ 94 : 3 : options.timeLimit.timeLimitToApprove !=
95 : : timeLimit_.timeLimitToApprove
- 96 : : ) {
- 97 : 6 : options.timeLimit.timeLimitToApprove = timeLimit_
+ 96 [ + ]: 3 : ) {
+ 97 : 3 : options.timeLimit.timeLimitToApprove = timeLimit_
98 : : .timeLimitToApprove;
99 : : }
- 100 [ + + ]: : if (
- 101 : 6 : options.timeLimit.timeLimitToTransfer !=
+ 100 : : if (
+ 101 : 3 : options.timeLimit.timeLimitToTransfer !=
102 : : timeLimit_.timeLimitToTransfer
- 103 : : ) {
- 104 : 6 : options.timeLimit.timeLimitToTransfer = timeLimit_
+ 103 [ + ]: 3 : ) {
+ 104 : 3 : options.timeLimit.timeLimitToTransfer = timeLimit_
105 : : .timeLimitToTransfer;
106 : : }
107 : : }
@@ -185,18 +185,18 @@
114 : : function setAutomaticApproval(
115 : : AUTOMATIC_APPROVAL memory automaticApproval_
116 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 117 [ + + ]: : if (
- 118 : 8 : options.automaticApproval.isActivate !=
+ 117 : : if (
+ 118 : 6 : options.automaticApproval.isActivate !=
119 : : automaticApproval_.isActivate
- 120 : : ) {
- 121 : 8 : options.automaticApproval.isActivate = automaticApproval_
+ 120 [ + ]: 6 : ) {
+ 121 : 6 : options.automaticApproval.isActivate = automaticApproval_
122 : : .isActivate;
123 : : }
- 124 [ + + ]: : if (
- 125 : 8 : options.automaticApproval.timeLimitBeforeAutomaticApproval !=
+ 124 : : if (
+ 125 : 6 : options.automaticApproval.timeLimitBeforeAutomaticApproval !=
126 : : automaticApproval_.timeLimitBeforeAutomaticApproval
- 127 : : ) {
- 128 : 8 : options
+ 127 [ + ]: 6 : ) {
+ 128 : 6 : options
129 : : .automaticApproval
130 : : .timeLimitBeforeAutomaticApproval = automaticApproval_
131 : : .timeLimitBeforeAutomaticApproval;
@@ -209,21 +209,21 @@
138 : : function createTransferRequestWithApproval(
139 : : TransferRequestKeyElement calldata keyElement
140 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 141 : 10 : _createTransferRequestWithApproval(keyElement);
+ 141 : 5 : _createTransferRequestWithApproval(keyElement);
142 : : }
143 : :
144 : : /**
- 145 : : @notice approve a transferRequest
- 146 : : @param keyElement contains from, to, value
- 147 : : @param partialValue amount approved. Put 0 if all the amount specified by value is approved.
- 148 : : @param isApproved approved (true) or refused (false). Put true if you use partialApproval
- 149 : : */
+ 145 : : * @notice approve a transferRequest
+ 146 : : * @param keyElement contains from, to, value
+ 147 : : * @param partialValue amount approved. Put 0 if all the amount specified by value is approved.
+ 148 : : * @param isApproved approved (true) or refused (false). Put true if you use partialApproval
+ 149 : : */
150 : : function approveTransferRequest(
151 : : TransferRequestKeyElement calldata keyElement,
152 : : uint256 partialValue,
153 : : bool isApproved
154 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 155 : 64 : _approveTransferRequestKeyElement(keyElement, partialValue, isApproved);
+ 155 : 32 : _approveTransferRequestKeyElement(keyElement, partialValue, isApproved);
156 : : }
157 : :
158 : : /**
@@ -233,13 +233,13 @@
162 : : uint256 requestId_,
163 : : bool isApproved
164 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 165 [ + + ]: 12 : if (requestId_ + 1 > requestId) {
- 166 : 4 : revert RuleConditionalTransfer_InvalidId();
+ 165 [ + ]: 4 : if (requestId_ + 1 > requestId) {
+ 166 : 2 : revert RuleConditionalTransfer_InvalidId();
167 : : }
- 168 : 4 : TransferRequest memory transferRequest = transferRequests[
+ 168 : 2 : TransferRequest memory transferRequest = transferRequests[
169 : : IdToKey[requestId_]
170 : : ];
- 171 : 4 : _approveRequest(transferRequest, isApproved);
+ 171 : 2 : _approveRequest(transferRequest, isApproved);
172 : : }
173 : :
174 : : /**
@@ -248,14 +248,14 @@
177 : : function resetRequestStatus(
178 : : uint256 requestId_
179 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 180 [ + + ]: 6 : if (requestId_ + 1 > requestId) {
- 181 : 2 : revert RuleConditionalTransfer_InvalidId();
+ 180 [ + ]: 2 : if (requestId_ + 1 > requestId) {
+ 181 : 1 : revert RuleConditionalTransfer_InvalidId();
182 : : }
- 183 : 2 : bytes32 key = IdToKey[requestId_];
- 184 : 2 : _resetRequestStatus(key);
+ 183 : 1 : bytes32 key = IdToKey[requestId_];
+ 184 : 1 : _resetRequestStatus(key);
185 : : }
186 : :
- 187 : : /***** Batch function */
+ 187 : : /* ============ Batch function ============ */
188 : : /**
189 : : * @notice Batch version of {approveTransferRequestWithId}
190 : : */
@@ -263,23 +263,23 @@
192 : : uint256[] calldata requestId_,
193 : : bool[] calldata isApproved
194 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 195 [ + + ]: 10 : if (requestId_.length == 0) {
- 196 : 2 : revert RuleConditionalTransfer_EmptyArray();
+ 195 [ + ]: 5 : if (requestId_.length == 0) {
+ 196 : 1 : revert RuleConditionalTransfer_EmptyArray();
197 : : }
- 198 [ + + ]: 8 : if (requestId_.length != isApproved.length) {
- 199 : 2 : revert RuleConditionalTransfer_InvalidLengthArray();
+ 198 [ + ]: 4 : if (requestId_.length != isApproved.length) {
+ 199 : 1 : revert RuleConditionalTransfer_InvalidLengthArray();
200 : : }
201 : : // Check id validity before performing actions
- 202 : 29 : for (uint256 i = 0; i < requestId_.length; ++i) {
- 203 [ + + ]: 33 : if (requestId_[i] + 1 > requestId) {
- 204 : 2 : revert RuleConditionalTransfer_InvalidId();
+ 202 : 3 : for (uint256 i = 0; i < requestId_.length; ++i) {
+ 203 [ + ]: 11 : if (requestId_[i] + 1 > requestId) {
+ 204 : 1 : revert RuleConditionalTransfer_InvalidId();
205 : : }
206 : : }
- 207 : 14 : for (uint256 i = 0; i < requestId_.length; ++i) {
- 208 : 10 : TransferRequest memory transferRequest = transferRequests[
+ 207 : 2 : for (uint256 i = 0; i < requestId_.length; ++i) {
+ 208 : 5 : TransferRequest memory transferRequest = transferRequests[
209 : : IdToKey[requestId_[i]]
210 : : ];
- 211 : 10 : _approveRequest(transferRequest, isApproved[i]);
+ 211 : 5 : _approveRequest(transferRequest, isApproved[i]);
212 : : }
213 : : }
214 : :
@@ -291,17 +291,17 @@
220 : : uint256[] calldata partialValues,
221 : : bool[] calldata isApproved
222 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 223 [ + + ]: 12 : if (keyElements.length == 0) {
- 224 : 2 : revert RuleConditionalTransfer_EmptyArray();
+ 223 [ + ]: 6 : if (keyElements.length == 0) {
+ 224 : 1 : revert RuleConditionalTransfer_EmptyArray();
225 : : }
- 226 [ + + ]: : if (
- 227 : 10 : (keyElements.length != partialValues.length) ||
+ 226 : : if (
+ 227 : 5 : (keyElements.length != partialValues.length) ||
228 : : (partialValues.length != isApproved.length)
- 229 : : ) {
- 230 : 6 : revert RuleConditionalTransfer_InvalidLengthArray();
+ 229 [ + ]: 3 : ) {
+ 230 : 3 : revert RuleConditionalTransfer_InvalidLengthArray();
231 : : }
- 232 : 24 : for (uint256 i = 0; i < keyElements.length; ++i) {
- 233 : 18 : _approveTransferRequestKeyElement(
+ 232 : 2 : for (uint256 i = 0; i < keyElements.length; ++i) {
+ 233 : 9 : _approveTransferRequestKeyElement(
234 : : keyElements[i],
235 : : partialValues[i],
236 : : isApproved[i]
@@ -315,11 +315,11 @@
244 : : function createTransferRequestWithApprovalBatch(
245 : : TransferRequestKeyElement[] calldata keyElements
246 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 247 [ + + ]: 4 : if (keyElements.length == 0) {
- 248 : 2 : revert RuleConditionalTransfer_EmptyArray();
+ 247 [ + ]: 2 : if (keyElements.length == 0) {
+ 248 : 1 : revert RuleConditionalTransfer_EmptyArray();
249 : : }
- 250 : 11 : for (uint256 i = 0; i < keyElements.length; ++i) {
- 251 : 8 : _createTransferRequestWithApproval(keyElements[i]);
+ 250 : 1 : for (uint256 i = 0; i < keyElements.length; ++i) {
+ 251 : 4 : _createTransferRequestWithApproval(keyElements[i]);
252 : : }
253 : : }
254 : :
@@ -329,198 +329,215 @@
258 : : function resetRequestStatusBatch(
259 : : uint256[] memory requestIds
260 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 261 [ + + ]: 6 : if (requestIds.length == 0) {
- 262 : 2 : revert RuleConditionalTransfer_EmptyArray();
+ 261 [ + ]: 3 : if (requestIds.length == 0) {
+ 262 : 1 : revert RuleConditionalTransfer_EmptyArray();
263 : : }
264 : : // Check id validity before performing actions
- 265 : 12 : for (uint256 i = 0; i < requestIds.length; ++i) {
- 266 [ + + ]: 12 : if (requestIds[i] + 1 > requestId) {
- 267 : 2 : revert RuleConditionalTransfer_InvalidId();
+ 265 : 2 : for (uint256 i = 0; i < requestIds.length; ++i) {
+ 266 [ + ]: 4 : if (requestIds[i] + 1 > requestId) {
+ 267 : 1 : revert RuleConditionalTransfer_InvalidId();
268 : : }
269 : : }
- 270 : 9 : for (uint256 i = 0; i < requestIds.length; ++i) {
- 271 : 6 : bytes32 key = IdToKey[requestIds[i]];
- 272 : 6 : _resetRequestStatus(key);
+ 270 : 1 : for (uint256 i = 0; i < requestIds.length; ++i) {
+ 271 : 3 : bytes32 key = IdToKey[requestIds[i]];
+ 272 : 3 : _resetRequestStatus(key);
273 : : }
274 : : }
275 : :
- 276 : : /*//////////////////////////////////////////////////////////////
- 277 : : INTERNAL FUNCTIONS
- 278 : : //////////////////////////////////////////////////////////////*/
- 279 : : function _approveTransferRequestKeyElement(
- 280 : : TransferRequestKeyElement calldata keyElement,
- 281 : : uint256 partialValue,
- 282 : : bool isApproved
- 283 : : ) internal {
- 284 [ + + ]: 82 : if (partialValue > keyElement.value) {
- 285 : 2 : revert RuleConditionalTransfer_InvalidValueApproved();
- 286 : : }
- 287 : 120 : bytes32 key = keccak256(
- 288 : : abi.encode(keyElement.from, keyElement.to, keyElement.value)
- 289 : : );
- 290 : 80 : TransferRequest memory transferRequest = transferRequests[key];
- 291 [ + + ]: 80 : if (partialValue > 0) {
- 292 [ + + ]: 14 : if (!isApproved) {
- 293 : 2 : revert RuleConditionalTransfer_CannotDeniedPartially();
- 294 : : }
- 295 : : // Denied the first request
- 296 : 12 : _approveRequest(transferRequest, false);
- 297 : : // Create new request
- 298 : 12 : _createTransferRequestWithApproval(
- 299 : : TransferRequestKeyElement({
- 300 : : from: keyElement.from,
- 301 : : to: keyElement.to,
- 302 : : value: partialValue
- 303 : : })
- 304 : : );
- 305 : : } else {
- 306 : 66 : _approveRequest(transferRequest, isApproved);
- 307 : : }
- 308 : : }
- 309 : :
- 310 : : function _createTransferRequestWithApproval(
- 311 : : TransferRequestKeyElement memory keyElement_
- 312 : : ) public onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
- 313 : : // WAIT => Will overwrite
- 314 : : // APPROVED => will overwrite previous status with a new delay
- 315 : : // DENIED => will overwrite
- 316 : 45 : bytes32 key = keccak256(
- 317 : : abi.encode(keyElement_.from, keyElement_.to, keyElement_.value)
- 318 : : );
- 319 [ # + ]: 30 : if (_checkRequestStatus(key)) {
- 320 : 42 : TransferRequest memory newTransferApproval = TransferRequest({
- 321 : : key: key,
- 322 : : id: requestId,
- 323 : : keyElement: keyElement_,
- 324 : : askTime: 0,
- 325 : : maxTime: block.timestamp +
- 326 : : options.timeLimit.timeLimitToTransfer,
- 327 : : status: STATUS.APPROVED
- 328 : : });
- 329 : 28 : transferRequests[key] = newTransferApproval;
- 330 : 28 : IdToKey[requestId] = key;
- 331 : 28 : emit transferApproved(
- 332 : : key,
- 333 : : keyElement_.from,
- 334 : : keyElement_.to,
- 335 : : keyElement_.value,
- 336 : : requestId
- 337 : : );
- 338 : 28 : ++requestId;
- 339 : : } else {
- 340 : : // Overwrite previous approval
- 341 : 2 : transferRequests[key].maxTime =
- 342 : : block.timestamp +
- 343 : : options.timeLimit.timeLimitToTransfer;
- 344 : 2 : transferRequests[key].status = STATUS.APPROVED;
- 345 : 2 : emit transferApproved(
- 346 : : key,
- 347 : : keyElement_.from,
- 348 : : keyElement_.to,
- 349 : : keyElement_.value,
- 350 : : transferRequests[key].id
- 351 : : );
- 352 : : }
- 353 : : }
- 354 : :
- 355 : : function _resetRequestStatus(bytes32 key) internal {
- 356 : 20 : transferRequests[key].status = STATUS.NONE;
- 357 : 20 : emit transferReset(
- 358 : : key,
- 359 : : transferRequests[key].keyElement.from,
- 360 : : transferRequests[key].keyElement.to,
- 361 : : transferRequests[key].keyElement.value,
- 362 : : transferRequests[key].id
- 363 : : );
- 364 : : }
- 365 : :
- 366 : : function _checkRequestStatus(bytes32 key) internal view returns (bool) {
- 367 : : // Status NONE not enough because reset is possible
- 368 : 238 : return
- 369 : 238 : (transferRequests[key].status == STATUS.NONE) &&
- 370 : : (transferRequests[key].key == 0x0);
- 371 : : }
- 372 : :
- 373 : : function _approveRequest(
- 374 : : TransferRequest memory transferRequest,
- 375 : : bool isApproved
- 376 : : ) internal {
- 377 : : // status
- 378 [ + + ]: 92 : if (transferRequest.status != STATUS.WAIT) {
- 379 : 2 : revert RuleConditionalTransfer_Wrong_Status();
- 380 : : }
- 381 [ + + ]: 45 : if (isApproved) {
- 382 : : // Time
- 383 [ + + ]: : if (
- 384 : 54 : block.timestamp >
- 385 : : (transferRequest.askTime + options.timeLimit.timeLimitToApprove)
- 386 : : ) {
- 387 : 6 : revert RuleConditionalTransfer_timeExceeded();
- 388 : : }
- 389 : : // Set status
- 390 : 48 : transferRequests[transferRequest.key].status = STATUS.APPROVED;
- 391 : : // Set max time
- 392 : 48 : transferRequests[transferRequest.key].maxTime =
- 393 : : block.timestamp +
- 394 : : options.timeLimit.timeLimitToTransfer;
- 395 : 48 : emit transferApproved(
- 396 : : transferRequest.key,
- 397 : : transferRequest.keyElement.from,
- 398 : : transferRequest.keyElement.to,
- 399 : : transferRequest.keyElement.value,
- 400 : : transferRequests[transferRequest.key].id
- 401 : : );
- 402 [ + + ]: : if (
- 403 : 48 : options.automaticTransfer.isActivate &&
- 404 : 8 : address(options.automaticTransfer.cmtat) != address(0)
- 405 : : ) {
- 406 : : // Transfer with approval
- 407 : : // External call
- 408 [ + + ]: : if (
- 409 : 6 : options.automaticTransfer.cmtat.allowance(
- 410 : : transferRequest.keyElement.from,
- 411 : : address(this)
- 412 : : ) >= transferRequest.keyElement.value
- 413 : : ) {
- 414 : : // Will call the ruleEngine and the rule again...
- 415 : 4 : options.automaticTransfer.cmtat.safeTransferFrom(
- 416 : : transferRequest.keyElement.from,
- 417 : : transferRequest.keyElement.to,
- 418 : : transferRequest.keyElement.value
- 419 : : );
- 420 : : }
- 421 : : }
- 422 : : } else {
- 423 : 36 : transferRequests[transferRequest.key].status = STATUS.DENIED;
- 424 : 36 : emit transferDenied(
- 425 : : transferRequest.key,
- 426 : : transferRequest.keyElement.from,
- 427 : : transferRequest.keyElement.to,
- 428 : : transferRequest.keyElement.value,
- 429 : : transferRequests[transferRequest.key].id
- 430 : : );
- 431 : : }
- 432 : : }
- 433 : :
- 434 : : /**
- 435 : : * @notice update the request during a transfer
- 436 : : */
- 437 : : function _updateProcessedTransfer(bytes32 key) internal {
- 438 : : // Reset to zero
- 439 : 20 : transferRequests[key].maxTime = 0;
- 440 : 20 : transferRequests[key].askTime = 0;
- 441 : : // Change status
- 442 : 20 : transferRequests[key].status = STATUS.EXECUTED;
- 443 : : // Emit event
- 444 : 20 : emit transferProcessed(
- 445 : : key,
- 446 : : transferRequests[key].keyElement.from,
- 447 : : transferRequests[key].keyElement.to,
- 448 : : transferRequests[key].keyElement.value,
- 449 : : transferRequests[key].id
- 450 : : );
- 451 : : }
- 452 : : }
+ 276 : : /* ============ ACCESS CONTROL ============ */
+ 277 : : /**
+ 278 : : * @dev Returns `true` if `account` has been granted `role`.
+ 279 : : */
+ 280 : : function hasRole(
+ 281 : : bytes32 role,
+ 282 : : address account
+ 283 : : ) public view virtual override(AccessControl) returns (bool) {
+ 284 : : // The Default Admin has all roles
+ 285 [ + ]: 630 : if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ 286 : 124 : return true;
+ 287 : : }
+ 288 : 506 : return AccessControl.hasRole(role, account);
+ 289 : : }
+ 290 : :
+ 291 : : /*//////////////////////////////////////////////////////////////
+ 292 : : INTERNAL FUNCTIONS
+ 293 : : //////////////////////////////////////////////////////////////*/
+ 294 : : function _approveTransferRequestKeyElement(
+ 295 : : TransferRequestKeyElement calldata keyElement,
+ 296 : : uint256 partialValue,
+ 297 : : bool isApproved
+ 298 : : ) internal {
+ 299 [ + ]: 41 : if (partialValue > keyElement.value) {
+ 300 : 1 : revert RuleConditionalTransfer_InvalidValueApproved();
+ 301 : : }
+ 302 : 40 : bytes32 key = keccak256(
+ 303 : : abi.encode(keyElement.from, keyElement.to, keyElement.value)
+ 304 : : );
+ 305 : 40 : TransferRequest memory transferRequest = transferRequests[key];
+ 306 [ + + ]: 40 : if (partialValue > 0) {
+ 307 [ + ]: 7 : if (!isApproved) {
+ 308 : 1 : revert RuleConditionalTransfer_CannotDeniedPartially();
+ 309 : : }
+ 310 : : // Denied the first request
+ 311 : 6 : _approveRequest(transferRequest, false);
+ 312 : : // Create new request
+ 313 : 6 : _createTransferRequestWithApproval(
+ 314 : : TransferRequestKeyElement({
+ 315 : : from: keyElement.from,
+ 316 : : to: keyElement.to,
+ 317 : : value: partialValue
+ 318 : : })
+ 319 : : );
+ 320 : : } else {
+ 321 : 33 : _approveRequest(transferRequest, isApproved);
+ 322 : : }
+ 323 : : }
+ 324 : :
+ 325 : : function _createTransferRequestWithApproval(
+ 326 : : TransferRequestKeyElement memory keyElement_
+ 327 : : ) internal onlyRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE) {
+ 328 : : // WAIT => Will overwrite
+ 329 : : // APPROVED => will overwrite previous status with a new delay
+ 330 : : // DENIED => will overwrite
+ 331 : 15 : bytes32 key = keccak256(
+ 332 : : abi.encode(keyElement_.from, keyElement_.to, keyElement_.value)
+ 333 : : );
+ 334 [ + + ]: 15 : if (_checkRequestStatus(key)) {
+ 335 : 14 : TransferRequest memory newTransferApproval = TransferRequest({
+ 336 : : key: key,
+ 337 : : id: requestId,
+ 338 : : keyElement: keyElement_,
+ 339 : : askTime: 0,
+ 340 : : // Warning: overflow possible if timeLimitToTransfer == max(uint256)
+ 341 : : maxTime: block.timestamp +
+ 342 : : options.timeLimit.timeLimitToTransfer,
+ 343 : : status: STATUS.APPROVED
+ 344 : : });
+ 345 : 14 : transferRequests[key] = newTransferApproval;
+ 346 : 14 : IdToKey[requestId] = key;
+ 347 : 14 : emit transferApproved(
+ 348 : : key,
+ 349 : : keyElement_.from,
+ 350 : : keyElement_.to,
+ 351 : : keyElement_.value,
+ 352 : : requestId
+ 353 : : );
+ 354 : 14 : ++requestId;
+ 355 : : } else {
+ 356 : : // Overwrite previous approval
+ 357 : : // Warning: overflow possible if timeLimitToTransfer == max(uint256)
+ 358 : 1 : transferRequests[key].maxTime =
+ 359 : : block.timestamp +
+ 360 : : options.timeLimit.timeLimitToTransfer;
+ 361 : 1 : transferRequests[key].status = STATUS.APPROVED;
+ 362 : 1 : emit transferApproved(
+ 363 : : key,
+ 364 : : keyElement_.from,
+ 365 : : keyElement_.to,
+ 366 : : keyElement_.value,
+ 367 : : transferRequests[key].id
+ 368 : : );
+ 369 : : }
+ 370 : : }
+ 371 : :
+ 372 : : function _resetRequestStatus(bytes32 key) internal {
+ 373 : 10 : transferRequests[key].status = STATUS.NONE;
+ 374 : 10 : emit transferReset(
+ 375 : : key,
+ 376 : : transferRequests[key].keyElement.from,
+ 377 : : transferRequests[key].keyElement.to,
+ 378 : : transferRequests[key].keyElement.value,
+ 379 : : transferRequests[key].id
+ 380 : : );
+ 381 : : }
+ 382 : :
+ 383 : : function _checkRequestStatus(bytes32 key) internal view returns (bool) {
+ 384 : : // Status NONE not enough because reset is possible
+ 385 : 121 : return
+ 386 : 121 : (transferRequests[key].status == STATUS.NONE) &&
+ 387 : : (transferRequests[key].key == 0x0);
+ 388 : : }
+ 389 : :
+ 390 : : function _approveRequest(
+ 391 : : TransferRequest memory transferRequest,
+ 392 : : bool isApproved
+ 393 : : ) internal {
+ 394 : : // status
+ 395 [ + ]: 46 : if (transferRequest.status != STATUS.WAIT) {
+ 396 : 1 : revert RuleConditionalTransfer_Wrong_Status();
+ 397 : : }
+ 398 [ + + ]: 27 : if (isApproved) {
+ 399 : : // Time
+ 400 : : if (
+ 401 : 27 : block.timestamp >
+ 402 : : (transferRequest.askTime + options.timeLimit.timeLimitToApprove)
+ 403 [ + ]: 3 : ) {
+ 404 : 3 : revert RuleConditionalTransfer_timeExceeded();
+ 405 : : }
+ 406 : : // Set status
+ 407 : 24 : transferRequests[transferRequest.key].status = STATUS.APPROVED;
+ 408 : : // Set max time
+ 409 : 24 : transferRequests[transferRequest.key].maxTime =
+ 410 : : block.timestamp +
+ 411 : : options.timeLimit.timeLimitToTransfer;
+ 412 : 24 : emit transferApproved(
+ 413 : : transferRequest.key,
+ 414 : : transferRequest.keyElement.from,
+ 415 : : transferRequest.keyElement.to,
+ 416 : : transferRequest.keyElement.value,
+ 417 : : transferRequests[transferRequest.key].id
+ 418 : : );
+ 419 : : if (
+ 420 : 24 : options.automaticTransfer.isActivate &&
+ 421 : 2 : address(options.automaticTransfer.cmtat) != address(0)
+ 422 [ + ]: 2 : ) {
+ 423 : : // Transfer with approval
+ 424 : : // External call
+ 425 : : if (
+ 426 : 2 : options.automaticTransfer.cmtat.allowance(
+ 427 : : transferRequest.keyElement.from,
+ 428 : : address(this)
+ 429 : : ) >= transferRequest.keyElement.value
+ 430 [ + ]: 2 : ) {
+ 431 : : // Will call the ruleEngine and the rule again...
+ 432 : 2 : options.automaticTransfer.cmtat.safeTransferFrom(
+ 433 : : transferRequest.keyElement.from,
+ 434 : : transferRequest.keyElement.to,
+ 435 : : transferRequest.keyElement.value
+ 436 : : );
+ 437 : : }
+ 438 : : }
+ 439 : : } else {
+ 440 : 18 : transferRequests[transferRequest.key].status = STATUS.DENIED;
+ 441 : 18 : emit transferDenied(
+ 442 : : transferRequest.key,
+ 443 : : transferRequest.keyElement.from,
+ 444 : : transferRequest.keyElement.to,
+ 445 : : transferRequest.keyElement.value,
+ 446 : : transferRequests[transferRequest.key].id
+ 447 : : );
+ 448 : : }
+ 449 : : }
+ 450 : :
+ 451 : : /**
+ 452 : : * @notice update the request during a transfer
+ 453 : : */
+ 454 : : function _updateProcessedTransfer(bytes32 key) internal {
+ 455 : : // Reset to zero
+ 456 : 12 : transferRequests[key].maxTime = 0;
+ 457 : 12 : transferRequests[key].askTime = 0;
+ 458 : : // Change status
+ 459 : 12 : transferRequests[key].status = STATUS.EXECUTED;
+ 460 : : // Emit event
+ 461 : 12 : emit transferProcessed(
+ 462 : : key,
+ 463 : : transferRequests[key].keyElement.from,
+ 464 : : transferRequests[key].keyElement.to,
+ 465 : : transferRequests[key].keyElement.value,
+ 466 : : transferRequests[key].id
+ 467 : : );
+ 468 : : }
+ 469 : : }
diff --git a/doc/coverage/coverage/src/rules/operation/abstract/index-sort-b.html b/doc/coverage/coverage/src/rules/operation/abstract/index-sort-b.html
index 206fec0..106bf3c 100644
--- a/doc/coverage/coverage/src/rules/operation/abstract/index-sort-b.html
+++ b/doc/coverage/coverage/src/rules/operation/abstract/index-sort-b.html
@@ -31,27 +31,27 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,11 +87,11 @@
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 113 / 113
+ 100.0 %
+ 20 / 20
+ 100.0 %
+ 31 / 31
diff --git a/doc/coverage/coverage/src/rules/operation/abstract/index-sort-f.html b/doc/coverage/coverage/src/rules/operation/abstract/index-sort-f.html
index 65b64ca..510afd6 100644
--- a/doc/coverage/coverage/src/rules/operation/abstract/index-sort-f.html
+++ b/doc/coverage/coverage/src/rules/operation/abstract/index-sort-f.html
@@ -31,27 +31,27 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,11 +87,11 @@
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 113 / 113
+ 100.0 %
+ 20 / 20
+ 100.0 %
+ 31 / 31
diff --git a/doc/coverage/coverage/src/rules/operation/abstract/index-sort-l.html b/doc/coverage/coverage/src/rules/operation/abstract/index-sort-l.html
index 94b0016..a7a93e9 100644
--- a/doc/coverage/coverage/src/rules/operation/abstract/index-sort-l.html
+++ b/doc/coverage/coverage/src/rules/operation/abstract/index-sort-l.html
@@ -31,27 +31,27 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,11 +87,11 @@
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 113 / 113
+ 100.0 %
+ 20 / 20
+ 100.0 %
+ 31 / 31
diff --git a/doc/coverage/coverage/src/rules/operation/abstract/index.html b/doc/coverage/coverage/src/rules/operation/abstract/index.html
index c127d25..a540778 100644
--- a/doc/coverage/coverage/src/rules/operation/abstract/index.html
+++ b/doc/coverage/coverage/src/rules/operation/abstract/index.html
@@ -31,27 +31,27 @@
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -87,11 +87,11 @@
100.0 %
- 99 / 99
- 94.7 %
- 18 / 19
- 98.1 %
- 53 / 54
+ 113 / 113
+ 100.0 %
+ 20 / 20
+ 100.0 %
+ 31 / 31
diff --git a/doc/coverage/coverage/src/rules/operation/index-sort-b.html b/doc/coverage/coverage/src/rules/operation/index-sort-b.html
index a923b48..3311178 100644
--- a/doc/coverage/coverage/src/rules/operation/index-sort-b.html
+++ b/doc/coverage/coverage/src/rules/operation/index-sort-b.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -84,14 +84,14 @@
RuleConditionalTransfer.sol
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
diff --git a/doc/coverage/coverage/src/rules/operation/index-sort-f.html b/doc/coverage/coverage/src/rules/operation/index-sort-f.html
index 53a284c..fae09be 100644
--- a/doc/coverage/coverage/src/rules/operation/index-sort-f.html
+++ b/doc/coverage/coverage/src/rules/operation/index-sort-f.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -84,14 +84,14 @@
RuleConditionalTransfer.sol
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
diff --git a/doc/coverage/coverage/src/rules/operation/index-sort-l.html b/doc/coverage/coverage/src/rules/operation/index-sort-l.html
index 0e34ee2..068336b 100644
--- a/doc/coverage/coverage/src/rules/operation/index-sort-l.html
+++ b/doc/coverage/coverage/src/rules/operation/index-sort-l.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -84,14 +84,14 @@
RuleConditionalTransfer.sol
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
diff --git a/doc/coverage/coverage/src/rules/operation/index.html b/doc/coverage/coverage/src/rules/operation/index.html
index 1d7e5b3..2f73491 100644
--- a/doc/coverage/coverage/src/rules/operation/index.html
+++ b/doc/coverage/coverage/src/rules/operation/index.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -84,14 +84,14 @@
RuleConditionalTransfer.sol
-
+
- 98.8 %
- 85 / 86
- 93.8 %
- 15 / 16
- 90.5 %
- 38 / 42
+ 99.0 %
+ 96 / 97
+ 94.4 %
+ 17 / 18
+ 100.0 %
+ 29 / 29
diff --git a/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func-sort-c.html
index df48d9c..cdeff24 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func-sort-c.html
@@ -37,11 +37,11 @@
-
+
-
-
+
+
@@ -80,6 +80,10 @@
RuleBlacklist.detectTransferRestriction
10
+
+ RuleBlacklist.
+ 12
+
diff --git a/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func.html b/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func.html
index 38fefc5..43a0389 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.func.html
@@ -37,11 +37,11 @@
-
+
-
-
+
+
@@ -68,6 +68,10 @@
Function Name
Hit count
+
+ RuleBlacklist.
+ 12
+
RuleBlacklist.canReturnTransferRestrictionCode
4
diff --git a/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.gcov.html
index c135db7..0e56a74 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleBlacklist.sol.gcov.html
@@ -37,11 +37,11 @@
-
+
-
-
+
+
@@ -106,12 +106,12 @@
35 : : address _to,
36 : : uint256 /*_amount */
37 : : ) public view override returns (uint8) {
- 38 [ + + ]: 20 : if (addressIsListed(_from)) {
- 39 : 10 : return CODE_ADDRESS_FROM_IS_BLACKLISTED;
- 40 [ + + ]: 10 : } else if (addressIsListed(_to)) {
- 41 : 4 : return CODE_ADDRESS_TO_IS_BLACKLISTED;
+ 38 [ + + ]: 10 : if (addressIsListed(_from)) {
+ 39 : 5 : return CODE_ADDRESS_FROM_IS_BLACKLISTED;
+ 40 [ + + ]: 5 : } else if (addressIsListed(_to)) {
+ 41 : 2 : return CODE_ADDRESS_TO_IS_BLACKLISTED;
42 : : } else {
- 43 : 9 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 43 : 3 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
44 : : }
45 : : }
46 : :
@@ -123,9 +123,9 @@
52 : : function canReturnTransferRestrictionCode(
53 : : uint8 _restrictionCode
54 : : ) external pure override returns (bool) {
- 55 : 8 : return
- 56 : 12 : _restrictionCode == CODE_ADDRESS_FROM_IS_BLACKLISTED ||
- 57 : 4 : _restrictionCode == CODE_ADDRESS_TO_IS_BLACKLISTED;
+ 55 : 4 : return
+ 56 : 4 : _restrictionCode == CODE_ADDRESS_FROM_IS_BLACKLISTED ||
+ 57 : 2 : _restrictionCode == CODE_ADDRESS_TO_IS_BLACKLISTED;
58 : : }
59 : :
60 : : /**
@@ -136,12 +136,12 @@
65 : : function messageForTransferRestriction(
66 : : uint8 _restrictionCode
67 : : ) external pure override returns (string memory) {
- 68 [ + + ]: 8 : if (_restrictionCode == CODE_ADDRESS_FROM_IS_BLACKLISTED) {
- 69 : 4 : return TEXT_ADDRESS_FROM_IS_BLACKLISTED;
- 70 [ + + ]: 4 : } else if (_restrictionCode == CODE_ADDRESS_TO_IS_BLACKLISTED) {
- 71 : 2 : return TEXT_ADDRESS_TO_IS_BLACKLISTED;
+ 68 [ + + ]: 4 : if (_restrictionCode == CODE_ADDRESS_FROM_IS_BLACKLISTED) {
+ 69 : 2 : return TEXT_ADDRESS_FROM_IS_BLACKLISTED;
+ 70 [ + + ]: 2 : } else if (_restrictionCode == CODE_ADDRESS_TO_IS_BLACKLISTED) {
+ 71 : 1 : return TEXT_ADDRESS_TO_IS_BLACKLISTED;
72 : : } else {
- 73 : 2 : return TEXT_CODE_NOT_FOUND;
+ 73 : 1 : return TEXT_CODE_NOT_FOUND;
74 : : }
75 : : }
76 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func-sort-c.html
index 3c40cbb..6a8afe3 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func-sort-c.html
@@ -31,26 +31,26 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -69,32 +69,44 @@
Hit count
- RuleSanctionList._msgData
+ RuleSanctionList._msgData
0
- RuleSanctionList.canReturnTransferRestrictionCode
+ RuleSanctionList.canReturnTransferRestrictionCode
3
- RuleSanctionList.messageForTransferRestriction
+ RuleSanctionList.messageForTransferRestriction
3
- RuleSanctionList.detectTransferRestriction
+ RuleSanctionList.detectTransferRestriction
7
- RuleSanctionList._contextSuffixLength
- 10
+ RuleSanctionList._setSanctionListOracle
+ 11
+
+
+ RuleSanctionList.setSanctionListOracle
+ 11
+
+
+ RuleSanctionList.
+ 13
+
+
+ RuleSanctionList.hasRole
+ 13
- RuleSanctionList._msgSender
- 10
+ RuleSanctionList._contextSuffixLength
+ 23
- RuleSanctionList.setSanctionListOracle
- 10
+ RuleSanctionList._msgSender
+ 23
diff --git a/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func.html b/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func.html
index a73eca9..7ab15b8 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.func.html
@@ -31,26 +31,26 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -69,32 +69,44 @@
Hit count
- RuleSanctionList._contextSuffixLength
- 10
+ RuleSanctionList.
+ 13
+
+
+ RuleSanctionList._contextSuffixLength
+ 23
- RuleSanctionList._msgData
+ RuleSanctionList._msgData
0
- RuleSanctionList._msgSender
- 10
+ RuleSanctionList._msgSender
+ 23
- RuleSanctionList.canReturnTransferRestrictionCode
+ RuleSanctionList._setSanctionListOracle
+ 11
+
+
+ RuleSanctionList.canReturnTransferRestrictionCode
3
- RuleSanctionList.detectTransferRestriction
+ RuleSanctionList.detectTransferRestriction
7
- RuleSanctionList.messageForTransferRestriction
+ RuleSanctionList.hasRole
+ 13
+
+
+ RuleSanctionList.messageForTransferRestriction
3
- RuleSanctionList.setSanctionListOracle
- 10
+ RuleSanctionList.setSanctionListOracle
+ 11
diff --git a/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.gcov.html
index fbc12ca..b1c19fc 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleSanctionList.sol.gcov.html
@@ -31,26 +31,26 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -96,113 +96,144 @@
25 : : */
26 : : constructor(
27 : : address admin,
- 28 : : address forwarderIrrevocable
- 29 : : ) MetaTxModuleStandalone(forwarderIrrevocable) {
- 30 : : if (admin == address(0)) {
- 31 : : revert RuleSanctionList_AdminWithAddressZeroNotAllowed();
- 32 : : }
- 33 : : _grantRole(DEFAULT_ADMIN_ROLE, admin);
- 34 : : _grantRole(SANCTIONLIST_ROLE, admin);
- 35 : : }
- 36 : :
- 37 : : /**
- 38 : : * @notice Set the oracle contract
- 39 : : * @param sanctionContractOracle_ address of your oracle contract
- 40 : : * @dev zero address is authorized to authorize all transfers
- 41 : : */
- 42 : : function setSanctionListOracle(
- 43 : : address sanctionContractOracle_
- 44 : : ) public onlyRole(SANCTIONLIST_ROLE) {
- 45 : 18 : sanctionsList = SanctionsList(sanctionContractOracle_);
- 46 : : }
- 47 : :
- 48 : : /**
- 49 : : * @notice Check if an addres is in the whitelist or not
- 50 : : * @param _from the origin address
- 51 : : * @param _to the destination address
- 52 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
- 53 : : **/
- 54 : : function detectTransferRestriction(
- 55 : : address _from,
- 56 : : address _to,
- 57 : : uint256 /*_amount */
- 58 : : ) public view override returns (uint8) {
- 59 [ + + ]: 28 : if (address(sanctionsList) != address(0)) {
- 60 [ + + ]: 14 : if (sanctionsList.isSanctioned(_from)) {
- 61 : 4 : return CODE_ADDRESS_FROM_IS_SANCTIONED;
- 62 [ + + ]: 10 : } else if (sanctionsList.isSanctioned(_to)) {
- 63 : 4 : return CODE_ADDRESS_TO_IS_SANCTIONED;
- 64 : : }
- 65 : : }
- 66 : 9 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
- 67 : : }
- 68 : :
- 69 : : /**
- 70 : : * @notice To know if the restriction code is valid for this rule or not.
- 71 : : * @param _restrictionCode The target restriction code
- 72 : : * @return true if the restriction code is known, false otherwise
- 73 : : **/
- 74 : : function canReturnTransferRestrictionCode(
- 75 : : uint8 _restrictionCode
- 76 : : ) external pure override returns (bool) {
- 77 : 6 : return
- 78 : 9 : _restrictionCode == CODE_ADDRESS_FROM_IS_SANCTIONED ||
- 79 : 4 : _restrictionCode == CODE_ADDRESS_TO_IS_SANCTIONED;
- 80 : : }
- 81 : :
- 82 : : /**
- 83 : : * @notice Return the corresponding message
- 84 : : * @param _restrictionCode The target restriction code
- 85 : : * @return true if the transfer is valid, false otherwise
- 86 : : **/
- 87 : : function messageForTransferRestriction(
- 88 : : uint8 _restrictionCode
- 89 : : ) external pure override returns (string memory) {
- 90 [ + + ]: 6 : if (_restrictionCode == CODE_ADDRESS_FROM_IS_SANCTIONED) {
- 91 : 2 : return TEXT_ADDRESS_FROM_IS_SANCTIONED;
- 92 [ + + ]: 4 : } else if (_restrictionCode == CODE_ADDRESS_TO_IS_SANCTIONED) {
- 93 : 2 : return TEXT_ADDRESS_TO_IS_SANCTIONED;
- 94 : : } else {
- 95 : 2 : return TEXT_CODE_NOT_FOUND;
- 96 : : }
- 97 : : }
- 98 : :
- 99 : : /**
- 100 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 101 : : */
- 102 : : function _msgSender()
- 103 : : internal
- 104 : : view
- 105 : : override(ERC2771Context, Context)
- 106 : : returns (address sender)
- 107 : : {
- 108 : 30 : return ERC2771Context._msgSender();
- 109 : : }
- 110 : :
- 111 : : /**
- 112 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 113 : : */
- 114 : : function _msgData()
- 115 : : internal
- 116 : : view
- 117 : : override(ERC2771Context, Context)
- 118 : : returns (bytes calldata)
- 119 : : {
- 120 : 0 : return ERC2771Context._msgData();
- 121 : : }
- 122 : :
- 123 : : /**
- 124 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 125 : : */
- 126 : : function _contextSuffixLength()
- 127 : : internal
- 128 : : view
- 129 : : override(ERC2771Context, Context)
- 130 : : returns (uint256)
- 131 : : {
- 132 : 30 : return ERC2771Context._contextSuffixLength();
- 133 : : }
- 134 : : }
+ 28 : : address forwarderIrrevocable,
+ 29 : : address sanctionContractOracle_
+ 30 : : ) MetaTxModuleStandalone(forwarderIrrevocable) {
+ 31 [ + ]: 13 : if (admin == address(0)) {
+ 32 : 1 : revert RuleSanctionList_AdminWithAddressZeroNotAllowed();
+ 33 : : }
+ 34 [ + ]: 12 : if (sanctionContractOracle_ != address(0)) {
+ 35 : 1 : _setSanctionListOracle(sanctionContractOracle_);
+ 36 : : }
+ 37 : 12 : _grantRole(DEFAULT_ADMIN_ROLE, admin);
+ 38 : : }
+ 39 : :
+ 40 : : /**
+ 41 : : * @notice Set the oracle contract
+ 42 : : * @param sanctionContractOracle_ address of your oracle contract
+ 43 : : * @dev zero address is authorized to authorize all transfers
+ 44 : : */
+ 45 : : function setSanctionListOracle(
+ 46 : : address sanctionContractOracle_
+ 47 : : ) public onlyRole(SANCTIONLIST_ROLE) {
+ 48 : 10 : _setSanctionListOracle(sanctionContractOracle_);
+ 49 : : }
+ 50 : :
+ 51 : : /**
+ 52 : : * @notice Check if an addres is in the whitelist or not
+ 53 : : * @param _from the origin address
+ 54 : : * @param _to the destination address
+ 55 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
+ 56 : : **/
+ 57 : : function detectTransferRestriction(
+ 58 : : address _from,
+ 59 : : address _to,
+ 60 : : uint256 /*_amount */
+ 61 : : ) public view override returns (uint8) {
+ 62 [ + ]: 7 : if (address(sanctionsList) != address(0)) {
+ 63 [ + + ]: 7 : if (sanctionsList.isSanctioned(_from)) {
+ 64 : 2 : return CODE_ADDRESS_FROM_IS_SANCTIONED;
+ 65 [ + ]: 5 : } else if (sanctionsList.isSanctioned(_to)) {
+ 66 : 2 : return CODE_ADDRESS_TO_IS_SANCTIONED;
+ 67 : : }
+ 68 : : }
+ 69 : 3 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 70 : : }
+ 71 : :
+ 72 : : /**
+ 73 : : * @notice To know if the restriction code is valid for this rule or not.
+ 74 : : * @param _restrictionCode The target restriction code
+ 75 : : * @return true if the restriction code is known, false otherwise
+ 76 : : **/
+ 77 : : function canReturnTransferRestrictionCode(
+ 78 : : uint8 _restrictionCode
+ 79 : : ) external pure override returns (bool) {
+ 80 : 3 : return
+ 81 : 3 : _restrictionCode == CODE_ADDRESS_FROM_IS_SANCTIONED ||
+ 82 : 2 : _restrictionCode == CODE_ADDRESS_TO_IS_SANCTIONED;
+ 83 : : }
+ 84 : :
+ 85 : : /**
+ 86 : : * @notice Return the corresponding message
+ 87 : : * @param _restrictionCode The target restriction code
+ 88 : : * @return true if the transfer is valid, false otherwise
+ 89 : : **/
+ 90 : : function messageForTransferRestriction(
+ 91 : : uint8 _restrictionCode
+ 92 : : ) external pure override returns (string memory) {
+ 93 [ + + ]: 3 : if (_restrictionCode == CODE_ADDRESS_FROM_IS_SANCTIONED) {
+ 94 : 1 : return TEXT_ADDRESS_FROM_IS_SANCTIONED;
+ 95 [ + + ]: 2 : } else if (_restrictionCode == CODE_ADDRESS_TO_IS_SANCTIONED) {
+ 96 : 1 : return TEXT_ADDRESS_TO_IS_SANCTIONED;
+ 97 : : } else {
+ 98 : 1 : return TEXT_CODE_NOT_FOUND;
+ 99 : : }
+ 100 : : }
+ 101 : :
+ 102 : : /* ============ ACCESS CONTROL ============ */
+ 103 : : /**
+ 104 : : * @dev Returns `true` if `account` has been granted `role`.
+ 105 : : */
+ 106 : : function hasRole(
+ 107 : : bytes32 role,
+ 108 : : address account
+ 109 : : ) public view virtual override(AccessControl) returns (bool) {
+ 110 : : // The Default Admin has all roles
+ 111 [ + ]: 24 : if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ 112 : 11 : return true;
+ 113 : : }
+ 114 : 13 : return AccessControl.hasRole(role, account);
+ 115 : : }
+ 116 : :
+ 117 : : /*//////////////////////////////////////////////////////////////
+ 118 : : INTERNAL FUNCTIONS
+ 119 : : //////////////////////////////////////////////////////////////*/
+ 120 : :
+ 121 : : function _setSanctionListOracle(address sanctionContractOracle_) internal {
+ 122 : 11 : sanctionsList = SanctionsList(sanctionContractOracle_);
+ 123 : 11 : emit SetSanctionListOracle(address(sanctionContractOracle_));
+ 124 : : }
+ 125 : :
+ 126 : : /*//////////////////////////////////////////////////////////////
+ 127 : : ERC-2771
+ 128 : : //////////////////////////////////////////////////////////////*/
+ 129 : :
+ 130 : : /**
+ 131 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 132 : : */
+ 133 : : function _msgSender()
+ 134 : : internal
+ 135 : : view
+ 136 : : override(ERC2771Context, Context)
+ 137 : : returns (address sender)
+ 138 : : {
+ 139 : 23 : return ERC2771Context._msgSender();
+ 140 : : }
+ 141 : :
+ 142 : : /**
+ 143 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 144 : : */
+ 145 : : function _msgData()
+ 146 : : internal
+ 147 : : view
+ 148 : : override(ERC2771Context, Context)
+ 149 : : returns (bytes calldata)
+ 150 : : {
+ 151 : 0 : return ERC2771Context._msgData();
+ 152 : : }
+ 153 : :
+ 154 : : /**
+ 155 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 156 : : */
+ 157 : : function _contextSuffixLength()
+ 158 : : internal
+ 159 : : view
+ 160 : : override(ERC2771Context, Context)
+ 161 : : returns (uint256)
+ 162 : : {
+ 163 : 23 : return ERC2771Context._contextSuffixLength();
+ 164 : : }
+ 165 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func-sort-c.html
index 312454d..bcf0b58 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func-sort-c.html
@@ -37,11 +37,11 @@
-
+
-
-
+
+
@@ -69,9 +69,13 @@
Hit count
- RuleWhitelist.detectTransferRestriction
+ RuleWhitelist.detectTransferRestriction
28
+
+ RuleWhitelist.
+ 173
+
diff --git a/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func.html b/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func.html
index 5f20449..836283a 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.func.html
@@ -37,11 +37,11 @@
-
+
-
-
+
+
@@ -69,7 +69,11 @@
Hit count
- RuleWhitelist.detectTransferRestriction
+ RuleWhitelist.
+ 173
+
+
+ RuleWhitelist.detectTransferRestriction
28
diff --git a/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.gcov.html
index 0812899..3df1691 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleWhitelist.sol.gcov.html
@@ -37,11 +37,11 @@
-
+
-
-
+
+
@@ -75,41 +75,40 @@
4 : :
5 : : import "./abstract/RuleAddressList/RuleAddressList.sol";
6 : : import "./abstract/RuleWhitelistCommon.sol";
- 7 : : /**
- 8 : : * @title a whitelist manager
- 9 : : */
- 10 : :
- 11 : : contract RuleWhitelist is RuleAddressList, RuleWhitelistCommon
- 12 : : {
- 13 : : /**
- 14 : : * @param admin Address of the contract (Access Control)
- 15 : : * @param forwarderIrrevocable Address of the forwarder, required for the gasless support
- 16 : : */
- 17 : : constructor(
- 18 : : address admin,
- 19 : : address forwarderIrrevocable
- 20 : : ) RuleAddressList(admin, forwarderIrrevocable) {}
- 21 : :
- 22 : : /**
- 23 : : * @notice Check if an addres is in the whitelist or not
- 24 : : * @param _from the origin address
- 25 : : * @param _to the destination address
- 26 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
- 27 : : **/
- 28 : : function detectTransferRestriction(
- 29 : : address _from,
- 30 : : address _to,
- 31 : : uint256 /*_amount */
- 32 : : ) public view override returns (uint8) {
- 33 [ + + ]: 56 : if (!addressIsListed(_from)) {
- 34 : 26 : return CODE_ADDRESS_FROM_NOT_WHITELISTED;
- 35 [ + + ]: 30 : } else if (!addressIsListed(_to)) {
- 36 : 10 : return CODE_ADDRESS_TO_NOT_WHITELISTED;
- 37 : : } else {
- 38 : 30 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
- 39 : : }
- 40 : : }
- 41 : : }
+ 7 : :
+ 8 : : /**
+ 9 : : * @title a whitelist manager
+ 10 : : */
+ 11 : : contract RuleWhitelist is RuleAddressList, RuleWhitelistCommon {
+ 12 : : /**
+ 13 : : * @param admin Address of the contract (Access Control)
+ 14 : : * @param forwarderIrrevocable Address of the forwarder, required for the gasless support
+ 15 : : */
+ 16 : : constructor(
+ 17 : : address admin,
+ 18 : : address forwarderIrrevocable
+ 19 : : ) RuleAddressList(admin, forwarderIrrevocable) {}
+ 20 : :
+ 21 : : /**
+ 22 : : * @notice Check if an addres is in the whitelist or not
+ 23 : : * @param _from the origin address
+ 24 : : * @param _to the destination address
+ 25 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
+ 26 : : **/
+ 27 : : function detectTransferRestriction(
+ 28 : : address _from,
+ 29 : : address _to,
+ 30 : : uint256 /*_amount */
+ 31 : : ) public view override returns (uint8) {
+ 32 [ + + ]: 28 : if (!addressIsListed(_from)) {
+ 33 : 13 : return CODE_ADDRESS_FROM_NOT_WHITELISTED;
+ 34 [ + + ]: 15 : } else if (!addressIsListed(_to)) {
+ 35 : 5 : return CODE_ADDRESS_TO_NOT_WHITELISTED;
+ 36 : : } else {
+ 37 : 10 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 38 : : }
+ 39 : : }
+ 40 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func-sort-c.html
index 31f73cd..d3e7dc3 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func-sort-c.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -69,20 +69,28 @@
Hit count
- RuleWhitelistWrapper._msgData
+ RuleWhitelistWrapper._msgData
0
- RuleWhitelistWrapper.detectTransferRestriction
+ RuleWhitelistWrapper.detectTransferRestriction
11
- RuleWhitelistWrapper._contextSuffixLength
- 36
+ RuleWhitelistWrapper.hasRole
+ 13
- RuleWhitelistWrapper._msgSender
- 36
+ RuleWhitelistWrapper.
+ 14
+
+
+ RuleWhitelistWrapper._contextSuffixLength
+ 52
+
+
+ RuleWhitelistWrapper._msgSender
+ 52
diff --git a/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func.html b/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func.html
index be2415d..ea009eb 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.func.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -69,21 +69,29 @@
Hit count
- RuleWhitelistWrapper._contextSuffixLength
- 36
+ RuleWhitelistWrapper.
+ 14
- RuleWhitelistWrapper._msgData
+ RuleWhitelistWrapper._contextSuffixLength
+ 52
+
+
+ RuleWhitelistWrapper._msgData
0
- RuleWhitelistWrapper._msgSender
- 36
+ RuleWhitelistWrapper._msgSender
+ 52
- RuleWhitelistWrapper.detectTransferRestriction
+ RuleWhitelistWrapper.detectTransferRestriction
11
+
+ RuleWhitelistWrapper.hasRole
+ 13
+
diff --git a/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.gcov.html
index 965cfca..1f9bba8 100644
--- a/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/RuleWhitelistWrapper.sol.gcov.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -95,92 +95,110 @@
24 : : address admin,
25 : : address forwarderIrrevocable
26 : : ) MetaTxModuleStandalone(forwarderIrrevocable) {
- 27 : : if (admin == address(0)) {
- 28 : : revert RuleEngine_AdminWithAddressZeroNotAllowed();
+ 27 [ + ]: 14 : if (admin == address(0)) {
+ 28 : 1 : revert RuleEngine_AdminWithAddressZeroNotAllowed();
29 : : }
- 30 : : _grantRole(DEFAULT_ADMIN_ROLE, admin);
- 31 : : _grantRole(RULE_ENGINE_OPERATOR_ROLE, admin);
- 32 : : }
- 33 : :
- 34 : : /**
- 35 : : * @notice Go through all the whitelist rules to know if a restriction exists on the transfer
- 36 : : * @param _from the origin address
- 37 : : * @param _to the destination address
- 38 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
- 39 : : **/
- 40 : : function detectTransferRestriction(
- 41 : : address _from,
- 42 : : address _to,
- 43 : : uint256 /*_amount*/
- 44 : : ) public view override returns (uint8) {
- 45 : 33 : address[] memory targetAddress = new address[](2);
- 46 : 33 : bool[] memory isListed = new bool[](2);
- 47 : 33 : bool[] memory result = new bool[](2);
- 48 : 22 : targetAddress[0] = _from;
- 49 : 22 : targetAddress[1] = _to;
- 50 : 22 : uint256 rulesLength = _rulesValidation.length;
- 51 : : // For each whitelist rule, we ask if from or to are in the whitelist
- 52 : 73 : for (uint256 i = 0; i < rulesLength; ++i) {
- 53 : : // External call
- 54 : 50 : isListed = RuleAddressList(_rulesValidation[i])
- 55 : : .addressIsListedBatch(targetAddress);
- 56 [ # + ]: 57 : if (isListed[0] && !result[0]) {
- 57 : : // Update if from is in the list
- 58 : 14 : result[0] = true;
- 59 : : }
- 60 [ # + ]: 57 : if (isListed[1] && !result[1]) {
- 61 : : // Update if to is in the list
- 62 : 14 : result[1] = true;
- 63 : : }
- 64 [ + + ]: 50 : if(result[0] && result[1]){
- 65 : 50 : break;
- 66 : : }
- 67 : : }
- 68 [ + + ]: 22 : if (!result[0]) {
- 69 : 8 : return CODE_ADDRESS_FROM_NOT_WHITELISTED;
- 70 [ + + ]: 14 : } else if (!result[1]) {
- 71 : 4 : return CODE_ADDRESS_TO_NOT_WHITELISTED;
- 72 : : } else {
- 73 : 15 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
- 74 : : }
- 75 : : }
- 76 : :
+ 30 : 13 : _grantRole(DEFAULT_ADMIN_ROLE, admin);
+ 31 : : }
+ 32 : :
+ 33 : : /**
+ 34 : : * @notice Go through all the whitelist rules to know if a restriction exists on the transfer
+ 35 : : * @param _from the origin address
+ 36 : : * @param _to the destination address
+ 37 : : * @return The restricion code or REJECTED_CODE_BASE.TRANSFER_OK
+ 38 : : **/
+ 39 : : function detectTransferRestriction(
+ 40 : : address _from,
+ 41 : : address _to,
+ 42 : : uint256 /*_amount*/
+ 43 : : ) public view override returns (uint8) {
+ 44 : 11 : address[] memory targetAddress = new address[](2);
+ 45 : 11 : bool[] memory isListed = new bool[](2);
+ 46 : 11 : bool[] memory result = new bool[](2);
+ 47 : 11 : targetAddress[0] = _from;
+ 48 : 11 : targetAddress[1] = _to;
+ 49 : 11 : uint256 rulesLength = _rulesValidation.length;
+ 50 : : // For each whitelist rule, we ask if from or to are in the whitelist
+ 51 : 11 : for (uint256 i = 0; i < rulesLength; ++i) {
+ 52 : : // External call
+ 53 : 25 : isListed = RuleAddressList(_rulesValidation[i])
+ 54 : : .addressIsListedBatch(targetAddress);
+ 55 [ + ]: 25 : if (isListed[0] && !result[0]) {
+ 56 : : // Update if from is in the list
+ 57 : 7 : result[0] = true;
+ 58 : : }
+ 59 [ + ]: 25 : if (isListed[1] && !result[1]) {
+ 60 : : // Update if to is in the list
+ 61 : 7 : result[1] = true;
+ 62 : : }
+ 63 [ + ]: 25 : if (result[0] && result[1]) {
+ 64 : 25 : break;
+ 65 : : }
+ 66 : : }
+ 67 [ + + ]: 11 : if (!result[0]) {
+ 68 : 4 : return CODE_ADDRESS_FROM_NOT_WHITELISTED;
+ 69 [ + + ]: 7 : } else if (!result[1]) {
+ 70 : 2 : return CODE_ADDRESS_TO_NOT_WHITELISTED;
+ 71 : : } else {
+ 72 : 5 : return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 73 : : }
+ 74 : : }
+ 75 : :
+ 76 : : /* ============ ACCESS CONTROL ============ */
77 : : /**
- 78 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 78 : : * @dev Returns `true` if `account` has been granted `role`.
79 : : */
- 80 : : function _msgSender()
- 81 : : internal
- 82 : : view
- 83 : : override(ERC2771Context, Context)
- 84 : : returns (address sender)
- 85 : : {
- 86 : 108 : return ERC2771Context._msgSender();
- 87 : : }
- 88 : :
- 89 : : /**
- 90 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 91 : : */
- 92 : : function _msgData()
- 93 : : internal
- 94 : : view
- 95 : : override(ERC2771Context, Context)
- 96 : : returns (bytes calldata)
- 97 : : {
- 98 : 0 : return ERC2771Context._msgData();
- 99 : : }
- 100 : :
- 101 : : /**
- 102 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 103 : : */
- 104 : : function _contextSuffixLength()
- 105 : : internal
- 106 : : view
- 107 : : override(ERC2771Context, Context)
- 108 : : returns (uint256)
- 109 : : {
- 110 : 108 : return ERC2771Context._contextSuffixLength();
- 111 : : }
- 112 : : }
+ 80 : : function hasRole(
+ 81 : : bytes32 role,
+ 82 : : address account
+ 83 : : ) public view virtual override(AccessControl) returns (bool) {
+ 84 : : // The Default Admin has all roles
+ 85 [ + ]: 52 : if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ 86 : 39 : return true;
+ 87 : : }
+ 88 : 13 : return AccessControl.hasRole(role, account);
+ 89 : : }
+ 90 : :
+ 91 : : /*//////////////////////////////////////////////////////////////
+ 92 : : ERC-2771
+ 93 : : //////////////////////////////////////////////////////////////*/
+ 94 : :
+ 95 : : /**
+ 96 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 97 : : */
+ 98 : : function _msgSender()
+ 99 : : internal
+ 100 : : view
+ 101 : : override(ERC2771Context, Context)
+ 102 : : returns (address sender)
+ 103 : : {
+ 104 : 52 : return ERC2771Context._msgSender();
+ 105 : : }
+ 106 : :
+ 107 : : /**
+ 108 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 109 : : */
+ 110 : : function _msgData()
+ 111 : : internal
+ 112 : : view
+ 113 : : override(ERC2771Context, Context)
+ 114 : : returns (bytes calldata)
+ 115 : : {
+ 116 : 0 : return ERC2771Context._msgData();
+ 117 : : }
+ 118 : :
+ 119 : : /**
+ 120 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 121 : : */
+ 122 : : function _contextSuffixLength()
+ 123 : : internal
+ 124 : : view
+ 125 : : override(ERC2771Context, Context)
+ 126 : : returns (uint256)
+ 127 : : {
+ 128 : 52 : return ERC2771Context._contextSuffixLength();
+ 129 : : }
+ 130 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func-sort-c.html
index a1cc6c6..693be82 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func-sort-c.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -69,27 +69,27 @@
Hit count
- RuleAddressList._msgData
+ RuleAddressList._msgData
0
- RuleAddressList.removeAddressFromTheList
+ RuleAddressList.removeAddressFromTheList
3
- RuleAddressList.removeAddressesFromTheList
+ RuleAddressList.removeAddressesFromTheList
4
- RuleAddressList.addAddressesToTheList
+ RuleAddressList.addAddressesToTheList
17
- RuleAddressList.numberListedAddress
+ RuleAddressList.numberListedAddress
24
- RuleAddressList.addressIsListedBatch
+ RuleAddressList.addressIsListedBatch
28
@@ -97,16 +97,24 @@
52
- RuleAddressList._contextSuffixLength
- 86
+ RuleAddressList.addressIsListed
+ 95
+
+
+ RuleAddressList.
+ 185
+
+
+ RuleAddressList.hasRole
+ 194
- RuleAddressList._msgSender
- 86
+ RuleAddressList._contextSuffixLength
+ 270
- RuleAddressList.addressIsListed
- 86
+ RuleAddressList._msgSender
+ 270
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func.html
index 80f4a95..54c594d 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.func.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -69,43 +69,51 @@
Hit count
- RuleAddressList._contextSuffixLength
- 86
+ RuleAddressList.
+ 185
+
+
+ RuleAddressList._contextSuffixLength
+ 270
- RuleAddressList._msgData
+ RuleAddressList._msgData
0
- RuleAddressList._msgSender
- 86
+ RuleAddressList._msgSender
+ 270
RuleAddressList.addAddressToTheList
52
- RuleAddressList.addAddressesToTheList
+ RuleAddressList.addAddressesToTheList
17
- RuleAddressList.addressIsListed
- 86
+ RuleAddressList.addressIsListed
+ 95
- RuleAddressList.addressIsListedBatch
+ RuleAddressList.addressIsListedBatch
28
- RuleAddressList.numberListedAddress
+ RuleAddressList.hasRole
+ 194
+
+
+ RuleAddressList.numberListedAddress
24
- RuleAddressList.removeAddressFromTheList
+ RuleAddressList.removeAddressFromTheList
3
- RuleAddressList.removeAddressesFromTheList
+ RuleAddressList.removeAddressesFromTheList
4
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.gcov.html
index 86424d8..7524536 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol.gcov.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -88,7 +88,7 @@
17 : : RuleAddressListInternal,
18 : : RuleAddressListInvariantStorage
19 : : {
- 20 : : // Number of addresses in the whitelist at the moment
+ 20 : : // Number of addresses in the list at the moment
21 : : uint256 private numAddressesWhitelisted;
22 : :
23 : : /**
@@ -99,135 +99,152 @@
28 : : address admin,
29 : : address forwarderIrrevocable
30 : : ) MetaTxModuleStandalone(forwarderIrrevocable) {
- 31 : : if (admin == address(0)) {
- 32 : : revert RuleAddressList_AdminWithAddressZeroNotAllowed();
+ 31 [ + ]: 185 : if (admin == address(0)) {
+ 32 : 1 : revert RuleAddressList_AdminWithAddressZeroNotAllowed();
33 : : }
- 34 : : _grantRole(DEFAULT_ADMIN_ROLE, admin);
- 35 : : _grantRole(ADDRESS_LIST_ADD_ROLE, admin);
- 36 : : _grantRole(ADDRESS_LIST_REMOVE_ROLE, admin);
- 37 : : }
- 38 : :
- 39 : : /**
- 40 : : * @notice Add addresses to the whitelist
- 41 : : * If one of addresses already exist, there is no change for this address. The transaction remains valid (no revert).
- 42 : : * @param listWhitelistedAddress an array with the addresses to whitelist
- 43 : : */
- 44 : : function addAddressesToTheList(
- 45 : : address[] calldata listWhitelistedAddress
- 46 : : ) public onlyRole(ADDRESS_LIST_ADD_ROLE) {
- 47 : 32 : _addAddressesToThelist(listWhitelistedAddress);
- 48 : : }
- 49 : :
- 50 : : /**
- 51 : : * @notice Remove addresses from the whitelist
- 52 : : * If the address does not exist in the whitelist, there is no change for this address.
- 53 : : * The transaction remains valid (no revert).
- 54 : : * @param listWhitelistedAddress an array with the addresses to remove
- 55 : : */
- 56 : : function removeAddressesFromTheList(
- 57 : : address[] calldata listWhitelistedAddress
- 58 : : ) public onlyRole(ADDRESS_LIST_REMOVE_ROLE) {
- 59 : 6 : _removeAddressesFromThelist(listWhitelistedAddress);
+ 34 : 184 : _grantRole(DEFAULT_ADMIN_ROLE, admin);
+ 35 : : }
+ 36 : :
+ 37 : : /**
+ 38 : : * @notice Add addresses to the list
+ 39 : : * If one of addresses already exist, there is no change for this address. The transaction remains valid (no revert).
+ 40 : : * @param listTargetAddresses an array with the addresses to list
+ 41 : : */
+ 42 : : function addAddressesToTheList(
+ 43 : : address[] calldata listTargetAddresses
+ 44 : : ) public onlyRole(ADDRESS_LIST_ADD_ROLE) {
+ 45 : 16 : _addAddressesToThelist(listTargetAddresses);
+ 46 : 16 : emit AddAddressesToTheList(listTargetAddresses);
+ 47 : : }
+ 48 : :
+ 49 : : /**
+ 50 : : * @notice Remove addresses from the list
+ 51 : : * If the address does not exist in the list, there is no change for this address.
+ 52 : : * The transaction remains valid (no revert).
+ 53 : : * @param listTargetAddresses an array with the addresses to remove
+ 54 : : */
+ 55 : : function removeAddressesFromTheList(
+ 56 : : address[] calldata listTargetAddresses
+ 57 : : ) public onlyRole(ADDRESS_LIST_REMOVE_ROLE) {
+ 58 : 3 : _removeAddressesFromThelist(listTargetAddresses);
+ 59 : 3 : emit RemoveAddressesFromTheList(listTargetAddresses);
60 : : }
61 : :
62 : : /**
- 63 : : * @notice Add one address to the whitelist
+ 63 : : * @notice Add one address to the list
64 : : * If the address already exists, the transaction is reverted to save gas.
- 65 : : * @param _newWhitelistAddress The address to whitelist
+ 65 : : * @param targetAddress The address to list
66 : : */
67 : : function addAddressToTheList(
- 68 : : address _newWhitelistAddress
+ 68 : : address targetAddress
69 : : ) public onlyRole(ADDRESS_LIST_ADD_ROLE) {
- 70 : 102 : _addAddressToThelist(_newWhitelistAddress);
- 71 : : }
- 72 : :
- 73 : : /**
- 74 : : * @notice Remove one address from the whitelist
- 75 : : * If the address does not exist in the whitelist, the transaction is reverted to save gas.
- 76 : : * @param _removeWhitelistAddress The address to remove
- 77 : : *
- 78 : : */
- 79 : : function removeAddressFromTheList(
- 80 : : address _removeWhitelistAddress
- 81 : : ) public onlyRole(ADDRESS_LIST_REMOVE_ROLE) {
- 82 : 4 : _removeAddressFromThelist(_removeWhitelistAddress);
- 83 : : }
- 84 : :
- 85 : : /**
- 86 : : * @notice Get the number of listed addresses
- 87 : : * @return Number of listed addresses
- 88 : : *
- 89 : : */
- 90 : : function numberListedAddress() public view returns (uint256) {
- 91 : 72 : return _numberListedAddress();
- 92 : : }
- 93 : :
- 94 : : /**
- 95 : : * @notice Know if an address is listed or not
- 96 : : * @param _targetAddress The concerned address
- 97 : : * @return True if the address is listed, false otherwise
- 98 : : *
- 99 : : */
- 100 : : function addressIsListed(
- 101 : : address _targetAddress
- 102 : : ) public view returns (bool) {
- 103 : 432 : return _addressIsListed(_targetAddress);
- 104 : : }
- 105 : :
- 106 : : /**
- 107 : : * @notice batch version of {addressIsListed}
- 108 : : *
- 109 : : */
- 110 : : function addressIsListedBatch(
- 111 : : address[] memory _targetAddresses
- 112 : : ) public view returns (bool[] memory) {
- 113 : 84 : bool[] memory isListed = new bool[](_targetAddresses.length);
- 114 : 194 : for (uint256 i = 0; i < _targetAddresses.length; ++i) {
- 115 : 110 : isListed[i] = _addressIsListed(_targetAddresses[i]);
- 116 : : }
- 117 : 56 : return isListed;
- 118 : : }
- 119 : :
- 120 : : /*//////////////////////////////////////////////////////////////
- 121 : : ERC-2771
- 122 : : //////////////////////////////////////////////////////////////*/
- 123 : :
- 124 : : /**
- 125 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 126 : : */
- 127 : : function _msgSender()
- 128 : : internal
- 129 : : view
- 130 : : override(ERC2771Context, Context)
- 131 : : returns (address sender)
- 132 : : {
- 133 : 258 : return ERC2771Context._msgSender();
- 134 : : }
- 135 : :
- 136 : : /**
- 137 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 138 : : */
- 139 : : function _msgData()
- 140 : : internal
- 141 : : view
- 142 : : override(ERC2771Context, Context)
- 143 : : returns (bytes calldata)
- 144 : : {
- 145 : 0 : return ERC2771Context._msgData();
- 146 : : }
- 147 : :
- 148 : : /**
- 149 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
- 150 : : */
- 151 : : function _contextSuffixLength()
- 152 : : internal
- 153 : : view
- 154 : : override(ERC2771Context, Context)
- 155 : : returns (uint256)
- 156 : : {
- 157 : 258 : return ERC2771Context._contextSuffixLength();
- 158 : : }
- 159 : : }
+ 70 : 51 : _addAddressToThelist(targetAddress);
+ 71 : 50 : emit AddAddressToTheList(targetAddress);
+ 72 : : }
+ 73 : :
+ 74 : : /**
+ 75 : : * @notice Remove one address from the list
+ 76 : : * If the address does not exist in the list, the transaction is reverted to save gas.
+ 77 : : * @param targetAddress The address to remove
+ 78 : : *
+ 79 : : */
+ 80 : : function removeAddressFromTheList(
+ 81 : : address targetAddress
+ 82 : : ) public onlyRole(ADDRESS_LIST_REMOVE_ROLE) {
+ 83 : 2 : _removeAddressFromThelist(targetAddress);
+ 84 : 1 : emit RemoveAddressFromTheList(targetAddress);
+ 85 : : }
+ 86 : :
+ 87 : : /**
+ 88 : : * @notice Get the number of listed addresses
+ 89 : : * @return Number of listed addresses
+ 90 : : *
+ 91 : : */
+ 92 : : function numberListedAddress() public view returns (uint256) {
+ 93 : 24 : return _numberListedAddress();
+ 94 : : }
+ 95 : :
+ 96 : : /**
+ 97 : : * @notice Know if an address is listed or not
+ 98 : : * @param _targetAddress The concerned address
+ 99 : : * @return True if the address is listed, false otherwise
+ 100 : : *
+ 101 : : */
+ 102 : : function addressIsListed(
+ 103 : : address _targetAddress
+ 104 : : ) public view returns (bool) {
+ 105 : 153 : return _addressIsListed(_targetAddress);
+ 106 : : }
+ 107 : :
+ 108 : : /**
+ 109 : : * @notice batch version of {addressIsListed}
+ 110 : : *
+ 111 : : */
+ 112 : : function addressIsListedBatch(
+ 113 : : address[] memory _targetAddresses
+ 114 : : ) public view returns (bool[] memory) {
+ 115 : 28 : bool[] memory isListed = new bool[](_targetAddresses.length);
+ 116 : 28 : for (uint256 i = 0; i < _targetAddresses.length; ++i) {
+ 117 : 55 : isListed[i] = _addressIsListed(_targetAddresses[i]);
+ 118 : : }
+ 119 : 28 : return isListed;
+ 120 : : }
+ 121 : :
+ 122 : : /* ============ ACCESS CONTROL ============ */
+ 123 : : /**
+ 124 : : * @dev Returns `true` if `account` has been granted `role`.
+ 125 : : */
+ 126 : : function hasRole(
+ 127 : : bytes32 role,
+ 128 : : address account
+ 129 : : ) public view virtual override(AccessControl) returns (bool) {
+ 130 : : // The Default Admin has all roles
+ 131 [ + ]: 280 : if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ 132 : 78 : return true;
+ 133 : : }
+ 134 : 202 : return AccessControl.hasRole(role, account);
+ 135 : : }
+ 136 : :
+ 137 : : /*//////////////////////////////////////////////////////////////
+ 138 : : ERC-2771
+ 139 : : //////////////////////////////////////////////////////////////*/
+ 140 : :
+ 141 : : /**
+ 142 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 143 : : */
+ 144 : : function _msgSender()
+ 145 : : internal
+ 146 : : view
+ 147 : : override(ERC2771Context, Context)
+ 148 : : returns (address sender)
+ 149 : : {
+ 150 : 270 : return ERC2771Context._msgSender();
+ 151 : : }
+ 152 : :
+ 153 : : /**
+ 154 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 155 : : */
+ 156 : : function _msgData()
+ 157 : : internal
+ 158 : : view
+ 159 : : override(ERC2771Context, Context)
+ 160 : : returns (bytes calldata)
+ 161 : : {
+ 162 : 0 : return ERC2771Context._msgData();
+ 163 : : }
+ 164 : :
+ 165 : : /**
+ 166 : : * @dev This surcharge is not necessary if you do not use the MetaTxModule
+ 167 : : */
+ 168 : : function _contextSuffixLength()
+ 169 : : internal
+ 170 : : view
+ 171 : : override(ERC2771Context, Context)
+ 172 : : returns (uint256)
+ 173 : : {
+ 174 : 270 : return ERC2771Context._contextSuffixLength();
+ 175 : : }
+ 176 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func-sort-c.html
index 9b51dc1..e6dec90 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -69,11 +69,11 @@
Hit count
- RuleAddressListInternal._removeAddressFromThelist
+ RuleAddressListInternal._removeAddressFromThelist
2
- RuleAddressListInternal._removeAddressesFromThelist
+ RuleAddressListInternal._removeAddressesFromThelist
3
@@ -81,16 +81,16 @@
16
- RuleAddressListInternal._numberListedAddress
+ RuleAddressListInternal._numberListedAddress
24
- RuleAddressListInternal._addAddressToThelist
+ RuleAddressListInternal._addAddressToThelist
51
- RuleAddressListInternal._addressIsListed
- 199
+ RuleAddressListInternal._addressIsListed
+ 208
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func.html
index dd99735..c02568e 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.func.html
@@ -37,7 +37,7 @@
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -69,7 +69,7 @@
Hit count
- RuleAddressListInternal._addAddressToThelist
+ RuleAddressListInternal._addAddressToThelist
51
@@ -77,19 +77,19 @@
16
- RuleAddressListInternal._addressIsListed
- 199
+ RuleAddressListInternal._addressIsListed
+ 208
- RuleAddressListInternal._numberListedAddress
+ RuleAddressListInternal._numberListedAddress
24
- RuleAddressListInternal._removeAddressFromThelist
+ RuleAddressListInternal._removeAddressFromThelist
2
- RuleAddressListInternal._removeAddressesFromThelist
+ RuleAddressListInternal._removeAddressesFromThelist
3
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.gcov.html
index e817af0..430dde9 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol.gcov.html
@@ -37,7 +37,7 @@
-
+
@@ -49,9 +49,9 @@
-
-
-
+
+
+
@@ -88,86 +88,88 @@
17 : : /**
18 : : * @notice Add addresses to the list
19 : : * If one of addresses already exist, there is no change for this address. The transaction remains valid (no revert).
- 20 : : * @param listAddresses an array with the addresses to list
+ 20 : : * @param listTargetAddresses an array with the addresses to list
21 : : */
- 22 : : function _addAddressesToThelist(address[] calldata listAddresses) internal {
- 23 : 32 : uint256 numAddressesListLocal = numAddressesList;
- 24 : 116 : for (uint256 i = 0; i < listAddresses.length; ++i) {
- 25 [ # + ]: 68 : if (!list[listAddresses[i]]) {
- 26 : 64 : list[listAddresses[i]] = true;
- 27 : 64 : ++numAddressesListLocal;
- 28 : : }
- 29 : : }
- 30 : 32 : numAddressesList = numAddressesListLocal;
- 31 : : }
- 32 : :
- 33 : : /**
- 34 : : * @notice Remove addresses from the list
- 35 : : * If the address does not exist in the list, there is no change for this address.
- 36 : : * The transaction remains valid (no revert).
- 37 : : * @param listAddresses an array with the addresses to remove
- 38 : : */
- 39 : : function _removeAddressesFromThelist(
- 40 : : address[] calldata listAddresses
- 41 : : ) internal {
- 42 : 6 : uint256 numAddressesListLocal = numAddressesList;
- 43 : 23 : for (uint256 i = 0; i < listAddresses.length; ++i) {
- 44 [ # + ]: 7 : if (list[listAddresses[i]]) {
- 45 : 12 : list[listAddresses[i]] = false;
- 46 : 12 : --numAddressesListLocal;
- 47 : : }
- 48 : : }
- 49 : 6 : numAddressesList = numAddressesListLocal;
- 50 : : }
- 51 : :
- 52 : : /**
- 53 : : * @notice Add one address to the list
- 54 : : * If the address already exists, the transaction is reverted to save gas.
- 55 : : * @param _newlistAddress The address to list
- 56 : : */
- 57 : : function _addAddressToThelist(address _newlistAddress) internal {
- 58 [ + + ]: 51 : if (list[_newlistAddress]) {
- 59 : 2 : revert Rulelist_AddressAlreadylisted();
- 60 : : }
- 61 : 100 : list[_newlistAddress] = true;
- 62 : 100 : ++numAddressesList;
- 63 : : }
- 64 : :
- 65 : : /**
- 66 : : * @notice Remove one address from the list
- 67 : : * If the address does not exist in the list, the transaction is reverted to save gas.
- 68 : : * @param _removelistAddress The address to remove
- 69 : : *
- 70 : : */
- 71 : : function _removeAddressFromThelist(address _removelistAddress) internal {
- 72 [ + + ]: 4 : if (!list[_removelistAddress]) {
- 73 : 2 : revert Rulelist_AddressNotPresent();
- 74 : : }
- 75 : 2 : list[_removelistAddress] = false;
- 76 : 2 : --numAddressesList;
- 77 : : }
- 78 : :
- 79 : : /**
- 80 : : * @notice Get the number of listed addresses
- 81 : : * @return Number of listed addresses
- 82 : : *
- 83 : : */
- 84 : : function _numberListedAddress() internal view returns (uint256) {
- 85 : 48 : return numAddressesList;
- 86 : : }
- 87 : :
- 88 : : /**
- 89 : : * @notice Know if an address is listed or not
- 90 : : * @param _targetAddress The concerned address
- 91 : : * @return True if the address is listed, false otherwise
- 92 : : *
- 93 : : */
- 94 : : function _addressIsListed(
- 95 : : address _targetAddress
- 96 : : ) internal view returns (bool) {
- 97 : 398 : return list[_targetAddress];
- 98 : : }
- 99 : : }
+ 22 : : function _addAddressesToThelist(
+ 23 : : address[] calldata listTargetAddresses
+ 24 : : ) internal {
+ 25 : 16 : uint256 numAddressesListLocal = numAddressesList;
+ 26 : 16 : for (uint256 i = 0; i < listTargetAddresses.length; ++i) {
+ 27 [ + ]: 34 : if (!list[listTargetAddresses[i]]) {
+ 28 : 32 : list[listTargetAddresses[i]] = true;
+ 29 : 32 : ++numAddressesListLocal;
+ 30 : : }
+ 31 : : }
+ 32 : 16 : numAddressesList = numAddressesListLocal;
+ 33 : : }
+ 34 : :
+ 35 : : /**
+ 36 : : * @notice Remove addresses from the list
+ 37 : : * If the address does not exist in the list, there is no change for this address.
+ 38 : : * The transaction remains valid (no revert).
+ 39 : : * @param listTargetAddresses an array with the addresses to remove
+ 40 : : */
+ 41 : : function _removeAddressesFromThelist(
+ 42 : : address[] calldata listTargetAddresses
+ 43 : : ) internal {
+ 44 : 3 : uint256 numAddressesListLocal = numAddressesList;
+ 45 : 3 : for (uint256 i = 0; i < listTargetAddresses.length; ++i) {
+ 46 [ + ]: 6 : if (list[listTargetAddresses[i]]) {
+ 47 : 6 : list[listTargetAddresses[i]] = false;
+ 48 : 6 : --numAddressesListLocal;
+ 49 : : }
+ 50 : : }
+ 51 : 3 : numAddressesList = numAddressesListLocal;
+ 52 : : }
+ 53 : :
+ 54 : : /**
+ 55 : : * @notice Add one address to the list
+ 56 : : * If the address already exists, the transaction is reverted to save gas.
+ 57 : : * @param targetAddress The address to list
+ 58 : : */
+ 59 : : function _addAddressToThelist(address targetAddress) internal {
+ 60 [ + ]: 1 : if (list[targetAddress]) {
+ 61 : 1 : revert Rulelist_AddressAlreadylisted();
+ 62 : : }
+ 63 : 50 : list[targetAddress] = true;
+ 64 : 50 : ++numAddressesList;
+ 65 : : }
+ 66 : :
+ 67 : : /**
+ 68 : : * @notice Remove one address from the list
+ 69 : : * If the address does not exist in the list, the transaction is reverted to save gas.
+ 70 : : * @param targetAddress The address to remove
+ 71 : : *
+ 72 : : */
+ 73 : : function _removeAddressFromThelist(address targetAddress) internal {
+ 74 [ + ]: 2 : if (!list[targetAddress]) {
+ 75 : 1 : revert Rulelist_AddressNotPresent();
+ 76 : : }
+ 77 : 1 : list[targetAddress] = false;
+ 78 : 1 : --numAddressesList;
+ 79 : : }
+ 80 : :
+ 81 : : /**
+ 82 : : * @notice Get the number of listed addresses
+ 83 : : * @return Number of listed addresses
+ 84 : : *
+ 85 : : */
+ 86 : : function _numberListedAddress() internal view returns (uint256) {
+ 87 : 24 : return numAddressesList;
+ 88 : : }
+ 89 : :
+ 90 : : /**
+ 91 : : * @notice Know if an address is listed or not
+ 92 : : * @param _targetAddress The concerned address
+ 93 : : * @return True if the address is listed, false otherwise
+ 94 : : *
+ 95 : : */
+ 96 : : function _addressIsListed(
+ 97 : : address _targetAddress
+ 98 : : ) internal view returns (bool) {
+ 99 : 208 : return list[_targetAddress];
+ 100 : : }
+ 101 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-b.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-b.html
index 8e97c35..a60ef87 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-b.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-b.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -81,6 +81,18 @@
Functions
Branches
+
+ RuleAddressList.sol
+
+
+
+ 95.7 %
+ 22 / 23
+ 91.7 %
+ 11 / 12
+ 100.0 %
+ 2 / 2
+
RuleAddressListInternal.sol
@@ -90,20 +102,8 @@
22 / 22
100.0 %
6 / 6
- 75.0 %
- 6 / 8
-
-
- RuleAddressList.sol
-
-
-
- 92.3 %
- 12 / 13
- 90.0 %
- 9 / 10
- -
- 0 / 0
+ 100.0 %
+ 4 / 4
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-f.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-f.html
index 62210c7..94eba9b 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-f.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-f.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -84,14 +84,14 @@
RuleAddressList.sol
-
+
- 92.3 %
- 12 / 13
- 90.0 %
- 9 / 10
- -
- 0 / 0
+ 95.7 %
+ 22 / 23
+ 91.7 %
+ 11 / 12
+ 100.0 %
+ 2 / 2
RuleAddressListInternal.sol
@@ -102,8 +102,8 @@
22 / 22
100.0 %
6 / 6
- 75.0 %
- 6 / 8
+ 100.0 %
+ 4 / 4
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-l.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-l.html
index d62aa4c..8f7e785 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-l.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index-sort-l.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -84,14 +84,14 @@
RuleAddressList.sol
-
+
- 92.3 %
- 12 / 13
- 90.0 %
- 9 / 10
- -
- 0 / 0
+ 95.7 %
+ 22 / 23
+ 91.7 %
+ 11 / 12
+ 100.0 %
+ 2 / 2
RuleAddressListInternal.sol
@@ -102,8 +102,8 @@
22 / 22
100.0 %
6 / 6
- 75.0 %
- 6 / 8
+ 100.0 %
+ 4 / 4
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index.html
index 8a35305..0892ee8 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleAddressList/index.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -50,8 +50,8 @@
-
-
+
+
@@ -84,14 +84,14 @@
RuleAddressList.sol
-
+
- 92.3 %
- 12 / 13
- 90.0 %
- 9 / 10
- -
- 0 / 0
+ 95.7 %
+ 22 / 23
+ 91.7 %
+ 11 / 12
+ 100.0 %
+ 2 / 2
RuleAddressListInternal.sol
@@ -102,8 +102,8 @@
22 / 22
100.0 %
6 / 6
- 75.0 %
- 6 / 8
+ 100.0 %
+ 4 / 4
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func-sort-c.html
index 599c4e6..f8c0470 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func-sort-c.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -70,7 +70,7 @@
RuleValidateTransfer.validateTransfer
- 7
+ 26
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func.html
index f2ed4bd..417fbf9 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.func.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -70,7 +70,7 @@
RuleValidateTransfer.validateTransfer
- 7
+ 26
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.gcov.html
index 9bdbb69..8544ad8 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleValidateTransfer.sol.gcov.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -89,9 +89,9 @@
18 : : uint256 _amount
19 : : ) public view override returns (bool isValid) {
20 : : // does not work without this keyword "Undeclared identifier"
- 21 : 14 : return
- 22 : 21 : this.detectTransferRestriction(_from, _to, _amount) ==
- 23 : 14 : uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ 21 : 26 : return
+ 22 : 26 : this.detectTransferRestriction(_from, _to, _amount) ==
+ 23 : : uint8(REJECTED_CODE_BASE.TRANSFER_OK);
24 : : }
25 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func-sort-c.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func-sort-c.html
index a3f1152..e0f9046 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func-sort-c.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
@@ -69,11 +69,11 @@
Hit count
- RuleWhitelistCommon.messageForTransferRestriction
+ RuleWhitelistCommon.messageForTransferRestriction
10
- RuleWhitelistCommon.canReturnTransferRestrictionCode
+ RuleWhitelistCommon.canReturnTransferRestrictionCode
12
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func.html
index d07b0b2..56bd216 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.func.html
@@ -37,7 +37,7 @@
-
+
@@ -69,11 +69,11 @@
Hit count
- RuleWhitelistCommon.canReturnTransferRestrictionCode
+ RuleWhitelistCommon.canReturnTransferRestrictionCode
12
- RuleWhitelistCommon.messageForTransferRestriction
+ RuleWhitelistCommon.messageForTransferRestriction
10
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.gcov.html b/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.gcov.html
index 4bfca76..7f454e0 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.gcov.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/RuleWhitelistCommon.sol.gcov.html
@@ -37,7 +37,7 @@
-
+
@@ -78,37 +78,38 @@
7 : :
8 : : abstract contract RuleWhitelistCommon is
9 : : RuleValidateTransfer,
- 10 : : RuleWhitelistInvariantStorage {
- 11 : : /**
- 12 : : * @notice To know if the restriction code is valid for this rule or not
- 13 : : * @param _restrictionCode The target restriction code
- 14 : : * @return true if the restriction code is known, false otherwise
- 15 : : **/
- 16 : : function canReturnTransferRestrictionCode(
- 17 : : uint8 _restrictionCode
- 18 : : ) external pure override returns (bool) {
- 19 : 24 : return
- 20 : 36 : _restrictionCode == CODE_ADDRESS_FROM_NOT_WHITELISTED ||
- 21 : 12 : _restrictionCode == CODE_ADDRESS_TO_NOT_WHITELISTED;
- 22 : : }
- 23 : :
- 24 : : /**
- 25 : : * @notice Return the corresponding message
- 26 : : * @param _restrictionCode The target restriction code
- 27 : : * @return true if the transfer is valid, false otherwise
- 28 : : **/
- 29 : : function messageForTransferRestriction(
- 30 : : uint8 _restrictionCode
- 31 : : ) external pure override returns (string memory) {
- 32 [ + + ]: 20 : if (_restrictionCode == CODE_ADDRESS_FROM_NOT_WHITELISTED) {
- 33 : 12 : return TEXT_ADDRESS_FROM_NOT_WHITELISTED;
- 34 [ + + ]: 8 : } else if (_restrictionCode == CODE_ADDRESS_TO_NOT_WHITELISTED) {
- 35 : 6 : return TEXT_ADDRESS_TO_NOT_WHITELISTED;
- 36 : : } else {
- 37 : 2 : return TEXT_CODE_NOT_FOUND;
- 38 : : }
- 39 : : }
- 40 : : }
+ 10 : : RuleWhitelistInvariantStorage
+ 11 : : {
+ 12 : : /**
+ 13 : : * @notice To know if the restriction code is valid for this rule or not
+ 14 : : * @param _restrictionCode The target restriction code
+ 15 : : * @return true if the restriction code is known, false otherwise
+ 16 : : **/
+ 17 : : function canReturnTransferRestrictionCode(
+ 18 : : uint8 _restrictionCode
+ 19 : : ) external pure override returns (bool) {
+ 20 : 12 : return
+ 21 : 12 : _restrictionCode == CODE_ADDRESS_FROM_NOT_WHITELISTED ||
+ 22 : 6 : _restrictionCode == CODE_ADDRESS_TO_NOT_WHITELISTED;
+ 23 : : }
+ 24 : :
+ 25 : : /**
+ 26 : : * @notice Return the corresponding message
+ 27 : : * @param _restrictionCode The target restriction code
+ 28 : : * @return true if the transfer is valid, false otherwise
+ 29 : : **/
+ 30 : : function messageForTransferRestriction(
+ 31 : : uint8 _restrictionCode
+ 32 : : ) external pure override returns (string memory) {
+ 33 [ + + ]: 10 : if (_restrictionCode == CODE_ADDRESS_FROM_NOT_WHITELISTED) {
+ 34 : 6 : return TEXT_ADDRESS_FROM_NOT_WHITELISTED;
+ 35 [ + + ]: 4 : } else if (_restrictionCode == CODE_ADDRESS_TO_NOT_WHITELISTED) {
+ 36 : 3 : return TEXT_ADDRESS_TO_NOT_WHITELISTED;
+ 37 : : } else {
+ 38 : 1 : return TEXT_CODE_NOT_FOUND;
+ 39 : : }
+ 40 : : }
+ 41 : : }
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/index-sort-b.html b/doc/coverage/coverage/src/rules/validation/abstract/index-sort-b.html
index 84222f3..80167d5 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/index-sort-b.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/index-sort-b.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -87,7 +87,7 @@
100.0 %
- 3 / 3
+ 2 / 2
100.0 %
1 / 1
-
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/index-sort-f.html b/doc/coverage/coverage/src/rules/validation/abstract/index-sort-f.html
index ae3ecc0..5d75ddb 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/index-sort-f.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/index-sort-f.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -87,7 +87,7 @@
100.0 %
- 3 / 3
+ 2 / 2
100.0 %
1 / 1
-
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/index-sort-l.html b/doc/coverage/coverage/src/rules/validation/abstract/index-sort-l.html
index a3e7add..62c92d4 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/index-sort-l.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/index-sort-l.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -87,7 +87,7 @@
100.0 %
- 3 / 3
+ 2 / 2
100.0 %
1 / 1
-
diff --git a/doc/coverage/coverage/src/rules/validation/abstract/index.html b/doc/coverage/coverage/src/rules/validation/abstract/index.html
index 637735f..7f73c12 100644
--- a/doc/coverage/coverage/src/rules/validation/abstract/index.html
+++ b/doc/coverage/coverage/src/rules/validation/abstract/index.html
@@ -31,13 +31,13 @@
-
-
+
+
-
+
@@ -87,7 +87,7 @@
100.0 %
- 3 / 3
+ 2 / 2
100.0 %
1 / 1
-
diff --git a/doc/coverage/coverage/src/rules/validation/index-sort-b.html b/doc/coverage/coverage/src/rules/validation/index-sort-b.html
index 33fbefd..43d72a6 100644
--- a/doc/coverage/coverage/src/rules/validation/index-sort-b.html
+++ b/doc/coverage/coverage/src/rules/validation/index-sort-b.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -81,18 +81,6 @@
Functions
Branches
-
- RuleWhitelistWrapper.sol
-
-
-
- 95.5 %
- 21 / 22
- 75.0 %
- 3 / 4
- 80.0 %
- 8 / 10
-
RuleWhitelist.sol
@@ -101,7 +89,7 @@
100.0 %
5 / 5
100.0 %
- 1 / 1
+ 2 / 2
100.0 %
4 / 4
@@ -113,21 +101,33 @@
100.0 %
13 / 13
100.0 %
- 3 / 3
+ 4 / 4
100.0 %
8 / 8
+
+ RuleWhitelistWrapper.sol
+
+
+
+ 96.4 %
+ 27 / 28
+ 83.3 %
+ 5 / 6
+ 100.0 %
+ 9 / 9
+
RuleSanctionList.sol
-
+
- 94.4 %
- 17 / 18
- 85.7 %
- 6 / 7
+ 96.4 %
+ 27 / 28
+ 90.0 %
+ 9 / 10
100.0 %
- 10 / 10
+ 11 / 11
diff --git a/doc/coverage/coverage/src/rules/validation/index-sort-f.html b/doc/coverage/coverage/src/rules/validation/index-sort-f.html
index 80ea1dc..b040fdc 100644
--- a/doc/coverage/coverage/src/rules/validation/index-sort-f.html
+++ b/doc/coverage/coverage/src/rules/validation/index-sort-f.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -84,26 +84,26 @@
RuleWhitelistWrapper.sol
-
+
- 95.5 %
- 21 / 22
- 75.0 %
- 3 / 4
- 80.0 %
- 8 / 10
+ 96.4 %
+ 27 / 28
+ 83.3 %
+ 5 / 6
+ 100.0 %
+ 9 / 9
RuleSanctionList.sol
-
+
- 94.4 %
- 17 / 18
- 85.7 %
- 6 / 7
+ 96.4 %
+ 27 / 28
+ 90.0 %
+ 9 / 10
100.0 %
- 10 / 10
+ 11 / 11
RuleWhitelist.sol
@@ -113,7 +113,7 @@
100.0 %
5 / 5
100.0 %
- 1 / 1
+ 2 / 2
100.0 %
4 / 4
@@ -125,7 +125,7 @@
100.0 %
13 / 13
100.0 %
- 3 / 3
+ 4 / 4
100.0 %
8 / 8
diff --git a/doc/coverage/coverage/src/rules/validation/index-sort-l.html b/doc/coverage/coverage/src/rules/validation/index-sort-l.html
index 735b5bc..59f017d 100644
--- a/doc/coverage/coverage/src/rules/validation/index-sort-l.html
+++ b/doc/coverage/coverage/src/rules/validation/index-sort-l.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -82,28 +82,28 @@
Branches
- RuleSanctionList.sol
+ RuleWhitelistWrapper.sol
-
+
- 94.4 %
- 17 / 18
- 85.7 %
- 6 / 7
+ 96.4 %
+ 27 / 28
+ 83.3 %
+ 5 / 6
100.0 %
- 10 / 10
+ 9 / 9
- RuleWhitelistWrapper.sol
+ RuleSanctionList.sol
-
+
- 95.5 %
- 21 / 22
- 75.0 %
- 3 / 4
- 80.0 %
- 8 / 10
+ 96.4 %
+ 27 / 28
+ 90.0 %
+ 9 / 10
+ 100.0 %
+ 11 / 11
RuleWhitelist.sol
@@ -113,7 +113,7 @@
100.0 %
5 / 5
100.0 %
- 1 / 1
+ 2 / 2
100.0 %
4 / 4
@@ -125,7 +125,7 @@
100.0 %
13 / 13
100.0 %
- 3 / 3
+ 4 / 4
100.0 %
8 / 8
diff --git a/doc/coverage/coverage/src/rules/validation/index.html b/doc/coverage/coverage/src/rules/validation/index.html
index 4ad8227..1f69f9d 100644
--- a/doc/coverage/coverage/src/rules/validation/index.html
+++ b/doc/coverage/coverage/src/rules/validation/index.html
@@ -31,27 +31,27 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -89,21 +89,21 @@
100.0 %
13 / 13
100.0 %
- 3 / 3
+ 4 / 4
100.0 %
8 / 8
RuleSanctionList.sol
-
+
- 94.4 %
- 17 / 18
- 85.7 %
- 6 / 7
+ 96.4 %
+ 27 / 28
+ 90.0 %
+ 9 / 10
100.0 %
- 10 / 10
+ 11 / 11
RuleWhitelist.sol
@@ -113,21 +113,21 @@
100.0 %
5 / 5
100.0 %
- 1 / 1
+ 2 / 2
100.0 %
4 / 4
RuleWhitelistWrapper.sol
-
+
- 95.5 %
- 21 / 22
- 75.0 %
- 3 / 4
- 80.0 %
- 8 / 10
+ 96.4 %
+ 27 / 28
+ 83.3 %
+ 5 / 6
+ 100.0 %
+ 9 / 9
diff --git a/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.func-sort-c.html b/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.func-sort-c.html
new file mode 100644
index 0000000..67433ed
--- /dev/null
+++ b/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.func-sort-c.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/RuleConditionalTransfer/RuleCTDeployment.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.func.html b/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.func.html
new file mode 100644
index 0000000..3e62922
--- /dev/null
+++ b/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.func.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/RuleConditionalTransfer/RuleCTDeployment.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.gcov.html b/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.gcov.html
new file mode 100644
index 0000000..3d19389
--- /dev/null
+++ b/doc/coverage/coverage/test/RuleConditionalTransfer/RuleCTDeployment.sol.gcov.html
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/RuleConditionalTransfer/RuleCTDeployment.sol
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Branch data Line data Source code
+
+ 1 : : // SPDX-License-Identifier: MPL-2.0
+ 2 : : pragma solidity ^0.8.20;
+ 3 : :
+ 4 : : import "forge-std/Test.sol";
+ 5 : : import "../HelperContract.sol";
+ 6 : : import "src/RuleEngine.sol";
+ 7 : :
+ 8 : : /**
+ 9 : : * @title Tests on the Access Control
+ 10 : : */
+ 11 : : contract RuleCTDeployment is Test, HelperContract {
+ 12 : : // Arrange
+ 13 : : constructor() {
+ 14 : 13 : TIME_LIMIT memory timeLimit_ = TIME_LIMIT({
+ 15 : : timeLimitToApprove: 7 days,
+ 16 : : timeLimitToTransfer: 30 days
+ 17 : : });
+ 18 : :
+ 19 : 13 : AUTOMATIC_APPROVAL memory automaticApproval_ = AUTOMATIC_APPROVAL({
+ 20 : : isActivate: false,
+ 21 : : timeLimitBeforeAutomaticApproval: 0
+ 22 : : });
+ 23 : :
+ 24 : 13 : ISSUANCE memory issuanceOption_ = ISSUANCE({
+ 25 : : authorizedMintWithoutApproval: false,
+ 26 : : authorizedBurnWithoutApproval: false
+ 27 : : });
+ 28 : 13 : AUTOMATIC_TRANSFER memory automaticTransfer_ = AUTOMATIC_TRANSFER({
+ 29 : : isActivate: false,
+ 30 : : cmtat: IERC20(address(0))
+ 31 : : });
+ 32 : :
+ 33 : 13 : OPTION memory options = OPTION({
+ 34 : : issuance: issuanceOption_,
+ 35 : : timeLimit: timeLimit_,
+ 36 : : automaticApproval: automaticApproval_,
+ 37 : : automaticTransfer: automaticTransfer_
+ 38 : : });
+ 39 : 13 : ruleEngineMock = new RuleEngine(
+ 40 : : RULE_ENGINE_OPERATOR_ADDRESS,
+ 41 : : ZERO_ADDRESS,
+ 42 : : ZERO_ADDRESS
+ 43 : : );
+ 44 : 13 : vm.prank(DEFAULT_ADMIN_ADDRESS);
+ 45 : 13 : ruleConditionalTransfer = new RuleConditionalTransfer(
+ 46 : : DEFAULT_ADMIN_ADDRESS,
+ 47 : : ZERO_ADDRESS,
+ 48 : : ruleEngineMock,
+ 49 : : options
+ 50 : : );
+ 51 : 13 : vm.prank(DEFAULT_ADMIN_ADDRESS);
+ 52 : 13 : ruleConditionalTransfer.grantRole(
+ 53 : : RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE,
+ 54 : : CONDITIONAL_TRANSFER_OPERATOR_ADDRESS
+ 55 : : );
+ 56 : : }
+ 57 : : }
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-b.html b/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-b.html
new file mode 100644
index 0000000..672842a
--- /dev/null
+++ b/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-b.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/RuleConditionalTransfer
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Filename
+ Line Coverage
+ Functions
+ Branches
+
+
+ RuleCTDeployment.sol
+
+
+
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-f.html b/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-f.html
new file mode 100644
index 0000000..314b064
--- /dev/null
+++ b/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-f.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/RuleConditionalTransfer
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Filename
+ Line Coverage
+ Functions
+ Branches
+
+
+ RuleCTDeployment.sol
+
+
+
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-l.html b/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-l.html
new file mode 100644
index 0000000..f6226c1
--- /dev/null
+++ b/doc/coverage/coverage/test/RuleConditionalTransfer/index-sort-l.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/RuleConditionalTransfer
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Filename
+ Line Coverage
+ Functions
+ Branches
+
+
+ RuleCTDeployment.sol
+
+
+
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/RuleConditionalTransfer/index.html b/doc/coverage/coverage/test/RuleConditionalTransfer/index.html
new file mode 100644
index 0000000..114f296
--- /dev/null
+++ b/doc/coverage/coverage/test/RuleConditionalTransfer/index.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/RuleConditionalTransfer
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Filename
+ Line Coverage
+ Functions
+ Branches
+
+
+ RuleCTDeployment.sol
+
+
+
+ 100.0 %
+ 10 / 10
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/utils/CMTATDeployment.sol.func-sort-c.html b/doc/coverage/coverage/test/utils/CMTATDeployment.sol.func-sort-c.html
new file mode 100644
index 0000000..ecfe634
--- /dev/null
+++ b/doc/coverage/coverage/test/utils/CMTATDeployment.sol.func-sort-c.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/utils/CMTATDeployment.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/utils/CMTATDeployment.sol.func.html b/doc/coverage/coverage/test/utils/CMTATDeployment.sol.func.html
new file mode 100644
index 0000000..4b8a007
--- /dev/null
+++ b/doc/coverage/coverage/test/utils/CMTATDeployment.sol.func.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/utils/CMTATDeployment.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/utils/CMTATDeployment.sol.gcov.html b/doc/coverage/coverage/test/utils/CMTATDeployment.sol.gcov.html
new file mode 100644
index 0000000..a4ba3e9
--- /dev/null
+++ b/doc/coverage/coverage/test/utils/CMTATDeployment.sol.gcov.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+ LCOV - lcov.info - test/utils/CMTATDeployment.sol
+
+
+
+
+
+
+ LCOV - code coverage report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Branch data Line data Source code
+
+ 1 : : //SPDX-License-Identifier: MPL-2.0
+ 2 : : pragma solidity ^0.8.20;
+ 3 : :
+ 4 : : import "forge-std/Test.sol";
+ 5 : : import "OZ/access/AccessControl.sol";
+ 6 : : import "CMTAT/CMTAT_STANDALONE.sol";
+ 7 : :
+ 8 : : contract CMTATDeployment {
+ 9 : : // Share with helper contract
+ 10 : : address constant ZERO_ADDRESS = address(0);
+ 11 : : address constant DEFAULT_ADMIN_ADDRESS = address(1);
+ 12 : :
+ 13 : : CMTAT_STANDALONE public cmtat;
+ 14 : :
+ 15 : : constructor() {
+ 16 : : // CMTAT
+ 17 : 71 : ICMTATConstructor.ERC20Attributes
+ 18 : : memory erc20Attributes = ICMTATConstructor.ERC20Attributes(
+ 19 : : "CMTA Token",
+ 20 : : "CMTAT",
+ 21 : : 0
+ 22 : : );
+ 23 : 71 : ICMTATConstructor.BaseModuleAttributes
+ 24 : : memory baseModuleAttributes = ICMTATConstructor
+ 25 : : .BaseModuleAttributes(
+ 26 : : "CMTAT_ISIN",
+ 27 : : "https://cmta.ch",
+ 28 : : "CMTAT_info"
+ 29 : : );
+ 30 : 71 : ICMTATConstructor.Engine memory engines = ICMTATConstructor.Engine(
+ 31 : : IRuleEngine(ZERO_ADDRESS),
+ 32 : : IDebtEngine(ZERO_ADDRESS),
+ 33 : : IAuthorizationEngine(ZERO_ADDRESS),
+ 34 : : IERC1643(ZERO_ADDRESS)
+ 35 : : );
+ 36 : 71 : cmtat = new CMTAT_STANDALONE(
+ 37 : : ZERO_ADDRESS,
+ 38 : : DEFAULT_ADMIN_ADDRESS,
+ 39 : : erc20Attributes,
+ 40 : : baseModuleAttributes,
+ 41 : : engines
+ 42 : : );
+ 43 : : }
+ 44 : : }
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func-sort-c.html b/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func-sort-c.html
index 6e16d92..f157fde 100644
--- a/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func-sort-c.html
+++ b/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func-sort-c.html
@@ -37,12 +37,12 @@
-
+
-
-
+
+
@@ -76,6 +76,10 @@
SanctionListOracle.addToSanctionsList
10
+
+ SanctionListOracle.
+ 11
+
SanctionListOracle.isSanctioned
12
diff --git a/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func.html b/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func.html
index 746376d..7e9b52c 100644
--- a/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func.html
+++ b/doc/coverage/coverage/test/utils/SanctionListOracle.sol.func.html
@@ -37,12 +37,12 @@
-
+
-
-
+
+
@@ -68,6 +68,10 @@
Function Name
Hit count
+
+ SanctionListOracle.
+ 11
+
SanctionListOracle.addToSanctionsList
10
diff --git a/doc/coverage/coverage/test/utils/SanctionListOracle.sol.gcov.html b/doc/coverage/coverage/test/utils/SanctionListOracle.sol.gcov.html
index ca478f9..6189674 100644
--- a/doc/coverage/coverage/test/utils/SanctionListOracle.sol.gcov.html
+++ b/doc/coverage/coverage/test/utils/SanctionListOracle.sol.gcov.html
@@ -37,12 +37,12 @@
-
+
-
-
+
+
@@ -82,7 +82,7 @@
11 : : mapping(address => bool) private sanctionedAddresses;
12 : :
13 : : function addToSanctionsList(address newSanction) public {
- 14 : 20 : sanctionedAddresses[newSanction] = true;
+ 14 : 10 : sanctionedAddresses[newSanction] = true;
15 : : }
16 : :
17 : : function removeFromSanctionsList(address removeSanction) public {
@@ -90,7 +90,7 @@
19 : : }
20 : :
21 : : function isSanctioned(address addr) public view returns (bool) {
- 22 : 36 : return sanctionedAddresses[addr] == true;
+ 22 : 12 : return sanctionedAddresses[addr] == true;
23 : : }
24 : : }
diff --git a/doc/coverage/coverage/test/utils/index-sort-b.html b/doc/coverage/coverage/test/utils/index-sort-b.html
index e6a9881..ddf11e9 100644
--- a/doc/coverage/coverage/test/utils/index-sort-b.html
+++ b/doc/coverage/coverage/test/utils/index-sort-b.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -88,8 +88,20 @@
66.7 %
2 / 3
- 66.7 %
- 2 / 3
+ 75.0 %
+ 3 / 4
+ -
+ 0 / 0
+
+
+ CMTATDeployment.sol
+
+
+
+ 100.0 %
+ 4 / 4
+ 100.0 %
+ 1 / 1
-
0 / 0
diff --git a/doc/coverage/coverage/test/utils/index-sort-f.html b/doc/coverage/coverage/test/utils/index-sort-f.html
index 0a0bdb8..9463e98 100644
--- a/doc/coverage/coverage/test/utils/index-sort-f.html
+++ b/doc/coverage/coverage/test/utils/index-sort-f.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -88,8 +88,20 @@
66.7 %
2 / 3
- 66.7 %
- 2 / 3
+ 75.0 %
+ 3 / 4
+ -
+ 0 / 0
+
+
+ CMTATDeployment.sol
+
+
+
+ 100.0 %
+ 4 / 4
+ 100.0 %
+ 1 / 1
-
0 / 0
diff --git a/doc/coverage/coverage/test/utils/index-sort-l.html b/doc/coverage/coverage/test/utils/index-sort-l.html
index 84ae466..23698d8 100644
--- a/doc/coverage/coverage/test/utils/index-sort-l.html
+++ b/doc/coverage/coverage/test/utils/index-sort-l.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -88,8 +88,20 @@
66.7 %
2 / 3
- 66.7 %
- 2 / 3
+ 75.0 %
+ 3 / 4
+ -
+ 0 / 0
+
+
+ CMTATDeployment.sol
+
+
+
+ 100.0 %
+ 4 / 4
+ 100.0 %
+ 1 / 1
-
0 / 0
diff --git a/doc/coverage/coverage/test/utils/index.html b/doc/coverage/coverage/test/utils/index.html
index 4352a4b..0fa7340 100644
--- a/doc/coverage/coverage/test/utils/index.html
+++ b/doc/coverage/coverage/test/utils/index.html
@@ -31,18 +31,18 @@
-
-
-
+
+
+
-
+
-
-
-
+
+
+
@@ -81,6 +81,18 @@
Functions
Branches
+
+ CMTATDeployment.sol
+
+
+
+ 100.0 %
+ 4 / 4
+ 100.0 %
+ 1 / 1
+ -
+ 0 / 0
+
SanctionListOracle.sol
@@ -88,8 +100,8 @@
66.7 %
2 / 3
- 66.7 %
- 2 / 3
+ 75.0 %
+ 3 / 4
-
0 / 0
diff --git a/doc/coverage/lcov.info b/doc/coverage/lcov.info
index 9a41ccd..b0b67e6 100644
--- a/doc/coverage/lcov.info
+++ b/doc/coverage/lcov.info
@@ -3,44 +3,22 @@ SF:script/CMTATWithRuleEngineScript.s.sol
FN:15,CMTATWithRuleEngineScript.run
FNDA:0,CMTATWithRuleEngineScript.run
DA:17,0
-DA:17,0
-DA:17,0
-DA:18,0
DA:18,0
-DA:18,0
-DA:19,0
DA:19,0
-DA:19,0
-DA:20,0
DA:20,0
-DA:21,0
-DA:21,0
-DA:22,0
DA:22,0
+DA:23,0
DA:24,0
-DA:24,0
-DA:24,0
-DA:37,0
+DA:26,0
+DA:30,0
+DA:32,0
DA:37,0
+DA:38,0
DA:39,0
-DA:39,0
-DA:39,0
-DA:43,0
-DA:43,0
-DA:45,0
-DA:45,0
-DA:45,0
-DA:50,0
-DA:50,0
-DA:51,0
-DA:51,0
-DA:52,0
-DA:52,0
-DA:54,0
-DA:54,0
+DA:41,0
FNF:1
FNH:0
-LF:15
+LF:14
LH:0
BRF:0
BRH:0
@@ -50,37 +28,19 @@ SF:script/RuleEngineScript.s.sol
FN:16,RuleEngineScript.run
FNDA:0,RuleEngineScript.run
DA:18,0
-DA:18,0
-DA:18,0
-DA:19,0
-DA:19,0
DA:19,0
DA:20,0
-DA:20,0
-DA:20,0
DA:21,0
-DA:21,0
-DA:23,0
DA:23,0
-DA:23,0
-DA:24,0
DA:24,0
DA:26,0
-DA:26,0
-DA:26,0
-DA:27,0
DA:27,0
DA:28,0
-DA:28,0
-DA:30,0
DA:30,0
-DA:30,0
-DA:33,0
DA:33,0
BRDA:33,0,0,-
BRDA:33,0,1,-
DA:34,0
-DA:34,0
FNF:1
FNH:0
LF:12
@@ -90,1066 +50,669 @@ BRH:0
end_of_record
TN:
SF:src/RuleEngine.sol
-FN:47,RuleEngine.detectTransferRestriction
+FN:29,RuleEngine.
+FNDA:190,RuleEngine.
+DA:34,190
+BRDA:34,0,0,1
+DA:35,1
+DA:37,189
+BRDA:37,1,0,71
+DA:38,71
+DA:40,189
+FN:50,RuleEngine.detectTransferRestriction
FNDA:17,RuleEngine.detectTransferRestriction
-DA:53,26
-DA:53,26
-DA:53,26
-DA:58,26
-DA:58,26
-DA:58,26
-BRDA:58,0,0,15
-BRDA:58,0,1,11
-DA:59,15
-DA:59,15
-DA:63,11
-DA:63,11
-DA:64,11
-DA:64,11
-DA:64,12
-DA:64,1
-DA:65,6
-DA:65,6
-DA:65,6
-DA:67,6
-DA:67,6
-BRDA:67,1,0,5
-BRDA:67,1,1,1
-DA:68,5
-DA:68,5
-DA:72,6
-DA:72,6
-DA:72,6
-FN:82,RuleEngine.validateTransfer
-FNDA:9,RuleEngine.validateTransfer
-DA:87,9
-DA:87,9
-DA:88,9
-DA:88,9
-DA:88,9
-DA:89,9
-DA:89,9
-FN:97,RuleEngine.messageForTransferRestriction
+DA:56,27
+DA:61,27
+BRDA:61,2,0,15
+DA:62,15
+DA:66,12
+DA:67,12
+DA:68,7
+DA:70,7
+BRDA:70,3,0,6
+DA:71,6
+DA:75,6
+FN:85,RuleEngine.validateTransfer
+FNDA:10,RuleEngine.validateTransfer
+DA:90,10
+DA:91,10
+FN:100,RuleEngine.messageForTransferRestriction
FNDA:18,RuleEngine.messageForTransferRestriction
-DA:101,18
-DA:101,18
-DA:102,18
-DA:102,18
-DA:102,21
-DA:102,3
-DA:104,13
-DA:104,13
-BRDA:103,2,0,-
-BRDA:103,2,1,10
-DA:107,10
-DA:107,10
-DA:108,10
-DA:108,10
-DA:113,8
-DA:113,8
-DA:114,8
-DA:114,8
-DA:114,9
-DA:114,1
-DA:116,2
-DA:116,2
-BRDA:115,3,0,-
-BRDA:115,3,1,1
-DA:119,1
-DA:119,1
-DA:120,1
-DA:120,1
-DA:124,7
-DA:124,7
-FN:130,RuleEngine.operateOnTransfer
-FNDA:52,RuleEngine.operateOnTransfer
-DA:137,51
-DA:137,51
-BRDA:136,4,0,10
-BRDA:136,4,1,41
-DA:139,10
-DA:139,10
-DA:142,41
-DA:142,41
-DA:142,41
-FN:152,RuleEngine._msgSender
-FNDA:263,RuleEngine._msgSender
-DA:158,263
-DA:158,263
-DA:158,263
-FN:164,RuleEngine._msgData
+DA:104,18
+DA:105,18
+DA:107,13
+DA:109,10
+BRDA:109,4,0,10
+DA:110,10
+DA:111,10
+DA:116,8
+DA:117,8
+DA:119,2
+DA:121,1
+BRDA:121,5,0,1
+DA:122,1
+DA:123,1
+DA:127,7
+FN:133,RuleEngine.operateOnTransfer
+FNDA:54,RuleEngine.operateOnTransfer
+DA:140,53
+DA:141,10
+BRDA:141,6,0,10
+DA:142,10
+DA:145,43
+FN:152,RuleEngine.hasRole
+FNDA:269,RuleEngine.hasRole
+DA:157,537
+BRDA:157,7,0,205
+DA:158,205
+DA:160,332
+FN:170,RuleEngine._msgSender
+FNDA:528,RuleEngine._msgSender
+DA:176,528
+FN:182,RuleEngine._msgData
FNDA:0,RuleEngine._msgData
-DA:170,0
-DA:170,0
-DA:170,0
-FN:176,RuleEngine._contextSuffixLength
-FNDA:263,RuleEngine._contextSuffixLength
-DA:182,263
-DA:182,263
-DA:182,263
-FNF:7
-FNH:6
-LF:29
-LH:28
-BRF:10
+DA:188,0
+FN:194,RuleEngine._contextSuffixLength
+FNDA:528,RuleEngine._contextSuffixLength
+DA:200,528
+FNF:9
+FNH:8
+LF:39
+LH:38
+BRF:8
BRH:8
end_of_record
TN:
+SF:src/modules/MetaTxModuleStandalone.sol
+FN:11,MetaTxModuleStandalone.
+FNDA:545,MetaTxModuleStandalone.
+FNF:1
+FNH:1
+LF:0
+LH:0
+BRF:0
+BRH:0
+end_of_record
+TN:
SF:src/modules/RuleEngineOperation.sol
FN:26,RuleEngineOperation.setRulesOperation
FNDA:11,RuleEngineOperation.setRulesOperation
DA:29,11
-DA:29,11
BRDA:29,0,0,10
-BRDA:29,0,1,11
-DA:30,10
DA:30,10
DA:32,11
-DA:32,11
-DA:33,8
DA:33,8
FN:40,RuleEngineOperation.clearRulesOperation
FNDA:4,RuleEngineOperation.clearRulesOperation
DA:41,4
-DA:41,4
FN:48,RuleEngineOperation._clearRulesOperation
FNDA:14,RuleEngineOperation._clearRulesOperation
DA:49,14
-DA:49,14
DA:51,14
-DA:51,14
-DA:51,31
-DA:51,17
-DA:54,17
DA:54,17
DA:56,17
-DA:56,17
-DA:58,14
DA:58,14
FN:66,RuleEngineOperation.addRuleOperation
-FNDA:68,RuleEngineOperation.addRuleOperation
-DA:69,68
-DA:69,68
-DA:70,66
-DA:70,66
+FNDA:70,RuleEngineOperation.addRuleOperation
+DA:69,70
+DA:70,68
FN:83,RuleEngineOperation.removeRuleOperation
FNDA:5,RuleEngineOperation.removeRuleOperation
DA:87,5
-DA:87,5
FN:100,RuleEngineOperation._removeRuleOperation
FNDA:22,RuleEngineOperation._removeRuleOperation
DA:101,22
-DA:101,22
-DA:102,21
DA:102,21
FN:108,RuleEngineOperation.rulesCountOperation
FNDA:41,RuleEngineOperation.rulesCountOperation
DA:109,41
-DA:109,41
FN:116,RuleEngineOperation.getRuleIndexOperation
FNDA:3,RuleEngineOperation.getRuleIndexOperation
DA:119,3
-DA:119,3
-DA:119,3
FN:127,RuleEngineOperation.ruleOperation
FNDA:1,RuleEngineOperation.ruleOperation
DA:130,1
-DA:130,1
FN:137,RuleEngineOperation.rulesOperation
FNDA:5,RuleEngineOperation.rulesOperation
DA:143,5
-DA:143,5
FN:152,RuleEngineOperation._operateOnTransfer
-FNDA:41,RuleEngineOperation._operateOnTransfer
-DA:157,41
-DA:157,41
-DA:158,41
-DA:158,41
-DA:158,57
-DA:158,16
-DA:159,33
-DA:159,33
-DA:159,33
-DA:164,33
-DA:164,33
+FNDA:43,RuleEngineOperation._operateOnTransfer
+DA:157,43
+DA:158,43
+DA:159,35
+DA:164,35
BRDA:164,1,0,17
-BRDA:164,1,1,16
DA:165,17
-DA:165,17
-DA:168,24
-DA:168,24
+DA:168,26
FNF:11
FNH:11
LF:25
LH:25
-BRF:4
-BRH:4
+BRF:2
+BRH:2
end_of_record
TN:
SF:src/modules/RuleEngineValidation.sol
FN:29,RuleEngineValidation.detectTransferRestrictionValidation
FNDA:3,RuleEngineValidation.detectTransferRestrictionValidation
-DA:34,82
-DA:34,82
-DA:35,82
-DA:35,82
-DA:35,97
-DA:35,15
-DA:36,43
+DA:34,85
+DA:35,85
DA:36,43
-DA:36,43
-DA:38,43
DA:38,43
BRDA:38,0,0,28
-BRDA:38,0,1,15
-DA:39,28
DA:39,28
-DA:43,54
-DA:43,54
-DA:43,54
+DA:43,57
FN:53,RuleEngineValidation.validateTransferValidation
FNDA:2,RuleEngineValidation.validateTransferValidation
-DA:58,53
-DA:58,53
-DA:59,53
-DA:59,53
-DA:59,53
-DA:60,53
-DA:60,53
+DA:58,55
+DA:59,55
FNF:2
FNH:2
-LF:9
-LH:9
-BRF:2
-BRH:2
+LF:8
+LH:8
+BRF:1
+BRH:1
end_of_record
TN:
SF:src/modules/RuleEngineValidationCommon.sol
-FN:31,RuleEngineValidationCommon.setRulesValidation
+FN:30,RuleEngineValidationCommon.setRulesValidation
FNDA:22,RuleEngineValidationCommon.setRulesValidation
-DA:34,21
-DA:34,21
-BRDA:34,0,0,20
-BRDA:34,0,1,21
-DA:35,20
-DA:35,20
-DA:37,21
-DA:37,21
-DA:38,18
-DA:38,18
-FN:45,RuleEngineValidationCommon.clearRulesValidation
+DA:33,21
+BRDA:33,0,0,20
+DA:34,20
+DA:36,21
+DA:37,18
+FN:44,RuleEngineValidationCommon.clearRulesValidation
FNDA:6,RuleEngineValidationCommon.clearRulesValidation
-DA:46,5
-DA:46,5
-FN:54,RuleEngineValidationCommon.addRuleValidation
-FNDA:115,RuleEngineValidationCommon.addRuleValidation
-DA:57,114
-DA:57,114
-DA:58,112
-DA:58,112
-FN:71,RuleEngineValidationCommon.removeRuleValidation
+DA:45,5
+FN:53,RuleEngineValidationCommon.addRuleValidation
+FNDA:119,RuleEngineValidationCommon.addRuleValidation
+DA:56,118
+DA:57,116
+FN:70,RuleEngineValidationCommon.removeRuleValidation
FNDA:6,RuleEngineValidationCommon.removeRuleValidation
-DA:75,5
-DA:75,5
-FN:81,RuleEngineValidationCommon.rulesCountValidation
+DA:74,5
+FN:80,RuleEngineValidationCommon.rulesCountValidation
FNDA:69,RuleEngineValidationCommon.rulesCountValidation
-DA:82,69
-DA:82,69
-FN:89,RuleEngineValidationCommon.getRuleIndexValidation
+DA:81,69
+FN:88,RuleEngineValidationCommon.getRuleIndexValidation
FNDA:3,RuleEngineValidationCommon.getRuleIndexValidation
-DA:92,3
-DA:92,3
-DA:92,3
-FN:100,RuleEngineValidationCommon.ruleValidation
+DA:91,3
+FN:99,RuleEngineValidationCommon.ruleValidation
FNDA:1,RuleEngineValidationCommon.ruleValidation
-DA:103,1
-DA:103,1
-FN:110,RuleEngineValidationCommon.rulesValidation
+DA:102,1
+FN:109,RuleEngineValidationCommon.rulesValidation
FNDA:5,RuleEngineValidationCommon.rulesValidation
-DA:116,5
-DA:116,5
-FN:126,RuleEngineValidationCommon._clearRulesValidation
+DA:115,5
+FN:125,RuleEngineValidationCommon._clearRulesValidation
FNDA:25,RuleEngineValidationCommon._clearRulesValidation
-DA:127,25
-DA:127,25
-DA:129,25
-DA:129,25
-DA:129,53
-DA:129,28
-DA:132,28
-DA:132,28
-DA:134,28
-DA:134,28
-DA:136,25
-DA:136,25
-FN:149,RuleEngineValidationCommon._removeRuleValidation
+DA:126,25
+DA:128,25
+DA:131,28
+DA:133,28
+DA:135,25
+FN:148,RuleEngineValidationCommon._removeRuleValidation
FNDA:33,RuleEngineValidationCommon._removeRuleValidation
-DA:150,33
-DA:150,33
-DA:151,32
-DA:151,32
+DA:149,33
+DA:150,32
FNF:10
FNH:10
LF:19
LH:19
-BRF:2
-BRH:2
+BRF:1
+BRH:1
end_of_record
TN:
SF:src/modules/RuleInternal.sol
FN:19,RuleInternal._setRules
FNDA:32,RuleInternal._setRules
DA:20,32
-DA:20,32
BRDA:20,0,0,2
-BRDA:20,0,1,30
-DA:21,2
DA:21,2
DA:23,30
-DA:23,30
-DA:23,74
-DA:24,48
-DA:24,48
-DA:24,48
DA:24,48
BRDA:24,1,0,2
-BRDA:24,1,1,46
-DA:25,2
DA:25,2
-DA:27,46
+DA:27,2
BRDA:27,2,0,2
-BRDA:27,2,1,44
DA:28,2
-DA:28,2
-DA:30,44
DA:30,44
DA:31,44
-DA:31,44
-DA:33,44
DA:33,44
FN:43,RuleInternal._addRule
-FNDA:182,RuleInternal._addRule
-DA:44,182
-DA:44,182
-DA:44,182
-DA:44,182
+FNDA:188,RuleInternal._addRule
+DA:44,188
BRDA:44,3,0,2
-BRDA:44,3,1,180
-DA:45,2
DA:45,2
-DA:47,180
+DA:47,2
BRDA:47,4,0,2
-BRDA:47,4,1,178
DA:48,2
-DA:48,2
-DA:50,178
-DA:50,178
-DA:51,178
-DA:51,178
+DA:50,184
+DA:51,184
FN:64,RuleInternal._removeRule
FNDA:55,RuleInternal._removeRule
DA:69,55
-DA:69,55
BRDA:69,5,0,2
-BRDA:69,5,1,53
DA:70,2
-DA:70,2
-DA:72,53
DA:72,53
-DA:72,53
-BRDA:72,6,0,-
-BRDA:72,6,1,4
-DA:73,4
+BRDA:72,6,0,4
DA:73,4
DA:75,53
-DA:75,53
-DA:76,53
DA:76,53
DA:77,53
-DA:77,53
FN:84,RuleInternal._getRuleIndex
FNDA:6,RuleInternal._getRuleIndex
DA:88,6
-DA:88,6
-DA:89,6
DA:89,6
-DA:89,12
-DA:90,10
DA:90,10
BRDA:90,7,0,4
-BRDA:90,7,1,6
-DA:91,4
DA:91,4
DA:94,6
-DA:94,6
-DA:97,2
DA:97,2
FNF:4
FNH:4
LF:29
LH:29
-BRF:16
-BRH:15
+BRF:8
+BRH:8
end_of_record
TN:
SF:src/rules/operation/RuleConditionalTransfer.sol
-FN:58,RuleConditionalTransfer.operateOnTransfer
-FNDA:33,RuleConditionalTransfer.operateOnTransfer
-DA:69,33
-DA:69,33
-DA:69,33
-DA:69,33
-BRDA:69,0,0,2
-BRDA:69,0,1,16
-DA:71,18
-DA:71,18
-DA:71,18
-DA:72,3
-DA:72,3
-BRDA:70,1,0,2
-BRDA:70,1,1,16
-DA:74,2
-DA:74,2
-DA:79,31
-DA:79,31
-BRDA:79,2,0,4
-BRDA:79,2,1,27
-DA:80,4
-DA:80,4
-DA:82,27
-DA:82,27
-DA:82,27
-DA:83,27
-DA:83,27
-BRDA:83,3,0,10
-BRDA:83,3,1,17
-DA:84,10
-DA:84,10
-DA:85,10
-DA:85,10
-DA:87,17
-DA:87,17
-FN:96,RuleConditionalTransfer.createTransferRequest
-FNDA:102,RuleConditionalTransfer.createTransferRequest
-DA:100,105
-DA:100,105
-DA:100,105
-DA:101,105
-DA:101,105
-DA:101,105
-DA:102,105
-DA:102,105
-BRDA:102,4,0,1
-BRDA:102,4,1,104
-DA:103,1
-DA:103,1
-DA:105,104
-DA:105,104
-BRDA:105,5,0,-
-BRDA:105,5,1,101
-DA:106,101
-DA:106,101
-DA:107,101
-DA:107,101
-DA:107,101
-DA:119,101
-DA:119,101
-DA:120,101
-DA:120,101
-DA:121,101
-DA:121,101
-DA:122,101
-DA:122,101
-DA:125,3
-DA:125,3
-DA:126,3
-DA:126,3
-DA:127,3
-DA:127,3
-FN:140,RuleConditionalTransfer.createTransferRequestBatch
+FN:27,RuleConditionalTransfer.
+FNDA:143,RuleConditionalTransfer.
+DA:33,143
+BRDA:33,0,0,1
+DA:34,1
+DA:36,142
+DA:37,142
+BRDA:37,1,0,138
+DA:38,138
+DA:40,142
+FN:51,RuleConditionalTransfer.operateOnTransfer
+FNDA:35,RuleConditionalTransfer.operateOnTransfer
+DA:61,35
+BRDA:61,2,0,6
+BRDA:61,2,1,17
+DA:62,6
+DA:64,29
+DA:65,29
+BRDA:65,3,0,12
+BRDA:65,3,1,17
+DA:66,12
+DA:67,12
+DA:69,17
+FN:79,RuleConditionalTransfer.createTransferRequest
+FNDA:104,RuleConditionalTransfer.createTransferRequest
+DA:83,107
+DA:84,107
+DA:85,107
+BRDA:85,4,0,1
+DA:86,1
+DA:88,106
+BRDA:88,5,0,103
+BRDA:88,5,1,3
+DA:89,103
+DA:90,103
+DA:102,103
+DA:103,103
+DA:104,103
+DA:105,103
+DA:108,3
+DA:109,3
+DA:110,3
+FN:123,RuleConditionalTransfer.createTransferRequestBatch
FNDA:3,RuleConditionalTransfer.createTransferRequestBatch
-DA:144,3
-DA:144,3
-BRDA:144,6,0,1
-BRDA:144,6,1,2
-DA:145,1
-DA:145,1
-DA:147,2
-DA:147,2
-BRDA:147,7,0,1
-BRDA:147,7,1,1
-DA:148,1
-DA:148,1
-DA:150,1
-DA:150,1
-DA:150,4
-DA:150,3
-DA:151,3
-DA:151,3
-FN:158,RuleConditionalTransfer.cancelTransferRequest
+DA:127,3
+BRDA:127,6,0,1
+DA:128,1
+DA:130,2
+BRDA:130,7,0,1
+DA:131,1
+DA:133,1
+DA:134,3
+FN:141,RuleConditionalTransfer.cancelTransferRequest
FNDA:6,RuleConditionalTransfer.cancelTransferRequest
-DA:159,6
-DA:159,6
-FN:165,RuleConditionalTransfer.cancelTransferRequestBatch
+DA:142,6
+FN:148,RuleConditionalTransfer.cancelTransferRequestBatch
FNDA:3,RuleConditionalTransfer.cancelTransferRequestBatch
-DA:166,3
-DA:166,3
-BRDA:166,8,0,1
-BRDA:166,8,1,2
-DA:167,1
-DA:167,1
-DA:170,2
-DA:170,2
-DA:170,6
-DA:170,4
-DA:171,5
-DA:171,5
-DA:171,5
-BRDA:171,9,0,1
-BRDA:171,9,1,4
-DA:172,1
-DA:172,1
-DA:175,1
-DA:175,1
-DA:175,4
-DA:175,3
-DA:176,3
-DA:176,3
-FN:180,RuleConditionalTransfer.getRequestTrade
+DA:149,3
+BRDA:149,8,0,1
+DA:150,1
+DA:153,2
+DA:154,5
+BRDA:154,9,0,1
+DA:155,1
+DA:158,1
+DA:159,3
+FN:163,RuleConditionalTransfer.getRequestTrade
FNDA:57,RuleConditionalTransfer.getRequestTrade
-DA:185,57
-DA:185,57
-DA:185,57
-DA:186,57
-DA:186,57
-FN:194,RuleConditionalTransfer.getRequestByStatus
+DA:168,57
+DA:169,57
+FN:177,RuleConditionalTransfer.getRequestByStatus
FNDA:35,RuleConditionalTransfer.getRequestByStatus
-DA:197,35
-DA:197,35
-DA:198,35
-DA:198,35
-DA:199,35
-DA:199,35
-DA:202,35
-DA:202,35
-DA:202,73
-DA:202,38
-DA:203,38
-DA:203,38
-BRDA:203,10,0,36
-BRDA:203,10,1,38
-DA:204,36
-DA:204,36
-DA:209,35
-DA:209,35
-DA:209,35
-DA:212,35
-DA:212,35
-DA:212,73
-DA:212,38
-DA:213,38
-DA:213,38
-BRDA:213,11,0,-
-BRDA:213,11,1,36
-DA:215,36
-DA:215,36
-DA:218,36
-DA:218,36
-DA:219,36
-DA:219,36
-DA:222,35
-DA:222,35
-FN:231,RuleConditionalTransfer.detectTransferRestriction
-FNDA:11,RuleConditionalTransfer.detectTransferRestriction
-DA:237,11
-DA:237,11
-DA:237,11
-DA:237,11
-BRDA:237,12,0,-
-BRDA:237,12,1,1
-DA:239,3
-DA:239,3
-DA:239,3
-DA:240,2
-DA:240,2
-BRDA:238,13,0,-
-BRDA:238,13,1,1
-DA:242,1
-DA:242,1
-DA:242,1
-DA:245,10
-DA:245,10
-DA:245,10
-DA:246,10
-DA:246,10
-DA:246,10
-DA:246,10
-BRDA:246,14,0,8
-BRDA:246,14,1,2
-DA:247,8
-DA:247,8
-DA:249,2
-DA:249,2
-DA:249,2
-FN:258,RuleConditionalTransfer.canReturnTransferRestrictionCode
+DA:180,35
+DA:181,35
+DA:182,35
+DA:185,35
+DA:186,38
+BRDA:186,10,0,36
+DA:187,36
+DA:192,35
+DA:195,35
+DA:196,38
+BRDA:196,11,0,36
+DA:198,36
+DA:201,36
+DA:202,36
+DA:205,35
+FN:214,RuleConditionalTransfer.detectTransferRestriction
+FNDA:31,RuleConditionalTransfer.detectTransferRestriction
+DA:220,31
+BRDA:220,12,0,1
+DA:221,1
+DA:223,30
+DA:224,30
+BRDA:224,13,0,6
+BRDA:224,13,1,6
+DA:225,6
+DA:227,24
+FN:236,RuleConditionalTransfer.canReturnTransferRestrictionCode
FNDA:2,RuleConditionalTransfer.canReturnTransferRestrictionCode
-DA:261,2
-DA:261,2
-DA:261,2
-FN:269,RuleConditionalTransfer.messageForTransferRestriction
+DA:239,2
+FN:247,RuleConditionalTransfer.messageForTransferRestriction
FNDA:3,RuleConditionalTransfer.messageForTransferRestriction
-DA:272,3
-DA:272,3
-BRDA:272,15,0,2
-BRDA:272,15,1,1
-DA:273,2
-DA:273,2
-DA:275,1
-DA:275,1
-FN:284,RuleConditionalTransfer._cancelTransferRequest
+DA:250,3
+BRDA:250,14,0,2
+BRDA:250,14,1,1
+DA:251,2
+DA:253,1
+FN:260,RuleConditionalTransfer._validateTransfer
+FNDA:66,RuleConditionalTransfer._validateTransfer
+DA:265,66
+BRDA:265,15,0,30
+DA:267,30
+DA:268,5
+DA:269,3
+BRDA:269,16,0,3
+DA:270,3
+DA:275,63
+BRDA:275,17,0,4
+DA:276,4
+DA:278,59
+FN:281,RuleConditionalTransfer._cancelTransferRequest
FNDA:9,RuleConditionalTransfer._cancelTransferRequest
-DA:285,9
-DA:285,9
-DA:285,9
-BRDA:285,16,0,1
-BRDA:285,16,1,8
-DA:286,1
-DA:286,1
-DA:288,8
-DA:288,8
-DA:290,8
-DA:290,8
-DA:290,8
-BRDA:290,17,0,1
-BRDA:290,17,1,7
-DA:291,1
-DA:291,1
-DA:295,7
-DA:295,7
-DA:295,7
-DA:296,2
-DA:296,2
-BRDA:294,18,0,1
-BRDA:294,18,1,6
-DA:298,1
-DA:298,1
-DA:300,6
-DA:300,6
-FN:310,RuleConditionalTransfer._validateBurnMint
-FNDA:41,RuleConditionalTransfer._validateBurnMint
-DA:316,41
-DA:316,41
-BRDA:315,19,0,4
-BRDA:315,19,1,37
-DA:321,4
-DA:321,4
-DA:323,37
-DA:323,37
-FN:332,RuleConditionalTransfer._validateApproval
-FNDA:37,RuleConditionalTransfer._validateApproval
-DA:336,37
-DA:336,37
-DA:336,37
-DA:343,37
-DA:343,37
-DA:343,37
-DA:346,37
-DA:346,37
-BRDA:346,20,0,12
-BRDA:346,20,1,25
-DA:347,12
-DA:347,12
-DA:349,25
-DA:349,25
-FN:360,RuleConditionalTransfer._msgSender
-FNDA:452,RuleConditionalTransfer._msgSender
-DA:366,452
-DA:366,452
-DA:366,452
-FN:372,RuleConditionalTransfer._msgData
+DA:282,9
+BRDA:282,18,0,1
+DA:283,1
+DA:285,8
+DA:287,8
+BRDA:287,19,0,1
+DA:288,1
+DA:292,7
+DA:293,2
+DA:294,1
+BRDA:294,20,0,1
+DA:295,1
+DA:297,6
+FN:307,RuleConditionalTransfer._validateBurnMint
+FNDA:63,RuleConditionalTransfer._validateBurnMint
+DA:313,63
+DA:317,4
+BRDA:317,21,0,4
+DA:318,4
+DA:320,59
+FN:329,RuleConditionalTransfer._validateApproval
+FNDA:59,RuleConditionalTransfer._validateApproval
+DA:334,59
+DA:337,21
+DA:341,59
+DA:344,59
+BRDA:344,22,0,18
+BRDA:344,22,1,41
+DA:345,18
+DA:347,41
+FN:358,RuleConditionalTransfer._msgSender
+FNDA:745,RuleConditionalTransfer._msgSender
+DA:364,745
+FN:370,RuleConditionalTransfer._msgData
FNDA:0,RuleConditionalTransfer._msgData
-DA:378,0
-DA:378,0
-DA:378,0
-FN:384,RuleConditionalTransfer._contextSuffixLength
-FNDA:452,RuleConditionalTransfer._contextSuffixLength
-DA:390,452
-DA:390,452
-DA:390,452
-FNF:16
-FNH:15
-LF:86
-LH:85
-BRF:42
-BRH:38
+DA:376,0
+FN:382,RuleConditionalTransfer._contextSuffixLength
+FNDA:745,RuleConditionalTransfer._contextSuffixLength
+DA:388,745
+FNF:18
+FNH:17
+LF:97
+LH:96
+BRF:29
+BRH:29
end_of_record
TN:
SF:src/rules/operation/abstract/RuleConditionalTransferOperator.sol
FN:32,RuleConditionalTransferOperator.setConditionalWhitelist
-FNDA:25,RuleConditionalTransferOperator.setConditionalWhitelist
-DA:35,25
-DA:35,25
-DA:36,25
-DA:36,25
+FNDA:26,RuleConditionalTransferOperator.setConditionalWhitelist
+DA:35,26
+DA:36,26
FN:42,RuleConditionalTransferOperator.setIssuanceOptions
FNDA:5,RuleConditionalTransferOperator.setIssuanceOptions
DA:46,4
-DA:46,4
-BRDA:45,0,0,2
-BRDA:45,0,1,4
-DA:49,2
+DA:48,2
+BRDA:48,0,0,2
DA:49,2
DA:53,4
-DA:53,4
-BRDA:52,1,0,2
-BRDA:52,1,1,4
-DA:56,2
+DA:55,2
+BRDA:55,1,0,2
DA:56,2
FN:66,RuleConditionalTransferOperator.setAutomaticTransfer
FNDA:3,RuleConditionalTransferOperator.setAutomaticTransfer
DA:70,2
-DA:70,2
-BRDA:69,2,0,2
-BRDA:69,2,1,2
-DA:73,2
+DA:72,2
+BRDA:72,2,0,2
DA:73,2
DA:78,2
-DA:78,2
-DA:78,2
-DA:79,2
-DA:79,2
-BRDA:77,3,0,2
-BRDA:77,3,1,2
-DA:81,2
+DA:80,2
+BRDA:80,3,0,2
DA:81,2
FN:90,RuleConditionalTransferOperator.setTimeLimit
FNDA:4,RuleConditionalTransferOperator.setTimeLimit
DA:94,3
-DA:94,3
-BRDA:93,4,0,3
-BRDA:93,4,1,3
-DA:97,3
+DA:96,3
+BRDA:96,4,0,3
DA:97,3
DA:101,3
-DA:101,3
-BRDA:100,5,0,3
-BRDA:100,5,1,3
-DA:104,3
+DA:103,3
+BRDA:103,5,0,3
DA:104,3
FN:114,RuleConditionalTransferOperator.setAutomaticApproval
-FNDA:5,RuleConditionalTransferOperator.setAutomaticApproval
-DA:118,4
-DA:118,4
-BRDA:117,6,0,4
-BRDA:117,6,1,4
-DA:121,4
-DA:121,4
-DA:125,4
-DA:125,4
-BRDA:124,7,0,4
-BRDA:124,7,1,4
-DA:128,4
-DA:128,4
+FNDA:7,RuleConditionalTransferOperator.setAutomaticApproval
+DA:118,6
+DA:120,6
+BRDA:120,6,0,6
+DA:121,6
+DA:125,6
+DA:127,6
+BRDA:127,7,0,6
+DA:128,6
FN:138,RuleConditionalTransferOperator.createTransferRequestWithApproval
FNDA:6,RuleConditionalTransferOperator.createTransferRequestWithApproval
DA:141,5
-DA:141,5
FN:150,RuleConditionalTransferOperator.approveTransferRequest
FNDA:33,RuleConditionalTransferOperator.approveTransferRequest
DA:155,32
-DA:155,32
FN:161,RuleConditionalTransferOperator.approveTransferRequestWithId
FNDA:5,RuleConditionalTransferOperator.approveTransferRequestWithId
DA:165,4
-DA:165,4
-DA:165,4
BRDA:165,8,0,2
-BRDA:165,8,1,2
-DA:166,2
DA:166,2
DA:168,2
-DA:168,2
-DA:171,2
DA:171,2
FN:177,RuleConditionalTransferOperator.resetRequestStatus
FNDA:3,RuleConditionalTransferOperator.resetRequestStatus
DA:180,2
-DA:180,2
-DA:180,2
BRDA:180,9,0,1
-BRDA:180,9,1,1
-DA:181,1
DA:181,1
DA:183,1
-DA:183,1
-DA:184,1
DA:184,1
FN:191,RuleConditionalTransferOperator.approveTransferRequestBatchWithId
FNDA:7,RuleConditionalTransferOperator.approveTransferRequestBatchWithId
DA:195,5
-DA:195,5
BRDA:195,10,0,1
-BRDA:195,10,1,4
-DA:196,1
DA:196,1
DA:198,4
-DA:198,4
BRDA:198,11,0,1
-BRDA:198,11,1,3
-DA:199,1
DA:199,1
DA:202,3
-DA:202,3
-DA:202,13
-DA:202,10
-DA:203,11
-DA:203,11
DA:203,11
BRDA:203,12,0,1
-BRDA:203,12,1,10
DA:204,1
-DA:204,1
-DA:207,2
DA:207,2
-DA:207,6
-DA:207,4
DA:208,5
-DA:208,5
-DA:211,5
DA:211,5
FN:218,RuleConditionalTransferOperator.approveTransferRequestBatch
FNDA:7,RuleConditionalTransferOperator.approveTransferRequestBatch
DA:223,6
-DA:223,6
BRDA:223,13,0,1
-BRDA:223,13,1,5
-DA:224,1
DA:224,1
DA:227,5
-DA:227,5
-BRDA:226,14,0,3
-BRDA:226,14,1,2
-DA:230,3
+DA:229,3
+BRDA:229,14,0,3
DA:230,3
DA:232,2
-DA:232,2
-DA:232,11
-DA:232,9
-DA:233,9
DA:233,9
FN:244,RuleConditionalTransferOperator.createTransferRequestWithApprovalBatch
FNDA:3,RuleConditionalTransferOperator.createTransferRequestWithApprovalBatch
DA:247,2
-DA:247,2
BRDA:247,15,0,1
-BRDA:247,15,1,1
DA:248,1
-DA:248,1
-DA:250,1
DA:250,1
-DA:250,5
-DA:250,4
-DA:251,4
DA:251,4
FN:258,RuleConditionalTransferOperator.resetRequestStatusBatch
FNDA:3,RuleConditionalTransferOperator.resetRequestStatusBatch
DA:261,3
-DA:261,3
BRDA:261,16,0,1
-BRDA:261,16,1,2
DA:262,1
-DA:262,1
-DA:265,2
DA:265,2
-DA:265,5
-DA:265,3
-DA:266,4
-DA:266,4
DA:266,4
BRDA:266,17,0,1
-BRDA:266,17,1,3
-DA:267,1
DA:267,1
DA:270,1
-DA:270,1
-DA:270,4
-DA:270,3
DA:271,3
-DA:271,3
-DA:272,3
DA:272,3
-FN:279,RuleConditionalTransferOperator._approveTransferRequestKeyElement
+FN:280,RuleConditionalTransferOperator.hasRole
+FNDA:280,RuleConditionalTransferOperator.hasRole
+DA:285,630
+BRDA:285,18,0,124
+DA:286,124
+DA:288,506
+FN:294,RuleConditionalTransferOperator._approveTransferRequestKeyElement
FNDA:41,RuleConditionalTransferOperator._approveTransferRequestKeyElement
-DA:284,41
-DA:284,41
-BRDA:284,18,0,1
-BRDA:284,18,1,40
-DA:285,1
-DA:285,1
-DA:287,40
-DA:287,40
-DA:287,40
-DA:290,40
-DA:290,40
-DA:291,40
-DA:291,40
-BRDA:291,19,0,1
-BRDA:291,19,1,6
-DA:292,7
-DA:292,7
-BRDA:292,20,0,1
-BRDA:292,20,1,6
-DA:293,1
-DA:293,1
-DA:296,6
-DA:296,6
-DA:298,6
-DA:298,6
-DA:306,33
-DA:306,33
-FN:310,RuleConditionalTransferOperator._createTransferRequestWithApproval
-FNDA:0,RuleConditionalTransferOperator._createTransferRequestWithApproval
-DA:316,15
-DA:316,15
-DA:316,15
-DA:319,15
-DA:319,15
-BRDA:319,21,0,-
-BRDA:319,21,1,14
-DA:320,14
-DA:320,14
-DA:320,14
-DA:329,14
-DA:329,14
-DA:330,14
-DA:330,14
-DA:331,14
-DA:331,14
-DA:338,14
-DA:338,14
-DA:341,1
-DA:341,1
-DA:344,1
-DA:344,1
-DA:345,1
-DA:345,1
-FN:355,RuleConditionalTransferOperator._resetRequestStatus
+DA:299,41
+BRDA:299,19,0,1
+DA:300,1
+DA:302,40
+DA:305,40
+DA:306,40
+BRDA:306,20,0,7
+BRDA:306,20,1,6
+DA:307,7
+BRDA:307,21,0,1
+DA:308,1
+DA:311,6
+DA:313,6
+DA:321,33
+FN:325,RuleConditionalTransferOperator._createTransferRequestWithApproval
+FNDA:15,RuleConditionalTransferOperator._createTransferRequestWithApproval
+DA:331,15
+DA:334,15
+BRDA:334,22,0,14
+BRDA:334,22,1,1
+DA:335,14
+DA:345,14
+DA:346,14
+DA:347,14
+DA:354,14
+DA:358,1
+DA:361,1
+DA:362,1
+FN:372,RuleConditionalTransferOperator._resetRequestStatus
FNDA:10,RuleConditionalTransferOperator._resetRequestStatus
-DA:356,10
-DA:356,10
-DA:357,10
-DA:357,10
-FN:366,RuleConditionalTransferOperator._checkRequestStatus
-FNDA:119,RuleConditionalTransferOperator._checkRequestStatus
-DA:368,119
-DA:368,119
-DA:369,119
-DA:369,119
-FN:373,RuleConditionalTransferOperator._approveRequest
+DA:373,10
+DA:374,10
+FN:383,RuleConditionalTransferOperator._checkRequestStatus
+FNDA:121,RuleConditionalTransferOperator._checkRequestStatus
+DA:385,121
+DA:386,121
+FN:390,RuleConditionalTransferOperator._approveRequest
FNDA:46,RuleConditionalTransferOperator._approveRequest
-DA:378,46
-DA:378,46
-BRDA:378,22,0,1
-BRDA:378,22,1,45
-DA:379,1
-DA:379,1
-DA:381,45
-BRDA:381,23,0,2
-BRDA:381,23,1,2
-DA:384,27
-DA:384,27
-BRDA:383,24,0,3
-BRDA:383,24,1,24
-DA:387,3
-DA:387,3
-DA:390,24
-DA:390,24
-DA:392,24
-DA:392,24
-DA:395,24
-DA:395,24
-DA:403,24
-DA:403,24
-DA:404,2
-DA:404,2
-DA:404,2
-DA:404,2
-BRDA:402,25,0,2
-BRDA:402,25,1,2
-DA:409,2
-DA:409,2
-DA:409,2
-BRDA:408,26,0,2
-BRDA:408,26,1,2
-DA:415,2
-DA:415,2
-DA:423,18
-DA:423,18
-DA:424,18
-DA:424,18
-FN:437,RuleConditionalTransferOperator._updateProcessedTransfer
-FNDA:10,RuleConditionalTransferOperator._updateProcessedTransfer
-DA:439,10
-DA:439,10
-DA:440,10
-DA:440,10
-DA:442,10
-DA:442,10
-DA:444,10
-DA:444,10
-FNF:19
-FNH:18
-LF:99
-LH:99
-BRF:54
-BRH:53
+DA:395,46
+BRDA:395,23,0,1
+DA:396,1
+DA:398,27
+BRDA:398,24,0,27
+BRDA:398,24,1,18
+DA:401,27
+DA:403,3
+BRDA:403,25,0,3
+DA:404,3
+DA:407,24
+DA:409,24
+DA:412,24
+DA:420,24
+DA:421,2
+DA:422,2
+BRDA:422,26,0,2
+DA:426,2
+DA:430,2
+BRDA:430,27,0,2
+DA:432,2
+DA:440,18
+DA:441,18
+FN:454,RuleConditionalTransferOperator._updateProcessedTransfer
+FNDA:12,RuleConditionalTransferOperator._updateProcessedTransfer
+DA:456,12
+DA:457,12
+DA:459,12
+DA:461,12
+FNF:20
+FNH:20
+LF:113
+LH:113
+BRF:31
+BRH:31
end_of_record
TN:
SF:src/rules/validation/RuleBlacklist.sol
+FN:22,RuleBlacklist.
+FNDA:12,RuleBlacklist.
FN:33,RuleBlacklist.detectTransferRestriction
FNDA:10,RuleBlacklist.detectTransferRestriction
DA:38,10
-DA:38,10
BRDA:38,0,0,5
-BRDA:38,0,1,5
+BRDA:38,0,1,3
DA:39,5
-DA:39,5
-DA:40,5
DA:40,5
BRDA:40,1,0,2
BRDA:40,1,1,3
DA:41,2
-DA:41,2
-DA:43,3
-DA:43,3
DA:43,3
FN:52,RuleBlacklist.canReturnTransferRestrictionCode
FNDA:4,RuleBlacklist.canReturnTransferRestrictionCode
DA:55,4
-DA:55,4
DA:56,4
-DA:56,4
-DA:56,4
-DA:57,2
DA:57,2
FN:65,RuleBlacklist.messageForTransferRestriction
FNDA:4,RuleBlacklist.messageForTransferRestriction
DA:68,4
-DA:68,4
BRDA:68,2,0,2
-BRDA:68,2,1,2
-DA:69,2
+BRDA:68,2,1,1
DA:69,2
DA:70,2
-DA:70,2
BRDA:70,3,0,1
BRDA:70,3,1,1
DA:71,1
-DA:71,1
DA:73,1
-DA:73,1
-FNF:3
-FNH:3
+FNF:4
+FNH:4
LF:13
LH:13
BRF:8
@@ -1157,101 +720,89 @@ BRH:8
end_of_record
TN:
SF:src/rules/validation/RuleSanctionList.sol
-FN:42,RuleSanctionList.setSanctionListOracle
-FNDA:10,RuleSanctionList.setSanctionListOracle
-DA:45,9
-DA:45,9
-FN:54,RuleSanctionList.detectTransferRestriction
+FN:26,RuleSanctionList.
+FNDA:13,RuleSanctionList.
+DA:31,13
+BRDA:31,0,0,1
+DA:32,1
+DA:34,12
+BRDA:34,1,0,1
+DA:35,1
+DA:37,12
+FN:45,RuleSanctionList.setSanctionListOracle
+FNDA:11,RuleSanctionList.setSanctionListOracle
+DA:48,10
+FN:57,RuleSanctionList.detectTransferRestriction
FNDA:7,RuleSanctionList.detectTransferRestriction
-DA:59,7
-DA:59,7
-DA:59,7
-DA:59,7
-BRDA:59,0,0,2
-BRDA:59,0,1,3
-DA:60,7
-DA:60,7
-BRDA:60,1,0,2
-BRDA:60,1,1,5
-DA:61,2
-DA:61,2
-DA:62,5
-DA:62,5
-BRDA:62,2,0,2
-BRDA:62,2,1,3
-DA:63,2
-DA:63,2
-DA:66,3
-DA:66,3
-DA:66,3
-FN:74,RuleSanctionList.canReturnTransferRestrictionCode
+DA:62,7
+BRDA:62,2,0,7
+DA:63,7
+BRDA:63,3,0,2
+BRDA:63,3,1,3
+DA:64,2
+DA:65,5
+BRDA:65,4,0,2
+DA:66,2
+DA:69,3
+FN:77,RuleSanctionList.canReturnTransferRestrictionCode
FNDA:3,RuleSanctionList.canReturnTransferRestrictionCode
-DA:77,3
-DA:77,3
-DA:78,3
-DA:78,3
-DA:78,3
-DA:79,2
-DA:79,2
-FN:87,RuleSanctionList.messageForTransferRestriction
+DA:80,3
+DA:81,3
+DA:82,2
+FN:90,RuleSanctionList.messageForTransferRestriction
FNDA:3,RuleSanctionList.messageForTransferRestriction
-DA:90,3
-DA:90,3
-BRDA:90,3,0,1
-BRDA:90,3,1,2
-DA:91,1
-DA:91,1
-DA:92,2
-DA:92,2
-BRDA:92,4,0,1
-BRDA:92,4,1,1
-DA:93,1
-DA:93,1
-DA:95,1
-DA:95,1
-FN:102,RuleSanctionList._msgSender
-FNDA:10,RuleSanctionList._msgSender
-DA:108,10
-DA:108,10
-DA:108,10
-FN:114,RuleSanctionList._msgData
+DA:93,3
+BRDA:93,5,0,1
+BRDA:93,5,1,1
+DA:94,1
+DA:95,2
+BRDA:95,6,0,1
+BRDA:95,6,1,1
+DA:96,1
+DA:98,1
+FN:106,RuleSanctionList.hasRole
+FNDA:13,RuleSanctionList.hasRole
+DA:111,24
+BRDA:111,7,0,11
+DA:112,11
+DA:114,13
+FN:121,RuleSanctionList._setSanctionListOracle
+FNDA:11,RuleSanctionList._setSanctionListOracle
+DA:122,11
+DA:123,11
+FN:133,RuleSanctionList._msgSender
+FNDA:23,RuleSanctionList._msgSender
+DA:139,23
+FN:145,RuleSanctionList._msgData
FNDA:0,RuleSanctionList._msgData
-DA:120,0
-DA:120,0
-DA:120,0
-FN:126,RuleSanctionList._contextSuffixLength
-FNDA:10,RuleSanctionList._contextSuffixLength
-DA:132,10
-DA:132,10
-DA:132,10
-FNF:7
-FNH:6
-LF:18
-LH:17
-BRF:10
-BRH:10
+DA:151,0
+FN:157,RuleSanctionList._contextSuffixLength
+FNDA:23,RuleSanctionList._contextSuffixLength
+DA:163,23
+FNF:10
+FNH:9
+LF:28
+LH:27
+BRF:11
+BRH:11
end_of_record
TN:
SF:src/rules/validation/RuleWhitelist.sol
-FN:28,RuleWhitelist.detectTransferRestriction
+FN:16,RuleWhitelist.
+FNDA:173,RuleWhitelist.
+FN:27,RuleWhitelist.detectTransferRestriction
FNDA:28,RuleWhitelist.detectTransferRestriction
-DA:33,28
-DA:33,28
-BRDA:33,0,0,13
-BRDA:33,0,1,15
-DA:34,13
-DA:34,13
-DA:35,15
-DA:35,15
-BRDA:35,1,0,5
-BRDA:35,1,1,10
-DA:36,5
-DA:36,5
-DA:38,10
-DA:38,10
-DA:38,10
-FNF:1
-FNH:1
+DA:32,28
+BRDA:32,0,0,13
+BRDA:32,0,1,10
+DA:33,13
+DA:34,15
+BRDA:34,1,0,5
+BRDA:34,1,1,10
+DA:35,5
+DA:37,10
+FNF:2
+FNH:2
LF:5
LH:5
BRF:4
@@ -1259,269 +810,198 @@ BRH:4
end_of_record
TN:
SF:src/rules/validation/RuleWhitelistWrapper.sol
-FN:40,RuleWhitelistWrapper.detectTransferRestriction
+FN:23,RuleWhitelistWrapper.
+FNDA:14,RuleWhitelistWrapper.
+DA:27,14
+BRDA:27,0,0,1
+DA:28,1
+DA:30,13
+FN:39,RuleWhitelistWrapper.detectTransferRestriction
FNDA:11,RuleWhitelistWrapper.detectTransferRestriction
+DA:44,11
DA:45,11
-DA:45,11
-DA:45,11
-DA:46,11
-DA:46,11
DA:46,11
DA:47,11
-DA:47,11
-DA:47,11
-DA:48,11
DA:48,11
DA:49,11
-DA:49,11
-DA:50,11
-DA:50,11
-DA:52,11
-DA:52,11
-DA:52,31
-DA:52,20
-DA:54,25
-DA:54,25
-DA:56,25
-DA:56,25
-DA:56,7
-BRDA:56,0,0,-
-BRDA:56,0,1,7
-DA:58,7
-DA:58,7
-DA:60,25
-DA:60,25
-DA:60,7
-BRDA:60,1,0,-
-BRDA:60,1,1,7
-DA:62,7
-DA:62,7
-DA:64,25
+DA:51,11
+DA:53,25
+DA:55,25
+BRDA:55,1,0,7
+DA:57,7
+DA:59,25
+BRDA:59,2,0,7
+DA:61,7
+DA:63,25
+BRDA:63,3,0,25
DA:64,25
-BRDA:64,2,0,20
-BRDA:64,2,1,11
-DA:65,25
-DA:65,25
-DA:68,11
-DA:68,11
-BRDA:68,3,0,4
-BRDA:68,3,1,7
-DA:69,4
-DA:69,4
-DA:70,7
-DA:70,7
-BRDA:70,4,0,2
-BRDA:70,4,1,5
-DA:71,2
-DA:71,2
-DA:73,5
-DA:73,5
-DA:73,5
-FN:80,RuleWhitelistWrapper._msgSender
-FNDA:36,RuleWhitelistWrapper._msgSender
-DA:86,36
-DA:86,36
-DA:86,36
-FN:92,RuleWhitelistWrapper._msgData
+DA:67,11
+BRDA:67,4,0,4
+BRDA:67,4,1,5
+DA:68,4
+DA:69,7
+BRDA:69,5,0,2
+BRDA:69,5,1,5
+DA:70,2
+DA:72,5
+FN:80,RuleWhitelistWrapper.hasRole
+FNDA:13,RuleWhitelistWrapper.hasRole
+DA:85,52
+BRDA:85,6,0,39
+DA:86,39
+DA:88,13
+FN:98,RuleWhitelistWrapper._msgSender
+FNDA:52,RuleWhitelistWrapper._msgSender
+DA:104,52
+FN:110,RuleWhitelistWrapper._msgData
FNDA:0,RuleWhitelistWrapper._msgData
-DA:98,0
-DA:98,0
-DA:98,0
-FN:104,RuleWhitelistWrapper._contextSuffixLength
-FNDA:36,RuleWhitelistWrapper._contextSuffixLength
-DA:110,36
-DA:110,36
-DA:110,36
-FNF:4
-FNH:3
-LF:22
-LH:21
-BRF:10
-BRH:8
+DA:116,0
+FN:122,RuleWhitelistWrapper._contextSuffixLength
+FNDA:52,RuleWhitelistWrapper._contextSuffixLength
+DA:128,52
+FNF:6
+FNH:5
+LF:28
+LH:27
+BRF:9
+BRH:9
end_of_record
TN:
SF:src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol
-FN:44,RuleAddressList.addAddressesToTheList
+FN:27,RuleAddressList.
+FNDA:185,RuleAddressList.
+DA:31,185
+BRDA:31,0,0,1
+DA:32,1
+DA:34,184
+FN:42,RuleAddressList.addAddressesToTheList
FNDA:17,RuleAddressList.addAddressesToTheList
-DA:47,16
-DA:47,16
-FN:56,RuleAddressList.removeAddressesFromTheList
+DA:45,16
+DA:46,16
+FN:55,RuleAddressList.removeAddressesFromTheList
FNDA:4,RuleAddressList.removeAddressesFromTheList
-DA:59,3
+DA:58,3
DA:59,3
FN:67,RuleAddressList.addAddressToTheList
FNDA:52,RuleAddressList.addAddressToTheList
DA:70,51
-DA:70,51
-FN:79,RuleAddressList.removeAddressFromTheList
+DA:71,50
+FN:80,RuleAddressList.removeAddressFromTheList
FNDA:3,RuleAddressList.removeAddressFromTheList
-DA:82,2
-DA:82,2
-FN:90,RuleAddressList.numberListedAddress
+DA:83,2
+DA:84,1
+FN:92,RuleAddressList.numberListedAddress
FNDA:24,RuleAddressList.numberListedAddress
-DA:91,24
-DA:91,24
-DA:91,24
-FN:100,RuleAddressList.addressIsListed
-FNDA:86,RuleAddressList.addressIsListed
-DA:103,144
-DA:103,144
-DA:103,144
-FN:110,RuleAddressList.addressIsListedBatch
+DA:93,24
+FN:102,RuleAddressList.addressIsListed
+FNDA:95,RuleAddressList.addressIsListed
+DA:105,153
+FN:112,RuleAddressList.addressIsListedBatch
FNDA:28,RuleAddressList.addressIsListedBatch
-DA:113,28
-DA:113,28
-DA:113,28
-DA:114,28
-DA:114,28
-DA:114,83
-DA:114,55
-DA:115,55
-DA:115,55
-DA:117,28
-DA:117,28
-FN:127,RuleAddressList._msgSender
-FNDA:86,RuleAddressList._msgSender
-DA:133,86
-DA:133,86
-DA:133,86
-FN:139,RuleAddressList._msgData
+DA:115,28
+DA:116,28
+DA:117,55
+DA:119,28
+FN:126,RuleAddressList.hasRole
+FNDA:194,RuleAddressList.hasRole
+DA:131,280
+BRDA:131,1,0,78
+DA:132,78
+DA:134,202
+FN:144,RuleAddressList._msgSender
+FNDA:270,RuleAddressList._msgSender
+DA:150,270
+FN:156,RuleAddressList._msgData
FNDA:0,RuleAddressList._msgData
-DA:145,0
-DA:145,0
-DA:145,0
-FN:151,RuleAddressList._contextSuffixLength
-FNDA:86,RuleAddressList._contextSuffixLength
-DA:157,86
-DA:157,86
-DA:157,86
-FNF:10
-FNH:9
-LF:13
-LH:12
-BRF:0
-BRH:0
+DA:162,0
+FN:168,RuleAddressList._contextSuffixLength
+FNDA:270,RuleAddressList._contextSuffixLength
+DA:174,270
+FNF:12
+FNH:11
+LF:23
+LH:22
+BRF:2
+BRH:2
end_of_record
TN:
SF:src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol
FN:22,RuleAddressListInternal._addAddressesToThelist
FNDA:16,RuleAddressListInternal._addAddressesToThelist
-DA:23,16
-DA:23,16
-DA:24,16
-DA:24,16
-DA:24,50
-DA:24,34
-DA:25,34
-DA:25,34
-BRDA:25,0,0,-
-BRDA:25,0,1,32
-DA:26,32
-DA:26,32
-DA:27,32
-DA:27,32
-DA:30,16
-DA:30,16
-FN:39,RuleAddressListInternal._removeAddressesFromThelist
+DA:25,16
+DA:26,16
+DA:27,34
+BRDA:27,0,0,32
+DA:28,32
+DA:29,32
+DA:32,16
+FN:41,RuleAddressListInternal._removeAddressesFromThelist
FNDA:3,RuleAddressListInternal._removeAddressesFromThelist
-DA:42,3
-DA:42,3
-DA:43,3
-DA:43,3
-DA:43,10
-DA:43,7
-DA:44,7
-BRDA:44,1,0,-
-BRDA:44,1,1,6
-DA:45,6
-DA:45,6
+DA:44,3
+DA:45,3
DA:46,6
-DA:46,6
-DA:49,3
-DA:49,3
-FN:57,RuleAddressListInternal._addAddressToThelist
+BRDA:46,1,0,6
+DA:47,6
+DA:48,6
+DA:51,3
+FN:59,RuleAddressListInternal._addAddressToThelist
FNDA:51,RuleAddressListInternal._addAddressToThelist
-DA:58,51
-BRDA:58,2,0,1
-BRDA:58,2,1,50
-DA:59,1
-DA:59,1
-DA:61,50
-DA:61,50
-DA:62,50
-DA:62,50
-FN:71,RuleAddressListInternal._removeAddressFromThelist
+DA:60,1
+BRDA:60,2,0,1
+DA:61,1
+DA:63,50
+DA:64,50
+FN:73,RuleAddressListInternal._removeAddressFromThelist
FNDA:2,RuleAddressListInternal._removeAddressFromThelist
-DA:72,2
-DA:72,2
-BRDA:72,3,0,1
-BRDA:72,3,1,1
-DA:73,1
-DA:73,1
-DA:75,1
+DA:74,2
+BRDA:74,3,0,1
DA:75,1
-DA:76,1
-DA:76,1
-FN:84,RuleAddressListInternal._numberListedAddress
+DA:77,1
+DA:78,1
+FN:86,RuleAddressListInternal._numberListedAddress
FNDA:24,RuleAddressListInternal._numberListedAddress
-DA:85,24
-DA:85,24
-FN:94,RuleAddressListInternal._addressIsListed
-FNDA:199,RuleAddressListInternal._addressIsListed
-DA:97,199
-DA:97,199
+DA:87,24
+FN:96,RuleAddressListInternal._addressIsListed
+FNDA:208,RuleAddressListInternal._addressIsListed
+DA:99,208
FNF:6
FNH:6
LF:22
LH:22
-BRF:8
-BRH:6
+BRF:4
+BRH:4
end_of_record
TN:
SF:src/rules/validation/abstract/RuleValidateTransfer.sol
FN:15,RuleValidateTransfer.validateTransfer
-FNDA:7,RuleValidateTransfer.validateTransfer
-DA:21,7
-DA:21,7
-DA:22,7
-DA:22,7
-DA:22,7
-DA:23,7
-DA:23,7
+FNDA:26,RuleValidateTransfer.validateTransfer
+DA:21,26
+DA:22,26
FNF:1
FNH:1
-LF:3
-LH:3
+LF:2
+LH:2
BRF:0
BRH:0
end_of_record
TN:
SF:src/rules/validation/abstract/RuleWhitelistCommon.sol
-FN:16,RuleWhitelistCommon.canReturnTransferRestrictionCode
+FN:17,RuleWhitelistCommon.canReturnTransferRestrictionCode
FNDA:12,RuleWhitelistCommon.canReturnTransferRestrictionCode
-DA:19,12
-DA:19,12
-DA:20,12
DA:20,12
-DA:20,12
-DA:21,6
-DA:21,6
-FN:29,RuleWhitelistCommon.messageForTransferRestriction
+DA:21,12
+DA:22,6
+FN:30,RuleWhitelistCommon.messageForTransferRestriction
FNDA:10,RuleWhitelistCommon.messageForTransferRestriction
-DA:32,10
-DA:32,10
-BRDA:32,0,0,6
-BRDA:32,0,1,4
-DA:33,6
-DA:33,6
-DA:34,4
-DA:34,4
-BRDA:34,1,0,3
-BRDA:34,1,1,1
-DA:35,3
-DA:35,3
-DA:37,1
-DA:37,1
+DA:33,10
+BRDA:33,0,0,6
+BRDA:33,0,1,1
+DA:34,6
+DA:35,4
+BRDA:35,1,0,3
+BRDA:35,1,1,1
+DA:36,3
+DA:38,1
FNF:2
FNH:2
LF:8
@@ -1530,22 +1010,67 @@ BRF:4
BRH:4
end_of_record
TN:
+SF:test/HelperContract.sol
+FN:95,HelperContract.
+FNDA:0,HelperContract.
+FNF:1
+FNH:0
+LF:0
+LH:0
+BRF:0
+BRH:0
+end_of_record
+TN:
+SF:test/RuleConditionalTransfer/RuleCTDeployment.sol
+FN:13,RuleCTDeployment.
+FNDA:13,RuleCTDeployment.
+DA:14,13
+DA:19,13
+DA:24,13
+DA:28,13
+DA:33,13
+DA:39,13
+DA:44,13
+DA:45,13
+DA:51,13
+DA:52,13
+FNF:1
+FNH:1
+LF:10
+LH:10
+BRF:0
+BRH:0
+end_of_record
+TN:
+SF:test/utils/CMTATDeployment.sol
+FN:15,CMTATDeployment.
+FNDA:71,CMTATDeployment.
+DA:17,71
+DA:23,71
+DA:30,71
+DA:36,71
+FNF:1
+FNH:1
+LF:4
+LH:4
+BRF:0
+BRH:0
+end_of_record
+TN:
SF:test/utils/SanctionListOracle.sol
+FN:9,SanctionListOracle.
+FNDA:11,SanctionListOracle.
FN:13,SanctionListOracle.addToSanctionsList
FNDA:10,SanctionListOracle.addToSanctionsList
DA:14,10
-DA:14,10
FN:17,SanctionListOracle.removeFromSanctionsList
FNDA:0,SanctionListOracle.removeFromSanctionsList
DA:18,0
-DA:18,0
FN:21,SanctionListOracle.isSanctioned
FNDA:12,SanctionListOracle.isSanctioned
DA:22,12
-DA:22,12
-DA:22,12
-FNF:3
-FNH:2
+FNF:4
+FNH:3
LF:3
LH:2
BRF:0
diff --git a/doc/schema/RuleEngine.svg b/doc/schema/RuleEngine.svg
index 4750cf4..f597ee9 100644
--- a/doc/schema/RuleEngine.svg
+++ b/doc/schema/RuleEngine.svg
@@ -4,289 +4,593 @@
-
-
+
+
UmlClassDiagram
-
+
0
-
-RuleEngine
-src/RuleEngine.sol
-
-Internal:
- _msgSender(): (sender: address)
- _msgData(): bytes
- _contextSuffixLength(): uint256
-External:
- messageForTransferRestriction(_restrictionCode: uint8): string
- operateOnTransfer(from: address, to: address, amount: uint256): (isValid: bool) <<onlyRole>>
-Public:
- constructor(admin: address, forwarderIrrevocable: address, tokenContract: address)
- detectTransferRestriction(_from: address, _to: address, _amount: uint256): uint8
- validateTransfer(_from: address, _to: address, _amount: uint256): bool
-
-
-
-5
-
-<<Interface>>
-IRuleValidation
-src/interfaces/IRuleValidation.sol
-
-External:
- canReturnTransferRestrictionCode(_restrictionCode: uint8): bool
-
-
-
-0->5
-
-
-
-
-
-6
-
-<<Abstract>>
-MetaTxModuleStandalone
-src/modules/MetaTxModuleStandalone.sol
-
-Public:
- constructor(trustedForwarder: address)
-
-
-
-0->6
-
-
-
-
-
-8
-
-<<Abstract>>
-RuleEngineOperation
-src/modules/RuleEngineOperation.sol
-
-Internal:
- _rulesOperation: address[]
-
-Internal:
- _clearRulesOperation()
- _removeRuleOperation(rule_: address, index: uint256)
- _operateOnTransfer(_from: address, _to: address, _amount: uint256): (isValid: bool)
-External:
- rulesCountOperation(): uint256
- getRuleIndexOperation(rule_: IRuleOperation): (index: uint256)
- ruleOperation(ruleId: uint256): address
- rulesOperation(): address[]
-Public:
- setRulesOperation(rules_: address[]) <<onlyRole>>
- clearRulesOperation() <<onlyRole>>
- addRuleOperation(rule_: IRuleOperation) <<onlyRole>>
- removeRuleOperation(rule_: IRuleOperation, index: uint256) <<onlyRole>>
-
-
-
-0->8
-
-
-
-
-
-9
-
-<<Abstract>>
-RuleEngineValidation
-src/modules/RuleEngineValidation.sol
-
-Public:
- detectTransferRestrictionValidation(_from: address, _to: address, _amount: uint256): uint8
- validateTransferValidation(_from: address, _to: address, _amount: uint256): bool
-
-
-
-0->9
-
-
+
+<<Interface>>
+IERC1404
+RuleEngine.sol
+
+External:
+ detectTransferRestriction(_from: address, _to: address, _amount: uint256): uint8
+ messageForTransferRestriction(_restrictionCode: uint8): string
1
-
-<<Interface>>
-IRuleEngineOperation
-src/interfaces/IRuleEngineOperation.sol
-
-External:
- setRulesOperation(rules_: address[])
- rulesCountOperation(): uint256
- ruleOperation(ruleId: uint256): address
- rulesOperation(): address[]
+
+<<Interface>>
+IERC1404EnumCode
+RuleEngine.sol
2
-
-<<Interface>>
-IRuleEngineValidation
-src/interfaces/IRuleEngineValidation.sol
-
-External:
- detectTransferRestrictionValidation(_from: address, _to: address, _amount: uint256): uint8
- validateTransferValidation(_from: address, _to: address, _amount: uint256): (isValid: bool)
+
+<<Enum>>
+REJECTED_CODE_BASE
+RuleEngine.sol
+
+TRANSFER_OK: 0
+TRANSFER_REJECTED_PAUSED: 1
+TRANSFER_REJECTED_FROM_FROZEN: 2
+TRANSFER_REJECTED_TO_FROZEN: 3
+
+
+
+2->1
+
+
3
-
-<<Interface>>
-IRuleEngineValidationCommon
-src/interfaces/IRuleEngineValidation.sol
-
-External:
- setRulesValidation(rules_: address[])
- rulesCountValidation(): uint256
- ruleValidation(ruleId: uint256): address
- rulesValidation(): address[]
+
+<<Interface>>
+IAccessControl
+RuleEngine.sol
+
+External:
+ hasRole(role: bytes32, account: address): bool
+ getRoleAdmin(role: bytes32): bytes32
+ grantRole(role: bytes32, account: address)
+ revokeRole(role: bytes32, account: address)
+ renounceRole(role: bytes32, callerConfirmation: address)
+Public:
+ <<event>> RoleAdminChanged(role: bytes32, previousAdminRole: bytes32, newAdminRole: bytes32)
+ <<event>> RoleGranted(role: bytes32, account: address, sender: address)
+ <<event>> RoleRevoked(role: bytes32, account: address, sender: address)
4
-
-<<Interface>>
-IRuleOperation
-src/interfaces/IRuleOperation.sol
-
-External:
- operateOnTransfer(_from: address, _to: address, _amount: uint256): (isValid: bool)
+
+<<Abstract>>
+Context
+RuleEngine.sol
+
+Internal:
+ _msgSender(): address
+ _msgData(): bytes
+ _contextSuffixLength(): uint256
+
+
+
+5
+
+<<Interface>>
+IERC165
+RuleEngine.sol
+
+External:
+ supportsInterface(interfaceId: bytes4): bool
+
+
+
+6
+
+<<Interface>>
+IRuleEngineOperation
+RuleEngine.sol
+
+External:
+ setRulesOperation(rules_: address[])
+ rulesCountOperation(): uint256
+ ruleOperation(ruleId: uint256): address
+ rulesOperation(): address[]
7
-
-<<Abstract>>
-RuleEngineInvariantStorage
-src/modules/RuleEngineInvariantStorage.sol
-
-Public:
- RULE_ENGINE_OPERATOR_ROLE: bytes32
- TOKEN_CONTRACT_ROLE: bytes32
-
-Public:
- <<event>> AddRule(rule: address)
- <<event>> RemoveRule(rule: address)
- <<event>> ClearRules(rulesRemoved: address[])
-
-
-
-8->1
-
-
+
+<<Interface>>
+IRuleEngineValidation
+RuleEngine.sol
+
+External:
+ detectTransferRestrictionValidation(_from: address, _to: address, _amount: uint256): uint8
+ validateTransferValidation(_from: address, _to: address, _amount: uint256): (isValid: bool)
-
-
-8->4
-
-
+
+
+8
+
+<<Interface>>
+IRuleEngineValidationCommon
+RuleEngine.sol
+
+External:
+ setRulesValidation(rules_: address[])
+ rulesCountValidation(): uint256
+ ruleValidation(ruleId: uint256): address
+ rulesValidation(): address[]
+
+
+
+9
+
+<<Interface>>
+IRuleOperation
+RuleEngine.sol
+
+External:
+ operateOnTransfer(_from: address, _to: address, _amount: uint256): (isValid: bool)
+
+
+
+10
+
+<<Abstract>>
+RuleEngineInvariantStorage
+RuleEngine.sol
+
+Public:
+ RULE_ENGINE_OPERATOR_ROLE: bytes32
+ TOKEN_CONTRACT_ROLE: bytes32
+
+Public:
+ <<event>> AddRule(rule: address)
+ <<event>> RemoveRule(rule: address)
+ <<event>> ClearRules(rulesRemoved: address[])
11
-
-<<Abstract>>
-RuleInternal
-src/modules/RuleInternal.sol
-
-Public:
- _ruleIsPresent: mapping(address=>bool)
-
-Internal:
- _setRules(rules_: address[])
- _addRule(_rules: address[], rule_: address)
- _removeRule(_rules: address[], rule_: address, index: uint256)
- _getRuleIndex(_rules: address[], rule_: address): (index: uint256)
-
-
+
+<<Abstract>>
+ERC2771Context
+RuleEngine.sol
+
+Private:
+ _trustedForwarder: address
+
+Internal:
+ _msgSender(): address
+ _msgData(): bytes
+ _contextSuffixLength(): uint256
+Public:
+ constructor(trustedForwarder_: address)
+ trustedForwarder(): address
+ isTrustedForwarder(forwarder: address): bool
+
+
+
+11->4
+
+
+
+
+
+12
+
+<<Abstract>>
+ERC165
+RuleEngine.sol
+
+Public:
+ supportsInterface(interfaceId: bytes4): bool
+
+
+
+12->5
+
+
+
+
+
+13
+
+<<Abstract>>
+RuleInternal
+RuleEngine.sol
+
+Public:
+ _ruleIsPresent: mapping(address=>bool)
+
+Internal:
+ _setRules(rules_: address[])
+ _addRule(_rules: address[], rule_: address)
+ _removeRule(_rules: address[], rule_: address, index: uint256)
+ _getRuleIndex(_rules: address[], rule_: address): (index: uint256)
+
+
+
+13->10
+
+
+
+
+
+14
+
+<<Interface>>
+IERC1404Wrapper
+RuleEngine.sol
+
+External:
+ validateTransfer(_from: address, _to: address, _amount: uint256): (isValid: bool)
+
+
-8->11
-
-
+14->0
+
+
-
-
-9->2
-
-
+
+
+14->1
+
+
-
-
-9->5
-
-
+
+
+15
+
+<<Abstract>>
+MetaTxModuleStandalone
+RuleEngine.sol
+
+Public:
+ constructor(trustedForwarder: address)
-
-
-10
-
-<<Abstract>>
-RuleEngineValidationCommon
-src/modules/RuleEngineValidationCommon.sol
-
-Internal:
- _rulesValidation: address[]
-
-Internal:
- _clearRulesValidation()
- _removeRuleValidation(rule_: address, index: uint256)
-External:
- rulesCountValidation(): uint256
- getRuleIndexValidation(rule_: IRuleValidation): (index: uint256)
- ruleValidation(ruleId: uint256): address
- rulesValidation(): address[]
-Public:
- setRulesValidation(rules_: address[]) <<onlyRole>>
- clearRulesValidation() <<onlyRole>>
- addRuleValidation(rule_: IRuleValidation) <<onlyRole>>
- removeRuleValidation(rule_: IRuleValidation, index: uint256) <<onlyRole>>
-
-
-
-9->10
-
-
+
+
+15->11
+
+
+
+
+
+16
+
+<<Interface>>
+IRuleEngine
+RuleEngine.sol
+
+External:
+ operateOnTransfer(_from: address, _to: address, _amount: uint256): (isValid: bool)
-
+
-9->11
-
-
+16->14
+
+
+
+
+
+17
+
+<<Interface>>
+IRuleValidation
+RuleEngine.sol
+
+External:
+ canReturnTransferRestrictionCode(_restrictionCode: uint8): bool
-
+
+
+17->14
+
+
+
+
+
+18
+
+<<Abstract>>
+AccessControl
+RuleEngine.sol
+
+Private:
+ _roles: mapping(bytes32=>RoleData)
+Public:
+ DEFAULT_ADMIN_ROLE: bytes32
+
+Internal:
+ _checkRole(role: bytes32)
+ _checkRole(role: bytes32, account: address)
+ _setRoleAdmin(role: bytes32, adminRole: bytes32)
+ _grantRole(role: bytes32, account: address): bool
+ _revokeRole(role: bytes32, account: address): bool
+Public:
+ <<modifier>> onlyRole(role: bytes32)
+ supportsInterface(interfaceId: bytes4): bool
+ hasRole(role: bytes32, account: address): bool
+ getRoleAdmin(role: bytes32): bytes32
+ grantRole(role: bytes32, account: address) <<onlyRole>>
+ revokeRole(role: bytes32, account: address) <<onlyRole>>
+ renounceRole(role: bytes32, callerConfirmation: address)
+
+
+
+18->3
+
+
+
+
+
+18->4
+
+
+
+
-10->3
-
-
+18->12
+
+
+
+
+
+19
+
+<<Struct>>
+RoleData
+RuleEngine.sol
+
+hasRole: mapping(address=>bool)
+adminRole: bytes32
-
+
-10->5
-
-
+18->19
+
+
-
-
-10->11
-
-
+
+
+19->18
+
+
+
+
+
+20
+
+<<Abstract>>
+RuleEngineOperation
+RuleEngine.sol
+
+Internal:
+ _rulesOperation: address[]
+
+Internal:
+ _clearRulesOperation()
+ _removeRuleOperation(rule_: address, index: uint256)
+ _operateOnTransfer(_from: address, _to: address, _amount: uint256): (isValid: bool)
+External:
+ rulesCountOperation(): uint256
+ getRuleIndexOperation(rule_: IRuleOperation): (index: uint256)
+ ruleOperation(ruleId: uint256): address
+ rulesOperation(): address[]
+Public:
+ setRulesOperation(rules_: address[]) <<onlyRole>>
+ clearRulesOperation() <<onlyRole>>
+ addRuleOperation(rule_: IRuleOperation) <<onlyRole>>
+ removeRuleOperation(rule_: IRuleOperation, index: uint256) <<onlyRole>>
+
+
+
+20->6
+
+
-
+
+
+20->9
+
+
+
+
+
+20->13
+
+
+
+
-11->7
-
-
+20->18
+
+
+
+
+
+21
+
+<<Abstract>>
+RuleEngineValidationCommon
+RuleEngine.sol
+
+Internal:
+ _rulesValidation: address[]
+
+Internal:
+ _clearRulesValidation()
+ _removeRuleValidation(rule_: address, index: uint256)
+External:
+ rulesCountValidation(): uint256
+ getRuleIndexValidation(rule_: IRuleValidation): (index: uint256)
+ ruleValidation(ruleId: uint256): address
+ rulesValidation(): address[]
+Public:
+ setRulesValidation(rules_: address[]) <<onlyRole>>
+ clearRulesValidation() <<onlyRole>>
+ addRuleValidation(rule_: IRuleValidation) <<onlyRole>>
+ removeRuleValidation(rule_: IRuleValidation, index: uint256) <<onlyRole>>
+
+
+
+21->8
+
+
+
+
+
+21->13
+
+
+
+
+
+21->17
+
+
+
+
+
+21->18
+
+
+
+
+
+22
+
+<<Abstract>>
+RuleEngineValidation
+RuleEngine.sol
+
+Public:
+ detectTransferRestrictionValidation(_from: address, _to: address, _amount: uint256): uint8
+ validateTransferValidation(_from: address, _to: address, _amount: uint256): bool
+
+
+
+22->1
+
+
+
+
+
+22->2
+
+
+
+
+
+22->7
+
+
+
+
+
+22->13
+
+
+
+
+
+22->17
+
+
+
+
+
+22->18
+
+
+
+
+
+22->21
+
+
+
+
+
+23
+
+RuleEngine
+RuleEngine.sol
+
+Public:
+ VERSION: string
+
+Internal:
+ _msgSender(): (sender: address)
+ _msgData(): bytes
+ _contextSuffixLength(): uint256
+External:
+ messageForTransferRestriction(_restrictionCode: uint8): string
+ operateOnTransfer(from: address, to: address, amount: uint256): (isValid: bool) <<onlyRole>>
+Public:
+ constructor(admin: address, forwarderIrrevocable: address, tokenContract: address)
+ detectTransferRestriction(_from: address, _to: address, _amount: uint256): uint8
+ validateTransfer(_from: address, _to: address, _amount: uint256): bool
+ hasRole(role: bytes32, account: address): bool
+
+
+
+23->2
+
+
+
+
+
+23->11
+
+
+
+
+
+23->15
+
+
+
+
+
+23->16
+
+
+
+
+
+23->17
+
+
+
+
+
+23->18
+
+
+
+
+
+23->20
+
+
+
+
+
+23->22
+
+
diff --git a/doc/security/audits/archive/v1.0.2-slither-report.md b/doc/security/audits/archive/v1.0.2-slither-report.md
deleted file mode 100644
index 74c91fd..0000000
--- a/doc/security/audits/archive/v1.0.2-slither-report.md
+++ /dev/null
@@ -1,254 +0,0 @@
-Summary
- - [calls-loop](#calls-loop) (3 results) (Low)
- - [dead-code](#dead-code) (3 results) (Informational)
- - [solc-version](#solc-version) (5 results) (Informational)
- - [low-level-calls](#low-level-calls) (1 results) (Informational)
- - [naming-convention](#naming-convention) (18 results) (Informational)
- - [similar-names](#similar-names) (2 results) (Informational)
-## calls-loop
-
-> Remark:
->
-> - The RuleEngine is a trusted contract deployed by the issuer.
->
-> It is not a problem to perform external call to this contract
->
-> - When a ruleEngine is created, the issuer has indeed to keep in mind to limit the number of rules.
-
-Impact: Low
-Confidence: Medium
-
- - [ ] ID-0
-[RuleEngine.detectTransferRestriction(address,address,uint256)](src/RuleEngine.sol#L127-L146) has external calls inside a loop: [restriction = _rules[i].detectTransferRestriction(_from,_to,_amount)](src/RuleEngine.sol#L133-L137)
-
-src/RuleEngine.sol#L127-L146
-
-
- - [ ] ID-1
-[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L156-L169) has external calls inside a loop: [_rules[i].messageForTransferRestriction(_restrictionCode)](src/RuleEngine.sol#L161-L162)
-
-src/RuleEngine.sol#L156-L169
-
-
- - [ ] ID-2
-[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L156-L169) has external calls inside a loop: [_rules[i].canReturnTransferRestrictionCode(_restrictionCode)](src/RuleEngine.sol#L160)
-
-src/RuleEngine.sol#L156-L169
-
-
-## dead-code
-Impact: Informational
-Confidence: Medium
-
-> msgData:
->
-> - Implemented to be gasless compatible (see MetaTxModule)
->
-> - If we remove this function, we will have the following error:
->
-> "Derived contract must override function "_msgData". Two or more base classes define function with same name and parameter types."
-
- - [ ] ID-3
-[MetaTxModuleStandalone._msgData()](src/modules/MetaTxModuleStandalone.sol#L25-L33) is never used and should be removed
-
-src/modules/MetaTxModuleStandalone.sol#L25-L33
-
-
- - [ ] ID-4
-[RuleEngine._msgData()](src/RuleEngine.sol#L186-L193) is never used and should be removed
-
-src/RuleEngine.sol#L186-L193
-
-
- - [ ] ID-5
-[RuleWhitelist._msgData()](src/RuleWhiteList.sol#L191-L198) is never used and should be removed
-
-src/RuleWhiteList.sol#L191-L198
-
-
-## solc-version
-Impact: Informational
-Confidence: High
-
-> Remark:
->
-> Not necessary, the latest solidity version at the time of this release is the version 0.8.20.
-> The comment is good but we think that three versions backwards is enough.
-> It is not the best practice to use an outdated version because each version
-> fixes some bugs.
-
- - [ ] ID-6
-Pragma version[^0.8.17](script/RuleEngineScript.s.sol#L4) necessitates a version too recent to be trusted. Consider deploying with 0.6.12/0.7.6/0.8.16
-
-script/RuleEngineScript.s.sol#L4
-
-
- - [ ] ID-7
-solc-0.8.17 is not recommended for deployment
-
- - [ ] ID-8
-Pragma version[^0.8.17](src/RuleWhiteList.sol#L3) necessitates a version too recent to be trusted. Consider deploying with 0.6.12/0.7.6/0.8.16
-
-src/RuleWhiteList.sol#L3
-
-
- - [ ] ID-9
-Pragma version[^0.8.17](src/RuleEngine.sol#L3) necessitates a version too recent to be trusted. Consider deploying with 0.6.12/0.7.6/0.8.16
-
-src/RuleEngine.sol#L3
-
-
- - [ ] ID-10
-Pragma version[^0.8.17](src/modules/MetaTxModuleStandalone.sol#L3) necessitates a version too recent to be trusted. Consider deploying with 0.6.12/0.7.6/0.8.16
-
-src/modules/MetaTxModuleStandalone.sol#L3
-
-
-## low-level-calls
-Impact: Informational
-Confidence: High
-
-> The script is an example, it is not destined to be used for production
-
- - [ ] ID-11
- Low level call in [RuleEngineScript.run()](script/RuleEngineScript.s.sol#L15-L34):
- - [(success) = address(CMTAT_Address).call(abi.encodeCall(ValidationModule.setRuleEngine,RULE_ENGINE))](script/RuleEngineScript.s.sol#L29-L31)
-
-script/RuleEngineScript.s.sol#L15-L34
-
-
-## naming-convention
-Impact: Informational
-Confidence: High
-
-> Remark:
->
-> It is not really necessary to rename all the variables. It will generate a lot of work for a minor improvement.
-
- - [ ] ID-12
-Parameter [RuleWhitelist.addressIsWhitelisted(address)._targetAddress](src/RuleWhiteList.sol#L127) is not in mixedCase
-
-src/RuleWhiteList.sol#L127
-
-
- - [ ] ID-13
-Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._amount](src/RuleEngine.sol#L130) is not in mixedCase
-
-src/RuleEngine.sol#L130
-
-
- - [ ] ID-14
-Parameter [RuleWhitelist.removeAddressFromTheWhitelist(address)._removeWhitelistAddress](src/RuleWhiteList.sol#L101) is not in mixedCase
-
-src/RuleWhiteList.sol#L101
-
-
- - [ ] ID-15
-Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._to](src/RuleEngine.sol#L129) is not in mixedCase
-
-src/RuleEngine.sol#L129
-
-
- - [ ] ID-16
-Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._from](src/RuleEngine.sol#L128) is not in mixedCase
-
-src/RuleEngine.sol#L128
-
-
- - [ ] ID-17
-Variable [RuleEngine._rules](src/RuleEngine.sol#L17) is not in mixedCase
-
-src/RuleEngine.sol#L17
-
-
- - [ ] ID-18
-Parameter [RuleEngine.messageForTransferRestriction(uint8)._restrictionCode](src/RuleEngine.sol#L157) is not in mixedCase
-
-src/RuleEngine.sol#L157
-
-
- - [ ] ID-19
-Parameter [RuleWhitelist.validateTransfer(address,address,uint256)._to](src/RuleWhiteList.sol#L134) is not in mixedCase
-
-src/RuleWhiteList.sol#L134
-
-
- - [ ] ID-20
-Parameter [RuleWhitelist.canReturnTransferRestrictionCode(uint8)._restrictionCode](src/RuleWhiteList.sol#L157) is not in mixedCase
-
-src/RuleWhiteList.sol#L157
-
-
- - [ ] ID-21
-Parameter [RuleEngine.validateTransfer(address,address,uint256)._amount](src/RuleEngine.sol#L151) is not in mixedCase
-
-src/RuleEngine.sol#L151
-
-
- - [ ] ID-22
-Parameter [RuleWhitelist.detectTransferRestriction(address,address,uint256)._to](src/RuleWhiteList.sol#L144) is not in mixedCase
-
-src/RuleWhiteList.sol#L144
-
-
- - [ ] ID-23
-Parameter [RuleWhitelist.messageForTransferRestriction(uint8)._restrictionCode](src/RuleWhiteList.sol#L165) is not in mixedCase
-
-src/RuleWhiteList.sol#L165
-
-
- - [ ] ID-24
-Parameter [RuleWhitelist.detectTransferRestriction(address,address,uint256)._from](src/RuleWhiteList.sol#L143) is not in mixedCase
-
-src/RuleWhiteList.sol#L143
-
-
- - [ ] ID-25
-Parameter [RuleEngine.validateTransfer(address,address,uint256)._from](src/RuleEngine.sol#L149) is not in mixedCase
-
-src/RuleEngine.sol#L149
-
-
- - [ ] ID-26
-Parameter [RuleWhitelist.validateTransfer(address,address,uint256)._from](src/RuleWhiteList.sol#L133) is not in mixedCase
-
-src/RuleWhiteList.sol#L133
-
-
- - [ ] ID-27
-Parameter [RuleWhitelist.addAddressToTheWhitelist(address)._newWhitelistAddress](src/RuleWhiteList.sol#L85) is not in mixedCase
-
-src/RuleWhiteList.sol#L85
-
-
- - [ ] ID-28
-Parameter [RuleEngine.validateTransfer(address,address,uint256)._to](src/RuleEngine.sol#L150) is not in mixedCase
-
-src/RuleEngine.sol#L150
-
-
- - [ ] ID-29
-Parameter [RuleWhitelist.validateTransfer(address,address,uint256)._amount](src/RuleWhiteList.sol#L135) is not in mixedCase
-
-src/RuleWhiteList.sol#L135
-
-
-## similar-names
-Impact: Informational
-Confidence: Medium
-
-> True, but it is the goal to use similar name
->
-> The two variables define two similar things, but one for the text and the other for the code.
-
- - [ ] ID-30
-Variable [RuleWhitelist.CODE_ADDRESS_TO_NOT_WHITELISTED](src/RuleWhiteList.sol#L27) is too similar to [RuleWhitelist.TEXT_ADDRESS_TO_NOT_WHITELISTED](src/RuleWhiteList.sol#L21-L22)
-
-src/RuleWhiteList.sol#L27
-
-
- - [ ] ID-31
-Variable [RuleWhitelist.CODE_ADDRESS_FROM_NOT_WHITELISTED](src/RuleWhiteList.sol#L26) is too similar to [RuleWhitelist.TEXT_ADDRESS_FROM_NOT_WHITELISTED](src/RuleWhiteList.sol#L19-L20)
-
-src/RuleWhiteList.sol#L26
-
diff --git a/doc/security/audits/archive/v1.0.3-slither-report.md b/doc/security/audits/archive/v1.0.3-slither-report.md
deleted file mode 100644
index dc5009e..0000000
--- a/doc/security/audits/archive/v1.0.3-slither-report.md
+++ /dev/null
@@ -1,18 +0,0 @@
-**THIS CHECKLIST IS NOT COMPLETE**. Use `--show-ignored-findings` to show all the results.
-Summary
- - [solc-version](#solc-version) (1 results) (Informational)
-## solc-version
-
-> Remark:
->
-> Not necessary, the latest solidity version at the time of this release is the version 0.8.23.
-> The comment is good but we think that three versions backwards is enough.
-> It is not the best practice to use an outdated version because each version
-> fixes some bugs.
-
-Impact: Informational
-Confidence: High
-
- - [ ] ID-0
-solc-0.8.20 is not recommended for deployment
-
diff --git a/doc/security/audits/tools/slither-report.md b/doc/security/audits/tools/slither-report.md
index abfc923..fb021eb 100644
--- a/doc/security/audits/tools/slither-report.md
+++ b/doc/security/audits/tools/slither-report.md
@@ -6,7 +6,7 @@ Summary
- [costly-loop](#costly-loop) (2 results) (Informational)
- [dead-code](#dead-code) (5 results) (Informational)
- [solc-version](#solc-version) (1 results) (Informational)
- - [naming-convention](#naming-convention) (54 results) (Informational)
+ - [naming-convention](#naming-convention) (50 results) (Informational)
- [similar-names](#similar-names) (7 results) (Informational)
- [unused-import](#unused-import) (1 results) (Informational)
- [var-read-using-this](#var-read-using-this) (1 results) (Optimization)
@@ -17,31 +17,31 @@ Summary
Impact: Medium
Confidence: High
- [ ] ID-0
- [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)](src/rules/operation/RuleConditionalTransfer.sol#L194-L223) uses a dangerous strict equality:
- - [transferRequests[IdToKey[i]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L203)
+ [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)](src/rules/operation/RuleConditionalTransfer.sol#L177-L206) uses a dangerous strict equality:
+ - [transferRequests[IdToKey[i_scope_0]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L196)
-src/rules/operation/RuleConditionalTransfer.sol#L194-L223
+src/rules/operation/RuleConditionalTransfer.sol#L177-L206
- [ ] ID-1
- [RuleConditionalTransferOperator._checkRequestStatus(bytes32)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L367-L372) uses a dangerous strict equality:
- - [(transferRequests[key].status == STATUS.NONE) && (transferRequests[key].key == 0x0)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L369-L371)
+ [RuleConditionalTransfer._validateApproval(bytes32)](src/rules/operation/RuleConditionalTransfer.sol#L329-L349) uses a dangerous strict equality:
+ - [isTransferApproved = (transferRequests[key].status == STATUS.APPROVED) && (transferRequests[key].maxTime >= block.timestamp)](src/rules/operation/RuleConditionalTransfer.sol#L341-L343)
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L367-L372
+src/rules/operation/RuleConditionalTransfer.sol#L329-L349
- [ ] ID-2
- [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)](src/rules/operation/RuleConditionalTransfer.sol#L194-L223) uses a dangerous strict equality:
- - [transferRequests[IdToKey[i_scope_0]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L213)
+ [RuleConditionalTransferOperator._checkRequestStatus(bytes32)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L383-L388) uses a dangerous strict equality:
+ - [(transferRequests[key].status == STATUS.NONE) && (transferRequests[key].key == 0x0)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L385-L387)
-src/rules/operation/RuleConditionalTransfer.sol#L194-L223
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L383-L388
- [ ] ID-3
- [RuleConditionalTransfer._validateApproval(bytes32)](src/rules/operation/RuleConditionalTransfer.sol#L332-L351) uses a dangerous strict equality:
- - [isTransferApproved = (transferRequests[key].status == STATUS.APPROVED) && (transferRequests[key].maxTime >= block.timestamp)](src/rules/operation/RuleConditionalTransfer.sol#L343-L345)
+ [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)](src/rules/operation/RuleConditionalTransfer.sol#L177-L206) uses a dangerous strict equality:
+ - [transferRequests[IdToKey[i]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L186)
-src/rules/operation/RuleConditionalTransfer.sol#L332-L351
+src/rules/operation/RuleConditionalTransfer.sol#L177-L206
## calls-loop
@@ -49,53 +49,52 @@ src/rules/operation/RuleConditionalTransfer.sol#L332-L351
Impact: Low
Confidence: Medium
-
- [ ] ID-4
-[RuleEngineValidation.detectTransferRestrictionValidation(address,address,uint256)](src/modules/RuleEngineValidation.sol#L29-L44) has external calls inside a loop: [restriction = IRuleValidation(_rulesValidation[i]).detectTransferRestriction(_from,_to,_amount)](src/modules/RuleEngineValidation.sol#L36-L37)
+[RuleWhitelistWrapper.detectTransferRestriction(address,address,uint256)](src/rules/validation/RuleWhitelistWrapper.sol#L39-L74) has external calls inside a loop: [isListed = RuleAddressList(_rulesValidation[i]).addressIsListedBatch(targetAddress)](src/rules/validation/RuleWhitelistWrapper.sol#L53-L54)
-src/modules/RuleEngineValidation.sol#L29-L44
+src/rules/validation/RuleWhitelistWrapper.sol#L39-L74
- [ ] ID-5
-[RuleWhitelistWrapper.detectTransferRestriction(address,address,uint256)](src/rules/validation/RuleWhitelistWrapper.sol#L40-L75) has external calls inside a loop: [isListed = RuleAddressList(_rulesValidation[i]).addressIsListedBatch(targetAddress)](src/rules/validation/RuleWhitelistWrapper.sol#L54-L55)
+[RuleEngineValidation.detectTransferRestrictionValidation(address,address,uint256)](src/modules/RuleEngineValidation.sol#L29-L44) has external calls inside a loop: [restriction = IRuleValidation(_rulesValidation[i]).detectTransferRestriction(_from,_to,_amount)](src/modules/RuleEngineValidation.sol#L36-L37)
-src/rules/validation/RuleWhitelistWrapper.sol#L40-L75
+src/modules/RuleEngineValidation.sol#L29-L44
- [ ] ID-6
-[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L97-L125) has external calls inside a loop: [IRuleValidation(_rulesValidation[i]).canReturnTransferRestrictionCode(_restrictionCode)](src/RuleEngine.sol#L104-L105)
+[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L100-L128) has external calls inside a loop: [IRuleValidation(_rulesOperation[i_scope_0]).messageForTransferRestriction(_restrictionCode)](src/RuleEngine.sol#L122-L124)
-src/RuleEngine.sol#L97-L125
+src/RuleEngine.sol#L100-L128
- [ ] ID-7
-[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L97-L125) has external calls inside a loop: [IRuleValidation(_rulesOperation[i_scope_0]).canReturnTransferRestrictionCode(_restrictionCode)](src/RuleEngine.sol#L116-L117)
+[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L100-L128) has external calls inside a loop: [IRuleValidation(_rulesValidation[i]).canReturnTransferRestrictionCode(_restrictionCode)](src/RuleEngine.sol#L107-L108)
-src/RuleEngine.sol#L97-L125
+src/RuleEngine.sol#L100-L128
- [ ] ID-8
-[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L97-L125) has external calls inside a loop: [IRuleValidation(_rulesValidation[i]).messageForTransferRestriction(_restrictionCode)](src/RuleEngine.sol#L107-L109)
+[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L100-L128) has external calls inside a loop: [IRuleValidation(_rulesValidation[i]).messageForTransferRestriction(_restrictionCode)](src/RuleEngine.sol#L110-L112)
-src/RuleEngine.sol#L97-L125
+src/RuleEngine.sol#L100-L128
- [ ] ID-9
-[RuleEngine.detectTransferRestriction(address,address,uint256)](src/RuleEngine.sol#L47-L73) has external calls inside a loop: [restriction = IRuleValidation(_rulesOperation[i]).detectTransferRestriction(_from,_to,_amount)](src/RuleEngine.sol#L65-L66)
+[RuleConditionalTransferOperator._approveRequest(RuleConditionalTransferInvariantStorage.TransferRequest,bool)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L390-L449) has external calls inside a loop: [options.automaticTransfer.cmtat.allowance(transferRequest.keyElement.from,address(this)) >= transferRequest.keyElement.value](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L426-L429)
-src/RuleEngine.sol#L47-L73
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L390-L449
- [ ] ID-10
-[RuleConditionalTransferOperator._approveRequest(RuleConditionalTransferInvariantStorage.TransferRequest,bool)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L374-L433) has external calls inside a loop: [options.automaticTransfer.cmtat.allowance(transferRequest.keyElement.from,address(this)) >= transferRequest.keyElement.value](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L410-L413)
+[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L100-L128) has external calls inside a loop: [IRuleValidation(_rulesOperation[i_scope_0]).canReturnTransferRestrictionCode(_restrictionCode)](src/RuleEngine.sol#L119-L120)
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L374-L433
+src/RuleEngine.sol#L100-L128
- [ ] ID-11
-[RuleEngine.messageForTransferRestriction(uint8)](src/RuleEngine.sol#L97-L125) has external calls inside a loop: [IRuleValidation(_rulesOperation[i_scope_0]).messageForTransferRestriction(_restrictionCode)](src/RuleEngine.sol#L119-L121)
+[RuleEngine.detectTransferRestriction(address,address,uint256)](src/RuleEngine.sol#L50-L76) has external calls inside a loop: [restriction = IRuleValidation(_rulesOperation[i]).detectTransferRestriction(_from,_to,_amount)](src/RuleEngine.sol#L68-L69)
-src/RuleEngine.sol#L97-L125
+src/RuleEngine.sol#L50-L76
## timestamp
@@ -104,52 +103,55 @@ src/RuleEngine.sol#L97-L125
> With the Proof Of Stake, a new block is created every 12 seconds
>
> In all cases, we are not looking for such precision
+>
+> btw, ID-13 and ID-15 don't use timestamp in their comparison
Impact: Low
Confidence: Medium
+
- [ ] ID-12
- [RuleConditionalTransferOperator._checkRequestStatus(bytes32)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L367-L372) uses timestamp for comparisons
+ [RuleConditionalTransfer._validateApproval(bytes32)](src/rules/operation/RuleConditionalTransfer.sol#L329-L349) uses timestamp for comparisons
Dangerous comparisons:
- - [(transferRequests[key].status == STATUS.NONE) && (transferRequests[key].key == 0x0)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L369-L371)
+ - [automaticApprovalCondition = options.automaticApproval.isActivate && block.timestamp >= (transferRequests[key].askTime + options.automaticApproval.timeLimitBeforeAutomaticApproval)](src/rules/operation/RuleConditionalTransfer.sol#L334-L339)
+ - [isTransferApproved = (transferRequests[key].status == STATUS.APPROVED) && (transferRequests[key].maxTime >= block.timestamp)](src/rules/operation/RuleConditionalTransfer.sol#L341-L343)
+ - [automaticApprovalCondition || isTransferApproved](src/rules/operation/RuleConditionalTransfer.sol#L344)
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L367-L372
+src/rules/operation/RuleConditionalTransfer.sol#L329-L349
- [ ] ID-13
- [RuleConditionalTransfer._validateApproval(bytes32)](src/rules/operation/RuleConditionalTransfer.sol#L332-L351) uses timestamp for comparisons
+ [RuleConditionalTransferOperator._checkRequestStatus(bytes32)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L383-L388) uses timestamp for comparisons
Dangerous comparisons:
- - [automaticApprovalCondition = options.automaticApproval.isActivate && ((transferRequests[key].askTime + options.automaticApproval.timeLimitBeforeAutomaticApproval) >= block.timestamp)](src/rules/operation/RuleConditionalTransfer.sol#L336-L341)
- - [isTransferApproved = (transferRequests[key].status == STATUS.APPROVED) && (transferRequests[key].maxTime >= block.timestamp)](src/rules/operation/RuleConditionalTransfer.sol#L343-L345)
- - [automaticApprovalCondition || isTransferApproved](src/rules/operation/RuleConditionalTransfer.sol#L346)
+ - [(transferRequests[key].status == STATUS.NONE) && (transferRequests[key].key == 0x0)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L385-L387)
-src/rules/operation/RuleConditionalTransfer.sol#L332-L351
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L383-L388
- [ ] ID-14
- [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)](src/rules/operation/RuleConditionalTransfer.sol#L194-L223) uses timestamp for comparisons
+ [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)](src/rules/operation/RuleConditionalTransfer.sol#L177-L206) uses timestamp for comparisons
Dangerous comparisons:
- - [transferRequests[IdToKey[i]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L203)
- - [transferRequests[IdToKey[i_scope_0]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L213)
+ - [transferRequests[IdToKey[i]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L186)
+ - [transferRequests[IdToKey[i_scope_0]].status == _targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L196)
-src/rules/operation/RuleConditionalTransfer.sol#L194-L223
+src/rules/operation/RuleConditionalTransfer.sol#L177-L206
- [ ] ID-15
- [RuleConditionalTransferOperator._approveRequest(RuleConditionalTransferInvariantStorage.TransferRequest,bool)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L374-L433) uses timestamp for comparisons
+ [RuleConditionalTransfer._cancelTransferRequest(uint256)](src/rules/operation/RuleConditionalTransfer.sol#L281-L298) uses timestamp for comparisons
Dangerous comparisons:
- - [transferRequest.status != STATUS.WAIT](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L379)
- - [block.timestamp > (transferRequest.askTime + options.timeLimit.timeLimitToApprove)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L385-L386)
- - [options.automaticTransfer.cmtat.allowance(transferRequest.keyElement.from,address(this)) >= transferRequest.keyElement.value](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L410-L413)
+ - [transferRequests[key].keyElement.from != _msgSender()](src/rules/operation/RuleConditionalTransfer.sol#L287)
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L374-L433
+src/rules/operation/RuleConditionalTransfer.sol#L281-L298
- [ ] ID-16
- [RuleConditionalTransfer._cancelTransferRequest(uint256)](src/rules/operation/RuleConditionalTransfer.sol#L284-L301) uses timestamp for comparisons
+ [RuleConditionalTransferOperator._approveRequest(RuleConditionalTransferInvariantStorage.TransferRequest,bool)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L390-L449) uses timestamp for comparisons
Dangerous comparisons:
- - [transferRequests[key].keyElement.from != _msgSender()](src/rules/operation/RuleConditionalTransfer.sol#L290)
+ - [transferRequest.status != STATUS.WAIT](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L395)
+ - [block.timestamp > (transferRequest.askTime + options.timeLimit.timeLimitToApprove)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L401-L402)
+ - [options.automaticTransfer.cmtat.allowance(transferRequest.keyElement.from,address(this)) >= transferRequest.keyElement.value](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L426-L429)
-src/rules/operation/RuleConditionalTransfer.sol#L284-L301
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L390-L449
## costly-loop
@@ -158,17 +160,17 @@ src/rules/operation/RuleConditionalTransfer.sol#L284-L301
Impact: Informational
Confidence: Medium
- [ ] ID-17
- [RuleConditionalTransferOperator._createTransferRequestWithApproval(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L311-L354) has costly operations inside a loop:
- - [++ requestId](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L339)
+ [RuleConditionalTransfer.createTransferRequest(address,uint256)](src/rules/operation/RuleConditionalTransfer.sol#L79-L118) has costly operations inside a loop:
+ - [++ requestId](src/rules/operation/RuleConditionalTransfer.sol#L105)
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L311-L354
+src/rules/operation/RuleConditionalTransfer.sol#L79-L118
- [ ] ID-18
- [RuleConditionalTransfer.createTransferRequest(address,uint256)](src/rules/operation/RuleConditionalTransfer.sol#L96-L135) has costly operations inside a loop:
- - [++ requestId](src/rules/operation/RuleConditionalTransfer.sol#L122)
+ [RuleConditionalTransferOperator._createTransferRequestWithApproval(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L325-L370) has costly operations inside a loop:
+ - [++ requestId](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L354)
-src/rules/operation/RuleConditionalTransfer.sol#L96-L135
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L325-L370
## dead-code
@@ -180,41 +182,43 @@ src/rules/operation/RuleConditionalTransfer.sol#L96-L135
Impact: Informational
Confidence: Medium
+
- [ ] ID-19
-[RuleSanctionList._msgData()](src/rules/validation/RuleSanctionList.sol#L114-L121) is never used and should be removed
+[RuleSanctionList._msgData()](src/rules/validation/RuleSanctionList.sol#L145-L152) is never used and should be removed
-src/rules/validation/RuleSanctionList.sol#L114-L121
+src/rules/validation/RuleSanctionList.sol#L145-L152
- [ ] ID-20
-[RuleAddressList._msgData()](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L135-L142) is never used and should be removed
+[RuleAddressList._msgData()](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L156-L163) is never used and should be removed
-src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L135-L142
+src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L156-L163
- [ ] ID-21
-[RuleWhitelistWrapper._msgData()](src/rules/validation/RuleWhitelistWrapper.sol#L92-L99) is never used and should be removed
+[RuleWhitelistWrapper._msgData()](src/rules/validation/RuleWhitelistWrapper.sol#L110-L117) is never used and should be removed
-src/rules/validation/RuleWhitelistWrapper.sol#L92-L99
+src/rules/validation/RuleWhitelistWrapper.sol#L110-L117
- [ ] ID-22
-[RuleConditionalTransfer._msgData()](src/rules/operation/RuleConditionalTransfer.sol#L368-L375) is never used and should be removed
+[RuleConditionalTransfer._msgData()](src/rules/operation/RuleConditionalTransfer.sol#L370-L377) is never used and should be removed
-src/rules/operation/RuleConditionalTransfer.sol#L368-L375
+src/rules/operation/RuleConditionalTransfer.sol#L370-L377
- [ ] ID-23
-[RuleEngine._msgData()](src/RuleEngine.sol#L160-L167) is never used and should be removed
+[RuleEngine._msgData()](src/RuleEngine.sol#L182-L189) is never used and should be removed
-src/RuleEngine.sol#L160-L167
+src/RuleEngine.sol#L182-L189
## solc-version
-> The version set in the config file is 0.8.26
+> The version set in the config file is 0.8.27
Impact: Informational
Confidence: High
+
- [ ] ID-24
Version constraint ^0.8.20 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- VerbatimInvalidDeduplication
@@ -264,24 +268,28 @@ Confidence: High
- src/rules/validation/abstract/RuleWhitelistCommon.sol#3
## naming-convention
+
+> Acknowledge
+
Impact: Informational
Confidence: High
+
- [ ] ID-25
-Event [RuleConditionalTransferInvariantStorage.transferDenied(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L125-L131) is not in CapWords
+Event [RuleConditionalTransferInvariantStorage.transferDenied(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L124-L130) is not in CapWords
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L125-L131
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L124-L130
- [ ] ID-26
-Parameter [RuleConditionalTransfer.operateOnTransfer(address,address,uint256)._amount](src/rules/operation/RuleConditionalTransfer.sol#L61) is not in mixedCase
+Parameter [RuleConditionalTransfer.operateOnTransfer(address,address,uint256)._amount](src/rules/operation/RuleConditionalTransfer.sol#L54) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L61
+src/rules/operation/RuleConditionalTransfer.sol#L54
- [ ] ID-27
-Parameter [RuleWhitelistCommon.canReturnTransferRestrictionCode(uint8)._restrictionCode](src/rules/validation/abstract/RuleWhitelistCommon.sol#L17) is not in mixedCase
+Parameter [RuleWhitelistCommon.canReturnTransferRestrictionCode(uint8)._restrictionCode](src/rules/validation/abstract/RuleWhitelistCommon.sol#L18) is not in mixedCase
-src/rules/validation/abstract/RuleWhitelistCommon.sol#L17
+src/rules/validation/abstract/RuleWhitelistCommon.sol#L18
- [ ] ID-28
@@ -291,15 +299,15 @@ src/rules/validation/abstract/RuleValidateTransfer.sol#L16
- [ ] ID-29
-Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._amount](src/RuleEngine.sol#L50) is not in mixedCase
+Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._amount](src/RuleEngine.sol#L53) is not in mixedCase
-src/RuleEngine.sol#L50
+src/RuleEngine.sol#L53
- [ ] ID-30
-Event [RuleConditionalTransferInvariantStorage.transferReset(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L132-L138) is not in CapWords
+Event [RuleConditionalTransferInvariantStorage.transferReset(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L131-L137) is not in CapWords
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L132-L138
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L131-L137
- [ ] ID-31
@@ -315,21 +323,21 @@ src/rules/validation/RuleBlacklist.sol#L53
- [ ] ID-33
-Parameter [RuleWhitelistCommon.messageForTransferRestriction(uint8)._restrictionCode](src/rules/validation/abstract/RuleWhitelistCommon.sol#L30) is not in mixedCase
+Parameter [RuleWhitelistCommon.messageForTransferRestriction(uint8)._restrictionCode](src/rules/validation/abstract/RuleWhitelistCommon.sol#L31) is not in mixedCase
-src/rules/validation/abstract/RuleWhitelistCommon.sol#L30
+src/rules/validation/abstract/RuleWhitelistCommon.sol#L31
- [ ] ID-34
-Variable [RuleConditionalTransferOperator.IdToKey](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L22) is not in mixedCase
+Variable [RuleConditionalTransferOperator.IdToKey](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L21) is not in mixedCase
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L22
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L21
- [ ] ID-35
-Parameter [RuleSanctionList.detectTransferRestriction(address,address,uint256)._to](src/rules/validation/RuleSanctionList.sol#L56) is not in mixedCase
+Parameter [RuleSanctionList.detectTransferRestriction(address,address,uint256)._to](src/rules/validation/RuleSanctionList.sol#L59) is not in mixedCase
-src/rules/validation/RuleSanctionList.sol#L56
+src/rules/validation/RuleSanctionList.sol#L59
- [ ] ID-36
@@ -339,39 +347,39 @@ src/rules/validation/RuleBlacklist.sol#L35
- [ ] ID-37
-Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._to](src/RuleEngine.sol#L49) is not in mixedCase
+Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._to](src/RuleEngine.sol#L52) is not in mixedCase
-src/RuleEngine.sol#L49
+src/RuleEngine.sol#L52
- [ ] ID-38
-Parameter [RuleConditionalTransfer.detectTransferRestriction(address,address,uint256)._amount](src/rules/operation/RuleConditionalTransfer.sol#L234) is not in mixedCase
+Parameter [RuleConditionalTransfer.detectTransferRestriction(address,address,uint256)._amount](src/rules/operation/RuleConditionalTransfer.sol#L217) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L234
+src/rules/operation/RuleConditionalTransfer.sol#L217
- [ ] ID-39
-Parameter [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)._targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L195) is not in mixedCase
+Parameter [RuleConditionalTransfer.getRequestByStatus(RuleConditionalTransferInvariantStorage.STATUS)._targetStatus](src/rules/operation/RuleConditionalTransfer.sol#L178) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L195
+src/rules/operation/RuleConditionalTransfer.sol#L178
- [ ] ID-40
-Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._from](src/RuleEngine.sol#L48) is not in mixedCase
+Parameter [RuleEngine.detectTransferRestriction(address,address,uint256)._from](src/RuleEngine.sol#L51) is not in mixedCase
-src/RuleEngine.sol#L48
+src/RuleEngine.sol#L51
- [ ] ID-41
-Parameter [RuleWhitelistWrapper.detectTransferRestriction(address,address,uint256)._to](src/rules/validation/RuleWhitelistWrapper.sol#L42) is not in mixedCase
+Parameter [RuleWhitelistWrapper.detectTransferRestriction(address,address,uint256)._to](src/rules/validation/RuleWhitelistWrapper.sol#L41) is not in mixedCase
-src/rules/validation/RuleWhitelistWrapper.sol#L42
+src/rules/validation/RuleWhitelistWrapper.sol#L41
- [ ] ID-42
-Parameter [RuleConditionalTransfer.operateOnTransfer(address,address,uint256)._from](src/rules/operation/RuleConditionalTransfer.sol#L59) is not in mixedCase
+Parameter [RuleConditionalTransfer.operateOnTransfer(address,address,uint256)._from](src/rules/operation/RuleConditionalTransfer.sol#L52) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L59
+src/rules/operation/RuleConditionalTransfer.sol#L52
- [ ] ID-43
@@ -381,271 +389,254 @@ src/rules/validation/RuleBlacklist.sol#L66
- [ ] ID-44
-Parameter [RuleEngine.messageForTransferRestriction(uint8)._restrictionCode](src/RuleEngine.sol#L98) is not in mixedCase
+Parameter [RuleEngine.messageForTransferRestriction(uint8)._restrictionCode](src/RuleEngine.sol#L101) is not in mixedCase
-src/RuleEngine.sol#L98
+src/RuleEngine.sol#L101
- [ ] ID-45
-Parameter [RuleAddressList.removeAddressFromTheList(address)._removeWhitelistAddress](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L80) is not in mixedCase
+Parameter [RuleSanctionList.canReturnTransferRestrictionCode(uint8)._restrictionCode](src/rules/validation/RuleSanctionList.sol#L78) is not in mixedCase
-src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L80
+src/rules/validation/RuleSanctionList.sol#L78
- [ ] ID-46
-Parameter [RuleSanctionList.canReturnTransferRestrictionCode(uint8)._restrictionCode](src/rules/validation/RuleSanctionList.sol#L75) is not in mixedCase
+Parameter [RuleAddressList.addressIsListed(address)._targetAddress](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L103) is not in mixedCase
-src/rules/validation/RuleSanctionList.sol#L75
+src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L103
- [ ] ID-47
-Parameter [RuleAddressList.addressIsListed(address)._targetAddress](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L101) is not in mixedCase
+Parameter [RuleEngineValidation.validateTransferValidation(address,address,uint256)._to](src/modules/RuleEngineValidation.sol#L55) is not in mixedCase
-src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L101
+src/modules/RuleEngineValidation.sol#L55
- [ ] ID-48
-Parameter [RuleEngineValidation.validateTransferValidation(address,address,uint256)._to](src/modules/RuleEngineValidation.sol#L55) is not in mixedCase
+Event [RuleConditionalTransferInvariantStorage.transferWaiting(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L110-L116) is not in CapWords
-src/modules/RuleEngineValidation.sol#L55
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L110-L116
- [ ] ID-49
-Event [RuleConditionalTransferInvariantStorage.transferWaiting(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L111-L117) is not in CapWords
+Struct [RuleConditionalTransferInvariantStorage.TIME_LIMIT](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L30-L35) is not in CapWords
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L111-L117
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L30-L35
- [ ] ID-50
-Struct [RuleConditionalTransferInvariantStorage.TIME_LIMIT](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L30-L35) is not in CapWords
+Parameter [RuleConditionalTransfer.canReturnTransferRestrictionCode(uint8)._restrictionCode](src/rules/operation/RuleConditionalTransfer.sol#L237) is not in mixedCase
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L30-L35
+src/rules/operation/RuleConditionalTransfer.sol#L237
- [ ] ID-51
-Parameter [RuleConditionalTransfer.canReturnTransferRestrictionCode(uint8)._restrictionCode](src/rules/operation/RuleConditionalTransfer.sol#L259) is not in mixedCase
+Parameter [RuleEngine.validateTransfer(address,address,uint256)._amount](src/RuleEngine.sol#L88) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L259
+src/RuleEngine.sol#L88
- [ ] ID-52
-Parameter [RuleEngine.validateTransfer(address,address,uint256)._amount](src/RuleEngine.sol#L85) is not in mixedCase
+Struct [RuleConditionalTransferInvariantStorage.AUTOMATIC_APPROVAL](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L37-L44) is not in CapWords
-src/RuleEngine.sol#L85
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L37-L44
- [ ] ID-53
-Struct [RuleConditionalTransferInvariantStorage.AUTOMATIC_APPROVAL](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L37-L44) is not in CapWords
+Parameter [RuleEngineValidation.validateTransferValidation(address,address,uint256)._from](src/modules/RuleEngineValidation.sol#L54) is not in mixedCase
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L37-L44
+src/modules/RuleEngineValidation.sol#L54
- [ ] ID-54
-Parameter [RuleEngineValidation.validateTransferValidation(address,address,uint256)._from](src/modules/RuleEngineValidation.sol#L54) is not in mixedCase
+Parameter [RuleSanctionList.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleSanctionList.sol#L58) is not in mixedCase
-src/modules/RuleEngineValidation.sol#L54
+src/rules/validation/RuleSanctionList.sol#L58
- [ ] ID-55
-Parameter [RuleSanctionList.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleSanctionList.sol#L55) is not in mixedCase
+Parameter [RuleConditionalTransfer.detectTransferRestriction(address,address,uint256)._to](src/rules/operation/RuleConditionalTransfer.sol#L216) is not in mixedCase
-src/rules/validation/RuleSanctionList.sol#L55
+src/rules/operation/RuleConditionalTransfer.sol#L216
- [ ] ID-56
-Parameter [RuleConditionalTransfer.detectTransferRestriction(address,address,uint256)._to](src/rules/operation/RuleConditionalTransfer.sol#L233) is not in mixedCase
+Parameter [RuleEngineValidation.detectTransferRestrictionValidation(address,address,uint256)._from](src/modules/RuleEngineValidation.sol#L30) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L233
+src/modules/RuleEngineValidation.sol#L30
- [ ] ID-57
-Parameter [RuleEngineValidation.detectTransferRestrictionValidation(address,address,uint256)._from](src/modules/RuleEngineValidation.sol#L30) is not in mixedCase
+Parameter [RuleEngineValidation.validateTransferValidation(address,address,uint256)._amount](src/modules/RuleEngineValidation.sol#L56) is not in mixedCase
-src/modules/RuleEngineValidation.sol#L30
+src/modules/RuleEngineValidation.sol#L56
- [ ] ID-58
-Parameter [RuleEngineValidation.validateTransferValidation(address,address,uint256)._amount](src/modules/RuleEngineValidation.sol#L56) is not in mixedCase
+Parameter [RuleWhitelistWrapper.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleWhitelistWrapper.sol#L40) is not in mixedCase
-src/modules/RuleEngineValidation.sol#L56
+src/rules/validation/RuleWhitelistWrapper.sol#L40
- [ ] ID-59
-Parameter [RuleWhitelistWrapper.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleWhitelistWrapper.sol#L41) is not in mixedCase
+Parameter [RuleWhitelist.detectTransferRestriction(address,address,uint256)._to](src/rules/validation/RuleWhitelist.sol#L29) is not in mixedCase
-src/rules/validation/RuleWhitelistWrapper.sol#L41
+src/rules/validation/RuleWhitelist.sol#L29
- [ ] ID-60
-Parameter [RuleWhitelist.detectTransferRestriction(address,address,uint256)._to](src/rules/validation/RuleWhitelist.sol#L30) is not in mixedCase
+Struct [RuleConditionalTransferInvariantStorage.AUTOMATIC_TRANSFER](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L18-L21) is not in CapWords
-src/rules/validation/RuleWhitelist.sol#L30
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L18-L21
- [ ] ID-61
-Struct [RuleConditionalTransferInvariantStorage.AUTOMATIC_TRANSFER](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L18-L21) is not in CapWords
+Parameter [RuleValidateTransfer.validateTransfer(address,address,uint256)._to](src/rules/validation/abstract/RuleValidateTransfer.sol#L17) is not in mixedCase
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L18-L21
+src/rules/validation/abstract/RuleValidateTransfer.sol#L17
- [ ] ID-62
-Parameter [RuleValidateTransfer.validateTransfer(address,address,uint256)._to](src/rules/validation/abstract/RuleValidateTransfer.sol#L17) is not in mixedCase
+Event [RuleConditionalTransferInvariantStorage.transferProcessed(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L103-L109) is not in CapWords
-src/rules/validation/abstract/RuleValidateTransfer.sol#L17
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L103-L109
- [ ] ID-63
-Parameter [RuleInternal.getRuleIndex(address[],address)._rules](src/modules/RuleInternal.sol#L85) is not in mixedCase
+Parameter [RuleWhitelist.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleWhitelist.sol#L28) is not in mixedCase
-src/modules/RuleInternal.sol#L85
+src/rules/validation/RuleWhitelist.sol#L28
- [ ] ID-64
-Function [RuleConditionalTransferOperator._createTransferRequestWithApproval(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement)](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L311-L354) is not in mixedCase
+Parameter [RuleValidateTransfer.validateTransfer(address,address,uint256)._amount](src/rules/validation/abstract/RuleValidateTransfer.sol#L18) is not in mixedCase
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L311-L354
+src/rules/validation/abstract/RuleValidateTransfer.sol#L18
- [ ] ID-65
-Parameter [RuleAddressList.addAddressToTheList(address)._newWhitelistAddress](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L68) is not in mixedCase
+Parameter [RuleEngine.validateTransfer(address,address,uint256)._from](src/RuleEngine.sol#L86) is not in mixedCase
-src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L68
+src/RuleEngine.sol#L86
- [ ] ID-66
-Event [RuleConditionalTransferInvariantStorage.transferProcessed(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L104-L110) is not in CapWords
+Parameter [RuleConditionalTransfer.operateOnTransfer(address,address,uint256)._to](src/rules/operation/RuleConditionalTransfer.sol#L53) is not in mixedCase
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L104-L110
+src/rules/operation/RuleConditionalTransfer.sol#L53
- [ ] ID-67
-Parameter [RuleWhitelist.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleWhitelist.sol#L29) is not in mixedCase
+Parameter [RuleConditionalTransfer.detectTransferRestriction(address,address,uint256)._from](src/rules/operation/RuleConditionalTransfer.sol#L215) is not in mixedCase
-src/rules/validation/RuleWhitelist.sol#L29
+src/rules/operation/RuleConditionalTransfer.sol#L215
- [ ] ID-68
-Parameter [RuleValidateTransfer.validateTransfer(address,address,uint256)._amount](src/rules/validation/abstract/RuleValidateTransfer.sol#L18) is not in mixedCase
+Parameter [RuleEngineValidation.detectTransferRestrictionValidation(address,address,uint256)._to](src/modules/RuleEngineValidation.sol#L31) is not in mixedCase
-src/rules/validation/abstract/RuleValidateTransfer.sol#L18
+src/modules/RuleEngineValidation.sol#L31
- [ ] ID-69
-Parameter [RuleEngine.validateTransfer(address,address,uint256)._from](src/RuleEngine.sol#L83) is not in mixedCase
+Parameter [RuleBlacklist.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleBlacklist.sol#L34) is not in mixedCase
-src/RuleEngine.sol#L83
+src/rules/validation/RuleBlacklist.sol#L34
- [ ] ID-70
-Parameter [RuleConditionalTransfer.operateOnTransfer(address,address,uint256)._to](src/rules/operation/RuleConditionalTransfer.sol#L60) is not in mixedCase
+Parameter [RuleConditionalTransfer.messageForTransferRestriction(uint8)._restrictionCode](src/rules/operation/RuleConditionalTransfer.sol#L248) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L60
+src/rules/operation/RuleConditionalTransfer.sol#L248
- [ ] ID-71
-Parameter [RuleConditionalTransfer.detectTransferRestriction(address,address,uint256)._from](src/rules/operation/RuleConditionalTransfer.sol#L232) is not in mixedCase
+Parameter [RuleSanctionList.messageForTransferRestriction(uint8)._restrictionCode](src/rules/validation/RuleSanctionList.sol#L91) is not in mixedCase
-src/rules/operation/RuleConditionalTransfer.sol#L232
+src/rules/validation/RuleSanctionList.sol#L91
- [ ] ID-72
-Parameter [RuleEngineValidation.detectTransferRestrictionValidation(address,address,uint256)._to](src/modules/RuleEngineValidation.sol#L31) is not in mixedCase
+Parameter [RuleAddressList.addressIsListedBatch(address[])._targetAddresses](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L113) is not in mixedCase
-src/modules/RuleEngineValidation.sol#L31
+src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L113
- [ ] ID-73
-Parameter [RuleBlacklist.detectTransferRestriction(address,address,uint256)._from](src/rules/validation/RuleBlacklist.sol#L34) is not in mixedCase
+Parameter [RuleEngine.validateTransfer(address,address,uint256)._to](src/RuleEngine.sol#L87) is not in mixedCase
-src/rules/validation/RuleBlacklist.sol#L34
+src/RuleEngine.sol#L87
- [ ] ID-74
-Parameter [RuleConditionalTransfer.messageForTransferRestriction(uint8)._restrictionCode](src/rules/operation/RuleConditionalTransfer.sol#L270) is not in mixedCase
+Event [RuleConditionalTransferInvariantStorage.transferApproved(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L117-L123) is not in CapWords
+
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L117-L123
-src/rules/operation/RuleConditionalTransfer.sol#L270
+## similar-names
+> Acknowlege
+Impact: Informational
+Confidence: Medium
- [ ] ID-75
-Parameter [RuleSanctionList.messageForTransferRestriction(uint8)._restrictionCode](src/rules/validation/RuleSanctionList.sol#L88) is not in mixedCase
+Variable [RuleSanctionlistInvariantStorage.CODE_ADDRESS_FROM_IS_SANCTIONED](src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol#L27) is too similar to [RuleSanctionlistInvariantStorage.TEXT_ADDRESS_FROM_IS_SANCTIONED](src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol#L20-L21)
-src/rules/validation/RuleSanctionList.sol#L88
+src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol#L27
- [ ] ID-76
-Parameter [RuleAddressList.addressIsListedBatch(address[])._targetAddresses](src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L111) is not in mixedCase
+Variable [RuleConditionalTransferOperator._createTransferRequestWithApproval(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement).keyElement_](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L326) is too similar to [RuleConditionalTransferOperator.createTransferRequestWithApprovalBatch(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement[]).keyElements](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L245)
-src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol#L111
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L326
- [ ] ID-77
-Parameter [RuleEngine.validateTransfer(address,address,uint256)._to](src/RuleEngine.sol#L84) is not in mixedCase
+Variable [RuleConditionalTransferOperator._createTransferRequestWithApproval(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement).keyElement_](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L326) is too similar to [RuleConditionalTransferOperator.approveTransferRequestBatch(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement[],uint256[],bool[]).keyElements](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L219)
-src/RuleEngine.sol#L84
+src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L326
- [ ] ID-78
-Event [RuleConditionalTransferInvariantStorage.transferApproved(bytes32,address,address,uint256,uint256)](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L118-L124) is not in CapWords
+Variable [RuleConditionalTransferInvariantStorage.CODE_TRANSFER_REQUEST_NOT_APPROVED](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L87) is too similar to [RuleConditionalTransferInvariantStorage.TEXT_TRANSFER_REQUEST_NOT_APPROVED](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L83-L84)
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L118-L124
+src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L87
-## similar-names
-Impact: Informational
-Confidence: Medium
- [ ] ID-79
-Variable [RuleSanctionlistInvariantStorage.CODE_ADDRESS_FROM_IS_SANCTIONED](src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol#L25) is too similar to [RuleSanctionlistInvariantStorage.TEXT_ADDRESS_FROM_IS_SANCTIONED](src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol#L18-L19)
-
-src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol#L25
-
-
- - [ ] ID-80
-Variable [RuleConditionalTransferOperator._createTransferRequestWithApproval(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement).keyElement_](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L312) is too similar to [RuleConditionalTransferOperator.createTransferRequestWithApprovalBatch(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement[]).keyElements](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L246)
-
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L312
-
-
- - [ ] ID-81
-Variable [RuleConditionalTransferOperator._createTransferRequestWithApproval(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement).keyElement_](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L312) is too similar to [RuleConditionalTransferOperator.approveTransferRequestBatch(RuleConditionalTransferInvariantStorage.TransferRequestKeyElement[],uint256[],bool[]).keyElements](src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L220)
-
-src/rules/operation/abstract/RuleConditionalTransferOperator.sol#L312
-
-
- - [ ] ID-82
-Variable [RuleConditionalTransferInvariantStorage.CODE_TRANSFER_REQUEST_NOT_APPROVED](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L88) is too similar to [RuleConditionalTransferInvariantStorage.TEXT_TRANSFER_REQUEST_NOT_APPROVED](src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L84-L85)
-
-src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol#L88
-
-
- - [ ] ID-83
Variable [RuleBlacklistInvariantStorage.CODE_ADDRESS_FROM_IS_BLACKLISTED](src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleBlacklistInvariantStorage.sol#L16) is too similar to [RuleBlacklistInvariantStorage.TEXT_ADDRESS_FROM_IS_BLACKLISTED](src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleBlacklistInvariantStorage.sol#L9-L10)
src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleBlacklistInvariantStorage.sol#L16
- - [ ] ID-84
+ - [ ] ID-80
Variable [RuleWhitelistInvariantStorage.CODE_ADDRESS_TO_NOT_WHITELISTED](src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol#L17) is too similar to [RuleWhitelistInvariantStorage.TEXT_ADDRESS_TO_NOT_WHITELISTED](src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol#L11-L12)
src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol#L17
- - [ ] ID-85
+ - [ ] ID-81
Variable [RuleWhitelistInvariantStorage.CODE_ADDRESS_FROM_NOT_WHITELISTED](src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol#L16) is too similar to [RuleWhitelistInvariantStorage.TEXT_ADDRESS_FROM_NOT_WHITELISTED](src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol#L9-L10)
src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol#L16
-
## unused-import
+
+> Concerns OpenZeppelin library
+
Impact: Informational
Confidence: High
- - [ ] ID-86
+ - [ ] ID-82
The following unused import(s) in lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol should be removed:
-import {IERC20Permit} from "../extensions/IERC20Permit.sol"; (lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol#7)
## var-read-using-this
+
+> Don't manage to find a better solution
+
Impact: Optimization
Confidence: High
- - [ ] ID-87
+ - [ ] ID-83
The function [RuleValidateTransfer.validateTransfer(address,address,uint256)](src/rules/validation/abstract/RuleValidateTransfer.sol#L15-L24) reads [this.detectTransferRestriction(_from,_to,_amount) == uint8(REJECTED_CODE_BASE.TRANSFER_OK)](src/rules/validation/abstract/RuleValidateTransfer.sol#L21-L23) with `this` which adds an extra STATICCALL.
src/rules/validation/abstract/RuleValidateTransfer.sol#L15-L24
diff --git a/doc/surya/surya_graph/surya_graph_RuleConditionalTransfer.sol.png b/doc/surya/surya_graph/surya_graph_RuleConditionalTransfer.sol.png
index b703a28..63ada00 100644
Binary files a/doc/surya/surya_graph/surya_graph_RuleConditionalTransfer.sol.png and b/doc/surya/surya_graph/surya_graph_RuleConditionalTransfer.sol.png differ
diff --git a/doc/surya/surya_graph/surya_graph_RuleEngineOperation.sol.png b/doc/surya/surya_graph/surya_graph_RuleEngineOperation.sol.png
index 2b42825..d6f49ab 100644
Binary files a/doc/surya/surya_graph/surya_graph_RuleEngineOperation.sol.png and b/doc/surya/surya_graph/surya_graph_RuleEngineOperation.sol.png differ
diff --git a/doc/surya/surya_graph/surya_graph_RuleEngineValidationCommon.sol.png b/doc/surya/surya_graph/surya_graph_RuleEngineValidationCommon.sol.png
index 2987ded..8f9337d 100644
Binary files a/doc/surya/surya_graph/surya_graph_RuleEngineValidationCommon.sol.png and b/doc/surya/surya_graph/surya_graph_RuleEngineValidationCommon.sol.png differ
diff --git a/doc/surya/surya_graph/surya_graph_RuleInternal.sol.png b/doc/surya/surya_graph/surya_graph_RuleInternal.sol.png
index c4af7de..e48ebdb 100644
Binary files a/doc/surya/surya_graph/surya_graph_RuleInternal.sol.png and b/doc/surya/surya_graph/surya_graph_RuleInternal.sol.png differ
diff --git a/doc/surya/surya_report/surya_report_RuleAddressList.sol.md b/doc/surya/surya_report/surya_report_RuleAddressList.sol.md
index ff6c938..5e11c02 100644
--- a/doc/surya/surya_report/surya_report_RuleAddressList.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleAddressList.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/validation/abstract/RuleAddressList/RuleAddressList.sol | c967eb21311041eb58c7feb097a6224ec34b0c82 |
+| ./rules/validation/abstract/RuleAddressList/RuleAddressList.sol | 7c34b72694e29bec42ce60e5d6c33971c583d109 |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleAddressListInvariantStorage.sol.md b/doc/surya/surya_report/surya_report_RuleAddressListInvariantStorage.sol.md
index 2c8378b..26d1af6 100644
--- a/doc/surya/surya_report/surya_report_RuleAddressListInvariantStorage.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleAddressListInvariantStorage.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/validation/abstract/RuleAddressList/invariantStorage/RuleAddressListInvariantStorage.sol | 7cbf2581ae0836b91ab89a9daf1f4d6daa64fc7a |
+| ./rules/validation/abstract/RuleAddressList/invariantStorage/RuleAddressListInvariantStorage.sol | e67c0b26d249da1c2ac7d643f60b8f605ae24fb8 |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleBlacklistInvariantStorage.sol.md b/doc/surya/surya_report/surya_report_RuleBlacklistInvariantStorage.sol.md
index 641e318..ab2beae 100644
--- a/doc/surya/surya_report/surya_report_RuleBlacklistInvariantStorage.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleBlacklistInvariantStorage.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/validation/abstract/RuleAddressList/invariantStorage/RuleBlacklistInvariantStorage.sol | ba066cb426060eaca152daa5bb489970c2f9c539 |
+| ./rules/validation/abstract/RuleAddressList/invariantStorage/RuleBlacklistInvariantStorage.sol | 6853e61c8827b0b47e12d55e1075cb9fdcc1058b |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleConditionalTransfer.sol.md b/doc/surya/surya_report/surya_report_RuleConditionalTransfer.sol.md
index 553f3c9..784cf24 100644
--- a/doc/surya/surya_report/surya_report_RuleConditionalTransfer.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleConditionalTransfer.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/operation/RuleConditionalTransfer.sol | c374bce394733d30cfdeaabb4fd96ac904c701a3 |
+| ./rules/operation/RuleConditionalTransfer.sol | eaf4569f1376ea3e0d975f9c9c1c5e078abf0c8d |
### Contracts Description Table
@@ -17,17 +17,17 @@
||||||
| **RuleConditionalTransfer** | Implementation | RuleValidateTransfer, IRuleOperation, RuleConditionalTransferOperator, MetaTxModuleStandalone |||
| └ | | Public ❗️ | 🛑 | MetaTxModuleStandalone |
-| └ | operateOnTransfer | Public ❗️ | 🛑 | onlyRole |
| └ | createTransferRequest | Public ❗️ | 🛑 |NO❗️ |
| └ | createTransferRequestBatch | Public ❗️ | 🛑 |NO❗️ |
| └ | cancelTransferRequest | Public ❗️ | 🛑 |NO❗️ |
| └ | cancelTransferRequestBatch | Public ❗️ | 🛑 |NO❗️ |
+| └ | _cancelTransferRequest | Internal 🔒 | 🛑 | |
| └ | getRequestTrade | Public ❗️ | |NO❗️ |
| └ | getRequestByStatus | Public ❗️ | |NO❗️ |
+| └ | operateOnTransfer | Public ❗️ | 🛑 | onlyRole |
| └ | detectTransferRestriction | Public ❗️ | |NO❗️ |
| └ | canReturnTransferRestrictionCode | External ❗️ | |NO❗️ |
| └ | messageForTransferRestriction | External ❗️ | |NO❗️ |
-| └ | _cancelTransferRequest | Internal 🔒 | 🛑 | |
| └ | _validateBurnMint | Internal 🔒 | | |
| └ | _validateApproval | Internal 🔒 | | |
| └ | _msgSender | Internal 🔒 | | |
diff --git a/doc/surya/surya_report/surya_report_RuleConditionalTransferInvariantStorage.sol.md b/doc/surya/surya_report/surya_report_RuleConditionalTransferInvariantStorage.sol.md
index 944844d..f8c33db 100644
--- a/doc/surya/surya_report/surya_report_RuleConditionalTransferInvariantStorage.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleConditionalTransferInvariantStorage.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol | 71ed84800ef21f7f0964ed6dfa744eb444cded98 |
+| ./rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol | d0c0060b1a859c8d1d91db9c023496ca709c3297 |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleConditionalTransferOperator.sol.md b/doc/surya/surya_report/surya_report_RuleConditionalTransferOperator.sol.md
index 759ed25..6f572fc 100644
--- a/doc/surya/surya_report/surya_report_RuleConditionalTransferOperator.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleConditionalTransferOperator.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/operation/abstract/RuleConditionalTransferOperator.sol | dee2c32effd6ffa0da948f5a18219c8a7d4ebd14 |
+| ./rules/operation/abstract/RuleConditionalTransferOperator.sol | 16b39f4a6d66b9b22ad4e7c5d673ce48afbeeb1f |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleEngine.sol.md b/doc/surya/surya_report/surya_report_RuleEngine.sol.md
index 1cf40f7..bb1329a 100644
--- a/doc/surya/surya_report/surya_report_RuleEngine.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleEngine.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./RuleEngine.sol | 6454d098574b8dc8cd532554aa71faf9cd9dd28a |
+| ./RuleEngine.sol | 442f079ba0d2f4ec3c497569b1c891452bd967dc |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleEngineOperation.sol.md b/doc/surya/surya_report/surya_report_RuleEngineOperation.sol.md
index 9083954..792bdd8 100644
--- a/doc/surya/surya_report/surya_report_RuleEngineOperation.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleEngineOperation.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./modules/RuleEngineOperation.sol | 1e1185c6f479770d66aabb692a54d331cbaf8f4d |
+| ./modules/RuleEngineOperation.sol | 1e2f612e6fd60aaec03b4ad3c9651085f87026c1 |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleEngineValidationCommon.sol.md b/doc/surya/surya_report/surya_report_RuleEngineValidationCommon.sol.md
index 19e253b..8dc81cd 100644
--- a/doc/surya/surya_report/surya_report_RuleEngineValidationCommon.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleEngineValidationCommon.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./modules/RuleEngineValidationCommon.sol | 10414c0f3b47baecd5d5e8abe9d9d05c35ca7599 |
+| ./modules/RuleEngineValidationCommon.sol | 922d0811abdd53bcc6a893c0c7877ec6402b6bfe |
### Contracts Description Table
@@ -18,14 +18,14 @@
| **RuleEngineValidationCommon** | Implementation | AccessControl, RuleInternal, IRuleEngineValidationCommon |||
| └ | setRulesValidation | Public ❗️ | 🛑 | onlyRole |
| └ | clearRulesValidation | Public ❗️ | 🛑 | onlyRole |
+| └ | _clearRulesValidation | Internal 🔒 | 🛑 | |
| └ | addRuleValidation | Public ❗️ | 🛑 | onlyRole |
| └ | removeRuleValidation | Public ❗️ | 🛑 | onlyRole |
+| └ | _removeRuleValidation | Internal 🔒 | 🛑 | |
| └ | rulesCountValidation | External ❗️ | |NO❗️ |
| └ | getRuleIndexValidation | External ❗️ | |NO❗️ |
| └ | ruleValidation | External ❗️ | |NO❗️ |
| └ | rulesValidation | External ❗️ | |NO❗️ |
-| └ | _clearRulesValidation | Internal 🔒 | 🛑 | |
-| └ | _removeRuleValidation | Internal 🔒 | 🛑 | |
### Legend
diff --git a/doc/surya/surya_report/surya_report_RuleInternal.sol.md b/doc/surya/surya_report/surya_report_RuleInternal.sol.md
index 0eddb1f..598612a 100644
--- a/doc/surya/surya_report/surya_report_RuleInternal.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleInternal.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./modules/RuleInternal.sol | 7bad85bfbad52abc2ab9082628bf6bba2ee116f4 |
+| ./modules/RuleInternal.sol | c11e264f542c2c3250efdca62099221472d5c81e |
### Contracts Description Table
@@ -19,7 +19,7 @@
| └ | _setRules | Internal 🔒 | 🛑 | |
| └ | _addRule | Internal 🔒 | 🛑 | |
| └ | _removeRule | Internal 🔒 | 🛑 | |
-| └ | _getRuleIndex | Internal 🔒 | | |
+| └ | getRuleIndex | Internal 🔒 | | |
### Legend
diff --git a/doc/surya/surya_report/surya_report_RuleWhitelistInvariantStorage.sol.md b/doc/surya/surya_report/surya_report_RuleWhitelistInvariantStorage.sol.md
index 8591a82..8218aa1 100644
--- a/doc/surya/surya_report/surya_report_RuleWhitelistInvariantStorage.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleWhitelistInvariantStorage.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol | a49ed4b2f4e846464b80004e3d79c797320b6e5b |
+| ./rules/validation/abstract/RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol | 037d720155c2c175e32d029e91fa0f639c0afe6c |
### Contracts Description Table
diff --git a/doc/surya/surya_report/surya_report_RuleWhitelistWrapper.sol.md b/doc/surya/surya_report/surya_report_RuleWhitelistWrapper.sol.md
index 71dedab..6b1d582 100644
--- a/doc/surya/surya_report/surya_report_RuleWhitelistWrapper.sol.md
+++ b/doc/surya/surya_report/surya_report_RuleWhitelistWrapper.sol.md
@@ -5,7 +5,7 @@
| File Name | SHA-1 Hash |
|-------------|--------------|
-| ./rules/validation/RuleWhitelistWrapper.sol | 4868a3528d859dca93054b44d406c6c1f64baa8c |
+| ./rules/validation/RuleWhitelistWrapper.sol | 6fb02b05c189d5c5be34023ec0ee623996068517 |
### Contracts Description Table
diff --git a/doc/technical/RuleEngine.md b/doc/technical/RuleEngine.md
index edbeb47..159cf07 100644
--- a/doc/technical/RuleEngine.md
+++ b/doc/technical/RuleEngine.md
@@ -31,7 +31,7 @@ The default admin is the address put in argument(`admin`) inside the constructor
Here a schema of the Access Control.
![alt text](../security/accessControl/access-control-RuleEngine.png)
-
+By default, the `DEFAULT_ADMIN_ROLE` has the role `RULE_ENGINE_ROLE`.
diff --git a/hardhat.config.js b/hardhat.config.js
index c7dfaa4..83d9e54 100644
--- a/hardhat.config.js
+++ b/hardhat.config.js
@@ -2,12 +2,12 @@
require("@nomicfoundation/hardhat-foundry");
require('solidity-docgen');
module.exports = {
- solidity: "0.8.26",
+ solidity: "0.8.27",
settings: {
optimizer: {
enabled: true,
runs: 200
},
- evmVersion:"london"
+ evmVersion:"cancun"
}
};
diff --git a/lib/CMTAT b/lib/CMTAT
index 23a1e59..cab48f1 160000
--- a/lib/CMTAT
+++ b/lib/CMTAT
@@ -1 +1 @@
-Subproject commit 23a1e59f913d079d0c09d32fafbd95ab2d426093
+Subproject commit cab48f1e11de4ed19f8c6fcdadae2485c58630e7
diff --git a/lib/forge-std b/lib/forge-std
index 978ac6f..1eea5ba 160000
--- a/lib/forge-std
+++ b/lib/forge-std
@@ -1 +1 @@
-Subproject commit 978ac6fadb62f5f0b723c996f64be52eddba6801
+Subproject commit 1eea5bae12ae557d589f9f0f0edae2faa47cb262
diff --git a/package-lock.json b/package-lock.json
index bd4f13a..755c254 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,7 +8,7 @@
"@nomicfoundation/hardhat-foundry": "^1.0.1",
"ethlint": "^1.2.5",
"prettier-plugin-solidity": "^1.0.0-rc.1",
- "sol2uml": "^2.2.6",
+ "sol2uml": "^2.5.20",
"solidity-docgen": "^0.6.0-beta.35",
"surya": "^0.4.6"
}
@@ -2049,12 +2049,12 @@
}
},
"node_modules/axios": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
- "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
+ "version": "1.7.9",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
+ "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"dev": true,
"dependencies": {
- "follow-redirects": "^1.15.0",
+ "follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
@@ -3710,9 +3710,9 @@
}
},
"node_modules/follow-redirects": {
- "version": "1.15.2",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
- "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
+ "version": "1.15.9",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
+ "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"dev": true,
"funding": [
{
@@ -7824,35 +7824,44 @@
"dev": true
},
"node_modules/sol2uml": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/sol2uml/-/sol2uml-2.4.2.tgz",
- "integrity": "sha512-/r4kGFSiPNAEhpr7gbJ/VTOyVuoA7+aLCQdhCsGtwd1TDN6OOCoDBu2wvtNM7uUwrDIEKWkqcGBQcB7meI8TnA==",
+ "version": "2.5.20",
+ "resolved": "https://registry.npmjs.org/sol2uml/-/sol2uml-2.5.20.tgz",
+ "integrity": "sha512-La+UQ4Y6n8yG3Vfy5FudhZGJvymJ13PxuC00W4pKF3iIZFcRGPVH7RLBQ8lc+JqOt+YW92oSaSGSwHnlTmd7tg==",
"dev": true,
"dependencies": {
"@aduh95/viz.js": "^3.7.0",
- "@solidity-parser/parser": "^0.14.5",
- "axios": "1.1.3",
+ "@solidity-parser/parser": "^0.16.1",
+ "axios": "^1.6.0",
"axios-debug-log": "^1.0.0",
"cli-color": "^2.0.3",
- "commander": "^9.4.1",
+ "commander": "^11.1.0",
"convert-svg-to-png": "^0.6.4",
"debug": "^4.3.4",
"diff-match-patch": "^1.0.5",
"ethers": "^5.7.2",
"js-graph-algorithms": "^1.0.18",
- "klaw": "^4.0.1"
+ "klaw": "^4.1.0"
},
"bin": {
"sol2uml": "lib/sol2uml.js"
}
},
+ "node_modules/sol2uml/node_modules/@solidity-parser/parser": {
+ "version": "0.16.2",
+ "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.2.tgz",
+ "integrity": "sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg==",
+ "dev": true,
+ "dependencies": {
+ "antlr4ts": "^0.5.0-alpha.4"
+ }
+ },
"node_modules/sol2uml/node_modules/commander": {
- "version": "9.4.1",
- "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz",
- "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
+ "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
"dev": true,
"engines": {
- "node": "^12.20.0 || >=14"
+ "node": ">=16"
}
},
"node_modules/solc": {
@@ -10717,12 +10726,12 @@
"dev": true
},
"axios": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
- "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
+ "version": "1.7.9",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
+ "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"dev": true,
"requires": {
- "follow-redirects": "^1.15.0",
+ "follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
@@ -12073,9 +12082,9 @@
"peer": true
},
"follow-redirects": {
- "version": "1.15.2",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
- "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
+ "version": "1.15.9",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
+ "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"dev": true
},
"for-in": {
@@ -15232,29 +15241,38 @@
"dev": true
},
"sol2uml": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/sol2uml/-/sol2uml-2.4.2.tgz",
- "integrity": "sha512-/r4kGFSiPNAEhpr7gbJ/VTOyVuoA7+aLCQdhCsGtwd1TDN6OOCoDBu2wvtNM7uUwrDIEKWkqcGBQcB7meI8TnA==",
+ "version": "2.5.20",
+ "resolved": "https://registry.npmjs.org/sol2uml/-/sol2uml-2.5.20.tgz",
+ "integrity": "sha512-La+UQ4Y6n8yG3Vfy5FudhZGJvymJ13PxuC00W4pKF3iIZFcRGPVH7RLBQ8lc+JqOt+YW92oSaSGSwHnlTmd7tg==",
"dev": true,
"requires": {
"@aduh95/viz.js": "^3.7.0",
- "@solidity-parser/parser": "^0.14.5",
- "axios": "1.1.3",
+ "@solidity-parser/parser": "^0.16.1",
+ "axios": "^1.6.0",
"axios-debug-log": "^1.0.0",
"cli-color": "^2.0.3",
- "commander": "^9.4.1",
+ "commander": "^11.1.0",
"convert-svg-to-png": "^0.6.4",
"debug": "^4.3.4",
"diff-match-patch": "^1.0.5",
"ethers": "^5.7.2",
"js-graph-algorithms": "^1.0.18",
- "klaw": "^4.0.1"
+ "klaw": "^4.1.0"
},
"dependencies": {
+ "@solidity-parser/parser": {
+ "version": "0.16.2",
+ "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.2.tgz",
+ "integrity": "sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg==",
+ "dev": true,
+ "requires": {
+ "antlr4ts": "^0.5.0-alpha.4"
+ }
+ },
"commander": {
- "version": "9.4.1",
- "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz",
- "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
+ "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
"dev": true
}
}
diff --git a/package.json b/package.json
index c148cd4..b76074f 100644
--- a/package.json
+++ b/package.json
@@ -13,13 +13,12 @@
"surya:report": "npx surya mdreport surya_report_ruleEngine.md src/RuleEngine.sol && npx surya mdreport surya_report_ruleWhitelist.md src/RuleWhitelist.sol",
"surya:graph": "npx surya graph src/rules/operation/RuleConditionalTransfer.sol | dot -Tpng > surya_graph_conditionalTransfer.png && npx surya graph src/rules/validation/RuleBlacklist.sol| dot -Tpng > surya_graph_blacklist.png && npx surya graph src/rules/validation/RuleWhitelist.sol | dot -Tpng > surya_graph_Whitelist.png && npx surya graph src/RuleEngine.sol | dot -Tpng > surya_graph_RuleEngine.png && npx surya graph src/rules/validation/RuleSanctionList.sol | dot -Tpng > surya_graph_SanctionList.png",
"docgen": "npx hardhat docgen"
-
},
"devDependencies": {
"@nomicfoundation/hardhat-foundry": "^1.0.1",
"ethlint": "^1.2.5",
"prettier-plugin-solidity": "^1.0.0-rc.1",
- "sol2uml": "^2.2.6",
+ "sol2uml": "^2.5.20",
"solidity-docgen": "^0.6.0-beta.35",
"surya": "^0.4.6"
}
diff --git a/script/CMTATWithRuleEngineScript.s.sol b/script/CMTATWithRuleEngineScript.s.sol
index 8303f01..e0e611e 100644
--- a/script/CMTATWithRuleEngineScript.s.sol
+++ b/script/CMTATWithRuleEngineScript.s.sol
@@ -4,36 +4,23 @@
pragma solidity ^0.8.17;
import "forge-std/Script.sol";
-import "CMTAT/CMTAT_STANDALONE.sol";
+import "../test/HelperContract.sol";
import "src/RuleEngine.sol";
import "src/rules/validation/RuleWhitelist.sol";
/**
@title Deploy a CMTAT, a RuleWhitelist and a RuleEngine
*/
-contract CMTATWithRuleEngineScript is Script {
+contract CMTATWithRuleEngineScript is Script, HelperContract {
function run() external {
// Get env variable
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address ADMIN = vm.addr(deployerPrivateKey);
address trustedForwarder = address(0x0);
vm.startBroadcast(deployerPrivateKey);
- uint256 flag = 5;
- uint8 decimals = 0;
// CMTAT
- CMTAT_STANDALONE CMTAT_CONTRACT = new CMTAT_STANDALONE(
- trustedForwarder,
- ADMIN,
- IAuthorizationEngine(address(0)),
- "CMTA Token",
- "CMTAT",
- decimals,
- "CMTAT_ISIN",
- "https://cmta.ch",
- IRuleEngine(address(0)),
- "CMTAT_info",
- flag
- );
+ cmtatDeployment = new CMTATDeployment();
+ CMTAT_CONTRACT = cmtatDeployment.cmtat();
console.log("CMTAT CMTAT_CONTRACT : ", address(CMTAT_CONTRACT));
// whitelist
RuleWhitelist ruleWhitelist = new RuleWhitelist(
diff --git a/src/RuleEngine.sol b/src/RuleEngine.sol
index 5dacf4d..48b95c8 100644
--- a/src/RuleEngine.sol
+++ b/src/RuleEngine.sol
@@ -20,9 +20,7 @@ contract RuleEngine is
* @notice
* Get the current version of the smart contract
*/
- string public constant VERSION = "2.0.3";
-
- error RuleEngine_TransferInvalid();
+ string public constant VERSION = "2.0.4";
/**
* @param admin Address of the contract (Access Control)
@@ -40,7 +38,6 @@ contract RuleEngine is
_grantRole(TOKEN_CONTRACT_ROLE, tokenContract);
}
_grantRole(DEFAULT_ADMIN_ROLE, admin);
- _grantRole(RULE_ENGINE_OPERATOR_ROLE, admin);
}
/**
@@ -148,6 +145,21 @@ contract RuleEngine is
return RuleEngineOperation._operateOnTransfer(from, to, amount);
}
+ /* ============ ACCESS CONTROL ============ */
+ /**
+ * @dev Returns `true` if `account` has been granted `role`.
+ */
+ function hasRole(
+ bytes32 role,
+ address account
+ ) public view virtual override(AccessControl) returns (bool) {
+ // The Default Admin has all roles
+ if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ return true;
+ }
+ return AccessControl.hasRole(role, account);
+ }
+
/*//////////////////////////////////////////////////////////////
ERC-2771
//////////////////////////////////////////////////////////////*/
diff --git a/src/rules/operation/RuleConditionalTransfer.sol b/src/rules/operation/RuleConditionalTransfer.sol
index 06f8ee5..733424b 100644
--- a/src/rules/operation/RuleConditionalTransfer.sol
+++ b/src/rules/operation/RuleConditionalTransfer.sol
@@ -34,16 +34,9 @@ contract RuleConditionalTransfer is
revert RuleConditionalTransfer_AdminWithAddressZeroNotAllowed();
}
_grantRole(DEFAULT_ADMIN_ROLE, admin);
- _grantRole(RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE, admin);
if (address(ruleEngineContract) != address(0x0)) {
_grantRole(RULE_ENGINE_CONTRACT_ROLE, address(ruleEngineContract));
}
- if (options_.timeLimit.timeLimitToApprove == 0) {
- options_.timeLimit.timeLimitToApprove = type(uint64).max;
- }
- if (options_.timeLimit.timeLimitToTransfer == 0) {
- options_.timeLimit.timeLimitToTransfer = type(uint64).max;
- }
options = options_;
}
@@ -65,17 +58,17 @@ contract RuleConditionalTransfer is
onlyRole(RULE_ENGINE_CONTRACT_ROLE)
returns (bool isValid)
{
- if(_validateTransfer(_from,_to,_amount)){
+ if (_validateTransfer(_from, _to)) {
return true;
- }else {
- bytes32 key = keccak256(abi.encode(_from, _to, _amount));
- if (_validateApproval(key)) {
+ } else {
+ bytes32 key = keccak256(abi.encode(_from, _to, _amount));
+ if (_validateApproval(key)) {
_updateProcessedTransfer(key);
return true;
} else {
return false;
}
- }
+ }
}
/**
@@ -224,8 +217,8 @@ contract RuleConditionalTransfer is
uint256 _amount
) public view override returns (uint8) {
// No need of approval if from and to are in the whitelist
- if(_validateTransfer(_from,_to,_amount)){
- return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
+ if (_validateTransfer(_from, _to)) {
+ return uint8(REJECTED_CODE_BASE.TRANSFER_OK);
}
bytes32 key = keccak256(abi.encode(_from, _to, _amount));
if (_validateApproval(key)) {
@@ -264,9 +257,10 @@ contract RuleConditionalTransfer is
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
- function _validateTransfer(address _from,
- address _to,
- uint256 _amount) internal view returns(bool) {
+ function _validateTransfer(
+ address _from,
+ address _to
+ ) internal view returns (bool) {
// No need of approval if from and to are in the whitelist
if (address(whitelistConditionalTransfer) != address(0)) {
if (
@@ -281,7 +275,7 @@ contract RuleConditionalTransfer is
if (_validateBurnMint(_from, _to)) {
return true;
}
- return false;
+ return false;
}
function _cancelTransferRequest(uint256 requestId_) internal {
@@ -336,9 +330,13 @@ contract RuleConditionalTransfer is
bytes32 key
) internal view returns (bool isValid) {
// If automatic approval is activate and time to approve the request has passed
+ // Warning: overflow possible if timeLimitBeforeAutomaticApproval == max(uint256)
bool automaticApprovalCondition = options
.automaticApproval
- .isActivate && block.timestamp >= (transferRequests[key].askTime + options.automaticApproval.timeLimitBeforeAutomaticApproval);
+ .isActivate &&
+ block.timestamp >=
+ (transferRequests[key].askTime +
+ options.automaticApproval.timeLimitBeforeAutomaticApproval);
// If the transfer is approved and delay to perform the transfer is respected
bool isTransferApproved = (transferRequests[key].status ==
STATUS.APPROVED) &&
diff --git a/src/rules/operation/abstract/RuleConditionalTransferOperator.sol b/src/rules/operation/abstract/RuleConditionalTransferOperator.sol
index f25c3e4..46076fd 100644
--- a/src/rules/operation/abstract/RuleConditionalTransferOperator.sol
+++ b/src/rules/operation/abstract/RuleConditionalTransferOperator.sol
@@ -142,11 +142,11 @@ abstract contract RuleConditionalTransferOperator is
}
/**
- @notice approve a transferRequest
- @param keyElement contains from, to, value
- @param partialValue amount approved. Put 0 if all the amount specified by value is approved.
- @param isApproved approved (true) or refused (false). Put true if you use partialApproval
- */
+ * @notice approve a transferRequest
+ * @param keyElement contains from, to, value
+ * @param partialValue amount approved. Put 0 if all the amount specified by value is approved.
+ * @param isApproved approved (true) or refused (false). Put true if you use partialApproval
+ */
function approveTransferRequest(
TransferRequestKeyElement calldata keyElement,
uint256 partialValue,
@@ -184,7 +184,7 @@ abstract contract RuleConditionalTransferOperator is
_resetRequestStatus(key);
}
- /***** Batch function */
+ /* ============ Batch function ============ */
/**
* @notice Batch version of {approveTransferRequestWithId}
*/
@@ -273,6 +273,21 @@ abstract contract RuleConditionalTransferOperator is
}
}
+ /* ============ ACCESS CONTROL ============ */
+ /**
+ * @dev Returns `true` if `account` has been granted `role`.
+ */
+ function hasRole(
+ bytes32 role,
+ address account
+ ) public view virtual override(AccessControl) returns (bool) {
+ // The Default Admin has all roles
+ if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ return true;
+ }
+ return AccessControl.hasRole(role, account);
+ }
+
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
@@ -322,6 +337,7 @@ abstract contract RuleConditionalTransferOperator is
id: requestId,
keyElement: keyElement_,
askTime: 0,
+ // Warning: overflow possible if timeLimitToTransfer == max(uint256)
maxTime: block.timestamp +
options.timeLimit.timeLimitToTransfer,
status: STATUS.APPROVED
@@ -338,6 +354,7 @@ abstract contract RuleConditionalTransferOperator is
++requestId;
} else {
// Overwrite previous approval
+ // Warning: overflow possible if timeLimitToTransfer == max(uint256)
transferRequests[key].maxTime =
block.timestamp +
options.timeLimit.timeLimitToTransfer;
diff --git a/src/rules/validation/RuleSanctionList.sol b/src/rules/validation/RuleSanctionList.sol
index d71bad5..4262cc5 100644
--- a/src/rules/validation/RuleSanctionList.sol
+++ b/src/rules/validation/RuleSanctionList.sol
@@ -31,11 +31,10 @@ contract RuleSanctionList is
if (admin == address(0)) {
revert RuleSanctionList_AdminWithAddressZeroNotAllowed();
}
- if(sanctionContractOracle_ != address(0)){
+ if (sanctionContractOracle_ != address(0)) {
_setSanctionListOracle(sanctionContractOracle_);
}
_grantRole(DEFAULT_ADMIN_ROLE, admin);
- _grantRole(SANCTIONLIST_ROLE, admin);
}
/**
@@ -49,13 +48,6 @@ contract RuleSanctionList is
_setSanctionListOracle(sanctionContractOracle_);
}
- function _setSanctionListOracle(
- address sanctionContractOracle_
- ) internal {
- sanctionsList = SanctionsList(sanctionContractOracle_);
- emit SetSanctionListOracle(address(sanctionContractOracle_));
- }
-
/**
* @notice Check if an addres is in the whitelist or not
* @param _from the origin address
@@ -107,6 +99,34 @@ contract RuleSanctionList is
}
}
+ /* ============ ACCESS CONTROL ============ */
+ /**
+ * @dev Returns `true` if `account` has been granted `role`.
+ */
+ function hasRole(
+ bytes32 role,
+ address account
+ ) public view virtual override(AccessControl) returns (bool) {
+ // The Default Admin has all roles
+ if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ return true;
+ }
+ return AccessControl.hasRole(role, account);
+ }
+
+ /*//////////////////////////////////////////////////////////////
+ INTERNAL FUNCTIONS
+ //////////////////////////////////////////////////////////////*/
+
+ function _setSanctionListOracle(address sanctionContractOracle_) internal {
+ sanctionsList = SanctionsList(sanctionContractOracle_);
+ emit SetSanctionListOracle(address(sanctionContractOracle_));
+ }
+
+ /*//////////////////////////////////////////////////////////////
+ ERC-2771
+ //////////////////////////////////////////////////////////////*/
+
/**
* @dev This surcharge is not necessary if you do not use the MetaTxModule
*/
diff --git a/src/rules/validation/RuleWhitelistWrapper.sol b/src/rules/validation/RuleWhitelistWrapper.sol
index 972a1d2..4537cb9 100644
--- a/src/rules/validation/RuleWhitelistWrapper.sol
+++ b/src/rules/validation/RuleWhitelistWrapper.sol
@@ -28,7 +28,6 @@ contract RuleWhitelistWrapper is
revert RuleEngine_AdminWithAddressZeroNotAllowed();
}
_grantRole(DEFAULT_ADMIN_ROLE, admin);
- _grantRole(RULE_ENGINE_OPERATOR_ROLE, admin);
}
/**
@@ -74,6 +73,25 @@ contract RuleWhitelistWrapper is
}
}
+ /* ============ ACCESS CONTROL ============ */
+ /**
+ * @dev Returns `true` if `account` has been granted `role`.
+ */
+ function hasRole(
+ bytes32 role,
+ address account
+ ) public view virtual override(AccessControl) returns (bool) {
+ // The Default Admin has all roles
+ if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ return true;
+ }
+ return AccessControl.hasRole(role, account);
+ }
+
+ /*//////////////////////////////////////////////////////////////
+ ERC-2771
+ //////////////////////////////////////////////////////////////*/
+
/**
* @dev This surcharge is not necessary if you do not use the MetaTxModule
*/
diff --git a/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol b/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol
index 7bc8095..ddcdb54 100644
--- a/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol
+++ b/src/rules/validation/abstract/RuleAddressList/RuleAddressList.sol
@@ -19,6 +19,7 @@ abstract contract RuleAddressList is
{
// Number of addresses in the list at the moment
uint256 private numAddressesWhitelisted;
+
/**
* @param admin Address of the contract (Access Control)
* @param forwarderIrrevocable Address of the forwarder, required for the gasless support
@@ -31,8 +32,6 @@ abstract contract RuleAddressList is
revert RuleAddressList_AdminWithAddressZeroNotAllowed();
}
_grantRole(DEFAULT_ADMIN_ROLE, admin);
- _grantRole(ADDRESS_LIST_ADD_ROLE, admin);
- _grantRole(ADDRESS_LIST_REMOVE_ROLE, admin);
}
/**
@@ -120,6 +119,21 @@ abstract contract RuleAddressList is
return isListed;
}
+ /* ============ ACCESS CONTROL ============ */
+ /**
+ * @dev Returns `true` if `account` has been granted `role`.
+ */
+ function hasRole(
+ bytes32 role,
+ address account
+ ) public view virtual override(AccessControl) returns (bool) {
+ // The Default Admin has all roles
+ if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
+ return true;
+ }
+ return AccessControl.hasRole(role, account);
+ }
+
/*//////////////////////////////////////////////////////////////
ERC-2771
//////////////////////////////////////////////////////////////*/
diff --git a/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol b/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol
index 2cd3116..02cbd38 100644
--- a/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol
+++ b/src/rules/validation/abstract/RuleAddressList/RuleAddressListInternal.sol
@@ -19,7 +19,9 @@ abstract contract RuleAddressListInternal {
* If one of addresses already exist, there is no change for this address. The transaction remains valid (no revert).
* @param listTargetAddresses an array with the addresses to list
*/
- function _addAddressesToThelist(address[] calldata listTargetAddresses) internal {
+ function _addAddressesToThelist(
+ address[] calldata listTargetAddresses
+ ) internal {
uint256 numAddressesListLocal = numAddressesList;
for (uint256 i = 0; i < listTargetAddresses.length; ++i) {
if (!list[listTargetAddresses[i]]) {
diff --git a/src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleAddressListInvariantStorage.sol b/src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleAddressListInvariantStorage.sol
index 0548667..75f5c3c 100644
--- a/src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleAddressListInvariantStorage.sol
+++ b/src/rules/validation/abstract/RuleAddressList/invariantStorage/RuleAddressListInvariantStorage.sol
@@ -8,7 +8,7 @@ abstract contract RuleAddressListInvariantStorage {
event RemoveAddressesFromTheList(address[] listTargetAddresses);
event AddAddressToTheList(address targetAddress);
event RemoveAddressFromTheList(address targetAddress);
-
+
/* ============ Custom errors ============ */
error RuleAddressList_AdminWithAddressZeroNotAllowed();
diff --git a/src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol b/src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol
index acfda07..e040bff 100644
--- a/src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol
+++ b/src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol
@@ -3,6 +3,7 @@
pragma solidity ^0.8.20;
import "./RuleCommonInvariantStorage.sol";
+
abstract contract RuleSanctionlistInvariantStorage is
RuleCommonInvariantStorage
{
diff --git a/test/HelperContract.sol b/test/HelperContract.sol
index 6027ad7..c9f4578 100644
--- a/test/HelperContract.sol
+++ b/test/HelperContract.sol
@@ -5,6 +5,8 @@ import "forge-std/Test.sol";
import "CMTAT/CMTAT_STANDALONE.sol";
import "src/modules/RuleEngineInvariantStorage.sol";
+// RuleEngine
+import "src/RuleEngine.sol";
// RuleConditionalTransfer
import "src/rules/operation/abstract/RuleConditionalTransferInvariantStorage.sol";
import "src/rules/operation/RuleConditionalTransfer.sol";
@@ -24,6 +26,9 @@ import "src/rules/validation/abstract/RuleSanctionListInvariantStorage.sol";
import "src/interfaces/IRuleValidation.sol";
import "src/interfaces/IRuleOperation.sol";
+// utils
+import "./utils/CMTATDeployment.sol";
+
/**
* @title Constants used by the tests
*/
@@ -35,6 +40,12 @@ abstract contract HelperContract is
RuleEngineInvariantStorage,
RuleConditionalTransferInvariantStorage
{
+ // Test result
+ uint256 internal resUint256;
+ uint8 internal resUint8;
+ bool internal resBool;
+ bool internal resCallBool;
+ string internal resString;
// EOA to perform tests
address constant ZERO_ADDRESS = address(0);
address constant DEFAULT_ADMIN_ADDRESS = address(1);
@@ -57,15 +68,24 @@ abstract contract HelperContract is
uint256 DEFAULT_TIME_LIMIT_TO_APPROVE = 7 days;
uint256 DEFAULT_TIME_LIMIT_TO_TRANSFER = 7 days;
// contract
- RuleBlacklist ruleBlacklist;
- RuleWhitelist ruleWhitelist;
- RuleConditionalTransfer ruleConditionalTransfer;
+ RuleBlacklist public ruleBlacklist;
+ RuleWhitelist public ruleWhitelist;
+ RuleConditionalTransfer public ruleConditionalTransfer;
+
+ // CMTAT
+ CMTATDeployment cmtatDeployment;
CMTAT_STANDALONE CMTAT_CONTRACT;
+ // RuleEngine Mock
+ RuleEngine public ruleEngineMock;
+
//bytes32 public constant RULE_ENGINE_ROLE = keccak256("RULE_ENGINE_ROLE");
uint8 constant NO_ERROR = 0;
-
+ uint8 CODE_NONEXISTENT = 255;
+ // Defined in CMTAT.sol
+ uint8 constant TRANSFER_OK = 0;
+ string constant TEXT_TRANSFER_OK = "No restriction";
// Forwarder
string ERC2771ForwarderDomain = "ERC2771ForwarderDomain";
diff --git a/test/RuleBlacklist/CMTATIntegration.t.sol b/test/RuleBlacklist/CMTATIntegration.t.sol
index f8c387d..98bf6d5 100644
--- a/test/RuleBlacklist/CMTATIntegration.t.sol
+++ b/test/RuleBlacklist/CMTATIntegration.t.sol
@@ -10,14 +10,6 @@ import "src/RuleEngine.sol";
* @title Integration test with the CMTAT
*/
contract CMTATIntegration is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
-
- RuleEngine ruleEngineMock;
- uint256 resUint256;
- bool resBool;
-
uint256 ADDRESS1_BALANCE_INIT = 31;
uint256 ADDRESS2_BALANCE_INIT = 32;
uint256 ADDRESS3_BALANCE_INIT = 33;
@@ -26,24 +18,12 @@ contract CMTATIntegration is Test, HelperContract {
// Arrange
function setUp() public {
+ // CMTAT
+ cmtatDeployment = new CMTATDeployment();
+ CMTAT_CONTRACT = cmtatDeployment.cmtat();
+
vm.prank(DEFAULT_ADMIN_ADDRESS);
ruleBlacklist = new RuleBlacklist(DEFAULT_ADMIN_ADDRESS, ZERO_ADDRESS);
- // global arrange
- uint8 decimals = 0;
- vm.prank(DEFAULT_ADMIN_ADDRESS);
- CMTAT_CONTRACT = new CMTAT_STANDALONE(
- ZERO_ADDRESS,
- DEFAULT_ADMIN_ADDRESS,
- IAuthorizationEngine(address(0)),
- "CMTA Token",
- "CMTAT",
- decimals,
- "CMTAT_ISIN",
- "https://cmta.ch",
- IRuleEngine(address(0)),
- "CMTAT_info",
- FLAG
- );
// specific arrange
vm.prank(DEFAULT_ADMIN_ADDRESS);
diff --git a/test/RuleBlacklist/RuleBlacklist.t.sol b/test/RuleBlacklist/RuleBlacklist.t.sol
index 2e73349..03305d9 100644
--- a/test/RuleBlacklist/RuleBlacklist.t.sol
+++ b/test/RuleBlacklist/RuleBlacklist.t.sol
@@ -10,13 +10,6 @@ import "src/RuleEngine.sol";
* @title Integration test with the CMTAT
*/
contract RuleBlacklistTest is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
-
- uint256 resUint256;
- bool resBool;
-
// Arrange
function setUp() public {
vm.prank(DEFAULT_ADMIN_ADDRESS);
diff --git a/test/RuleConditionalTransfer/CMTATIntegration.t.sol b/test/RuleConditionalTransfer/CMTATIntegration.t.sol
index b37b291..4e7f358 100644
--- a/test/RuleConditionalTransfer/CMTATIntegration.t.sol
+++ b/test/RuleConditionalTransfer/CMTATIntegration.t.sol
@@ -10,14 +10,6 @@ import "src/RuleEngine.sol";
* @title Integration test with the CMTAT
*/
contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
-
- RuleEngine ruleEngineMock;
- uint256 resUint256;
- bool resBool;
-
uint256 ADDRESS1_BALANCE_INIT = 31;
uint256 ADDRESS2_BALANCE_INIT = 32;
uint256 ADDRESS3_BALANCE_INIT = 33;
@@ -63,21 +55,8 @@ contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
});
// global arrange
- uint8 decimals = 0;
- vm.prank(DEFAULT_ADMIN_ADDRESS);
- CMTAT_CONTRACT = new CMTAT_STANDALONE(
- ZERO_ADDRESS,
- DEFAULT_ADMIN_ADDRESS,
- IAuthorizationEngine(address(0)),
- "CMTA Token",
- "CMTAT",
- decimals,
- "CMTAT_ISIN",
- "https://cmta.ch",
- IRuleEngine(address(0)),
- "CMTAT_info",
- FLAG
- );
+ cmtatDeployment = new CMTATDeployment();
+ CMTAT_CONTRACT = cmtatDeployment.cmtat();
// RuleEngine
vm.prank(DEFAULT_ADMIN_ADDRESS);
@@ -410,28 +389,46 @@ contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
);
}
- function testCanTransferIfAutomaticApprovalSetAndTimeExceedsJustInTime() public {
+ function testCanTransferIfAutomaticApprovalSetAndTimeExceedsJustInTime()
+ public
+ {
AUTOMATIC_APPROVAL memory automaticApproval_ = AUTOMATIC_APPROVAL({
isActivate: true,
timeLimitBeforeAutomaticApproval: 90 days
});
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.prank(CONDITIONAL_TRANSFER_OPERATOR_ADDRESS);
ruleConditionalTransfer.setAutomaticApproval(automaticApproval_);
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
// Arrange
_createTransferRequest();
-
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.warp(block.timestamp + 90 days);
// Act
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertEq(resBool, true);
vm.prank(ADDRESS1);
vm.expectEmit(true, true, true, true);
@@ -445,22 +442,38 @@ contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
timeLimitBeforeAutomaticApproval: 90 days
});
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.prank(CONDITIONAL_TRANSFER_OPERATOR_ADDRESS);
ruleConditionalTransfer.setAutomaticApproval(automaticApproval_);
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
// Arrange
_createTransferRequest();
-
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.warp(block.timestamp + 91 days);
// Act
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertEq(resBool, true);
vm.prank(ADDRESS1);
vm.expectEmit(true, true, true, true);
@@ -475,20 +488,36 @@ contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
isActivate: true,
timeLimitBeforeAutomaticApproval: 90 days
});
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.prank(CONDITIONAL_TRANSFER_OPERATOR_ADDRESS);
ruleConditionalTransfer.setAutomaticApproval(automaticApproval_);
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
// Arrange
_createTransferRequest();
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
- resBool = CMTAT_CONTRACT.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = CMTAT_CONTRACT.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
// Time not exceeds
vm.warp(block.timestamp + 85 days);
diff --git a/test/RuleConditionalTransfer/CMTATIntegrationWhitelist.t .sol b/test/RuleConditionalTransfer/CMTATIntegrationConditionalTransfer.t.sol
similarity index 93%
rename from test/RuleConditionalTransfer/CMTATIntegrationWhitelist.t .sol
rename to test/RuleConditionalTransfer/CMTATIntegrationConditionalTransfer.t.sol
index 10f1d77..87d796e 100644
--- a/test/RuleConditionalTransfer/CMTATIntegrationWhitelist.t .sol
+++ b/test/RuleConditionalTransfer/CMTATIntegrationConditionalTransfer.t.sol
@@ -10,14 +10,6 @@ import "src/RuleEngine.sol";
* @title Integration test with the CMTAT
*/
contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
-
- RuleEngine ruleEngineMock;
- uint256 resUint256;
- bool resBool;
-
uint256 ADDRESS1_BALANCE_INIT = 31;
uint256 ADDRESS2_BALANCE_INIT = 32;
uint256 ADDRESS3_BALANCE_INIT = 33;
@@ -63,21 +55,8 @@ contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
});
// global arrange
- uint8 decimals = 0;
- vm.prank(DEFAULT_ADMIN_ADDRESS);
- CMTAT_CONTRACT = new CMTAT_STANDALONE(
- ZERO_ADDRESS,
- DEFAULT_ADMIN_ADDRESS,
- IAuthorizationEngine(address(0)),
- "CMTA Token",
- "CMTAT",
- decimals,
- "CMTAT_ISIN",
- "https://cmta.ch",
- IRuleEngine(address(0)),
- "CMTAT_info",
- FLAG
- );
+ cmtatDeployment = new CMTATDeployment();
+ CMTAT_CONTRACT = cmtatDeployment.cmtat();
// Whitelist
ruleWhitelist = new RuleWhitelist(DEFAULT_ADMIN_ADDRESS, ZERO_ADDRESS);
@@ -575,28 +554,46 @@ contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
);
}
- function testCanTransferIfAutomaticApprovalSetAndTimeExceedsJustInTime() public {
+ function testCanTransferIfAutomaticApprovalSetAndTimeExceedsJustInTime()
+ public
+ {
AUTOMATIC_APPROVAL memory automaticApproval_ = AUTOMATIC_APPROVAL({
isActivate: true,
timeLimitBeforeAutomaticApproval: 90 days
});
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.prank(CONDITIONAL_TRANSFER_OPERATOR_ADDRESS);
ruleConditionalTransfer.setAutomaticApproval(automaticApproval_);
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
// Arrange
_createTransferRequest();
-
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.warp(block.timestamp + 90 days);
// Act
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertEq(resBool, true);
vm.prank(ADDRESS1);
vm.expectEmit(true, true, true, true);
@@ -610,22 +607,38 @@ contract CMTATIntegrationConditionalTransfer is Test, HelperContract {
timeLimitBeforeAutomaticApproval: 90 days
});
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.prank(CONDITIONAL_TRANSFER_OPERATOR_ADDRESS);
ruleConditionalTransfer.setAutomaticApproval(automaticApproval_);
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
// Arrange
_createTransferRequest();
-
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertFalse(resBool);
vm.warp(block.timestamp + 91 days);
// Act
- resBool = ruleConditionalTransfer.validateTransfer(ADDRESS1, ADDRESS2, defaultValue);
+ resBool = ruleConditionalTransfer.validateTransfer(
+ ADDRESS1,
+ ADDRESS2,
+ defaultValue
+ );
assertEq(resBool, true);
vm.prank(ADDRESS1);
vm.expectEmit(true, true, true, true);
diff --git a/test/RuleConditionalTransfer/RuleCTDeployment.sol b/test/RuleConditionalTransfer/RuleCTDeployment.sol
new file mode 100644
index 0000000..23615be
--- /dev/null
+++ b/test/RuleConditionalTransfer/RuleCTDeployment.sol
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: MPL-2.0
+pragma solidity ^0.8.20;
+
+import "forge-std/Test.sol";
+import "../HelperContract.sol";
+import "src/RuleEngine.sol";
+
+/**
+ * @title Tests on the Access Control
+ */
+contract RuleCTDeployment is Test, HelperContract {
+ // Arrange
+ constructor() {
+ TIME_LIMIT memory timeLimit_ = TIME_LIMIT({
+ timeLimitToApprove: 7 days,
+ timeLimitToTransfer: 30 days
+ });
+
+ AUTOMATIC_APPROVAL memory automaticApproval_ = AUTOMATIC_APPROVAL({
+ isActivate: false,
+ timeLimitBeforeAutomaticApproval: 0
+ });
+
+ ISSUANCE memory issuanceOption_ = ISSUANCE({
+ authorizedMintWithoutApproval: false,
+ authorizedBurnWithoutApproval: false
+ });
+ AUTOMATIC_TRANSFER memory automaticTransfer_ = AUTOMATIC_TRANSFER({
+ isActivate: false,
+ cmtat: IERC20(address(0))
+ });
+
+ OPTION memory options = OPTION({
+ issuance: issuanceOption_,
+ timeLimit: timeLimit_,
+ automaticApproval: automaticApproval_,
+ automaticTransfer: automaticTransfer_
+ });
+ ruleEngineMock = new RuleEngine(
+ RULE_ENGINE_OPERATOR_ADDRESS,
+ ZERO_ADDRESS,
+ ZERO_ADDRESS
+ );
+ vm.prank(DEFAULT_ADMIN_ADDRESS);
+ ruleConditionalTransfer = new RuleConditionalTransfer(
+ DEFAULT_ADMIN_ADDRESS,
+ ZERO_ADDRESS,
+ ruleEngineMock,
+ options
+ );
+ vm.prank(DEFAULT_ADMIN_ADDRESS);
+ ruleConditionalTransfer.grantRole(
+ RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE,
+ CONDITIONAL_TRANSFER_OPERATOR_ADDRESS
+ );
+ }
+}
diff --git a/test/RuleConditionalTransfer/RuleConditionalTransfer.t.sol b/test/RuleConditionalTransfer/RuleConditionalTransfer.t.sol
index e1f16c0..34d15c0 100644
--- a/test/RuleConditionalTransfer/RuleConditionalTransfer.t.sol
+++ b/test/RuleConditionalTransfer/RuleConditionalTransfer.t.sol
@@ -9,13 +9,6 @@ import "src/RuleEngine.sol";
* @title General functions of the RuleWhitelist
*/
contract RuleConditionalTransferTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
uint256 defaultValue = 10;
bytes32 defaultKey =
keccak256(abi.encode(ADDRESS1, ADDRESS2, defaultValue));
diff --git a/test/RuleConditionalTransfer/RuleConditionalTransferAccessControl.t.sol b/test/RuleConditionalTransfer/RuleConditionalTransferAccessControl.t.sol
index fc59416..8054259 100644
--- a/test/RuleConditionalTransfer/RuleConditionalTransferAccessControl.t.sol
+++ b/test/RuleConditionalTransfer/RuleConditionalTransferAccessControl.t.sol
@@ -4,23 +4,14 @@ pragma solidity ^0.8.20;
import "forge-std/Test.sol";
import "../HelperContract.sol";
import "src/RuleEngine.sol";
+import "./RuleCTDeployment.sol";
/**
* @title Tests on the Access Control
*/
contract RuleConditionalTransferAccessControl is Test, HelperContract {
- RuleEngine ruleEngineMock;
// Custom error openZeppelin
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
uint256 defaultValue = 10;
bytes32 defaultKey =
keccak256(abi.encode(ADDRESS1, ADDRESS2, defaultValue));
@@ -31,51 +22,13 @@ contract RuleConditionalTransferAccessControl is Test, HelperContract {
to: ADDRESS2,
value: defaultValue
});
+ RuleCTDeployment ruleCTDeployment;
// Arrange
function setUp() public {
- TIME_LIMIT memory timeLimit_ = TIME_LIMIT({
- timeLimitToApprove: 7 days,
- timeLimitToTransfer: 30 days
- });
-
- AUTOMATIC_APPROVAL memory automaticApproval_ = AUTOMATIC_APPROVAL({
- isActivate: false,
- timeLimitBeforeAutomaticApproval: 0
- });
-
- ISSUANCE memory issuanceOption_ = ISSUANCE({
- authorizedMintWithoutApproval: false,
- authorizedBurnWithoutApproval: false
- });
- AUTOMATIC_TRANSFER memory automaticTransfer_ = AUTOMATIC_TRANSFER({
- isActivate: false,
- cmtat: IERC20(address(0))
- });
-
- OPTION memory options = OPTION({
- issuance: issuanceOption_,
- timeLimit: timeLimit_,
- automaticApproval: automaticApproval_,
- automaticTransfer: automaticTransfer_
- });
- ruleEngineMock = new RuleEngine(
- RULE_ENGINE_OPERATOR_ADDRESS,
- ZERO_ADDRESS,
- ZERO_ADDRESS
- );
- vm.prank(DEFAULT_ADMIN_ADDRESS);
- ruleConditionalTransfer = new RuleConditionalTransfer(
- DEFAULT_ADMIN_ADDRESS,
- ZERO_ADDRESS,
- ruleEngineMock,
- options
- );
- vm.prank(DEFAULT_ADMIN_ADDRESS);
- ruleConditionalTransfer.grantRole(
- RULE_CONDITIONAL_TRANSFER_OPERATOR_ROLE,
- CONDITIONAL_TRANSFER_OPERATOR_ADDRESS
- );
+ ruleCTDeployment = new RuleCTDeployment();
+ ruleEngineMock = ruleCTDeployment.ruleEngineMock();
+ ruleConditionalTransfer = ruleCTDeployment.ruleConditionalTransfer();
}
function _createTransferRequest() internal {
diff --git a/test/RuleConditionalTransfer/RuleConditionalTransferDeployment.t.sol b/test/RuleConditionalTransfer/RuleConditionalTransferDeployment.t.sol
new file mode 100644
index 0000000..954ba40
--- /dev/null
+++ b/test/RuleConditionalTransfer/RuleConditionalTransferDeployment.t.sol
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: MPL-2.0
+pragma solidity ^0.8.20;
+
+import "forge-std/Test.sol";
+import "../HelperContract.sol";
+import "src/RuleEngine.sol";
+import "./RuleCTDeployment.sol";
+
+/**
+ * @title General functions of the RuleWhitelist
+ */
+contract RuleConditionalTransferDeploymentTest is Test, HelperContract {
+ RuleCTDeployment ruleCTDeployment;
+
+ // Arrange
+ function setUp() public {}
+
+ function testSetMaxLimitIfZeroForAutomaticApprovalAndAutomaticTransfer()
+ public
+ {
+ TIME_LIMIT memory timeLimit_ = TIME_LIMIT({
+ timeLimitToApprove: 7 days,
+ timeLimitToTransfer: 30 days
+ });
+
+ AUTOMATIC_APPROVAL memory automaticApproval_ = AUTOMATIC_APPROVAL({
+ isActivate: false,
+ timeLimitBeforeAutomaticApproval: 0
+ });
+
+ ISSUANCE memory issuanceOption_ = ISSUANCE({
+ authorizedMintWithoutApproval: false,
+ authorizedBurnWithoutApproval: false
+ });
+ AUTOMATIC_TRANSFER memory automaticTransfer_ = AUTOMATIC_TRANSFER({
+ isActivate: false,
+ cmtat: IERC20(address(0))
+ });
+
+ OPTION memory options = OPTION({
+ issuance: issuanceOption_,
+ timeLimit: timeLimit_,
+ automaticApproval: automaticApproval_,
+ automaticTransfer: automaticTransfer_
+ });
+ ruleEngineMock = new RuleEngine(
+ RULE_ENGINE_OPERATOR_ADDRESS,
+ ZERO_ADDRESS,
+ ZERO_ADDRESS
+ );
+ // Test 1
+ vm.prank(DEFAULT_ADMIN_ADDRESS);
+ vm.expectRevert(
+ abi.encodeWithSelector(
+ RuleConditionalTransfer_AdminWithAddressZeroNotAllowed.selector
+ )
+ );
+ ruleConditionalTransfer = new RuleConditionalTransfer(
+ ZERO_ADDRESS,
+ ZERO_ADDRESS,
+ ruleEngineMock,
+ options
+ );
+
+ // Test 2
+ ruleCTDeployment = new RuleCTDeployment();
+ ruleConditionalTransfer = ruleCTDeployment.ruleConditionalTransfer();
+ ISSUANCE memory issuance;
+ TIME_LIMIT memory timeLimit;
+ AUTOMATIC_APPROVAL memory automaticApproval;
+ AUTOMATIC_TRANSFER memory automaticTransfer;
+ (
+ issuance,
+ timeLimit,
+ automaticApproval,
+ automaticTransfer
+ ) = ruleConditionalTransfer.options();
+ assertEq(timeLimit.timeLimitToApprove, 7 days);
+ assertEq(timeLimit.timeLimitToTransfer, 30 days);
+ }
+}
diff --git a/test/RuleConditionalTransfer/RuleConditionalTransferReset.t.sol b/test/RuleConditionalTransfer/RuleConditionalTransferReset.t.sol
index 9ca291f..139aa81 100644
--- a/test/RuleConditionalTransfer/RuleConditionalTransferReset.t.sol
+++ b/test/RuleConditionalTransfer/RuleConditionalTransferReset.t.sol
@@ -9,13 +9,6 @@ import "src/RuleEngine.sol";
* @title General functions of the RuleWhitelist
*/
contract RuleConditionalTransferResetTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
uint256 defaultValue = 10;
bytes32 defaultKey =
keccak256(abi.encode(ADDRESS1, ADDRESS2, defaultValue));
diff --git a/test/RuleConditionalTransfer/RuleConditionalTransferRestriction.t.sol b/test/RuleConditionalTransfer/RuleConditionalTransferRestriction.t.sol
index 389843d..4c6be2f 100644
--- a/test/RuleConditionalTransfer/RuleConditionalTransferRestriction.t.sol
+++ b/test/RuleConditionalTransfer/RuleConditionalTransferRestriction.t.sol
@@ -10,12 +10,6 @@ import "src/RuleEngine.sol";
* @title General functions of the RuleEngine
*/
contract RuleEngineOperationTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
uint256 defaultValue = 20;
TIME_LIMIT timeLimit_ =
diff --git a/test/RuleEngine/AccessControl/RuleEngineAccessControl.sol b/test/RuleEngine/AccessControl/RuleEngineAccessControl.sol
index 940e6b5..4ceb246 100644
--- a/test/RuleEngine/AccessControl/RuleEngineAccessControl.sol
+++ b/test/RuleEngine/AccessControl/RuleEngineAccessControl.sol
@@ -11,12 +11,6 @@ import "src/RuleEngine.sol";
contract RuleEngineAccessControlTest is Test, HelperContract {
// Custom error openZeppelin
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
// Arrange
function setUp() public {
diff --git a/test/RuleEngine/AccessControl/RuleEngineAccessControlOZ.t.sol b/test/RuleEngine/AccessControl/RuleEngineAccessControlOZ.t.sol
index ef3d354..1bfe450 100644
--- a/test/RuleEngine/AccessControl/RuleEngineAccessControlOZ.t.sol
+++ b/test/RuleEngine/AccessControl/RuleEngineAccessControlOZ.t.sol
@@ -10,13 +10,6 @@ import "src/RuleEngine.sol";
* @title Tests on the provided functions by OpenZeppelin
*/
contract RuleEngineAccessControlTest is Test, HelperContract, AccessControl {
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
// Arrange
function setUp() public {
ruleWhitelist = new RuleWhitelist(
diff --git a/test/RuleEngine/RuleEngineDeployment.t.sol b/test/RuleEngine/RuleEngineDeployment.t.sol
index 258d75e..67b27d4 100644
--- a/test/RuleEngine/RuleEngineDeployment.t.sol
+++ b/test/RuleEngine/RuleEngineDeployment.t.sol
@@ -11,13 +11,6 @@ import "src/RuleEngine.sol";
* @title General functions of the RuleEngine
*/
contract RuleEngineTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
// Arrange
function setUp() public {}
diff --git a/test/RuleEngine/ruleEngineOperation/RuleEngineOperation.t.sol b/test/RuleEngine/ruleEngineOperation/RuleEngineOperation.t.sol
index 0b535f0..efc1f60 100644
--- a/test/RuleEngine/ruleEngineOperation/RuleEngineOperation.t.sol
+++ b/test/RuleEngine/ruleEngineOperation/RuleEngineOperation.t.sol
@@ -5,18 +5,10 @@ import "forge-std/Test.sol";
import "../../HelperContract.sol";
import "src/RuleEngine.sol";
-//ADmin, forwarder irrect /RuleEngine
/**
* @title General functions of the RuleEngine
*/
contract RuleEngineOperationTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
TIME_LIMIT timeLimit_ =
TIME_LIMIT({
timeLimitToApprove: DEFAULT_TIME_LIMIT_TO_APPROVE,
diff --git a/test/RuleEngine/ruleEngineOperation/RuleEngineRestriction.t.sol b/test/RuleEngine/ruleEngineOperation/RuleEngineRestriction.t.sol
index 1f052a3..a5aadee 100644
--- a/test/RuleEngine/ruleEngineOperation/RuleEngineRestriction.t.sol
+++ b/test/RuleEngine/ruleEngineOperation/RuleEngineRestriction.t.sol
@@ -10,12 +10,6 @@ import "src/RuleEngine.sol";
* @title General functions of the RuleEngine
*/
contract RuleEngineOperationTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
uint256 defaultValue = 20;
TIME_LIMIT timeLimit_ =
diff --git a/test/RuleEngine/ruleEngineValidation/RuleEngineRestriction.t.sol b/test/RuleEngine/ruleEngineValidation/RuleEngineRestriction.t.sol
index f6d10a7..12a1be7 100644
--- a/test/RuleEngine/ruleEngineValidation/RuleEngineRestriction.t.sol
+++ b/test/RuleEngine/ruleEngineValidation/RuleEngineRestriction.t.sol
@@ -9,12 +9,6 @@ import "src/RuleEngine.sol";
* @title tests concerning the restrictions and validation for the transfers
*/
contract RuleEngineRestrictionTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
RuleWhitelist ruleWhitelist1;
// Arrange
diff --git a/test/RuleEngine/ruleEngineValidation/RuleEngineValidation.t.sol b/test/RuleEngine/ruleEngineValidation/RuleEngineValidation.t.sol
index 896a054..f39585e 100644
--- a/test/RuleEngine/ruleEngineValidation/RuleEngineValidation.t.sol
+++ b/test/RuleEngine/ruleEngineValidation/RuleEngineValidation.t.sol
@@ -9,13 +9,6 @@ import "src/RuleEngine.sol";
* @title General functions of the RuleEngine
*/
contract RuleEngineValidationTest is Test, HelperContract {
- RuleEngine ruleEngineMock;
- uint8 resUint8;
- uint256 resUint256;
- bool resBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
// Arrange
function setUp() public {
ruleWhitelist = new RuleWhitelist(
diff --git a/test/RuleSanctionList/RuleSanctionListAddTest.t.sol b/test/RuleSanctionList/RuleSanctionListAddTest.t.sol
index e7f0043..5e38475 100644
--- a/test/RuleSanctionList/RuleSanctionListAddTest.t.sol
+++ b/test/RuleSanctionList/RuleSanctionListAddTest.t.sol
@@ -12,13 +12,6 @@ import "../utils/SanctionListOracle.sol";
contract RuleSanctionlistAddTest is Test, HelperContract {
// Custom error openZeppelin
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
-
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
SanctionListOracle sanctionlistOracle;
RuleSanctionList ruleSanctionList;
@@ -42,7 +35,10 @@ contract RuleSanctionlistAddTest is Test, HelperContract {
SanctionsList sanctionListOracleGet = ruleSanctionList.sanctionsList();
// Assert
- vm.assertEq(address(sanctionListOracleGet), address(sanctionlistOracle));
+ vm.assertEq(
+ address(sanctionListOracleGet),
+ address(sanctionlistOracle)
+ );
// Remove
vm.prank(SANCTIONLIST_OPERATOR_ADDRESS);
emit SetSanctionListOracle(ZERO_ADDRESS);
diff --git a/test/RuleSanctionList/RuleSanctionListDeploymentTest.t.sol b/test/RuleSanctionList/RuleSanctionListDeploymentTest.t.sol
index 0690eba..99870f4 100644
--- a/test/RuleSanctionList/RuleSanctionListDeploymentTest.t.sol
+++ b/test/RuleSanctionList/RuleSanctionListDeploymentTest.t.sol
@@ -10,14 +10,10 @@ import "../utils/SanctionListOracle.sol";
* @title General functions of the ruleSanctionList
*/
contract RuleSanctionListDeploymentTest is Test, HelperContract {
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
RuleSanctionList ruleSanctionList;
SanctionListOracle sanctionlistOracle;
+ event Testa();
+
// Arrange
function setUp() public {}
@@ -29,7 +25,7 @@ contract RuleSanctionListDeploymentTest is Test, HelperContract {
vm.prank(SANCTIONLIST_OPERATOR_ADDRESS);
ruleSanctionList = new RuleSanctionList(
SANCTIONLIST_OPERATOR_ADDRESS,
- address(forwarder),
+ address(forwarder),
ZERO_ADDRESS
);
@@ -52,17 +48,27 @@ contract RuleSanctionListDeploymentTest is Test, HelperContract {
RuleSanctionList_AdminWithAddressZeroNotAllowed.selector
);
vm.prank(SANCTIONLIST_OPERATOR_ADDRESS);
- ruleSanctionList = new RuleSanctionList(address(0), address(forwarder), ZERO_ADDRESS);
+ ruleSanctionList = new RuleSanctionList(
+ address(0),
+ address(forwarder),
+ ZERO_ADDRESS
+ );
}
function testCanSetAnOracleAtDeployment() public {
sanctionlistOracle = new SanctionListOracle();
vm.prank(SANCTIONLIST_OPERATOR_ADDRESS);
+ // TODO: Event seems not checked by Foundry at deployment
emit SetSanctionListOracle(address(sanctionlistOracle));
+
ruleSanctionList = new RuleSanctionList(
- SANCTIONLIST_OPERATOR_ADDRESS,
- address(0x0),
- ZERO_ADDRESS
- );
- }
+ SANCTIONLIST_OPERATOR_ADDRESS,
+ ZERO_ADDRESS,
+ address(sanctionlistOracle)
+ );
+ assertEq(
+ address(ruleSanctionList.sanctionsList()),
+ address(sanctionlistOracle)
+ );
+ }
}
diff --git a/test/RuleSanctionList/RuleSanctionListTest.t.sol b/test/RuleSanctionList/RuleSanctionListTest.t.sol
index 7e146a1..749e950 100644
--- a/test/RuleSanctionList/RuleSanctionListTest.t.sol
+++ b/test/RuleSanctionList/RuleSanctionListTest.t.sol
@@ -10,12 +10,6 @@ import "../utils/SanctionListOracle.sol";
* @title General functions of the ruleSanctionList
*/
contract RuleSanctionlistTest is Test, HelperContract {
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
SanctionListOracle sanctionlistOracle;
RuleSanctionList ruleSanctionList;
diff --git a/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControl.t.sol b/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControl.t.sol
index f29768e..c87e62b 100644
--- a/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControl.t.sol
+++ b/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControl.t.sol
@@ -11,15 +11,6 @@ import "src/RuleEngine.sol";
contract RuleWhitelistAccessControl is Test, HelperContract {
// Custom error openZeppelin
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
// Arrange
function setUp() public {
diff --git a/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControlOZ.t.sol b/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControlOZ.t.sol
index 0b507df..4aacfac 100644
--- a/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControlOZ.t.sol
+++ b/test/RuleWhitelist/AccessControl/RuleWhitelistAccessControlOZ.t.sol
@@ -10,16 +10,6 @@ import "src/RuleEngine.sol";
* @title Tests on the provided functions by OpenZeppelin
*/
contract RuleWhitelistAccessControlOZ is Test, HelperContract, AccessControl {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
// Arrange
function setUp() public {
vm.prank(WHITELIST_OPERATOR_ADDRESS);
diff --git a/test/RuleWhitelist/CMTATIntegration.t.sol b/test/RuleWhitelist/CMTATIntegration.t.sol
index b91265b..f0c9274 100644
--- a/test/RuleWhitelist/CMTATIntegration.t.sol
+++ b/test/RuleWhitelist/CMTATIntegration.t.sol
@@ -10,14 +10,6 @@ import "src/RuleEngine.sol";
* @title Integration test with the CMTAT
*/
contract CMTATIntegration is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
-
- RuleEngine ruleEngineMock;
- uint256 resUint256;
- bool resBool;
-
uint256 ADDRESS1_BALANCE_INIT = 31;
uint256 ADDRESS2_BALANCE_INIT = 32;
uint256 ADDRESS3_BALANCE_INIT = 33;
@@ -29,21 +21,8 @@ contract CMTATIntegration is Test, HelperContract {
vm.prank(DEFAULT_ADMIN_ADDRESS);
ruleWhitelist = new RuleWhitelist(DEFAULT_ADMIN_ADDRESS, ZERO_ADDRESS);
// global arrange
- uint8 decimals = 0;
- vm.prank(DEFAULT_ADMIN_ADDRESS);
- CMTAT_CONTRACT = new CMTAT_STANDALONE(
- ZERO_ADDRESS,
- DEFAULT_ADMIN_ADDRESS,
- IAuthorizationEngine(address(0)),
- "CMTA Token",
- "CMTAT",
- decimals,
- "CMTAT_ISIN",
- "https://cmta.ch",
- IRuleEngine(address(0)),
- "CMTAT_info",
- FLAG
- );
+ cmtatDeployment = new CMTATDeployment();
+ CMTAT_CONTRACT = cmtatDeployment.cmtat();
// specific arrange
vm.prank(DEFAULT_ADMIN_ADDRESS);
diff --git a/test/RuleWhitelist/CMTATIntegrationWhitelistWrapper.t.sol b/test/RuleWhitelist/CMTATIntegrationWhitelistWrapper.t.sol
index e6dc0e9..4b7f4a8 100644
--- a/test/RuleWhitelist/CMTATIntegrationWhitelistWrapper.t.sol
+++ b/test/RuleWhitelist/CMTATIntegrationWhitelistWrapper.t.sol
@@ -10,14 +10,6 @@ import "src/RuleEngine.sol";
* @title Integration test with the CMTAT
*/
contract CMTATIntegrationWhitelistWrapper is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
-
- RuleEngine ruleEngineMock;
- uint256 resUint256;
- bool resBool;
-
uint256 ADDRESS1_BALANCE_INIT = 31;
uint256 ADDRESS2_BALANCE_INIT = 32;
uint256 ADDRESS3_BALANCE_INIT = 33;
@@ -44,22 +36,8 @@ contract CMTATIntegrationWhitelistWrapper is Test, HelperContract {
vm.prank(DEFAULT_ADMIN_ADDRESS);
ruleWhitelistWrapper.addRuleValidation(ruleWhitelist3);
// global arrange
- uint8 decimals = 0;
- vm.prank(DEFAULT_ADMIN_ADDRESS);
- CMTAT_CONTRACT = new CMTAT_STANDALONE(
- ZERO_ADDRESS,
- DEFAULT_ADMIN_ADDRESS,
- IAuthorizationEngine(address(0)),
- "CMTA Token",
- "CMTAT",
- decimals,
- "CMTAT_ISIN",
- "https://cmta.ch",
- IRuleEngine(address(0)),
- "CMTAT_info",
- FLAG
- );
-
+ cmtatDeployment = new CMTATDeployment();
+ CMTAT_CONTRACT = cmtatDeployment.cmtat();
// specific arrange
vm.prank(DEFAULT_ADMIN_ADDRESS);
ruleEngineMock = new RuleEngine(
@@ -80,6 +58,17 @@ contract CMTATIntegrationWhitelistWrapper is Test, HelperContract {
CMTAT_CONTRACT.setRuleEngine(ruleEngineMock);
}
+ /******* Deployment *******/
+
+ function testCannotDeployContractIfAdminAddressIsZero() public {
+ vm.prank(WHITELIST_OPERATOR_ADDRESS);
+ vm.expectRevert(RuleEngine_AdminWithAddressZeroNotAllowed.selector);
+ ruleWhitelistWrapper = new RuleWhitelistWrapper(
+ ZERO_ADDRESS,
+ ZERO_ADDRESS
+ );
+ }
+
/******* Transfer *******/
function testCannotTransferWithoutAddressWhitelisted() public {
// Arrange
diff --git a/test/RuleWhitelist/RuleWhitelist.t.sol b/test/RuleWhitelist/RuleWhitelist.t.sol
index d4734ef..15ebc52 100644
--- a/test/RuleWhitelist/RuleWhitelist.t.sol
+++ b/test/RuleWhitelist/RuleWhitelist.t.sol
@@ -9,13 +9,6 @@ import "src/RuleEngine.sol";
* @title General functions of the RuleWhitelist
*/
contract RuleWhitelistTest is Test, HelperContract {
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
// Arrange
function setUp() public {
vm.prank(WHITELIST_OPERATOR_ADDRESS);
diff --git a/test/RuleWhitelist/RuleWhitelistAdd.t.sol b/test/RuleWhitelist/RuleWhitelistAdd.t.sol
index bbd3a97..6cadac7 100644
--- a/test/RuleWhitelist/RuleWhitelistAdd.t.sol
+++ b/test/RuleWhitelist/RuleWhitelistAdd.t.sol
@@ -9,16 +9,6 @@ import "src/RuleEngine.sol";
* @title Tests the functions to add addresses to the whitelist
*/
contract RuleWhitelistAddTest is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
// Arrange
function setUp() public {
vm.prank(WHITELIST_OPERATOR_ADDRESS);
diff --git a/test/RuleWhitelist/RuleWhitelistDeployment.t.sol b/test/RuleWhitelist/RuleWhitelistDeployment.t.sol
index 3c4c296..9f3b11f 100644
--- a/test/RuleWhitelist/RuleWhitelistDeployment.t.sol
+++ b/test/RuleWhitelist/RuleWhitelistDeployment.t.sol
@@ -9,14 +9,7 @@ import "CMTAT/mocks/MinimalForwarderMock.sol";
/**
* @title General functions of the RuleWhitelist
*/
-contract RuleWhitelistTest is Test, HelperContract {
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
+contract RuleWhitelistDeploymentTest is Test, HelperContract {
// Arrange
function setUp() public {}
diff --git a/test/RuleWhitelist/RuleWhitelistRemove.t.sol b/test/RuleWhitelist/RuleWhitelistRemove.t.sol
index ebc9398..0da5d26 100644
--- a/test/RuleWhitelist/RuleWhitelistRemove.t.sol
+++ b/test/RuleWhitelist/RuleWhitelistRemove.t.sol
@@ -9,17 +9,6 @@ import "src/RuleEngine.sol";
* @title Tests the functions to remove addresses from the whitelist
*/
contract RuleWhitelistRemoveTest is Test, HelperContract {
- // Defined in CMTAT.sol
- uint8 constant TRANSFER_OK = 0;
- string constant TEXT_TRANSFER_OK = "No restriction";
-
- uint256 resUint256;
- uint8 resUint8;
- bool resBool;
- bool resCallBool;
- string resString;
- uint8 CODE_NONEXISTENT = 255;
-
// Arrange
function setUp() public {
vm.prank(WHITELIST_OPERATOR_ADDRESS);
diff --git a/test/utils/CMTATDeployment.sol b/test/utils/CMTATDeployment.sol
new file mode 100644
index 0000000..c8b5393
--- /dev/null
+++ b/test/utils/CMTATDeployment.sol
@@ -0,0 +1,44 @@
+//SPDX-License-Identifier: MPL-2.0
+pragma solidity ^0.8.20;
+
+import "forge-std/Test.sol";
+import "OZ/access/AccessControl.sol";
+import "CMTAT/CMTAT_STANDALONE.sol";
+
+contract CMTATDeployment {
+ // Share with helper contract
+ address constant ZERO_ADDRESS = address(0);
+ address constant DEFAULT_ADMIN_ADDRESS = address(1);
+
+ CMTAT_STANDALONE public cmtat;
+
+ constructor() {
+ // CMTAT
+ ICMTATConstructor.ERC20Attributes
+ memory erc20Attributes = ICMTATConstructor.ERC20Attributes(
+ "CMTA Token",
+ "CMTAT",
+ 0
+ );
+ ICMTATConstructor.BaseModuleAttributes
+ memory baseModuleAttributes = ICMTATConstructor
+ .BaseModuleAttributes(
+ "CMTAT_ISIN",
+ "https://cmta.ch",
+ "CMTAT_info"
+ );
+ ICMTATConstructor.Engine memory engines = ICMTATConstructor.Engine(
+ IRuleEngine(ZERO_ADDRESS),
+ IDebtEngine(ZERO_ADDRESS),
+ IAuthorizationEngine(ZERO_ADDRESS),
+ IERC1643(ZERO_ADDRESS)
+ );
+ cmtat = new CMTAT_STANDALONE(
+ ZERO_ADDRESS,
+ DEFAULT_ADMIN_ADDRESS,
+ erc20Attributes,
+ baseModuleAttributes,
+ engines
+ );
+ }
+}