From a3b2d5a15c5c18bc3787954d1d079a892ff885d6 Mon Sep 17 00:00:00 2001 From: 8ball030 <8baller@station.codes> Date: Sun, 13 Jul 2025 09:52:45 +0100 Subject: [PATCH] fix:resolve-remaining-issue --- src/DerolasAuction.sol | 1 + test/DerolasAuction.t.sol | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/DerolasAuction.sol b/src/DerolasAuction.sol index 301a303..fd588b9 100644 --- a/src/DerolasAuction.sol +++ b/src/DerolasAuction.sol @@ -311,6 +311,7 @@ contract DerolasAuction { ); require(roundToDonations[curRound][msg.sender] == 0, "Already donated this round"); + require(getRemainingRoundLength() > 0, "Round has ended"); roundPoints[curRound].totalDonated += msg.value; roundToDonations[curRound][msg.sender] = msg.value; diff --git a/test/DerolasAuction.t.sol b/test/DerolasAuction.t.sol index b012338..9dba3d3 100644 --- a/test/DerolasAuction.t.sol +++ b/test/DerolasAuction.t.sol @@ -408,4 +408,13 @@ contract TestDerolasAuctionContract is Test { assertLt(address(c).balance, minimumTradeAmount, "Contract should have less than minimum trade amount in ETH"); this.testCanEndRound(); // Ensure the round can be ended without failing } + + function testCannotDonateAfterRoundEnd() public { + // Check that a user cannot donate after the round has ended + this.testTopupIncentivesBalance(); // Ensure incentives are topped up + // fast-forward to the block after the round length + vm.roll(block.number + roundLength + 1); + vm.expectRevert("Round has ended"); + c.donate{value: minimumDonation}(); // Attempt to donate after round end + } }