Explorar o código

Use hardhat-exposed to reduce the need for mocks (#3666)

Co-authored-by: Francisco <fg@frang.io>
Hadrien Croubois %!s(int64=2) %!d(string=hai) anos
pai
achega
c1d9da4052
Modificáronse 100 ficheiros con 617 adicións e 2911 borrados
  1. 3 0
      .gitignore
  2. 1 15
      contracts/mocks/AccessControlCrossChainMock.sol
  3. 0 17
      contracts/mocks/AccessControlEnumerableMock.sol
  4. 0 17
      contracts/mocks/AccessControlMock.sol
  5. 0 42
      contracts/mocks/AddressImpl.sol
  6. 0 11
      contracts/mocks/Base64Mock.sol
  7. 0 27
      contracts/mocks/BitmapMock.sol
  8. 4 4
      contracts/mocks/CallReceiverMock.sol
  9. 0 96
      contracts/mocks/CheckpointsMock.sol
  10. 0 32
      contracts/mocks/ClonesMock.sol
  11. 0 27
      contracts/mocks/CountersImpl.sol
  12. 0 30
      contracts/mocks/Create2Impl.sol
  13. 0 58
      contracts/mocks/DoubleEndedQueueMock.sol
  14. 0 32
      contracts/mocks/ECDSAMock.sol
  15. 1 11
      contracts/mocks/EIP712Verifier.sol
  16. 0 13
      contracts/mocks/ERC1155BurnableMock.sol
  17. 0 33
      contracts/mocks/ERC1155Mock.sol
  18. 0 29
      contracts/mocks/ERC1155PausableMock.sol
  19. 0 21
      contracts/mocks/ERC1155SupplyMock.sol
  20. 0 22
      contracts/mocks/ERC1155URIStorageMock.sol
  21. 0 58
      contracts/mocks/ERC165/ERC165InterfacesSupported.sol
  22. 0 29
      contracts/mocks/ERC165CheckerMock.sol
  23. 0 7
      contracts/mocks/ERC165Mock.sol
  24. 0 11
      contracts/mocks/ERC165StorageMock.sol
  25. 0 11
      contracts/mocks/ERC1820ImplementerMock.sol
  26. 0 16
      contracts/mocks/ERC20BurnableMock.sol
  27. 0 13
      contracts/mocks/ERC20CappedMock.sol
  28. 0 25
      contracts/mocks/ERC20DecimalsMock.sol
  29. 4 21
      contracts/mocks/ERC20Mock.sol
  30. 0 33
      contracts/mocks/ERC20PausableMock.sol
  31. 0 20
      contracts/mocks/ERC20PermitMock.sol
  32. 0 28
      contracts/mocks/ERC20SnapshotMock.sol
  33. 0 21
      contracts/mocks/ERC20VotesCompMock.sol
  34. 0 21
      contracts/mocks/ERC20VotesMock.sol
  35. 0 17
      contracts/mocks/ERC20WrapperMock.sol
  36. 3 37
      contracts/mocks/ERC4626Mock.sol
  37. 0 25
      contracts/mocks/ERC721BurnableMock.sol
  38. 0 47
      contracts/mocks/ERC721EnumerableMock.sol
  39. 0 37
      contracts/mocks/ERC721Mock.sol
  40. 0 41
      contracts/mocks/ERC721PausableMock.sol
  41. 0 29
      contracts/mocks/ERC721RoyaltyMock.sol
  42. 0 51
      contracts/mocks/ERC721URIStorageMock.sol
  43. 0 25
      contracts/mocks/ERC721VotesMock.sol
  44. 0 42
      contracts/mocks/ERC777Mock.sol
  45. 0 221
      contracts/mocks/EnumerableMapMock.sol
  46. 0 111
      contracts/mocks/EnumerableSetMock.sol
  47. 0 31
      contracts/mocks/GovernorCompMock.sol
  48. 0 50
      contracts/mocks/GovernorMock.sol
  49. 0 31
      contracts/mocks/GovernorVoteMock.sol
  50. 0 43
      contracts/mocks/MathMock.sol
  51. 0 57
      contracts/mocks/MerkleProofWrapper.sol
  52. 2 2
      contracts/mocks/MulticallTest.sol
  53. 0 10
      contracts/mocks/MulticallTokenMock.sol
  54. 0 7
      contracts/mocks/Ownable2StepMock.sol
  55. 0 7
      contracts/mocks/OwnableMock.sol
  56. 0 267
      contracts/mocks/SafeCastMock.sol
  57. 0 182
      contracts/mocks/SafeERC20Helper.sol
  58. 72 0
      contracts/mocks/SafeMathMemoryCheck.sol
  59. 0 126
      contracts/mocks/SafeMathMock.sol
  60. 0 13
      contracts/mocks/SignatureCheckerMock.sol
  61. 0 23
      contracts/mocks/SignedMathMock.sol
  62. 0 23
      contracts/mocks/SignedSafeMathMock.sol
  63. 0 31
      contracts/mocks/StringsMock.sol
  64. 3 9
      contracts/mocks/VotesMock.sol
  65. 20 0
      contracts/mocks/governance/GovernorCompMock.sol
  66. 8 35
      contracts/mocks/governance/GovernorCompatibilityBravoMock.sol
  67. 28 0
      contracts/mocks/governance/GovernorMock.sol
  68. 6 18
      contracts/mocks/governance/GovernorPreventLateQuorumMock.sol
  69. 5 32
      contracts/mocks/governance/GovernorTimelockCompoundMock.sol
  70. 5 32
      contracts/mocks/governance/GovernorTimelockControlMock.sol
  71. 20 0
      contracts/mocks/governance/GovernorVoteMock.sol
  72. 3 14
      contracts/mocks/governance/GovernorWithParamsMock.sol
  73. 0 0
      contracts/mocks/proxy/BadBeacon.sol
  74. 0 0
      contracts/mocks/proxy/ClashingImplementation.sol
  75. 0 0
      contracts/mocks/proxy/UUPSLegacy.sol
  76. 14 2
      contracts/mocks/proxy/UUPSUpgradeableMock.sol
  77. 2 2
      contracts/mocks/token/ERC1155ReceiverMock.sol
  78. 17 0
      contracts/mocks/token/ERC20DecimalsMock.sol
  79. 2 19
      contracts/mocks/token/ERC20FlashMintMock.sol
  80. 8 0
      contracts/mocks/token/ERC20MulticallMock.sol
  81. 21 0
      contracts/mocks/token/ERC20NoReturnMock.sol
  82. 38 0
      contracts/mocks/token/ERC20PermitNoRevertMock.sol
  83. 27 0
      contracts/mocks/token/ERC20ReturnFalseMock copy.sol
  84. 27 0
      contracts/mocks/token/ERC20ReturnTrueMock.sol
  85. 33 0
      contracts/mocks/token/ERC4626DecimalsMock.sol
  86. 2 2
      contracts/mocks/token/ERC721ConsecutiveEnumerableMock.sol
  87. 5 30
      contracts/mocks/token/ERC721ConsecutiveMock.sol
  88. 1 1
      contracts/mocks/token/ERC721ReceiverMock.sol
  89. 17 0
      contracts/mocks/token/ERC721URIStorageMock.sol
  90. 13 0
      contracts/mocks/token/ERC777Mock.sol
  91. 6 6
      contracts/mocks/token/ERC777SenderRecipientMock.sol
  92. 15 7
      hardhat.config.js
  93. 175 1
      package-lock.json
  94. 1 0
      package.json
  95. 0 8
      scripts/generate/run.js
  96. 0 80
      scripts/generate/templates/CheckpointsMock.js
  97. 0 66
      scripts/generate/templates/EnumerableMapMock.js
  98. 0 56
      scripts/generate/templates/EnumerableSetMock.js
  99. 0 50
      scripts/generate/templates/SafeCast.js
  100. 5 4
      test/access/AccessControl.behavior.js

+ 3 - 0
.gitignore

@@ -54,6 +54,9 @@ allFiredEvents
 .coverage_cache
 .coverage_contracts
 
+# hardat-exposed
+contracts-exposed
+
 # Hardhat
 /cache
 /artifacts

+ 1 - 15
contracts/mocks/AccessControlCrossChainMock.sol

@@ -5,18 +5,4 @@ pragma solidity ^0.8.4;
 import "../access/AccessControlCrossChain.sol";
 import "../crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol";
 
-contract AccessControlCrossChainMock is AccessControlCrossChain, CrossChainEnabledArbitrumL2 {
-    constructor() {
-        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
-    }
-
-    function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public {
-        _setRoleAdmin(roleId, adminRoleId);
-    }
-
-    function senderProtected(bytes32 roleId) public onlyRole(roleId) {}
-
-    function crossChainRoleAlias(bytes32 role) public pure returns (bytes32) {
-        return _crossChainRoleAlias(role);
-    }
-}
+contract AccessControlCrossChainMock is AccessControlCrossChain, CrossChainEnabledArbitrumL2 {}

+ 0 - 17
contracts/mocks/AccessControlEnumerableMock.sol

@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../access/AccessControlEnumerable.sol";
-
-contract AccessControlEnumerableMock is AccessControlEnumerable {
-    constructor() {
-        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
-    }
-
-    function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public {
-        _setRoleAdmin(roleId, adminRoleId);
-    }
-
-    function senderProtected(bytes32 roleId) public onlyRole(roleId) {}
-}

+ 0 - 17
contracts/mocks/AccessControlMock.sol

@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../access/AccessControl.sol";
-
-contract AccessControlMock is AccessControl {
-    constructor() {
-        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
-    }
-
-    function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public {
-        _setRoleAdmin(roleId, adminRoleId);
-    }
-
-    function senderProtected(bytes32 roleId) public onlyRole(roleId) {}
-}

+ 0 - 42
contracts/mocks/AddressImpl.sol

@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Address.sol";
-
-contract AddressImpl {
-    string public sharedAnswer;
-
-    event CallReturnValue(string data);
-
-    function isContract(address account) external view returns (bool) {
-        return Address.isContract(account);
-    }
-
-    function sendValue(address payable receiver, uint256 amount) external {
-        Address.sendValue(receiver, amount);
-    }
-
-    function functionCall(address target, bytes calldata data) external {
-        bytes memory returnData = Address.functionCall(target, data);
-        emit CallReturnValue(abi.decode(returnData, (string)));
-    }
-
-    function functionCallWithValue(address target, bytes calldata data, uint256 value) external payable {
-        bytes memory returnData = Address.functionCallWithValue(target, data, value);
-        emit CallReturnValue(abi.decode(returnData, (string)));
-    }
-
-    function functionStaticCall(address target, bytes calldata data) external {
-        bytes memory returnData = Address.functionStaticCall(target, data);
-        emit CallReturnValue(abi.decode(returnData, (string)));
-    }
-
-    function functionDelegateCall(address target, bytes calldata data) external {
-        bytes memory returnData = Address.functionDelegateCall(target, data);
-        emit CallReturnValue(abi.decode(returnData, (string)));
-    }
-
-    // sendValue's tests require the contract to hold Ether
-    receive() external payable {}
-}

+ 0 - 11
contracts/mocks/Base64Mock.sol

@@ -1,11 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Base64.sol";
-
-contract Base64Mock {
-    function encode(bytes memory value) external pure returns (string memory) {
-        return Base64.encode(value);
-    }
-}

+ 0 - 27
contracts/mocks/BitmapMock.sol

@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/structs/BitMaps.sol";
-
-contract BitMapMock {
-    using BitMaps for BitMaps.BitMap;
-
-    BitMaps.BitMap private _bitmap;
-
-    function get(uint256 index) public view returns (bool) {
-        return _bitmap.get(index);
-    }
-
-    function setTo(uint256 index, bool value) public {
-        _bitmap.setTo(index, value);
-    }
-
-    function set(uint256 index) public {
-        _bitmap.set(index);
-    }
-
-    function unset(uint256 index) public {
-        _bitmap.unset(index);
-    }
-}

+ 4 - 4
contracts/mocks/CallReceiverMock.sol

@@ -3,8 +3,6 @@
 pragma solidity ^0.8.0;
 
 contract CallReceiverMock {
-    string public sharedAnswer;
-
     event MockFunctionCalled();
     event MockFunctionCalledWithArgs(uint256 a, uint256 b);
 
@@ -50,8 +48,10 @@ contract CallReceiverMock {
         }
     }
 
-    function mockFunctionWritesStorage() public returns (string memory) {
-        sharedAnswer = "42";
+    function mockFunctionWritesStorage(bytes32 slot, bytes32 value) public returns (string memory) {
+        assembly {
+            sstore(slot, value)
+        }
         return "0x1234";
     }
 }

+ 0 - 96
contracts/mocks/CheckpointsMock.sol

@@ -1,96 +0,0 @@
-// SPDX-License-Identifier: MIT
-// This file was procedurally generated from scripts/generate/templates/CheckpointsMock.js.
-
-pragma solidity ^0.8.0;
-
-import "../utils/Checkpoints.sol";
-
-contract CheckpointsMock {
-    using Checkpoints for Checkpoints.History;
-
-    Checkpoints.History private _totalCheckpoints;
-
-    function latest() public view returns (uint256) {
-        return _totalCheckpoints.latest();
-    }
-
-    function latestCheckpoint() public view returns (bool, uint256, uint256) {
-        return _totalCheckpoints.latestCheckpoint();
-    }
-
-    function length() public view returns (uint256) {
-        return _totalCheckpoints.length();
-    }
-
-    function push(uint256 value) public returns (uint256, uint256) {
-        return _totalCheckpoints.push(value);
-    }
-
-    function getAtBlock(uint256 blockNumber) public view returns (uint256) {
-        return _totalCheckpoints.getAtBlock(blockNumber);
-    }
-
-    function getAtProbablyRecentBlock(uint256 blockNumber) public view returns (uint256) {
-        return _totalCheckpoints.getAtProbablyRecentBlock(blockNumber);
-    }
-}
-
-contract Checkpoints224Mock {
-    using Checkpoints for Checkpoints.Trace224;
-
-    Checkpoints.Trace224 private _totalCheckpoints;
-
-    function latest() public view returns (uint224) {
-        return _totalCheckpoints.latest();
-    }
-
-    function latestCheckpoint() public view returns (bool, uint32, uint224) {
-        return _totalCheckpoints.latestCheckpoint();
-    }
-
-    function length() public view returns (uint256) {
-        return _totalCheckpoints.length();
-    }
-
-    function push(uint32 key, uint224 value) public returns (uint224, uint224) {
-        return _totalCheckpoints.push(key, value);
-    }
-
-    function lowerLookup(uint32 key) public view returns (uint224) {
-        return _totalCheckpoints.lowerLookup(key);
-    }
-
-    function upperLookup(uint32 key) public view returns (uint224) {
-        return _totalCheckpoints.upperLookup(key);
-    }
-}
-
-contract Checkpoints160Mock {
-    using Checkpoints for Checkpoints.Trace160;
-
-    Checkpoints.Trace160 private _totalCheckpoints;
-
-    function latest() public view returns (uint160) {
-        return _totalCheckpoints.latest();
-    }
-
-    function latestCheckpoint() public view returns (bool, uint96, uint160) {
-        return _totalCheckpoints.latestCheckpoint();
-    }
-
-    function length() public view returns (uint256) {
-        return _totalCheckpoints.length();
-    }
-
-    function push(uint96 key, uint160 value) public returns (uint160, uint160) {
-        return _totalCheckpoints.push(key, value);
-    }
-
-    function lowerLookup(uint96 key) public view returns (uint160) {
-        return _totalCheckpoints.lowerLookup(key);
-    }
-
-    function upperLookup(uint96 key) public view returns (uint160) {
-        return _totalCheckpoints.upperLookup(key);
-    }
-}

+ 0 - 32
contracts/mocks/ClonesMock.sol

@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../proxy/Clones.sol";
-import "../utils/Address.sol";
-
-contract ClonesMock {
-    using Address for address;
-    using Clones for address;
-
-    event NewInstance(address instance);
-
-    function clone(address implementation, bytes calldata initdata) public payable {
-        _initAndEmit(implementation.clone(), initdata);
-    }
-
-    function cloneDeterministic(address implementation, bytes32 salt, bytes calldata initdata) public payable {
-        _initAndEmit(implementation.cloneDeterministic(salt), initdata);
-    }
-
-    function predictDeterministicAddress(address implementation, bytes32 salt) public view returns (address predicted) {
-        return implementation.predictDeterministicAddress(salt);
-    }
-
-    function _initAndEmit(address instance, bytes memory initdata) private {
-        if (initdata.length > 0) {
-            instance.functionCallWithValue(initdata, msg.value);
-        }
-        emit NewInstance(instance);
-    }
-}

+ 0 - 27
contracts/mocks/CountersImpl.sol

@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Counters.sol";
-
-contract CountersImpl {
-    using Counters for Counters.Counter;
-
-    Counters.Counter private _counter;
-
-    function current() public view returns (uint256) {
-        return _counter.current();
-    }
-
-    function increment() public {
-        _counter.increment();
-    }
-
-    function decrement() public {
-        _counter.decrement();
-    }
-
-    function reset() public {
-        _counter.reset();
-    }
-}

+ 0 - 30
contracts/mocks/Create2Impl.sol

@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Create2.sol";
-import "../utils/introspection/ERC1820Implementer.sol";
-
-contract Create2Impl {
-    function deploy(uint256 value, bytes32 salt, bytes memory code) public {
-        Create2.deploy(value, salt, code);
-    }
-
-    function deployERC1820Implementer(uint256 value, bytes32 salt) public {
-        Create2.deploy(value, salt, type(ERC1820Implementer).creationCode);
-    }
-
-    function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) {
-        return Create2.computeAddress(salt, codeHash);
-    }
-
-    function computeAddressWithDeployer(
-        bytes32 salt,
-        bytes32 codeHash,
-        address deployer
-    ) public pure returns (address) {
-        return Create2.computeAddress(salt, codeHash, deployer);
-    }
-
-    receive() external payable {}
-}

+ 0 - 58
contracts/mocks/DoubleEndedQueueMock.sol

@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/structs/DoubleEndedQueue.sol";
-
-// Bytes32Deque
-contract Bytes32DequeMock {
-    using DoubleEndedQueue for DoubleEndedQueue.Bytes32Deque;
-
-    event OperationResult(bytes32 value);
-
-    DoubleEndedQueue.Bytes32Deque private _vector;
-
-    function pushBack(bytes32 value) public {
-        _vector.pushBack(value);
-    }
-
-    function pushFront(bytes32 value) public {
-        _vector.pushFront(value);
-    }
-
-    function popFront() public returns (bytes32) {
-        bytes32 value = _vector.popFront();
-        emit OperationResult(value);
-        return value;
-    }
-
-    function popBack() public returns (bytes32) {
-        bytes32 value = _vector.popBack();
-        emit OperationResult(value);
-        return value;
-    }
-
-    function front() public view returns (bytes32) {
-        return _vector.front();
-    }
-
-    function back() public view returns (bytes32) {
-        return _vector.back();
-    }
-
-    function at(uint256 i) public view returns (bytes32) {
-        return _vector.at(i);
-    }
-
-    function clear() public {
-        _vector.clear();
-    }
-
-    function length() public view returns (uint256) {
-        return _vector.length();
-    }
-
-    function empty() public view returns (bool) {
-        return _vector.empty();
-    }
-}

+ 0 - 32
contracts/mocks/ECDSAMock.sol

@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/cryptography/ECDSA.sol";
-
-contract ECDSAMock {
-    using ECDSA for bytes32;
-    using ECDSA for bytes;
-
-    function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
-        return hash.recover(signature);
-    }
-
-    // solhint-disable-next-line func-name-mixedcase
-    function recover_v_r_s(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
-        return hash.recover(v, r, s);
-    }
-
-    // solhint-disable-next-line func-name-mixedcase
-    function recover_r_vs(bytes32 hash, bytes32 r, bytes32 vs) public pure returns (address) {
-        return hash.recover(r, vs);
-    }
-
-    function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
-        return hash.toEthSignedMessageHash();
-    }
-
-    function toEthSignedMessageHash(bytes memory s) public pure returns (bytes32) {
-        return s.toEthSignedMessageHash();
-    }
-}

+ 1 - 11
contracts/mocks/EIP712External.sol → contracts/mocks/EIP712Verifier.sol

@@ -5,13 +5,7 @@ pragma solidity ^0.8.0;
 import "../utils/cryptography/ECDSA.sol";
 import "../utils/cryptography/EIP712.sol";
 
-contract EIP712External is EIP712 {
-    constructor(string memory name, string memory version) EIP712(name, version) {}
-
-    function domainSeparator() external view returns (bytes32) {
-        return _domainSeparatorV4();
-    }
-
+abstract contract EIP712Verifier is EIP712 {
     function verify(bytes memory signature, address signer, address mailTo, string memory mailContents) external view {
         bytes32 digest = _hashTypedDataV4(
             keccak256(abi.encode(keccak256("Mail(address to,string contents)"), mailTo, keccak256(bytes(mailContents))))
@@ -19,8 +13,4 @@ contract EIP712External is EIP712 {
         address recoveredSigner = ECDSA.recover(digest, signature);
         require(recoveredSigner == signer);
     }
-
-    function getChainId() external view returns (uint256) {
-        return block.chainid;
-    }
 }

+ 0 - 13
contracts/mocks/ERC1155BurnableMock.sol

@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC1155/extensions/ERC1155Burnable.sol";
-
-contract ERC1155BurnableMock is ERC1155Burnable {
-    constructor(string memory uri) ERC1155(uri) {}
-
-    function mint(address to, uint256 id, uint256 value, bytes memory data) public {
-        _mint(to, id, value, data);
-    }
-}

+ 0 - 33
contracts/mocks/ERC1155Mock.sol

@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC1155/ERC1155.sol";
-
-/**
- * @title ERC1155Mock
- * This mock just publicizes internal functions for testing purposes
- */
-contract ERC1155Mock is ERC1155 {
-    constructor(string memory uri) ERC1155(uri) {}
-
-    function setURI(string memory newuri) public {
-        _setURI(newuri);
-    }
-
-    function mint(address to, uint256 id, uint256 value, bytes memory data) public {
-        _mint(to, id, value, data);
-    }
-
-    function mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) public {
-        _mintBatch(to, ids, values, data);
-    }
-
-    function burn(address owner, uint256 id, uint256 value) public {
-        _burn(owner, id, value);
-    }
-
-    function burnBatch(address owner, uint256[] memory ids, uint256[] memory values) public {
-        _burnBatch(owner, ids, values);
-    }
-}

+ 0 - 29
contracts/mocks/ERC1155PausableMock.sol

@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "./ERC1155Mock.sol";
-import "../token/ERC1155/extensions/ERC1155Pausable.sol";
-
-contract ERC1155PausableMock is ERC1155Mock, ERC1155Pausable {
-    constructor(string memory uri) ERC1155Mock(uri) {}
-
-    function pause() external {
-        _pause();
-    }
-
-    function unpause() external {
-        _unpause();
-    }
-
-    function _beforeTokenTransfer(
-        address operator,
-        address from,
-        address to,
-        uint256[] memory ids,
-        uint256[] memory amounts,
-        bytes memory data
-    ) internal override(ERC1155, ERC1155Pausable) {
-        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
-    }
-}

+ 0 - 21
contracts/mocks/ERC1155SupplyMock.sol

@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "./ERC1155Mock.sol";
-import "../token/ERC1155/extensions/ERC1155Supply.sol";
-
-contract ERC1155SupplyMock is ERC1155Mock, ERC1155Supply {
-    constructor(string memory uri) ERC1155Mock(uri) {}
-
-    function _beforeTokenTransfer(
-        address operator,
-        address from,
-        address to,
-        uint256[] memory ids,
-        uint256[] memory amounts,
-        bytes memory data
-    ) internal override(ERC1155, ERC1155Supply) {
-        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
-    }
-}

+ 0 - 22
contracts/mocks/ERC1155URIStorageMock.sol

@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "./ERC1155Mock.sol";
-import "../token/ERC1155/extensions/ERC1155URIStorage.sol";
-
-contract ERC1155URIStorageMock is ERC1155Mock, ERC1155URIStorage {
-    constructor(string memory _uri) ERC1155Mock(_uri) {}
-
-    function uri(uint256 tokenId) public view override(ERC1155, ERC1155URIStorage) returns (string memory) {
-        return ERC1155URIStorage.uri(tokenId);
-    }
-
-    function setURI(uint256 tokenId, string memory _tokenURI) public {
-        _setURI(tokenId, _tokenURI);
-    }
-
-    function setBaseURI(string memory baseURI) public {
-        _setBaseURI(baseURI);
-    }
-}

+ 0 - 58
contracts/mocks/ERC165/ERC165InterfacesSupported.sol

@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../../utils/introspection/IERC165.sol";
-
-/**
- * https://eips.ethereum.org/EIPS/eip-214#specification
- * From the specification:
- * > Any attempts to make state-changing operations inside an execution instance with STATIC set to true will instead
- * throw an exception.
- * > These operations include [...], LOG0, LOG1, LOG2, [...]
- *
- * therefore, because this contract is staticcall'd we need to not emit events (which is how solidity-coverage works)
- * solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it
- */
-contract SupportsInterfaceWithLookupMock is IERC165 {
-    /*
-     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
-     */
-    bytes4 public constant INTERFACE_ID_ERC165 = 0x01ffc9a7;
-
-    /**
-     * @dev A mapping of interface id to whether or not it's supported.
-     */
-    mapping(bytes4 => bool) private _supportedInterfaces;
-
-    /**
-     * @dev A contract implementing SupportsInterfaceWithLookup
-     * implement ERC165 itself.
-     */
-    constructor() {
-        _registerInterface(INTERFACE_ID_ERC165);
-    }
-
-    /**
-     * @dev Implement supportsInterface(bytes4) using a lookup table.
-     */
-    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
-        return _supportedInterfaces[interfaceId];
-    }
-
-    /**
-     * @dev Private method for registering an interface.
-     */
-    function _registerInterface(bytes4 interfaceId) internal {
-        require(interfaceId != 0xffffffff, "ERC165InterfacesSupported: invalid interface id");
-        _supportedInterfaces[interfaceId] = true;
-    }
-}
-
-contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock {
-    constructor(bytes4[] memory interfaceIds) {
-        for (uint256 i = 0; i < interfaceIds.length; i++) {
-            _registerInterface(interfaceIds[i]);
-        }
-    }
-}

+ 0 - 29
contracts/mocks/ERC165CheckerMock.sol

@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/introspection/ERC165Checker.sol";
-
-contract ERC165CheckerMock {
-    using ERC165Checker for address;
-
-    function supportsERC165(address account) public view returns (bool) {
-        return account.supportsERC165();
-    }
-
-    function supportsInterface(address account, bytes4 interfaceId) public view returns (bool) {
-        return account.supportsInterface(interfaceId);
-    }
-
-    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool) {
-        return account.supportsAllInterfaces(interfaceIds);
-    }
-
-    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool[] memory) {
-        return account.getSupportedInterfaces(interfaceIds);
-    }
-
-    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) public view returns (bool) {
-        return account.supportsERC165InterfaceUnchecked(interfaceId);
-    }
-}

+ 0 - 7
contracts/mocks/ERC165Mock.sol

@@ -1,7 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/introspection/ERC165.sol";
-
-contract ERC165Mock is ERC165 {}

+ 0 - 11
contracts/mocks/ERC165StorageMock.sol

@@ -1,11 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/introspection/ERC165Storage.sol";
-
-contract ERC165StorageMock is ERC165Storage {
-    function registerInterface(bytes4 interfaceId) public {
-        _registerInterface(interfaceId);
-    }
-}

+ 0 - 11
contracts/mocks/ERC1820ImplementerMock.sol

@@ -1,11 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/introspection/ERC1820Implementer.sol";
-
-contract ERC1820ImplementerMock is ERC1820Implementer {
-    function registerInterfaceForAddress(bytes32 interfaceHash, address account) public {
-        _registerInterfaceForAddress(interfaceHash, account);
-    }
-}

+ 0 - 16
contracts/mocks/ERC20BurnableMock.sol

@@ -1,16 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20Burnable.sol";
-
-contract ERC20BurnableMock is ERC20Burnable {
-    constructor(
-        string memory name,
-        string memory symbol,
-        address initialAccount,
-        uint256 initialBalance
-    ) ERC20(name, symbol) {
-        _mint(initialAccount, initialBalance);
-    }
-}

+ 0 - 13
contracts/mocks/ERC20CappedMock.sol

@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20Capped.sol";
-
-contract ERC20CappedMock is ERC20Capped {
-    constructor(string memory name, string memory symbol, uint256 cap) ERC20(name, symbol) ERC20Capped(cap) {}
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-}

+ 0 - 25
contracts/mocks/ERC20DecimalsMock.sol

@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/ERC20.sol";
-
-contract ERC20DecimalsMock is ERC20 {
-    uint8 private immutable _decimals;
-
-    constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) {
-        _decimals = decimals_;
-    }
-
-    function decimals() public view override returns (uint8) {
-        return _decimals;
-    }
-
-    function mint(address account, uint256 amount) public {
-        _mint(account, amount);
-    }
-
-    function burn(address account, uint256 amount) public {
-        _burn(account, amount);
-    }
-}

+ 4 - 21
contracts/mocks/ERC20Mock.sol

@@ -1,33 +1,16 @@
 // SPDX-License-Identifier: MIT
-
 pragma solidity ^0.8.0;
 
-import "../token/ERC20/ERC20.sol";
+import {ERC20} from "../token/ERC20/ERC20.sol";
 
-// mock class using ERC20
 contract ERC20Mock is ERC20 {
-    constructor(
-        string memory name,
-        string memory symbol,
-        address initialAccount,
-        uint256 initialBalance
-    ) payable ERC20(name, symbol) {
-        _mint(initialAccount, initialBalance);
-    }
+    constructor() ERC20("ERC20Mock", "E20M") {}
 
-    function mint(address account, uint256 amount) public {
+    function mint(address account, uint256 amount) external {
         _mint(account, amount);
     }
 
-    function burn(address account, uint256 amount) public {
+    function burn(address account, uint256 amount) external {
         _burn(account, amount);
     }
-
-    function transferInternal(address from, address to, uint256 value) public {
-        _transfer(from, to, value);
-    }
-
-    function approveInternal(address owner, address spender, uint256 value) public {
-        _approve(owner, spender, value);
-    }
 }

+ 0 - 33
contracts/mocks/ERC20PausableMock.sol

@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20Pausable.sol";
-
-// mock class using ERC20Pausable
-contract ERC20PausableMock is ERC20Pausable {
-    constructor(
-        string memory name,
-        string memory symbol,
-        address initialAccount,
-        uint256 initialBalance
-    ) ERC20(name, symbol) {
-        _mint(initialAccount, initialBalance);
-    }
-
-    function pause() external {
-        _pause();
-    }
-
-    function unpause() external {
-        _unpause();
-    }
-
-    function mint(address to, uint256 amount) public {
-        _mint(to, amount);
-    }
-
-    function burn(address from, uint256 amount) public {
-        _burn(from, amount);
-    }
-}

+ 0 - 20
contracts/mocks/ERC20PermitMock.sol

@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20Permit.sol";
-
-contract ERC20PermitMock is ERC20Permit {
-    constructor(
-        string memory name,
-        string memory symbol,
-        address initialAccount,
-        uint256 initialBalance
-    ) payable ERC20(name, symbol) ERC20Permit(name) {
-        _mint(initialAccount, initialBalance);
-    }
-
-    function getChainId() external view returns (uint256) {
-        return block.chainid;
-    }
-}

+ 0 - 28
contracts/mocks/ERC20SnapshotMock.sol

@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20Snapshot.sol";
-
-contract ERC20SnapshotMock is ERC20Snapshot {
-    constructor(
-        string memory name,
-        string memory symbol,
-        address initialAccount,
-        uint256 initialBalance
-    ) ERC20(name, symbol) {
-        _mint(initialAccount, initialBalance);
-    }
-
-    function snapshot() public {
-        _snapshot();
-    }
-
-    function mint(address account, uint256 amount) public {
-        _mint(account, amount);
-    }
-
-    function burn(address account, uint256 amount) public {
-        _burn(account, amount);
-    }
-}

+ 0 - 21
contracts/mocks/ERC20VotesCompMock.sol

@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20VotesComp.sol";
-
-contract ERC20VotesCompMock is ERC20VotesComp {
-    constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
-
-    function mint(address account, uint256 amount) public {
-        _mint(account, amount);
-    }
-
-    function burn(address account, uint256 amount) public {
-        _burn(account, amount);
-    }
-
-    function getChainId() external view returns (uint256) {
-        return block.chainid;
-    }
-}

+ 0 - 21
contracts/mocks/ERC20VotesMock.sol

@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20Votes.sol";
-
-contract ERC20VotesMock is ERC20Votes {
-    constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
-
-    function mint(address account, uint256 amount) public {
-        _mint(account, amount);
-    }
-
-    function burn(address account, uint256 amount) public {
-        _burn(account, amount);
-    }
-
-    function getChainId() external view returns (uint256) {
-        return block.chainid;
-    }
-}

+ 0 - 17
contracts/mocks/ERC20WrapperMock.sol

@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC20/extensions/ERC20Wrapper.sol";
-
-contract ERC20WrapperMock is ERC20Wrapper {
-    constructor(
-        IERC20 _underlyingToken,
-        string memory name,
-        string memory symbol
-    ) ERC20(name, symbol) ERC20Wrapper(_underlyingToken) {}
-
-    function recover(address account) public returns (uint256) {
-        return _recover(account);
-    }
-}

+ 3 - 37
contracts/mocks/ERC4626Mock.sol

@@ -1,50 +1,16 @@
 // SPDX-License-Identifier: MIT
-
 pragma solidity ^0.8.0;
 
 import "../token/ERC20/extensions/ERC4626.sol";
 
 contract ERC4626Mock is ERC4626 {
-    constructor(IERC20Metadata asset, string memory name, string memory symbol) ERC20(name, symbol) ERC4626(asset) {}
+    constructor(address underlying) ERC20("ERC4626Mock", "E4626M") ERC4626(IERC20(underlying)) {}
 
-    function mockMint(address account, uint256 amount) public {
+    function mint(address account, uint256 amount) external {
         _mint(account, amount);
     }
 
-    function mockBurn(address account, uint256 amount) public {
+    function burn(address account, uint256 amount) external {
         _burn(account, amount);
     }
 }
-
-contract ERC4626DecimalMock is ERC4626Mock {
-    using Math for uint256;
-
-    uint8 private immutable _decimals;
-
-    constructor(
-        IERC20Metadata asset,
-        string memory name,
-        string memory symbol,
-        uint8 decimalsOverride
-    ) ERC4626Mock(asset, name, symbol) {
-        _decimals = decimalsOverride;
-    }
-
-    function decimals() public view virtual override returns (uint8) {
-        return _decimals;
-    }
-
-    function _initialConvertToShares(
-        uint256 assets,
-        Math.Rounding rounding
-    ) internal view virtual override returns (uint256 shares) {
-        return assets.mulDiv(10 ** decimals(), 10 ** super.decimals(), rounding);
-    }
-
-    function _initialConvertToAssets(
-        uint256 shares,
-        Math.Rounding rounding
-    ) internal view virtual override returns (uint256 assets) {
-        return shares.mulDiv(10 ** super.decimals(), 10 ** decimals(), rounding);
-    }
-}

+ 0 - 25
contracts/mocks/ERC721BurnableMock.sol

@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC721/extensions/ERC721Burnable.sol";
-
-contract ERC721BurnableMock is ERC721Burnable {
-    constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
-
-    function exists(uint256 tokenId) public view returns (bool) {
-        return _exists(tokenId);
-    }
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId) public {
-        _safeMint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId, bytes memory _data) public {
-        _safeMint(to, tokenId, _data);
-    }
-}

+ 0 - 47
contracts/mocks/ERC721EnumerableMock.sol

@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC721/extensions/ERC721Enumerable.sol";
-
-/**
- * @title ERC721Mock
- * This mock just provides a public safeMint, mint, and burn functions for testing purposes
- */
-contract ERC721EnumerableMock is ERC721Enumerable {
-    string private _baseTokenURI;
-
-    constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
-
-    function _baseURI() internal view override returns (string memory) {
-        return _baseTokenURI;
-    }
-
-    function setBaseURI(string calldata newBaseTokenURI) public {
-        _baseTokenURI = newBaseTokenURI;
-    }
-
-    function baseURI() public view returns (string memory) {
-        return _baseURI();
-    }
-
-    function exists(uint256 tokenId) public view returns (bool) {
-        return _exists(tokenId);
-    }
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId) public {
-        _safeMint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId, bytes memory _data) public {
-        _safeMint(to, tokenId, _data);
-    }
-
-    function burn(uint256 tokenId) public {
-        _burn(tokenId);
-    }
-}

+ 0 - 37
contracts/mocks/ERC721Mock.sol

@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC721/ERC721.sol";
-
-/**
- * @title ERC721Mock
- * This mock just provides a public safeMint, mint, and burn functions for testing purposes
- */
-contract ERC721Mock is ERC721 {
-    constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
-
-    function baseURI() public view returns (string memory) {
-        return _baseURI();
-    }
-
-    function exists(uint256 tokenId) public view returns (bool) {
-        return _exists(tokenId);
-    }
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId) public {
-        _safeMint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId, bytes memory _data) public {
-        _safeMint(to, tokenId, _data);
-    }
-
-    function burn(uint256 tokenId) public {
-        _burn(tokenId);
-    }
-}

+ 0 - 41
contracts/mocks/ERC721PausableMock.sol

@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC721/extensions/ERC721Pausable.sol";
-
-/**
- * @title ERC721PausableMock
- * This mock just provides a public mint, burn and exists functions for testing purposes
- */
-contract ERC721PausableMock is ERC721Pausable {
-    constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
-
-    function pause() external {
-        _pause();
-    }
-
-    function unpause() external {
-        _unpause();
-    }
-
-    function exists(uint256 tokenId) public view returns (bool) {
-        return _exists(tokenId);
-    }
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId) public {
-        _safeMint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId, bytes memory _data) public {
-        _safeMint(to, tokenId, _data);
-    }
-
-    function burn(uint256 tokenId) public {
-        _burn(tokenId);
-    }
-}

+ 0 - 29
contracts/mocks/ERC721RoyaltyMock.sol

@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC721/extensions/ERC721Royalty.sol";
-
-contract ERC721RoyaltyMock is ERC721Royalty {
-    constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
-
-    function setTokenRoyalty(uint256 tokenId, address recipient, uint96 fraction) public {
-        _setTokenRoyalty(tokenId, recipient, fraction);
-    }
-
-    function setDefaultRoyalty(address recipient, uint96 fraction) public {
-        _setDefaultRoyalty(recipient, fraction);
-    }
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-
-    function burn(uint256 tokenId) public {
-        _burn(tokenId);
-    }
-
-    function deleteDefaultRoyalty() public {
-        _deleteDefaultRoyalty();
-    }
-}

+ 0 - 51
contracts/mocks/ERC721URIStorageMock.sol

@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC721/extensions/ERC721URIStorage.sol";
-
-/**
- * @title ERC721Mock
- * This mock just provides a public safeMint, mint, and burn functions for testing purposes
- */
-contract ERC721URIStorageMock is ERC721URIStorage {
-    string private _baseTokenURI;
-
-    constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
-
-    function _baseURI() internal view override returns (string memory) {
-        return _baseTokenURI;
-    }
-
-    function setBaseURI(string calldata newBaseTokenURI) public {
-        _baseTokenURI = newBaseTokenURI;
-    }
-
-    function baseURI() public view returns (string memory) {
-        return _baseURI();
-    }
-
-    function setTokenURI(uint256 tokenId, string memory _tokenURI) public {
-        _setTokenURI(tokenId, _tokenURI);
-    }
-
-    function exists(uint256 tokenId) public view returns (bool) {
-        return _exists(tokenId);
-    }
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId) public {
-        _safeMint(to, tokenId);
-    }
-
-    function safeMint(address to, uint256 tokenId, bytes memory _data) public {
-        _safeMint(to, tokenId, _data);
-    }
-
-    function burn(uint256 tokenId) public {
-        _burn(tokenId);
-    }
-}

+ 0 - 25
contracts/mocks/ERC721VotesMock.sol

@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../token/ERC721/extensions/ERC721Votes.sol";
-
-contract ERC721VotesMock is ERC721Votes {
-    constructor(string memory name, string memory symbol) ERC721(name, symbol) EIP712(name, "1") {}
-
-    function getTotalSupply() public view returns (uint256) {
-        return _getTotalSupply();
-    }
-
-    function mint(address account, uint256 tokenId) public {
-        _mint(account, tokenId);
-    }
-
-    function burn(uint256 tokenId) public {
-        _burn(tokenId);
-    }
-
-    function getChainId() external view returns (uint256) {
-        return block.chainid;
-    }
-}

+ 0 - 42
contracts/mocks/ERC777Mock.sol

@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Context.sol";
-import "../token/ERC777/ERC777.sol";
-
-contract ERC777Mock is Context, ERC777 {
-    event BeforeTokenTransfer();
-
-    constructor(
-        address initialHolder,
-        uint256 initialBalance,
-        string memory name,
-        string memory symbol,
-        address[] memory defaultOperators
-    ) ERC777(name, symbol, defaultOperators) {
-        _mint(initialHolder, initialBalance, "", "");
-    }
-
-    function mintInternal(address to, uint256 amount, bytes memory userData, bytes memory operatorData) public {
-        _mint(to, amount, userData, operatorData);
-    }
-
-    function mintInternalExtended(
-        address to,
-        uint256 amount,
-        bytes memory userData,
-        bytes memory operatorData,
-        bool requireReceptionAck
-    ) public {
-        _mint(to, amount, userData, operatorData, requireReceptionAck);
-    }
-
-    function approveInternal(address holder, address spender, uint256 value) public {
-        _approve(holder, spender, value);
-    }
-
-    function _beforeTokenTransfer(address, address, address, uint256) internal override {
-        emit BeforeTokenTransfer();
-    }
-}

+ 0 - 221
contracts/mocks/EnumerableMapMock.sol

@@ -1,221 +0,0 @@
-// SPDX-License-Identifier: MIT
-// This file was procedurally generated from scripts/generate/templates/EnumerableMapMock.js.
-
-pragma solidity ^0.8.0;
-
-import "../utils/structs/EnumerableMap.sol";
-
-// UintToAddressMap
-contract UintToAddressMapMock {
-    using EnumerableMap for EnumerableMap.UintToAddressMap;
-
-    event OperationResult(bool result);
-
-    EnumerableMap.UintToAddressMap private _map;
-
-    function contains(uint256 key) public view returns (bool) {
-        return _map.contains(key);
-    }
-
-    function set(uint256 key, address value) public {
-        bool result = _map.set(key, value);
-        emit OperationResult(result);
-    }
-
-    function remove(uint256 key) public {
-        bool result = _map.remove(key);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _map.length();
-    }
-
-    function at(uint256 index) public view returns (uint256 key, address value) {
-        return _map.at(index);
-    }
-
-    function tryGet(uint256 key) public view returns (bool, address) {
-        return _map.tryGet(key);
-    }
-
-    function get(uint256 key) public view returns (address) {
-        return _map.get(key);
-    }
-
-    function getWithMessage(uint256 key, string calldata errorMessage) public view returns (address) {
-        return _map.get(key, errorMessage);
-    }
-}
-
-// AddressToUintMap
-contract AddressToUintMapMock {
-    using EnumerableMap for EnumerableMap.AddressToUintMap;
-
-    event OperationResult(bool result);
-
-    EnumerableMap.AddressToUintMap private _map;
-
-    function contains(address key) public view returns (bool) {
-        return _map.contains(key);
-    }
-
-    function set(address key, uint256 value) public {
-        bool result = _map.set(key, value);
-        emit OperationResult(result);
-    }
-
-    function remove(address key) public {
-        bool result = _map.remove(key);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _map.length();
-    }
-
-    function at(uint256 index) public view returns (address key, uint256 value) {
-        return _map.at(index);
-    }
-
-    function tryGet(address key) public view returns (bool, uint256) {
-        return _map.tryGet(key);
-    }
-
-    function get(address key) public view returns (uint256) {
-        return _map.get(key);
-    }
-
-    function getWithMessage(address key, string calldata errorMessage) public view returns (uint256) {
-        return _map.get(key, errorMessage);
-    }
-}
-
-// Bytes32ToBytes32Map
-contract Bytes32ToBytes32MapMock {
-    using EnumerableMap for EnumerableMap.Bytes32ToBytes32Map;
-
-    event OperationResult(bool result);
-
-    EnumerableMap.Bytes32ToBytes32Map private _map;
-
-    function contains(bytes32 key) public view returns (bool) {
-        return _map.contains(key);
-    }
-
-    function set(bytes32 key, bytes32 value) public {
-        bool result = _map.set(key, value);
-        emit OperationResult(result);
-    }
-
-    function remove(bytes32 key) public {
-        bool result = _map.remove(key);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _map.length();
-    }
-
-    function at(uint256 index) public view returns (bytes32 key, bytes32 value) {
-        return _map.at(index);
-    }
-
-    function tryGet(bytes32 key) public view returns (bool, bytes32) {
-        return _map.tryGet(key);
-    }
-
-    function get(bytes32 key) public view returns (bytes32) {
-        return _map.get(key);
-    }
-
-    function getWithMessage(bytes32 key, string calldata errorMessage) public view returns (bytes32) {
-        return _map.get(key, errorMessage);
-    }
-}
-
-// UintToUintMap
-contract UintToUintMapMock {
-    using EnumerableMap for EnumerableMap.UintToUintMap;
-
-    event OperationResult(bool result);
-
-    EnumerableMap.UintToUintMap private _map;
-
-    function contains(uint256 key) public view returns (bool) {
-        return _map.contains(key);
-    }
-
-    function set(uint256 key, uint256 value) public {
-        bool result = _map.set(key, value);
-        emit OperationResult(result);
-    }
-
-    function remove(uint256 key) public {
-        bool result = _map.remove(key);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _map.length();
-    }
-
-    function at(uint256 index) public view returns (uint256 key, uint256 value) {
-        return _map.at(index);
-    }
-
-    function tryGet(uint256 key) public view returns (bool, uint256) {
-        return _map.tryGet(key);
-    }
-
-    function get(uint256 key) public view returns (uint256) {
-        return _map.get(key);
-    }
-
-    function getWithMessage(uint256 key, string calldata errorMessage) public view returns (uint256) {
-        return _map.get(key, errorMessage);
-    }
-}
-
-// Bytes32ToUintMap
-contract Bytes32ToUintMapMock {
-    using EnumerableMap for EnumerableMap.Bytes32ToUintMap;
-
-    event OperationResult(bool result);
-
-    EnumerableMap.Bytes32ToUintMap private _map;
-
-    function contains(bytes32 key) public view returns (bool) {
-        return _map.contains(key);
-    }
-
-    function set(bytes32 key, uint256 value) public {
-        bool result = _map.set(key, value);
-        emit OperationResult(result);
-    }
-
-    function remove(bytes32 key) public {
-        bool result = _map.remove(key);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _map.length();
-    }
-
-    function at(uint256 index) public view returns (bytes32 key, uint256 value) {
-        return _map.at(index);
-    }
-
-    function tryGet(bytes32 key) public view returns (bool, uint256) {
-        return _map.tryGet(key);
-    }
-
-    function get(bytes32 key) public view returns (uint256) {
-        return _map.get(key);
-    }
-
-    function getWithMessage(bytes32 key, string calldata errorMessage) public view returns (uint256) {
-        return _map.get(key, errorMessage);
-    }
-}

+ 0 - 111
contracts/mocks/EnumerableSetMock.sol

@@ -1,111 +0,0 @@
-// SPDX-License-Identifier: MIT
-// This file was procedurally generated from scripts/generate/templates/EnumerableSetMock.js.
-
-pragma solidity ^0.8.0;
-
-import "../utils/structs/EnumerableSet.sol";
-
-// Bytes32Set
-contract EnumerableBytes32SetMock {
-    using EnumerableSet for EnumerableSet.Bytes32Set;
-
-    event OperationResult(bool result);
-
-    EnumerableSet.Bytes32Set private _set;
-
-    function contains(bytes32 value) public view returns (bool) {
-        return _set.contains(value);
-    }
-
-    function add(bytes32 value) public {
-        bool result = _set.add(value);
-        emit OperationResult(result);
-    }
-
-    function remove(bytes32 value) public {
-        bool result = _set.remove(value);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _set.length();
-    }
-
-    function at(uint256 index) public view returns (bytes32) {
-        return _set.at(index);
-    }
-
-    function values() public view returns (bytes32[] memory) {
-        return _set.values();
-    }
-}
-
-// AddressSet
-contract EnumerableAddressSetMock {
-    using EnumerableSet for EnumerableSet.AddressSet;
-
-    event OperationResult(bool result);
-
-    EnumerableSet.AddressSet private _set;
-
-    function contains(address value) public view returns (bool) {
-        return _set.contains(value);
-    }
-
-    function add(address value) public {
-        bool result = _set.add(value);
-        emit OperationResult(result);
-    }
-
-    function remove(address value) public {
-        bool result = _set.remove(value);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _set.length();
-    }
-
-    function at(uint256 index) public view returns (address) {
-        return _set.at(index);
-    }
-
-    function values() public view returns (address[] memory) {
-        return _set.values();
-    }
-}
-
-// UintSet
-contract EnumerableUintSetMock {
-    using EnumerableSet for EnumerableSet.UintSet;
-
-    event OperationResult(bool result);
-
-    EnumerableSet.UintSet private _set;
-
-    function contains(uint256 value) public view returns (bool) {
-        return _set.contains(value);
-    }
-
-    function add(uint256 value) public {
-        bool result = _set.add(value);
-        emit OperationResult(result);
-    }
-
-    function remove(uint256 value) public {
-        bool result = _set.remove(value);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _set.length();
-    }
-
-    function at(uint256 index) public view returns (uint256) {
-        return _set.at(index);
-    }
-
-    function values() public view returns (uint256[] memory) {
-        return _set.values();
-    }
-}

+ 0 - 31
contracts/mocks/GovernorCompMock.sol

@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../governance/extensions/GovernorCountingSimple.sol";
-import "../governance/extensions/GovernorVotesComp.sol";
-
-contract GovernorCompMock is GovernorVotesComp, GovernorCountingSimple {
-    constructor(string memory name_, ERC20VotesComp token_) Governor(name_) GovernorVotesComp(token_) {}
-
-    function quorum(uint256) public pure override returns (uint256) {
-        return 0;
-    }
-
-    function votingDelay() public pure override returns (uint256) {
-        return 4;
-    }
-
-    function votingPeriod() public pure override returns (uint256) {
-        return 16;
-    }
-
-    function cancel(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        bytes32 salt
-    ) public returns (uint256 proposalId) {
-        return _cancel(targets, values, calldatas, salt);
-    }
-}

+ 0 - 50
contracts/mocks/GovernorMock.sol

@@ -1,50 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../governance/extensions/GovernorProposalThreshold.sol";
-import "../governance/extensions/GovernorSettings.sol";
-import "../governance/extensions/GovernorCountingSimple.sol";
-import "../governance/extensions/GovernorVotesQuorumFraction.sol";
-
-contract GovernorMock is
-    GovernorProposalThreshold,
-    GovernorSettings,
-    GovernorVotesQuorumFraction,
-    GovernorCountingSimple
-{
-    constructor(
-        string memory name_,
-        IVotes token_,
-        uint256 votingDelay_,
-        uint256 votingPeriod_,
-        uint256 quorumNumerator_
-    )
-        Governor(name_)
-        GovernorSettings(votingDelay_, votingPeriod_, 0)
-        GovernorVotes(token_)
-        GovernorVotesQuorumFraction(quorumNumerator_)
-    {}
-
-    function cancel(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        bytes32 salt
-    ) public returns (uint256 proposalId) {
-        return _cancel(targets, values, calldatas, salt);
-    }
-
-    function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
-        return super.proposalThreshold();
-    }
-
-    function propose(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        string memory description
-    ) public override(Governor, GovernorProposalThreshold) returns (uint256) {
-        return super.propose(targets, values, calldatas, description);
-    }
-}

+ 0 - 31
contracts/mocks/GovernorVoteMock.sol

@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../governance/extensions/GovernorCountingSimple.sol";
-import "../governance/extensions/GovernorVotes.sol";
-
-contract GovernorVoteMocks is GovernorVotes, GovernorCountingSimple {
-    constructor(string memory name_, IVotes token_) Governor(name_) GovernorVotes(token_) {}
-
-    function quorum(uint256) public pure override returns (uint256) {
-        return 0;
-    }
-
-    function votingDelay() public pure override returns (uint256) {
-        return 4;
-    }
-
-    function votingPeriod() public pure override returns (uint256) {
-        return 16;
-    }
-
-    function cancel(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        bytes32 salt
-    ) public returns (uint256 proposalId) {
-        return _cancel(targets, values, calldatas, salt);
-    }
-}

+ 0 - 43
contracts/mocks/MathMock.sol

@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/math/Math.sol";
-
-contract MathMock {
-    function max(uint256 a, uint256 b) public pure returns (uint256) {
-        return Math.max(a, b);
-    }
-
-    function min(uint256 a, uint256 b) public pure returns (uint256) {
-        return Math.min(a, b);
-    }
-
-    function average(uint256 a, uint256 b) public pure returns (uint256) {
-        return Math.average(a, b);
-    }
-
-    function ceilDiv(uint256 a, uint256 b) public pure returns (uint256) {
-        return Math.ceilDiv(a, b);
-    }
-
-    function mulDiv(uint256 a, uint256 b, uint256 denominator, Math.Rounding direction) public pure returns (uint256) {
-        return Math.mulDiv(a, b, denominator, direction);
-    }
-
-    function sqrt(uint256 a, Math.Rounding direction) public pure returns (uint256) {
-        return Math.sqrt(a, direction);
-    }
-
-    function log2(uint256 a, Math.Rounding direction) public pure returns (uint256) {
-        return Math.log2(a, direction);
-    }
-
-    function log10(uint256 a, Math.Rounding direction) public pure returns (uint256) {
-        return Math.log10(a, direction);
-    }
-
-    function log256(uint256 a, Math.Rounding direction) public pure returns (uint256) {
-        return Math.log256(a, direction);
-    }
-}

+ 0 - 57
contracts/mocks/MerkleProofWrapper.sol

@@ -1,57 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/cryptography/MerkleProof.sol";
-
-contract MerkleProofWrapper {
-    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) public pure returns (bool) {
-        return MerkleProof.verify(proof, root, leaf);
-    }
-
-    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) public pure returns (bool) {
-        return MerkleProof.verifyCalldata(proof, root, leaf);
-    }
-
-    function processProof(bytes32[] memory proof, bytes32 leaf) public pure returns (bytes32) {
-        return MerkleProof.processProof(proof, leaf);
-    }
-
-    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) public pure returns (bytes32) {
-        return MerkleProof.processProofCalldata(proof, leaf);
-    }
-
-    function multiProofVerify(
-        bytes32[] memory proofs,
-        bool[] memory proofFlag,
-        bytes32 root,
-        bytes32[] memory leaves
-    ) public pure returns (bool) {
-        return MerkleProof.multiProofVerify(proofs, proofFlag, root, leaves);
-    }
-
-    function multiProofVerifyCalldata(
-        bytes32[] calldata proofs,
-        bool[] calldata proofFlag,
-        bytes32 root,
-        bytes32[] memory leaves
-    ) public pure returns (bool) {
-        return MerkleProof.multiProofVerifyCalldata(proofs, proofFlag, root, leaves);
-    }
-
-    function processMultiProof(
-        bytes32[] memory proofs,
-        bool[] memory proofFlag,
-        bytes32[] memory leaves
-    ) public pure returns (bytes32) {
-        return MerkleProof.processMultiProof(proofs, proofFlag, leaves);
-    }
-
-    function processMultiProofCalldata(
-        bytes32[] calldata proofs,
-        bool[] calldata proofFlag,
-        bytes32[] memory leaves
-    ) public pure returns (bytes32) {
-        return MerkleProof.processMultiProofCalldata(proofs, proofFlag, leaves);
-    }
-}

+ 2 - 2
contracts/mocks/MulticallTest.sol

@@ -2,11 +2,11 @@
 
 pragma solidity ^0.8.0;
 
-import "./MulticallTokenMock.sol";
+import "./token/ERC20MulticallMock.sol";
 
 contract MulticallTest {
     function checkReturnValues(
-        MulticallTokenMock multicallToken,
+        ERC20MulticallMock multicallToken,
         address[] calldata recipients,
         uint256[] calldata amounts
     ) external {

+ 0 - 10
contracts/mocks/MulticallTokenMock.sol

@@ -1,10 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Multicall.sol";
-import "./ERC20Mock.sol";
-
-contract MulticallTokenMock is ERC20Mock, Multicall {
-    constructor(uint256 initialBalance) ERC20Mock("MulticallToken", "BCT", msg.sender, initialBalance) {}
-}

+ 0 - 7
contracts/mocks/Ownable2StepMock.sol

@@ -1,7 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../access/Ownable2Step.sol";
-
-contract Ownable2StepMock is Ownable2Step {}

+ 0 - 7
contracts/mocks/OwnableMock.sol

@@ -1,7 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../access/Ownable.sol";
-
-contract OwnableMock is Ownable {}

+ 0 - 267
contracts/mocks/SafeCastMock.sol

@@ -1,267 +0,0 @@
-// SPDX-License-Identifier: MIT
-// This file was procedurally generated from scripts/generate/templates/SafeCastMock.js.
-
-pragma solidity ^0.8.0;
-
-import "../utils/math/SafeCast.sol";
-
-contract SafeCastMock {
-    using SafeCast for uint256;
-    using SafeCast for int256;
-
-    function toUint256(int256 a) public pure returns (uint256) {
-        return a.toUint256();
-    }
-
-    function toUint248(uint256 a) public pure returns (uint248) {
-        return a.toUint248();
-    }
-
-    function toUint240(uint256 a) public pure returns (uint240) {
-        return a.toUint240();
-    }
-
-    function toUint232(uint256 a) public pure returns (uint232) {
-        return a.toUint232();
-    }
-
-    function toUint224(uint256 a) public pure returns (uint224) {
-        return a.toUint224();
-    }
-
-    function toUint216(uint256 a) public pure returns (uint216) {
-        return a.toUint216();
-    }
-
-    function toUint208(uint256 a) public pure returns (uint208) {
-        return a.toUint208();
-    }
-
-    function toUint200(uint256 a) public pure returns (uint200) {
-        return a.toUint200();
-    }
-
-    function toUint192(uint256 a) public pure returns (uint192) {
-        return a.toUint192();
-    }
-
-    function toUint184(uint256 a) public pure returns (uint184) {
-        return a.toUint184();
-    }
-
-    function toUint176(uint256 a) public pure returns (uint176) {
-        return a.toUint176();
-    }
-
-    function toUint168(uint256 a) public pure returns (uint168) {
-        return a.toUint168();
-    }
-
-    function toUint160(uint256 a) public pure returns (uint160) {
-        return a.toUint160();
-    }
-
-    function toUint152(uint256 a) public pure returns (uint152) {
-        return a.toUint152();
-    }
-
-    function toUint144(uint256 a) public pure returns (uint144) {
-        return a.toUint144();
-    }
-
-    function toUint136(uint256 a) public pure returns (uint136) {
-        return a.toUint136();
-    }
-
-    function toUint128(uint256 a) public pure returns (uint128) {
-        return a.toUint128();
-    }
-
-    function toUint120(uint256 a) public pure returns (uint120) {
-        return a.toUint120();
-    }
-
-    function toUint112(uint256 a) public pure returns (uint112) {
-        return a.toUint112();
-    }
-
-    function toUint104(uint256 a) public pure returns (uint104) {
-        return a.toUint104();
-    }
-
-    function toUint96(uint256 a) public pure returns (uint96) {
-        return a.toUint96();
-    }
-
-    function toUint88(uint256 a) public pure returns (uint88) {
-        return a.toUint88();
-    }
-
-    function toUint80(uint256 a) public pure returns (uint80) {
-        return a.toUint80();
-    }
-
-    function toUint72(uint256 a) public pure returns (uint72) {
-        return a.toUint72();
-    }
-
-    function toUint64(uint256 a) public pure returns (uint64) {
-        return a.toUint64();
-    }
-
-    function toUint56(uint256 a) public pure returns (uint56) {
-        return a.toUint56();
-    }
-
-    function toUint48(uint256 a) public pure returns (uint48) {
-        return a.toUint48();
-    }
-
-    function toUint40(uint256 a) public pure returns (uint40) {
-        return a.toUint40();
-    }
-
-    function toUint32(uint256 a) public pure returns (uint32) {
-        return a.toUint32();
-    }
-
-    function toUint24(uint256 a) public pure returns (uint24) {
-        return a.toUint24();
-    }
-
-    function toUint16(uint256 a) public pure returns (uint16) {
-        return a.toUint16();
-    }
-
-    function toUint8(uint256 a) public pure returns (uint8) {
-        return a.toUint8();
-    }
-
-    function toInt256(uint256 a) public pure returns (int256) {
-        return a.toInt256();
-    }
-
-    function toInt248(int256 a) public pure returns (int248) {
-        return a.toInt248();
-    }
-
-    function toInt240(int256 a) public pure returns (int240) {
-        return a.toInt240();
-    }
-
-    function toInt232(int256 a) public pure returns (int232) {
-        return a.toInt232();
-    }
-
-    function toInt224(int256 a) public pure returns (int224) {
-        return a.toInt224();
-    }
-
-    function toInt216(int256 a) public pure returns (int216) {
-        return a.toInt216();
-    }
-
-    function toInt208(int256 a) public pure returns (int208) {
-        return a.toInt208();
-    }
-
-    function toInt200(int256 a) public pure returns (int200) {
-        return a.toInt200();
-    }
-
-    function toInt192(int256 a) public pure returns (int192) {
-        return a.toInt192();
-    }
-
-    function toInt184(int256 a) public pure returns (int184) {
-        return a.toInt184();
-    }
-
-    function toInt176(int256 a) public pure returns (int176) {
-        return a.toInt176();
-    }
-
-    function toInt168(int256 a) public pure returns (int168) {
-        return a.toInt168();
-    }
-
-    function toInt160(int256 a) public pure returns (int160) {
-        return a.toInt160();
-    }
-
-    function toInt152(int256 a) public pure returns (int152) {
-        return a.toInt152();
-    }
-
-    function toInt144(int256 a) public pure returns (int144) {
-        return a.toInt144();
-    }
-
-    function toInt136(int256 a) public pure returns (int136) {
-        return a.toInt136();
-    }
-
-    function toInt128(int256 a) public pure returns (int128) {
-        return a.toInt128();
-    }
-
-    function toInt120(int256 a) public pure returns (int120) {
-        return a.toInt120();
-    }
-
-    function toInt112(int256 a) public pure returns (int112) {
-        return a.toInt112();
-    }
-
-    function toInt104(int256 a) public pure returns (int104) {
-        return a.toInt104();
-    }
-
-    function toInt96(int256 a) public pure returns (int96) {
-        return a.toInt96();
-    }
-
-    function toInt88(int256 a) public pure returns (int88) {
-        return a.toInt88();
-    }
-
-    function toInt80(int256 a) public pure returns (int80) {
-        return a.toInt80();
-    }
-
-    function toInt72(int256 a) public pure returns (int72) {
-        return a.toInt72();
-    }
-
-    function toInt64(int256 a) public pure returns (int64) {
-        return a.toInt64();
-    }
-
-    function toInt56(int256 a) public pure returns (int56) {
-        return a.toInt56();
-    }
-
-    function toInt48(int256 a) public pure returns (int48) {
-        return a.toInt48();
-    }
-
-    function toInt40(int256 a) public pure returns (int40) {
-        return a.toInt40();
-    }
-
-    function toInt32(int256 a) public pure returns (int32) {
-        return a.toInt32();
-    }
-
-    function toInt24(int256 a) public pure returns (int24) {
-        return a.toInt24();
-    }
-
-    function toInt16(int256 a) public pure returns (int16) {
-        return a.toInt16();
-    }
-
-    function toInt8(int256 a) public pure returns (int8) {
-        return a.toInt8();
-    }
-}

+ 0 - 182
contracts/mocks/SafeERC20Helper.sol

@@ -1,182 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Context.sol";
-import "../token/ERC20/IERC20.sol";
-import "../token/ERC20/extensions/ERC20Permit.sol";
-import "../token/ERC20/utils/SafeERC20.sol";
-
-contract ERC20ReturnFalseMock is Context {
-    uint256 private _allowance;
-
-    // IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
-    // we write to a dummy state variable.
-    uint256 private _dummy;
-
-    function transfer(address, uint256) public returns (bool) {
-        _dummy = 0;
-        return false;
-    }
-
-    function transferFrom(address, address, uint256) public returns (bool) {
-        _dummy = 0;
-        return false;
-    }
-
-    function approve(address, uint256) public returns (bool) {
-        _dummy = 0;
-        return false;
-    }
-
-    function allowance(address, address) public view returns (uint256) {
-        require(_dummy == 0); // Dummy read from a state variable so that the function is view
-        return 0;
-    }
-}
-
-contract ERC20ReturnTrueMock is Context {
-    mapping(address => uint256) private _allowances;
-
-    // IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
-    // we write to a dummy state variable.
-    uint256 private _dummy;
-
-    function transfer(address, uint256) public returns (bool) {
-        _dummy = 0;
-        return true;
-    }
-
-    function transferFrom(address, address, uint256) public returns (bool) {
-        _dummy = 0;
-        return true;
-    }
-
-    function approve(address, uint256) public returns (bool) {
-        _dummy = 0;
-        return true;
-    }
-
-    function setAllowance(uint256 allowance_) public {
-        _allowances[_msgSender()] = allowance_;
-    }
-
-    function allowance(address owner, address) public view returns (uint256) {
-        return _allowances[owner];
-    }
-}
-
-contract ERC20NoReturnMock is Context {
-    mapping(address => uint256) private _allowances;
-
-    // IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
-    // we write to a dummy state variable.
-    uint256 private _dummy;
-
-    function transfer(address, uint256) public {
-        _dummy = 0;
-    }
-
-    function transferFrom(address, address, uint256) public {
-        _dummy = 0;
-    }
-
-    function approve(address, uint256) public {
-        _dummy = 0;
-    }
-
-    function setAllowance(uint256 allowance_) public {
-        _allowances[_msgSender()] = allowance_;
-    }
-
-    function allowance(address owner, address) public view returns (uint256) {
-        return _allowances[owner];
-    }
-}
-
-contract ERC20PermitNoRevertMock is
-    ERC20("ERC20PermitNoRevertMock", "ERC20PermitNoRevertMock"),
-    ERC20Permit("ERC20PermitNoRevertMock")
-{
-    function getChainId() external view returns (uint256) {
-        return block.chainid;
-    }
-
-    function permitThatMayRevert(
-        address owner,
-        address spender,
-        uint256 value,
-        uint256 deadline,
-        uint8 v,
-        bytes32 r,
-        bytes32 s
-    ) public {
-        super.permit(owner, spender, value, deadline, v, r, s);
-    }
-
-    function permit(
-        address owner,
-        address spender,
-        uint256 value,
-        uint256 deadline,
-        uint8 v,
-        bytes32 r,
-        bytes32 s
-    ) public override {
-        try this.permitThatMayRevert(owner, spender, value, deadline, v, r, s) {
-            // do nothing
-        } catch {
-            // do nothing
-        }
-    }
-}
-
-contract SafeERC20Wrapper is Context {
-    using SafeERC20 for IERC20;
-
-    IERC20 private _token;
-
-    constructor(IERC20 token) {
-        _token = token;
-    }
-
-    function transfer() public {
-        _token.safeTransfer(address(0), 0);
-    }
-
-    function transferFrom() public {
-        _token.safeTransferFrom(address(0), address(0), 0);
-    }
-
-    function approve(uint256 amount) public {
-        _token.safeApprove(address(0), amount);
-    }
-
-    function increaseAllowance(uint256 amount) public {
-        _token.safeIncreaseAllowance(address(0), amount);
-    }
-
-    function decreaseAllowance(uint256 amount) public {
-        _token.safeDecreaseAllowance(address(0), amount);
-    }
-
-    function permit(
-        address owner,
-        address spender,
-        uint256 value,
-        uint256 deadline,
-        uint8 v,
-        bytes32 r,
-        bytes32 s
-    ) public {
-        SafeERC20.safePermit(IERC20Permit(address(_token)), owner, spender, value, deadline, v, r, s);
-    }
-
-    function setAllowance(uint256 allowance_) public {
-        ERC20ReturnTrueMock(address(_token)).setAllowance(allowance_);
-    }
-
-    function allowance() public view returns (uint256) {
-        return _token.allowance(address(0), address(0));
-    }
-}

+ 72 - 0
contracts/mocks/SafeMathMemoryCheck.sol

@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../utils/math/SafeMath.sol";
+
+library SafeMathMemoryCheck {
+    function addMemoryCheck() internal pure returns (uint256 mem) {
+        uint256 length = 32;
+        assembly {
+            mem := mload(0x40)
+        }
+        for (uint256 i = 0; i < length; ++i) {
+            SafeMath.add(1, 1);
+        }
+        assembly {
+            mem := sub(mload(0x40), mem)
+        }
+    }
+
+    function subMemoryCheck() internal pure returns (uint256 mem) {
+        uint256 length = 32;
+        assembly {
+            mem := mload(0x40)
+        }
+        for (uint256 i = 0; i < length; ++i) {
+            SafeMath.sub(1, 1);
+        }
+        assembly {
+            mem := sub(mload(0x40), mem)
+        }
+    }
+
+    function mulMemoryCheck() internal pure returns (uint256 mem) {
+        uint256 length = 32;
+        assembly {
+            mem := mload(0x40)
+        }
+        for (uint256 i = 0; i < length; ++i) {
+            SafeMath.mul(1, 1);
+        }
+        assembly {
+            mem := sub(mload(0x40), mem)
+        }
+    }
+
+    function divMemoryCheck() internal pure returns (uint256 mem) {
+        uint256 length = 32;
+        assembly {
+            mem := mload(0x40)
+        }
+        for (uint256 i = 0; i < length; ++i) {
+            SafeMath.div(1, 1);
+        }
+        assembly {
+            mem := sub(mload(0x40), mem)
+        }
+    }
+
+    function modMemoryCheck() internal pure returns (uint256 mem) {
+        uint256 length = 32;
+        assembly {
+            mem := mload(0x40)
+        }
+        for (uint256 i = 0; i < length; ++i) {
+            SafeMath.mod(1, 1);
+        }
+        assembly {
+            mem := sub(mload(0x40), mem)
+        }
+    }
+}

+ 0 - 126
contracts/mocks/SafeMathMock.sol

@@ -1,126 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/math/SafeMath.sol";
-
-contract SafeMathMock {
-    function tryAdd(uint256 a, uint256 b) public pure returns (bool flag, uint256 value) {
-        return SafeMath.tryAdd(a, b);
-    }
-
-    function trySub(uint256 a, uint256 b) public pure returns (bool flag, uint256 value) {
-        return SafeMath.trySub(a, b);
-    }
-
-    function tryMul(uint256 a, uint256 b) public pure returns (bool flag, uint256 value) {
-        return SafeMath.tryMul(a, b);
-    }
-
-    function tryDiv(uint256 a, uint256 b) public pure returns (bool flag, uint256 value) {
-        return SafeMath.tryDiv(a, b);
-    }
-
-    function tryMod(uint256 a, uint256 b) public pure returns (bool flag, uint256 value) {
-        return SafeMath.tryMod(a, b);
-    }
-
-    // using the do* naming convention to avoid warnings due to clashing opcode names
-
-    function doAdd(uint256 a, uint256 b) public pure returns (uint256) {
-        return SafeMath.add(a, b);
-    }
-
-    function doSub(uint256 a, uint256 b) public pure returns (uint256) {
-        return SafeMath.sub(a, b);
-    }
-
-    function doMul(uint256 a, uint256 b) public pure returns (uint256) {
-        return SafeMath.mul(a, b);
-    }
-
-    function doDiv(uint256 a, uint256 b) public pure returns (uint256) {
-        return SafeMath.div(a, b);
-    }
-
-    function doMod(uint256 a, uint256 b) public pure returns (uint256) {
-        return SafeMath.mod(a, b);
-    }
-
-    function subWithMessage(uint256 a, uint256 b, string memory errorMessage) public pure returns (uint256) {
-        return SafeMath.sub(a, b, errorMessage);
-    }
-
-    function divWithMessage(uint256 a, uint256 b, string memory errorMessage) public pure returns (uint256) {
-        return SafeMath.div(a, b, errorMessage);
-    }
-
-    function modWithMessage(uint256 a, uint256 b, string memory errorMessage) public pure returns (uint256) {
-        return SafeMath.mod(a, b, errorMessage);
-    }
-
-    function addMemoryCheck() public pure returns (uint256 mem) {
-        uint256 length = 32;
-        assembly {
-            mem := mload(0x40)
-        }
-        for (uint256 i = 0; i < length; ++i) {
-            SafeMath.add(1, 1);
-        }
-        assembly {
-            mem := sub(mload(0x40), mem)
-        }
-    }
-
-    function subMemoryCheck() public pure returns (uint256 mem) {
-        uint256 length = 32;
-        assembly {
-            mem := mload(0x40)
-        }
-        for (uint256 i = 0; i < length; ++i) {
-            SafeMath.sub(1, 1);
-        }
-        assembly {
-            mem := sub(mload(0x40), mem)
-        }
-    }
-
-    function mulMemoryCheck() public pure returns (uint256 mem) {
-        uint256 length = 32;
-        assembly {
-            mem := mload(0x40)
-        }
-        for (uint256 i = 0; i < length; ++i) {
-            SafeMath.mul(1, 1);
-        }
-        assembly {
-            mem := sub(mload(0x40), mem)
-        }
-    }
-
-    function divMemoryCheck() public pure returns (uint256 mem) {
-        uint256 length = 32;
-        assembly {
-            mem := mload(0x40)
-        }
-        for (uint256 i = 0; i < length; ++i) {
-            SafeMath.div(1, 1);
-        }
-        assembly {
-            mem := sub(mload(0x40), mem)
-        }
-    }
-
-    function modMemoryCheck() public pure returns (uint256 mem) {
-        uint256 length = 32;
-        assembly {
-            mem := mload(0x40)
-        }
-        for (uint256 i = 0; i < length; ++i) {
-            SafeMath.mod(1, 1);
-        }
-        assembly {
-            mem := sub(mload(0x40), mem)
-        }
-    }
-}

+ 0 - 13
contracts/mocks/SignatureCheckerMock.sol

@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/cryptography/SignatureChecker.sol";
-
-contract SignatureCheckerMock {
-    using SignatureChecker for address;
-
-    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) public view returns (bool) {
-        return signer.isValidSignatureNow(hash, signature);
-    }
-}

+ 0 - 23
contracts/mocks/SignedMathMock.sol

@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/math/SignedMath.sol";
-
-contract SignedMathMock {
-    function max(int256 a, int256 b) public pure returns (int256) {
-        return SignedMath.max(a, b);
-    }
-
-    function min(int256 a, int256 b) public pure returns (int256) {
-        return SignedMath.min(a, b);
-    }
-
-    function average(int256 a, int256 b) public pure returns (int256) {
-        return SignedMath.average(a, b);
-    }
-
-    function abs(int256 n) public pure returns (uint256) {
-        return SignedMath.abs(n);
-    }
-}

+ 0 - 23
contracts/mocks/SignedSafeMathMock.sol

@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/math/SignedSafeMath.sol";
-
-contract SignedSafeMathMock {
-    function mul(int256 a, int256 b) public pure returns (int256) {
-        return SignedSafeMath.mul(a, b);
-    }
-
-    function div(int256 a, int256 b) public pure returns (int256) {
-        return SignedSafeMath.div(a, b);
-    }
-
-    function sub(int256 a, int256 b) public pure returns (int256) {
-        return SignedSafeMath.sub(a, b);
-    }
-
-    function add(int256 a, int256 b) public pure returns (int256) {
-        return SignedSafeMath.add(a, b);
-    }
-}

+ 0 - 31
contracts/mocks/StringsMock.sol

@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: MIT
-
-pragma solidity ^0.8.0;
-
-import "../utils/Strings.sol";
-
-contract StringsMock {
-    function toString(uint256 value) public pure returns (string memory) {
-        return Strings.toString(value);
-    }
-
-    function toString(int256 value) public pure returns (string memory) {
-        return Strings.toString(value);
-    }
-
-    function toHexString(uint256 value) public pure returns (string memory) {
-        return Strings.toHexString(value);
-    }
-
-    function toHexString(uint256 value, uint256 length) public pure returns (string memory) {
-        return Strings.toHexString(value, length);
-    }
-
-    function toHexString(address addr) public pure returns (string memory) {
-        return Strings.toHexString(addr);
-    }
-
-    function equal(string memory a, string memory b) public pure returns (bool) {
-        return Strings.equal(a, b);
-    }
-}

+ 3 - 9
contracts/mocks/VotesMock.sol

@@ -4,12 +4,10 @@ pragma solidity ^0.8.0;
 
 import "../governance/utils/Votes.sol";
 
-contract VotesMock is Votes {
+abstract contract VotesMock is Votes {
     mapping(address => uint256) private _balances;
     mapping(uint256 => address) private _owners;
 
-    constructor(string memory name) EIP712(name, "1") {}
-
     function getTotalSupply() public view returns (uint256) {
         return _getTotalSupply();
     }
@@ -22,19 +20,15 @@ contract VotesMock is Votes {
         return _balances[account];
     }
 
-    function mint(address account, uint256 voteId) external {
+    function _mint(address account, uint256 voteId) internal {
         _balances[account] += 1;
         _owners[voteId] = account;
         _transferVotingUnits(address(0), account, 1);
     }
 
-    function burn(uint256 voteId) external {
+    function _burn(uint256 voteId) internal {
         address owner = _owners[voteId];
         _balances[owner] -= 1;
         _transferVotingUnits(owner, address(0), 1);
     }
-
-    function getChainId() external view returns (uint256) {
-        return block.chainid;
-    }
 }

+ 20 - 0
contracts/mocks/governance/GovernorCompMock.sol

@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../governance/extensions/GovernorCountingSimple.sol";
+import "../../governance/extensions/GovernorVotesComp.sol";
+
+abstract contract GovernorCompMock is GovernorVotesComp, GovernorCountingSimple {
+    function quorum(uint256) public pure override returns (uint256) {
+        return 0;
+    }
+
+    function votingDelay() public pure override returns (uint256) {
+        return 4;
+    }
+
+    function votingPeriod() public pure override returns (uint256) {
+        return 16;
+    }
+}

+ 8 - 35
contracts/mocks/GovernorCompatibilityBravoMock.sol → contracts/mocks/governance/GovernorCompatibilityBravoMock.sol

@@ -2,30 +2,20 @@
 
 pragma solidity ^0.8.0;
 
-import "../governance/compatibility/GovernorCompatibilityBravo.sol";
-import "../governance/extensions/GovernorTimelockCompound.sol";
-import "../governance/extensions/GovernorSettings.sol";
-import "../governance/extensions/GovernorVotesComp.sol";
+import "../../governance/compatibility/GovernorCompatibilityBravo.sol";
+import "../../governance/extensions/GovernorTimelockCompound.sol";
+import "../../governance/extensions/GovernorSettings.sol";
+import "../../governance/extensions/GovernorVotesComp.sol";
 
-contract GovernorCompatibilityBravoMock is
+abstract contract GovernorCompatibilityBravoMock is
     GovernorCompatibilityBravo,
     GovernorSettings,
     GovernorTimelockCompound,
     GovernorVotesComp
 {
-    constructor(
-        string memory name_,
-        ERC20VotesComp token_,
-        uint256 votingDelay_,
-        uint256 votingPeriod_,
-        uint256 proposalThreshold_,
-        ICompoundTimelock timelock_
-    )
-        Governor(name_)
-        GovernorTimelockCompound(timelock_)
-        GovernorSettings(votingDelay_, votingPeriod_, proposalThreshold_)
-        GovernorVotesComp(token_)
-    {}
+    function quorum(uint256) public pure override returns (uint256) {
+        return 0;
+    }
 
     function supportsInterface(
         bytes4 interfaceId
@@ -33,10 +23,6 @@ contract GovernorCompatibilityBravoMock is
         return super.supportsInterface(interfaceId);
     }
 
-    function quorum(uint256) public pure override returns (uint256) {
-        return 0;
-    }
-
     function state(
         uint256 proposalId
     ) public view override(IGovernor, Governor, GovernorTimelockCompound) returns (ProposalState) {
@@ -90,19 +76,6 @@ contract GovernorCompatibilityBravoMock is
         super._execute(proposalId, targets, values, calldatas, descriptionHash);
     }
 
-    /**
-     * @notice WARNING: this is for mock purposes only. Ability to the _cancel function should be restricted for live
-     * deployments.
-     */
-    function cancel(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        bytes32 salt
-    ) public returns (uint256 proposalId) {
-        return _cancel(targets, values, calldatas, salt);
-    }
-
     function _cancel(
         address[] memory targets,
         uint256[] memory values,

+ 28 - 0
contracts/mocks/governance/GovernorMock.sol

@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../governance/extensions/GovernorProposalThreshold.sol";
+import "../../governance/extensions/GovernorSettings.sol";
+import "../../governance/extensions/GovernorCountingSimple.sol";
+import "../../governance/extensions/GovernorVotesQuorumFraction.sol";
+
+abstract contract GovernorMock is
+    GovernorProposalThreshold,
+    GovernorSettings,
+    GovernorVotesQuorumFraction,
+    GovernorCountingSimple
+{
+    function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) {
+        return super.proposalThreshold();
+    }
+
+    function propose(
+        address[] memory targets,
+        uint256[] memory values,
+        bytes[] memory calldatas,
+        string memory description
+    ) public override(Governor, GovernorProposalThreshold) returns (uint256) {
+        return super.propose(targets, values, calldatas, description);
+    }
+}

+ 6 - 18
contracts/mocks/GovernorPreventLateQuorumMock.sol → contracts/mocks/governance/GovernorPreventLateQuorumMock.sol

@@ -2,12 +2,12 @@
 
 pragma solidity ^0.8.0;
 
-import "../governance/extensions/GovernorPreventLateQuorum.sol";
-import "../governance/extensions/GovernorSettings.sol";
-import "../governance/extensions/GovernorCountingSimple.sol";
-import "../governance/extensions/GovernorVotes.sol";
+import "../../governance/extensions/GovernorPreventLateQuorum.sol";
+import "../../governance/extensions/GovernorSettings.sol";
+import "../../governance/extensions/GovernorCountingSimple.sol";
+import "../../governance/extensions/GovernorVotes.sol";
 
-contract GovernorPreventLateQuorumMock is
+abstract contract GovernorPreventLateQuorumMock is
     GovernorSettings,
     GovernorVotes,
     GovernorCountingSimple,
@@ -15,19 +15,7 @@ contract GovernorPreventLateQuorumMock is
 {
     uint256 private _quorum;
 
-    constructor(
-        string memory name_,
-        IVotes token_,
-        uint256 votingDelay_,
-        uint256 votingPeriod_,
-        uint256 quorum_,
-        uint64 voteExtension_
-    )
-        Governor(name_)
-        GovernorSettings(votingDelay_, votingPeriod_, 0)
-        GovernorVotes(token_)
-        GovernorPreventLateQuorum(voteExtension_)
-    {
+    constructor(uint256 quorum_) {
         _quorum = quorum_;
     }
 

+ 5 - 32
contracts/mocks/GovernorTimelockCompoundMock.sol → contracts/mocks/governance/GovernorTimelockCompoundMock.sol

@@ -2,32 +2,17 @@
 
 pragma solidity ^0.8.0;
 
-import "../governance/extensions/GovernorTimelockCompound.sol";
-import "../governance/extensions/GovernorSettings.sol";
-import "../governance/extensions/GovernorCountingSimple.sol";
-import "../governance/extensions/GovernorVotesQuorumFraction.sol";
+import "../../governance/extensions/GovernorTimelockCompound.sol";
+import "../../governance/extensions/GovernorSettings.sol";
+import "../../governance/extensions/GovernorCountingSimple.sol";
+import "../../governance/extensions/GovernorVotesQuorumFraction.sol";
 
-contract GovernorTimelockCompoundMock is
+abstract contract GovernorTimelockCompoundMock is
     GovernorSettings,
     GovernorTimelockCompound,
     GovernorVotesQuorumFraction,
     GovernorCountingSimple
 {
-    constructor(
-        string memory name_,
-        IVotes token_,
-        uint256 votingDelay_,
-        uint256 votingPeriod_,
-        ICompoundTimelock timelock_,
-        uint256 quorumNumerator_
-    )
-        Governor(name_)
-        GovernorTimelockCompound(timelock_)
-        GovernorSettings(votingDelay_, votingPeriod_, 0)
-        GovernorVotes(token_)
-        GovernorVotesQuorumFraction(quorumNumerator_)
-    {}
-
     function supportsInterface(
         bytes4 interfaceId
     ) public view override(Governor, GovernorTimelockCompound) returns (bool) {
@@ -40,18 +25,6 @@ contract GovernorTimelockCompoundMock is
         return super.quorum(blockNumber);
     }
 
-    function cancel(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        bytes32 salt
-    ) public returns (uint256 proposalId) {
-        return _cancel(targets, values, calldatas, salt);
-    }
-
-    /**
-     * Overriding nightmare
-     */
     function state(
         uint256 proposalId
     ) public view override(Governor, GovernorTimelockCompound) returns (ProposalState) {

+ 5 - 32
contracts/mocks/GovernorTimelockControlMock.sol → contracts/mocks/governance/GovernorTimelockControlMock.sol

@@ -2,32 +2,17 @@
 
 pragma solidity ^0.8.0;
 
-import "../governance/extensions/GovernorTimelockControl.sol";
-import "../governance/extensions/GovernorSettings.sol";
-import "../governance/extensions/GovernorCountingSimple.sol";
-import "../governance/extensions/GovernorVotesQuorumFraction.sol";
+import "../../governance/extensions/GovernorTimelockControl.sol";
+import "../../governance/extensions/GovernorSettings.sol";
+import "../../governance/extensions/GovernorCountingSimple.sol";
+import "../../governance/extensions/GovernorVotesQuorumFraction.sol";
 
-contract GovernorTimelockControlMock is
+abstract contract GovernorTimelockControlMock is
     GovernorSettings,
     GovernorTimelockControl,
     GovernorVotesQuorumFraction,
     GovernorCountingSimple
 {
-    constructor(
-        string memory name_,
-        IVotes token_,
-        uint256 votingDelay_,
-        uint256 votingPeriod_,
-        TimelockController timelock_,
-        uint256 quorumNumerator_
-    )
-        Governor(name_)
-        GovernorTimelockControl(timelock_)
-        GovernorSettings(votingDelay_, votingPeriod_, 0)
-        GovernorVotes(token_)
-        GovernorVotesQuorumFraction(quorumNumerator_)
-    {}
-
     function supportsInterface(
         bytes4 interfaceId
     ) public view override(Governor, GovernorTimelockControl) returns (bool) {
@@ -40,18 +25,6 @@ contract GovernorTimelockControlMock is
         return super.quorum(blockNumber);
     }
 
-    function cancel(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        bytes32 descriptionHash
-    ) public returns (uint256 proposalId) {
-        return _cancel(targets, values, calldatas, descriptionHash);
-    }
-
-    /**
-     * Overriding nightmare
-     */
     function state(uint256 proposalId) public view override(Governor, GovernorTimelockControl) returns (ProposalState) {
         return super.state(proposalId);
     }

+ 20 - 0
contracts/mocks/governance/GovernorVoteMock.sol

@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../governance/extensions/GovernorCountingSimple.sol";
+import "../../governance/extensions/GovernorVotes.sol";
+
+abstract contract GovernorVoteMocks is GovernorVotes, GovernorCountingSimple {
+    function quorum(uint256) public pure override returns (uint256) {
+        return 0;
+    }
+
+    function votingDelay() public pure override returns (uint256) {
+        return 4;
+    }
+
+    function votingPeriod() public pure override returns (uint256) {
+        return 16;
+    }
+}

+ 3 - 14
contracts/mocks/GovernorWithParamsMock.sol → contracts/mocks/governance/GovernorWithParamsMock.sol

@@ -2,14 +2,12 @@
 
 pragma solidity ^0.8.0;
 
-import "../governance/extensions/GovernorCountingSimple.sol";
-import "../governance/extensions/GovernorVotes.sol";
+import "../../governance/extensions/GovernorCountingSimple.sol";
+import "../../governance/extensions/GovernorVotes.sol";
 
-contract GovernorWithParamsMock is GovernorVotes, GovernorCountingSimple {
+abstract contract GovernorWithParamsMock is GovernorVotes, GovernorCountingSimple {
     event CountParams(uint256 uintParam, string strParam);
 
-    constructor(string memory name_, IVotes token_) Governor(name_) GovernorVotes(token_) {}
-
     function quorum(uint256) public pure override returns (uint256) {
         return 0;
     }
@@ -49,13 +47,4 @@ contract GovernorWithParamsMock is GovernorVotes, GovernorCountingSimple {
         }
         return super._countVote(proposalId, account, support, weight, params);
     }
-
-    function cancel(
-        address[] memory targets,
-        uint256[] memory values,
-        bytes[] memory calldatas,
-        bytes32 salt
-    ) public returns (uint256 proposalId) {
-        return _cancel(targets, values, calldatas, salt);
-    }
 }

+ 0 - 0
contracts/mocks/BadBeacon.sol → contracts/mocks/proxy/BadBeacon.sol


+ 0 - 0
contracts/mocks/ClashingImplementation.sol → contracts/mocks/proxy/ClashingImplementation.sol


+ 0 - 0
contracts/mocks/UUPS/UUPSLegacy.sol → contracts/mocks/proxy/UUPSLegacy.sol


+ 14 - 2
contracts/mocks/UUPS/UUPSUpgradeableMock.sol → contracts/mocks/proxy/UUPSUpgradeableMock.sol

@@ -2,10 +2,22 @@
 
 pragma solidity ^0.8.0;
 
-import "../CountersImpl.sol";
 import "../../proxy/utils/UUPSUpgradeable.sol";
+import "../../utils/Counters.sol";
 
-contract UUPSUpgradeableMock is CountersImpl, UUPSUpgradeable {
+contract NonUpgradeableMock {
+    Counters.Counter internal _counter;
+
+    function current() external view returns (uint256) {
+        return Counters.current(_counter);
+    }
+
+    function increment() external {
+        return Counters.increment(_counter);
+    }
+}
+
+contract UUPSUpgradeableMock is NonUpgradeableMock, UUPSUpgradeable {
     // Not having any checks in this function is dangerous! Do not do this outside tests!
     function _authorizeUpgrade(address) internal override {}
 }

+ 2 - 2
contracts/mocks/ERC1155ReceiverMock.sol → contracts/mocks/token/ERC1155ReceiverMock.sol

@@ -2,8 +2,8 @@
 
 pragma solidity ^0.8.0;
 
-import "../token/ERC1155/IERC1155Receiver.sol";
-import "../utils/introspection/ERC165.sol";
+import "../../token/ERC1155/IERC1155Receiver.sol";
+import "../../utils/introspection/ERC165.sol";
 
 contract ERC1155ReceiverMock is ERC165, IERC1155Receiver {
     bytes4 private _recRetval;

+ 17 - 0
contracts/mocks/token/ERC20DecimalsMock.sol

@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../token/ERC20/ERC20.sol";
+
+abstract contract ERC20DecimalsMock is ERC20 {
+    uint8 private immutable _decimals;
+
+    constructor(uint8 decimals_) {
+        _decimals = decimals_;
+    }
+
+    function decimals() public view override returns (uint8) {
+        return _decimals;
+    }
+}

+ 2 - 19
contracts/mocks/ERC20FlashMintMock.sol → contracts/mocks/token/ERC20FlashMintMock.sol

@@ -2,25 +2,12 @@
 
 pragma solidity ^0.8.0;
 
-import "../token/ERC20/extensions/ERC20FlashMint.sol";
+import "../../token/ERC20/extensions/ERC20FlashMint.sol";
 
-contract ERC20FlashMintMock is ERC20FlashMint {
+abstract contract ERC20FlashMintMock is ERC20FlashMint {
     uint256 _flashFeeAmount;
     address _flashFeeReceiverAddress;
 
-    constructor(
-        string memory name,
-        string memory symbol,
-        address initialAccount,
-        uint256 initialBalance
-    ) ERC20(name, symbol) {
-        _mint(initialAccount, initialBalance);
-    }
-
-    function mint(address account, uint256 amount) public {
-        _mint(account, amount);
-    }
-
     function setFlashFee(uint256 amount) public {
         _flashFeeAmount = amount;
     }
@@ -33,10 +20,6 @@ contract ERC20FlashMintMock is ERC20FlashMint {
         _flashFeeReceiverAddress = receiver;
     }
 
-    function flashFeeReceiver() public view returns (address) {
-        return _flashFeeReceiver();
-    }
-
     function _flashFeeReceiver() internal view override returns (address) {
         return _flashFeeReceiverAddress;
     }

+ 8 - 0
contracts/mocks/token/ERC20MulticallMock.sol

@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../token/ERC20/ERC20.sol";
+import "../../utils/Multicall.sol";
+
+abstract contract ERC20MulticallMock is ERC20, Multicall {}

+ 21 - 0
contracts/mocks/token/ERC20NoReturnMock.sol

@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+contract ERC20NoReturnMock {
+    mapping(address => uint256) private _allowances;
+
+    function transfer(address, uint256) public {}
+
+    function transferFrom(address, address, uint256) public {}
+
+    function approve(address, uint256) public {}
+
+    function setAllowance(address account, uint256 allowance_) public {
+        _allowances[account] = allowance_;
+    }
+
+    function allowance(address owner, address) public view returns (uint256) {
+        return _allowances[owner];
+    }
+}

+ 38 - 0
contracts/mocks/token/ERC20PermitNoRevertMock.sol

@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../token/ERC20/ERC20.sol";
+import "../../token/ERC20/extensions/draft-ERC20Permit.sol";
+
+contract ERC20PermitNoRevertMock is ERC20, ERC20Permit {
+    constructor() ERC20("ERC20PermitNoRevertMock", "ERC20PermitNoRevertMock") ERC20Permit("ERC20PermitNoRevertMock") {}
+
+    function permitThatMayRevert(
+        address owner,
+        address spender,
+        uint256 value,
+        uint256 deadline,
+        uint8 v,
+        bytes32 r,
+        bytes32 s
+    ) public virtual {
+        super.permit(owner, spender, value, deadline, v, r, s);
+    }
+
+    function permit(
+        address owner,
+        address spender,
+        uint256 value,
+        uint256 deadline,
+        uint8 v,
+        bytes32 r,
+        bytes32 s
+    ) public virtual override {
+        try this.permitThatMayRevert(owner, spender, value, deadline, v, r, s) {
+            // do nothing
+        } catch {
+            // do nothing
+        }
+    }
+}

+ 27 - 0
contracts/mocks/token/ERC20ReturnFalseMock copy.sol

@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+contract ERC20ReturnFalseMock {
+    mapping(address => uint256) private _allowances;
+
+    function transfer(address, uint256) public pure returns (bool) {
+        return false;
+    }
+
+    function transferFrom(address, address, uint256) public pure returns (bool) {
+        return false;
+    }
+
+    function approve(address, uint256) public pure returns (bool) {
+        return false;
+    }
+
+    function setAllowance(address account, uint256 allowance_) public {
+        _allowances[account] = allowance_;
+    }
+
+    function allowance(address owner, address) public view returns (uint256) {
+        return _allowances[owner];
+    }
+}

+ 27 - 0
contracts/mocks/token/ERC20ReturnTrueMock.sol

@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+contract ERC20ReturnTrueMock {
+    mapping(address => uint256) private _allowances;
+
+    function transfer(address, uint256) public pure returns (bool) {
+        return true;
+    }
+
+    function transferFrom(address, address, uint256) public pure returns (bool) {
+        return true;
+    }
+
+    function approve(address, uint256) public pure returns (bool) {
+        return true;
+    }
+
+    function setAllowance(address account, uint256 allowance_) public {
+        _allowances[account] = allowance_;
+    }
+
+    function allowance(address owner, address) public view returns (uint256) {
+        return _allowances[owner];
+    }
+}

+ 33 - 0
contracts/mocks/token/ERC4626DecimalsMock.sol

@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../token/ERC20/extensions/ERC4626.sol";
+
+abstract contract ERC4626DecimalsMock is ERC4626 {
+    using Math for uint256;
+
+    uint8 private immutable _decimals;
+
+    constructor(uint8 decimals_) {
+        _decimals = decimals_;
+    }
+
+    function decimals() public view virtual override returns (uint8) {
+        return _decimals;
+    }
+
+    function _initialConvertToShares(
+        uint256 assets,
+        Math.Rounding rounding
+    ) internal view virtual override returns (uint256 shares) {
+        return assets.mulDiv(10 ** decimals(), 10 ** super.decimals(), rounding);
+    }
+
+    function _initialConvertToAssets(
+        uint256 shares,
+        Math.Rounding rounding
+    ) internal view virtual override returns (uint256 assets) {
+        return shares.mulDiv(10 ** super.decimals(), 10 ** decimals(), rounding);
+    }
+}

+ 2 - 2
contracts/mocks/ERC721ConsecutiveEnumerableMock.sol → contracts/mocks/token/ERC721ConsecutiveEnumerableMock.sol

@@ -2,8 +2,8 @@
 
 pragma solidity ^0.8.0;
 
-import "../token/ERC721/extensions/ERC721Consecutive.sol";
-import "../token/ERC721/extensions/ERC721Enumerable.sol";
+import "../../token/ERC721/extensions/ERC721Consecutive.sol";
+import "../../token/ERC721/extensions/ERC721Enumerable.sol";
 
 contract ERC721ConsecutiveEnumerableMock is ERC721Consecutive, ERC721Enumerable {
     constructor(

+ 5 - 30
contracts/mocks/ERC721ConsecutiveMock.sol → contracts/mocks/token/ERC721ConsecutiveMock.sol

@@ -2,16 +2,15 @@
 
 pragma solidity ^0.8.0;
 
-import "../token/ERC721/extensions/ERC721Burnable.sol";
-import "../token/ERC721/extensions/ERC721Consecutive.sol";
-import "../token/ERC721/extensions/ERC721Enumerable.sol";
-import "../token/ERC721/extensions/ERC721Pausable.sol";
-import "../token/ERC721/extensions/ERC721Votes.sol";
+import "../../token/ERC721/extensions/ERC721Consecutive.sol";
+import "../../token/ERC721/extensions/ERC721Enumerable.sol";
+import "../../token/ERC721/extensions/ERC721Pausable.sol";
+import "../../token/ERC721/extensions/draft-ERC721Votes.sol";
 
 /**
  * @title ERC721ConsecutiveMock
  */
-contract ERC721ConsecutiveMock is ERC721Burnable, ERC721Consecutive, ERC721Pausable, ERC721Votes {
+contract ERC721ConsecutiveMock is ERC721Consecutive, ERC721Pausable, ERC721Votes {
     constructor(
         string memory name,
         string memory symbol,
@@ -28,30 +27,6 @@ contract ERC721ConsecutiveMock is ERC721Burnable, ERC721Consecutive, ERC721Pausa
         }
     }
 
-    function pause() external {
-        _pause();
-    }
-
-    function unpause() external {
-        _unpause();
-    }
-
-    function exists(uint256 tokenId) public view returns (bool) {
-        return _exists(tokenId);
-    }
-
-    function mint(address to, uint256 tokenId) public {
-        _mint(to, tokenId);
-    }
-
-    function mintConsecutive(address to, uint96 amount) public {
-        _mintConsecutive(to, amount);
-    }
-
-    function safeMint(address to, uint256 tokenId) public {
-        _safeMint(to, tokenId);
-    }
-
     function _ownerOf(uint256 tokenId) internal view virtual override(ERC721, ERC721Consecutive) returns (address) {
         return super._ownerOf(tokenId);
     }

+ 1 - 1
contracts/mocks/ERC721ReceiverMock.sol → contracts/mocks/token/ERC721ReceiverMock.sol

@@ -2,7 +2,7 @@
 
 pragma solidity ^0.8.0;
 
-import "../token/ERC721/IERC721Receiver.sol";
+import "../../token/ERC721/IERC721Receiver.sol";
 
 contract ERC721ReceiverMock is IERC721Receiver {
     enum Error {

+ 17 - 0
contracts/mocks/token/ERC721URIStorageMock.sol

@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../token/ERC721/extensions/ERC721URIStorage.sol";
+
+abstract contract ERC721URIStorageMock is ERC721URIStorage {
+    string private _baseTokenURI;
+
+    function _baseURI() internal view virtual override returns (string memory) {
+        return _baseTokenURI;
+    }
+
+    function setBaseURI(string calldata newBaseTokenURI) public {
+        _baseTokenURI = newBaseTokenURI;
+    }
+}

+ 13 - 0
contracts/mocks/token/ERC777Mock.sol

@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: MIT
+
+pragma solidity ^0.8.0;
+
+import "../../token/ERC777/ERC777.sol";
+
+abstract contract ERC777Mock is ERC777 {
+    event BeforeTokenTransfer();
+
+    function _beforeTokenTransfer(address, address, address, uint256) internal override {
+        emit BeforeTokenTransfer();
+    }
+}

+ 6 - 6
contracts/mocks/ERC777SenderRecipientMock.sol → contracts/mocks/token/ERC777SenderRecipientMock.sol

@@ -2,12 +2,12 @@
 
 pragma solidity ^0.8.0;
 
-import "../token/ERC777/IERC777.sol";
-import "../token/ERC777/IERC777Sender.sol";
-import "../token/ERC777/IERC777Recipient.sol";
-import "../utils/Context.sol";
-import "../utils/introspection/IERC1820Registry.sol";
-import "../utils/introspection/ERC1820Implementer.sol";
+import "../../token/ERC777/IERC777.sol";
+import "../../token/ERC777/IERC777Sender.sol";
+import "../../token/ERC777/IERC777Recipient.sol";
+import "../../utils/Context.sol";
+import "../../utils/introspection/IERC1820Registry.sol";
+import "../../utils/introspection/ERC1820Implementer.sol";
 
 contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient, ERC1820Implementer {
     event TokensToSendCalled(

+ 15 - 7
hardhat.config.js

@@ -51,13 +51,10 @@ const argv = require('yargs/yargs')()
 
 require('@nomiclabs/hardhat-truffle5');
 require('hardhat-ignore-warnings');
+require('hardhat-exposed');
 
 require('solidity-docgen');
 
-if (argv.gas) {
-  require('hardhat-gas-reporter');
-}
-
 for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
   require(path.join(__dirname, 'hardhat', f));
 }
@@ -91,13 +88,24 @@ module.exports = {
       allowUnlimitedContractSize: !withOptimizations,
     },
   },
-  gasReporter: {
+  exposed: {
+    exclude: [
+      'vendor/**/*',
+      // overflow clash
+      'utils/Timers.sol',
+    ],
+  },
+  docgen: require('./docs/config'),
+};
+
+if (argv.gas) {
+  require('hardhat-gas-reporter');
+  module.exports.gasReporter = {
     showMethodSig: true,
     currency: 'USD',
     outputFile: argv.gasReport,
     coinmarketcap: argv.coinmarketcap,
-  },
-  docgen: require('./docs/config'),
+  };
 };
 
 if (argv.coverage) {

+ 175 - 1
package-lock.json

@@ -26,6 +26,7 @@
         "glob": "^8.0.3",
         "graphlib": "^2.1.8",
         "hardhat": "^2.9.1",
+        "hardhat-exposed": "^0.3.0",
         "hardhat-gas-reporter": "^1.0.4",
         "hardhat-ignore-warnings": "^0.2.0",
         "keccak256": "^1.0.2",
@@ -6905,6 +6906,19 @@
         }
       }
     },
+    "node_modules/hardhat-exposed": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/hardhat-exposed/-/hardhat-exposed-0.3.0.tgz",
+      "integrity": "sha512-1p2Aou7QW3VVI0iJhh3q9hgPyF66zggeW7v/PrcipniQqaXK+KxJnnJvzGsLvXYzB8lVp23GIK7MXoTjjyXkHQ==",
+      "dev": true,
+      "dependencies": {
+        "micromatch": "^4.0.4",
+        "solidity-ast": "^0.4.25"
+      },
+      "peerDependencies": {
+        "hardhat": "^2.3.0"
+      }
+    },
     "node_modules/hardhat-gas-reporter": {
       "version": "1.0.9",
       "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.9.tgz",
@@ -9990,6 +10004,89 @@
         "prettier": ">=2.3.0 || >=3.0.0-alpha.0"
       }
     },
+    "node_modules/prettier-plugin-solidity/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/prettier-plugin-solidity/node_modules/is-fullwidth-code-point": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+      "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+      "dev": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/prettier-plugin-solidity/node_modules/lru-cache": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+      "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+      "dev": true,
+      "dependencies": {
+        "yallist": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/prettier-plugin-solidity/node_modules/semver": {
+      "version": "7.3.8",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
+      "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+      "dev": true,
+      "dependencies": {
+        "lru-cache": "^6.0.0"
+      },
+      "bin": {
+        "semver": "bin/semver.js"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/prettier-plugin-solidity/node_modules/string-width": {
+      "version": "4.2.3",
+      "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+      "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+      "dev": true,
+      "dependencies": {
+        "emoji-regex": "^8.0.0",
+        "is-fullwidth-code-point": "^3.0.0",
+        "strip-ansi": "^6.0.1"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/prettier-plugin-solidity/node_modules/string-width/node_modules/emoji-regex": {
+      "version": "8.0.0",
+      "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+      "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+      "dev": true
+    },
+    "node_modules/prettier-plugin-solidity/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/prettier-plugin-solidity/node_modules/yallist": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+      "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+      "dev": true
+    },
     "node_modules/process": {
       "version": "0.11.10",
       "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@@ -20019,6 +20116,16 @@
         }
       }
     },
+    "hardhat-exposed": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/hardhat-exposed/-/hardhat-exposed-0.3.0.tgz",
+      "integrity": "sha512-1p2Aou7QW3VVI0iJhh3q9hgPyF66zggeW7v/PrcipniQqaXK+KxJnnJvzGsLvXYzB8lVp23GIK7MXoTjjyXkHQ==",
+      "dev": true,
+      "requires": {
+        "micromatch": "^4.0.4",
+        "solidity-ast": "^0.4.25"
+      }
+    },
     "hardhat-gas-reporter": {
       "version": "1.0.9",
       "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.9.tgz",
@@ -22186,7 +22293,74 @@
       "requires": {
         "@solidity-parser/parser": "^0.14.5",
         "semver": "^7.3.8",
-        "solidity-comments-extractor": "^0.0.7"
+        "solidity-comments-extractor": "^0.0.7",
+        "string-width": "^4.2.3"
+      },
+      "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
+        },
+        "is-fullwidth-code-point": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+          "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+          "dev": true
+        },
+        "lru-cache": {
+          "version": "6.0.0",
+          "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+          "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+          "dev": true,
+          "requires": {
+            "yallist": "^4.0.0"
+          }
+        },
+        "semver": {
+          "version": "7.3.8",
+          "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
+          "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+          "dev": true,
+          "requires": {
+            "lru-cache": "^6.0.0"
+          }
+        },
+        "string-width": {
+          "version": "4.2.3",
+          "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+          "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+          "dev": true,
+          "requires": {
+            "emoji-regex": "^8.0.0",
+            "is-fullwidth-code-point": "^3.0.0",
+            "strip-ansi": "^6.0.1"
+          },
+          "dependencies": {
+            "emoji-regex": {
+              "version": "8.0.0",
+              "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+              "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+              "dev": true
+            }
+          }
+        },
+        "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"
+          }
+        },
+        "yallist": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+          "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+          "dev": true
+        }
       }
     },
     "process": {

+ 1 - 0
package.json

@@ -67,6 +67,7 @@
     "glob": "^8.0.3",
     "graphlib": "^2.1.8",
     "hardhat": "^2.9.1",
+    "hardhat-exposed": "^0.3.0",
     "hardhat-gas-reporter": "^1.0.4",
     "hardhat-ignore-warnings": "^0.2.0",
     "keccak256": "^1.0.2",

+ 0 - 8
scripts/generate/run.js

@@ -16,18 +16,10 @@ function getVersion (path) {
 }
 
 for (const [ file, template ] of Object.entries({
-  // SafeCast
   'utils/math/SafeCast.sol': './templates/SafeCast.js',
-  'mocks/SafeCastMock.sol': './templates/SafeCastMock.js',
-  // EnumerableSet
   'utils/structs/EnumerableSet.sol': './templates/EnumerableSet.js',
-  'mocks/EnumerableSetMock.sol': './templates/EnumerableSetMock.js',
-  // EnumerableMap
   'utils/structs/EnumerableMap.sol': './templates/EnumerableMap.js',
-  'mocks/EnumerableMapMock.sol': './templates/EnumerableMapMock.js',
-  // Checkpoints
   'utils/Checkpoints.sol': './templates/Checkpoints.js',
-  'mocks/CheckpointsMock.sol': './templates/CheckpointsMock.js',
 })) {
   const script = path.relative(path.join(__dirname, '../..'), __filename);
   const input = path.join(path.dirname(script), template);

+ 0 - 80
scripts/generate/templates/CheckpointsMock.js

@@ -1,80 +0,0 @@
-const format = require('../format-lines');
-
-const VALUE_SIZES = [ 224, 160 ];
-
-const header = `\
-pragma solidity ^0.8.0;
-
-import "../utils/Checkpoints.sol";
-`;
-
-const legacy = () => `\
-contract CheckpointsMock {
-    using Checkpoints for Checkpoints.History;
-
-    Checkpoints.History private _totalCheckpoints;
-
-    function latest() public view returns (uint256) {
-        return _totalCheckpoints.latest();
-    }
-
-    function latestCheckpoint() public view returns (bool, uint256, uint256) {
-        return _totalCheckpoints.latestCheckpoint();
-    }
-
-    function length() public view returns (uint256) {
-        return _totalCheckpoints.length();
-    }
-
-    function push(uint256 value) public returns (uint256, uint256) {
-        return _totalCheckpoints.push(value);
-    }
-
-    function getAtBlock(uint256 blockNumber) public view returns (uint256) {
-        return _totalCheckpoints.getAtBlock(blockNumber);
-    }
-
-    function getAtProbablyRecentBlock(uint256 blockNumber) public view returns (uint256) {
-        return _totalCheckpoints.getAtProbablyRecentBlock(blockNumber);
-    }
-}
-`;
-
-const checkpoint = length => `\
-contract Checkpoints${length}Mock {
-    using Checkpoints for Checkpoints.Trace${length};
-
-    Checkpoints.Trace${length} private _totalCheckpoints;
-
-    function latest() public view returns (uint${length}) {
-        return _totalCheckpoints.latest();
-    }
-
-    function latestCheckpoint() public view returns (bool, uint${256 - length}, uint${length}) {
-        return _totalCheckpoints.latestCheckpoint();
-    }
-
-    function length() public view returns (uint256) {
-        return _totalCheckpoints.length();
-    }
-
-    function push(uint${256 - length} key, uint${length} value) public returns (uint${length}, uint${length}) {
-        return _totalCheckpoints.push(key, value);
-    }
-
-    function lowerLookup(uint${256 - length} key) public view returns (uint${length}) {
-        return _totalCheckpoints.lowerLookup(key);
-    }
-
-    function upperLookup(uint${256 - length} key) public view returns (uint${length}) {
-        return _totalCheckpoints.upperLookup(key);
-    }
-}
-`;
-
-// GENERATE
-module.exports = format(
-  header,
-  legacy(),
-  ...VALUE_SIZES.map(checkpoint),
-);

+ 0 - 66
scripts/generate/templates/EnumerableMapMock.js

@@ -1,66 +0,0 @@
-const format = require('../format-lines');
-
-const TYPES = [
-  { name: 'UintToAddressMap', keyType: 'uint256', valueType: 'address' },
-  { name: 'AddressToUintMap', keyType: 'address', valueType: 'uint256' },
-  { name: 'Bytes32ToBytes32Map', keyType: 'bytes32', valueType: 'bytes32' },
-  { name: 'UintToUintMap', keyType: 'uint256', valueType: 'uint256' },
-  { name: 'Bytes32ToUintMap', keyType: 'bytes32', valueType: 'uint256' },
-];
-
-const header = `\
-pragma solidity ^0.8.0;
-
-import "../utils/structs/EnumerableMap.sol";
-`;
-
-const customSetMock = ({ name, keyType, valueType }) => `\
-// ${name}
-contract ${name}Mock {
-    using EnumerableMap for EnumerableMap.${name};
-
-    event OperationResult(bool result);
-
-    EnumerableMap.${name} private _map;
-
-    function contains(${keyType} key) public view returns (bool) {
-        return _map.contains(key);
-    }
-
-    function set(${keyType} key, ${valueType} value) public {
-        bool result = _map.set(key, value);
-        emit OperationResult(result);
-    }
-
-    function remove(${keyType} key) public {
-        bool result = _map.remove(key);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _map.length();
-    }
-
-    function at(uint256 index) public view returns (${keyType} key, ${valueType} value) {
-        return _map.at(index);
-    }
-
-    function tryGet(${keyType} key) public view returns (bool, ${valueType}) {
-        return _map.tryGet(key);
-    }
-
-    function get(${keyType} key) public view returns (${valueType}) {
-        return _map.get(key);
-    }
-
-    function getWithMessage(${keyType} key, string calldata errorMessage) public view returns (${valueType}) {
-        return _map.get(key, errorMessage);
-    }
-}
-`;
-
-// GENERATE
-module.exports = format(
-  header,
-  ...TYPES.map(details => customSetMock(details)),
-);

+ 0 - 56
scripts/generate/templates/EnumerableSetMock.js

@@ -1,56 +0,0 @@
-const format = require('../format-lines');
-
-const TYPES = [
-  { name: 'Bytes32Set', type: 'bytes32' },
-  { name: 'AddressSet', type: 'address' },
-  { name: 'UintSet', type: 'uint256' },
-];
-
-const header = `\
-pragma solidity ^0.8.0;
-
-import "../utils/structs/EnumerableSet.sol";
-`;
-
-const customSetMock = ({ name, type }) => `\
-// ${name}
-contract Enumerable${name}Mock {
-    using EnumerableSet for EnumerableSet.${name};
-
-    event OperationResult(bool result);
-
-    EnumerableSet.${name} private _set;
-
-    function contains(${type} value) public view returns (bool) {
-        return _set.contains(value);
-    }
-
-    function add(${type} value) public {
-        bool result = _set.add(value);
-        emit OperationResult(result);
-    }
-
-    function remove(${type} value) public {
-        bool result = _set.remove(value);
-        emit OperationResult(result);
-    }
-
-    function length() public view returns (uint256) {
-        return _set.length();
-    }
-
-    function at(uint256 index) public view returns (${type}) {
-        return _set.at(index);
-    }
-
-    function values() public view returns (${type}[] memory) {
-        return _set.values();
-    }
-}
-`;
-
-// GENERATE
-module.exports = format(
-  header,
-  ...TYPES.map(details => customSetMock(details)),
-);

+ 0 - 50
scripts/generate/templates/SafeCast.js

@@ -1,50 +0,0 @@
-const format = require('../format-lines');
-const { range } = require('../../helpers');
-
-const LENGTHS = range(8, 256, 8).reverse(); // 248 → 8 (in steps of 8)
-
-const header = `\
-pragma solidity ^0.8.0;
-
-import "../utils/math/SafeCast.sol";
-`;
-
-const toInt = length => `\
-function toInt${length}(uint${length} a) public pure returns (int${length}) {
-    return a.toInt${length}();
-}
-`;
-
-const toUint = length => `\
-function toUint${length}(int${length} a) public pure returns (uint${length}) {
-    return a.toUint${length}();
-}
-`;
-
-const toIntDownCast = length => `\
-function toInt${length}(int256 a) public pure returns (int${length}) {
-    return a.toInt${length}();
-}
-`;
-
-const toUintDownCast = length => `\
-function toUint${length}(uint256 a) public pure returns (uint${length}) {
-    return a.toUint${length}();
-}
-`;
-
-// GENERATE
-module.exports = format(
-  header,
-  'contract SafeCastMock {',
-  [
-    'using SafeCast for uint256;',
-    'using SafeCast for int256;',
-    '',
-    toUint(256),
-    ...LENGTHS.map(toUintDownCast),
-    toInt(256),
-    ...LENGTHS.map(toIntDownCast),
-  ].flatMap(fn => fn.split('\n')).slice(0, -1),
-  '}',
-);

+ 5 - 4
test/access/AccessControl.behavior.js

@@ -115,7 +115,7 @@ function shouldBehaveLikeAccessControl (errorPrefix, admin, authorized, other, o
 
   describe('setting role admin', function () {
     beforeEach(async function () {
-      const receipt = await this.accessControl.setRoleAdmin(ROLE, OTHER_ROLE);
+      const receipt = await this.accessControl.$_setRoleAdmin(ROLE, OTHER_ROLE);
       expectEvent(receipt, 'RoleAdminChanged', {
         role: ROLE,
         previousAdminRole: DEFAULT_ADMIN_ROLE,
@@ -161,19 +161,19 @@ function shouldBehaveLikeAccessControl (errorPrefix, admin, authorized, other, o
     });
 
     it('do not revert if sender has role', async function () {
-      await this.accessControl.senderProtected(ROLE, { from: authorized });
+      await this.accessControl.methods['$_checkRole(bytes32)'](ROLE, { from: authorized });
     });
 
     it('revert if sender doesn\'t have role #1', async function () {
       await expectRevert(
-        this.accessControl.senderProtected(ROLE, { from: other }),
+        this.accessControl.methods['$_checkRole(bytes32)'](ROLE, { from: other }),
         `${errorPrefix}: account ${other.toLowerCase()} is missing role ${ROLE}`,
       );
     });
 
     it('revert if sender doesn\'t have role #2', async function () {
       await expectRevert(
-        this.accessControl.senderProtected(OTHER_ROLE, { from: authorized }),
+        this.accessControl.methods['$_checkRole(bytes32)'](OTHER_ROLE, { from: authorized }),
         `${errorPrefix}: account ${authorized.toLowerCase()} is missing role ${OTHER_ROLE}`,
       );
     });
@@ -211,6 +211,7 @@ function shouldBehaveLikeAccessControlEnumerable (errorPrefix, admin, authorized
 }
 
 module.exports = {
+  DEFAULT_ADMIN_ROLE,
   shouldBehaveLikeAccessControl,
   shouldBehaveLikeAccessControlEnumerable,
 };

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio