Skip to content

Commit fe991b6

Browse files
authored
Merge branch 'DefiLlama:main' into main
2 parents e0a8919 + c643999 commit fe991b6

File tree

84 files changed

+9123
-334
lines changed

Some content is hidden

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

84 files changed

+9123
-334
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ BSC_RPC="..."
4141
POLYGON_RPC="..."
4242
```
4343

44-
The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://unpkg.com/@defillama/sdk@5.0.116/build/providers.json). If you run into issues with a chain make sure to update the sdk with `npm update @defillama/sdk`.
44+
The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://unpkg.com/@defillama/sdk@latest/build/providers.json). If you run into issues with a chain make sure to update the sdk with `npm update @defillama/sdk`.
4545

4646
## Adapter rules
4747
- Never add extra npm packages, if you need a chain-level package for your chain, ask us and we'll consider it, but we can't accept any npm package that is project-specific

package-lock.json

+9-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/Ringswap/index.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { masterchefExports } = require("../helper/unknownTokens");
2+
3+
module.exports = masterchefExports({
4+
chain: "sonic",
5+
masterchef: "0x51cbd201913dEC2C9714b340fDCf6530399bb89a",
6+
nativeTokens: ["0x4931CE8f4130a723cC6fF8A0B23B7F33550aB3a4"],
7+
useDefaultCoreAssets: true,
8+
poolInfoABI: "function poolInfo(uint256) view returns (address)",
9+
getToken: (i) => i,
10+
});

projects/SuperHedge/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const SH_VAULT_1_CURRENCY = '0x4c9EDD5852cd905f086C759E8383e09bff1E68B3'; // USDe Ethereum
1+
const ADDRESSES = require('../helper/coreAssets.json')
2+
const SH_VAULT_1_CURRENCY = ADDRESSES.ethereum.USDe; // USDe Ethereum
23
const SH_VAULT_1_PT = '0x8A47b431A7D947c6a3ED6E42d501803615a97EAa'; // Pendle pt token
34
const SH_VAULT_1 = '0xDF59153DA47dc7c39505261D423BAf14c48D23A6'; // SHProduct Vault
45

projects/Thick/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ module.exports = uniV3Export({
44
fantom: { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 70309749 },
55
arbitrum : { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 148243463 },
66
base : { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 6314325 },
7+
sonic: { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 444927 },
78
})

projects/agdex/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const ETH =
1616
ADDRESSES.aptos.zWETH;
1717

1818
const usdc_resource_account = "0xb27c95e40594d6f5765e0183ccca5ebcd0942f9c9a66578af1c743f5bd0d90e5";
19-
const usdc_metadata = "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b";
19+
const usdc_metadata = ADDRESSES.aptos.USDC_3;
2020

2121
const layerzero_usdc_resource_account = "0x19fb80bd79fa8f7538404af85196396973e3fbbda1503495598172c8813f7ca5";
2222
const layerzero_usdc_metadata = "0x2b3be0a97a73c87ff62cbdd36837a9fb5bbd1d7f06a73b7ed62ec15c5326c1b8";

projects/alphafi/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const ALPHAFI_CETUS_TVL_IDS = [
134134
parentPoolID: "0x7df346f8ef98ad20869ff6d2fc7c43c00403a524987509091b39ce61dde00957",
135135
investorID: "0x6285c57b0d86cbe585abfe5b23d74f96243f450381ef4d57604164e76a76f4c8",
136136
token0Type: ADDRESSES.sui.USDC_CIRCLE,
137-
token1Type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT"
137+
token1Type: ADDRESSES.sui.suiUSDT
138138
},
139139
]
140140

projects/arbius/index.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { stakings } = require("../helper/staking");
2+
3+
const stakingContracts = [
4+
"0x3A7e6915f997Cdbc8BFB090051AA22E37Dab345d", // votingEscrow
5+
];
6+
const stakingLpContracts = [
7+
"",
8+
];
9+
10+
const AIUS = "0x4a24B101728e07A52053c13FB4dB2BcF490CAbc3";
11+
const WETH_AIUS_UNIV2 = "";
12+
13+
14+
module.exports = {
15+
misrepresentedTokens: false,
16+
arbitrum: {
17+
staking: stakings(stakingContracts, AIUS),
18+
tvl: async() => ({}),
19+
},
20+
/* ethereum: {
21+
pool2: stakings(stakingLpContracts, [WETH_AIUS_UNIV2]),
22+
tvl: async() => ({})
23+
}, */
24+
methodology: "Counts staked $AIUS in the voting escrow contract",
25+
};

projects/arcadia-finance-v2/index.js

+24-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const utils = require('../helper/utils')
44
const config = {
55
factory: "0xDa14Fdd72345c4d2511357214c5B89A919768e59",
66
uniNFT: "0x03a520b32c04bf3beef7beb72e919cf822ed34f1",
7+
uniV4NFT: "0x7C5f5A4bBd8fD63184577525326123B519429bDc",
78
alienBaseNFT: "0xb7996d1ecd07fb227e8dca8cd5214bdfb04534e5",
89
slipNFT: "0x827922686190790b37229fd06084350e74485b72",
910
wAeroNFT: "0x17B5826382e3a5257b829cF0546A08Bd77409270".toLowerCase(),
@@ -65,17 +66,18 @@ async function uwrapStakedSlipstreamLP({ api, sSlipNftIds, }) {
6566
}
6667

6768
async function tvl (api) {
68-
const { factory, pools, uniNFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT, alienBaseNFT, wsSlipNFT } = config;
69+
const { factory, pools, uniNFT, uniV4NFT,slipNFT, wAeroNFT, sAeroNFT, sSlipNFT, alienBaseNFT, wsSlipNFT } = config;
6970
const ownerTokens = []
7071
const ownerIds = []
7172
const accs = []
73+
const uniV4Ids = []
7274

7375
const uTokens = await api.multiCall({ abi: "address:asset", calls: pools });
74-
await api.sumTokens({ blacklistedTokens: [uniNFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT, alienBaseNFT, wsSlipNFT], tokensAndOwners2: [uTokens, pools] });
75-
76+
await api.sumTokens({ blacklistedTokens: [uniNFT, uniV4NFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT, alienBaseNFT, wsSlipNFT], tokensAndOwners2: [uTokens, pools] });
77+
7678
const accounts = await api.fetchList({ lengthAbi: 'allAccountsLength', itemAbi: 'allAccounts', target: factory, })
7779

78-
// Account version 1 has a stored state of all assets, and can be fetched using generateAssetData()
80+
// Account version 1 has a stored state of all assets, and can be fetched using generateAssetData()
7981
// Account version 2 has no such stored state, and must be fetched with external api calls.
8082
const versions = await api.multiCall({abi: 'function ACCOUNT_VERSION() view returns (uint256)', calls: accounts,});
8183
const v1Accounts = accounts.filter((_, i) => versions[i] === '1');
@@ -88,7 +90,7 @@ async function tvl (api) {
8890
// 4. Return format is then transformed to be identical to the format of the V1 assetData
8991
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
9092

91-
const batchSize = 10;
93+
const batchSize = 5;
9294
for (let i = 0; i < v2Accounts.length; i += batchSize) {
9395
const batch = v2Accounts.slice(i, i + batchSize);
9496
await Promise.all(batch.map(async (account) => {
@@ -123,12 +125,19 @@ async function tvl (api) {
123125
if (!assetData[0][0].length || !assetData[0][1].length || assetData[0][1] == "0") return;
124126
ownerIds.push([assetData[0][0], assetData[0][1], account])
125127
accs.push(account)
128+
129+
for (let i = 0; i < assetData[0][0].length; i++) {
130+
if (assetData[0][0][i] === uniV4NFT) {
131+
uniV4Ids.push(assetData[0][1][i]);
132+
}
133+
}
134+
126135
} catch (error) {
127136
console.log(`Failed to fetch/process data for account ${account}:`, error);
128137
return;
129138
}
130139
}));
131-
140+
132141
// Add small delay between batches to prevent rate limiting
133142
if (i + batchSize < v2Accounts.length) { // Only sleep if there are more batches to process
134143
await sleep(1000);
@@ -143,19 +152,25 @@ async function tvl (api) {
143152
if (!assetData[0].length || !assetData[1].length) return;
144153
ownerIds.push([assetData[0], assetData[1], account])
145154
accs.push(account)
155+
156+
for (let i = 0; i < assetData.assets.length; i++) {
157+
if (assetData.assets[i] === uniV4NFT) {
158+
uniV4Ids.push(assetData[1][i]);
159+
}
160+
}
146161
})
147162

148163
if (alienBaseNFT)
149164
await sumTokens2({ api, owners: accs, uniV3ExtraConfig: { nftAddress: alienBaseNFT } })
150165

151166
// add all simple ERC20s
152-
await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT, alienBaseNFT, wsSlipNFT],});
167+
await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, uniV4NFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT, alienBaseNFT, wsSlipNFT],});
153168

154169
// add all Arcadia-wrapped LP positions
155170
await unwrapArcadiaAeroLP({ api, ownerIds });
156171

157-
// add all native LP positions
158-
return sumTokens2({ api, owners: accs, resolveUniV3: true, resolveSlipstream: true })
172+
//add all native LP positions
173+
return sumTokens2({ api, owners: accs, resolveUniV3: true, resolveSlipstream: true, resolveUniV4: true, uniV4ExtraConfig: {"positionIds":uniV4Ids}})
159174
}
160175

161176
module.exports = {

projects/babelfish/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const ADDRESSES = require('../helper/coreAssets.json')
12
const { sumTokensExport } = require("../helper/unwrapLPs");
23

34
const tokens = [
@@ -14,7 +15,7 @@ const tokens = [
1415
"0xFf4299bCA0313C20A61dc5eD597739743BEf3f6d",
1516
"0xb5999795BE0eBb5BAb23144Aa5fD6a02d080299f",
1617
"0xc1411567D2670E24D9c4Daaa7CdA95686E1250Aa",
17-
"0xEf213441a85DF4d7acBdAe0Cf78004E1e486BB96",
18+
ADDRESSES.rsk.rUSDT,
1819
"0xE700691Da7B9851F2F35f8b8182C69C53ccad9DB",
1920
]
2021

projects/basefinance-v1/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const { uniTvlExport } = require('../helper/unknownTokens')
2+
const factory = '0x99fbA55CAd2e0CF3750E3f48F6b8a87e6CdBf8c0' // v2 factory address
3+
4+
module.exports = uniTvlExport('base', factory)

projects/bucket-protocol/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ const navi_sLP_ID =
119119
const navi_stSUI_sLP_ID =
120120
"0xd3f6b8f3c92d8f967f7e177e836770421e351b419ffe074ce57911365b4ede56";
121121

122+
const navi_sbWBTC_LP_ID =
123+
"0x208628e8800828b272dfc4cf40ef98e1ba137f65d26a28961176a1718c2bdb4c";
124+
122125
const scallop_sUSDC_LP_ID =
123126
"0x7b16192d63e6fa111b0dac03f99c5ff965205455089f846804c10b10be55983c";
124127

@@ -355,6 +358,9 @@ async function tvl(api) {
355358
snavistSUILPAmount
356359
);
357360

361+
const snavisbWBTCLPAmount = await getStakingLPAmount(navi_sbWBTC_LP_ID);
362+
api.add(ADDRESSES.sui.WBTC, snavisbWBTCLPAmount);
363+
358364
const haSuiNaviPondAmount = await getStakingLPAmount(haSUI_Navi_Pond_ID);
359365
api.add(
360366
"0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI",

projects/camelot-v2/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const export2 = uniV3Export({
1616
duckchain: { factory: '0xCf4062Ee235BbeB4C7c0336ada689ed1c17547b6', fromBlock: 1530060, isAlgebra: true, },
1717
occ: { factory: '0xCf4062Ee235BbeB4C7c0336ada689ed1c17547b6', fromBlock: 21053, isAlgebra: true, },
1818
spn: { factory: '0xCf4062Ee235BbeB4C7c0336ada689ed1c17547b6', fromBlock: 1, isAlgebra: true, },
19+
winr: { factory: '0x10aA510d94E094Bd643677bd2964c3EE085Daffc', fromBlock: 1258618, isAlgebra: true }
1920
})
2021

21-
module.exports = mergeExports([export1, export2])
22+
module.exports = mergeExports([export1, export2])
23+

projects/canopy/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const ADDRESSES = require('../helper/coreAssets.json')
12
const { function_view } = require("../helper/chain/aptos");
23

34
const canopyCoreAddress = "b10bd32b3979c9d04272c769d9ef52afbc6edc4bf03982a9e326b96ac25e7f2d"; // Canopy Core Vaults Module
@@ -6,7 +7,7 @@ const canopyLiquidswapAddress = "968a2429f2544882a1743c51128fdf876ff03a25287d618
67
const registryAddress = "e6ef7257c8d73c55c97507705e4aac1bcc740c648eb698db3b07895fff689f05"; // Registry for Liquidswap Vaults
78
const liquidswapV1Address = "4763c5cfde8517f48e930f7ece14806d75b98ce31b0b4eab99f49a067f5b5ef2"; // Liquidswap V1 Module
89

9-
const moveCoinAddress = "0x1::aptos_coin::AptosCoin"
10+
const moveCoinAddress = ADDRESSES.aptos.APT
1011
const moveCoinFa = "0xa"
1112

1213
async function getCanopyCoreVaults(address, pageSize = 100) {

projects/centrifuge/index.js

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
const { getLogs } = require('../helper/cache/getLogs')
2+
3+
const contractAbis = {
4+
getVault: "function vault(address asset) external view returns (address)",
5+
totalAssets: "function totalAssets() external view returns (uint256)",
6+
};
7+
8+
9+
const config = {
10+
ethereum: {
11+
factories: [
12+
{
13+
START_BLOCK: 20432393,
14+
TOKEN_FACTORY: '0x91808B5E2F6d7483D41A681034D7c9DbB64B9E29'
15+
}
16+
],
17+
assets: {
18+
USDC: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
19+
}
20+
},
21+
base: {
22+
factories: [
23+
{
24+
START_BLOCK: 17854404,
25+
TOKEN_FACTORY: '0x7f192F34499DdB2bE06c4754CFf2a21c4B056994'
26+
}
27+
],
28+
assets: {
29+
USDC: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
30+
}
31+
},
32+
arbitrum: {
33+
factories: [
34+
{
35+
START_BLOCK: 238245701,
36+
TOKEN_FACTORY: '0x91808B5E2F6d7483D41A681034D7c9DbB64B9E29'
37+
}
38+
],
39+
assets: {
40+
USDC: '0xaf88d065e77c8cc2239327c5edb3a432268e5831'
41+
}
42+
},
43+
}
44+
45+
async function tvl(api) {
46+
if (config[api.chain]) {
47+
const targets = await getTokens(api);
48+
49+
const vaults = await api.multiCall({
50+
abi: contractAbis.getVault,
51+
calls: targets.map(i => ({ target: i, params: [config[api.chain].assets.USDC] })),
52+
permitFailure: true
53+
});
54+
55+
const totalAssets = await api.multiCall({
56+
abi: contractAbis.totalAssets,
57+
calls: vaults.map(i => ({ target: i })),
58+
permitFailure: true
59+
});
60+
61+
const decimals = await api.multiCall({
62+
abi: "erc20:decimals",
63+
calls: targets.map(i => ({ target: i })),
64+
permitFailure: true
65+
});
66+
67+
for (let i = 0; i <= targets.length; i++) {
68+
if (totalAssets[i] > 0 && decimals[i] > 0) {
69+
let value = totalAssets[i] / 10 ** (decimals[i]);
70+
api.addUSDValue(value);
71+
}
72+
}
73+
}
74+
}
75+
76+
async function getTokens(api) {
77+
const chain = api.chain;
78+
let logs = [];
79+
let tokenAddresses = [];
80+
if (config[chain]) {
81+
for (let factory of config[chain].factories) {
82+
const { TOKEN_FACTORY, START_BLOCK } = factory;
83+
let logChunk = await getLogs({
84+
api,
85+
target: TOKEN_FACTORY,
86+
fromBlock: START_BLOCK,
87+
eventAbi: 'event DeployTranche(uint64 indexed poolId, bytes16 indexed trancheId, address indexed tranche)',
88+
});
89+
logs = [...logs, ...logChunk];
90+
}
91+
92+
tokenAddresses = logs.map((log) => log.args[2]);
93+
94+
}
95+
return tokenAddresses;
96+
}
97+
98+
99+
module.exports = {
100+
methodology: `TVL corresponds to the total USD value of tokens minted on Centrifuge across Ethereum, Base, and Arbitrum.`,
101+
ethereum: { tvl },
102+
base: { tvl },
103+
arbitrum: { tvl },
104+
}

projects/cian-yl/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ const config = {
3232

3333
// sei
3434
"0x7fF67093231CE8DBC70c0A65b629ed080e66a7F0", // pumpbtc
35-
"0xe5DfcE87E75e92C61aeD31329716Cf3D85Cd9C8c" // ylBTCLST
35+
"0xe5DfcE87E75e92C61aeD31329716Cf3D85Cd9C8c", // ylBTCLST
36+
37+
// lfbtc-cian-eth
38+
"0x821d2e44984168d278C698fD742d5138c01bAAA2" // lfbtc-cian-eth
39+
3640
],
3741
optimism: ["0x907883da917ca9750ad202ff6395C4C6aB14e60E"],
3842
bsc: ["0xEa5f10A0E612316A47123D818E2b597437D19a17"],

0 commit comments

Comments
 (0)