BeanstalkFarms / Beanstalk

A monorepo for the Beanstalk protocol, SDK, subgraphs and UI. Currently houses infra for the Basin protocol.
https://bean.money
MIT License
122 stars 76 forks source link

RFC: Soil Issuance Update #739

Closed nickkatsios closed 1 month ago

nickkatsios commented 8 months ago

RFC: Soil Issuance Update

Authors

Ben Weintraub, Brendan Sanderson, Guy, Brean, deadmanwalking

Summary

When $\Delta B{\overline{t-1}} < 0$, change Soil issued at gm to be the minimum of (1) $-\Delta B$ calculated using the instantaneous reserves from Multi Flow and (2) $-\Delta B{\overline{t-1}}$.

Problem

Beanstalk occasionally overissues Soil at gm because Soil issuance below peg is solely based on $-\Delta B_{\overline{t-1}}$.

Beanstalk can read inter-block MEV manipulation resistant instantaneous reserves for whitelisted Well LP tokens via Multi Flow, but does not yet use these values to determine Soil issuance below peg.

Context

Consider an example where Beanstalk is at -300k deltaB for the first 58 minutes of a Season. At the 58th minute, i.e., 10 blocks before the next gm call, a Farmer buys and Sows 200k Beans, bringing the current deltaB to -100k.

Assuming no other trades in the final 2 minutes of the Season, the Soil issued at gm will be slightly less than 300k, despite Beanstalk only needing 100k Beans to be bought to return to peg. Before Multi Flow, this was necessary for sufficient manipulation resistance.

Solution

When $\Delta B{\overline{t-1}} < 0$, change Soil issued at gm to be the minimum of (1) $-\Delta B$ calculated using the instantaneous reserves from Multi Flow and (2) $-\Delta B{\overline{t-1}}$.

Intuition

In general, Beanstalk does not need to be particularly aggressive when issuing Soil. Beanstalk does not want to issue debt if it doesn't have to. Therefore, accounting for the instantaneous reserves in Multi Flow when below peg is appropriate.

Specification

TBD.

Brean0 commented 1 month ago

https://github.com/BeanstalkFarms/Beanstalk/pull/802 addresses this issue.