Skip to content

Commit

Permalink
Merge branch 'feat/amm-v3'
Browse files Browse the repository at this point in the history
  • Loading branch information
trungbach committed Aug 15, 2024
2 parents 96ed695 + d9a4a81 commit 996dd8a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions projects/oraidex-v3/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const graphql = require('../helper/utils/graphql');
const ADDRESSES = require('../helper/coreAssets.json')

async function tvl() {
try {
const endpoint = 'https://staging-ammv3-indexer.oraidex.io'
const query = `query poolQuery {
pools {
nodes {
id
totalValueLockedInUSD
}
}
}`
const res = await graphql.request(endpoint, query)

const token = 'orai:' + ADDRESSES.orai.USDT
const sum = {
[token]: 0
}
const COSMOS_DECIMALS = 6;
const decimals = 10 ** COSMOS_DECIMALS;
res.pools.nodes.forEach(pool => {
sum[token] += pool.totalValueLockedInUSD * decimals
})
return sum
} catch (error) {
console.error("Error when get tvl oraidex v3: ", error)
}
}

module.exports = {
timetravel: false,
misrepresentedTokens: true,
methodology: "Liquidity on pool V3",
orai: {tvl}
}

0 comments on commit 996dd8a

Please sign in to comment.