Skip to content

Commit

Permalink
Treat missing denom as balance of 0 for Monitored Values (#574)
Browse files Browse the repository at this point in the history
fix(analytics): treat missing denom as balance of 0
  • Loading branch information
Redm4x authored Dec 20, 2024
1 parent 03f9f31 commit 36a084f
Showing 1 changed file with 1 addition and 5 deletions.
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

0 comments on commit 36a084f

Please sign in to comment.