|
1 |
| -const { sumTokens2 } = require('../helper/unwrapLPs') |
| 1 | +const { sumTokens2 } = require('../helper/unwrapLPs'); |
2 | 2 | const { cachedGraphQuery } = require('../helper/cache')
|
3 | 3 |
|
4 |
| -const MintingHub = "0x7bbe8F18040aF0032f4C2435E7a76db6F1E346DF"; |
5 |
| -const Collaterals = ["0xb4272071ecadd69d933adcd19ca99fe80664fc08"]; // XCHF |
| 4 | +// @dev: mapping of XCHF to its Bridge |
| 5 | +const XCHFBridge = ["0xb4272071ecadd69d933adcd19ca99fe80664fc08", "0x7bbe8F18040aF0032f4C2435E7a76db6F1E346DF"]; |
6 | 6 |
|
7 | 7 | async function tvl(api) {
|
8 |
| - const tokensAndOwners = Collaterals.map(i => [i, MintingHub]) |
9 |
| - const { positions } = await cachedGraphQuery('frankencoin', 'https://api.thegraph.com/subgraphs/name/frankencoin-zchf/frankencoin-subgraph', '{ positions { position collateral } }') |
10 |
| - positions.forEach(i => tokensAndOwners.push([i.collateral, i.position])) |
11 |
| - return sumTokens2({ api, tokensAndOwners, }) |
| 8 | + const tokensAndOwners = [XCHFBridge]; |
| 9 | + |
| 10 | + // @dev: query of positions from minting hubs via frankencoin graph (ponder) |
| 11 | + const { positionV1s } = await cachedGraphQuery('frankencoinV1', 'https://ponder.frankencoin.com', '{ positionV1s { items { position collateral } } }'); |
| 12 | + const { positionV2s } = await cachedGraphQuery('frankencoinV2', 'https://ponder.frankencoin.com', '{ positionV2s { items { position collateral } } }'); |
| 13 | + |
| 14 | + // @dev: mapping of positions from minting hubs |
| 15 | + positionV1s?.items?.forEach(i => tokensAndOwners.push([i.collateral, i.position])); |
| 16 | + positionV2s?.items?.forEach(i => tokensAndOwners.push([i.collateral, i.position])); |
| 17 | + |
| 18 | + return sumTokens2({ api, tokensAndOwners, }); |
12 | 19 | }
|
13 | 20 |
|
14 | 21 | module.exports = {
|
|
0 commit comments