Beanstalk Farms, pizzaman1337
There are currently 3 problems in Beanstalk for Silo deposits:
seedsPerBdv
to a Whitelisted Silo token with a lower seedsPerBdv
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, otherwise if a seeds value changed, incorrect amounts of stalk would be removed upon withdrawal of existing depositsseedsPerBdv
currently cannot have Decimals.cumulativeStalkPerBdv
counter, or "stem", for each Whitelisted Silo Token.
cumulativeStalkPerBdv
or stem instead of Season
culumativeStalkPerBDV
for a deposit means that the user deposited in a later season.int128
so grown stalk per bdv values can be negative to accommodate converts without requiring the depositor losing StalkstalkEarnedPerSeason
level (seeds), 6 decimal placesSiloFacet
, ConvertFacet
and other facet functions to use stemsmowAndMigrate
migration functionSiloFacet
into MigrationFacet
and ApprovalFacet
to reduce the SiloFacet
size to fit within the deployable limitThe following changes are made to Beanstalk's storage:
MowStatus
struct:deposits
to legacyDeposits
;mapping(bytes32 => Deposit) deposits;
MowStatus
on a per-token basis mapping(address => MowStatus) mowStatuses;
mapping(address => bool) isApprovedForAll;
seeds
to deprecated_seeds
uint16 stemStartSeason;
which represents the season in which Stems were deployedseeds
to stalkEarnedPerSeason
stalk
to stalkIssuedPerBdv
uint32 milestoneSeason;
to keep track of the last season a stalkEarnedPerSeason change happenedint96 milestoneStem;
to store the stem value at the time of the latest changemapping(bytes32 => Storage.Metadata) metadata;
as a mapping of ERC1155 deposit to metadata of the depositStoring deposits based on uint32
season didn't allow for negative deposits, nor any flexibility in seeds values. Storing based on a "grown stalk per bdv index", or stem, allows for calculating grown stalk based on deposit and withdraw indexes rather than number of seasons passed * seeds. This means seeds, now called stalkEarnedPerSeason, can vary per season.
Storing deposits based on Stem allows cleaning up the combination of Silo v1 and v2 deposit storage systems into a single storage method that supports 1155. This requires a migration function, in which users submit all of their deposit seasons and amounts, the system verifies their presence and removes them from the old storage slots for deposits into the stem-based slots with 1155 support. In order to verify the user submitted all of their deposits correctly, the amount of seeds stored for that user should align with the amount calculated based on the submitted deposits. This is handled by the mowAndMigrate
function. A gas-saving migration function is available to those with no current deposits (but previous deposits had occured), mowAndMigrateNoDeposits
.
<Insert 1155 details here>
The penalty for converting from LP to Bean, both ripe and unripe, and losing grown stalk for doing so (in some cases) affects peg maintainence. Users expect to not lose grown stalk when converting from LP to Bean.
For seeds rebalancing, to quote bacchist, the original proposer:
There is currently more than enough Unripe BEAN:3CRV LP to regain the peg through silo conversions to Unripe Bean. Unripe LP grants 4 seeds, compared to 2 seeds for Unripe Bean, which presents an opportunity cost to silo members who may otherwise be inclined to perform arbitrage that would restore the peg.
Given that the majority of the liquidity represented by Unripe LP tokens will remain in the Curve pool until those assets ripen, there is less need to use seed rewards to incentivize liquidity for Bean to trade against. Adjusting the seed rewards for Unripe assets to parity will reduce friction for conversions and aid in peg maintenance.
This can be achieved by increasing seed rewards for Unripe Bean to match LP at 4, reducing rewards for Unripe LP to 2, or removing seed rewards for unripe assets entirely.
Reducing unripe seeds to 1:1 was the most popular choice based on an informal discord poll.
None.
Effective immediately upon commit.