Skip to content

Commit b577f56

Browse files
inumuneg1nt0ki
andauthored
Create panko tvl (DefiLlama#11970)
Co-authored-by: g1nt0ki <[email protected]>
1 parent 6770ee3 commit b577f56

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

projects/panko/index.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const { uniV3Export } = require("../helper/uniswapV3")
2+
const { getLogs2 } = require('../helper/cache/getLogs')
3+
const { mergeExports } = require("../helper/utils")
4+
const { nullAddress } = require("../helper/unwrapLPs")
5+
6+
const uniTvl = uniV3Export({
7+
taiko: { factory: '0x99960D7076297a1E0C86f3cc60FfA5d6f2B507B5', fromBlock: 433329 }
8+
})
9+
10+
const stableswapConfig = {
11+
taiko: { factory: '0x542E849ff47da056c127F35710b01242A59705d2', fromBlock: 433341 }
12+
}
13+
const stableTvl = {}
14+
15+
Object.keys(stableswapConfig).forEach(chain => {
16+
const { factory, fromBlock, } = stableswapConfig[chain]
17+
stableTvl[chain] = {
18+
tvl: async (api) => {
19+
const logs = await getLogs2({
20+
api,
21+
factory,
22+
eventAbi: 'event NewStableSwapPair(address indexed swapContract, address tokenA, address tokenB, address tokenC, address LP)',
23+
fromBlock,
24+
})
25+
const ownerTokens = logs.map(i => [[i.tokenA, i.tokenB, i.tokenC].filter(i => i !== nullAddress), i.swapContract])
26+
return api.sumTokens({ ownerTokens })
27+
}
28+
}
29+
})
30+
31+
module.exports = mergeExports([uniTvl, stableTvl])

0 commit comments

Comments
 (0)