From 47ee49efa492647256b9d89404fcd712930345a2 Mon Sep 17 00:00:00 2001 From: Spacebean Date: Wed, 9 Oct 2024 20:35:16 -0600 Subject: [PATCH] feat: remove pre silov3 claimable --- .../useBeanstalkBalancesBreakdown.tsx | 30 +++------ projects/ui/src/state/beanstalk/silo/index.ts | 5 -- .../ui/src/state/beanstalk/silo/updater.ts | 62 ------------------- 3 files changed, 10 insertions(+), 87 deletions(-) diff --git a/projects/ui/src/hooks/beanstalk/useBeanstalkBalancesBreakdown.tsx b/projects/ui/src/hooks/beanstalk/useBeanstalkBalancesBreakdown.tsx index d61001661..6dfd5756c 100644 --- a/projects/ui/src/hooks/beanstalk/useBeanstalkBalancesBreakdown.tsx +++ b/projects/ui/src/hooks/beanstalk/useBeanstalkBalancesBreakdown.tsx @@ -27,12 +27,12 @@ export const STATE_CONFIG = { colors.chart.yellow, (name: string) => `${name} that are Deposited in the Silo.`, ], - withdrawn: [ - 'Claimable', - colors.chart.yellowLight, - (name: string) => - `Legacy Claimable ${name === 'Beans' ? 'Bean' : name} Withdrawals from before Silo V3.`, - ], + // withdrawn: [ + // 'Claimable', + // colors.chart.yellowLight, + // (name: string) => + // `Legacy Claimable ${name === 'Beans' ? 'Bean' : name} Withdrawals from before Silo V3.`, + // ], farmable: [ 'Farm & Circulating', colors.chart.green, @@ -170,9 +170,9 @@ export default function useBeanstalkSiloBreakdown() { if (unripeToRipe[address]) { const unripeToken = unripeTokenState[address]; if (unripeToken) { - farmable = unripeToken.supply - .minus(siloBalance.deposited.amount) - .minus(siloBalance.withdrawn?.amount || ZERO_BN); + farmable = unripeToken.supply.minus( + siloBalance.deposited.amount + ); } } @@ -201,24 +201,18 @@ export default function useBeanstalkSiloBreakdown() { // .minus(budget) .minus(totalPooled) .minus(ripe || ZERO_BN) - .minus(siloBalance.deposited.amount) - .minus(siloBalance.withdrawn?.amount || ZERO_BN); + .minus(siloBalance.deposited.amount); } // Handle: LP Tokens if (poolState[address]) { farmable = poolState[address].supply .minus(siloBalance.deposited.amount) - .minus(siloBalance.withdrawn?.amount || ZERO_BN) .minus(ripe || ZERO_BN); } const amountByState = { deposited: siloBalance.deposited?.amount, - withdrawn: - TOKEN === BeanWstETH - ? undefined - : siloBalance.withdrawn?.amount, pooled: pooled, ripePooled: ripePooled, ripe: ripe, @@ -227,10 +221,6 @@ export default function useBeanstalkSiloBreakdown() { }; const usdValueByState = { deposited: getUSD(TOKEN, siloBalance.deposited.amount), - withdrawn: - TOKEN === BeanWstETH - ? undefined - : getUSD(TOKEN, siloBalance.withdrawn?.amount || ZERO_BN), pooled: pooled ? getUSD(TOKEN, pooled) : undefined, ripePooled: ripePooled ? getUSD(TOKEN, ripePooled) : undefined, ripe: ripe ? getUSD(TOKEN, ripe) : undefined, diff --git a/projects/ui/src/state/beanstalk/silo/index.ts b/projects/ui/src/state/beanstalk/silo/index.ts index 4dc105e59..3e30364be 100644 --- a/projects/ui/src/state/beanstalk/silo/index.ts +++ b/projects/ui/src/state/beanstalk/silo/index.ts @@ -20,11 +20,6 @@ export type BeanstalkSiloBalance = { }; /** the total amount of this Token that is deposited (deposited & germinating) */ TVD: BigNumber; - /** @deprecated */ - withdrawn?: { - /** The total amount of this Token currently in the Withdrawn state. */ - amount: BigNumber; - }; }; /** diff --git a/projects/ui/src/state/beanstalk/silo/updater.ts b/projects/ui/src/state/beanstalk/silo/updater.ts index 7ea7e46b3..a331c8560 100644 --- a/projects/ui/src/state/beanstalk/silo/updater.ts +++ b/projects/ui/src/state/beanstalk/silo/updater.ts @@ -126,9 +126,6 @@ export const useFetchBeanstalkSilo = () => { deposited: { amount: curr.deposited, }, - withdrawn: { - amount: ZERO_BN, - }, germinating: { amount: curr.totalGerminating, }, @@ -291,62 +288,3 @@ function buildBeanstalkSiloMultiCall(beanstalkAddress: string): CallParams[] { }, ]; } - -// const [ -// // 0 -// _stalkTotal, -// _bdvTotal, -// _rootsTotal, -// _earnedBeansTotal, -// // 4 -// _whitelistedAssetTotals, -// // 5 -// _stemTips, -// ] = await Promise.all([ -// // 0 -// beanstalk.totalStalk().then(tokenResult(STALK)), // Does NOT include Grown Stalk -// new BigNumberJS(0), // -// beanstalk.totalRoots().then(bigNumberResult), // -// beanstalk.totalEarnedBeans().then(tokenResult(BEAN)), - -// // 4 -// // FIXME: Could save a lot of network requests by moving this to the Subgraph -// Promise.all( -// [...sdk.tokens.siloWhitelist].map((token) => -// Promise.all([ -// // FIXME: duplicate tokenResult optimization -// beanstalk -// .getTotalDeposited(token.address) -// .then((v) => transform(v, 'bnjs', token)), -// // BEAN will always have a fixed BDV of 1, skip to save a network request -// tokenIshEqual(token, BEAN) -// ? ONE_BN -// : beanstalk -// .bdv(token.address, token.amount(1).toBlockchain()) -// .then(tokenResult(BEAN)) -// .catch((err) => { -// console.error(`Failed to fetch BDV: ${token.address}`); -// console.error(err); -// throw err; -// }), -// sdk.silo.getStemTip(token), -// beanstalk -// .getTotalDepositedBdv(token.address) -// .then(tokenResult(BEAN)), -// beanstalk -// .getGerminatingTotalDeposited(token.address) -// .then((v) => transform(v, 'bnjs', token)), -// ]).then((data) => ({ -// address: token.address.toLowerCase(), -// deposited: data[0], -// bdvPerToken: data[1], -// stemTip: data[2], -// depositedBdv: data[3], -// totalGerminating: data[4], -// })) -// ) -// ), - -// // // 5 -// sdk.silo.getStemTips(), -// ] as const);