Mystery Box

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

Potential Economic Imbalance due to Fixed `SEEDVALUE` and Limited Reward Pool

Summary

The MysteryBox contract uses a fixed SEEDVALUE for initial funding and has a limited initial reward pool, which could lead to economic imbalances and sustainability issues as the contract scales.

Vulnerability Details

  1. Fixed SEEDVALUE:

uint256 public constant SEEDVALUE = 0.1 ether;
  • Used only in the constructor

  • No mechanism to adjust or add funds later

  1. Limited initial reward pool:

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));
  • Fixed initial rewards

  • Total value of non-zero rewards: 0.85 ether

  • No automatic refill mechanism

  1. Mismatch between SEEDVALUE and reward values:

    • SEEDVALUE (0.1 ether) is less than total non-zero rewards (0.85 ether)

Impact

  • Potential for contract to become underfunded if many high-value rewards are claimed

  • Risk of economic imbalance if box sales don't match reward distributions

  • Lack of scalability as the contract grows in usage

  • Possible user disappointment due to limited reward variety

Tools Used

Manual code review and economic analysis

Recommendations

  1. Implement a dynamic funding mechanism:

    • Allow additional deposits to the contract

    • Consider a percentage-based fee on box purchases to sustain the reward pool

  2. Create a more robust reward system:

    • Implement dynamic reward pools that adjust based on contract balance

    • Add functionality to update reward probabilities and values

  3. Improve economic balancing:

    • Ensure initial funding (SEEDVALUE) matches or exceeds total possible rewards

    • Implement checks to maintain a minimum contract balance relative to outstanding potential rewards

  4. Add monitoring and reporting:

    • Implement events to track reward distributions and contract balance changes

    • Create functions to report on current economic state of the contract

By implementing these recommendations, the contract can achieve better economic balance, scalability, and long-term sustainability, providing a more reliable and engaging experience for users.

Updates

Appeal created

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

Protocol should have a higher initial balance to prevent prize withdrawing problems

Support

FAQs

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