Skip to content

Commit

Permalink
ui: Fix zero balance issue
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalecks committed Aug 30, 2023
1 parent 75fa0e8 commit 22ae824
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions projects/sdk/src/lib/silo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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<Token, BigNumber>(tips)
return Promise.all(tokens.map((token) => this.getStemTip(token).then((tip) => [token.address, tip] as const))).then(
(tips) => new Map<String, BigNumber>(tips)
);
}

Expand Down
2 changes: 1 addition & 1 deletion projects/ui/src/state/beanstalk/silo/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down

0 comments on commit 22ae824

Please sign in to comment.