Skip to content

Commit 81b557b

Browse files
authored
Add BOB TVL for Sovryn DEX (DefiLlama#10480)
1 parent d60b699 commit 81b557b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

projects/sovryn-dex/index.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const { staking } = require('../helper/staking')
2+
const { request, gql } = require("graphql-request");
3+
const { sumTokens2 } = require('../helper/unwrapLPs');
24
const { getConfig } = require('../helper/cache')
35
const { getUniqueAddresses } = require('../helper/utils')
46
const { transformDexBalances } = require('../helper/portedTokens')
@@ -8,8 +10,10 @@ async function tvl(api) {
810

911
// const impl = await api.call({ abi: 'address:swapsImpl', target: '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7' })
1012

11-
const protocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7'
13+
const RSKprotocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7'
14+
1215
const res = await getConfig('sovryn', 'https://backend.sovryn.app/tvl')
16+
1317
let pools = Object.values(res.tvlAmm).map(i => i?.contract).filter(i => i)
1418
pools = getUniqueAddresses(pools)
1519
const ownerTokens = []
@@ -31,14 +35,27 @@ async function tvl(api) {
3135
})
3236
await Promise.all(promises)
3337

34-
ownerTokens.push([allTokens, protocolContract])
38+
ownerTokens.push([allTokens, RSKprotocolContract])
3539
await api.sumTokens({ ownerTokens })
3640
return transformDexBalances({ data, api, })
3741
}
42+
3843
module.exports = {
3944
misrepresentedTokens: true,
45+
bob: {
46+
tvl: async () => { const query = gql`
47+
{
48+
pools { base quote }
49+
}
50+
`
51+
pools = await request(`https://bob-ambient-subgraph.sovryn.app/subgraphs/name/DistributedCollective/bob-ambient-subgraph`, query)
52+
const tokens = pools.pools.map(i => [i.base, i.quote]).flat()
53+
return sumTokens2({ chain: "bob", owner: '0xe5bc234A484A912A61Aa74501960cFc202e773dA', tokens, });
54+
},
55+
//staking: staking('0xc17C6462cEAFE9A8819258c6bA168BEF5544Fc21') // does not work
56+
},
4057
rsk: {
4158
tvl,
4259
staking: staking('0x5684a06cab22db16d901fee2a5c081b4c91ea40e', '0xefc78fc7d48b64958315949279ba181c2114abbd')
4360
}
44-
}
61+
}

0 commit comments

Comments
 (0)