Skip to content

Commit e26359a

Browse files
committed
fix(hardhat, distributor v5): gracefully handle timestamp underflow
1 parent 5ba8531 commit e26359a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/hardhat/contracts/claim/distributor-v5/ContinuousVestingMerkleDistributorFactory.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity 0.8.21;
33

4+
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
45
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
56
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
67
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
@@ -186,7 +187,7 @@ contract ContinuousVestingMerkleDistributorFactory_v_5_0 {
186187
require(answeredInRound > 0, "answer == 0");
187188
require(updatedAt > 0, "round not complete");
188189
require(answeredInRound >= roundID, "stale price");
189-
require(updatedAt < block.timestamp - heartbeat, "stale price");
190+
require(updatedAt > Math.max(block.timestamp, heartbeat) - heartbeat, "stale price");
190191

191192
return uint256(_price);
192193
}

0 commit comments

Comments
 (0)