Skip to content

Commit ad6230d

Browse files
committed
Merge branch 'main' into nibiru/silverswap
2 parents 0f9d3bf + bd54d66 commit ad6230d

File tree

17 files changed

+352
-120
lines changed

17 files changed

+352
-120
lines changed

projects/claystack-matic/clayABIs/clayMain.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

projects/claystack-matic/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
const ADDRESSES = require('../helper/coreAssets.json')
2-
const abi = require('./clayABIs/clayMain.json');
2+
3+
const abis = {
4+
"funds": "function funds() view returns (uint256 currentDeposit, uint256 stakedDeposit, uint256 accruedFees)"
5+
}
36

47
const clayAddresses = {
58
clayMatic: "0x91730940DCE63a7C0501cEDfc31D9C28bcF5F905",
69
};
710

8-
async function getTvlOnEthereum(api) {
9-
const maticDeposits = await api.call({ target: clayAddresses.clayMatic, abi: abi.funds, })
10-
11+
async function tvl(api) {
12+
const maticDeposits = await api.call({ target: clayAddresses.clayMatic, abi: abis.funds })
1113
api.add(ADDRESSES.ethereum.MATIC, maticDeposits.currentDeposit)
1214
}
1315

1416
module.exports = {
15-
ethereum: {
16-
tvl: getTvlOnEthereum,
17-
},
17+
deadFrom: '2025-05-20',
18+
ethereum: { tvl },
1819
methodology: `We get the total MATIC deposited in clay contracts and convert it to USD.`
1920
}

projects/claystack/clayABIs/clayMain.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

projects/claystack/index.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
const ADDRESSES = require('../helper/coreAssets.json')
2-
const abi = require('./clayABIs/clayMain.json');
2+
3+
const abis = {
4+
"funds": "function funds() view returns (uint256 currentDeposit, uint256 stakedDeposit, uint256 accruedFees)"
5+
}
36

47
const clayAddresses = {
58
clayEth: "0x331312DAbaf3d69138c047AaC278c9f9e0E8FFf8"
69
};
710

8-
async function getTvlOnEthereum(api) {
9-
const ethDeposits = await api.call({ target: clayAddresses.clayEth, abi: abi.funds, })
10-
11+
async function tvl(api) {
12+
const ethDeposits = await api.call({ target: clayAddresses.clayEth, abi: abis.funds, })
1113
api.add(ADDRESSES.null, ethDeposits.currentDeposit)
1214
}
1315

1416
module.exports = {
17+
deadFrom: '2025-05-20',
1518
doublecounted: true,
16-
hallmarks: [
17-
[1707315338,"Split Adapter"]
18-
],
19-
ethereum: {
20-
tvl: getTvlOnEthereum,
21-
},
19+
hallmarks: [[1707315338,"Split Adapter"]],
20+
ethereum: { tvl },
2221
methodology: `We get the total ETH deposited in clay contracts and convert it to USD.`
2322
}

projects/gt3/index.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
// projects/gt3/index.js
2-
const { getUniTVL } = require('../helper/unknownTokens');
1+
const { uniTvlExports } = require('../helper/unknownTokens');
32

4-
const CHAIN = "polygon";
5-
const GT3_FACTORY_ADDRESS = "0x2d7360Db7216792cfc2c73B79C0cA629007E2af4";
6-
7-
const tvl = getUniTVL({ factory: GT3_FACTORY_ADDRESS, chain: CHAIN, useDefaultCoreAssets: true });
8-
9-
module.exports = {
10-
methodology: "The TVL is calculated by adding the liquidity of all pairs on the gt3.finance exchange, obtained through the Factory contract.",
11-
[CHAIN]: { // Exportar por cadena
12-
tvl: tvl,
13-
},
14-
};
3+
module.exports = uniTvlExports({
4+
polygon: '0x2d7360Db7216792cfc2c73B79C0cA629007E2af4'
5+
})

projects/helper/tokenMapping.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ const fixBalancesTokens = {
7575
'0x4200000000000000000000000000000000000006': { coingeckoId: 'superseed-bridged-weth-superseed', decimals: 18, },
7676
'0xc316c8252b5f2176d0135ebb0999e99296998f2e': { coingeckoId: 'superseed-bridged-usdc-superseed', decimals: 6, },
7777
'0x1217BfE6c773EEC6cc4A38b5Dc45B92292B6E189': { coingeckoId: 'openusdt', decimals: 6, },
78+
},
79+
lens: {
80+
'0x6bdc36e20d267ff0dd6097799f82e78907105e2f': { coingeckoId: 'gho', decimals: 18, },
81+
'0x88f08e304ec4f90d644cec3fb69b8ad414acf884': { coingeckoId: 'usd-coin', decimals: 6, },
82+
'0xe5ecd226b3032910ceaa43ba92ee8232f8237553': { coingeckoId: 'ethereum', decimals: 18, },
83+
'0xb0588f9a9cade7cd5f194a5fe77acd6a58250f82': { coingeckoId: 'bonsai-token', decimals: 18, },
7884
}
7985
}
8086

projects/hyperbeat/index.js

Lines changed: 75 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,89 @@
11
const { sumERC4626VaultsExport } = require('../helper/erc4626');
22
const { sumTokens2 } = require('../helper/unwrapLPs');
3+
const sdk = require('@defillama/sdk');
4+
const BigNumber = require('bignumber.js');
35

4-
const hyperliquidVaults = ['0x96C6cBB6251Ee1c257b2162ca0f39AA5Fa44B1FB', '0xc061d38903b99aC12713B550C2CB44B221674F94'];
6+
const USDT0 = '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb';
7+
const USDT0_VAULT = '0x5e105266db42f78fa814322bce7f388b4c2e61eb';
58

6-
const ethereumVaults = [
7-
'0x9E3C0D2D70e9A4BF4f9d5F0A6E4930ce76Fed09e',
8-
'0x9920d2075A350ACAaa4c6D00A56ebBEeD021cD7f',
9-
'0x340116F605Ca4264B8bC75aAE1b3C8E42AE3a3AB',
10-
];
9+
const morphoVaults = {
10+
'0x5eEC795d919FA97688Fb9844eeB0072E6B846F9d': '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34',
11+
'0x53A333e51E96FE288bC9aDd7cdC4B1EAD2CD2FfA': '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb',
12+
'0x0571362ba5EA9784a97605f57483f865A37dBEAA': '0xBe6727B535545C67d5cAa73dEa54865B92CF7907',
13+
'0xd19e3d00f8547f7d108abfd4bbb015486437b487': '0x5555555555555555555555555555555555555555'
14+
};
1115

12-
const tokensToCheck = [
13-
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
14-
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7',
15-
'0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110', '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',
16-
'0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', '0x8DB2350D78aBc13f5673A411D4700BCF87864dDE',
17-
'0x657e8C867D8B37dCC18fA4Caead9C45EB088C642', '0x094c0e36210634c3CfA25DC11B96b562E0b07624',
18-
'0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', '0x8236a87084f8B84306f72007F36F2618A5634494',
19-
'0x7A56E1C57C7475CCf742a1832B028F0456652F97', '0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e',
20-
'0xE6829d9a7eE3040e1276Fa75293Bde931859e8fA', '0x7122985656e38BDC0302Db86685bb972b145bD3C',
21-
'0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee', '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7',
22-
'0xf951E335afb289353dc249e82926178EaC7DEd78', '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0'
23-
];
16+
const adjustDecimals = (amount, from, to = 6) => {
17+
return new BigNumber(amount)
18+
.times(new BigNumber(10).pow(to))
19+
.div(new BigNumber(10).pow(from))
20+
.toFixed(0);
21+
};
2422

2523
module.exports = {
2624
doublecounted: true,
27-
methodology: 'Measures TVL by calculating all tokens held by each vault. For Ethereum vaults we check balances of major tokens, for Hyperliquid vault we use the ERC4626 standard.',
25+
methodology: 'Measures TVL by calculating all tokens held by each vault.',
2826
start: 1738368000,
2927
ethereum: {
30-
tvl: async (api) => {
31-
return sumTokens2({ api, owners: ethereumVaults, tokens: tokensToCheck });
32-
}
28+
tvl: async (api) => sumTokens2({
29+
api,
30+
owners: [
31+
'0x9E3C0D2D70e9A4BF4f9d5F0A6E4930ce76Fed09e',
32+
'0x9920d2075A350ACAaa4c6D00A56ebBEeD021cD7f',
33+
'0x340116F605Ca4264B8bC75aAE1b3C8E42AE3a3AB'
34+
],
35+
tokens: [
36+
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
37+
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7',
38+
'0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110', '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',
39+
'0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', '0x8DB2350D78aBc13f5673A411D4700BCF87864dDE',
40+
'0x657e8C867D8B37dCC18fA4Caead9C45EB088C642', '0x094c0e36210634c3CfA25DC11B96b562E0b07624',
41+
'0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', '0x8236a87084f8B84306f72007F36F2618A5634494',
42+
'0x7A56E1C57C7475CCf742a1832B028F0456652F97', '0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e',
43+
'0xE6829d9a7eE3040e1276Fa75293Bde931859e8fA', '0x7122985656e38BDC0302Db86685bb972b145bD3C',
44+
'0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee', '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7',
45+
'0xf951E335afb289353dc249e82926178EaC7DEd78', '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0'
46+
]
47+
})
3348
},
3449
hyperliquid: {
35-
tvl: sumERC4626VaultsExport({ vaults: hyperliquidVaults, isOG4626: true })
50+
tvl: async (api) => {
51+
await sumERC4626VaultsExport({
52+
vaults: ['0x96C6cBB6251Ee1c257b2162ca0f39AA5Fa44B1FB', '0xc061d38903b99aC12713B550C2CB44B221674F94'],
53+
isOG4626: true
54+
})(api);
55+
56+
const [supply, decimals] = await Promise.all([
57+
sdk.api.erc20.totalSupply({ target: USDT0_VAULT, chain: 'hyperliquid' }),
58+
sdk.api.erc20.decimals(USDT0_VAULT, 'hyperliquid')
59+
]);
60+
61+
api.add(USDT0, adjustDecimals(supply.output, decimals.output));
62+
63+
const [supplies, vaultDecimals] = await Promise.all([
64+
sdk.api.abi.multiCall({
65+
calls: Object.keys(morphoVaults).map(v => ({ target: v })),
66+
abi: 'erc20:totalSupply',
67+
chain: 'hyperliquid'
68+
}),
69+
sdk.api.abi.multiCall({
70+
calls: Object.keys(morphoVaults).map(v => ({ target: v })),
71+
abi: 'erc20:decimals',
72+
chain: 'hyperliquid'
73+
})
74+
]);
75+
76+
supplies.output.forEach((data, i) => {
77+
const vault = data.input.target;
78+
const underlying = morphoVaults[vault];
79+
const decimals = vaultDecimals.output[i].output;
80+
const amount = underlying === USDT0
81+
? adjustDecimals(data.output, decimals)
82+
: data.output;
83+
api.add(underlying, amount);
84+
});
85+
86+
return api.getBalances();
87+
}
3688
}
3789
};

projects/kleva/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ async function fetchLiquidity() {
5858
}
5959

6060
module.exports = {
61+
deadFrom: '2025-01-01',
62+
hallmarks: [[1711929600,'Sunset of Kleva-Farm']],
6163
klaytn: { tvl: sdk.util.sumChainTvls([fetchLiquidity, kExports.klaytn.tvl]) },
6264
doublecounted: true,
6365
}

projects/panoptic-v1_1/index.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
const { getLogs2 } = require('../helper/cache/getLogs')
2+
const { cachedGraphQuery } = require("../helper/cache");
3+
const { addUniV3LikePosition } = require('../helper/unwrapLPs');
4+
const { sumTokens2 } = require("../helper/unwrapLPs");
5+
const sdk = require('@defillama/sdk')
6+
7+
const FACTORY = '0x0000000000000CF008e9bf9D01f8306029724c80'
8+
9+
const SFPMChunksQuery = `
10+
query SFPMChunks($lastId: ID, $block: Int) {
11+
chunks(first: 1000
12+
block: {number: $block}
13+
where: {and: [{id_gt: $lastId}, { netLiquidity_gt: 100}]}
14+
) {
15+
netLiquidity
16+
tickLower
17+
tickUpper
18+
id
19+
pool { id, tick, token0 {id}, token1 {id}}
20+
panopticPool {
21+
id
22+
}
23+
}
24+
}`
25+
26+
const abi = {"PoolDeployed": "event PoolDeployed(address indexed poolAddress, address indexed oracleContract, bytes32 indexed idV4, address collateralTracker0, address collateralTracker1)"}
27+
28+
const config = {
29+
ethereum: {
30+
graphUrl: 'https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-mainnet/prod/gn',
31+
startBlock: 21745246,
32+
safeBlockLimit: 50,
33+
PoolManager: '0x000000000004444c5dc75cB358380D2e3dE08A90'
34+
},
35+
base: {
36+
graphUrl: 'https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-base/prod/gn',
37+
startBlock: 29281023,
38+
safeBlockLimit: 50,
39+
PoolManager: '0x498581ff718922c3f8e6a244956af099b2652b2b'
40+
},
41+
// unichain: {
42+
// graphUrl: 'https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-unichain/prod/gn',
43+
// startBlock: 8576605,
44+
// safeBlockLimit: 50,
45+
// PoolManager: '0x1f98400000000000000000000000000000000004'
46+
// }
47+
}
48+
49+
50+
async function tvl(api) {
51+
const chain = api.chain
52+
const { startBlock, graphUrl, safeBlockLimit, PoolManager } = config[chain]
53+
54+
const poolDeployedLogs = await getLogs2({ api, target: FACTORY, fromBlock: startBlock, eventAbi: abi.PoolDeployed, })
55+
56+
const isV4 = {}
57+
58+
for (const poolDeployedLog of poolDeployedLogs) {
59+
// get underlying token from each collateral tracker
60+
const tokens = await api.multiCall({ abi:'function asset() external view returns (address)', calls: [{target: poolDeployedLog.collateralTracker0, params: []}, {target: poolDeployedLog.collateralTracker1, params: []}] })
61+
62+
// query the erc1155 balance of the pool manager for each token
63+
const balancesRaw = await api.multiCall({ abi:'function balanceOf(address owner, uint256 id) view returns (uint256)', calls: tokens.map(t => ({ target: PoolManager, params: [poolDeployedLog.poolAddress, t] })) })
64+
65+
isV4[poolDeployedLog.poolAddress.toLowerCase()] = true
66+
67+
api.addTokens(tokens, balancesRaw)
68+
}
69+
70+
71+
const chunks = await cachedGraphQuery(`panoptic/sfpm-chunks`, graphUrl, SFPMChunksQuery, { api, useBlock: true, fetchById: true, safeBlockLimit, })
72+
chunks.forEach(chunk => {
73+
if (!isV4[chunk.panopticPool.id.toLowerCase()]) return
74+
addUniV3LikePosition({ api, token0: chunk.pool.token0.id, token1: chunk.pool.token1.id, tick: chunk.pool.tick, liquidity: chunk.netLiquidity, tickUpper: chunk.tickUpper, tickLower: chunk.tickLower, })
75+
})
76+
}
77+
78+
module.exports = {
79+
ethereum: {
80+
tvl,
81+
methodology: 'This adapter counts tokens held by all PanopticPool contracts created by the PanopticFactory, as well as the token composition of all Uniswap liquidity held by the SemiFungiblePositionManager (which is used by every PanopticPool to manage liquidity).',
82+
start: 1738292183,
83+
},
84+
base: {
85+
tvl,
86+
methodology: 'This adapter counts tokens held by all PanopticPool contracts created by the PanopticFactory, as well as the token composition of all Uniswap liquidity held by the SemiFungiblePositionManager (which is used by every PanopticPool to manage liquidity).',
87+
start: 1745308193,
88+
},
89+
// unichain: {
90+
// tvl,
91+
// methodology: 'This adapter counts tokens held by all PanopticPool contracts created by the PanopticFactory, as well as the token composition of all Uniswap liquidity held by the SemiFungiblePositionManager (which is used by every PanopticPool to manage liquidity).',
92+
// start: ,
93+
// },
94+
}

projects/rubicon/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
const sdk = require("@defillama/sdk");
22
const { cachedGraphQuery } = require('../helper/cache')
33
const { sumTokens2 } = require('../helper/unwrapLPs')
4+
const { uniTvlExport } = require('../helper/unknownTokens')
45

56
const RUBICON_MARKET_OPTIMISM = '0x7a512d3609211e719737E82c7bb7271eC05Da70d'
67
const RUBICON_MARKET_ARBITRUM = '0xC715a30FDe987637A082Cf5F19C74648b67f2db8'
78

9+
const baseFactory = '0xA5cA8Ba2e3017E9aF3Bd9EDa69e9E8C263Abf6cD'
10+
11+
const base = 'base'
12+
813

914
module.exports = {
1015
methodology: "Counts the tokens on the market (orders in the orderbook) and in bath pools",
@@ -16,6 +21,8 @@ module.exports = {
1621
]
1722
}
1823

24+
module.exports = uniTvlExport(base, baseFactory)
25+
1926
const config = {
2027
optimism: {
2128
endpoint: sdk.graph.modifyEndpoint('AUcAkUd4sJutFD3hYQfvB6uvXrEdYP26qiZwZ5qyrgTw'),

0 commit comments

Comments
 (0)