Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(hub): on update v1 status, never reduce lastMintTime to avoid resett… #48

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading