Skip to content

Commit 7bf9a91

Browse files
committed
fix broken adapters
1 parent a1d1cee commit 7bf9a91

File tree

6 files changed

+41
-60
lines changed

6 files changed

+41
-60
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/ambient-finance/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const vault = {
1212
const subgraphs = {
1313
scroll: 'https://ambindexer.net/scroll-gcgo/pool_list?chainId=0x82750',
1414
blast: 'https://ambindexer.net/blast-gcgo/pool_list?chainId=0x13e31',
15-
canto: "https://canto-subgraph.plexnode.wtf/subgraphs/name/ambient-graph",
15+
canto: "https://ambient-graphcache.fly.dev/gcgo/pool_list?chainId=0x1e14",
1616
ethereum: `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet`
1717
}
1818

projects/elektrik/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const query = `{
1010
}`
1111

1212
async function tvl(_, _b, _cb, { api, }) {
13-
const { pools } = await cachedGraphQuery('elektrik', 'https://subgraph.elektrik.network/subgraphs/name/ELEKTRIK-GRAPH', query)
13+
const { pools } = await cachedGraphQuery('elektrik-1', 'https://subgraph.elektrik.network/subgraphs/name/ELEKTRIK-GRAPH', query)
1414
const ownerTokens = pools.map(i => [[i.token0.id, i.token1.id], i.id])
1515
return sumTokens2({ api, ownerTokens, })
1616
}

projects/helper/chain/cosmos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const endPoints = {
2525
stargaze: "https://rest.stargaze-apis.com",
2626
quicksilver: "https://rest.cosmos.directory/quicksilver",
2727
persistence: "https://rest.cosmos.directory/persistence",
28-
secret: "https://lcd.secret.express",
28+
secret: "https://rpc.ankr.com/http/scrt_cosmos",
2929
// chihuahua: "https://api.chihuahua.wtf",
3030
injective: "https://sentry.lcd.injective.network:443",
3131
migaloo: "https://migaloo-api.polkachu.com",

projects/helper/env.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const DEFAULTS = {
2323
MERLIN_RPC: "https://rpc.merlinchain.io",
2424
MERLIN_RPC_MULTICALL: '0x830E7E548F4D80947a40A7Cf3a2a53166a0C3980',
2525
BITROCK_RPC_MULTICALL: '0x40DD0342A46Ab0893251211F6626E82c09A75345',
26+
RONIN_RPC: 'https://api.roninchain.com/rpc',
27+
ETHF_RPC: 'https://rpc.dischain.xyz/',
2628
}
2729

2830
const ENV_KEYS = [

projects/orbitbridge/index.js

Lines changed: 33 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const ADDRESSES = require('../helper/coreAssets.json')
2-
const sdk = require('@defillama/sdk')
32
const { getConfig } = require('../helper/cache')
43
const { sumTokensExport } = require('../helper/sumTokens')
54
const { sumTokens2 } = require('../helper/unwrapLPs')
@@ -40,72 +39,52 @@ const farms = {
4039

4140
let tokenData
4241

43-
function chainTvls(chain) {
44-
return async (timestamp, ethBlock, {[chain]: block}) => {
45-
const vault = vaults[chain]
46-
let targetChain = chain
47-
if (chain === 'ethereum') targetChain = 'eth'
48-
if (chain === 'polygon') targetChain = 'matic'
42+
async function tvl(timestamp, ethBlock, _1, { api }) {
43+
const chain = api.chain
4944

50-
const tokenListURL = 'https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList'
51-
tokenData = tokenData || getConfig('orbit-bridge', tokenListURL)
52-
const data = await tokenData
45+
if (chain === 'meta') return {} // rpc issues with meta
5346

54-
let tokenList = data.origins.filter(x => x.chain === targetChain && !x.is_nft).map(x => x.address)
55-
tokenList.push(nullAddress)
56-
const balances = await sumTokens2({ owner: vault, tokens: tokenList, chain, block, blacklistedTokens: [
47+
const vault = vaults[chain]
48+
let targetChain = chain
49+
if (chain === 'ethereum') targetChain = 'eth'
50+
if (chain === 'polygon') targetChain = 'matic'
51+
52+
const tokenListURL = 'https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList'
53+
tokenData = tokenData || getConfig('orbit-bridge', tokenListURL)
54+
const data = await tokenData
55+
56+
let tokenList = data.origins.filter(x => x.chain === targetChain && !x.is_nft).map(x => x.address)
57+
tokenList.push(nullAddress)
58+
await sumTokens2({
59+
api,
60+
owner: vault, tokens: tokenList, blacklistedTokens: [
5761
'0x662b67d00a13faf93254714dd601f5ed49ef2f51' // ORC, blacklist project's own token
5862
// reason for skipping, most of the tvl comes from this transaction which is about 25% of ORU supply on ETH
5963
// https://etherscan.io/tx/0x0a556fcef2a867421ec3941251ad3c10ae1402a23ddd9ad4b1097b686ced89f7
60-
] })
64+
]
65+
})
6166

62-
if (farms[chain]) {
63-
const calls = farms[chain].map(i => ({ params: i }))
64-
const { output: farmData } = await sdk.api.abi.multiCall({
65-
target: vault,
66-
abi: ABI.farms,
67-
calls, chain, block,
68-
})
69-
const { output: farmBalance } = await sdk.api.abi.multiCall({
70-
abi: ABI.wantLockedTotal,
71-
calls: farmData.map(i => ({ target: i.output})),
72-
chain, block,
73-
})
74-
farmBalance.forEach((data, i) => sdk.util.sumSingleBalance(balances, chain + ':' + farms[chain][i], data.output))
75-
}
76-
return balances
67+
if (farms[chain]) {
68+
const calls = farms[chain]
69+
const farmData = await api.multiCall({ target: vault, abi: ABI.farms, calls, })
70+
const farmBalance = await api.multiCall({ abi: ABI.wantLockedTotal, calls: farmData, })
71+
api.add(farms[chain], farmBalance)
7772
}
7873
}
7974

8075
module.exports = {
8176
methodology: 'Tokens locked in Orbit Bridge contract are counted as TVL',
8277
timetravel: false,
83-
bsc: {
84-
tvl: chainTvls('bsc')
85-
},
86-
celo: {
87-
tvl: chainTvls('celo')
88-
},
89-
heco: {
90-
tvl: chainTvls('heco')
91-
},
92-
ethereum: {
93-
tvl: chainTvls('ethereum')
94-
},
95-
klaytn: {
96-
tvl: chainTvls('klaytn')
97-
},
98-
polygon: {
99-
tvl: chainTvls('polygon')
100-
},
101-
meta: {
102-
tvl: chainTvls('meta')
103-
},
104-
wemix: {
105-
tvl: chainTvls('wemix')
106-
},
78+
bsc: { tvl },
79+
celo: { tvl },
80+
heco: { tvl },
81+
ethereum: { tvl },
82+
klaytn: { tvl },
83+
polygon: { tvl },
84+
meta: { tvl },
85+
wemix: { tvl },
10786
ripple: {
108-
tvl: sumTokensExport({ chain: 'ripple', owner: 'rLcxBUrZESqHnruY4fX7GQthRjDCDSAWia'})
87+
tvl: sumTokensExport({ chain: 'ripple', owner: 'rLcxBUrZESqHnruY4fX7GQthRjDCDSAWia' })
10988
},
11089
ton: {
11190
tvl: tonExport({ owner: "EQAtkbV8ysI75e7faO8Ihu0mFtmsg-osj7gmrTg_mljVRccy", tokens: [ADDRESSES.null], onlyWhitelistedTokens: true }),

0 commit comments

Comments
 (0)