Skip to content

Commit 64e8c4c

Browse files
committed
fix astroport
1 parent a44d479 commit 64e8c4c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

projects/astroport/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ module.exports = {
1111
tvl: getFactoryTvl("terra14x9fr055x5hvr48hzy2t4q7kvjvfttsvxusa4xsdcy702mnzsvuqprer8r")
1212
},
1313
neutron: {
14-
tvl: getFactoryTvl("neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e")
14+
tvl: getFactoryTvl("neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e", {
15+
blacklistedPairs: ['neutron14hn88erzgqskhvvczvdncu79tz4xqncrun5l5yqkwecmzrlpqnjquqp33f']
16+
})
1517
},
1618
sei: {
1719
tvl: getFactoryTvl("sei1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3shh3qfl")

projects/helper/coreAssets.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,5 +1880,8 @@
18801880
"WETH": "0x6b48c2e6a32077ec17e8ba0d98ffc676dfab1a30",
18811881
"USDC": "0x3B860c0b53f2e8bd5264AA7c3451d41263C933F2",
18821882
"RUSD": "0xa9f32a851b1800742e47725da54a09a7ef2556a3"
1883+
},
1884+
"neutron": {
1885+
"NTRN": "untrn"
18831886
}
18841887
}

projects/terraswap/factoryTvl.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ function getAssetInfo(asset) {
1616
return [extractTokenInfo(asset), Number(asset.amount)]
1717
}
1818

19-
async function getAllPairs(factory, chain) {
19+
async function getAllPairs(factory, chain, { blacklistedPairs = [] } = {}) {
20+
const blacklist = new Set(blacklistedPairs)
2021
let allPairs = []
2122
let currentPairs;
2223
const limit = factory === 'terra14x9fr055x5hvr48hzy2t4q7kvjvfttsvxusa4xsdcy702mnzsvuqprer8r' ? 29 : 30 // some weird native token issue at one of the pagination query
2324
do {
2425
const queryStr = `{"pairs": { "limit": ${limit} ${allPairs.length ? `,"start_after":${JSON.stringify(allPairs[allPairs.length - 1].asset_infos)}` : ""} }}`
2526
currentPairs = (await queryContract({ contract: factory, chain, data: queryStr })).pairs
26-
allPairs.push(...currentPairs)
27+
allPairs.push(...currentPairs.filter(pair => !blacklist.has(pair.contract_addr)))
2728
} while (currentPairs.length > 0)
2829
const dtos = []
2930
const getPairPool = (async (pair) => {
@@ -47,17 +48,17 @@ async function getAllPairs(factory, chain) {
4748
return dtos
4849
}
4950

50-
function getFactoryTvl(factory) {
51-
return async (_, _1, _2, { chain }) => {
52-
const pairs = (await getAllPairs(factory, chain)).filter(pair => (pair.assets[0].balance && pair.assets[1].balance))
51+
function getFactoryTvl(factory, { blacklistedPairs = []} = {}) {
52+
return async (api) => {
53+
const pairs = (await getAllPairs(factory, api.chain, { blacklistedPairs })).filter(pair => (pair.assets[0].balance && pair.assets[1].balance))
5354

5455
const data = pairs.map(({ assets }) => ({
5556
token0: assets[0].addr,
5657
token0Bal: assets[0].balance,
5758
token1: assets[1].addr,
5859
token1Bal: assets[1].balance,
5960
}))
60-
return transformDexBalances({ chain, data })
61+
return transformDexBalances({ api, data })
6162
}
6263
}
6364

0 commit comments

Comments
 (0)