Skip to content

Commit

Permalink
(hub): on update v1 status, never reduce lastMintTime to avoid resett…
Browse files Browse the repository at this point in the history
…ing stopped status
  • Loading branch information
benjaminbollen committed Sep 26, 2024
1 parent 74a6435 commit 3a209d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/circles/Circles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 3 additions & 1 deletion src/hub/Hub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
}

Expand Down

0 comments on commit 3a209d7

Please sign in to comment.