FeeSplitter.onBalanceChange doesn't claim already earned fees #66
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-39
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-01-curves/blob/main/contracts/FeeSplitter.sol#L96-L100
Vulnerability details
Proof of Concept
Subject token holders receive some portion of fees from subject token trading.
First, user's
data.userFeeOffset[account]
is updated to current reward rate of token. And then fee is distributed among all subject token holders and reward rate is increased.The problem is that when
onBalanceChange
is called, then function doesn't account situation, when user's balance was not 0 before and that he already accrued some fee. In this case they are not claimed anduserFeeOffset
is updated, which means that user has lost that portion of fees.Impact
User loses part of fee.
Tools Used
VsCode
Recommended Mitigation Steps
Make sure that all earned fees are accumulated and then update the rate.
Assessed type
Error
The text was updated successfully, but these errors were encountered: