Description:
When accumulating the fees from entranceFee
the variable totalFees
can overflow, because its type is uint64
and after for example 20-30 entrances it will overflow and wrap around and start from 0. This will cause loss of fees.
Impact:
Less incentive for the user running the contract.
Tools used:
foundry
Proof of Concept:
Recommended Mitigation:
Make the totalFees
variable of type uint256
.
diff --git a/src/PuppyRaffle.sol b/src/PuppyRaffle.sol
index b37922b..2685900 100644
--- a/src/PuppyRaffle.sol
+++ b/src/PuppyRaffle.sol
@@ -28,7 +28,7 @@ contract PuppyRaffle is ReentrancyGuard, ERC721, Ownable {
// We do some storage packing to save gas
address public feeAddress;
uint64 public totalFees = 0;
uint256 public totalFees = 0;
uint256 public raffleId = 1;
mapping(address => uint256) addressToRaffleId;
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.