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
bill-clippy authored Apr 15, 2024
2 parents 90f0d0a + cf76e52 commit 31e858c
Show file tree
Hide file tree
Showing 460 changed files with 1,824 additions and 2,342 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions projects/0xzebra/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokensExport } = require('../helper/sumTokens')

module.exports = {
zeta: {
tvl: sumTokensExport({ owner: '0x3aC3d90dc8cB1Cacf1Fd8bc07e4B76c5EA443279', tokens: [ADDRESSES.zeta.WZETA] }),
}
}
16 changes: 2 additions & 14 deletions projects/1bch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,9 @@ const FACTORY = "0x3dC4e6aC26df957a908cfE1C0E6019545D08319b";
const MASTERBREEDER = "0xeC0A7496e66a206181034F86B261DDDC1A2c406E";
const rBCH_WBCH_LP = "0xb9659B524447F53FF1019952A6eeDBb99776Ab4A";
const COREASSETNAME = "bitcoin-cash";
const CHAIN = "smartbch";

async function bchMasterChef(timestamp, ethBlock, {[CHAIN]: block}) {

const stakedBCH = (await sdk.api.erc20.balanceOf({
target: WBCH,
owner: MASTERBREEDER,
chain: CHAIN,
block: block,
decimals: 18
})).output;

return {
[COREASSETNAME]: Number(stakedBCH)
}
async function bchMasterChef(api) {
return api.sumTokens({ owner: MASTERBREEDER, tokens: [WBCH]})
}

const bchDexTvl = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, })
Expand Down
16 changes: 4 additions & 12 deletions projects/2pi/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const sdk = require('@defillama/sdk')
const { getUniqueAddresses } = require('../helper/utils')
const { getConfig } = require('../helper/cache')
const archimedesAbi = require('./archimedes.json')
Expand All @@ -17,21 +16,14 @@ const fetchChainAddresses = async chain => {
}

const fetchTvl = chain => {
return async (_timestamp, _block, chainBlocks) => {
const block = chainBlocks[chain]
return async (api) => {
const addresses = await fetchChainAddresses(chains[chain])
let pools = await Promise.all(addresses.map(i => sdk.api2.abi.fetchList({ withMetadata: true, chain, block, target: i, lengthAbi: archimedesAbi['poolLength'], itemAbi: archimedesAbi['poolInfo'] })))
let pools = await Promise.all(addresses.map(i => api.fetchList({ withMetadata: true, target: i, lengthAbi: archimedesAbi['poolLength'], itemAbi: archimedesAbi['poolInfo'] })))
pools = pools.flat()
const wantTokens = pools.map(i => i.output.want)
const calls = pools.map(i => i.input)
const { output: bal } = await sdk.api.abi.multiCall({
abi: archimedesAbi.balance,
calls,
chain, block,
})
const balances = {}
bal.forEach(({ output}, i) => sdk.util.sumSingleBalance(balances,wantTokens[i],output, chain))
return balances
const bal = await api.multiCall({ abi: archimedesAbi.balance, calls, })
api.add(wantTokens, bal)
}
}

Expand Down
2 changes: 1 addition & 1 deletion projects/Caketomb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
deadFrom: 1648765747,
bsc: {
tvl: async () => ({}),
staking: staking(boardroom, shares, "bsc"),
staking: staking(boardroom, shares),
pool2: pool2Exports(shareRewardPool, pancakeLPs, "bsc", addr=>`bsc:${addr}`)
}
}
2 changes: 1 addition & 1 deletion projects/Equalizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ module.exports = {
misrepresentedTokens: true,
fantom:{
tvl: uniTvlExport("0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
staking: staking("0x8313f3551C4D3984FfbaDFb42f780D0c8763Ce94", "0x3Fd3A0c85B70754eFc07aC9Ac0cbBDCe664865A6","fantom"),
staking: staking("0x8313f3551C4D3984FfbaDFb42f780D0c8763Ce94", "0x3Fd3A0c85B70754eFc07aC9Ac0cbBDCe664865A6"),
},
}
2 changes: 1 addition & 1 deletion projects/FirepotSwap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { getUniTVL } = require('../helper/unknownTokens')

const FACTORY = "0xe63Cf585Dae8273A5e37AfF6da2f823FBf3Eb5BE" // This factory is on AirDAO Mainnet (Chain Id: 16718)

const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, chain: "airdao" })
const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, })

module.exports = {
misrepresentedTokens: true,
Expand Down
2 changes: 1 addition & 1 deletion projects/GoSwap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ module.exports={
misrepresentedTokens: true,
methodology: "Factory address (0xe93c2cD333902d8dd65bF9420B68fC7B1be94bB3) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.",
gochain: {
tvl: getUniTVL({ factory: '0xe93c2cD333902d8dd65bF9420B68fC7B1be94bB3', chain: 'gochain', useDefaultCoreAssets: true }),
tvl: getUniTVL({ factory: '0xe93c2cD333902d8dd65bF9420B68fC7B1be94bB3', useDefaultCoreAssets: true }),
}
}
27 changes: 27 additions & 0 deletions projects/LeaperFinance/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { compoundExports2, } = require('../helper/compound')
const { stakings } = require("../helper/staking")
const { mergeExports } = require("../helper/utils")
const { yieldHelper, } = require("../helper/yieldHelper")

const lend = compoundExports2({ comptroller: '0xB37e4151603bD0A83329CDB3F7AB0Ba608D2b9e4' })

const stake = '0x94C84CdA39fc7099d745Fea787b2e42BAe51B5a5'
const contract = '0x8B0eB5bD61c790E2CC6FB61a08210736ae66B462'
const token = '0x49cD19636855C00Dd0408C0C40e0951a41c4512A'
const abis = {
poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, uint256 accSushiPerShare, uint256 amount, address strat)',
}

const arbi_helper = yieldHelper({
project: 'leaper-finance',
chain: 'blast',
masterchef: contract,
nativeToken: token,
abis,
})

module.exports = mergeExports([
arbi_helper,
{ blast: lend, },
{ blast: { staking: stakings([stake], token) }, }
])
2 changes: 1 addition & 1 deletion projects/LizardExchange/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { getUniTVL } = require('../helper/unknownTokens')
module.exports = {
oasis: {
tvl: getUniTVL({ factory: '0xefA6861931991CCE372c477a015619A21dfEBE8c', chain: 'oasis', useDefaultCoreAssets: true }),
tvl: getUniTVL({ factory: '0xefA6861931991CCE372c477a015619A21dfEBE8c', useDefaultCoreAssets: true }),
}
};
2 changes: 1 addition & 1 deletion projects/Scale/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ module.exports = {
misrepresentedTokens: true,
base:{
tvl: uniTvlExport("0xEd8db60aCc29e14bC867a497D94ca6e3CeB5eC04", "base", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, fetchBalances: true, }),
staking: staking("0x28c9c71c776a1203000b56c0cca48bef1cd51c53", "0x54016a4848a38f257b6e96331f7404073fd9c32c","base"),
staking: staking("0x28c9c71c776a1203000b56c0cca48bef1cd51c53", "0x54016a4848a38f257b6e96331f7404073fd9c32c"),
},
}
2 changes: 1 addition & 1 deletion projects/StrikeX.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const token = "0xd6fdde76b8c1c45b33790cc8751d5b88984c44ec"

module.exports = {

//staking: staking("5867cd4f7e105878afbc903505c207eb7b130a50", "bsc"),
//staking: staking("5867cd4f7e105878afbc903505c207eb7b130a50"),
...masterChefExports(masterchef, "bsc", token)

};
30 changes: 25 additions & 5 deletions projects/ZebraDAO/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
const { compoundExports2 } = require("../helper/compound");
const { staking } = require('../helper/staking')
const { mergeExports } = require("../helper/utils")
const { yieldHelper } = require("../helper/yieldHelper")

module.exports = {
base: compoundExports2({ comptroller: '0xBEA1D596Ae022fae90d84ffaF0907E38a25Ed6E7', cether: '0x4B20dBdd4d5a7A762f788796DF5e0487007C6B36', }),
};
const token = '0xF0ce1d83b5FC9c67F157d8B97fD09E2cF8AF899E'

module.exports.base.staking = staking(
const lend = compoundExports2({ comptroller: '0xBEA1D596Ae022fae90d84ffaF0907E38a25Ed6E7', cether: '0x4B20dBdd4d5a7A762f788796DF5e0487007C6B36', })

const stakings = staking(
['0x0b42A3D7290a94DF04cf4193f62856950A5F5f89', '0x5346fa63509Ed9dEeF2795eD62f5cC84a5F2Ab00'],
'0xF0ce1d83b5FC9c67F157d8B97fD09E2cF8AF899E',
token
)

const contract = '0x3E17cbE7e8597995591088e13dDe7E25B2B34F1F'
const abis = {
poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, uint256 accSushiPerShare, uint256 amount, address strat)',
}
const zebra_vault = yieldHelper({
project: 'ZebraDAO',
chain: 'base',
masterchef: contract,
nativeToken: token,
abis,
})

module.exports = mergeExports([
{ base: lend },
{ base: { staking: stakings } },
zebra_vault,
])
4 changes: 2 additions & 2 deletions projects/aavegotchi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ module.exports = {
tvl: ethTvl,
},
polygon: {
staking: staking(stkGHST_QUICKContract, GHST_Polygon, "polygon"),
staking: staking(stkGHST_QUICKContract, GHST_Polygon),
tvl: polygonTvl,
pool2: staking([stkGHST_QUICKContract], GHST_pools2, "polygon")
pool2: staking([stkGHST_QUICKContract], GHST_pools2)
},
methodology:
`We count liquidity on Vaults from ETHEREUM and Polygon chains through Vault Contracts;
Expand Down
4 changes: 2 additions & 2 deletions projects/adamantfinance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => {

module.exports = {
polygon: {
staking: stakings(stakingContracts_polygon, ADDY, "polygon"),
staking: stakings(stakingContracts_polygon, ADDY),
pool2: pool2Polygon,
tvl: polygonTvl,
},
arbitrum: {
staking: stakings(stakingContracts_Arbitrum, ARBY, "arbitrum"),
staking: stakings(stakingContracts_Arbitrum, ARBY),
tvl: arbitrumTvl,
},
cronos: {
Expand Down
2 changes: 1 addition & 1 deletion projects/agave.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ module.exports = {
borrowed: sdk.util.sumChainTvls([
aaveChainTvl("xdai", addressesProviderRegistryXDAI, addr => `xdai:${addr}`, [protocolDataHelper], true),
]),
staking: staking(agaveStakingContract, agaveTokenAddress, "xdai")
staking: staking(agaveStakingContract, agaveTokenAddress)
}
}
6 changes: 5 additions & 1 deletion projects/ainn-layer2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ const BTCOwners = [
"39Fvw2Ho1fEkyDsos5sNTN5iMJZKzTL526",
"3Kptt4TZZRcjuGH8ikoQ8mV1TVxq45dnuS",
"3G4sMXWAAVTvTXTksr8u9zuu7W8RKsicEz",
"335DRGzLLG2tu4H4PnFBHYAwcj5pvV8zei"
"335DRGzLLG2tu4H4PnFBHYAwcj5pvV8zei",
"bc1qqg3cdyadq25zn99sdprr4lgpsxg2za998eygy8",
"bc1qw4vp94e9egkaxc04qsu5z9aq5pqpku2p6pzer8",
"bc1q3q7afjarz7l6v49538qs2prffhtawf38ss85k8",
"bc1q3smt9ut40eld6tgn42sdlp9yrx98s90unqw3pl"
];


Expand Down
57 changes: 21 additions & 36 deletions projects/airpuff/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//import utils
const ADDRESSES = require("../helper/coreAssets.json");

const contractAbis = {
readOraclePrice: "function read() view returns (int224 value, uint32 timestamp)",
balanceOf: "function balanceOf(address) external view returns (uint256)",
Expand All @@ -27,7 +26,14 @@ module.exports = {

const ezETH = {
vault: "0x497eB27Ca1ed7566653edf811b03d6418a03FC9d",
reStakingToken: "0x2416092f143378750bb29b79eD961ab195CcEea5",
reStakingToken: ADDRESSES.blast.ezETH,
oracle: "0x2BAF3A2B667A5027a83101d218A9e8B73577F117", //Renzo
oracleToken: "0x59e710215d45f584f44c0fee83da6d43d762d857",
};

const ezETH1x = {
vault: "0x9c96d0Cc5341654167ee35DB4F288ae523fe8779",
reStakingToken: ADDRESSES.blast.ezETH,
oracle: "0x2BAF3A2B667A5027a83101d218A9e8B73577F117", //Renzo
oracleToken: "0x59e710215d45f584f44c0fee83da6d43d762d857",
};
Expand All @@ -38,6 +44,12 @@ module.exports = {
params: [ezETH.vault],
});

const balOfezETH1x = await api.call({
abi: contractAbis.balanceOf,
target: ezETH.reStakingToken,
params: [ezETH1x.vault],
});

const priceOfezETH = await api.call({
target: ezETH.oracle,
abi: contractAbis.getUnderlyingPrice,
Expand All @@ -46,7 +58,10 @@ module.exports = {

const ezETHBalInETH = (balOfezETH * priceOfezETH) / 1e18;

const ezETH1xBalInETH = (balOfezETH1x * priceOfezETH) / 1e18;

api.add(ADDRESSES.mode.WETH, ezETHBalInETH);
api.add(ADDRESSES.mode.WETH, ezETH1xBalInETH);
},
},

Expand Down Expand Up @@ -149,7 +164,7 @@ module.exports = {
target: svETH.vault,
});

const strategies = [ezETH, weETH, rsETH, ezETH1x, weETH1x, rsETH1x, bedRockETH, bedRockETH1x];
const strategies = [ezETH, weETH, rsETH, ezETH1x, weETH1x, rsETH1x, bedRockETH, bedRockETH1x, svETH1x, svETH];

for (const strategy of strategies) {
const bal = await api.call({
Expand All @@ -174,37 +189,6 @@ module.exports = {

api.add(ADDRESSES.ethereum.WETH, balInETH);
}
//strategy with no oracle, but can calculate price using erc4626 totalSupply and totalAssets
const LiquidETH = {
vault: "0xE543eBa28a3793d5ae747A2164A306DB1767cDAe",
reStakingToken: "0xeA1A6307D9b18F8d1cbf1c3Dd6aad8416C06a221",
};

const erc4626Strategies = [LiquidETH];

for (const erc4626strategy of erc4626Strategies) {
const bal = await api.call({
abi: contractAbis.balanceOf,
target: erc4626strategy.reStakingToken,
params: [erc4626strategy.vault],
});

const totalAssets = await api.call({
abi: contractAbis.getTotalAssets,
target: erc4626strategy.reStakingToken,
});

const totalSupply = await api.call({
abi: contractAbis.getTotalSupply,
target: erc4626strategy.reStakingToken,
});

const price = totalAssets / totalSupply;

const balInETH = bal * price;

api.add(ADDRESSES.ethereum.WETH, balInETH);
}

const mswETH = {
vault: "0x7c505E03460aEF7FE88e218CC5fcEeCCcA4C4394",
Expand Down Expand Up @@ -245,6 +229,7 @@ module.exports = {
}
},
},
//-----------------------------------------------------------------------//

arbitrum: {
tvl: async (api) => {
Expand Down Expand Up @@ -272,7 +257,7 @@ module.exports = {
// leverage users
const ezETH = {
vault: "0x6295248F578bFA9c057a3e1182BED27121530E7A",
reStakingToken: "0x2416092f143378750bb29b79eD961ab195CcEea5",
reStakingToken: ADDRESSES.blast.ezETH,
oracle: "0x28c1576eb118f2Ccd02eF2e6Dbd732F5C8D2e86B", //Renzo
};

Expand All @@ -290,7 +275,7 @@ module.exports = {

const ezETH1x = {
vault: "0x0bAc1a3D569c16D8AD9D3aB37f61dAF18DCfF781" /*vault*/,
reStakingToken: "0x2416092f143378750bb29b79eD961ab195CcEea5" /*reStakingToken*/,
reStakingToken: ADDRESSES.blast.ezETH /*reStakingToken*/,
oracle: "0x28c1576eb118f2Ccd02eF2e6Dbd732F5C8D2e86B" /*oracle*/,
};
const weETH1x = {
Expand Down
Loading

0 comments on commit 31e858c

Please sign in to comment.