From 3a209d730e1ca927057b4735e5f94ef8394ed7c9 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Thu, 26 Sep 2024 17:00:23 +0200 Subject: [PATCH] (hub): on update v1 status, never reduce lastMintTime to avoid resetting stopped status --- src/circles/Circles.sol | 4 +--- src/hub/Hub.sol | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/circles/Circles.sol b/src/circles/Circles.sol index 45d2c63..4174b2a 100644 --- a/src/circles/Circles.sol +++ b/src/circles/Circles.sol @@ -185,14 +185,12 @@ contract Circles is ERC1155, ICirclesErrors { discountedTotalSupplies[_id] = totalSupplyBalance; } - // Private functions - /** * @dev Max function to compare two values. * @param a Value a * @param b Value b */ - function _max(uint256 a, uint256 b) private pure returns (uint256) { + function _max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } } diff --git a/src/hub/Hub.sol b/src/hub/Hub.sol index b99a4a9..c669faa 100644 --- a/src/hub/Hub.sol +++ b/src/hub/Hub.sol @@ -1117,7 +1117,9 @@ contract Hub is Circles, TypeDefinitions, IHubErrors { // to avoid possible overlap of the mint between Hub v1 and Hub v2 if (mintTime.mintV1Status != _mintV1Status) { mintTime.mintV1Status = _mintV1Status; - mintTime.lastMintTime = uint96(block.timestamp); + // for last mint time take the maximum to avoid resetting "INDEFINITE_FUTURE" + // which indicates stopped status of the human + mintTime.lastMintTime = uint96(_max(mintTime.lastMintTime, uint96(block.timestamp))); } }