From 55ebab3ef04bb0c174e034969b972392a68a58f3 Mon Sep 17 00:00:00 2001 From: Spacebean Date: Mon, 16 Sep 2024 15:15:01 -0600 Subject: [PATCH 1/6] misc updates --- projects/examples/src/setup.ts | 2 +- projects/sdk/src/classes/Pool/BasinWell.ts | 29 ++------ projects/sdk/src/constants/addresses.ts | 28 ++++---- projects/sdk/src/lib/contracts.ts | 71 +++++++------------- projects/sdk/src/lib/pools.ts | 8 +++ projects/sdk/src/lib/silo/Convert.ts | 17 ++++- projects/sdk/src/utils/TestUtils/provider.ts | 13 +++- 7 files changed, 76 insertions(+), 92 deletions(-) diff --git a/projects/examples/src/setup.ts b/projects/examples/src/setup.ts index 3152dba95..c45c9de87 100644 --- a/projects/examples/src/setup.ts +++ b/projects/examples/src/setup.ts @@ -7,7 +7,7 @@ const RPC_URL = "http://127.0.0.1:8545"; const network = { name: "local", chainId: ChainId.LOCALHOST, - _defaultProvider: () => new ethers.providers.JsonRpcProvider(RPC_URL, network) + _defaultProvider: () => new ethers.providers.JsonRpcProvider(RPC_URL) }; export const provider = new ethers.providers.StaticJsonRpcProvider(RPC_URL, network); diff --git a/projects/sdk/src/classes/Pool/BasinWell.ts b/projects/sdk/src/classes/Pool/BasinWell.ts index 6aa2c4059..3afd9a60b 100644 --- a/projects/sdk/src/classes/Pool/BasinWell.ts +++ b/projects/sdk/src/classes/Pool/BasinWell.ts @@ -1,30 +1,11 @@ -import { BasinWell__factory, BasinWell as BasinWellContract } from "src/constants/generated"; +import { BasinWell__factory } from "src/constants/generated"; import { TokenValue } from "src/TokenValue"; import Pool, { Reserves } from "./Pool"; import { ERC20Token } from "../Token"; -import { BeanstalkSDK } from "src/lib/BeanstalkSDK"; export class BasinWell extends Pool { - public readonly contract: BasinWellContract; - - constructor( - sdk: BeanstalkSDK, - address: string, - lpToken: ERC20Token, - tokens: ERC20Token[], - metadata: { - name: string; - symbol: string; - logo: string; - color: string; - } - ) { - super(sdk, address, lpToken, tokens, metadata); - this.contract = BasinWell__factory.connect(address, sdk.providerOrSigner); - } - public getContract() { - return this.contract; + return BasinWell__factory.connect(this.address, Pool.sdk.providerOrSigner); } public getReserves() { @@ -44,19 +25,19 @@ export class BasinWell extends Pool { } async getAddLiquidityOut(amounts: TokenValue[]) { - return this.contract + return this.getContract() .getAddLiquidityOut(amounts.map((a) => a.toBigNumber())) .then((result) => this.lpToken.fromBlockchain(result)); } async getRemoveLiquidityOutEqual(amount: TokenValue) { - return this.contract + return this.getContract() .getRemoveLiquidityOut(amount.toBigNumber()) .then((result) => this.tokens.map((token, i) => token.fromBlockchain(result[i]))); } async getRemoveLiquidityOutOneToken(lpAmountIn: TokenValue, tokenOut: ERC20Token) { - return this.contract + return this.getContract() .getRemoveLiquidityOneTokenOut(lpAmountIn.toBigNumber(), tokenOut.address) .then((result) => tokenOut.fromBlockchain(result)); } diff --git a/projects/sdk/src/constants/addresses.ts b/projects/sdk/src/constants/addresses.ts index 5dc21f791..320cfe98b 100644 --- a/projects/sdk/src/constants/addresses.ts +++ b/projects/sdk/src/constants/addresses.ts @@ -182,6 +182,18 @@ export const addresses = { [ChainId.ARBITRUM_MAINNET]: "0x6985884C4392D348587B19cb9eAAf157F13271cd" }), + // ---------------------------------------- + // Uniswap V3 + UNISWAP_V3_ROUTER: Address.make({ + [ChainId.ETH_MAINNET]: "0xE592427A0AEce92De3Edee1F18E0157C05861564", + [ChainId.ARBITRUM_MAINNET]: "0xE592427A0AEce92De3Edee1F18E0157C05861564" + }), + + UNISWAP_V3_QUOTER_V2: Address.make({ + [ChainId.ETH_MAINNET]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + [ChainId.ARBITRUM_MAINNET]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e" + }), + // ---------------------------------------- // Curve Pools: Other // ---------------------------------------- @@ -255,22 +267,6 @@ export const addresses = { [ChainId.ETH_MAINNET]: "0xA79828DF1850E8a3A3064576f380D90aECDD3359" }), - /** - * @deprecated - * Uniswap V3 Router - */ - UNISWAP_V3_ROUTER: Address.make({ - [ChainId.ETH_MAINNET]: "0xE592427A0AEce92De3Edee1F18E0157C05861564" - }), - - /** - * @deprecated - * Uniswap V3 Quoter V2 - */ - UNISWAP_V3_QUOTER_V2: Address.make({ - [ChainId.ETH_MAINNET]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e" - }), - /** * @deprecated */ diff --git a/projects/sdk/src/lib/contracts.ts b/projects/sdk/src/lib/contracts.ts index 49e9ebefa..63d363195 100644 --- a/projects/sdk/src/lib/contracts.ts +++ b/projects/sdk/src/lib/contracts.ts @@ -24,21 +24,7 @@ import { UnwrapAndSendEthJunction, UnwrapAndSendEthJunction__factory, Junction, - Junction__factory, - Curve3Pool, - CurveCryptoFactory, - CurveMetaFactory, - CurveMetaPool, - CurveRegistry, - CurveTriCrypto2Pool, - CurveZap, - Curve3Pool__factory, - CurveCryptoFactory__factory, - CurveMetaFactory__factory, - CurveMetaPool__factory, - CurveRegistry__factory, - CurveTriCrypto2Pool__factory, - CurveZap__factory + Junction__factory } from "src/constants/generated"; type LidoContracts = { @@ -60,30 +46,27 @@ export class Contracts { public readonly pipeline: Pipeline; public readonly depot: Depot; public readonly junction: Junction; - public readonly usdOracle: UsdOracle; public readonly pipelineJunctions: PipelineJunctions; public readonly lido: LidoContracts; - // Deprecated contracts + public readonly uniswapV3Router: UniswapV3Router; + public readonly uniswapV3QuoterV2: UniswapV3QuoterV2; + /** * @deprecated - * @description External contract not part of Beanstalk3 L2 migration. + * @description Not included in Beanstalk3 deployment on Arbitrum. * @note mainnet Beanstalk only */ - public readonly root: Root | null = null; - - /** - * @deprecated as of Beanstalk 3.0 L2 migration - * @description mainnet only - */ - public readonly uniswapV3Router: UniswapV3Router; + public readonly usdOracle: UsdOracle; + // Deprecated contracts /** - * @deprecated as of Beanstalk 3.0 L2 migration - * @description mainnet only + * @deprecated + * @description Not included in Beanstalk3 deployment on Arbitrum. + * @note mainnet Beanstalk only */ - public readonly uniswapV3QuoterV2: UniswapV3QuoterV2; + public readonly root: Root | null = null; constructor(sdk: BeanstalkSDK) { Contracts.sdk = sdk; @@ -137,12 +120,6 @@ export class Contracts { ) }; } - if (rootAddress) { - this.root = Root__factory.connect(rootAddress, sdk.providerOrSigner); - } - if (usdOracleAddress) { - this.usdOracle = UsdOracle__factory.connect(usdOracleAddress, sdk.providerOrSigner); - } // Lido this.lido = { @@ -150,18 +127,22 @@ export class Contracts { }; // Uniswap - if (uniswapV3RouterAddress) { - this.uniswapV3Router = UniswapV3Router__factory.connect( - uniswapV3RouterAddress, - sdk.providerOrSigner - ); - } - if (uniswapV3QuoterV2Address) { - this.uniswapV3QuoterV2 = UniswapV3QuoterV2__factory.connect( - uniswapV3QuoterV2Address, - sdk.providerOrSigner - ); + this.uniswapV3Router = UniswapV3Router__factory.connect( + uniswapV3RouterAddress, + sdk.providerOrSigner + ); + + this.uniswapV3QuoterV2 = UniswapV3QuoterV2__factory.connect( + uniswapV3QuoterV2Address, + sdk.providerOrSigner + ); + + if (rootAddress) { + this.root = Root__factory.connect(rootAddress, sdk.providerOrSigner); + } + if (usdOracleAddress) { + this.usdOracle = UsdOracle__factory.connect(usdOracleAddress, sdk.providerOrSigner); } } } diff --git a/projects/sdk/src/lib/pools.ts b/projects/sdk/src/lib/pools.ts index 3eb974d5f..ac5ba1015 100644 --- a/projects/sdk/src/lib/pools.ts +++ b/projects/sdk/src/lib/pools.ts @@ -135,6 +135,7 @@ export class Pools { return this.whitelistedPools.has(_pool.address); } + // Do we need this? Maybe we can just have wells only?? getPoolByLPToken(token: Token | string): Pool | undefined { if (typeof token === "string") { return this.lpAddressMap.get(token.toLowerCase()); @@ -142,6 +143,13 @@ export class Pools { return this.lpAddressMap.get(token.address); } + getWellByLPToken(token: Token | string): BasinWell | undefined { + if (typeof token === "string") { + return this.wellAddressMap.get(token.toLowerCase()); + } + return this.wellAddressMap.get(token.address); + } + getWells(): readonly BasinWell[] { return Array.from(this.wellAddressMap.values()) as ReadonlyArray; } diff --git a/projects/sdk/src/lib/silo/Convert.ts b/projects/sdk/src/lib/silo/Convert.ts index 17d090fab..9d6e4b484 100644 --- a/projects/sdk/src/lib/silo/Convert.ts +++ b/projects/sdk/src/lib/silo/Convert.ts @@ -41,7 +41,11 @@ export class Convert { this.paths.set(Convert.sdk.tokens.BEAN, [ // Convert.sdk.tokens.BEAN_CRV3_LP, // Deprecated. Convert.sdk.tokens.BEAN_WSTETH_WELL_LP, - Convert.sdk.tokens.BEAN_ETH_WELL_LP + Convert.sdk.tokens.BEAN_ETH_WELL_LP, + Convert.sdk.tokens.BEAN_WBTC_WELL_LP, + Convert.sdk.tokens.BEAN_WEETH_WELL_LP, + Convert.sdk.tokens.BEAN_USDC_WELL_LP, + Convert.sdk.tokens.BEAN_USDT_WELL_LP ]); this.paths.set(Convert.sdk.tokens.BEAN_CRV3_LP, [Convert.sdk.tokens.BEAN]); this.paths.set(Convert.sdk.tokens.BEAN_ETH_WELL_LP, [Convert.sdk.tokens.BEAN]); @@ -57,6 +61,10 @@ export class Convert { Convert.sdk.tokens.UNRIPE_BEAN, Convert.sdk.tokens.BEAN_WSTETH_WELL_LP ]); + this.paths.set(Convert.sdk.tokens.BEAN_WBTC_WELL_LP, [Convert.sdk.tokens.BEAN]); + this.paths.set(Convert.sdk.tokens.BEAN_USDC_WELL_LP, [Convert.sdk.tokens.BEAN]); + this.paths.set(Convert.sdk.tokens.BEAN_USDT_WELL_LP, [Convert.sdk.tokens.BEAN]); + this.paths.set(Convert.sdk.tokens.BEAN_WEETH_WELL_LP, [Convert.sdk.tokens.BEAN]); } async convert( @@ -168,7 +176,11 @@ export class Convert { const whitelistedWellLPs = new Set([ Convert.sdk.tokens.BEAN_ETH_WELL_LP.address.toLowerCase(), - Convert.sdk.tokens.BEAN_WSTETH_WELL_LP.address.toLowerCase() + Convert.sdk.tokens.BEAN_WSTETH_WELL_LP.address.toLowerCase(), + Convert.sdk.tokens.BEAN_USDC_WELL_LP.address.toLowerCase(), + Convert.sdk.tokens.BEAN_USDT_WELL_LP.address.toLowerCase(), + Convert.sdk.tokens.BEAN_WEETH_WELL_LP.address.toLowerCase(), + Convert.sdk.tokens.BEAN_WBTC_WELL_LP.address.toLowerCase() ]); const isFromWlLP = Boolean(whitelistedWellLPs.has(fromToken.address.toLowerCase())); const isToWlLP = Boolean(whitelistedWellLPs.has(toToken.address.toLowerCase())); @@ -267,5 +279,4 @@ export class Convert { const token = Convert.sdk.tokens.findByAddress(fromToken.address); return token ? this.paths.get(token) || [] : []; } - } diff --git a/projects/sdk/src/utils/TestUtils/provider.ts b/projects/sdk/src/utils/TestUtils/provider.ts index 57bbf3752..eb53900c4 100644 --- a/projects/sdk/src/utils/TestUtils/provider.ts +++ b/projects/sdk/src/utils/TestUtils/provider.ts @@ -1,18 +1,25 @@ import { ethers } from "ethers"; import { BeanstalkSDK, DataSource } from "src/lib/BeanstalkSDK"; import { BlockchainUtils } from "./BlockchainUtils"; +import { ChainId } from "@beanstalk/sdk-core"; // private key + account mapping // these keys are provided by hardhat/anvil export const ACCOUNTS = [ - ["0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"], - ["0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d", "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"] + [ + "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", + "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + [ + "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d", + "0x70997970c51812dc3a010c7d01b50e0d17dc79c8" + ] ] as const; export const getProvider = () => new ethers.providers.StaticJsonRpcProvider(`http://127.0.0.1:8545`, { name: "foundry", - chainId: 41337 // default to arbitrum-local + chainId: ChainId.LOCALHOST // default to arbitrum-local }); export const setupConnection = (provider: ethers.providers.JsonRpcProvider = getProvider()) => { From ef55cafdc4bcd1c0580e00d219005b6cfaca6011 Mon Sep 17 00:00:00 2001 From: Spacebean Date: Mon, 16 Sep 2024 15:15:30 -0600 Subject: [PATCH 2/6] ui: misc updates --- projects/ui/src/graph/graphql.schema.json | 12 ++++++++++++ projects/ui/src/graph/schema-snapshot1.graphql | 1 + .../src/hooks/beanstalk/useDataFeedTokenPrices.ts | 15 ++------------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/projects/ui/src/graph/graphql.schema.json b/projects/ui/src/graph/graphql.schema.json index 8b9f59fcb..e0262f1d3 100644 --- a/projects/ui/src/graph/graphql.schema.json +++ b/projects/ui/src/graph/graphql.schema.json @@ -128859,6 +128859,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "proposalsCount1d", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "proposalsCount7d", "description": null, diff --git a/projects/ui/src/graph/schema-snapshot1.graphql b/projects/ui/src/graph/schema-snapshot1.graphql index 01ac8ca08..232815531 100644 --- a/projects/ui/src/graph/schema-snapshot1.graphql +++ b/projects/ui/src/graph/schema-snapshot1.graphql @@ -318,6 +318,7 @@ type Space { plugins: Any private: Boolean proposalsCount: Int + proposalsCount1d: Int proposalsCount7d: Int rank: Float skin: String diff --git a/projects/ui/src/hooks/beanstalk/useDataFeedTokenPrices.ts b/projects/ui/src/hooks/beanstalk/useDataFeedTokenPrices.ts index 9acc1f177..e7fa9be55 100644 --- a/projects/ui/src/hooks/beanstalk/useDataFeedTokenPrices.ts +++ b/projects/ui/src/hooks/beanstalk/useDataFeedTokenPrices.ts @@ -84,22 +84,11 @@ export default function useDataFeedTokenPrices() { const token = underlyingTokens[index]; if (!token) return; - // BS3TODO: REMOVE ME - const decimals = ['wstETH', 'weETH'].includes(token.symbol) ? 40 : 6; - // BS3TODO: REMOVE ME - const divBy = ['wstETH', 'weETH'].includes(token.symbol) ? 20000 : 1; - if (price) { - priceDataCache[getTokenIndex(token)] = getBNResult( - price.toString(), - decimals - ).div(divBy); + priceDataCache[getTokenIndex(token)] = getBNResult(price.toString(), 6); } if (twap) { - priceDataCache[`${token.symbol}-TWA`] = getBNResult( - twap.toString(), - decimals - ).div(divBy); + priceDataCache[`${token.symbol}-TWA`] = getBNResult(twap.toString(), 6); } // add it for ETH as well From fbc255184132bf16841bde7dac324be24c2586cf Mon Sep 17 00:00:00 2001 From: Spacebean Date: Tue, 17 Sep 2024 12:25:31 -0600 Subject: [PATCH 3/6] feat: update fork block num --- package.json | 2 +- projects/sdk/src/classes/Pool/BasinWell.ts | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0474c3a91..ff48300ca 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "ui:test": "yarn workspace ui test", "test:browser": "yarn workspace tests test:browser", "ex": "yarn workspace @beanstalk/examples x", - "anvil-arbitrum": "yarn cli:anvil-arbitrum --code-size-limit 50000 --fork-block-number 250704543", + "anvil-arbitrum": "yarn cli:anvil-arbitrum --code-size-limit 50000 --fork-block-number 254247030", "anvil-eth-mainnet": "yarn cli:anvil-eth-mainnet", "anvil": "anvil --fork-url https://eth-mainnet.g.alchemy.com/v2/5ubn94zT7v7DnB5bNW1VOnoIbX5-AG2N --chain-id 1337", "anvil4tests": "anvil --fork-url https://eth-mainnet.g.alchemy.com/v2/Kk7ktCQL5wz4v4AG8bR2Gun8TAASQ-qi --chain-id 1337 --fork-block-number 18629000" diff --git a/projects/sdk/src/classes/Pool/BasinWell.ts b/projects/sdk/src/classes/Pool/BasinWell.ts index 3afd9a60b..d32044271 100644 --- a/projects/sdk/src/classes/Pool/BasinWell.ts +++ b/projects/sdk/src/classes/Pool/BasinWell.ts @@ -37,9 +37,22 @@ export class BasinWell extends Pool { } async getRemoveLiquidityOutOneToken(lpAmountIn: TokenValue, tokenOut: ERC20Token) { + const tokenIndex = this.tokens.findIndex((token) => token.equals(tokenOut)); + if (tokenIndex < 0) { + throw new Error(`Unable to determine token index of ${tokenOut.symbol} in ${this.tokens}`); + } + return this.getContract() .getRemoveLiquidityOneTokenOut(lpAmountIn.toBigNumber(), tokenOut.address) - .then((result) => tokenOut.fromBlockchain(result)); + .then((result) => { + const underlying = [ + tokenOut.fromBlockchain(result), + this.tokens[tokenIndex === 0 ? 1 : 0].fromHuman(0) + ]; + // If the specified token out index === 1, reverse the result + if (tokenIndex === 1) return underlying.reverse(); + return underlying; + }); } /** From b82f5bada068c89bae28167ff4109ca77e772b65 Mon Sep 17 00:00:00 2001 From: pizzaman1337 Date: Tue, 17 Sep 2024 16:36:15 -0600 Subject: [PATCH 4/6] Expose calculateDeltaBFromReserves --- .../beanstalk/silo/ConvertGettersFacet.sol | 15 +++++++++++++++ protocol/contracts/interfaces/IMockFBeanstalk.sol | 2 +- .../mocks/mockFacets/MockPipelineConvertFacet.sol | 8 -------- protocol/test/foundry/farm/PipelineConvert.t.sol | 6 +++--- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/protocol/contracts/beanstalk/silo/ConvertGettersFacet.sol b/protocol/contracts/beanstalk/silo/ConvertGettersFacet.sol index 668600108..94dbaf95b 100644 --- a/protocol/contracts/beanstalk/silo/ConvertGettersFacet.sol +++ b/protocol/contracts/beanstalk/silo/ConvertGettersFacet.sol @@ -69,6 +69,21 @@ contract ConvertGettersFacet { return LibDeltaB.cappedReservesDeltaB(well); } + /** + * @notice calculates the deltaB for a given well using the reserves. + * @dev reverts if the bean reserve is less than the minimum, + * or if the usd oracle fails. + * This differs from the twaDeltaB, as this function should not be used within the sunrise function. + * @return deltaB The deltaB using the reserves. + */ + function calculateDeltaBFromReserves( + address well, + uint256[] memory reserves, + uint256 lookback + ) external view returns (int256) { + return LibDeltaB.calculateDeltaBFromReserves(well, reserves, lookback); + } + /** * @notice Returns currently available convert power for this block * @return convertCapacity The amount of convert power available for this block diff --git a/protocol/contracts/interfaces/IMockFBeanstalk.sol b/protocol/contracts/interfaces/IMockFBeanstalk.sol index 9131ada52..1b73d24fa 100644 --- a/protocol/contracts/interfaces/IMockFBeanstalk.sol +++ b/protocol/contracts/interfaces/IMockFBeanstalk.sol @@ -751,7 +751,7 @@ interface IMockFBeanstalk { uint256 outputTokenAmountInDirectionOfPeg ) external view returns (uint256 cumulativePenalty, PenaltyData memory pdCapacity); - function calculateDeltaBFromReservesE( + function calculateDeltaBFromReserves( address well, uint256[] memory reserves, uint256 lookback diff --git a/protocol/contracts/mocks/mockFacets/MockPipelineConvertFacet.sol b/protocol/contracts/mocks/mockFacets/MockPipelineConvertFacet.sol index 8a2433eb0..416d6120a 100644 --- a/protocol/contracts/mocks/mockFacets/MockPipelineConvertFacet.sol +++ b/protocol/contracts/mocks/mockFacets/MockPipelineConvertFacet.sol @@ -32,12 +32,4 @@ contract MockPipelineConvertFacet is PipelineConvertFacet { outputTokenAmountInDirectionOfPeg ); } - - function calculateDeltaBFromReservesE( - address well, - uint256[] memory reserves, - uint256 lookback - ) external view returns (int256) { - return LibDeltaB.calculateDeltaBFromReserves(well, reserves, lookback); - } } diff --git a/protocol/test/foundry/farm/PipelineConvert.t.sol b/protocol/test/foundry/farm/PipelineConvert.t.sol index 40a1e0c04..7b64f53e5 100644 --- a/protocol/test/foundry/farm/PipelineConvert.t.sol +++ b/protocol/test/foundry/farm/PipelineConvert.t.sol @@ -1949,7 +1949,7 @@ contract PipelineConvertTest is TestHelper { reserves[beanIndex] = reserves[beanIndex].sub(beansOut); // get new deltaB - deltaB = pipelineConvert.calculateDeltaBFromReservesE(well, reserves, 0); + deltaB = bs.calculateDeltaBFromReserves(well, reserves, 0); } function calculateDeltaBForWellAfterAddingBean( @@ -1969,7 +1969,7 @@ contract PipelineConvertTest is TestHelper { // add to bean index (no beans out on this one) reserves[beanIndex] = reserves[beanIndex].add(beansIn); // get new deltaB - deltaB = pipelineConvert.calculateDeltaBFromReservesE(well, reserves, 0); + deltaB = bs.calculateDeltaBFromReserves(well, reserves, 0); } function calculateDeltaBForWellAfterAddingNonBean( @@ -1989,7 +1989,7 @@ contract PipelineConvertTest is TestHelper { reserves[nonBeanIndex] = reserves[nonBeanIndex].add(amountIn); // get new deltaB - deltaB = pipelineConvert.calculateDeltaBFromReservesE(well, reserves, 0); + deltaB = bs.calculateDeltaBFromReserves(well, reserves, 0); } // verifies there's no way to withdraw from a deposit without losing grown stalk From 092ef5b211257de640545407b44d876a8b0405a9 Mon Sep 17 00:00:00 2001 From: Spacebean Date: Thu, 19 Sep 2024 12:08:01 -0600 Subject: [PATCH 5/6] feat: update storage slots --- .../sdk/src/utils/TestUtils/BlockchainUtils.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/projects/sdk/src/utils/TestUtils/BlockchainUtils.ts b/projects/sdk/src/utils/TestUtils/BlockchainUtils.ts index b1e78ed4b..d5ad291f0 100644 --- a/projects/sdk/src/utils/TestUtils/BlockchainUtils.ts +++ b/projects/sdk/src/utils/TestUtils/BlockchainUtils.ts @@ -199,12 +199,18 @@ export class BlockchainUtils { private getBalanceConfig(tokenAddress: string) { const slotConfig = new Map(); slotConfig.set(this.sdk.tokens.BEAN.address, [0, false]); - slotConfig.set(this.sdk.tokens.WETH.address, [0, false]); - slotConfig.set(this.sdk.tokens.WSTETH.address, [0, false]); - slotConfig.set(this.sdk.tokens.WEETH.address, [0, false]); - slotConfig.set(this.sdk.tokens.WBTC.address, [0, false]); - slotConfig.set(this.sdk.tokens.USDC.address, [0, false]); - slotConfig.set(this.sdk.tokens.USDT.address, [0, false]); + slotConfig.set(this.sdk.tokens.WETH.address, [51, false]); // OnChain + // slotConfig.set(this.sdk.tokens.WETH.address, [0, false]); // MockToken + slotConfig.set(this.sdk.tokens.WSTETH.address, [1, false]); // OnChain + // slotConfig.set(this.sdk.tokens.WSTETH.address, [0, false]); // MockToken + slotConfig.set(this.sdk.tokens.WEETH.address, [51, false]); // OnChain + // slotConfig.set(this.sdk.tokens.WEETH.address, [0, false]); // MockToken + slotConfig.set(this.sdk.tokens.WBTC.address, [51, false]); // OnChain + // slotConfig.set(this.sdk.tokens.WBTC.address, [0, false]); // MockToken + slotConfig.set(this.sdk.tokens.USDC.address, [9, false]); // OnChain + // slotConfig.set(this.sdk.tokens.USDC.address, [0, false]); // MockToken + slotConfig.set(this.sdk.tokens.USDT.address, [51, false]); // OnChain + // slotConfig.set(this.sdk.tokens.USDT.address, [0, false]); // MockToken slotConfig.set(this.sdk.tokens.DAI.address, [2, false]); slotConfig.set(this.sdk.tokens.UNRIPE_BEAN.address, [0, false]); slotConfig.set(this.sdk.tokens.UNRIPE_BEAN_WSTETH.address, [0, false]); From 4b9216b9734e454ee19109450530f2fdd3cef8b7 Mon Sep 17 00:00:00 2001 From: Space-Bean Date: Thu, 19 Sep 2024 18:38:51 +0000 Subject: [PATCH 6/6] prettier auto formatting changes --- protocol/test/foundry/sun/Gauge.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/test/foundry/sun/Gauge.t.sol b/protocol/test/foundry/sun/Gauge.t.sol index 430beab9d..ea18a4d2b 100644 --- a/protocol/test/foundry/sun/Gauge.t.sol +++ b/protocol/test/foundry/sun/Gauge.t.sol @@ -455,7 +455,7 @@ contract GaugeTest is TestHelper { * note: beanToMaxLPRatio and averageGrownStalkPerBdvPerSeason are kept constant for testing purposes. * see {testDistroGaugeBeanToLp} to see how the beanToMaxLPRatio and averageGrownStalkPerBdvPerSeason are adjusted. */ - // FAILS + // FAILS function testDistroGaugeLpToLp() public { initLpToLpDistro(); bs.mockStepGauge();