diff --git a/.gitignore b/.gitignore index 4d39e1d4..4ec8db2f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules build coverage coverage.json +bin/* #exception !doc/general/test/coverage /.openzeppelin diff --git a/contracts/libraries/Errors.sol b/contracts/libraries/Errors.sol index 3f3eaad9..cd7801a8 100644 --- a/contracts/libraries/Errors.sol +++ b/contracts/libraries/Errors.sol @@ -28,9 +28,6 @@ library Errors { error CMTAT_SnapshotModule_NoSnapshotScheduled(); error CMTAT_SnapshotModule_SnapshotNotFound(); - // OnlyDelegateCallModule - error CMTAT_OnlyDelegateCallModule_DirectCallToImplementation(); - // ERC20BaseModule error CMTAT_ERC20BaseModule_WrongAllowance( address spender, @@ -61,4 +58,7 @@ library Errors { // AuthorizationModule error CMTAT_AuthorizationModule_AddressZeroNotAllowed(); + + // PauseModule + error CMTAT_PauseModule_ContractIsDeactivated(); } diff --git a/contracts/modules/CMTAT_BASE.sol b/contracts/modules/CMTAT_BASE.sol index 4a5f21bf..7903d2e8 100644 --- a/contracts/modules/CMTAT_BASE.sol +++ b/contracts/modules/CMTAT_BASE.sol @@ -16,12 +16,12 @@ SnapshotModule: Add this import in case you add the SnapshotModule import "./wrapper/optional/SnapshotModule.sol"; */ -import "./wrapper/mandatory/PauseModule.sol"; import "./wrapper/optional/ValidationModule.sol"; import "./wrapper/optional/MetaTxModule.sol"; import "./wrapper/optional/DebtModule/DebtBaseModule.sol"; import "./wrapper/optional/DebtModule/CreditEventsModule.sol"; import "./security/AuthorizationModule.sol"; +import "./security/PauseModule.sol"; import "../interfaces/IEIP1404/IEIP1404Wrapper.sol"; import "../libraries/Errors.sol"; diff --git a/contracts/modules/security/OnlyDelegateCallModule.sol b/contracts/modules/security/OnlyDelegateCallModule.sol deleted file mode 100644 index a7e61b92..00000000 --- a/contracts/modules/security/OnlyDelegateCallModule.sol +++ /dev/null @@ -1,28 +0,0 @@ -//SPDX-License-Identifier: MPL-2.0 - -pragma solidity ^0.8.20; - -import "../../libraries/Errors.sol"; - -/** -@dev When a contract is deployed with a proxy, insure that some functions (e.g. delegatecall and selfdestruct) can only be triggered through proxies -and not on the implementation contract itself. -*/ -abstract contract OnlyDelegateCallModule { - /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment - address private immutable self = address(this); - - function checkDelegateCall() private view { - if (address(this) == self) { - revert Errors - .CMTAT_OnlyDelegateCallModule_DirectCallToImplementation(); - } - } - - modifier onlyDelegateCall(bool deployedWithProxy) { - if (deployedWithProxy) { - checkDelegateCall(); - } - _; - } -} diff --git a/contracts/modules/wrapper/mandatory/PauseModule.sol b/contracts/modules/security/PauseModule.sol similarity index 51% rename from contracts/modules/wrapper/mandatory/PauseModule.sol rename to contracts/modules/security/PauseModule.sol index 08deed33..ee39ce16 100644 --- a/contracts/modules/wrapper/mandatory/PauseModule.sol +++ b/contracts/modules/security/PauseModule.sol @@ -2,12 +2,15 @@ pragma solidity ^0.8.20; -import "../../../../openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol"; -import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; -import "../../security/AuthorizationModule.sol"; +import "../../../openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol"; +import "../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; +import "./AuthorizationModule.sol"; /** - * @dev ERC20 token with pausable token transfers, minting and burning. + * + * @dev Put in pause or deactivate the contract + * The issuer must be able to “pause” the smart contract, + * to prevent execution of transactions on the distributed ledger until the issuer puts an end to the pause. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the @@ -16,6 +19,8 @@ import "../../security/AuthorizationModule.sol"; abstract contract PauseModule is PausableUpgradeable, AuthorizationModule { string internal constant TEXT_TRANSFER_REJECTED_PAUSED = "All transfers paused"; + bool private isDeactivated; + event Deactivated(address account); function __PauseModule_init(address admin, uint48 initialDelayToAcceptAdminRole) internal onlyInitializing { /* OpenZeppelin */ @@ -39,30 +44,58 @@ abstract contract PauseModule is PausableUpgradeable, AuthorizationModule { } /** - * @dev Pauses all token transfers. - * - * See {ERC20Pausable} and {Pausable-_pause}. + * @notice Pauses all token transfers. + * @dev See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. + * */ function pause() public onlyRole(PAUSER_ROLE) { _pause(); } /** - * @dev Unpauses all token transfers. - * - * See {ERC20Pausable} and {Pausable-_unpause}. + * @notice Unpauses all token transfers. + * @dev See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public onlyRole(PAUSER_ROLE) { + if(isDeactivated){ + revert Errors.CMTAT_PauseModule_ContractIsDeactivated(); + } _unpause(); } + /** + * @notice deactivate the contract + * Warning: the operation is irreversible, be careful + * @dev + * Emits a {Deactivated} event indicating that the contract has been deactivated. + * Requirements: + * + * - the caller must have the `DEFAULT_ADMIN_ROLE`. + */ + /// @custom:oz-upgrades-unsafe-allow selfdestruct + function deactivateContract() + public + onlyRole(DEFAULT_ADMIN_ROLE) + { + isDeactivated = true; + _pause(); + emit Deactivated(_msgSender()); + } + + /** + * @notice Returns true if the contract is deactivated, and false otherwise. + */ + function deactivated() view public returns (bool){ + return isDeactivated; + } + uint256[50] private __gap; } diff --git a/contracts/modules/wrapper/mandatory/BaseModule.sol b/contracts/modules/wrapper/mandatory/BaseModule.sol index 6275643b..bfbdeb82 100644 --- a/contracts/modules/wrapper/mandatory/BaseModule.sol +++ b/contracts/modules/wrapper/mandatory/BaseModule.sol @@ -5,11 +5,9 @@ pragma solidity ^0.8.20; // required OZ imports here import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; import "../../security/AuthorizationModule.sol"; -import "../../security/OnlyDelegateCallModule.sol"; - import "../../../libraries/Errors.sol"; -abstract contract BaseModule is AuthorizationModule, OnlyDelegateCallModule { +abstract contract BaseModule is AuthorizationModule { // to initialize inside the implementation constructor when deployed with a Proxy bool internal deployedWithProxy; /* Events */ @@ -27,6 +25,7 @@ abstract contract BaseModule is AuthorizationModule, OnlyDelegateCallModule { string public information; uint256 public flag; + /* Initializers */ /** * @dev Sets the values for {name} and {symbol}. @@ -110,18 +109,5 @@ abstract contract BaseModule is AuthorizationModule, OnlyDelegateCallModule { emit Flag(flag_); } - /** - @notice destroys the contract and send the remaining ethers in the contract to the sender - Warning: the operation is irreversible, be careful - */ - /// @custom:oz-upgrades-unsafe-allow selfdestruct - function kill() - public - onlyRole(DEFAULT_ADMIN_ROLE) - onlyDelegateCall(deployedWithProxy) - { - selfdestruct(payable(_msgSender())); - } - uint256[50] private __gap; } diff --git a/contracts/modules/wrapper/optional/ValidationModule.sol b/contracts/modules/wrapper/optional/ValidationModule.sol index 628ca7b5..6e10fca4 100644 --- a/contracts/modules/wrapper/optional/ValidationModule.sol +++ b/contracts/modules/wrapper/optional/ValidationModule.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.20; import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; import "../../security/AuthorizationModule.sol"; import "../../internal/ValidationModuleInternal.sol"; -import "../mandatory/PauseModule.sol"; +import "../../security/PauseModule.sol"; import "../mandatory/EnforcementModule.sol"; import "../../../libraries/Errors.sol"; diff --git a/contracts/test/CMTATSnapshot/CMTAT_BASE_SnapshotTest.sol b/contracts/test/CMTATSnapshot/CMTAT_BASE_SnapshotTest.sol index d14fe6ee..1b943976 100644 --- a/contracts/test/CMTATSnapshot/CMTAT_BASE_SnapshotTest.sol +++ b/contracts/test/CMTATSnapshot/CMTAT_BASE_SnapshotTest.sol @@ -16,12 +16,12 @@ SnapshotModule: Add this import in case you add the SnapshotModule */ import "../../modules/wrapper/optional/SnapshotModule.sol"; -import "../../modules/wrapper/mandatory/PauseModule.sol"; import "../../modules/wrapper/optional/ValidationModule.sol"; import "../../modules/wrapper/optional/MetaTxModule.sol"; import "../../modules/wrapper/optional/DebtModule/DebtBaseModule.sol"; import "../../modules/wrapper/optional/DebtModule/CreditEventsModule.sol"; import "../../modules/security/AuthorizationModule.sol"; +import "../../modules/security/PauseModule.sol"; import "../../interfaces/IEIP1404/IEIP1404Wrapper.sol"; import "../../libraries/Errors.sol"; diff --git a/contracts/test/killTest/BaseModuleTest.sol b/contracts/test/killTest/BaseModuleTest.sol deleted file mode 100644 index 61704afa..00000000 --- a/contracts/test/killTest/BaseModuleTest.sol +++ /dev/null @@ -1,109 +0,0 @@ -//SPDX-License-Identifier: MPL-2.0 - -pragma solidity ^0.8.20; - -// required OZ imports here -import "../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; -import "../../modules/security/AuthorizationModule.sol"; -import "../../modules/security/OnlyDelegateCallModule.sol"; - -/** -@title A BaseModule version only for TESTING -@dev This version has removed the check of access control on the kill function -The only remaining protection is the call to the modifier onlyDelegateCall -*/ -abstract contract BaseModuleTest is - Initializable, - AuthorizationModule, - OnlyDelegateCallModule -{ - // @dev we removed the access control to check onlyDelegateCall - /// @custom:oz-upgrades-unsafe-allow selfdestruct - function kill() public onlyDelegateCall(deployedWithProxy) { - selfdestruct(payable(_msgSender())); - } - - //******* Code from BaseModule, not modified *******/ - - bool internal deployedWithProxy; - /* Events */ - event TermSet(string indexed newTerm); - event TokenIdSet(string indexed newTokenId); - event InformationSet(string indexed newInformation); - event FlagSet(uint256 indexed newFlag); - - /* Variables */ - string public tokenId; - string public terms; - string public information; - uint256 public flag; - - /* Initializers */ - /** - * @dev Sets the values for {name} and {symbol}. - * - * All two of these values are immutable: they can only be set once during - * construction. - */ - function __Base_init( - string memory tokenId_, - string memory terms_, - string memory information_, - uint256 flag_ - ) internal onlyInitializing { - /* OpenZeppelin */ - __Context_init_unchained(); - // AccessControlUpgradeable inherits from ERC165Upgradeable - __ERC165_init_unchained(); - // AuthorizationModule inherits from AccessControlUpgradeable - __AccessControl_init_unchained(); - - /* Wrapper */ - __AuthorizationModule_init_unchained(); - - - /* own function */ - __Base_init_unchained(tokenId_, terms_, information_, flag_); - } - - function __Base_init_unchained( - string memory tokenId_, - string memory terms_, - string memory information_, - uint256 flag_ - ) internal onlyInitializing { - tokenId = tokenId_; - terms = terms_; - information = information_; - flag = flag_; - } - - /* Methods */ - function setTokenId( - string calldata tokenId_ - ) public onlyRole(DEFAULT_ADMIN_ROLE) { - tokenId = tokenId_; - emit TokenIdSet(tokenId_); - } - - function setTerms( - string calldata terms_ - ) public onlyRole(DEFAULT_ADMIN_ROLE) { - terms = terms_; - emit TermSet(terms_); - } - - function setInformation( - string calldata information_ - ) public onlyRole(DEFAULT_ADMIN_ROLE) { - information = information_; - emit InformationSet(information_); - } - - function setFlag(uint256 flag_) public onlyRole(DEFAULT_ADMIN_ROLE) { - flag = flag_; - emit FlagSet(flag_); - } - - uint256[50] private __gap; -} diff --git a/contracts/test/killTest/CMTATKillTest.sol b/contracts/test/killTest/CMTATKillTest.sol deleted file mode 100644 index e63f4ffe..00000000 --- a/contracts/test/killTest/CMTATKillTest.sol +++ /dev/null @@ -1,230 +0,0 @@ -//SPDX-License-Identifier: MPL-2.0 - -pragma solidity ^0.8.20; - -// required OZ imports here -import "../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; -import "../../../openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol"; -import "./BaseModuleTest.sol"; -import "../../modules/wrapper/mandatory/BurnModule.sol"; -import "../../modules/wrapper/mandatory/MintModule.sol"; -import "../../modules/wrapper/mandatory/BurnModule.sol"; -import "../../modules/wrapper/mandatory/EnforcementModule.sol"; -import "../../modules/wrapper/mandatory/ERC20BaseModule.sol"; -import "../../modules/wrapper/mandatory/PauseModule.sol"; -// import "../../modules/wrapper/optional/SnapshotModule.sol"; -import "../../modules/wrapper/optional/ValidationModule.sol"; -import "../../modules/wrapper/optional/MetaTxModule.sol"; -import "../../modules/wrapper/optional/DebtModule/DebtBaseModule.sol"; -import "../../modules/wrapper/optional/DebtModule/CreditEventsModule.sol"; -import "../../modules/security/AuthorizationModule.sol"; -import "../../modules/security/OnlyDelegateCallModule.sol"; -import "../../interfaces/IEIP1404/IEIP1404Wrapper.sol"; - -import "../../libraries/Errors.sol"; - -/** -@title A CMTAT version only for TESTING -@dev This version inherits from BaseModuleTest instead of BaseModule -*/ -contract CMTAT_KILL_TEST is - Initializable, - ContextUpgradeable, - BaseModuleTest, - PauseModule, - MintModule, - BurnModule, - EnforcementModule, - ValidationModule, - MetaTxModule, - //SnapshotModule, - ERC20BaseModule, - DebtBaseModule, - CreditEventsModule -{ - // CMTAT_PROXY constructor - /** - @notice Contract version for the deployment with a proxy - @param forwarderIrrevocable address of the forwarder, required for the gasless support - */ - /// @custom:oz-upgrades-unsafe-allow constructor - constructor( - address forwarderIrrevocable - ) MetaTxModule(forwarderIrrevocable) { - // Initialize the variable for the implementation - deployedWithProxy = true; - // Disable the possibility to initialize the implementation - _disableInitializers(); - } - - /** - @notice - initialize the proxy contract - The calls to this function will revert if the contract was deployed without a proxy - */ - function initialize( - address admin, - uint48 initialDelayToAcceptAdminRole, - string memory nameIrrevocable, - string memory symbolIrrevocable, - uint8 decimalsIrrevocable, - string memory tokenId_, - string memory terms_, - IEIP1404Wrapper ruleEngine_, - string memory information_, - uint256 flag_ - ) public initializer { - __CMTAT_init( - admin, - initialDelayToAcceptAdminRole, - nameIrrevocable, - symbolIrrevocable, - decimalsIrrevocable, - tokenId_, - terms_, - ruleEngine_, - information_, - flag_ - ); - } - - /** - @dev calls the different initialize functions from the different modules - */ - function __CMTAT_init( - address admin, - uint48 initialDelayToAcceptAdminRole, - string memory nameIrrevocable, - string memory symbolIrrevocable, - uint8 decimalsIrrevocable, - string memory tokenId_, - string memory terms_, - IEIP1404Wrapper ruleEngine_, - string memory information_, - uint256 flag_ - ) internal onlyInitializing { - /* OpenZeppelin library */ - // OZ init_unchained functions are called firstly due to inheritance - __Context_init_unchained(); - __ERC20_init_unchained(nameIrrevocable, symbolIrrevocable); - // AccessControlUpgradeable inherits from ERC165Upgradeable - __ERC165_init_unchained(); - // AuthorizationModule inherits from AccessControlUpgradeable - __AccessControl_init_unchained(); - __AccessControlDefaultAdminRules_init_unchained(initialDelayToAcceptAdminRole, admin); - __Pausable_init_unchained(); - - /* Internal Modules */ - __Enforcement_init_unchained(); - /* - SnapshotModule: - Add this call in case you add the SnapshotModule - __Snapshot_init_unchained(); - */ - __Validation_init_unchained(ruleEngine_); - - /* Wrapper */ - // AuthorizationModule_init_unchained is called firstly due to inheritance - __AuthorizationModule_init_unchained(); - __BurnModule_init_unchained(); - __MintModule_init_unchained(); - // EnforcementModule_init_unchained is called before ValidationModule_init_unchained due to inheritance - __EnforcementModule_init_unchained(); - __ERC20Module_init_unchained(decimalsIrrevocable); - // PauseModule_init_unchained is called before ValidationModule_init_unchained due to inheritance - __PauseModule_init_unchained(); - __ValidationModule_init_unchained(); - - /* - SnapshotModule: - Add this call in case you add the SnapshotModule - __SnasphotModule_init_unchained(); - */ - - /* Other modules */ - __DebtBaseModule_init_unchained(); - __CreditEvents_init_unchained(); - __Base_init_unchained(tokenId_, terms_, information_, flag_); - - /* own function */ - __CMTAT_init_unchained(); - } - - function __CMTAT_init_unchained() internal onlyInitializing { - // no variable to initialize - } - - /** - @notice Returns the number of decimals used to get its user representation. - */ - function decimals() - public - view - virtual - override(ERC20Upgradeable, ERC20BaseModule) - returns (uint8) - { - return ERC20BaseModule.decimals(); - } - - function transferFrom( - address sender, - address recipient, - uint256 amount - ) - public - virtual - override(ERC20Upgradeable, ERC20BaseModule) - returns (bool) - { - return ERC20BaseModule.transferFrom(sender, recipient, amount); - } - - /* - @dev - SnapshotModule: - - override SnapshotModuleInternal if you add the SnapshotModule - e.g. override(SnapshotModuleInternal, ERC20Upgradeable) - - remove the keyword view - */ - function _update( - address from, - address to, - uint256 amount - ) internal view override(ERC20Upgradeable) { - if (!ValidationModule.validateTransfer(from, to, amount)) - revert Errors.CMTAT_InvalidTransfer(from, to, amount); - // We call the SnapshotModule only if the transfer is valid - /* - SnapshotModule: - Add this call in case you add the SnapshotModule - SnapshotModuleInternal._update(from, to, amount); - */ - } - - /** - @dev This surcharge is not necessary if you do not use the MetaTxModule - */ - function _msgSender() - internal - view - override(MetaTxModule, ContextUpgradeable) - returns (address sender) - { - return MetaTxModule._msgSender(); - } - - /** - @dev This surcharge is not necessary if you do not use the MetaTxModule - */ - function _msgData() - internal - view - override(MetaTxModule, ContextUpgradeable) - returns (bytes calldata) - { - return MetaTxModule._msgData(); - } - - uint256[50] private __gap; -} diff --git a/package-lock.json b/package-lock.json index 9596bf2a..612c0965 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ }, "devDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.4", + "@nomicfoundation/hardhat-network-helpers": "^1.0.8", "@nomiclabs/hardhat-truffle5": "^2.0.7", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/hardhat-upgrades": "^2.1.1", @@ -33,6 +34,8 @@ "ethereumjs-util": "^7.1.5", "ethjs-abi": "^0.2.1", "ethlint": "^1.2.5", + "hardhat-contract-sizer": "^2.10.0", + "hardhat-gas-reporter": "^1.0.9", "keccak256": "^1.0.6", "prettier": "^2.8.7", "prettier-plugin-solidity": "^1.1.3", @@ -2164,6 +2167,16 @@ "case": "^1.6.3" } }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, "node_modules/@ensdomains/address-encoder": { "version": "0.1.9", "license": "BSD", @@ -3827,6 +3840,18 @@ "hardhat": "^2.0.0" } }, + "node_modules/@nomicfoundation/hardhat-network-helpers": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.9.tgz", + "integrity": "sha512-OXWCv0cHpwLUO2u7bFxBna6dQtCC2Gg/aN/KtJLO7gmuuA28vgmVKYFRCDUqrbjujzgfwQ2aKyZ9Y3vSmDqS7Q==", + "dev": true, + "dependencies": { + "ethereumjs-util": "^7.1.4" + }, + "peerDependencies": { + "hardhat": "^2.9.5" + } + }, "node_modules/@nomicfoundation/solidity-analyzer": { "version": "0.1.1", "dev": true, @@ -6112,6 +6137,15 @@ "node": ">=8" } }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/array-unique": { "version": "0.2.1", "dev": true, @@ -11066,6 +11100,8 @@ }, "node_modules/ganache/node_modules/@trufflesuite/bigint-buffer": { "version": "1.1.10", + "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz", + "integrity": "sha512-pYIQC5EcMmID74t26GCC67946mgTJFiLXOT/BYozgrd4UEY2JHEGLhWi9cMiQCt5BSqFEvKkCHNnoj82SRjiEw==", "hasInstallScript": true, "inBundle": true, "license": "Apache-2.0", @@ -11078,6 +11114,8 @@ }, "node_modules/ganache/node_modules/@trufflesuite/bigint-buffer/node_modules/node-gyp-build": { "version": "4.4.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.4.0.tgz", + "integrity": "sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==", "inBundle": true, "license": "MIT", "bin": { @@ -11103,6 +11141,8 @@ }, "node_modules/ganache/node_modules/abstract-leveldown": { "version": "7.2.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "inBundle": true, "license": "MIT", "dependencies": { @@ -11133,6 +11173,8 @@ }, "node_modules/ganache/node_modules/base64-js": { "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "funding": [ { "type": "github", @@ -11152,11 +11194,15 @@ }, "node_modules/ganache/node_modules/brorand": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/buffer": { "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { "type": "github", @@ -11192,6 +11238,8 @@ }, "node_modules/ganache/node_modules/catering": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.0.tgz", + "integrity": "sha512-M5imwzQn6y+ODBfgi+cfgZv2hIUI6oYU/0f35Mdb1ujGeqeoI5tOnl9Q13DTH7LW+7er+NYq8stNOKZD/Z3U/A==", "inBundle": true, "license": "MIT", "dependencies": { @@ -11203,6 +11251,8 @@ }, "node_modules/ganache/node_modules/elliptic": { "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "inBundle": true, "license": "MIT", "dependencies": { @@ -11217,6 +11267,8 @@ }, "node_modules/ganache/node_modules/elliptic/node_modules/bn.js": { "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "inBundle": true, "license": "MIT" }, @@ -11232,6 +11284,8 @@ }, "node_modules/ganache/node_modules/hash.js": { "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "inBundle": true, "license": "MIT", "dependencies": { @@ -11241,6 +11295,8 @@ }, "node_modules/ganache/node_modules/hmac-drbg": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "inBundle": true, "license": "MIT", "dependencies": { @@ -11251,6 +11307,8 @@ }, "node_modules/ganache/node_modules/ieee754": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", @@ -11270,11 +11328,15 @@ }, "node_modules/ganache/node_modules/inherits": { "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "inBundle": true, "license": "ISC" }, "node_modules/ganache/node_modules/is-buffer": { "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "funding": [ { "type": "github", @@ -11297,6 +11359,8 @@ }, "node_modules/ganache/node_modules/keccak": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", "hasInstallScript": true, "inBundle": true, "license": "MIT", @@ -11311,6 +11375,8 @@ }, "node_modules/ganache/node_modules/level-concat-iterator": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", + "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "inBundle": true, "license": "MIT", "dependencies": { @@ -11322,6 +11388,8 @@ }, "node_modules/ganache/node_modules/level-supports": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", + "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", "inBundle": true, "license": "MIT", "engines": { @@ -11330,6 +11398,8 @@ }, "node_modules/ganache/node_modules/leveldown": { "version": "6.1.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", + "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", "hasInstallScript": true, "inBundle": true, "license": "MIT", @@ -11344,26 +11414,36 @@ }, "node_modules/ganache/node_modules/minimalistic-assert": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "inBundle": true, "license": "ISC" }, "node_modules/ganache/node_modules/minimalistic-crypto-utils": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/napi-macros": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/node-addon-api": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/node-gyp-build": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", + "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==", "inBundle": true, "license": "MIT", "bin": { @@ -11374,6 +11454,8 @@ }, "node_modules/ganache/node_modules/queue-microtask": { "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "funding": [ { "type": "github", @@ -11393,11 +11475,15 @@ }, "node_modules/ganache/node_modules/queue-tick": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.0.tgz", + "integrity": "sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/readable-stream": { "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "inBundle": true, "license": "MIT", "dependencies": { @@ -11411,6 +11497,8 @@ }, "node_modules/ganache/node_modules/safe-buffer": { "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "funding": [ { "type": "github", @@ -11430,6 +11518,8 @@ }, "node_modules/ganache/node_modules/secp256k1": { "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "hasInstallScript": true, "inBundle": true, "license": "MIT", @@ -11444,6 +11534,8 @@ }, "node_modules/ganache/node_modules/string_decoder": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "inBundle": true, "license": "MIT", "dependencies": { @@ -11464,6 +11556,8 @@ }, "node_modules/ganache/node_modules/util-deprecate": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "inBundle": true, "license": "MIT" }, @@ -12092,6 +12186,70 @@ } } }, + "node_modules/hardhat-contract-sizer": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/hardhat-contract-sizer/-/hardhat-contract-sizer-2.10.0.tgz", + "integrity": "sha512-QiinUgBD5MqJZJh1hl1jc9dNnpJg7eE/w4/4GEnrcmZJJTDbVFNe3+/3Ep24XqISSkYxRz36czcPHKHd/a0dwA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "cli-table3": "^0.6.0", + "strip-ansi": "^6.0.0" + }, + "peerDependencies": { + "hardhat": "^2.0.0" + } + }, + "node_modules/hardhat-contract-sizer/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hardhat-contract-sizer/node_modules/cli-table3": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", + "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/hardhat-contract-sizer/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/hardhat-gas-reporter": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.9.tgz", + "integrity": "sha512-INN26G3EW43adGKBNzYWOlI3+rlLnasXTwW79YNnUhXPDa+yHESgt639dJEs37gCjhkbNKcRRJnomXEuMFBXJg==", + "dev": true, + "dependencies": { + "array-uniq": "1.0.3", + "eth-gas-reporter": "^0.2.25", + "sha1": "^1.1.1" + }, + "peerDependencies": { + "hardhat": "^2.0.2" + } + }, "node_modules/hardhat/node_modules/ansi-styles": { "version": "3.2.1", "dev": true, @@ -23307,6 +23465,13 @@ "case": "^1.6.3" } }, + "@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "dev": true, + "optional": true + }, "@ensdomains/address-encoder": { "version": "0.1.9", "requires": { @@ -24391,6 +24556,15 @@ "lodash.isequal": "^4.5.0" } }, + "@nomicfoundation/hardhat-network-helpers": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.9.tgz", + "integrity": "sha512-OXWCv0cHpwLUO2u7bFxBna6dQtCC2Gg/aN/KtJLO7gmuuA28vgmVKYFRCDUqrbjujzgfwQ2aKyZ9Y3vSmDqS7Q==", + "dev": true, + "requires": { + "ethereumjs-util": "^7.1.4" + } + }, "@nomicfoundation/solidity-analyzer": { "version": "0.1.1", "dev": true, @@ -26131,6 +26305,12 @@ "version": "2.1.0", "dev": true }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "dev": true + }, "array-unique": { "version": "0.2.1", "dev": true @@ -29456,6 +29636,8 @@ "dependencies": { "@trufflesuite/bigint-buffer": { "version": "1.1.10", + "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz", + "integrity": "sha512-pYIQC5EcMmID74t26GCC67946mgTJFiLXOT/BYozgrd4UEY2JHEGLhWi9cMiQCt5BSqFEvKkCHNnoj82SRjiEw==", "bundled": true, "requires": { "node-gyp-build": "4.4.0" @@ -29463,6 +29645,8 @@ "dependencies": { "node-gyp-build": { "version": "4.4.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.4.0.tgz", + "integrity": "sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==", "bundled": true } } @@ -29480,6 +29664,8 @@ }, "abstract-leveldown": { "version": "7.2.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "bundled": true, "requires": { "buffer": "^6.0.3", @@ -29504,14 +29690,20 @@ }, "base64-js": { "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "bundled": true }, "brorand": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "bundled": true }, "buffer": { "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "bundled": true, "requires": { "base64-js": "^1.3.1", @@ -29527,6 +29719,8 @@ }, "catering": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.0.tgz", + "integrity": "sha512-M5imwzQn6y+ODBfgi+cfgZv2hIUI6oYU/0f35Mdb1ujGeqeoI5tOnl9Q13DTH7LW+7er+NYq8stNOKZD/Z3U/A==", "bundled": true, "requires": { "queue-tick": "^1.0.0" @@ -29534,6 +29728,8 @@ }, "elliptic": { "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "bundled": true, "requires": { "bn.js": "^4.11.9", @@ -29547,6 +29743,8 @@ "dependencies": { "bn.js": { "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "bundled": true } } @@ -29556,6 +29754,8 @@ }, "hash.js": { "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "bundled": true, "requires": { "inherits": "^2.0.3", @@ -29564,6 +29764,8 @@ }, "hmac-drbg": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "bundled": true, "requires": { "hash.js": "^1.0.3", @@ -29573,18 +29775,26 @@ }, "ieee754": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "bundled": true }, "inherits": { "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "bundled": true }, "is-buffer": { "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "bundled": true }, "keccak": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", "bundled": true, "requires": { "node-addon-api": "^2.0.0", @@ -29594,6 +29804,8 @@ }, "level-concat-iterator": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", + "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "bundled": true, "requires": { "catering": "^2.1.0" @@ -29601,10 +29813,14 @@ }, "level-supports": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", + "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", "bundled": true }, "leveldown": { "version": "6.1.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", + "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", "bundled": true, "requires": { "abstract-leveldown": "^7.2.0", @@ -29614,34 +29830,50 @@ }, "minimalistic-assert": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "bundled": true }, "minimalistic-crypto-utils": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", "bundled": true }, "napi-macros": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", "bundled": true }, "node-addon-api": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "bundled": true }, "node-gyp-build": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", + "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==", "bundled": true }, "queue-microtask": { "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "bundled": true }, "queue-tick": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.0.tgz", + "integrity": "sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ==", "bundled": true }, "readable-stream": { "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "bundled": true, "requires": { "inherits": "^2.0.3", @@ -29651,10 +29883,14 @@ }, "safe-buffer": { "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "bundled": true }, "secp256k1": { "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "bundled": true, "requires": { "elliptic": "^6.5.4", @@ -29664,6 +29900,8 @@ }, "string_decoder": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "bundled": true, "requires": { "safe-buffer": "~5.2.0" @@ -29678,6 +29916,8 @@ }, "util-deprecate": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "bundled": true }, "ws": { @@ -30352,6 +30592,55 @@ } } }, + "hardhat-contract-sizer": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/hardhat-contract-sizer/-/hardhat-contract-sizer-2.10.0.tgz", + "integrity": "sha512-QiinUgBD5MqJZJh1hl1jc9dNnpJg7eE/w4/4GEnrcmZJJTDbVFNe3+/3Ep24XqISSkYxRz36czcPHKHd/a0dwA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "cli-table3": "^0.6.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "cli-table3": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", + "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", + "dev": true, + "requires": { + "@colors/colors": "1.5.0", + "string-width": "^4.2.0" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "hardhat-gas-reporter": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.9.tgz", + "integrity": "sha512-INN26G3EW43adGKBNzYWOlI3+rlLnasXTwW79YNnUhXPDa+yHESgt639dJEs37gCjhkbNKcRRJnomXEuMFBXJg==", + "dev": true, + "requires": { + "array-uniq": "1.0.3", + "eth-gas-reporter": "^0.2.25", + "sha1": "^1.1.1" + } + }, "has": { "version": "1.0.3", "requires": { diff --git a/package.json b/package.json index 741938be..51c3a63e 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,9 @@ "uml": "npx sol2uml class contracts -c", "uml-i-eip1404": "npx sol2uml class -c contracts/interfaces/IEIP1404", "uml-partial": "npx sol2uml class contracts -c -b CMTAT_STANDALONE && npx sol2uml class contracts -c -b CMTAT_PROXY && npx sol2uml class contracts -c -b CMTAT_BASE", - "uml-modules-mandatory": "npx sol2uml class contracts -c -b BaseModule && npx sol2uml class contracts -c -b BurnModule && npx sol2uml class contracts -c -b EnforcementModule && npx sol2uml class contracts -c -b ERC20BaseModule && npx sol2uml class contracts -c -b MintModule && npx sol2uml class contracts -c -b PauseModule", + "uml-modules-mandatory": "npx sol2uml class contracts -c -b BaseModule && npx sol2uml class contracts -c -b BurnModule && npx sol2uml class contracts -c -b EnforcementModule && npx sol2uml class contracts -c -b ERC20BaseModule && npx sol2uml class contracts -c -b MintModule", "uml-modules-optional": "npx sol2uml class contracts -c -b DebtBaseModule && npx sol2uml class contracts -c -b CreditEventsModule && npx sol2uml class contracts -c -b MetaTxModule && npx sol2uml class contracts -c -b SnapshotModule && npx sol2uml class contracts -c -b ValidationModule", - "uml-modules-security": "npx sol2uml class contracts -c -b AuthorizationModule && npx sol2uml class contracts -c -b OnlyDelegateCallModule", + "uml-modules-security": "npx sol2uml class contracts -c -b AuthorizationModule && npx sol2uml class contracts -c -b PauseModule", "uml-mocks": "npx sol2uml class -c contracts/mocks/RuleEngine", "size": "npx truffle run contract-size", "test:pause": "npx truffle test test/standard/modules/PauseModule.test.js test/proxy/modules/PauseModule.test.js", @@ -39,7 +39,7 @@ "test:debt": "npx truffle test test/standard/modules/DebtModule.test.js test/proxy/modules/DebtModule.test.js", "test:creditEvents": "npx truffle test test/standard/modules/CreditEventsModule.test.js test/proxy/modules/CreditEventsModule.test.js", "test:deployment": "npx truffle test test/deployment/deployment.test.js", - "test:proxy": "npx truffle test test/proxy/general/KillImplementation.test.js test/proxy/general/Proxy.test.js test/proxy/general/UpgradeProxy.test.js", + "test:proxy": "npx truffle test test/proxy/general/Proxy.test.js test/proxy/general/UpgradeProxy.test.js", "test:metaTx": "npx truffle test test/standard/modules/MetaTxModule.test.js test/proxy/modules/MetaTxModule.test.js", "test:hardhat:burn": "npx hardhat test test/standard/modules/BurnModule.test.js test/proxy/modules/BurnModule.test.js", "test:hardhat:mint": "npx hardhat test test/standard/modules/MintModule.test.js test/proxy/modules/MintModule.test.js", @@ -53,7 +53,7 @@ "test:hardhat:snapshot": "npx hardhat test test/standard/modules/SnapshotModule.test.js test/proxy/modules/SnapshotModule.test.js", "test:hardhat:enforcement": "npx hardhat test test/standard/modules/EnforcementModule.test.js test/proxy/modules/EnforcementModule.test.js", "test:hardhat:metaTx": "npx hardhat test test/standard/modules/MetaTxModule.test.js test/proxy/modules/MetaTxModule.test.js", - "test:hardhat:proxy": "npx hardhat test test/proxy/general/KillImplementation.test.js test/proxy/general/Proxy.test.js test/proxy/general/UpgradeProxy.test.js", + "test:hardhat:proxy": "npx hardhat test test/proxy/general/Proxy.test.js test/proxy/general/UpgradeProxy.test.js", "test:hardhat:deployment": "npx hardhat test test/deployment/deployment.test.js" }, "repository": { diff --git a/test/common/BaseModuleCommon.js b/test/common/BaseModuleCommon.js index a8d02117..e3d1ef75 100644 --- a/test/common/BaseModuleCommon.js +++ b/test/common/BaseModuleCommon.js @@ -124,35 +124,6 @@ function BaseModuleCommon (owner, address1, address2, address3, proxyTest) { // Assert (await this.cmtat.flag()).should.be.bignumber.equal(this.flag.toString()) }) - it('testAdminCanKillContract', async function () { - // Arrange - Assert - await web3.eth.getCode(this.cmtat.address).should.not.equal('0x') - // Act - await this.cmtat.kill({ from: owner }); - // Assert - // TODO: Check if the ethers inside the contract is sent to the right address - // A destroyed contract has a bytecode size of 0. - (await web3.eth.getCode(this.cmtat.address)).should.equal('0x') - try { - await this.cmtat.terms() - } catch (e) { - e.message.should.equal( - "Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced." - ) - } - }) - it('testCannotNonAdminKillContract', async function () { - // Act - await expectRevertCustomError( - this.cmtat.kill({ from: address1 }), - 'AccessControlUnauthorizedAccount', - [address1, DEFAULT_ADMIN_ROLE] - ); - // Assert - (await this.cmtat.terms()).should.equal('https://cmta.ch') - // The contract is not destroyed, so the contract has a bytecode size different from zero. - await web3.eth.getCode(this.cmtat.address).should.not.equal('0x') - }) }) } module.exports = BaseModuleCommon diff --git a/test/common/EnforcementModuleCommon.js b/test/common/EnforcementModuleCommon.js index fece3f0d..98aba5fd 100644 --- a/test/common/EnforcementModuleCommon.js +++ b/test/common/EnforcementModuleCommon.js @@ -1,4 +1,4 @@ -const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers') +const { expectEvent } = require('@openzeppelin/test-helpers') const { should } = require('chai').should() const { ENFORCER_ROLE } = require('../utils') const { @@ -17,13 +17,13 @@ function EnforcementModuleCommon (owner, address1, address2, address3) { // Arrange - Assert (await this.cmtat.frozen(address1)).should.equal(false); // Act - ({ logs: this.logs } = await this.cmtat.freeze(address1, reasonFreeze, { + this.logs = await this.cmtat.freeze(address1, reasonFreeze, { from: owner - })); + }); // Assert (await this.cmtat.frozen(address1)).should.equal(true) // emits a Freeze event - expectEvent.inLogs(this.logs, 'Freeze', { + expectEvent(this.logs, 'Freeze', { enforcer: owner, owner: address1, reasonIndexed: web3.utils.keccak256(reasonFreeze), @@ -35,13 +35,13 @@ function EnforcementModuleCommon (owner, address1, address2, address3) { // Arrange - Assert (await this.cmtat.frozen(address1)).should.equal(false); // Act - ({ logs: this.logs } = await this.cmtat.freeze(address1, '', { + this.logs = await this.cmtat.freeze(address1, '', { from: owner - })); + }); // Assert (await this.cmtat.frozen(address1)).should.equal(true) // emits a Freeze event - expectEvent.inLogs(this.logs, 'Freeze', { + expectEvent(this.logs, 'Freeze', { enforcer: owner, owner: address1, // see https://ethereum.stackexchange.com/questions/35103/keccak-hash-of-null-values-result-in-different-hashes-for-different-types @@ -57,14 +57,14 @@ function EnforcementModuleCommon (owner, address1, address2, address3) { // Arrange - Assert (await this.cmtat.frozen(address1)).should.equal(false); // Act - ({ logs: this.logs } = await this.cmtat.freeze(address1, reasonFreeze, { + this.logs = await this.cmtat.freeze(address1, reasonFreeze, { from: address2 - })); + }); // Assert (await this.cmtat.frozen(address1)).should.equal(true) // emits a Freeze event - expectEvent.inLogs(this.logs, 'Freeze', { + expectEvent(this.logs, 'Freeze', { enforcer: address2, owner: address1, reasonIndexed: web3.utils.keccak256(reasonFreeze), @@ -78,16 +78,16 @@ function EnforcementModuleCommon (owner, address1, address2, address3) { // Arrange - Assert (await this.cmtat.frozen(address1)).should.equal(true); // Act - ({ logs: this.logs } = await this.cmtat.unfreeze( + this.logs = await this.cmtat.unfreeze( address1, reasonUnfreeze, { from: owner } - )); + ); // Assert (await this.cmtat.frozen(address1)).should.equal(false) - expectEvent.inLogs(this.logs, 'Unfreeze', { + expectEvent(this.logs, 'Unfreeze', { enforcer: owner, owner: address1, reasonIndexed: web3.utils.keccak256(reasonUnfreeze), @@ -102,15 +102,15 @@ function EnforcementModuleCommon (owner, address1, address2, address3) { // Arrange - Assert (await this.cmtat.frozen(address1)).should.equal(true); // Act - ({ logs: this.logs } = await this.cmtat.unfreeze( + this.logs = await this.cmtat.unfreeze( address1, reasonUnfreeze, { from: address2 } - )); + ); // Assert (await this.cmtat.frozen(address1)).should.equal(false) // emits an Unfreeze event - expectEvent.inLogs(this.logs, 'Unfreeze', { + expectEvent(this.logs, 'Unfreeze', { enforcer: address2, owner: address1, reasonIndexed: web3.utils.keccak256(reasonUnfreeze), diff --git a/test/common/PauseModuleCommon.js b/test/common/PauseModuleCommon.js index 43a56c18..608eceb2 100644 --- a/test/common/PauseModuleCommon.js +++ b/test/common/PauseModuleCommon.js @@ -1,8 +1,8 @@ -const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers') +const { expectEvent } = require('@openzeppelin/test-helpers') const { expectRevertCustomError } = require('../../openzeppelin-contracts-upgradeable/test/helpers/customError.js') -const { PAUSER_ROLE } = require('../utils') +const { PAUSER_ROLE, DEFAULT_ADMIN_ROLE } = require('../utils') const { should } = require('chai').should() function PauseModuleCommon (admin, address1, address2, address3) { @@ -13,9 +13,10 @@ function PauseModuleCommon (admin, address1, address2, address3) { it('testCanBePausedByAdmin', async function () { const AMOUNT_TO_TRANSFER = 10 // Act - this.logs = await this.cmtat.pause({ from: admin }) + this.logs = await this.cmtat.pause({ from: admin }); // Assert + (await this.cmtat.paused()).should.equal(true) // emits a Paused event expectEvent(this.logs, 'Paused', { account: admin }) // Transfer is reverted @@ -32,9 +33,10 @@ function PauseModuleCommon (admin, address1, address2, address3) { await this.cmtat.grantRole(PAUSER_ROLE, address1, { from: admin }) // Act - this.logs = await this.cmtat.pause({ from: address1 }) + this.logs = await this.cmtat.pause({ from: address1 }); // Assert + (await this.cmtat.paused()).should.equal(true) // emits a Paused event expectEvent(this.logs, 'Paused', { account: address1 }) // Transfer is reverted @@ -43,6 +45,7 @@ function PauseModuleCommon (admin, address1, address2, address3) { 'CMTAT_InvalidTransfer', [address1, address2, AMOUNT_TO_TRANSFER] ) + }) it('testCannotBePausedByNonPauser', async function () { @@ -59,9 +62,10 @@ function PauseModuleCommon (admin, address1, address2, address3) { await this.cmtat.pause({ from: admin }) // Act - this.logs = await this.cmtat.unpause({ from: admin }) + this.logs = await this.cmtat.unpause({ from: admin }); // Assert + (await this.cmtat.paused()).should.equal(false) // emits a Unpaused event expectEvent(this.logs, 'Unpaused', { account: admin }) // Transfer works @@ -74,9 +78,10 @@ function PauseModuleCommon (admin, address1, address2, address3) { await this.cmtat.grantRole(PAUSER_ROLE, address1, { from: admin }) // Act - this.logs = await this.cmtat.unpause({ from: address1 }) + this.logs = await this.cmtat.unpause({ from: address1 }); // Assert + (await this.cmtat.paused()).should.equal(false) // emits a Unpaused event expectEvent(this.logs, 'Unpaused', { account: address1 }) // Transfer works @@ -147,5 +152,46 @@ function PauseModuleCommon (admin, address1, address2, address3) { ) }) }) + + context('DeactivateContract', function () { + /** + The admin is assigned the PAUSER role when the contract is deployed + */ + it('testCanDeactivatedByAdmin', async function () { + const AMOUNT_TO_TRANSFER = 10 + // Act + this.logs = await this.cmtat.deactivateContract({ from: admin }); + + // Assert + (await this.cmtat.deactivated()).should.equal(true); + // Contract is in pause state + (await this.cmtat.paused()).should.equal(true) + // emits a Deactivated event + expectEvent(this.logs, 'Deactivated', { account: admin }) + // Transfer is reverted because contract is in paused state + await expectRevertCustomError( + this.cmtat.transfer(address2, AMOUNT_TO_TRANSFER, { from: address1 }), + 'CMTAT_InvalidTransfer', + [address1, address2, AMOUNT_TO_TRANSFER] + ) + + // Unpause is reverted + await expectRevertCustomError(this.cmtat.unpause({ from: admin }), + 'CMTAT_PauseModule_ContractIsDeactivated', + [] + ) + }) + + it('testCannotBeDeactivatedByNonAdmin', async function () { + // Act + await expectRevertCustomError( + this.cmtat.deactivateContract({ from: address1 }), + 'AccessControlUnauthorizedAccount', + [address1, DEFAULT_ADMIN_ROLE] + ); + // Assert + (await this.cmtat.deactivated()).should.equal(false) + }) + }) } module.exports = PauseModuleCommon diff --git a/test/proxy/general/KillImplementation.test.js b/test/proxy/general/KillImplementation.test.js deleted file mode 100644 index 0e47fd5e..00000000 --- a/test/proxy/general/KillImplementation.test.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * We use a different version of the CMTAT where we have removed the check of access control on the kill function - * The goal is to verify if the modifier onlyDelegateCall works as intended - * - */ -const { expectRevert } = require('@openzeppelin/test-helpers') -const { deployCMTATProxyWithKillTest } = require('../../deploymentUtils') -const { - expectRevertCustomError -} = require('../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js') -const { should } = require('chai').should() -const { upgrades } = require('hardhat') -const CMTAT_KILL_TEST = artifacts.require('CMTAT_KILL_TEST') - -contract('Proxy - Security Test', function ([_, admin, deployerAddress]) { - beforeEach(async function () { - this.flag = 5 - // Contract to deploy: CMTAT_KILL_TEST - this.CMTAT_PROXY = await deployCMTATProxyWithKillTest( - _, - admin, - deployerAddress - ) - const implementationContractAddress = - await upgrades.erc1967.getImplementationAddress( - this.CMTAT_PROXY.address, - { - from: admin - } - ) - this.implementationContract = await CMTAT_KILL_TEST.at( - implementationContractAddress - ) - }) - context('Implementation contract', function () { - it('testCannotKillTheImplementationContract', async function () { - await expectRevertCustomError( - this.implementationContract.kill({ from: admin }), - 'CMTAT_OnlyDelegateCallModule_DirectCallToImplementation', - [] - ) - }) - }) -}) diff --git a/test/proxy/general/Proxy.test.js b/test/proxy/general/Proxy.test.js index d830f309..89705124 100644 --- a/test/proxy/general/Proxy.test.js +++ b/test/proxy/general/Proxy.test.js @@ -4,7 +4,7 @@ const { expectRevertCustomError } = require('../../../openzeppelin-contracts-upgradeable/test/helpers/customError.js') const CMTAT = artifacts.require('CMTAT_PROXY') -const { DEFAULT_ADMIN_ROLE } = require('../../utils') +const { DEFAULT_ADMIN_ROLE, PAUSER_ROLE } = require('../../utils') const { ZERO_ADDRESS } = require('../../utils') const DECIMAL = 0 const { deployCMTATProxy, DEPLOYMENT_FLAG } = require('../../deploymentUtils') @@ -47,9 +47,9 @@ contract( [] ) await expectRevertCustomError( - this.implementationContract.kill({ from: attacker }), + this.implementationContract.pause({ from: attacker }), 'AccessControlUnauthorizedAccount', - [attacker, DEFAULT_ADMIN_ROLE] + [attacker, PAUSER_ROLE] ) }) // Here the argument to indicate if it is deployed with a proxy, set at true by the attacker @@ -72,21 +72,11 @@ contract( [] ) await expectRevertCustomError( - this.implementationContract.kill({ from: attacker }), + this.implementationContract.pause({ from: attacker }), 'AccessControlUnauthorizedAccount', - [attacker, DEFAULT_ADMIN_ROLE] + [attacker, PAUSER_ROLE] ) }) }) - context('Admin', function () { - it('testCannotKillTheImplementationContractByAdmin', async function () { - await expectRevertCustomError( - this.implementationContract.kill({ from: admin }), - 'AccessControlUnauthorizedAccount', - [admin, DEFAULT_ADMIN_ROLE] - ); - (await this.implementationContract.terms()).should.equal('') - }) - }) } ) diff --git a/test/proxy/modules/ValidationModule/ValidationModuleConstructor.test.js b/test/proxy/modules/ValidationModule/ValidationModuleConstructor.test.js index e80c89a8..0815c786 100644 --- a/test/proxy/modules/ValidationModule/ValidationModuleConstructor.test.js +++ b/test/proxy/modules/ValidationModule/ValidationModuleConstructor.test.js @@ -14,7 +14,6 @@ contract( const DECIMAL = 0 this.ruleEngineMock = await RuleEngineMock.new({ from: admin }) const delayTime = BigInt(time.duration.days(3)) - console.log(delayTime) this.cmtat = await deployCMTATProxyWithParameter( deployerAddress, _,