From afc1d7bbff789a8e63b78745e88eccb53eb2f24a Mon Sep 17 00:00:00 2001 From: Michael Standen Date: Mon, 10 Jul 2023 09:33:57 +1200 Subject: [PATCH] Update contracts to match deployment on chain --- contracts/modules/commons/ModuleHooks.sol | 15 +-------------- contracts/modules/utils/RequireUtils.sol | 2 +- foundry_test/modules/utils/RequireUtils.t.sol | 6 +----- test/ERC165.spec.ts | 1 - 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/contracts/modules/commons/ModuleHooks.sol b/contracts/modules/commons/ModuleHooks.sol index 5d5a7b60..80996977 100644 --- a/contracts/modules/commons/ModuleHooks.sol +++ b/contracts/modules/commons/ModuleHooks.sol @@ -8,12 +8,11 @@ import "./ModuleStorage.sol"; import "./ModuleERC165.sol"; import "../../interfaces/receivers/IERC1155Receiver.sol"; -import "../../interfaces/receivers/IERC777Receiver.sol"; import "../../interfaces/receivers/IERC721Receiver.sol"; import "../../interfaces/receivers/IERC223Receiver.sol"; -contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC223Receiver, IModuleHooks, ModuleERC165, ModuleSelfAuth { +contract ModuleHooks is IERC1155Receiver, IERC721Receiver, IModuleHooks, ModuleERC165, ModuleSelfAuth { // HOOKS_KEY = keccak256("org.arcadeum.module.hooks.hooks"); bytes32 private constant HOOKS_KEY = bytes32(0xbe27a319efc8734e89e26ba4bc95f5c788584163b959f03fa04e2d7ab4b9a120); @@ -95,12 +94,6 @@ contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC return ModuleHooks.onERC1155BatchReceived.selector; } - /** - * @notice Handle the receipt of ERC777 token types. - */ - // solhint-disable-next-line no-empty-blocks - function tokensReceived(address, address, address, uint256, bytes calldata, bytes calldata) external override virtual {} - /** * @notice Handle the receipt of a single ERC721 token. * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` @@ -109,11 +102,6 @@ contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC return ModuleHooks.onERC721Received.selector; } - /** - * @notice Handle the receipt of ERC223 tokens. - */ - function tokenFallback(address, uint256, bytes calldata) external override virtual {} // solhint-disable-line no-empty-blocks - /** * @notice Routes fallback calls through hooks */ @@ -147,7 +135,6 @@ contract ModuleHooks is IERC1155Receiver, IERC777Receiver, IERC721Receiver, IERC if ( _interfaceID == type(IModuleHooks).interfaceId || _interfaceID == type(IERC1155Receiver).interfaceId || - _interfaceID == type(IERC777Receiver).interfaceId || _interfaceID == type(IERC721Receiver).interfaceId || _interfaceID == type(IERC223Receiver).interfaceId ) { diff --git a/contracts/modules/utils/RequireUtils.sol b/contracts/modules/utils/RequireUtils.sol index c9a9eb00..957e2c94 100644 --- a/contracts/modules/utils/RequireUtils.sol +++ b/contracts/modules/utils/RequireUtils.sol @@ -13,7 +13,7 @@ contract RequireUtils { * @param _expiration Expiration to check */ function requireNonExpired(uint256 _expiration) external view { - require(block.timestamp <= _expiration, "RequireUtils#requireNonExpired: EXPIRED"); + require(block.timestamp < _expiration, "RequireUtils#requireNonExpired: EXPIRED"); } /** diff --git a/foundry_test/modules/utils/RequireUtils.t.sol b/foundry_test/modules/utils/RequireUtils.t.sol index b137b307..66acdbb4 100644 --- a/foundry_test/modules/utils/RequireUtils.t.sol +++ b/foundry_test/modules/utils/RequireUtils.t.sol @@ -54,16 +54,12 @@ contract SubModuleNonceTest is AdvTest { } function test_requireNonExpired(uint256 _expiration) external { - if (block.timestamp > _expiration) { + if (block.timestamp >= _expiration) { vm.expectRevert(bytes('RequireUtils#requireNonExpired: EXPIRED')); } requireUtils.requireNonExpired(_expiration); } - function test_requireNonExpiredWithExactBlock() external view { - requireUtils.requireNonExpired(block.timestamp); - } - function test_requireMinNonce(uint160 _space, uint96 _nonce, uint96 _nonceToCheck) external { imp.writeNonce(_space, _nonce); uint256 encoded = abi.decode(abi.encodePacked(_space, _nonceToCheck), (uint256)); diff --git a/test/ERC165.spec.ts b/test/ERC165.spec.ts index 3eed32c8..3cd718ff 100644 --- a/test/ERC165.spec.ts +++ b/test/ERC165.spec.ts @@ -6,7 +6,6 @@ import { expect, interfaceIdOf, randomHex } from './utils' const interfaceIds = [ 'IERC223Receiver', 'IERC721Receiver', - 'IERC777Receiver', 'IERC1155Receiver', 'IERC1271Wallet', 'IModuleAuth',