From 49ee6315f3198a23d8bf2d88332a7c3c543b5ace Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 15:53:11 +0300 Subject: [PATCH 01/12] remove withdrwalSeasond in System.sol, update comments --- .../contracts/beanstalk/storage/System.sol | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/protocol/contracts/beanstalk/storage/System.sol b/protocol/contracts/beanstalk/storage/System.sol index e85d85b93..724a108c8 100644 --- a/protocol/contracts/beanstalk/storage/System.sol +++ b/protocol/contracts/beanstalk/storage/System.sol @@ -143,8 +143,8 @@ struct Field { * @param fertilizedPaidIndex The total number of Fertilizer Beans that have been sent out to users. * @param fertFirst The lowest active Fertilizer Id (start of linked list that is stored by nextFid). * @param fertLast The highest active Fertilizer Id (end of linked list that is stored by nextFid). - * @param bpf The cumulative Beans Per Fertilizer (bfp) minted over all Season. - * @param recapitalized The number of USDC that has been recapitalized in the Barn Raise. + * @param bpf The cumulative Beans Per Fertilizer (bfp) minted over all Seasons. + * @param recapitalized The number of USD that has been recapitalized in the Barn Raise. * @param leftoverBeans Amount of Beans that have shipped to Fert but not yet reflected in bpf. * @param _buffer Reserved storage for future expansion. */ @@ -167,7 +167,6 @@ struct Fertilizer { * @notice System-level Season state variables. * @param current The current Season in Beanstalk. * @param lastSop The Season in which the most recent consecutive series of Seasons of Plenty started. - * @param withdrawSeasons The number of Seasons required to Withdraw a Deposit. * @param lastSopSeason The Season in which the most recent consecutive series of Seasons of Plenty ended. * @param rainStart Stores the most recent Season in which Rain started. * @param raining True if it is Raining (P > 1, Pod Rate Excessively Low). @@ -184,7 +183,6 @@ struct Fertilizer { struct Season { uint32 current; uint32 lastSop; - uint8 withdrawSeasons; uint32 lastSopSeason; uint32 rainStart; bool raining; @@ -202,8 +200,8 @@ struct Season { /** * @notice System-level Weather state variables. * @param lastDeltaSoil Delta Soil; the number of Soil purchased last Season. - * @param lastSowTime The number of seconds it for Soil to sell out last Season. - * @param thisSowTime The number of seconds it for Soil to sell out this Season. + * @param lastSowTime The number of seconds it took for Soil to sell out last Season. + * @param thisSowTime The number of seconds it took for Soil to sell out this Season. * @param temp Temperature is max interest rate in current Season for sowing Beans in Soil. Adjusted each Season. * @param _buffer Reserved storage for future expansion. */ @@ -338,7 +336,7 @@ struct AssetSettings { * - Unripe LP, with its `underlyingToken` as BEAN:3CRV LP. * * Unripe Tokens are initially distributed through the use of a `merkleRoot`. - * + * The `underlyingToken` for Unripe LP was modified and currently set to BEAN:WSTEH well LP. * The existence of a non-zero {UnripeSettings} implies that a Token is an Unripe Token. */ struct UnripeSettings { @@ -362,6 +360,12 @@ struct Deposited { uint128 bdv; } +/** + * @notice Stores convert capacity data for a given block. + * @param overallConvertCapacityUsed The amount of total convert power used in the block. + * @param wellConvertCapacityUsed A mapping from well to the amount of deltaB + * that can be converted in the given block. + */ struct ConvertCapacity { uint256 overallConvertCapacityUsed; mapping(address => uint256) wellConvertCapacityUsed; @@ -389,7 +393,7 @@ struct ShipmentRoute { } /** - * @notice storage relating to the L2 Migration. Can be removed upon a full migration. + * @notice storage relating to the L2 Migration of smart contracts. Can be removed upon a full migration. * @param migratedL1Beans the amount of L1 Beans that have been migrated to L2. * @param contractata a mapping from a L1 contract to an approved L2 receiver. * @param _buffer_ Reserved storage for future additions. @@ -401,7 +405,7 @@ struct L2Migration { } /** - * @notice contains data relating to migration. + * @notice contains data relating to migration of a smart contract from L1 to L2. */ struct MigrationData { address receiver; From 4795b7b13f842bfed0bc2901b139f993b16458db Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 15:55:58 +0300 Subject: [PATCH 02/12] update various comments, remove deprecated UnripeBean3crv.sol --- protocol/contracts/beanstalk/sun/OracleFacet.sol | 1 + .../sun/SeasonFacet/GaugeGettersFacet.sol | 5 ++++- .../sun/SeasonFacet/SeasonGettersFacet.sol | 10 ++++++++++ protocol/contracts/libraries/LibEvaluate.sol | 10 +++++----- .../contracts/tokens/Fertilizer/Internalizer.sol | 2 -- protocol/contracts/tokens/UnripeBean3Crv.sol | 15 --------------- 6 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 protocol/contracts/tokens/UnripeBean3Crv.sol diff --git a/protocol/contracts/beanstalk/sun/OracleFacet.sol b/protocol/contracts/beanstalk/sun/OracleFacet.sol index ef84026c0..d46230f20 100644 --- a/protocol/contracts/beanstalk/sun/OracleFacet.sol +++ b/protocol/contracts/beanstalk/sun/OracleFacet.sol @@ -45,6 +45,7 @@ contract OracleFacet is Invariable, ReentrancyGuard { /** * @notice Fetches the amount of USD equal 1 token is worth, using a lookback * @param token address of token to get the price of. + * @param lookback the amount of time to look back in seconds. */ function getTokenUsdTwap(address token, uint256 lookback) external view returns (uint256) { return LibUsdOracle.getTokenPrice(token, lookback); diff --git a/protocol/contracts/beanstalk/sun/SeasonFacet/GaugeGettersFacet.sol b/protocol/contracts/beanstalk/sun/SeasonFacet/GaugeGettersFacet.sol index 777a59684..a2366e058 100644 --- a/protocol/contracts/beanstalk/sun/SeasonFacet/GaugeGettersFacet.sol +++ b/protocol/contracts/beanstalk/sun/SeasonFacet/GaugeGettersFacet.sol @@ -53,7 +53,7 @@ contract GaugeGettersFacet { /** * @notice Returns the average grown stalk per BDV per season. * @dev 6 decimal precision (1 GrownStalkPerBdvPerSeason = 1e6); - * note that stalk has 10 decimals. + * note that stalk has 16 decimals. */ function getAverageGrownStalkPerBdvPerSeason() public view returns (uint128) { return s.sys.seedGauge.averageGrownStalkPerBdvPerSeason; @@ -103,6 +103,9 @@ contract GaugeGettersFacet { } } + /** + * @notice returns the largest Gauge Points per BDV of all whitelisted LP tokens. + */ function getLargestGpPerBdv() public view returns (uint256) { uint256 largestGpPerBdv; address[] memory whitelistedLpTokens = LibWhitelistedTokens.getWhitelistedLpTokens(); diff --git a/protocol/contracts/beanstalk/sun/SeasonFacet/SeasonGettersFacet.sol b/protocol/contracts/beanstalk/sun/SeasonFacet/SeasonGettersFacet.sol index 45092bdac..9bb6396e0 100644 --- a/protocol/contracts/beanstalk/sun/SeasonFacet/SeasonGettersFacet.sol +++ b/protocol/contracts/beanstalk/sun/SeasonFacet/SeasonGettersFacet.sol @@ -107,6 +107,10 @@ contract SeasonGettersFacet { revert("Oracle: Pool not supported"); } + /** + * @notice Returns the current Delta B for a given well using `calculateDeltaBFromReserves`. + * @return deltaB The deltaB for the well, calculated by its reserves. + */ function poolCurrentDeltaB(address pool) public view returns (int256 deltaB) { if (LibWell.isWell(pool)) { (deltaB) = LibDeltaB.currentDeltaB(pool); @@ -116,6 +120,9 @@ contract SeasonGettersFacet { } } + /** + * @notice Returns the cumulative Delta B from a given list of wells. + */ function cumulativeCurrentDeltaB( address[] calldata pools ) external view returns (int256 deltaB) { @@ -170,6 +177,9 @@ contract SeasonGettersFacet { } } + /** + * @notice Returns the well with the largest USD time weighted average liquidity. + */ function getLargestLiqWell() external view returns (address) { uint256 beanSupply = BeanstalkERC20(s.sys.tokens.bean).totalSupply(); (, address well, ) = LibEvaluate.calcLPToSupplyRatio(beanSupply); diff --git a/protocol/contracts/libraries/LibEvaluate.sol b/protocol/contracts/libraries/LibEvaluate.sol index ced84ade4..4f51ecdf0 100644 --- a/protocol/contracts/libraries/LibEvaluate.sol +++ b/protocol/contracts/libraries/LibEvaluate.sol @@ -84,7 +84,7 @@ library LibEvaluate { // and thus will skip the p > EXCESSIVE_PRICE_THRESHOLD check if the well oracle fails to // compute a valid price this Season. // deltaB > 0 implies that address(well) != address(0). - uint256 tokenBeanPrice = LibWell.getTokenBeanPriceFromTwaReserves(well); //variable name is wrong here + uint256 tokenBeanPrice = LibWell.getTokenBeanPriceFromTwaReserves(well); if (tokenBeanPrice > 1) { address nonBeanToken = address(LibWell.getNonBeanTokenFromWell(well)); uint256 nonBeanTokenDecimals = IERC20Decimals(nonBeanToken).decimals(); @@ -98,7 +98,7 @@ library LibEvaluate { } caseId = 3; } - // p < 1 + // p < 1 (caseId = 0) } /** @@ -296,9 +296,9 @@ library LibEvaluate { function evaluateBeanstalk(int256 deltaB, uint256 beanSupply) external returns (uint256, bool) { BeanstalkState memory bs = updateAndGetBeanstalkState(beanSupply); uint256 caseId = evalPodRate(bs.podRate) // Evaluate Pod Rate - .add(evalPrice(deltaB, bs.largestLiqWell)) - .add(evalDeltaPodDemand(bs.deltaPodDemand)) - .add(evalLpToSupplyRatio(bs.lpToSupplyRatio)); // Evaluate Price // Evaluate Delta Soil Demand // Evaluate LP to Supply Ratio + .add(evalPrice(deltaB, bs.largestLiqWell)) // Evaluate Price + .add(evalDeltaPodDemand(bs.deltaPodDemand)) // Evaluate Delta Soil Demand + .add(evalLpToSupplyRatio(bs.lpToSupplyRatio)); // Evaluate LP to Supply Ratio return (caseId, bs.oracleFailure); } diff --git a/protocol/contracts/tokens/Fertilizer/Internalizer.sol b/protocol/contracts/tokens/Fertilizer/Internalizer.sol index 1abcb5674..177f3ebfe 100644 --- a/protocol/contracts/tokens/Fertilizer/Internalizer.sol +++ b/protocol/contracts/tokens/Fertilizer/Internalizer.sol @@ -95,8 +95,6 @@ contract Internalizer is * @notice Returns the beans per fertilizer remaining for a given fertilizer Id. * @param id - the id of the fertilizer * Formula: bpfRemaining = id - s.bpf - * Calculated here to avoid uint underflow - * Solidity 0.8.0 has underflow protection and the tx would revert but we are using 0.7.6 */ function calculateBpfRemaining(uint256 id) internal view returns (uint128) { // make sure it does not underflow diff --git a/protocol/contracts/tokens/UnripeBean3Crv.sol b/protocol/contracts/tokens/UnripeBean3Crv.sol deleted file mode 100644 index 052829205..000000000 --- a/protocol/contracts/tokens/UnripeBean3Crv.sol +++ /dev/null @@ -1,15 +0,0 @@ -/* - SPDX-License-Identifier: MIT -*/ - -pragma solidity ^0.8.20; - -import "./ERC20/BeanstalkERC20.sol"; - -/** - * @author Publius - * @title Unripe Bean 3Crv is the Unripe token for the Bean3Crv Token. - **/ -contract UnripeBean3Crv is BeanstalkERC20 { - constructor() BeanstalkERC20(msg.sender, "Unripe Bean3Crv", "urBEAN3CRV") {} -} From 79fafac4bc9a5df31ab99fd463072b987a3265b9 Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 16:56:17 +0300 Subject: [PATCH 03/12] misc cleanups --- protocol/contracts/beanstalk/init/InitalizeDiamond.sol | 3 --- .../beanstalk/market/MarketplaceFacet/MarketplaceFacet.sol | 3 +++ protocol/contracts/mocks/mockFacets/MockSeasonFacet.sol | 1 - protocol/test/hardhat/SopReport.test.js | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/protocol/contracts/beanstalk/init/InitalizeDiamond.sol b/protocol/contracts/beanstalk/init/InitalizeDiamond.sol index 9a6f15fd4..c88de226c 100644 --- a/protocol/contracts/beanstalk/init/InitalizeDiamond.sol +++ b/protocol/contracts/beanstalk/init/InitalizeDiamond.sol @@ -175,9 +175,6 @@ contract InitalizeDiamond { // set current season to 1. s.sys.season.current = 1; - // set withdraw seasons to 0. Kept here for verbosity. - s.sys.season.withdrawSeasons = 0; - // initalize the duration of 1 season in seconds. s.sys.season.period = C.CURRENT_SEASON_PERIOD; diff --git a/protocol/contracts/beanstalk/market/MarketplaceFacet/MarketplaceFacet.sol b/protocol/contracts/beanstalk/market/MarketplaceFacet/MarketplaceFacet.sol index cf9c41593..1563c632b 100644 --- a/protocol/contracts/beanstalk/market/MarketplaceFacet/MarketplaceFacet.sol +++ b/protocol/contracts/beanstalk/market/MarketplaceFacet/MarketplaceFacet.sol @@ -207,6 +207,9 @@ contract MarketplaceFacet is Invariable, Order { amount = end - start; } + /** + * @notice Approves pods to be spent by `spender`. + */ function approvePods( address spender, uint256 fieldId, diff --git a/protocol/contracts/mocks/mockFacets/MockSeasonFacet.sol b/protocol/contracts/mocks/mockFacets/MockSeasonFacet.sol index e150e5cbc..d850f7cee 100644 --- a/protocol/contracts/mocks/mockFacets/MockSeasonFacet.sol +++ b/protocol/contracts/mocks/mockFacets/MockSeasonFacet.sol @@ -284,7 +284,6 @@ contract MockSeasonFacet is SeasonFacet { s.sys.season.start = block.timestamp; s.sys.season.timestamp = block.timestamp; s.sys.silo.stalk = 0; - s.sys.season.withdrawSeasons = 25; s.sys.season.current = 1; s.sys.paused = false; BeanstalkERC20(s.sys.tokens.bean).burn( diff --git a/protocol/test/hardhat/SopReport.test.js b/protocol/test/hardhat/SopReport.test.js index 735ba5a48..3cba76714 100644 --- a/protocol/test/hardhat/SopReport.test.js +++ b/protocol/test/hardhat/SopReport.test.js @@ -97,7 +97,7 @@ describe("Sop Test Cases", function () { await mockBeanstalk.rainSunrise(); // 6 => 7 const rain = await beanstalk.rain(); - let season = await beanstalk.time(); + // let season = await beanstalk.time(); // there is a flood in season 8 await mockBeanstalk.rainSunrise(); // 7 => 8 @@ -146,7 +146,7 @@ describe("Sop Test Cases", function () { await mockBeanstalk.rainSunrise(); // 6 => 7 const rain = await beanstalk.rain(); - let season = await beanstalk.time(); + // let season = await beanstalk.time(); // there is a flood in season 8 await mockBeanstalk.rainSunrise(); // 7 => 8 From ce1ab165170651e379a516925337bbf4f4200bb1 Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 17:00:33 +0300 Subject: [PATCH 04/12] remove withdrawSeasons from mock beanstalk --- protocol/contracts/interfaces/IMockFBeanstalk.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/protocol/contracts/interfaces/IMockFBeanstalk.sol b/protocol/contracts/interfaces/IMockFBeanstalk.sol index 5bb1c46cd..535d29c02 100644 --- a/protocol/contracts/interfaces/IMockFBeanstalk.sol +++ b/protocol/contracts/interfaces/IMockFBeanstalk.sol @@ -193,7 +193,6 @@ interface IMockFBeanstalk { struct Season { uint32 current; uint32 lastSop; - uint8 withdrawSeasons; uint32 lastSopSeason; uint32 rainStart; bool raining; From 33562a325746c75134e32a18ec2e6c689e61b7f4 Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 14:32:15 +0000 Subject: [PATCH 05/12] prettier auto formatting changes --- protocol/contracts/libraries/LibEvaluate.sol | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/protocol/contracts/libraries/LibEvaluate.sol b/protocol/contracts/libraries/LibEvaluate.sol index 4f51ecdf0..1afac4b1d 100644 --- a/protocol/contracts/libraries/LibEvaluate.sol +++ b/protocol/contracts/libraries/LibEvaluate.sol @@ -296,9 +296,8 @@ library LibEvaluate { function evaluateBeanstalk(int256 deltaB, uint256 beanSupply) external returns (uint256, bool) { BeanstalkState memory bs = updateAndGetBeanstalkState(beanSupply); uint256 caseId = evalPodRate(bs.podRate) // Evaluate Pod Rate - .add(evalPrice(deltaB, bs.largestLiqWell)) // Evaluate Price - .add(evalDeltaPodDemand(bs.deltaPodDemand)) // Evaluate Delta Soil Demand - .add(evalLpToSupplyRatio(bs.lpToSupplyRatio)); // Evaluate LP to Supply Ratio + .add(evalPrice(deltaB, bs.largestLiqWell)) // Evaluate Price + .add(evalDeltaPodDemand(bs.deltaPodDemand)).add(evalLpToSupplyRatio(bs.lpToSupplyRatio)); // Evaluate Delta Soil Demand // Evaluate LP to Supply Ratio return (caseId, bs.oracleFailure); } From fa757ca7ca0cd4d2227745d2ce92c5469f57c201 Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 20:04:51 +0300 Subject: [PATCH 06/12] add l2 bcm in reseed bean --- protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol b/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol index cda36355d..33007ef0e 100644 --- a/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol +++ b/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol @@ -119,8 +119,7 @@ contract ReseedBean { bytes32 internal constant FERTILIZER_PROXY_SALT = 0xd1a0060ba708bc4bcd3da6c37efa8dedf015fb70fb8fe6ecbb7a4fead78f65ee; - // BCM (TODO: Replace with actual L2 address) - address internal constant L2_BCM = address(0xa9bA2C40b263843C04d344727b954A545c81D043); + address internal constant L2_BCM = address(0xDd5b31E73dB1c566Ca09e1F1f74Df34913DaaF69); /** * @notice deploys bean, unripe bean, unripe lp, and wells. From a4153c97aed9ae25bda7e5f6934446d403c0f128 Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 17:08:23 +0000 Subject: [PATCH 07/12] prettier auto formatting changes --- protocol/contracts/libraries/LibEvaluate.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocol/contracts/libraries/LibEvaluate.sol b/protocol/contracts/libraries/LibEvaluate.sol index 1afac4b1d..9533ae891 100644 --- a/protocol/contracts/libraries/LibEvaluate.sol +++ b/protocol/contracts/libraries/LibEvaluate.sol @@ -296,8 +296,9 @@ library LibEvaluate { function evaluateBeanstalk(int256 deltaB, uint256 beanSupply) external returns (uint256, bool) { BeanstalkState memory bs = updateAndGetBeanstalkState(beanSupply); uint256 caseId = evalPodRate(bs.podRate) // Evaluate Pod Rate - .add(evalPrice(deltaB, bs.largestLiqWell)) // Evaluate Price - .add(evalDeltaPodDemand(bs.deltaPodDemand)).add(evalLpToSupplyRatio(bs.lpToSupplyRatio)); // Evaluate Delta Soil Demand // Evaluate LP to Supply Ratio + .add(evalPrice(deltaB, bs.largestLiqWell)).add(evalDeltaPodDemand(bs.deltaPodDemand)).add( // Evaluate Price + evalLpToSupplyRatio(bs.lpToSupplyRatio) + ); // Evaluate Delta Soil Demand // Evaluate LP to Supply Ratio return (caseId, bs.oracleFailure); } From 8a6b294594b06ed2fb5f9450d7e70af8dbabcda3 Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 20:29:20 +0300 Subject: [PATCH 08/12] update comments, remove todo --- protocol/contracts/beanstalk/storage/System.sol | 2 +- protocol/contracts/libraries/Convert/LibConvert.sol | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/protocol/contracts/beanstalk/storage/System.sol b/protocol/contracts/beanstalk/storage/System.sol index 724a108c8..0d2b062f7 100644 --- a/protocol/contracts/beanstalk/storage/System.sol +++ b/protocol/contracts/beanstalk/storage/System.sol @@ -362,7 +362,7 @@ struct Deposited { /** * @notice Stores convert capacity data for a given block. - * @param overallConvertCapacityUsed The amount of total convert power used in the block. + * @param overallConvertCapacityUsed The amount of overall deltaB that can be converted towards peg within a block. * @param wellConvertCapacityUsed A mapping from well to the amount of deltaB * that can be converted in the given block. */ diff --git a/protocol/contracts/libraries/Convert/LibConvert.sol b/protocol/contracts/libraries/Convert/LibConvert.sol index 3569724f7..ba4e7834f 100644 --- a/protocol/contracts/libraries/Convert/LibConvert.sol +++ b/protocol/contracts/libraries/Convert/LibConvert.sol @@ -476,8 +476,7 @@ library LibConvert { AssetsRemovedConvert memory a; uint256 i = 0; - // if (user == address(0)) user = LibTractor._user(); - + // a bracket is included here to avoid the "stack too deep" error. { a.bdvsRemoved = new uint256[](stems.length); @@ -490,7 +489,6 @@ library LibConvert { while ((i < stems.length) && (a.active.tokens < maxTokens)) { // skip any stems that are germinating, due to the ability to // circumvent the germination process. - // TODO: expose a view function that let's you pass in stems/amounts and returns the non-germinating stems/amounts? if (germStem.germinatingStem <= stems[i]) { i++; continue; From aa217499d6a57f89d0993547285e1431d612eff7 Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 20:29:28 +0300 Subject: [PATCH 09/12] remove todo --- protocol/test/foundry/utils/FertilizerDeployer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/test/foundry/utils/FertilizerDeployer.sol b/protocol/test/foundry/utils/FertilizerDeployer.sol index 9890851b8..e8bc41cf3 100644 --- a/protocol/test/foundry/utils/FertilizerDeployer.sol +++ b/protocol/test/foundry/utils/FertilizerDeployer.sol @@ -32,7 +32,7 @@ contract FertilizerDeployer is Utils { IOwner(fertilizerAddress).transferOwnership(newOwner); } - function mintFertilizer() internal {} // TODO + function mintFertilizer() internal {} function mockMintFertilizer() internal {} From 951fb501b4de7f9310e27930fe11ba54da5bfd6f Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Thu, 26 Sep 2024 17:32:53 +0000 Subject: [PATCH 10/12] prettier auto formatting changes --- protocol/contracts/libraries/Convert/LibConvert.sol | 2 +- protocol/contracts/libraries/LibEvaluate.sol | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol/contracts/libraries/Convert/LibConvert.sol b/protocol/contracts/libraries/Convert/LibConvert.sol index ba4e7834f..a8875d065 100644 --- a/protocol/contracts/libraries/Convert/LibConvert.sol +++ b/protocol/contracts/libraries/Convert/LibConvert.sol @@ -476,7 +476,7 @@ library LibConvert { AssetsRemovedConvert memory a; uint256 i = 0; - + // a bracket is included here to avoid the "stack too deep" error. { a.bdvsRemoved = new uint256[](stems.length); diff --git a/protocol/contracts/libraries/LibEvaluate.sol b/protocol/contracts/libraries/LibEvaluate.sol index 9533ae891..fae43d2a2 100644 --- a/protocol/contracts/libraries/LibEvaluate.sol +++ b/protocol/contracts/libraries/LibEvaluate.sol @@ -296,9 +296,9 @@ library LibEvaluate { function evaluateBeanstalk(int256 deltaB, uint256 beanSupply) external returns (uint256, bool) { BeanstalkState memory bs = updateAndGetBeanstalkState(beanSupply); uint256 caseId = evalPodRate(bs.podRate) // Evaluate Pod Rate - .add(evalPrice(deltaB, bs.largestLiqWell)).add(evalDeltaPodDemand(bs.deltaPodDemand)).add( // Evaluate Price - evalLpToSupplyRatio(bs.lpToSupplyRatio) - ); // Evaluate Delta Soil Demand // Evaluate LP to Supply Ratio + .add(evalPrice(deltaB, bs.largestLiqWell)) + .add(evalDeltaPodDemand(bs.deltaPodDemand)) + .add(evalLpToSupplyRatio(bs.lpToSupplyRatio)); // Evaluate Price // Evaluate Delta Soil Demand // Evaluate LP to Supply Ratio return (caseId, bs.oracleFailure); } From dd0c06d994f421a1edd9b83a4c5148c7aeed892f Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Sun, 29 Sep 2024 10:10:33 +0300 Subject: [PATCH 11/12] update well upgr owner --- protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol b/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol index 33007ef0e..229d605c9 100644 --- a/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol +++ b/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol @@ -39,7 +39,7 @@ contract ReseedBean { using SafeERC20 for IERC20; - address internal constant OWNER = address(0xa9bA2C40b263843C04d344727b954A545c81D043); + address internal constant OWNER = address(0xDd5b31E73dB1c566Ca09e1F1f74Df34913DaaF69); AppStorage internal s; // A default well salt is used to prevent front-running attacks From 017a6509d00bf9fd1a2a10a231bbaec200dc0d7f Mon Sep 17 00:00:00 2001 From: nickkatsios Date: Sun, 29 Sep 2024 17:18:56 +0300 Subject: [PATCH 12/12] remove owner --- protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol b/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol index 229d605c9..4364615b1 100644 --- a/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol +++ b/protocol/contracts/beanstalk/init/reseed/L2/ReseedBean.sol @@ -39,7 +39,6 @@ contract ReseedBean { using SafeERC20 for IERC20; - address internal constant OWNER = address(0xDd5b31E73dB1c566Ca09e1F1f74Df34913DaaF69); AppStorage internal s; // A default well salt is used to prevent front-running attacks