Skip to content

Commit

Permalink
track mantra amm DefiLlama#12972
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Jan 6, 2025
1 parent 0f9194a commit f055266
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 17 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"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",
"check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js",
"string-timestamp": "node utils/scripts/stringTimestamp.js",
"sort-chains": "node projects/helper/getChainList.js",
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' "
},
"author": "",
Expand Down
3 changes: 2 additions & 1 deletion projects/helper/chain/cosmos.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const endPoints = {
joltify: "https://lcd.joltify.io",
kopi: "https://rest.kopi.money",
noble: "https://noble-api.polkachu.com",
mantra: "https://api.mantrachain.io",
elys: "https://api.elys.network", // https://api.elys.network/#/Query/ElysAmmPoolAll
pryzm: "https://api.pryzm.zone"
};
Expand Down Expand Up @@ -313,7 +314,7 @@ async function sumTokens({ balances, owners = [], chain, owner, tokens, blacklis
.for(owners)
.process(async (owner, i) => {
await getBalance2({ balances, owner, chain, tokens, blacklistedTokens, api, })
if (chain === 'osmosis' && owners.length > 100)
if (chain === 'osmosis' && owners.length > 100)
await sleep(3000)
});

Expand Down
31 changes: 16 additions & 15 deletions projects/helper/chains.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"alephium",
"algorand",
"alv",
"ancient8",
"apechain",
"aptos",
"arbitrum",
"arbitrum_nova",
"assetchain",
"ancient8",
"archway",
"area",
"apechain",
"assetchain",
"astar",
"astrzk",
"aura",
Expand All @@ -34,10 +34,10 @@
"bitcoincash",
"bitgert",
"bitindi",
"bitkub",
"bitrock",
"bittensor",
"bittorrent",
"bitkub",
"blast",
"bob",
"boba",
Expand All @@ -49,8 +49,8 @@
"bouncebit",
"bsc",
"bsquared",
"btr",
"btn",
"btr",
"bytomsidechain",
"callisto",
"candle",
Expand Down Expand Up @@ -90,8 +90,8 @@
"degen",
"dexalot",
"dexit",
"dfs",
"dfk",
"dfs",
"doge",
"dogechain",
"dsc",
Expand All @@ -115,11 +115,11 @@
"equilibrium",
"era",
"ergo",
"etlk",
"ethereum",
"ethereumclassic",
"ethf",
"ethpow",
"etlk",
"etn",
"europa",
"everscale",
Expand All @@ -133,8 +133,8 @@
"fraxtal",
"fsc",
"ftn",
"functionx",
"fuel",
"functionx",
"fuse",
"fusion",
"genesys",
Expand All @@ -146,8 +146,8 @@
"gravity",
"gravitybridge",
"grove",
"harmony",
"ham",
"harmony",
"heco",
"hedera",
"heiko",
Expand Down Expand Up @@ -199,10 +199,11 @@
"lukso",
"lung",
"manta",
"massa",
"manta_atlantic",
"mantle",
"mantra",
"map",
"massa",
"matchain",
"mayachain",
"meer",
Expand Down Expand Up @@ -278,8 +279,8 @@
"quicksilver",
"radixdlt",
"rari",
"real",
"rbn",
"real",
"reef",
"regen",
"rei",
Expand Down Expand Up @@ -312,7 +313,6 @@
"sonic",
"sophon",
"sora",
"swellchain",
"stacks",
"stafi",
"staking",
Expand All @@ -324,6 +324,7 @@
"stride",
"sui",
"svm",
"swellchain",
"sx",
"syscoin",
"taiko",
Expand Down Expand Up @@ -365,6 +366,7 @@
"xdc",
"xlayer",
"xpla",
"xsat",
"zeniq",
"zeta",
"zilliqa",
Expand All @@ -374,6 +376,5 @@
"zklink",
"zksync",
"zora",
"zyx",
"xsat"
]
"zyx"
]
5 changes: 4 additions & 1 deletion projects/helper/tokenMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets))


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',
'kopi', 'elys', "pryzm"
'kopi', 'elys', "pryzm", "mantra",

]
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',
Expand Down Expand Up @@ -92,6 +92,9 @@ const fixBalancesTokens = {
crossfi: {
[ADDRESSES.null]: { coingeckoId: 'crossfi-2', decimals: 18 },
[ADDRESSES.crossfi.WXFI]: { coingeckoId: 'crossfi-2', decimals: 18 },
},
mantra: {
uom: { coingeckoId: 'mantra-dao', decimals: 6 },
}
}

Expand Down
36 changes: 36 additions & 0 deletions projects/mantra-amm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { queryContract } = require("../helper/chain/cosmos");

const chain = 'mantra'
const mantraPoolManager = 'mantra1466nf3zuxpya8q9emxukd7vftaf6h4psr0a07srl5zw74zh84yjqagspfm'

/**
* Get all pools in the DEX
* @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}}>>}
*/
async function getDexPools() {
const response = await queryContract({
chain,
contract: mantraPoolManager,
data: {
pools: {}
}
})
return response.pools
}

async function tvl(api) {
const allPools = await getDexPools()
allPools.forEach(pool => {
pool.pool_info.assets.forEach(asset => {
api.add(asset.denom, asset.amount)
})
})
}

module.exports = {
timetravel: false,
methodology: "Counts the liquidity on MANTRA Chain AMM pools",
mantra: {
tvl
}
}

0 comments on commit f055266

Please sign in to comment.