One Shot: Reloaded

First Flight #47
Beginner FriendlyNFT
100 EXP
Submission Details
Impact: high
Likelihood: high

Stakers will receive 1e18 less CRED than expected

Author Revealed upon completion

Root + Impact

Description

The protocol implements a staking mechanics. Users can stake their rappers and will earn CRED per full day staked. However, the reward is only 1 unit of CRED, which is unexpectedly low.

// streets::unstake
@> if (days_staked >= 1) { cred_token::mint(module_owner, staker_addr, 1); };
@> if (days_staked >= 2) { cred_token::mint(module_owner, staker_addr, 1); };
@> if (days_staked >= 3) { cred_token::mint(module_owner, staker_addr, 1); };
@> if (days_staked >= 4) { cred_token::mint(module_owner, staker_addr, 1); };

Risk

Likelihood:

Happens every time a user unstakes a rapper after at least 1 day of staking

Impact:

Users receive 1e8 less CRED than expected

Recommended Mitigation

- if (days_staked >= 1) { cred_token::mint(module_owner, staker_addr, 1); };
- if (days_staked >= 2) { cred_token::mint(module_owner, staker_addr, 1); };
- if (days_staked >= 3) { cred_token::mint(module_owner, staker_addr, 1); };
- if (days_staked >= 4) { cred_token::mint(module_owner, staker_addr, 1); };
+ if (days_staked >= 1) { cred_token::mint(module_owner, staker_addr, 100000000); };
+ if (days_staked >= 2) { cred_token::mint(module_owner, staker_addr, 100000000); };
+ if (days_staked >= 3) { cred_token::mint(module_owner, staker_addr, 100000000); };
+ if (days_staked >= 4) { cred_token::mint(module_owner, staker_addr, 100000000); };

Support

FAQs

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