Skip to content

Commit

Permalink
add moe liquidity book adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
realdealshaman committed Apr 3, 2024
1 parent 62784e7 commit d1f4ba5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions projects/merchant-moe-lb/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { sumTokens2 } = require('../helper/unwrapLPs')

const factories = {
mantle: '0xa6630671775c4EA2743840F9A5016dCf2A104054',
}
async function tvl(api) {
const pools = await api.fetchList({
target: factories[api.chain],
itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)',
lengthAbi: 'uint256:getNumberOfLBPairs',
})
const tokenA = await api.multiCall({
abi: 'address:getTokenX',
calls: pools,
})
const tokenB = await api.multiCall({
abi: 'address:getTokenY',
calls: pools,
})
const toa = []
tokenA.map((_, i) => {
toa.push([tokenA[i], pools[i]])
toa.push([tokenB[i], pools[i]])
})
return sumTokens2({ api, tokensAndOwners: toa, })
}

module.exports = {
methodology: 'We count the token balances in in different liquidity book contracts',
}

Object.keys(factories).forEach(chain => {
module.exports[chain] = { tvl }
})

0 comments on commit d1f4ba5

Please sign in to comment.