This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
coffiasd - starting new voting period not check current period has already ended #219
Labels
Non-Reward
This issue will not receive a payout
coffiasd
High
starting new voting period not check current period has already ended
Summary
starting new voting period not check current period has already ended , which can lead to calculation error result in reward token lost.
Vulnerability Detail
code link
From above code we can see there is no check if current period has ended.
when user vote, user -> Voter.sol ->BribeReward.sol to calculate the amount of reward token.
calculation code
the
_amountPerPeriod
is a fixed value after admin fundBribeReward.sol
contract. Thus the emissions speed is based onendTime - startTime
aka period duration.If the administrator intentionally or unintentionally starts a new voting period early, it will result in the remaining reward tokens being stuck in the contract because the release rate of reward tokens is calculated based on the end time.
Impact
reward tokens being stuck in the contract
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/Voter.sol#L107-L115
Tool used
Foundry
Manual Review
Recommendation
check if current period has ended before starting new period
The text was updated successfully, but these errors were encountered: