From 22ae82406cf323729751b1f397e82c4546d72e45 Mon Sep 17 00:00:00 2001 From: alecks <0xalecks@gmail.com> Date: Wed, 30 Aug 2023 14:14:25 -0400 Subject: [PATCH] ui: Fix zero balance issue --- projects/sdk/src/lib/silo.ts | 8 ++++---- projects/ui/src/state/beanstalk/silo/updater.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/sdk/src/lib/silo.ts b/projects/sdk/src/lib/silo.ts index 1c368387c1..e07ab23b5e 100644 --- a/projects/sdk/src/lib/silo.ts +++ b/projects/sdk/src/lib/silo.ts @@ -288,7 +288,7 @@ export class Silo { const balance = balances.get(token)!; // Load stem tip, used to calculate the amount of grown stalk - const stemTip = stemTips.get(token); + const stemTip = stemTips.get(token.address); if (!stemTip) throw new Error(`No stem tip found for ${token.address}`); for (let stem in deposits) { @@ -328,7 +328,7 @@ export class Silo { const balance = balances.get(token)!; // Load stem tip, used to calculate the amount of grown stalk - const stemTip = stemTips.get(token); + const stemTip = stemTips.get(token.address); if (!stemTip) throw new Error(`No stem tip found for ${token.address}`); utils.applyDeposit(balance, token, stemTip, { @@ -445,8 +445,8 @@ export class Silo { * TODO: Check if whitelisted? */ async getStemTips(tokens: Token[]) { - return Promise.all(tokens.map((token) => this.getStemTip(token).then((tip) => [token, tip] as const))).then( - (tips) => new Map(tips) + return Promise.all(tokens.map((token) => this.getStemTip(token).then((tip) => [token.address, tip] as const))).then( + (tips) => new Map(tips) ); } diff --git a/projects/ui/src/state/beanstalk/silo/updater.ts b/projects/ui/src/state/beanstalk/silo/updater.ts index 6bcfca406a..bd0e0f791c 100644 --- a/projects/ui/src/state/beanstalk/silo/updater.ts +++ b/projects/ui/src/state/beanstalk/silo/updater.ts @@ -106,7 +106,7 @@ export const useFetchBeanstalkSilo = () => { const token = sdk.tokens.findByAddress(curr.address); if (!token) throw new Error(`Token not found in SDK: ${curr.address}`); - const stemTip = stemTips.get(token); + const stemTip = stemTips.get(token.address); if (!stemTip) throw new Error(`Stem Tip not found in SDK: ${curr.address}`);