Refactor Time library to use valueBefore/valueAfter (#4555)
Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
@ -9,6 +9,7 @@ import {EIP712} from "../../utils/cryptography/EIP712.sol";
|
||||
import {Checkpoints} from "../../utils/structs/Checkpoints.sol";
|
||||
import {SafeCast} from "../../utils/math/SafeCast.sol";
|
||||
import {ECDSA} from "../../utils/cryptography/ECDSA.sol";
|
||||
import {Time} from "../../utils/types/Time.sol";
|
||||
|
||||
/**
|
||||
* @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be
|
||||
@ -55,7 +56,7 @@ abstract contract Votes is Context, EIP712, Nonces, IERC5805 {
|
||||
* checkpoints (and voting), in which case {CLOCK_MODE} should be overridden as well to match.
|
||||
*/
|
||||
function clock() public view virtual returns (uint48) {
|
||||
return SafeCast.toUint48(block.number);
|
||||
return Time.blockNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,7 +65,7 @@ abstract contract Votes is Context, EIP712, Nonces, IERC5805 {
|
||||
// solhint-disable-next-line func-name-mixedcase
|
||||
function CLOCK_MODE() public view virtual returns (string memory) {
|
||||
// Check that the clock was not modified
|
||||
if (clock() != block.number) {
|
||||
if (clock() != Time.blockNumber()) {
|
||||
revert ERC6372InconsistentClock();
|
||||
}
|
||||
return "mode=blocknumber&from=default";
|
||||
|
||||
Reference in New Issue
Block a user