Skip to content

Commit

Permalink
coins2
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebruce0x committed Oct 13, 2023
1 parent 5ce2761 commit 6cd82d4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
34 changes: 22 additions & 12 deletions projects/defichain-dex.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
const { transformDexBalances } = require('./helper/portedTokens');
const { get } = require('./helper/http')
const { transformDexBalances } = require("./helper/portedTokens");
const { get } = require("./helper/http");

async function tvl() {
const data = []
const { data: info } = await get('https://ocean.defichain.com/v0/mainnet/poolpairs?size=200')
info.forEach(i => data.push({ token0: i.tokenA.symbol, token0Bal: i.tokenA.reserve, token1: i.tokenB.symbol, token1Bal: i.tokenB.reserve,}))
const balances = await transformDexBalances({data, chain: 'defichain'})
balances['defichain:dusd'] = balances['defichain:dusd'] * 0.7
return balances
const data = [];
const { data: info } = await get(
"https://ocean.defichain.com/v0/mainnet/poolpairs?size=200"
);
info.forEach((i) =>
data.push({
token0: i.tokenA.symbol,
token0Bal: i.tokenA.reserve,
token1: i.tokenB.symbol,
token1Bal: i.tokenB.reserve,
})
);
const balances = await transformDexBalances({ data, chain: "defichain" });
balances["defichain:dusd"] = balances["defichain:dusd"] * 0.7;
return balances;
}

module.exports = {
methodology: "Liquidity on the DEX, DUSD price is reduced by 30% because of the dex stabilty tax",
methodology:
"Liquidity on the DEX, DUSD price is reduced by 30% because of the dex stabilty tax",
timetravel: false,
misrepresentedTokens: true,
defichain: {
tvl
}
}
tvl,
},
}; // node test.js projects/stfil/index.js
2 changes: 1 addition & 1 deletion projects/shipyard-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function chainTvl(chain, config) {
coins.push(`${chain}:${want}`.toLowerCase());
}

const getCoins = get(`https://coins.llama.fi/prices/current/${coins.join(',')}`)
const getCoins = get(`https://coins2.llama.fi/prices/current/${coins.join(',')}`)

const coinsData = (await getCoins).coins;

Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ async function computeTVL(balances, timestamp) {
const { errors } = await PromisePool.withConcurrency(5)
.for(sliceIntoChunks(readKeys, 100))
.process(async (keys) => {
tokenData.push((await axios.get(`https://coins.llama.fi/prices/current/${keys.join(',')}`)).data.coins)
tokenData.push((await axios.get(`https://coins2.llama.fi/prices/current/${keys.join(',')}`)).data.coins)
})

if (errors && errors.length)
Expand Down
4 changes: 2 additions & 2 deletions utils/scripts/changeCoreAssetsFormat2.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function getSymbols([chain, mapping]) {
return key2
}).filter(i => i)
if (!tokens.length) return;
const { data: { coins } } = await axios.get('https://coins.llama.fi/prices/current/' + tokens.join(','))
const { data: { coins } } = await axios.get('https://coins2.llama.fi/prices/current/' + tokens.join(','))
const symbolSet = new Set()
Object.entries(coins).forEach(([key, { symbol }]) => {
const key2 = reverseMapping[key]
Expand Down Expand Up @@ -55,7 +55,7 @@ async function checkSymbols([chain, mapping]) {
return chain + ':' + value
})
if (!tokens.length) return;
const { data: { coins } } = await axios.get('https://coins.llama.fi/prices/current/' + tokens.join(','))
const { data: { coins } } = await axios.get('https://coins2.llama.fi/prices/current/' + tokens.join(','))
Object.entries(coins).forEach(([key, { symbol }]) => {
tokens = tokens.filter(i => i !== key)
})
Expand Down
2 changes: 1 addition & 1 deletion utils/scripts/testTokenMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function main() {
.for(chunks)
.process(async chunk => {
const str = chunk.join(',')
const { data } = await axios.get('https://coins.llama.fi/prices/current/'+str)
const { data } = await axios.get('https://coins2.llama.fi/prices/current/'+str)
missing.push(...chunk.filter(i => !data.coins[i]))
})

Expand Down

0 comments on commit 6cd82d4

Please sign in to comment.