In LibUnripe:switchUnderlyingToken
there is a missing must condition that the balance of underlying of unripe token should be zero before switching underlying token s.u[unripeToken].balanceOfUnderlying == 0
.
Although some functions calling it have checked the condition there is 1 function in InitMigrateUnripeBean3CrvToBeanEth
that has left it. Also if there are more functionalities which will need this function its highly possible that this check will be missed.
Without this validation, it could lead to unexpected behavior or inconsistencies in the underlying token switching process, and if there is some balance. That will be lost during the switching.
Manual Review
Apply this condition require(s.u[unripeToken].balanceOfUnderlying == 0, "Unripe: Underlying balance > 0");
in the start of switchUnderlyingToken
to resolve the issue.
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.