From 8be1fa2b368541a08adcb18161e2978d3ba9c7bc Mon Sep 17 00:00:00 2001 From: uncoolzero <107518216+uncoolzero@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:22:00 -0300 Subject: [PATCH] Updated Mowable Grown Stalk calculation --- .../src/components/Silo/Actions/Deposits.tsx | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/projects/ui/src/components/Silo/Actions/Deposits.tsx b/projects/ui/src/components/Silo/Actions/Deposits.tsx index be75670078..cf6bf99a91 100644 --- a/projects/ui/src/components/Silo/Actions/Deposits.tsx +++ b/projects/ui/src/components/Silo/Actions/Deposits.tsx @@ -31,10 +31,9 @@ const Deposits: FC< const account = useWagmiAccount(); const newToken = sdk.tokens.findBySymbol(token.symbol) as ERC20Token; - const seeds = transform(newToken.rewards?.seeds.toBlockchain() || "0", 'ethers', sdk.tokens.SEEDS); - const stemTip = useStemTipForToken(newToken); - const lastStem = stemTip ? stemTip.sub(siloBalance?.mowStatus.lastStem || Number(0)) : Number(0); - const mowableStalk = transform(((stemTip?.sub(lastStem) || BigNumber.from(0)).mul(seeds)), 'bnjs', sdk.tokens.STALK); + const stemTip = useStemTipForToken(newToken) || BigNumber.from(0); + const lastStem = siloBalance?.mowStatus.lastStem || BigNumber.from(0); + const deltaStem = stemTip?.sub(lastStem) || BigNumber.from(0); const rows: (LegacyDepositCrate & { id: string })[] = useMemo( () => @@ -139,25 +138,18 @@ const Deposits: FC< placement="bottom" title={ - - {displayFullBN(mowableStalk, 2, 2)} - - {displayFullBN(params.row.stalk.grown.minus(mowableStalk), 2, 2)} + {displayBN(params.row.stalk.grown.minus(transform(sdk.tokens.STALK.fromBlockchain(transform(params.row.bdv, 'tokenValue', sdk.tokens.BEAN).toBigNumber().mul(deltaStem)), 'bnjs')))} } > - {displayFullBN( - params.row.stalk.grown, - STALK.displayDecimals, - STALK.displayDecimals - )} + {displayBN(transform(sdk.tokens.STALK.fromBlockchain(transform(params.row.bdv, 'tokenValue', sdk.tokens.BEAN).toBigNumber().mul(deltaStem)), 'bnjs'))} - {displayBN(params.row.stalk.grown)} + {displayBN(transform(sdk.tokens.STALK.fromBlockchain(transform(params.row.bdv, 'tokenValue', sdk.tokens.BEAN).toBigNumber().mul(deltaStem)), 'bnjs'))} @@ -166,7 +158,7 @@ const Deposits: FC< }, COLUMNS.seeds, ] as GridColumns, - [mowableStalk, token] + [deltaStem, sdk.tokens.BEAN, sdk.tokens.STALK, token] ); const amount = siloBalance?.deposited.amount;