Skip to content

Commit 48b6cfa

Browse files
Tvl for iguana stableswap (#15705)
1 parent 380e331 commit 48b6cfa

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

projects/helper/coreAssets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,8 @@
20502050
"WXTZ": "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb",
20512051
"USDC": "0x796ea11fa2dd751ed01b53c372ffdb4aaa8f00f9",
20522052
"USDT": "0x2c03058c8afc06713be23e58d2febc8337dbfe6a",
2053-
"WETH": "0xfc24f770f94edbca6d6f885e12d4317320bcb401"
2053+
"WETH": "0xfc24f770f94edbca6d6f885e12d4317320bcb401",
2054+
"LBTC": "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
20542055
},
20552056
"rari": {
20562057
"WETH": "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0",

projects/iguana-stableswap/index.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const { sumTokens2 } = require('../helper/unwrapLPs')
2+
const { getLogs } = require('../helper/cache/getLogs')
3+
4+
const factories = [{ target: '0x8676553F78fE2bC2321d4e87E7B825Bb092ED7c8', fromBlock: 16406948, token3: true, },]
5+
6+
module.exports.etlk = { tvl: async (api) => {
7+
const configs = await Promise.all(factories.map(getTvlConfig))
8+
return sumTokens2({ api, ownerTokens: configs.flat() })
9+
10+
async function getTvlConfig({ target, fromBlock, token3 }) {
11+
let topic = '0xa9551fb056fc743efe2a0a34e39f9769ad10166520df7843c09a66f82e148b97'
12+
let eventAbi = 'event NewStableSwapPair(address indexed swapContract, address indexed tokenA, address indexed tokenB)'
13+
let getOwnTokens = logs => logs.map(i => ([[i.tokenA, i.tokenB], i.swapContract]))
14+
if (token3) {
15+
topic = '0x48dc7a1b156fe3e70ed5ed0afcb307661905edf536f15bb5786e327ea1933532'
16+
eventAbi = 'event NewStableSwapPair(address indexed swapContract, address tokenA, address tokenB, address tokenC, address LP)'
17+
getOwnTokens = logs => logs.map(i => ([[i.tokenA, i.tokenB, i.tokenC], i.swapContract]))
18+
}
19+
20+
const logs = await getLogs({
21+
api,
22+
target,
23+
topics: [topic],
24+
fromBlock,
25+
eventAbi,
26+
onlyArgs: true,
27+
})
28+
29+
return getOwnTokens(logs)
30+
}
31+
} }

0 commit comments

Comments
 (0)