Skip to content

Commit 88b7b35

Browse files
g1nt0kikhiemsoft
andauthored
update baryon (DefiLlama#9842)
* Submit Baryon Tomo Contract * Submit Pool Stake Baryon * remove comma * feat: submit add more chain to baryon * feat: add new chain * code refactor --------- Co-authored-by: khiêm <[email protected]>
1 parent b415c05 commit 88b7b35

File tree

3 files changed

+23
-30
lines changed

3 files changed

+23
-30
lines changed

projects/baryon/index.js

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
const utils = require('../helper/utils');
2-
const { stakings, staking } = require('../helper/staking');
1+
const { stakings } = require('../helper/staking');
32
const { getUniTVL } = require('../helper/unknownTokens')
43
const { getConfig } = require('../helper/cache')
54

@@ -9,33 +8,22 @@ async function fetchData(chain) {
98
return data[chain]
109
}
1110

12-
async function stakingTomo(...args) {
13-
const lpTokenTomo = await fetchData('tomo')
14-
15-
return stakings(lpTokenTomo.stakeContract, lpTokenTomo.lpToken)(...args)
11+
const config = {
12+
bitkub: { factory: '0xf7eEe3A8363731C611A24CdDfCBcaDE9C153Cfe8', key: 'bitkub' },
13+
ancient8: { factory: '0xAE12C5930881c53715B369ceC7606B70d8EB229f', key: 'ancient8Mainnet' },
14+
tomochain: { factory: '0xFe48A2E66EE2f90334d3565E56E0c9d0081447e8', key: 'tomo' },
15+
bsc: { factory: '0x03879e2a3944fd601e7638dfcbc9253fb793b599', key: 'binanceSmart' },
1616
}
1717

18-
async function stakingBsc(...args) {
19-
const lpTokenTomo = await fetchData('binanceSmart')
20-
21-
return stakings(lpTokenTomo.stakeContract, lpTokenTomo.lpToken)(...args)
22-
}
23-
24-
module.exports = {
25-
bsc: {
26-
misrepresentedTokens: true,
27-
staking: stakingBsc,
28-
tvl: getUniTVL({
29-
factory: '0x03879e2a3944fd601e7638dfcbc9253fb793b599',
30-
useDefaultCoreAssets: true,
31-
})
32-
},
33-
tomochain: {
34-
misrepresentedTokens: true,
35-
staking: stakingTomo,
36-
tvl: getUniTVL({
37-
factory: '0xFe48A2E66EE2f90334d3565E56E0c9d0081447e8',
38-
useDefaultCoreAssets: true,
39-
})
18+
Object.keys(config).forEach(chain => {
19+
const { factory, key } = config[chain]
20+
module.exports[chain] = {
21+
tvl: getUniTVL({ factory, useDefaultCoreAssets: true }),
22+
staking: async (...args) => {
23+
const { stakeContract, lpToken } = await fetchData(key)
24+
return stakings(stakeContract, lpToken)(...args)
25+
}
4026
}
41-
}
27+
})
28+
29+
module.exports.misrepresentedTokens = true

projects/helper/chains.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"aptos",
88
"arbitrum",
99
"arbitrum_nova",
10+
"ancient8",
1011
"archway",
1112
"area",
1213
"astar",
@@ -28,6 +29,7 @@
2829
"bitrock",
2930
"bittensor",
3031
"bittorrent",
32+
"bitkub",
3133
"blast",
3234
"boba",
3335
"boba_avax",

projects/helper/tokenMapping.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ const fixBalancesTokens = {
8989
"0xd97b1de3619ed2c6beb3860147e30ca8a7dc9891": { decimals: 18, coingeckoId: "ethereum" },
9090
"0x48f80608b672dc30dc7e3dbbd0343c5f02c738eb": { decimals: 18, coingeckoId: "binancecoin" },
9191
"0x13A0c5930C028511Dc02665E7285134B6d11A5f4": { decimals: 18, coingeckoId: "bitcoin" }
92-
}
92+
},
93+
ancient8: {
94+
'0x4200000000000000000000000000000000000006': { coingeckoId: "ethereum", decimals: 18, },
95+
},
9396
}
9497

9598
ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) })

0 commit comments

Comments
 (0)