Raisebox Faucet

First Flight #50
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: medium
Invalid

Useless "to" parameter in mintFaucetTokens() — function can only mint to the contract itself

Root + Impact

Description

The mintFaucetTokens() function includes an address parameter to, suggesting that tokens can be minted to any arbitrary address.
However, the function immediately checks whether to != address(this) and reverts if true — meaning the only valid argument is the contract’s own address.This makes the to parameter redundant and misleading, as the function effectively behaves as a fixed self-minting function for the faucet contract only.

function mintFaucetTokens(address to, uint256 amount) public onlyOwner {
// @> The function accepts `to` as an argument, implying flexibility.
if (to != address(this)) {
// @> But it enforces `to` == address(this), making the argument redundant.
revert RaiseBoxFaucet_MiningToNonContractAddressFailed();
}
// @> The balance check also references `address(to)`, which will always be the contract itself.
if (balanceOf(address(to)) > 1000 * 10 ** 18) {
revert RaiseBoxFaucet_FaucetNotOutOfTokens();
}
_mint(to, amount);
emit MintedNewFaucetTokens(to, amount);
}

Risk: Low

Likelihood: Medium

Factor Observation Likelihood Influence
Access Level Only callable by the owner Low
Exploitability Cannot be exploited for gain Low
Developer Confusion Likely due to misleading API Medium
Usage Frequency Administrative, rarely used Low
Code Clarity Decreases due to redundant argument Medium

Impact: Low

Impact Area Description
Functional No functional exploit or token loss — faucet still operates normally.
Code Quality Redundant argument introduces unnecessary complexity and confusion.
Maintainability Misleading parameter may cause developer misunderstanding or incorrect assumptions.
Auditability Lowers readability and increases chance of oversight during audits.
User Impact None for end users — affects internal maintainers only.

Proof of Concept


Step Input Expected Result
1️⃣ to = randomAddress Reverts with RaiseBoxFaucet_MiningToNonContractAddressFailed()
2️⃣ to = address(raiseBoxFaucet) Succeeds and emits MintedNewFaucetTokens event
function testMintFaucetTokens_ToParameterIsRedundant() public {
address owner = raiseBoxFaucet.owner();
address randomAddress = address(0x1234);
vm.startPrank(owner);
// Minting to any address other than the contract should revert.
vm.expectRevert(RaiseBoxFaucet.RaiseBoxFaucet_MiningToNonContractAddressFailed.selector);
raiseBoxFaucet.mintFaucetTokens(randomAddress, 1000 ether);
// Only minting to the contract itself succeeds.
raiseBoxFaucet.mintFaucetTokens(address(raiseBoxFaucet), 1000 ether);
vm.stopPrank();
}

Recommended Mitigation

Simplify the function to remove the redundant argument and mint directly to the contract address:

This change:

  • Improves clarity and maintainability.

  • Removes the misleading to parameter.

- function mintFaucetTokens(address to, uint256 amount) public onlyOwner {
- if (to != address(this)) {
- revert RaiseBoxFaucet_MiningToNonContractAddressFailed();
- }
- if (balanceOf(address(to)) > 1000 * 10 ** 18) {
- revert RaiseBoxFaucet_FaucetNotOutOfTokens();
- }
- _mint(to, amount);
- emit MintedNewFaucetTokens(to, amount);
- }
+ function mintFaucetTokens(uint256 amount) public onlyOwner {
+ if (balanceOf(address(this)) > 1000 * 10 ** 18) {
+ revert RaiseBoxFaucet_FaucetNotOutOfTokens();
+ }
+ _mint(address(this), amount);
+ emit MintedNewFaucetTokens(address(this), amount);
+}
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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