Skip to content

Commit

Permalink
add kayak tvl (#10806)
Browse files Browse the repository at this point in the history
* init: kayak

* init: kayak tvl

* code refactor

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
liuruibin1 and g1nt0ki authored Jun 28, 2024
1 parent 9279e3b commit 6fefa69
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions projects/kayak/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { getLogs2 } = require('../helper/cache/getLogs')
const { sumTokens2 } = require('../helper/unwrapLPs')

const config = {
avax: { factory: '0x4df3038C2C7e13F46F0d63eC3AF5728F75Be3775', fromBlock: 46950081, }
}

Object.keys(config).forEach(chain => {
const { factory, fromBlock, } = config[chain]
module.exports[chain] = {
tvl: async (api) => {
const logs = await getLogs2({
api,
factory,
eventAbi: 'event NewStableSwapPair(address indexed swapContract, address indexed tokenA, address indexed tokenB)',
fromBlock,
})

const ownerTokens = logs.map(i => [[i.tokenA, i.tokenB], i.swapContract])
return sumTokens2({ api, ownerTokens })
}
}
})

0 comments on commit 6fefa69

Please sign in to comment.