Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

addReward is a useless function so it should be removed or its use should be justified

Summary

This function addReward given below add a reward to the list of rewards but there is no way this new added reward can be utilized in the `openBox` function.

function addReward(string memory _name, uint256 _value) public {
require(msg.sender == owner, "Only owner can add rewards");
rewardPool.push(Reward(_name, _value));
}

Vulnerability Details

Impact

Either this addReward function should be removed or openBoxfunction should be modified to modular approach so that new rewards added to should be utilized in it.

Tools Used

Recommendations

openBoxfunction should be modified so that it doesn't use hardcoded if condition for selecting the reward but some dynamic method that picks the winner on fly.

Updates

Appeal created

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

addReward won't have any effect on openBox

Support

FAQs

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