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

Treat missing denom as balance of 0 for Monitored Values #574

Merged
merged 1 commit into from
Dec 20, 2024
Merged
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
6 changes: 1 addition & 5 deletions apps/indexer/src/monitors/addressBalanceMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ export class AddressBalanceMonitor {
const [targetAddress, targetToken] = monitoredValue.target.split("|");
const balance = await this.getBalance(targetAddress, targetToken);

if (balance === null) {
throw new Error("Unable to get balance for " + monitoredValue.target);
}

monitoredValue.value = balance.toString();
monitoredValue.lastUpdateDate = new Date();
await monitoredValue.save();
Expand All @@ -36,7 +32,7 @@ export class AddressBalanceMonitor {
const balance = response.data.balances.find(x => x.denom === (denom || activeChain.udenom));

if (!balance) {
return null;
return 0;
}

return parseInt(balance.amount);
Expand Down
Loading