Skip to content

Commit ddc617e

Browse files
authored
Merge branch 'DefiLlama:main' into main
2 parents 2047f36 + d19ea70 commit ddc617e

File tree

80 files changed

+2577
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2577
-371
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/Equalizer/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ module.exports = {
77
tvl: uniTvlExport("0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
88
staking: staking("0x8313f3551C4D3984FfbaDFb42f780D0c8763Ce94", "0x3Fd3A0c85B70754eFc07aC9Ac0cbBDCe664865A6"),
99
},
10+
sonic: {
11+
tvl: uniTvlExport("0xDDD9845Ba0D8f38d3045f804f67A1a8B9A528FcC", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, stablePoolSymbol: 's-'}),
12+
}
1013
}

projects/ZTLN/index.js

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,31 @@ query MyQuery {
1313
}
1414
`;
1515

16-
async function getTvl() {
17-
try {
18-
const data = await request(endpoint, query);
19-
20-
const securities = data.securities || [];
21-
22-
let tokens = 0;
23-
const currencyDecimal = 10 ** 18;
24-
25-
securities.forEach(security => {
26-
security.secondaryInvestors.forEach(investor => {
27-
const amt = parseFloat(investor.amount);
28-
tokens += amt / currencyDecimal;
29-
});
30-
});
16+
async function tvl(api) {
17+
const data = await request(endpoint, query);
3118

32-
const price = 100.5;
33-
const tvl = tokens * price;
19+
const securities = data.securities || [];
3420

35-
// console.log("tvl", tvl);
36-
return tvl;
37-
} catch (error) {
38-
console.error("Error fetching TVL:", error);
39-
return 0;
40-
}
21+
let tokens = 0;
22+
const currencyDecimal = 10 ** 18;
23+
24+
securities.forEach(security => {
25+
security.secondaryInvestors.forEach(investor => {
26+
const amt = parseFloat(investor.amount);
27+
tokens += amt / currencyDecimal;
28+
});
29+
});
30+
31+
const price = 100.5;
32+
const tvl = tokens * price
33+
api.addUSDValue(tvl);
4134
}
4235

4336
module.exports = {
4437
timetravel: false,
38+
misrepresentedTokens: true,
4539
methodology: "The value in RWA held by the protocol",
4640
ethereum: {
47-
fetch: getTvl
41+
tvl
4842
},
49-
fetch: getTvl
5043
};

projects/alexar/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const { getConfig } = require('../helper/cache')
22
const { sumTokens } = require('../helper/sumTokens')
33

4-
const blacklistedAssets = ['uaxl'];
5-
64
const chainMapping = {
75
avax: 'avalanche',
86
cosmos: 'cosmoshub',
@@ -11,9 +9,12 @@ const chainMapping = {
119
};
1210

1311
const blackListChains = ['comdex', 'crescent'];
14-
const chainListSupply = ['juno', 'cosmos', 'carbon', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2'];
12+
const chainListSupply = ['juno', 'cosmos', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2'];
1513
const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum', 'base'];
1614

15+
const blacklistedTokensChain = {
16+
ethereum: ['0x946fb08103b400d1c79e07acCCDEf5cfd26cd374'], // KIP tvl is higher than the circulating supply
17+
}
1718

1819
chainListSupply.concat(chainListTotal).forEach(chain => {
1920
if (blackListChains.includes(chain)) {
@@ -25,6 +26,7 @@ chainListSupply.concat(chainListTotal).forEach(chain => {
2526
const config = await getConfig('alexar', 'https://api.axelarscan.io/api/getTVL')
2627
const tokensAndOwners = []
2728
const owners = []
29+
const blacklistedTokens = blacklistedTokensChain[chain] || []
2830
const mappedChain = chainMapping[chain] || chain;
2931
config.data.forEach(({ tvl: { [mappedChain]: assetTvl } = {} }) => {
3032
if (!assetTvl) return;
@@ -42,8 +44,8 @@ chainListSupply.concat(chainListTotal).forEach(chain => {
4244
}
4345
})
4446
if (tokensAndOwners.length > 0)
45-
return api.sumTokens({ tokensAndOwners })
46-
return sumTokens({ chain, owners })
47+
return api.sumTokens({ tokensAndOwners, blacklistedTokens })
48+
return sumTokens({ chain, owners, blacklistedTokens, })
4749
}
4850
});
4951

projects/apwine/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module.exports = {
108108
doublecounted: true,
109109
ethereum: {
110110
tvl: tvl_from_registry('ethereum'),
111-
staking: staking(veAPW, APW),
111+
//staking: staking(veAPW, APW),
112112
},
113113
polygon: {
114114
tvl: tvl_from_registry('polygon'),

projects/blacksail/index.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const { get } = require('../helper/http')
2+
const { sumUnknownTokens } = require('../helper/unknownTokens')
3+
4+
async function fetcher() {
5+
const response = await get('https://api.blacksail.finance/stats');
6+
return response;
7+
}
8+
9+
const strats = [
10+
"0x11d58E28048132957FA344Be0Ae3FaE56bA185d2", "0x197329445441dFa5B725eA654A6f910f7669e83f", "0x14E19a5d30E75e252F02f6cFD3985b1b5c64D298", "0x33f02985658B7E2763859154B92A97d90F8Ec7ad", "0xAc57B713C630f188bc2d95c2ae3C27A1DE1DebA1", "0xDBa26763C6DbA30891453897Ef0b85C3Ab126Bb7", "0x6506920CF039087792BE09066712F4dC2186C749", "0xba5eC23096D5579b2052aA77317167E2d905D84E", "0xBdfF1fFbBdA067416c10719804EAC95A49B84EE4", "0xb896e66473915157534C77e06925d88E5b42C057", "0xe15825c6a9e26F47b436b9c3bd76b79daDfd7075", "0x613662ED769c0313cF228d76Fb3863456B6D0C5a", "0x88BF4D8efF256eEaE1Ccc7D5A93f23d88EC178f4", "0x2D5016734838FDf467016c9EF649327FD4110c71", "0x79f28bebd165D2B884f90e60b1946154A58752f1", "0xF5F2A9Ae7673dc28A327684b023A89248F8E8318", "0x0149Ed6072b343E587718f5B82dE7F665E44E403", "0x32259E464d130479eE4cB2c3F375d21A401Ab129", "0x3bBf53067B7C596De32092C789C051f5284c50bD", "0xc48077cDdbD8AC80aC1E7e22D510480ba700cbd1", "0x14A8B80078b818E62A53B39781C357610EC3C16F", "0xC84FcDF81b86D817A28d046eA89752030f6c1c4d", "0x491612ACe7d4ccd255fC5D08710ABF1b666a77DF", "0x4D6C1b29FD117790b8dA064d259821154fe99a42", "0x41b3407e368F96f58645543Bce307493631e303B", "0x30f10efC192BC2095f9085199F3916Cd043b2d44", "0xba6b2bb02854E174Ab9B995261B447154EAbd10a", "0x9Fb4B224Ab74DeB01899C4CdBC037419e2700aCF", "0x96c2BCed606bdddb1f1f0BAfe6a5dc8d746F8484", "0x1175D5fF8fA3cC545eAEb9697eB20237873281B3", "0x4d8C24Ab68B5C32c38BC39ab841B6cCE454C03aD", "0x4f796426B6d8cD98cE814837e03eCa4e8D66Dff3", "0x174A963186BB90852461D189035eB923f6fCc838", "0xAC76a4714f08F04F32DF75D647979f2660239078", "0x978526df622cE9b02b5A32f4D76C73d066b72FEb", "0x33B1C16403fF2BFbA0508e15eAEA58BDA1eDc48C", "0xe8F694512973eBE7D6FDA181872e6Ffb1B7eaB5c"
11+
]
12+
13+
async function tvl(api) {
14+
const bals = await api.multiCall({ abi: 'uint256:balanceOf', calls: strats })
15+
const tokens = await api.multiCall({ abi: 'address:staking_token', calls: strats })
16+
const symbols = await api.multiCall({ abi: 'string:symbol', calls: tokens })
17+
const ichiVaults = []
18+
const ichiBals = []
19+
tokens.forEach((token, i) => {
20+
if (symbols[i] === 'ICHI_Vault_LP') {
21+
ichiVaults.push(token)
22+
ichiBals.push(bals[i])
23+
} else
24+
api.add(token, bals[i])
25+
})
26+
27+
// resolve ichi vaults
28+
const iSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: ichiVaults })
29+
const iToken0s = await api.multiCall({ abi: 'address:token0', calls: ichiVaults })
30+
const iToken1s = await api.multiCall({ abi: 'address:token1', calls: ichiVaults })
31+
const iTokenBals = await api.multiCall({ abi: 'function getTotalAmounts() view returns (uint256 bal1, uint256 bal2)', calls: ichiVaults })
32+
33+
iSupplies.map((_, i) => {
34+
const token0 = iToken0s[i]
35+
const token1 = iToken1s[i]
36+
const ratio = ichiBals[i] / iSupplies[i]
37+
api.add(token0, iTokenBals[i].bal1 * ratio)
38+
api.add(token1, iTokenBals[i].bal2 * ratio)
39+
})
40+
41+
return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: tokens.filter((_, i) => symbols[i].startsWith('v-')), resolveLP: true, allLps: true, })
42+
}
43+
44+
module.exports = {
45+
sonic: {
46+
tvl,
47+
}
48+
}

projects/credbull/index.js

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,46 @@
11
const { getConfig } = require('../helper/cache');
22

3-
const STAKING_VAULT_CONTRACT = "0xe4a4d891f02DF7bFFc5ff9e691313DE8a9E76b91";
4-
const CBL_TOKEN = "0xD6b3d81868770083307840F513A3491960b95cb6";
3+
const cblConfigArbitrum = {
4+
cbl: "0xD6b3d81868770083307840F513A3491960b95cb6",
5+
cblStakingV2: "0xc0C1DaA773570C041c47cE12c397AdDFD6B7403F",
6+
};
7+
8+
const fundConfigPolygon = {
9+
liquidStoneFund: "0x2eda17eb596858566be933b26fae6fa4ee8ccd6d",
10+
fundNavCalculator: "0xcdf038dd3b66506d2e5378aee185b2f0084b7a33",
11+
};
512

13+
// Credbull DeFi Vaults v1 TVL (6 or 12 month fixed APY)
614
async function tvl(api) {
715
let vaults = await getConfig('credbull', "https://incredbull.io/api/vaults")
816
vaults = vaults[api.chain]
917
const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults })
18+
1019
return api.sumTokens({ tokensAndOwners2: [tokens, vaults] })
1120
}
1221

22+
// Credbull Fund, including LiquidStone
23+
async function borrowedFund(api) {
24+
const fundNavResults = await api.multiCall({
25+
abi: 'function calcNav(address _vaultProxy) external returns (address denominationAsset, uint256 nav)',
26+
calls: [fundConfigPolygon.liquidStoneFund],
27+
target: fundConfigPolygon.fundNavCalculator,
28+
excludeFailed: true,
29+
})
30+
const vaultBalance = await api.call({ abi: 'erc20:balanceOf', target: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', params: fundConfigPolygon.liquidStoneFund })
31+
api.add('0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', vaultBalance * -1)
32+
33+
fundNavResults.forEach((i) => {
34+
api.add(i.denominationAsset, i.nav)
35+
});
36+
api.getBalancesV2().removeNegativeBalances()
37+
}
38+
39+
async function polygonTvl(api) {
40+
const vaultBalance = await api.call({ abi: 'erc20:balanceOf', target: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', params: fundConfigPolygon.liquidStoneFund })
41+
api.add('0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', vaultBalance)
42+
}
43+
1344
async function borrowed(api) {
1445
let vaults = await getConfig('credbull', "https://incredbull.io/api/vaults")
1546
vaults = vaults[api.chain]
@@ -21,12 +52,13 @@ async function borrowed(api) {
2152
}
2253

2354
async function stakedCbl(api) {
24-
const bals = await api.multiCall({ abi: 'address:totalAssets', calls: [STAKING_VAULT_CONTRACT,] })
25-
api.add(CBL_TOKEN, bals)
55+
const bals = await api.multiCall({ abi: 'address:totalAssets', calls: [cblConfigArbitrum.cblStakingV2,] })
56+
api.add(cblConfigArbitrum.cbl, bals)
2657
}
2758

2859
module.exports = {
2960
methodology: 'TVL consist of the sum of every deposit of all vaults for a given asset.',
30-
btr: { tvl, borrowed, },
3161
arbitrum: { tvl, borrowed, staking: stakedCbl },
62+
btr: { tvl, borrowed, },
63+
polygon: { borrowed: borrowedFund, tvl: polygonTvl },
3264
};

projects/cronos-zk/index.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
1-
const { sumTokens2 } = require("../helper/unwrapLPs");
2-
3-
const target = "0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB"
4-
const gasQuery = '0x0000000000000000000000000000000000000001'
5-
const gasAddress = '0x0000000000000000000000000000000000000000'
6-
const chainId = 388
1+
const getTvl = require("../txBridge/util")
72

83
module.exports = {
94
ethereum: {
10-
tvl: async (api) => {
11-
const totalBalances = await sumTokens2({
12-
api,
13-
owner: target,
14-
fetchCoValentTokens: true,
15-
})
16-
const balances = await api.multiCall({
17-
calls: [gasQuery, ...Object.keys(totalBalances)].map(token => ({
18-
target, params: [chainId, token.substring(token.indexOf(':') + 1)]
19-
})),
20-
abi: { "inputs": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "l1Token", "type": "address" }], "name": "chainBalance", "outputs": [{ "internalType": "uint256", "name": "balance", "type": "uint256" }], "stateMutability": "view", "type": "function" },
21-
permitFailure: true,
22-
withMetadata: true
23-
})
24-
api._balances._balances = {}
25-
balances.map(call => {
26-
const token = call.input.params[1]
27-
api.add(token == gasQuery ? gasAddress : token, call.output)
28-
})
29-
}
5+
tvl: async (api) => getTvl(api, { chainId: 388, }),
306
},
31-
};
7+
}

projects/curve/contracts.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,12 @@
214214
"CurveStableswapFactoryNG": "0xd7E72f3615aa65b92A4DBdC211E296a35512988B",
215215
"CurveTwocryptoFactoryNG": "0x5Ea9DD3b6f042A34Df818C6c1324BC5A7c61427a",
216216
"CurveTricryptoFactoryNG": "0x7Ca46A636b02D4aBC66883D7FF164bDE506DC66a"
217+
},
218+
"sonic": {
219+
"gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
220+
"wrapped": "0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38",
221+
"CurveStableswapFactoryNG": "0x7C2085419BE6a04f4ad88ea91bC9F5C6E6C463D8",
222+
"CurveTwocryptoFactoryNG": "0x1A83348F9cCFD3Fe1A8C0adBa580Ac4e267Fe495",
223+
"CurveTricryptoFactoryNG": "0x635742dCC8313DCf8c904206037d962c042EAfBd"
217224
}
218225
}

projects/curve/index.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ const contracts = require("./contracts.json");
1111
const { getLogs } = require('../helper/cache/getLogs')
1212

1313
const chains = [
14-
"ethereum", //-200M
15-
"polygon", //-40M
16-
"arbitrum", //G
17-
"aurora", //G
18-
"avax", //-30M
19-
"fantom", //-80M
20-
"optimism", //-6M
21-
"xdai", //G
14+
"ethereum",
15+
"polygon",
16+
"arbitrum",
17+
"aurora",
18+
"avax",
19+
"fantom",
20+
"optimism",
21+
"xdai",
2222
"moonbeam",
2323
"celo",
2424
"kava",
@@ -29,7 +29,8 @@ const chains = [
2929
"mantle",
3030
"taiko",
3131
"corn",
32-
]; // Object.keys(contracts);
32+
"sonic",
33+
];
3334
const registryIds = {
3435
stableswap: 0,
3536
stableFactory: 3,
@@ -94,7 +95,7 @@ async function getPools(block, chain) {
9495
let { registriesMapping, addressProvider } = contracts[chain]
9596
if (!registriesMapping) {
9697
registriesMapping = {};
97-
if(addressProvider){
98+
if (addressProvider) {
9899
(await sdk.api.abi.multiCall({
99100
block, chain,
100101
calls: Object.values(registryIds).map(r => ({ params: r })),
@@ -259,18 +260,20 @@ module.exports = chainTypeExports(chains);
259260
module.exports.ethereum["staking"] = staking(
260261
contracts.ethereum.veCRV,
261262
contracts.ethereum.CRV
262-
);
263+
);
263264

264265
module.exports.harmony = {
265266
tvl: async (api) => {
266267
if (api.timestamp > 1655989200) {
267268
// harmony hack
268269
return {};
269270
}
270-
return api.sumTokens({ owner: '0xC5cfaDA84E902aD92DD40194f0883ad49639b023', tokens: [
271-
"0xef977d2f931c1978db5f6747666fa1eacb0d0339",
272-
"0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f"
273-
]})
271+
return api.sumTokens({
272+
owner: '0xC5cfaDA84E902aD92DD40194f0883ad49639b023', tokens: [
273+
"0xef977d2f931c1978db5f6747666fa1eacb0d0339",
274+
"0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f"
275+
]
276+
})
274277
}
275278
};
276279

0 commit comments

Comments
 (0)