Skip to content

Commit 6df48ee

Browse files
authored
Merge pull request DefiLlama#3638 from dezzyboy/main
add Jioswap
2 parents 30562cd + c863242 commit 6df48ee

File tree

4 files changed

+185
-7
lines changed

4 files changed

+185
-7
lines changed

projects/helper/chains.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"meter",
9191
"zilliqa",
9292
"godwoken",
93+
"godwoken_v1",
9394
"zksync",
9495
"zyx",
9596
"karura",

projects/helper/portedTokens.js

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,33 +1254,74 @@ function fixGodwokenBalances(balances) {
12541254
const mapping = {
12551255
"0xC3b946c53E2e62200515d284249f2a91d9DF7954": {
12561256
coingeckoId: "usd-coin",
1257-
decimals: 6
1257+
decimals: 6,
12581258
}, // Wrapped USDC (ForceBridge from Ethereum)
12591259
"0xA21B19d660917C1DE263Ad040Ba552737cfcEf50": {
12601260
coingeckoId: "usd-coin",
1261-
decimals: 18
1261+
decimals: 18,
12621262
}, // Wrapped USDC (ForceBridge from BSC)
12631263
"0x07a388453944bB54BE709AE505F14aEb5d5cbB2C": {
12641264
coingeckoId: "tether",
1265-
decimals: 6
1265+
decimals: 6,
12661266
}, // Wrapped USDT (ForceBridge from Ethereum)
12671267
"0x5C30d9396a97f2279737E63B2bf64CC823046591": {
12681268
coingeckoId: "tether",
1269-
decimals: 18
1269+
decimals: 18,
12701270
}, // Wrapped USDT (ForceBridge from BSC)
12711271
"0x7818FA4C71dC3b60049FB0b6066f18ff8c720f33": {
12721272
coingeckoId: "bitcoin",
1273-
decimals: 8
1273+
decimals: 8,
12741274
}, // Wrapped BTC (ForceBridge from Ethereum)
12751275
"0x3f8d2b24C6fa7b190f368C3701FfCb2bd919Af37": {
12761276
coingeckoId: "bitcoin",
1277-
decimals: 18
1278-
} // Wrapped BTC (ForceBridge from BSC)
1277+
decimals: 18,
1278+
}, // Wrapped BTC (ForceBridge from BSC)
12791279
};
12801280

12811281
return fixBalances(balances, mapping);
12821282
}
12831283

1284+
const godwokenV1FixMapping = {
1285+
1286+
"0x9E858A7aAEDf9FDB1026Ab1f77f627be2791e98A": {
1287+
coingeckoId: "ethereum",
1288+
decimals: 18,
1289+
}, // ETH (via Forcebridge from ETH)
1290+
1291+
"0xB66954619363145a05eF835547449EB9050d82f6": {
1292+
coingeckoId: "ethereum",
1293+
decimals: 18,
1294+
}, // WETH (Via Celer CBridge From ETH)
1295+
"0x186181e225dc1Ad85a4A94164232bD261e351C33": {
1296+
coingeckoId: "usd-coin",
1297+
decimals: 6,
1298+
}, // USDC (via Forcebridge from ETH
1299+
"0x53bB26dc8C5EFC6c95C37155aCa487d1D043436a": {
1300+
coingeckoId: "usd-coin",
1301+
decimals: 6,
1302+
}, // USDC (Via Celer CBridge From ETH)
1303+
"0x2c9Fc6087875646112f66a3C92fEF2d158FAa76e": {
1304+
coingeckoId: "dai",
1305+
decimals: 18,
1306+
}, // DAI (via Forcebridge from ETH)
1307+
"0x317F8d18FB16E49a958Becd0EA72f8E153d25654": {
1308+
coingeckoId: "dai",
1309+
decimals: 18,
1310+
}, // Dai (Via Celer CBridge From ETH)
1311+
"0x8E019acb11C7d17c26D334901fA2ac41C1f44d50": {
1312+
coingeckoId: "tether",
1313+
decimals: 6,
1314+
}, // USDT (via Forcebridge from ETH)
1315+
"0x3c790b38f466514ffCB4230e7B2334e52B64c942": {
1316+
coingeckoId: "tether",
1317+
decimals: 6,
1318+
}, // USDT (Via Celer CBridge From ETH)
1319+
"0xcD7bC9fC617a4F82eC1c8359D1C8610B90e3B44C": {
1320+
coingeckoId: "binance-usd",
1321+
decimals: 18,
1322+
}, // BUSD (Via Celer CBridge From BSC)
1323+
}
1324+
12841325
const wavesMapping = {
12851326
"5UYBPpq4WoU5n4MwpFkgJnW3Fq4B1u3ukpK33ik4QerR": {
12861327
coingeckoId: "binancecoin",
@@ -2010,6 +2051,7 @@ const fixBalancesMapping = {
20102051
harmony: fixHarmonyBalances,
20112052
hpb: fixHPBBalances,
20122053
godwoken: fixGodwokenBalances,
2054+
godwoken_v1: b => fixBalances(b, godwokenV1FixMapping, { removeUnmapped: false }),
20132055
klaytn: fixKlaytnBalances,
20142056
waves: fixWavesBalances,
20152057
songbird: b => fixBalances(b, songbirdFixMapping, { removeUnmapped: true }),

projects/jioswap/config.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"meter": {
3+
"jioMeterUSD": {
4+
"address": "0x559Ec9D7D0a80220C8167d6B413d8AA1B26f596D",
5+
"lpToken": "0x4CD99606b98230b039a82bE45165663f6A931A96",
6+
"poolTokens": [
7+
{
8+
"address": "0x24aa189dfaa76c671c279262f94434770f557c35",
9+
"name": "BUSD"
10+
},
11+
{
12+
"address": "0xD86e243FC0007e6226B07c9A50C9d70D78299EB5",
13+
"name": "USDC"
14+
},
15+
{
16+
"address": "0x5fa41671c48e3c951afc30816947126ccc8c162e",
17+
"name": "USDT"
18+
}
19+
]
20+
}
21+
},
22+
"godwoken_v1": {
23+
"jioETH": {
24+
"address": "0x0f25e206DAfE6F5bbCE2037b67497D5F017062cd",
25+
"lpToken": "0x3D57dF23702c761f28FEC15B358B4E2F543f343E",
26+
"poolTokens": [
27+
{
28+
"address": "0x9E858A7aAEDf9FDB1026Ab1f77f627be2791e98A",
29+
"name": "ETH (via Forcebridge from ETH)"
30+
},
31+
{
32+
"address": "0xB66954619363145a05eF835547449EB9050d82f6",
33+
"name": "WETH (Via Celer CBridge From ETH)"
34+
}
35+
]
36+
},
37+
"jio2USD": {
38+
"address": "0x55f676d9a014a83e58D6A9b73265709e071aAE88",
39+
"lpToken": "0xb3D6913CF2D6A8fD9b472ff7526ec11620957C8b",
40+
"poolTokens": [
41+
{
42+
"address": "0x186181e225dc1Ad85a4A94164232bD261e351C33",
43+
"name": "USDC (via Forcebridge from ETH"
44+
},
45+
{
46+
"address": "0x53bB26dc8C5EFC6c95C37155aCa487d1D043436a",
47+
"name": "USDC (Via Celer CBridge From ETH)"
48+
}
49+
]
50+
},
51+
"jio3fUSD": {
52+
"address": "0xCF60f11627f2fb412EDe8E674a97c893E8dD73d8",
53+
"lpToken": "0xbe6FB8874C6E5800092E7e85bDD8c165ADcD0592",
54+
"poolTokens": [
55+
{
56+
"address": "0x2c9Fc6087875646112f66a3C92fEF2d158FAa76e",
57+
"name": "DAI (via Forcebridge from ETH)"
58+
},
59+
{
60+
"address": "0x186181e225dc1Ad85a4A94164232bD261e351C33",
61+
"name": "USDC (via Forcebridge from ETH)"
62+
},
63+
{
64+
"address": "0x8E019acb11C7d17c26D334901fA2ac41C1f44d50",
65+
"name": "USDT (via Forcebridge from ETH)"
66+
}
67+
]
68+
},
69+
"jio4celUSD": {
70+
"address": "0x5abff8841a016631ecB90250D65F53996dda10b0",
71+
"lpToken": "0x83f3CfF88102F498b7170fbd237935152E6909c7",
72+
"poolTokens": [
73+
{
74+
"address": "0xcD7bC9fC617a4F82eC1c8359D1C8610B90e3B44C",
75+
"name": "BUSD (Via Celer CBridge From BSC)"
76+
},
77+
{
78+
"address": "0x317F8d18FB16E49a958Becd0EA72f8E153d25654",
79+
"name": "Dai (Via Celer CBridge From ETH)"
80+
},
81+
{
82+
"address": "0x53bB26dc8C5EFC6c95C37155aCa487d1D043436a",
83+
"name": "USDC (Via Celer CBridge From ETH)"
84+
},
85+
{
86+
"address": "0x3c790b38f466514ffCB4230e7B2334e52B64c942",
87+
"name": "USDT (Via Celer CBridge From ETH)"
88+
}
89+
]
90+
}
91+
}
92+
}

projects/jioswap/index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const { sumTokens2 } = require("../helper/unwrapLPs");
2+
const config = require("./config");
3+
const { getFixBalances } = require("../helper/portedTokens");
4+
const ethers = require("ethers")
5+
const { config: configRPC } = require('@defillama/sdk/build/api');
6+
7+
configRPC.setProvider("godwoken_v1", new ethers.providers.StaticJsonRpcProvider(
8+
"https://v1.mainnet.godwoken.io/rpc",
9+
{
10+
name: "godwoken_v1",
11+
chainId: 71402,
12+
}
13+
))
14+
15+
module.exports = {
16+
misrepresentedTokens: true,
17+
methodology:
18+
"Counts as TVL all the Assets deposited on each chain through different Pool Contracts",
19+
};
20+
21+
Object.keys(config).forEach((chain) => {
22+
module.exports[chain] = {
23+
tvl: async (_, _b, { [chain]: block }) => {
24+
const toa = [];
25+
const blacklistedTokens = [];
26+
Object.values(config[chain]).forEach(
27+
({ address, lpToken, poolTokens }) => {
28+
blacklistedTokens.push(lpToken);
29+
poolTokens.forEach((i) => toa.push([i.address, address]));
30+
}
31+
);
32+
const balances = await sumTokens2({
33+
tokensAndOwners: toa,
34+
chain,
35+
block,
36+
blacklistedTokens,
37+
});
38+
const fixBalances = await getFixBalances(chain);
39+
fixBalances(balances);
40+
return balances;
41+
},
42+
};
43+
});

0 commit comments

Comments
 (0)