// check for previous deposits
if (position.depositTime != 0) {
// check that bucket didn't go bankrupt after prior memorialization
if (_bucketBankruptAfterDeposit(pool, index, position.depositTime)) {
// if bucket did go bankrupt, zero out the LP tracked by position manager
position.lps = 0;
}
}
However, the lender could still have unclaimed rewards. In this case, the lender loses the rewards due to the lack of claiming rewards before zeroing out the previous tracked LP balance.
In RewardsManager, claimRewards there is no a check for bucket's bankruptcy.
Impact
Lose of unclaimed rewards in case a bucket goes bankrupt
ctf_sec
high
Lose of unclaimed rewards in case a bucket goes bankrupt
Summary
Lose of unclaimed rewards in case a bucket goes bankrupt
Vulnerability Detail
When the lender calls PositionManager.memorializePositions method
https://github.com/sherlock-audit/2023-04-ajna/blob/e2439305cc093204a0d927aac19d898f4a0edb3d/ajna-core/src/PositionManager.sol#L236
if the bucket goes bucket, the lps is zero out
However, the lender could still have unclaimed rewards. In this case, the lender loses the rewards due to the lack of claiming rewards before zeroing out the previous tracked LP balance.
In RewardsManager, claimRewards there is no a check for bucket's bankruptcy.
Impact
Lose of unclaimed rewards in case a bucket goes bankrupt
Code Snippet
https://github.com/sherlock-audit/2023-04-ajna/blob/e2439305cc093204a0d927aac19d898f4a0edb3d/ajna-core/src/PositionManager.sol#L236
Tool used
Manual Review
Recommendation
check and transfer unclaimed reward or at least record the unclaimed reward before calling
to avoid loss of reward
Duplicate of #100