Files
DefiLlama-Adapters/utils/scripts/checkFixTokensPriced.js
g1nt0ki 75c2625e8b Rumpel (#11727)
Co-authored-by: Josh Levine <joshuapark95@gmail.com>
Co-authored-by: Josh Levine <24902242+jparklev@users.noreply.github.com>
2024-09-24 10:45:25 +02:00

34 lines
1.0 KiB
JavaScript

const { fixBalancesTokens } = require("../../projects/helper/tokenMapping")
const axios = require('axios')
async function run() {
let allTokens = []
const tokensMissingPrice = []
const tokensWithPrice = []
const tokenSet = new Set()
Object.entries(fixBalancesTokens).forEach(([chain, tokens]) => {
Object.keys(tokens).forEach(token => {
const key = chain+':'+token
if (!tokenSet.has(key.toLowerCase())) { // ignore duplicates
tokenSet.add(key.toLowerCase())
allTokens.push(key)
}
})
})
const burl = 'https://coins.llama.fi/prices/current/'+allTokens.join(',')
const prices = (await axios.get(burl)).data.coins
allTokens.forEach(token => {
if (!prices[token]) {
tokensMissingPrice.push(token)
} else {
tokensWithPrice.push(token)
}
})
console.log('Tokens with price:', tokensWithPrice, tokensWithPrice.length)
console.log('Tokens missing price:', tokensMissingPrice, tokensMissingPrice.length)
}
run().catch(console.error).then(() => process.exit(0))