mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
Dodo (#8145)
* 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:
5
test.js
5
test.js
@@ -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}`)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user