Lines of code
<https://github.com/code-423n4/2023-09-venus/blob/main/contracts/Tokens/Prime/Prime.sol#L597-L601>
<https://github.com/code-423n4/2023-09-venus/blob/main/contracts/Tokens/Prime/Prime.sol#L672-L697>
This oversight in the contract logic may lead to incorrect interest calculations for users. Specifically, if a user’s balance or the factors contributing to the score changes between interest accruals (due to actions outside of staking more tokens), the system might use an outdated score to calculate the interest for the user during claims. This could result in users either claiming less or more interest than they are entitled to, thereby compromising the integrity of the platform’s reward distribution mechanism.
1. Incorrect Interest Accrual:
2. User Score Calculation:
3. Lack of Score Update during Interest Claiming:
Illustrative Scenario (For PoC clarity):
Imagine user Alice whose initial score was 100. Over time, due to various activities on the platform, her effective score should now be 120. However, because she hasn’t staked more tokens recently, her score remains outdated in the system. When Alice goes to claim her interest, the system calculates her rewards based on the old score of 100 instead of the updated score of 120. This results in Alice receiving less interest than she is rightfully owed.
Update Score during Interest Claim: Incorporate logic to update the user’s score within the claimInterest function. This ensures that the most recent score is always used during interest calculation.
Trigger-based Score Update: Implement a trigger mechanism that updates a user’s score anytime there’s an action that might change it, not just during staking.
Other
The text was updated successfully, but these errors were encountered:
All reactions