From 74ad1a2530d1fc1f31185a8af19eb25af22a9aaf Mon Sep 17 00:00:00 2001 From: Tina Zheng Date: Tue, 21 Nov 2023 14:34:43 -0500 Subject: [PATCH] remove custom timestamp getter --- contracts/base/BlockTimestamp.sol | 12 ------------ contracts/base/ERC721Permit.sol | 5 ++--- contracts/base/PeripheryValidation.sol | 6 ++---- 3 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 contracts/base/BlockTimestamp.sol diff --git a/contracts/base/BlockTimestamp.sol b/contracts/base/BlockTimestamp.sol deleted file mode 100644 index 5afe4b4b..00000000 --- a/contracts/base/BlockTimestamp.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.19; - -/// @title Function for getting block timestamp -/// @dev Base contract that is overridden for tests -abstract contract BlockTimestamp { - /// @dev Method that exists purely to be overridden for tests - /// @return The current block timestamp - function _blockTimestamp() internal view virtual returns (uint256) { - return block.timestamp; - } -} diff --git a/contracts/base/ERC721Permit.sol b/contracts/base/ERC721Permit.sol index 17541f8c..015f8394 100644 --- a/contracts/base/ERC721Permit.sol +++ b/contracts/base/ERC721Permit.sol @@ -7,11 +7,10 @@ import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {ChainId} from "../libraries/ChainId.sol"; import {IERC1271} from "../interfaces/external/IERC1271.sol"; import {IERC721Permit} from "../interfaces/IERC721Permit.sol"; -import {BlockTimestamp} from "./BlockTimestamp.sol"; /// @title ERC721 with permit /// @notice Nonfungible tokens that support an approve via signature, i.e. permit -abstract contract ERC721Permit is BlockTimestamp, ERC721, IERC721Permit { +abstract contract ERC721Permit is ERC721, IERC721Permit { /// @dev Gets the current nonce for a token ID and then increments it, returning the original value function _getAndIncrementNonce(uint256 tokenId) internal virtual returns (uint256); @@ -52,7 +51,7 @@ abstract contract ERC721Permit is BlockTimestamp, ERC721, IERC721Permit { payable override { - require(_blockTimestamp() <= deadline, "Permit expired"); + require(block.timestamp <= deadline, "Permit expired"); bytes32 digest = keccak256( abi.encodePacked( diff --git a/contracts/base/PeripheryValidation.sol b/contracts/base/PeripheryValidation.sol index e014477e..3f8a8b6d 100644 --- a/contracts/base/PeripheryValidation.sol +++ b/contracts/base/PeripheryValidation.sol @@ -1,11 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; -import {BlockTimestamp} from "./BlockTimestamp.sol"; - -abstract contract PeripheryValidation is BlockTimestamp { +abstract contract PeripheryValidation { modifier checkDeadline(uint256 deadline) { - require(_blockTimestamp() <= deadline, "Transaction too old"); + require(block.timestamp <= deadline, "Transaction too old"); _; } }