Skip to content

Commit

Permalink
Merge branch 'DefiLlama:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-magpie authored Jan 15, 2025
2 parents cc2d40a + 58a98a8 commit 0f9f088
Show file tree
Hide file tree
Showing 57 changed files with 626 additions and 152 deletions.
6 changes: 5 additions & 1 deletion projects/ZTLN/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ module.exports = {
timetravel: false,
misrepresentedTokens: true,
methodology: "The value in RWA held by the protocol",
hallmarks: [
[Math.floor(new Date('2025-01-13')/1e3), 'ZTLN is deprecated'],
],
deadFrom: "2025-01-13",
ethereum: {
tvl
tvl: () => ({}),
},
};
2 changes: 1 addition & 1 deletion projects/anedak/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async function fetch() {
}

module.exports = {
// deadFrom: '2024-08-30',
deadFrom: '2024-08-30',
timetravel: false,
misrepresentedTokens: true,
methodology: "TVL accounts for the liquidity on all Anedak AMM pools, with all values calculated in terms of KDA price.",
Expand Down
12 changes: 12 additions & 0 deletions projects/aurum/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { aaveExports, methodology } = require('../helper/aave')

const CONFIG = {
sonic: ['0x2ce2f663f8C8A011df0ACb1744b45108F61B9005'],
}

module.exports.methodology = methodology

Object.keys(CONFIG).forEach((chain) => {
const poolDatas = CONFIG[chain];
module.exports[chain] = aaveExports(undefined, undefined, undefined, poolDatas, { v3: true, })
})
2 changes: 1 addition & 1 deletion projects/babena/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function stakingfetch() {
module.exports = {
timetravel: false,
misrepresentedTokens: true,
// deadFrom: '2024-08-30',
deadFrom: '2024-08-30',
kadena: {
tvl: () => ({}),
staking: () => ({})
Expand Down
34 changes: 34 additions & 0 deletions projects/botto/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { staking } = require('../helper/staking');
const { sumTokensExport } = require("../helper/unwrapLPs");
const coreAssets = require("../helper/coreAssets.json");

const ethereumContracts = [
"0x19cd3998f106ecc40ee7668c19c47e18b491e8a6",
"0xf8515cae6915838543bcd7756f39268ce8f853fd",
];

const baseStakingContract = "0x8a7a5991aAf142B43E58253Bd6791e240084F0A9";
const baseToken = "0x24914CB6BD01E6a0CF2a9c0478e33c25926e6a0c";

module.exports = {
ethereum: {
tvl: sumTokensExport({
owners: ethereumContracts,
token: coreAssets.null
}),
staking: staking(
ethereumContracts,
'0x9DFAD1b7102D46b1b197b90095B5c4E9f5845BBA'
),
pool2: staking(
ethereumContracts,
'0x9FF68F61cA5EB0c6606dC517a9d44001e564bb66'
),
},
base: {
staking: staking(
baseStakingContract,
baseToken
),
},
};
3 changes: 2 additions & 1 deletion projects/brbtc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const chainConfigs = {
"0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568",//uniBTC
"0xC96dE26018A54D51c097160568752c4E3BD6C364",//FBTC
"0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",//cbBTC
"0x2F913C820ed3bEb3a67391a6eFF64E70c4B20b19",//MBTC
"0x2F913C820ed3bEb3a67391a6eFF64E70c4B20b19",//M-BTC
],
},
bsc: {
Expand All @@ -20,6 +20,7 @@ const chainConfigs = {
ADDRESSES.bsc.BTCB,//BTCB
"0x6B2a01A5f79dEb4c2f3c0eDa7b01DF456FbD726a",//uniBTC
"0xC96dE26018A54D51c097160568752c4E3BD6C364",//FBTC
"0x9BFA177621119e64CecbEabE184ab9993E2ef727",//M-BTC
],
}
}
Expand Down
5 changes: 3 additions & 2 deletions projects/burve-protocol/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Object.keys(config).forEach(chain => {
module.exports[chain] = {
tvl: async (api) => {
const tokens = await getLogs2({ api, factory, eventAbi: 'event LogTokenDeployed (string tokenType, string bondingCurveType, uint256 tokenId, address deployedAddr)', fromBlock, transform: i => i.deployedAddr })
const uTokens = await api.multiCall({ abi: 'address:getRaisingToken', calls: tokens })
return api.sumTokens({ tokensAndOwners2: [uTokens, tokens], blacklistedTokens: tokens })
const uTokens = await api.multiCall({ abi: 'address:getRaisingToken', calls: tokens, permitFailure: true })
const tokensAndOwners = uTokens.map((u, i) => [u, tokens[i]]).filter(t => t[0])
return api.sumTokens({ tokensAndOwners, blacklistedTokens: tokens })
}
}
})
10 changes: 6 additions & 4 deletions projects/chaingpt/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { stakings } = require("../helper/staking");
const { getLogs } = require('../helper/cache/getLogs')
const { PromisePool } = require('@supercharge/promise-pool')
const { PromisePool } = require('@supercharge/promise-pool');
const { blake2b } = require("blakejs");
const { sumTokens2 } = require("../helper/unwrapLPs");

const cgpt = "0x9840652DC04fb9db2C43853633f0F62BE6f00f98";
const stakingpool1 = "0x765a6ee976137801F2661c3644E1fde369A8ED18";
Expand Down Expand Up @@ -32,7 +34,7 @@ const config = {
{ factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 15191500, blacklistedTokens: ['0xcE87100A1dBAf576ebd063EB0890840346338689'] },
],
base: [
{ factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 15137100 },
{ factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 15137100, },
],
xlayer: [
{ factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 2353300 },
Expand All @@ -52,7 +54,7 @@ async function tvl(api) {
let blacklistedTokens = []

for (const chainConfig of chainConfigs) {
const { factory, fromBlock, blacklistedTokens: configBlacklistedTokens } = chainConfig
const { factory, fromBlock, blacklistedTokens: configBlacklistedTokens } = chainConfig

if (configBlacklistedTokens) {
blacklistedTokens = blacklistedTokens.concat(configBlacklistedTokens)
Expand Down Expand Up @@ -100,7 +102,7 @@ async function tvl(api) {
})
}

return api.sumTokens({ ownerTokens, blacklistedTokens })
return sumTokens2({ api, ownerTokens, blacklistedTokens, permitFailure: true, })

}

Expand Down
21 changes: 9 additions & 12 deletions projects/clober-liquidity-vault/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@ const abi = {
}

const config = {
base: {
rebalancer: '0x6A0b87D6b74F7D5C92722F6a11714DBeDa9F3895',
bookManager: '0x382CCccbD3b142D7DA063bF68cd0c89634767F76',
fromBlock: 21715410,
},
rebalancer: '0x6A0b87D6b74F7D5C92722F6a11714DBeDa9F3895',
bookManager: '0x382CCccbD3b142D7DA063bF68cd0c89634767F76',
blacklistedTokens: ['0x000000000000bb1b11e5ac8099e92e366b64c133'],
fromBlock: 21715410
}

async function tvl(api) {
const { rebalancer, bookManager, fromBlock } = config[api.chain]
const { rebalancer, bookManager, fromBlock, blacklistedTokens } = config
const logs = await getLogs2({ api, factory: rebalancer, eventAbi: abi.openEvent, fromBlock, extraKey: 'open-bookid' })
const bookIds = logs.map(i => [i.bookIdA, i.bookIdB]).flat()
const res = await api.multiCall({ abi: abi.getBookKey, calls: bookIds, target: bookManager })
const tokens = res.map(i => [i.base, i.quote]).flat()
return api.sumTokens({ owners: [rebalancer,], tokens })
return api.sumTokens({ owners: [rebalancer], tokens, blacklistedTokens })
}

module.exports = {
hallmarks: [[1733788800, 'The Clober Liquidity Vault has been hacked']],
methodology: "TVL includes all assets deposited into the Clober Liquidity Vault contract, specifically allocated for liquidity provision and market-making within the Clober ecosystem",
};

Object.keys(config).forEach(chain => {
module.exports[chain] = { tvl }
})
base: { tvl }
}
11 changes: 11 additions & 0 deletions projects/cybro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const vaultsBlast = [
'0x6654cddf2a14a06307af6a8d7731dd4e059962a1',
'0x4caec64454893c7912e6beb1e19b4714dd353748',
'0x24e72c2c7be9b07942f6f8d3cdce995df699514d',
'0xb3e2099b135b12139c4eb774f84a5808fb25c67d',
]

const vaultsArbitrum = [
Expand All @@ -28,6 +29,11 @@ const vaultsArbitrum = [
'0x951c846aa10cc3da45defed784c3802605f71769',
]

const vaultsBase = [
"0x459a3d995d66798b1ab114f702b8bc8655484e78",
"0xa7517b9930d0556175a1971bd62084e16f21881f",
]

const dexes = [
'0xe9041d3483a760c7d5f8762ad407ac526fbe144f',
'0xbfb18eda8961ee33e38678caf2bceb2d23aedfea',
Expand Down Expand Up @@ -59,9 +65,14 @@ async function tvlArbitrum(api) {
return api.erc4626Sum2({ calls: vaultsArbitrum });
}

async function tvlBase(api) {
return api.erc4626Sum2({ calls: vaultsBase });
}

module.exports = {
doublecounted: true,
methodology: "We calculate TVL based on the Total Supply of our proxy contracts through which users interact with vault's contracts",
base: { tvl: tvlBase },
blast: { tvl: tvlBlast },
arbitrum: { tvl: tvlArbitrum },
};
2 changes: 1 addition & 1 deletion projects/datadex/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { uniV3Export } = require('../helper/uniswapV3')
module.exports = uniV3Export({
vana: { factory: '0xc2a0d530e57B1275fbce908031DA636f95EA1E38', fromBlock: 763744, blacklistedTokens: ['0xbd2d7c728b224961fdb25ccf2a67eb3c25f5ec52'] },
vana: { factory: '0xc2a0d530e57B1275fbce908031DA636f95EA1E38', fromBlock: 763744, blacklistedTokens: ['0xbd2d7c728b224961fdb25ccf2a67eb3c25f5ec52', '0x0238966c595619312c0422f02e1e64f37a06439d'] },
})
8 changes: 7 additions & 1 deletion projects/dexodus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ const { sumTokensExport } = require('../helper/unwrapLPs');
module.exports = {
methodology: 'Counts the USDC and WETH tokens in the Dexodus liquidity pool on Base.',
base: {
tvl: sumTokensExport({ owner: '0x1A84d7E27e7f0e93Da74b93095e342b6e8dBd50A', tokens: [ADDRESSES.base.USDbC, ADDRESSES.base.WETH] }),
tvl: sumTokensExport({
owners: [ '0x1A84d7E27e7f0e93Da74b93095e342b6e8dBd50A', // Dexodus liquidity pool address
'0x39016479A05626Df9BA4cB80864E1B3b69D694b4', // Dexodus core futures address
'0x1692992ee7EE987510Dd32BFCeF2C08C8080d5b2' // Dexodus referrals address

], tokens: [ADDRESSES.base.USDbC, ADDRESSES.base.WETH]
}),
},
};
1 change: 1 addition & 0 deletions projects/dfs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ async function dfs() {
}

module.exports = {
timetravel: false,
methodology: `DFS TVL is achieved by querying token balances from DFS's AMM swap liquidity smart contract.`,
eos: {
tvl: eos,
Expand Down
3 changes: 2 additions & 1 deletion projects/donaswap-v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ module.exports = {
methodology: "Factory address (0x8e5dff1c121F661971d02950698f8c5EFc3DfA78) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.",
};

chains.forEach(chain => module.exports[chain] = { tvl })
chains.forEach(chain => module.exports[chain] = { tvl })
module.exports.cmp.tvl = () => ({})
1 change: 1 addition & 0 deletions projects/dyorswap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const config = {
bob: '0x2CcaDb1e437AA9cDc741574bDa154686B1F04C09',
ink: '0x6c86ab200661512fDBd27Da4Bb87dF15609A2806',
sonic: '0xd8863d794520285185197F97215c8B8AD04E8815',
soneium: '0x4f0c1b4c6FdF983f2d385Cf24DcbC8c68f345E40',
}

module.exports = {
Expand Down
5 changes: 2 additions & 3 deletions projects/fx-Protocol/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const aCVX = "0xb0903Ab70a7467eE5756074b31ac88aEBb8fB777";
const uniBTC = "0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568";
const uniBTC_Genesis_Gauge = "0x1D20671A21112E85b03B00F94Fd760DE0Bef37Ba"
const fxUSD_stabilityPool = "0x65C9A641afCEB9C0E6034e558A319488FA0FA3be"
const fxUSD_stabilityPool_Gauge = "0xEd92dDe3214c24Ae04F5f96927E3bE8f8DbC3289"
const FxProtocol_PoolManager = "0x250893CA4Ba5d05626C785e8da758026928FCD24"

module.exports = {
doublecounted: true,
Expand Down Expand Up @@ -65,7 +65,6 @@ async function tvl(api) {
api.add(tokens[i], bal / (rates[i] / 1e18) / 10 ** (18 - decimals[i]))
}
})

const tokensAndOwners = [[uniBTC, uniBTC_Genesis_Gauge], [ADDRESSES.ethereum.USDC, fxUSD_stabilityPool]]
const tokensAndOwners = [[uniBTC, uniBTC_Genesis_Gauge], [ADDRESSES.ethereum.USDC, fxUSD_stabilityPool], [ADDRESSES.ethereum.WSTETH, FxProtocol_PoolManager]]
return api.sumTokens({ tokensAndOwners })
}
44 changes: 26 additions & 18 deletions projects/harvest.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,29 @@ const chains = {
polygon: 'matic'
}

module.exports = {}
Object.keys(chains).forEach(chain => {
module.exports[chain] = {
tvl: async (api) => {
const response = await getConfig('harvest', endpoint)
const vaults = Object.values(response[chains[chain]]).map(i => i.vaultAddress)
const strategy = await api.multiCall({ abi: 'address:strategy', calls: vaults })
const tokensV = await api.multiCall({ abi: 'address:underlying', calls: vaults, permitFailure: true })
const tokens = await api.multiCall({ abi: 'address:underlying', calls: strategy, permitFailure: true })
const bals2 = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: vaults, permitFailure: true })
tokens.forEach((token, idx) => {
if (!token) token = tokensV[idx]
if (token) api.add(token, bals2[idx])
})
return sumTokens2({ api, resolveLP: true, owners: vaults, resolveUniV3: chain !== 'base', permitFailure: true })
}
}
})
const tvl = async (api) => {
const response = await getConfig('harvest', endpoint)
const rawVaults = Object.values(response[chains[api.chain]]).map(i => i.vaultAddress)
const strategies = await api.multiCall({ abi: 'address:strategy', calls: rawVaults, permitFailure: true })

const vaults = rawVaults.map((vault, i) => {
const strategy = strategies[i]
if (!strategy) return null
return { vault, strategy }
}).filter(Boolean)

const tokensV = await api.multiCall({ abi: 'address:underlying', calls: vaults.map(({ vault }) => ({ target: vault })), permitFailure: true })
const tokens = await api.multiCall({ abi: 'address:underlying', calls: vaults.map(({ strategy }) => ({ target: strategy })), permitFailure: true })
const bals2 = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: vaults.map(({ vault }) => ({ target: vault })), permitFailure: true })

tokens.forEach((token, i) => {
if (!token) token = tokensV[i]
if (token) api.add(token, bals2[i])
})

return sumTokens2({ api, resolveLP: true, owners: vaults.map(({ vault }) => vault), resolveUniV3: api.chain !== 'base', permitFailure: true })
}

Object.keys(chains).forEach((chain) => {
module.exports[chain] = { tvl }
})
6 changes: 6 additions & 0 deletions projects/helper/bitcoin-book/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ const teleswap = [
'31uHNFfbejkbUD2B26o2CARfU1ALJ6x6Ag', // BOB_LOCKER
'3LNsey3ceG9ZHkQ7bcfAjwnew7KVujHt29', // BRC20_LOCKER
]

const ssiProtocol = [
'1BH4rZH7ptWyjim6fLJDp9t8Jp2DgXiBDM'
]

const bitomato = [
'bc1qgmtx3caf8rlxmzw703ga2sljv3rkkj39e4ysk9',
]
Expand All @@ -120,6 +125,7 @@ module.exports = {
bitomato,
bitlayerBridge,
teleswap,
ssiProtocol,
ainn,
allo,
avalanche,
Expand Down
1 change: 1 addition & 0 deletions projects/helper/chains.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@
"smartbch",
"solana",
"sommelier",
"soneium",
"songbird",
"sonic",
"sophon",
Expand Down
Loading

0 comments on commit 0f9f088

Please sign in to comment.