Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/DerolasAuction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions test/DerolasAuction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}