Skip to content

Commit

Permalink
add canto ambient
Browse files Browse the repository at this point in the history
  • Loading branch information
0xngmi committed Oct 19, 2023
1 parent b8f539a commit 6ab3de6
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions projects/ambient-finance/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
const { sumTokens2 } = require('../helper/unwrapLPs');
const { cachedGraphQuery } = require("../helper/cache");

const vault = "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688"
const vault = {
ethereum: "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688",
canto: "0x9290c893ce949fe13ef3355660d07de0fb793618"
}

async function tvl(_, _b, _cb, { api, }) {
const subgraphs = {
canto: "https://canto-subgraph.plexnode.wtf/subgraphs/name/ambient-graph",
ethereum: `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet`
}

const { pools } = await cachedGraphQuery(`ambient-finance/${api.chain}`, `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet`, "{ pools { base quote }}")
async function tvl(_, _b, _cb, { api, }) {
const { pools } = await cachedGraphQuery(`ambient-finance/${api.chain}`, subgraphs[api.chain], "{ pools { base quote }}")
const tokens = pools.map(i => [i.base, i.quote]).flat()
return sumTokens2({ api, owner: vault, tokens, })
return sumTokens2({ api, owner: vault[api.chain], tokens, })
}

module.exports = {
ethereum: {
tvl,
},
canto: {
tvl,
}
}
}

0 comments on commit 6ab3de6

Please sign in to comment.