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

V0.3.7 patch05 missing hour when minting exactly on the hour #51

Closed
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
11 changes: 9 additions & 2 deletions src/circles/Circles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,17 @@ contract Circles is ERC1155, ICirclesErrors {
// calculate the number of completed hours in day A until `startMint`
int128 k = Math64x64.fromUInt((startMint - (dA * 1 days + inflationDayZero)) / 1 hours);

// Calculate the number of incompleted hours remaining in day B from current timestamp
int128 l = Math64x64.fromUInt(((dB + 1) * 1 days + inflationDayZero - block.timestamp) / 1 hours + 1);
// Calculate the number of seconds remaining in the current day (dB)
uint256 secondsRemainingInB = ((dB + 1) * 1 days + inflationDayZero - block.timestamp);
// Calculate the number of complete hours remaining
uint256 hoursRemainingInB = secondsRemainingInB / 1 hours;
// Calculate l:
// If there are any seconds beyond complete hours, add 1 to account for the incomplete hour
// Convert the result to int128 using Math64x64.fromUInt
int128 l = Math64x64.fromUInt(hoursRemainingInB + (secondsRemainingInB % 1 hours > 0 ? 1 : 0));

// calculate the overcounted (demurraged) k (in day A) and l (in day B) hours
// note that the hours l are not demurraged as it is current day by construction
int128 overcount = Math64x64.add(Math64x64.mul(R[n], k), l);

// subtract the overcount from the total issuance, and convert to attoCircles
Expand Down
Loading