Skip to content

Commit f055266

Browse files
committed
track mantra amm DefiLlama#12972
1 parent 0f9194a commit f055266

File tree

5 files changed

+59
-17
lines changed

5 files changed

+59
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"biggest-files": "find ./projects -name '*.js' -not -path './projects/helper/*' -not -path './projects/curve/*' -not -path './projects/sigmao/*' -exec du -sh {} \\; | sort -rh | head -n 100",
1818
"check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js",
1919
"string-timestamp": "node utils/scripts/stringTimestamp.js",
20+
"sort-chains": "node projects/helper/getChainList.js",
2021
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' "
2122
},
2223
"author": "",

projects/helper/chain/cosmos.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const endPoints = {
4545
joltify: "https://lcd.joltify.io",
4646
kopi: "https://rest.kopi.money",
4747
noble: "https://noble-api.polkachu.com",
48+
mantra: "https://api.mantrachain.io",
4849
elys: "https://api.elys.network", // https://api.elys.network/#/Query/ElysAmmPoolAll
4950
pryzm: "https://api.pryzm.zone"
5051
};
@@ -313,7 +314,7 @@ async function sumTokens({ balances, owners = [], chain, owner, tokens, blacklis
313314
.for(owners)
314315
.process(async (owner, i) => {
315316
await getBalance2({ balances, owner, chain, tokens, blacklistedTokens, api, })
316-
if (chain === 'osmosis' && owners.length > 100)
317+
if (chain === 'osmosis' && owners.length > 100)
317318
await sleep(3000)
318319
});
319320

projects/helper/chains.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
"alephium",
1010
"algorand",
1111
"alv",
12+
"ancient8",
13+
"apechain",
1214
"aptos",
1315
"arbitrum",
1416
"arbitrum_nova",
15-
"assetchain",
16-
"ancient8",
1717
"archway",
1818
"area",
19-
"apechain",
19+
"assetchain",
2020
"astar",
2121
"astrzk",
2222
"aura",
@@ -34,10 +34,10 @@
3434
"bitcoincash",
3535
"bitgert",
3636
"bitindi",
37+
"bitkub",
3738
"bitrock",
3839
"bittensor",
3940
"bittorrent",
40-
"bitkub",
4141
"blast",
4242
"bob",
4343
"boba",
@@ -49,8 +49,8 @@
4949
"bouncebit",
5050
"bsc",
5151
"bsquared",
52-
"btr",
5352
"btn",
53+
"btr",
5454
"bytomsidechain",
5555
"callisto",
5656
"candle",
@@ -90,8 +90,8 @@
9090
"degen",
9191
"dexalot",
9292
"dexit",
93-
"dfs",
9493
"dfk",
94+
"dfs",
9595
"doge",
9696
"dogechain",
9797
"dsc",
@@ -115,11 +115,11 @@
115115
"equilibrium",
116116
"era",
117117
"ergo",
118-
"etlk",
119118
"ethereum",
120119
"ethereumclassic",
121120
"ethf",
122121
"ethpow",
122+
"etlk",
123123
"etn",
124124
"europa",
125125
"everscale",
@@ -133,8 +133,8 @@
133133
"fraxtal",
134134
"fsc",
135135
"ftn",
136-
"functionx",
137136
"fuel",
137+
"functionx",
138138
"fuse",
139139
"fusion",
140140
"genesys",
@@ -146,8 +146,8 @@
146146
"gravity",
147147
"gravitybridge",
148148
"grove",
149-
"harmony",
150149
"ham",
150+
"harmony",
151151
"heco",
152152
"hedera",
153153
"heiko",
@@ -199,10 +199,11 @@
199199
"lukso",
200200
"lung",
201201
"manta",
202-
"massa",
203202
"manta_atlantic",
204203
"mantle",
204+
"mantra",
205205
"map",
206+
"massa",
206207
"matchain",
207208
"mayachain",
208209
"meer",
@@ -278,8 +279,8 @@
278279
"quicksilver",
279280
"radixdlt",
280281
"rari",
281-
"real",
282282
"rbn",
283+
"real",
283284
"reef",
284285
"regen",
285286
"rei",
@@ -312,7 +313,6 @@
312313
"sonic",
313314
"sophon",
314315
"sora",
315-
"swellchain",
316316
"stacks",
317317
"stafi",
318318
"staking",
@@ -324,6 +324,7 @@
324324
"stride",
325325
"sui",
326326
"svm",
327+
"swellchain",
327328
"sx",
328329
"syscoin",
329330
"taiko",
@@ -365,6 +366,7 @@
365366
"xdc",
366367
"xlayer",
367368
"xpla",
369+
"xsat",
368370
"zeniq",
369371
"zeta",
370372
"zilliqa",
@@ -374,6 +376,5 @@
374376
"zklink",
375377
"zksync",
376378
"zora",
377-
"zyx",
378-
"xsat"
379-
]
379+
"zyx"
380+
]

projects/helper/tokenMapping.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets))
1919

2020

2121
const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom', 'joltify', 'nibiru',
22-
'kopi', 'elys', "pryzm"
22+
'kopi', 'elys', "pryzm", "mantra",
2323

2424
]
2525
const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa',
@@ -92,6 +92,9 @@ const fixBalancesTokens = {
9292
crossfi: {
9393
[ADDRESSES.null]: { coingeckoId: 'crossfi-2', decimals: 18 },
9494
[ADDRESSES.crossfi.WXFI]: { coingeckoId: 'crossfi-2', decimals: 18 },
95+
},
96+
mantra: {
97+
uom: { coingeckoId: 'mantra-dao', decimals: 6 },
9598
}
9699
}
97100

projects/mantra-amm/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const { queryContract } = require("../helper/chain/cosmos");
2+
3+
const chain = 'mantra'
4+
const mantraPoolManager = 'mantra1466nf3zuxpya8q9emxukd7vftaf6h4psr0a07srl5zw74zh84yjqagspfm'
5+
6+
/**
7+
* Get all pools in the DEX
8+
* @returns {Promise<Array<{pool_info: {pool_identifier: string, asset_denoms: string[], lp_denom: string, asset_decimals: number[], assets: Array<{denom: string, amount: string}>}, total_share: {denom: string, amount: string}}>>}
9+
*/
10+
async function getDexPools() {
11+
const response = await queryContract({
12+
chain,
13+
contract: mantraPoolManager,
14+
data: {
15+
pools: {}
16+
}
17+
})
18+
return response.pools
19+
}
20+
21+
async function tvl(api) {
22+
const allPools = await getDexPools()
23+
allPools.forEach(pool => {
24+
pool.pool_info.assets.forEach(asset => {
25+
api.add(asset.denom, asset.amount)
26+
})
27+
})
28+
}
29+
30+
module.exports = {
31+
timetravel: false,
32+
methodology: "Counts the liquidity on MANTRA Chain AMM pools",
33+
mantra: {
34+
tvl
35+
}
36+
}

0 commit comments

Comments
 (0)