Skip to content

Commit a23b0dd

Browse files
authored
Merge branch 'DefiLlama:main' into main
2 parents dac012d + 6aae3fc commit a23b0dd

File tree

132 files changed

+1610
-1113
lines changed

Some content is hidden

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

132 files changed

+1610
-1113
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.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"tvl": "cd utils;npm i; cd ..; node utils/testInteractive",
1414
"treasury": "cd utils;npm i; cd ..; node utils/testInteractive treasury",
1515
"entities": "cd utils;npm i; cd ..; node utils/testInteractive entities",
16+
"useTokenLabels": "node utils/scripts/useTokenLabels.js",
1617
"postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' "
1718
},
1819
"author": "",

projects/1155Tech/index.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
const TOKEN_CONTRACT_NOTE = '0x4e71A2E537B7f9D9413D3991D37958c0b5e1e503';
1+
const ADDRESSES = require('../helper/coreAssets.json');
2+
const { sumTokensExport } = require('../helper/unwrapLPs');
23
const MARKET_1155TECH_CONTRACT = '0x33b77fAf955Ed3eDAf939ae66C4D7a2D78bc30C6';
34

4-
async function tvl(_, _1, _2, { api }) {
5-
const balance = await api.call({
6-
abi: 'erc20:balanceOf',
7-
target: TOKEN_CONTRACT_NOTE,
8-
params: [MARKET_1155TECH_CONTRACT],
9-
});
10-
11-
api.add(TOKEN_CONTRACT_NOTE, balance)
12-
}
13-
145
module.exports = {
15-
timetravel: true,
16-
misrepresentedTokens: false,
17-
methodology: 'Value of all Keys across all art markets is TVL in the protocol',
18-
start: 7280880,
19-
canto: {
20-
tvl
21-
}
6+
methodology: 'Value of all Keys across all art markets is TVL in the protocol',
7+
start: 7280880,
8+
canto: {
9+
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: [ADDRESSES.canto.NOTE] })
10+
}
2211
};

projects/FlashLiquidity/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
polygon_zkevm: { tvl, },
1010
avax: { tvl, },
1111
base: { tvl, },
12+
arbitrum: { tvl, },
1213
methodology:
1314
"TVL comes from the DEX liquidity pools"
1415
};

projects/Omnidrome/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const { uniTvlExport } = require('../helper/calculateUniTvl.js')
2+
3+
module.exports = {
4+
misrepresentedTokens: true,
5+
zeta: {
6+
tvl: uniTvlExport("0x769d1BcB5FDf30F5a9D19f1ab8A3cF8b60a6e855", undefined, undefined, {
7+
allPairsLength: 'uint256:allPoolsLength',
8+
allPairs: 'function allPools(uint256) view returns (address)',
9+
}, { fetchBalances: true, useDefaultCoreAssets: true, hasStablePools: true, }),
10+
},
11+
}

projects/SwapMode/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { getUniTVL } = require("../helper/unknownTokens");
2+
module.exports = {
3+
misrepresentedTokens: true,
4+
mode: {
5+
tvl: getUniTVL({ factory: "0xfb926356BAf861c93C3557D7327Dbe8734A71891", useDefaultCoreAssets: true, }),
6+
},
7+
};

projects/aave/v3.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ function v3(chain) {
1010
params = ['0x9E7B73ffD9D2026F3ff4212c29E209E09C8A91F5', undefined, ['0x99411FC17Ad1B56f49719E3850B2CDcc0f9bBFd8']]
1111
else if (chain === 'base')
1212
params = ['0x2f6571d3Eb9a4e350C68C36bCD2afe39530078E2', undefined, ['0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac']]
13-
else if (chain === 'xdai')
13+
else if (chain === 'xdai')
1414
params = ['0x36616cf17557639614c1cdDb356b1B83fc0B2132', undefined, ['0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741']]
15+
else if (chain === 'scroll')
16+
params = ['0xFBedc64AeE24921cb43004312B9eF367a4162b57', undefined, ['0xa99F4E69acF23C6838DE90dD1B5c02EA928A53ee']]
17+
else if (chain === 'bsc')
18+
params = ['0x117684358D990E42Eb1649E7e8C4691951dc1E71', undefined, ['0x41585C50524fb8c3899B43D7D797d9486AAc94DB']]
1519
const section = borrowed => aaveChainTvl(chain, ...params, borrowed, true);
1620
return {
1721
tvl: section(false),
@@ -22,7 +26,7 @@ function v3(chain) {
2226
module.exports = {
2327
methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`,
2428
avax: v3("avax"),
25-
...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base", "xdai"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}),
29+
...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base", "xdai", "scroll", "bsc"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}),
2630
hallmarks: [
2731
[1659630089, "Start OP Rewards"],
2832
[1650471689, "Start AVAX Rewards"]

projects/acala-euphrates/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
const ADDRESSES = require('../helper/coreAssets.json')
12
const euphrates = '0x7Fe92EC600F15cD25253b421bc151c51b0276b7D';
2-
const ldotAddr = '0x0000000000000000000100000000000000000003';
3+
const ldotAddr = ADDRESSES.acala.LDOT;
34
const wtdotAddr = '0xe1bD4306A178f86a9214c39ABCD53D021bEDb0f9';
45

56
async function tvl(timestamp) {

projects/ambit-finance/index.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
const ADDRESSES = require('../helper/coreAssets.json');
2+
const { sumTokens2 } = require('../helper/unwrapLPs');
3+
4+
const REGISTRY = "0x5b1eFC3057E941439C487E67761F348D19Dd4100";
5+
6+
const REGISTRY_KEYS = {
7+
"ambit.asset.storage":
8+
"0x7267fae8044d9c0f406ec1d6bfdfdb3a4afea229fceedb3c88cc26df2ac97809",
9+
"ambit.depositorVault":
10+
"0x970bffd07196f826592058a2977d8df91d0b38816ca31aaaa6a628eda0328dbe",
11+
"ambit.depositorVault.token":
12+
"0x8e9a5206de4051330868a4fdef94140eaddce6206903c36de600007efb237b8d",
13+
"ambit.market":
14+
"0xcc0fa1d8c6527b2fc2cd5cbed9e80e1843330af5cd1d34a45c3f125a60dc07aa",
15+
};
16+
17+
const ABI = {
18+
IAddressRegistry: {
19+
getAddresses:
20+
"function getAddresses(bytes32[] calldata keys) view returns (address[] memory)",
21+
},
22+
IAssetStorage: {
23+
getAssets:
24+
"function getAssets() view returns ((address,address,address,address,uint16,uint16,uint256,(address,uint16))[])",
25+
},
26+
ICustodian: {
27+
getTotalAssets: "function getTotalAssets() view returns (uint256)",
28+
},
29+
IDepositorVault: {
30+
getTotalAssets: "function getTotalAssets() view returns (uint256)",
31+
getLiabilities:
32+
"function getLiabilities(address account) view returns (uint256)",
33+
},
34+
};
35+
36+
const AUSD = "0xf328ed974e586b6eea7997a87ea2ab1de149b186";
37+
38+
async function tvl(_, _1, _2, { api }) {
39+
const tokensAndOwners = []
40+
const [storage, depositorVault] = await api.call({
41+
abi: ABI["IAddressRegistry"]["getAddresses"],
42+
target: REGISTRY,
43+
params: [
44+
[
45+
REGISTRY_KEYS["ambit.asset.storage"],
46+
REGISTRY_KEYS["ambit.depositorVault"],
47+
],
48+
],
49+
});
50+
tokensAndOwners.push([ADDRESSES.bsc.USDT, depositorVault]);
51+
// supply side
52+
const assets = await api.call({ abi: ABI["IAssetStorage"]["getAssets"], target: storage, });
53+
assets.forEach(i => tokensAndOwners.push([i[0], i[1]]))
54+
return sumTokens2({ api, tokensAndOwners, blacklistedTokens: [AUSD] });
55+
}
56+
57+
async function borrowed(_, _1, _2, { api }) {
58+
const [depositorVault, market] = await api.call({
59+
abi: ABI["IAddressRegistry"]["getAddresses"],
60+
target: REGISTRY,
61+
params: [
62+
[REGISTRY_KEYS["ambit.depositorVault"], REGISTRY_KEYS["ambit.market"]],
63+
],
64+
});
65+
66+
const liabilities = await api.call({ abi: ABI["IDepositorVault"]["getLiabilities"], target: depositorVault, params: market });
67+
api.add(ADDRESSES.bsc.USDT, liabilities);
68+
return api.getBalances()
69+
}
70+
71+
module.exports = {
72+
bsc: {
73+
tvl,
74+
borrowed,
75+
},
76+
methodology: "Gets the TVL for the protocol",
77+
};

projects/anzen/index.js

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
1-
const tokens = [
2-
'0xEf5AAcB3c38a5Be7785a361008e27fb0328a62B5', // secured private credit token
3-
// '0xE16f2eC94E8a0819EB93022c45E05D582f4E5c15', // private credit token
4-
];
1+
const ADDRESSES = require('../helper/coreAssets.json')
2+
3+
// Anzen Secured Private Credit Token
4+
// minted by depositing USDC
5+
const SPCT = '0xEf5AAcB3c38a5Be7785a361008e27fb0328a62B5';
56

67
async function tvl(_, _1, _2, { api }) {
7-
const uTokens = await api.multiCall({ abi: 'address:usdc', calls: tokens })
8-
return api.sumTokens({ tokensAndOwners2: [uTokens, tokens,] })
8+
const uTokens = await api.multiCall({ abi: 'address:usdc', calls: [SPCT] })
9+
const bals = (await api.multiCall({ abi: 'uint256:totalPooledUSD', calls: [SPCT] })).map(i => i / 1e12)
10+
11+
api.add(uTokens, bals)
12+
return api.getBalances()
913
}
14+
1015
async function borrowed(_, _1, _2, { api }) {
11-
const uTokens = await api.multiCall({ abi: 'address:usdc', calls: tokens })
12-
const bals = (await api.multiCall({ abi: 'uint256:totalPooledUSD', calls: tokens })).map(i => i / 1e12)
13-
const inContracts = (await api.multiCall({ abi: 'address:reserveUSD', calls: tokens })).map(i => i * -1)
14-
api.add(uTokens, bals)
15-
api.add(uTokens, inContracts)
16+
// Borrowed amount in shares of pool
17+
const executedShares = await api.call({
18+
target: SPCT,
19+
abi: 'uint256:executedShares'
20+
});
21+
22+
// Borrowed amount in USD
23+
const pooledUSDByShares = await api.call({
24+
target: SPCT,
25+
abi: 'function getPooledUSDByShares(uint256 _sharesAmount) public view returns (uint256)',
26+
params: [executedShares]
27+
});
28+
29+
api.add(ADDRESSES.ethereum.USDC, pooledUSDByShares/1e12);
1630
return api.getBalances()
1731
}
1832

1933
module.exports = {
20-
methodology: "Sums the locked collateral amounts and depositor token balances.",
34+
methodology: "Sums the total USDC value deposited to mint SPCT.",
35+
misrepresentedTokens: true,
2136
ethereum: {
22-
tvl, borrowed,
37+
tvl,
38+
borrowed,
2339
},
2440
};

0 commit comments

Comments
 (0)