mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
Rumpel (#11727)
Co-authored-by: Josh Levine <joshuapark95@gmail.com> Co-authored-by: Josh Levine <24902242+jparklev@users.noreply.github.com>
This commit is contained in:
34
utils/scripts/checkFixTokensPriced.js
Normal file
34
utils/scripts/checkFixTokensPriced.js
Normal file
@@ -0,0 +1,34 @@
|
||||
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))
|
||||
Reference in New Issue
Block a user