Skip to content

Commit

Permalink
feat: remove pre silov3 claimable
Browse files Browse the repository at this point in the history
  • Loading branch information
Space-Bean committed Oct 10, 2024
1 parent 611920e commit 47ee49e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 87 deletions.
30 changes: 10 additions & 20 deletions projects/ui/src/hooks/beanstalk/useBeanstalkBalancesBreakdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
);
}
}

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions projects/ui/src/state/beanstalk/silo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};

/**
Expand Down
62 changes: 0 additions & 62 deletions projects/ui/src/state/beanstalk/silo/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ export const useFetchBeanstalkSilo = () => {
deposited: {
amount: curr.deposited,
},
withdrawn: {
amount: ZERO_BN,
},
germinating: {
amount: curr.totalGerminating,
},
Expand Down Expand Up @@ -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);

0 comments on commit 47ee49e

Please sign in to comment.