Skip to content

Commit

Permalink
ui: Fix zero balance issue (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalecks authored Sep 4, 2023
2 parents 5902e90 + d827445 commit a68ea67
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 a68ea67

Please sign in to comment.