The getPercentPenalty
function is designed to return the percentage of tokens that can be retrieved if a user decides to chop their unripe tokens. Following the latest update, the new chop rate is calculated as (recapitalized percent)^2
. However, there's an issue when unripeToken == C.UNRIPE_BEAN
. In this case, the function returns the penalized underlying value, not the expected percentage. This could lead to unexpected behavior if any entity or individual uses this function to obtain a percentage.
Likelyhood: Medium/High
Every time this function is called with UNRIPE_BEAN
token.
There is no usage in the protocol but could be high if the Beanstalk dApps or any other protocols/users rely on it.
Impact: Medium/High
Return an integer number with 6 decimals (>=1e6) instead of a percentage (1e6>=). It will lead the caller to retrieve an incorrect nubme and could result in unexpected behavior.
Given the available context, this appears to be at least a medium severity bug.
Since the recapitalization percent is calculated using the UnripeLP supply (even for UNRIPE_BEAN), remove all conditions and retain only the code in the second if statement:
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.