Problem
Currently there are 2 problems in Beanstalk related to Deposits.
- Farmers with older Deposits may forfeit Stalk when converting from a Whitelisted Silo token with a higher
seedsPerBdv
to a Whitelisted Silo token with a lower seedsPerBdv
- This is due to the fact that we calculate the season of the deposit based on the total grown stalk. For example, if we had an beanLP deposit (meaning they get 4 seeds per BDV) deposited at season 0, and converted into single-sided bean at season 500 (2 seeds), the single sided bean would have to be deposited at season -500 in order for stalk to be properly calculated. since seasons are stored as a
uint32
, this sets the value to 0, and causes the user to lose stalk. As the number of seasons increases, so does the likihood that this will occur.
seedsPerBdv
must be static over time for each Whitelisted Silo token.
seedsPerBdv
cannot have Decimals.
Solution
- Introduce a
cumulativeStalkPerBdv
counter for each Whitelisted Silo Token. This increments when there is a change in stalk grown rate.
- cumulative stalk per BDV is the total amount of stalk per BDV an asset should have, had they deposited in season 0.
- Index Deposits based on
cumulativeStalkPerBdv
instead of Season
- A higher
culumativeStalkPerBDV
for a deposit means that the user deposited in a later season.
- Make claiming Grown Stalk token specific, since stalk now grows in different rates per asset.
- Introduce decimals at the
cumulativeGrownStalkPerBdv
Level
- Modify existing
SiloFacet
functions
- Add backwards compatible functions
Implementation
Branch off the zero-withdraw
branch
https://github.com/BeanstalkFarms/Beanstalk/pull/172
Token Specific Seeds
Cumulative Grown Stalk Per Bdv
- Update SiloSettings to have the following structure (Note: all existing SiloSettings will need to be updated):