Skip to content

Commit 55c02fb

Browse files
committed
refactor privacy pools
1 parent 1e946d7 commit 55c02fb

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

projects/privacypools/index.js

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs')
1+
const { sumTokens2 } = require("../helper/unwrapLPs")
22

33
const config = {
4-
ethereum: { owners: ['0xf241d57c6debae225c0f2e6ea1529373c9a9c9fb'], tokens: [nullAddress] },
4+
ethereum: { poolsAndAssets: [
5+
{ pool: '0x6818809eefce719e480a7526d76bd3e561526b46', assets: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE']}
6+
]},
57
}
68

79
Object.keys(config).forEach(chain => {
810
module.exports[chain] = {
9-
tvl: sumTokensExport(config[chain],)
11+
tvl
1012
}
11-
})
13+
})
14+
15+
async function tvl(api) {
16+
const { poolsAndAssets } = config[api.chain]
17+
const tokens = []
18+
const calls = []
19+
poolsAndAssets.forEach(({ pool, assets }) => {
20+
assets.forEach(asset => {
21+
tokens.push(asset)
22+
calls.push({ target: pool, params: asset })
23+
})
24+
})
25+
const poolConfig = await api.multiCall({ abi: "function assetConfig(address _asset) view returns (address pool, uint256 minimumDepositAmount, uint256 vettingFeeBPS, uint256 maxRelayFeeBPS)", calls: calls })
26+
const owners = poolConfig.map(i => i.pool)
27+
return sumTokens2({ api, tokensAndOwners2: [tokens, owners], })
28+
29+
}

0 commit comments

Comments
 (0)