* fix: dodo add base,linea,scroll,manta,mantle chain data

* fix dodo

---------

Co-authored-by: pengyongjun <pengyongjun@vip.qq.com>
This commit is contained in:
g1nt0ki
2023-11-21 23:42:38 +01:00
committed by GitHub
parent ccd60ba48d
commit 4dfdd8b2e6
2 changed files with 68 additions and 32 deletions

View File

@@ -379,7 +379,7 @@ async function computeTVL(balances, timestamp) {
const balance = balances[address];
if (data == undefined) tokenBalances[`UNKNOWN (${address})`] = balance
if ('confidence' in data && data.confidence < confidenceThreshold) return
if ('confidence' in data && data.confidence < confidenceThreshold || !data.price) return
if (Math.abs(data.timestamp - Date.now() / 1e3) > (24 * 3600)) {
console.log(`Price for ${address} is stale, ignoring...`)
return
@@ -403,6 +403,9 @@ Warning: `)
tokenBalances[data.symbol] = (tokenBalances[data.symbol] ?? 0) + amount;
usdTokenBalances[data.symbol] = (usdTokenBalances[data.symbol] ?? 0) + usdAmount;
usdTvl += usdAmount;
if (isNaN(usdTvl)) {
throw new Error(`NaN usdTvl for ${address} with balance ${balance} and price ${data.price}`)
}
})
});