Mystery Box

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

Wrong reward data in `openBox` function

Summary

In our rewardPoolarray we have following box properties

rewardPool.push(Reward("Gold Coin", 0.5 ether));
rewardPool.push(Reward("Silver Coin", 0.25 ether));
rewardPool.push(Reward("Bronze Coin", 0.1 ether));
rewardPool.push(Reward("Coal", 0 ether));

But in openBoxfunction we have following code:

- rewardsOwned[msg.sender].push(Reward("Silver Coin", 0.5 ether)); 0.25 ether
+ silver must be 0.25 ether
} else {
// 1% chance to get Gold Coin (99)
- rewardsOwned[msg.sender].push(Reward("Gold Coin", 1 ether));
+ gold must be 0.5 ether
}

Impact

Discrepancy between intended rewards for boxes and real will drain the protocol and break it core invariants.

Recommendations

Remove wrong data from openBoxfunction.

Updates

Appeal created

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

The rewards in constructor are different from the rewards in openBox

Support

FAQs

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