Skip to content

Commit

Permalink
test: round up sub end when extending
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
  • Loading branch information
tmigone committed Sep 14, 2023
1 parent f5bc567 commit 7ee1ea7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/tests/Subscriptions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ contract Subscriptions is Ownable {
require(sub.start != 0, "no subscription found");
require(sub.rate != 0, "cannot extend a zero rate subscription");

uint64 newEnd = uint64(Math.max(sub.end, block.timestamp)) + uint64(amount / sub.rate);
uint64 newEnd = uint64(Math.max(sub.end, block.timestamp)) + uint64(Math.ceilDiv(amount, sub.rate));

_setEpochs(sub.start, sub.end, -int128(sub.rate));
_setEpochs(sub.start, newEnd, int128(sub.rate));
Expand Down

0 comments on commit 7ee1ea7

Please sign in to comment.