Skip to content

Commit fd11045

Browse files
mhmtcrkglug1nt0ki
andauthored
Add AsteriaFinance (DefiLlama#11469)
Co-authored-by: g1ntoki <[email protected]>
1 parent 7a0cf09 commit fd11045

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function asteriaFinanceExport(config) {
2+
const exports = {
3+
methodology: 'We count the token balances in in different liquidity book contracts',
4+
}
5+
6+
Object.keys(config).forEach(chain => {
7+
let { factory } = config[chain]
8+
9+
exports[chain] = {
10+
tvl: async (api) => {
11+
const pools = await api.fetchList({ target: factory, itemAbi: 'getLBPairAtIndex', lengthAbi: 'getNumberOfLBPairs', })
12+
const tokenA = await api.multiCall({ abi: 'address:getTokenX', calls: pools, })
13+
const tokenB = await api.multiCall({ abi: 'address:getTokenY', calls: pools, })
14+
const tokensAndOwners2 = [tokenA.concat(tokenB), pools.concat(pools)]
15+
return api.sumTokens({ tokensAndOwners2 })
16+
}
17+
}
18+
})
19+
20+
return exports
21+
}
22+
23+
24+
module.exports = {
25+
asteriaFinanceExport,
26+
}

projects/asteria-finance/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const { asteriaFinanceExport } = require('./asteriaFinance')
2+
3+
module.exports = asteriaFinanceExport({
4+
scroll: { factory: '0x77C99431b679e21C42464f1714221eAE94C1e3ed' },
5+
})

0 commit comments

Comments
 (0)