Skip to content

Commit b9b6e8d

Browse files
committed
venus: track ethereum
1 parent d672695 commit b9b6e8d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

projects/venus-isolated-pools/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ const { compoundExports2 } = require('../helper/compound')
44
const config = {
55
bsc: {
66
endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools',
7+
corePools: ['0xfd36e2c2a6789db23113685031d7f16329158384'],
8+
},
9+
ethereum: {
10+
endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools-ethereum',
11+
corePools: ['0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'],
712
}
813
}
914

@@ -12,9 +17,10 @@ Object.keys(config).forEach(chain => {
1217
})
1318

1419
async function getPools(api) {
15-
const { endpoint } = config[api.chain]
16-
const { pools } = await cachedGraphQuery('venus-v4', endpoint, `{ pools { id }}`)
17-
return pools.map(i => i.id)
20+
const { endpoint, corePools } = config[api.chain]
21+
const poolSet = new Set(corePools.map(i=>i.toLowerCase()))
22+
const { pools } = await cachedGraphQuery('venus-v4/'+api.chain, endpoint, `{ pools { id }}`)
23+
return pools.map(i => i.id).filter(i => !poolSet.has(i.toLowerCase()))
1824
}
1925

2026
async function tvl(...args) {
@@ -29,4 +35,4 @@ async function borrowed(...args) {
2935
const pools = await getPools(api)
3036
const tvls = pools.map(i => compoundExports2({ comptroller: i, fetchBalances: true, }))
3137
return sdk.util.sumChainTvls(tvls.map(i => i.borrowed))(...args)
32-
}
38+
}

projects/venus.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const ADDRESSES = require('./helper/coreAssets.json')
2-
const {fullCoumpoundExports} = require('./helper/compound');
2+
const {fullCoumpoundExports, compoundExports2} = require('./helper/compound');
33

44
const replace = {
55
[ADDRESSES.bsc.BETH]: ADDRESSES.ethereum.WETH, // beth->weth
@@ -9,3 +9,5 @@ const replace = {
99
module.exports = fullCoumpoundExports("0xfd36e2c2a6789db23113685031d7f16329158384", "bsc", "0xA07c5b74C9B40447a954e1466938b865b6BBea36", ADDRESSES.bsc.WBNB, addr=>{
1010
return replace[addr.toLowerCase()] || `bsc:${addr}`
1111
})
12+
13+
module.exports.ethereum = compoundExports2({ comptroller: '0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'})

0 commit comments

Comments
 (0)