DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: high
Invalid

Low Rinsable Sprouts Leading to Substantial Losses in Unripe Token Conversion

Summary

The UnripeFacet:chop function enables users to convert their Unripe Tokens into Ripe Tokens. This process involves burning Unripe Tokens and receiving a corresponding amount of Ripe Tokens based on the percentage of Rinsable Sprouts. The LibChop:chop and LibUnripe:getRecapPaidPercentAmount functions facilitate this conversion by calculating the penalized amount of Ripe Tokens a user can claim. A critical issue arises when the percentage of Rinsable Sprouts is very low, causing users to lose a significant portion of their Unripe Tokens.

Vulnerbility Details

The function getRecapPaidPercentAmount computes the penalized amount of Unripe Tokens that can be claimed based on the percentage of Rinsable Sprouts. However, you raised a concern about the situation when the percentage of Rinsable Sprouts is very low, causing users to lose most of their Unripe Tokens when they attempt to claim Ripe Tokens.

The function getRecapPaidPercentAmount is designed to calculate the penalized amount of Ripe Tokens a user can receive when they chop their Unripe Tokens. This calculation is based on the ratio of fertilized (Rinsable) Sprouts to the total Sprouts:

function getRecapPaidPercentAmount(uint256 amount) internal view returns (uint256 penalizedAmount) {
AppStorage storage s = LibAppStorage.diamondStorage();
return s.sys.fert.fertilizedIndex.mul(amount).div(s.sys.fert.unfertilizedIndex);
}

Here:

  • fertilizedIndex represents the number of Sprouts that have been Rinsable.

  • unfertilizedIndex represents the total number of Sprouts.

The ratio fertilizedIndex / unfertilizedIndex determines the percentage of Unripe Tokens that can be converted to Ripe Tokens.

Impact

When the fertilizedIndex is low, the ratio is small, leading to the following issues:

  • Users receive a very small number of Ripe Tokens in exchange for a large number of Unripe Tokens. For example, if the ratio is 1%, a user chopping 100 Unripe Tokens will only receive 1 Ripe Token. Even if the ratio is 0, then user will recieve Ripe tokens for any number of Unripe Tokens.

  • The effective penalty for chopping becomes very high. Users might perceive this as losing value, as they sacrifice many Unripe Tokens for a minimal return.

  • The low return discourages users from participating in the Chopping process, leading to reduced engagement and lower liquidity in the system.

  • An imbalance might arise where too many Unripe Tokens remain in circulation without being converted to Ripe Tokens, affecting their market value and the overall stability of the ecosystem.

Tools Used

Manual Review

Recommendations

To mitigate this issue, consider implementing the following strategies:

  • Implement a minimum threshold for the fertilizedIndex to ensure that users always receive a meaningful amount of Ripe Tokens. For example, setting a minimum ratio (e.g., 10%) ensures users get a fair return on their Unripe Tokens.

  • Provide additional incentives for users to participate in the Chopping process during periods of low Rinsable Sprouts. This could include bonus Ripe Tokens or other rewards to encourage participation.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.