This project is not audited ! It is provided to show an example of a possible AuthorizationEngine as defined in the CMTAT.
If you want to use this project, perform your own verification or send an email to admin@cmta.ch.
This AuthorizationEngine
adds a supplementary check on the function grantRole
from the CMTAT
-
Enforces a 2-step process to transfer the
DEFAULT_ADMIN_ROLE
to another account. -
Enforces a configurable delay between the two steps, with the ability to cancel before the transfer is accepted.
-
The delay can be changed by scheduling, see
changeDefaultAdminDelay
.
The behavior and the code (under MIT License) come mainly from the OpenZeppelin version AcessControlDefaultAdminRule
.
Nevertheless, contrary to OpenZeppelin, these checks are NOT performed:
-
Only one account holds the
DEFAULT_ADMIN_ROLE
since deployment until it’s potentially renounced. -
It is not possible to use another role to manage the
DEFAULT_ADMIN_ROLE
.
See https://docs.openzeppelin.com/contracts/5.x/api/access#AccessControlDefaultAdminRules
Here a summary of the main documentation
Document | Link/Files |
---|---|
Technical documentation | doc/technical |
Toolchain | doc/TOOLCHAIN.md |
Surya report | doc/surya |
Explain how it works.
The contracts are developed and tested with Foundry, a smart contract development toolchain.
To install the Foundry suite, please refer to the official instructions in the Foundry book.
You must first initialize the submodules, with
forge install
See also the command's documentation.
Later you can update all the submodules with:
forge update
See also the command's documentation.
The official documentation is available in the Foundry website
forge build --contracts src/AuthorizationEngine.sol
You can run the tests with
forge test
To run a specific test, use
forge test --match-contract <contract name> --match-test <function name>
See also the test framework's official documentation, and that of the test commands.
- Perform a code coverage
forge coverage
- Generate LCOV report
forge coverage --report lcov
- Generate
index.html
forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage
See Solidity Coverage in VS Code with Foundry & Foundry forge coverage