The functions addUnderlying and removeUnderlying are designed to adjust the s.recapitalized value when the token involved is UNRIPE_LP. However, admin functions directly call incrementUnderlying and decrementUnderlying without appropriately updating the s.recapitalized value. The functions UnripeFacet:addMigratedUnderlying() and LibFertilizer:beginBarnRaiseMigration() fail to adjust s.recapitalized when they modify the underlying value of UNRIPE_LP. This oversight leads to a reduced value for unchopped UNRIPE_LP, resulting in unfair payouts for token holders.
The value of s.recapitalized represents the total value that has been recapitalized. This value is crucial for ensuring that the holders of UNRIPE_LP tokens receive the correct returns.
The bug is discovered previously showed on Immunefi that not updating s.recapitalized correctly led to reduced value for UNRIPE_LP holders.
A similar issue exists with the admin functions
addMigratedUnderlying:
This function allows the contract owner to add underlying tokens to the protocol without updating the s.recapitalized value. The function calls LibUnripe::incrementUnderlying without ensuring the s.recapitalized value is adjusted accordingly.
This can lead to an inconsistency where the s.recapitalized value does not reflect the actual state of the underlying tokens, affecting the value distribution for UNRIPE_LP holders.
beginBarnRaiseMigration:
This function is used during the barn raise migration process and decrements the underlying value of UNRIPE_LP without adjusting s.recapitalized in LibUnripe::decrementUnderlying() function call is called without updating s.recapitalized. This results in an incorrect s.recapitalized value, leading to premature recapitalization and reduced value for remaining UNRIPE_LP holders.
The called the LibUnripe.decrementUnderlying(C.UNRIPE_LP, balanceOfUnderlying); without change the recapped
Manual Review
UnripeFacet:addMigratedUnderlying() and LibFertilizer::beginBarnRaiseMigration() must call LibUnripe::addUnderlying() LibUnripe::removeUnderlying() instead of LibUnripe::decrementUnderlying, LibUnripe::incrementUnderlying to recapped the s.recapitalized.
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.