Skip to content
Open
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
12 changes: 4 additions & 8 deletions defi/src/storeTvlInterval/computeTVL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,10 @@ export default async function (balances: { [address: string]: string }, timestam
const balance = balances[address];
const { price, decimals } = response;
if (!price) return;
let symbol: string, amount: number;
if (response.PK.startsWith('coingecko:')) {
symbol = address;
amount = Number(balance);
} else {
symbol = (response.symbol as string).toUpperCase();
amount = new BigNumber(balance).div(10 ** decimals).toNumber();
}

const symbol = (response.symbol as string).toUpperCase();
const amount = response.PK.startsWith('coingecko:') ? Number(balance) : new BigNumber(balance).div(10 ** decimals).toNumber();

const usdAmount = amount * price;
checkForStaleness(usdAmount, response, now, protocol, staleCoinsInclusive);
tokenBalances[symbol] = (tokenBalances[symbol] ?? 0) + amount;
Expand Down