-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bean:Eth -> Bean:wStEth Migration #765
Changes from 15 commits
e36d92c
ef43b1d
1103605
6eb4e60
24b3602
6cdcff9
11064bc
deca380
c896cde
053bdbc
5817cb8
0fe0c71
267077d
28d33a8
f62086f
a570d17
dadef06
c7f7060
350eab6
8787bd4
e1324cd
65f5ef2
bb600e7
204b580
4ea7406
71930ff
e46ee6b
9a39c57
e0a4006
97f905d
c797265
7d11d62
0874a98
0ab6512
dc43e94
3ab6c01
9277577
e6513e4
4faeb3d
41dc181
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,7 @@ contract Account { | |
* @param isApprovedForAll A mapping of ERC1155 operator to approved status. ERC1155 compatability. | ||
* @param farmerGerminating A Farmer's germinating stalk. Seperated into odd and even stalk. | ||
* @param deposits SiloV3.1 deposits. A mapping from depositId to Deposit. SiloV3.1 introduces greater precision for deposits. | ||
* @param barnRaiseWell The Well that the Barn Raise adds liquidity to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be in the appStorage natspec There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was on natspec of |
||
*/ | ||
struct State { | ||
Field field; // A Farmer's Field storage. | ||
|
@@ -342,6 +343,7 @@ contract Storage { | |
* @param abovePeg Boolean indicating whether the previous Season was above or below peg. | ||
* @param stemStartSeason // season in which the stem storage method was introduced. | ||
* @param stemScaleSeason // season in which the stem v1.1 was introduced, where stems are not truncated anymore. | ||
* @param beanEthStartMintingSeason // Season to start minting in Bean:Eth pool after migrating liquidity out of the pool to protect against Pump failure. | ||
* This allows for greater precision of stems, and requires a soft migration (see {LibTokenSilo.removeDepositFromAccount}) | ||
* @param start The timestamp of the Beanstalk deployment rounded down to the nearest hour. | ||
* @param period The length of each season in Beanstalk in seconds. | ||
|
@@ -359,6 +361,7 @@ contract Storage { | |
bool abovePeg; // | 1 (24) | ||
uint16 stemStartSeason; // | 2 (26) | ||
uint16 stemScaleSeason; //──────────┘ 2 (28/32) | ||
uint32 beanEthStartMintingSeason; //──────────┘ 2 (28/32) NOTE: Reset and delete after Bean:wStEth migration has been completed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix style There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
uint256 start; | ||
uint256 period; | ||
uint256 timestamp; | ||
|
@@ -650,4 +653,6 @@ struct AppStorage { | |
mapping(uint32 => Storage.Sr) unclaimedGerminating; | ||
|
||
Storage.WhitelistStatus[] whitelistStatuses; | ||
|
||
address barnRaiseWell; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
pragma solidity =0.7.6; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import {AppStorage} from "contracts/beanstalk/AppStorage.sol"; | ||
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; | ||
import {C} from "contracts/C.sol"; | ||
import {LibDiamond} from "contracts/libraries/LibDiamond.sol"; | ||
import {LibUnripe} from "contracts/libraries/LibUnripe.sol"; | ||
import {LibSafeMath32} from "contracts/libraries/LibSafeMath32.sol"; | ||
import {LibWhitelist} from "contracts/libraries/Silo/LibWhitelist.sol"; | ||
import {BDVFacet} from "contracts/beanstalk/silo/BDVFacet.sol"; | ||
import {ILiquidityWeightFacet} from "contracts/beanstalk/sun/LiquidityWeightFacet.sol"; | ||
import {IGaugePointFacet} from "contracts/beanstalk/sun/GaugePointFacet.sol"; | ||
|
||
/** | ||
* Initializes the Migration of the Unripe LP underlying tokens from Bean:Eth to Bean:Steth. | ||
*/ | ||
contract InitMigrateUnripeBeanEthToBeanSteth { | ||
using SafeERC20 for IERC20; | ||
using LibSafeMath32 for uint32; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed here: |
||
|
||
// gauge point factor is used to scale up the gauge points of the bean and bean3crv pools. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done here: |
||
uint128 internal constant BEAN_WSTETH_INITIAL_GAUGE_POINTS = 1000e18; | ||
|
||
uint32 constant BEAN_ETH_PUMP_CATCH_UP_SEASONS = 24; | ||
uint32 constant private STALK_ISSUED_PER_BDV = 10000; | ||
uint64 constant private OPTIMAL_PERCENT_DEPOSITED_BDV = 5e6; | ||
uint64 constant private MAX_PERCENT_DEPOSITED_BDV = 100e6; | ||
|
||
AppStorage internal s; | ||
|
||
function init() external { | ||
|
||
// Turn off Bean:Eth Minting while Multi Flow Pump catches up | ||
delete s.wellOracleSnapshots[C.BEAN_ETH_WELL]; | ||
s.season.beanEthStartMintingSeason = s.season.current + BEAN_ETH_PUMP_CATCH_UP_SEASONS; | ||
|
||
LibWhitelist.whitelistToken( | ||
C.BEAN_WSTETH_WELL, | ||
BDVFacet.wellBdv.selector, | ||
STALK_ISSUED_PER_BDV, | ||
0, // No need to set Stalk issued per BDV | ||
0x01, | ||
IGaugePointFacet.defaultGaugePointFunction.selector, | ||
ILiquidityWeightFacet.maxWeight.selector, | ||
BEAN_WSTETH_INITIAL_GAUGE_POINTS, | ||
OPTIMAL_PERCENT_DEPOSITED_BDV | ||
); | ||
|
||
LibWhitelist.updateOptimalPercentDepositedBdvForToken( | ||
C.BEAN_ETH_WELL, | ||
MAX_PERCENT_DEPOSITED_BDV - OPTIMAL_PERCENT_DEPOSITED_BDV | ||
); | ||
|
||
// Migrate to BEAN_STETH; | ||
uint256 balanceOfUnderlying = s.u[C.UNRIPE_LP].balanceOfUnderlying; | ||
IERC20(s.u[C.UNRIPE_LP].underlyingToken).safeTransfer( | ||
LibDiamond.diamondStorage().contractOwner, | ||
balanceOfUnderlying | ||
); | ||
LibUnripe.decrementUnderlying(C.UNRIPE_LP, balanceOfUnderlying); | ||
LibUnripe.switchUnderlyingToken(C.UNRIPE_LP, C.BEAN_WSTETH_WELL); | ||
|
||
s.barnRaiseWell = C.BEAN_WSTETH_WELL; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update to legacy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
BEANSTALK_PUMP
from here:e0a4006