Raisebox Faucet

First Flight #50
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

Broken logic skips last claim

Broken logic skips last claim

A strict balance check in claimFaucetTokens prevents the last available faucet claim from succeeding. The function rejects claims when the contract balance is equal to faucetDrip, effectively skipping the final intended distribution.

Risk

Likelihood: Low

The issue is triggered when the contract balance exactly equals one claim amount.

Imapct: Low

A single user is unable to claim the final drip with funds remain in the contract.

Proof of Concept

The following Forge test demonstrates the failure of last claim with enough available balance

function test_reverts_with_balance_for_a_final_claim() public {
vm.startPrank(contractAddress);
uint256 startingBalance = raiseBoxFaucet.balanceOf(contractAddress);
raiseBoxFaucet.transfer(user1, startingBalance - faucetDrip);
uint256 endingBalance = raiseBoxFaucet.balanceOf(contractAddress);
vm.stopPrank();
assertEq(endingBalance, faucetDrip);
vm.warp(5 days);
vm.startPrank(user1);
vm.expectRevert();
raiseBoxFaucet.claimFaucetTokens();
vm.stopPrank();
}

Recommended Mitigation

Allow claims when the contract balance equals faucetDrip by changing the comparison to strict less-than:

-if (balanceOf(address(this)) <= faucetDrip) {
+if (balanceOf(address(this)) < faucetDrip) {
revert RaiseBoxFaucet_InsufficientContractBalance();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 5 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Off-by-one error in `claimFaucetTokens` prevents claiming when the balance is exactly equal to faucetDrip

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.