Skip to content

Commit

Permalink
fix thorchain
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Apr 26, 2023
1 parent 90eb3ee commit 39ed1fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions projects/thorchain/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const chainMapping = {
LTC: 'litecoin',
BCH: 'bitcoin-cash',
DOGE: 'dogecoin',
GAIA: 'cosmos',
}

const defillamaChainMapping = {
Expand Down
8 changes: 3 additions & 5 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,9 @@ async function computeTVL(balances, timestamp) {
readKeys.forEach(i => unknownTokens[i] = true)

const { errors } = await PromisePool.withConcurrency(5)
.for(sliceIntoChunks(readKeys, 200))
.for(sliceIntoChunks(readKeys, 100))
.process(async (keys) => {
tokenData.push((await axios.post(`https://coins.llama.fi/prices`, {
coins: keys
})).data.coins)
tokenData.push((await axios.get(`https://coins.llama.fi/prices/current/${keys.join(',')}`)).data.coins)
})

if (errors && errors.length)
Expand All @@ -381,7 +379,7 @@ async function computeTVL(balances, timestamp) {

if (data == undefined) tokenBalances[`UNKNOWN (${address})`] = balance
if ('confidence' in data && data.confidence < confidenceThreshold) return
if (Math.abs(data.timestamp - Date.now()/1e3) > (24*3600)) {
if (Math.abs(data.timestamp - Date.now() / 1e3) > (24 * 3600)) {
console.log(`Price for ${address} is stale, ignoring...`)
return
}
Expand Down

0 comments on commit 39ed1fe

Please sign in to comment.