Due to the way new stake is handled, users loose claimable fees when they add a stake to an existing staked amount.
When a user stakes, accumulateActor
is called within the stake
function of VaultRouterBranch.sol. The issue is that the accumulateActor
does not do what the name of the function implies.
As can be seen from the code above, it only updates the LastValuePerShare
for the user. The earned fees, valueChange
, are not stored anywhere and user's LastValuePerShare
is set to the latest valuepershare
. Therefore, in the case of user having a previous stake with a different valuepershare
compared to the current one(has earned fees) and adding a new stake will lead to user loosing the previously earned fees. Ideally, the code should revert if there are unclaimed fees for the user as it is done in the unstake
function.
This issue can be observed from the below POC. To run it, add the below test to the claimFees.t.sol
and run with forge test --match-test testFuzz_LostClaimablesOnAdditionalStake -vvv
command.
Impact
Users loose claimable fees when they stake additional index tokens on top of previous stake.
Foundry
Make the stake operation to revert when there are claimable rewards as it is done in during unstaking.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.