Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Fix zero balance issue #619

Merged
merged 3 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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