-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Update Vaults, Remove LRT page and All Stake Assets #14418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vvalecha519
wants to merge
5
commits into
DefiLlama:main
Choose a base branch
from
etherfi-protocol:etherfi/update-etherfi-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,96 @@ | ||
const ADDRESSES = require('../helper/coreAssets.json') | ||
const sdk = require('@defillama/sdk') | ||
|
||
const liquidVaults = [ | ||
"0xf0bb20865277aBd641a307eCe5Ee04E79073416C", | ||
"0x08c6F91e2B681FaF5e17227F2a44C307b3C1364C" | ||
] | ||
|
||
const liquidAccountants = [ | ||
"0x0d05D94a5F1E76C18fbeB7A13d17C8a314088198", | ||
"0xc315D6e14DDCDC7407784e2Caf815d131Bc1D3E7" | ||
] | ||
|
||
const vault_config = { | ||
'eth': { | ||
'vaults': [ | ||
'0xf0bb20865277aBd641a307eCe5Ee04E79073416C',//eth liq | ||
'0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88',//weeths | ||
'0x7223442cad8e9cA474fC40109ab981608F8c4273',//weethk | ||
'0x83599937c2C9bEA0E0E8ac096c6f32e86486b410', //beraEth | ||
'0xca8711dAF13D852ED2121E4bE3894Dae366039E4', //move | ||
], | ||
'accountant': [ | ||
'0x0d05D94a5F1E76C18fbeB7A13d17C8a314088198', //eth liq | ||
'0xbe16605B22a7faCEf247363312121670DFe5afBE', //weeths | ||
'0x126af21dc55C300B7D0bBfC4F3898F558aE8156b', //weethk | ||
'0x04B8136820598A4e50bEe21b8b6a23fE25Df9Bd8', //beraEth | ||
'0x075e60550C6f77f430B284E76aF699bC31651f75', //move | ||
], | ||
'base': ADDRESSES.ethereum.EETH, | ||
'decimals': 18 | ||
}, | ||
'btc': { | ||
'vaults': [ | ||
'0x5f46d540b6eD704C3c8789105F30E075AA900726', //btc liq | ||
'0xC673ef7791724f0dcca38adB47Fbb3AEF3DB6C80', //beraBtc | ||
], | ||
'accountant': [ | ||
'0xEa23aC6D7D11f6b181d6B98174D334478ADAe6b0', //btc liq | ||
'0xF44BD12956a0a87c2C20113DdFe1537A442526B5', //beraBtc | ||
], | ||
'base': ADDRESSES.ethereum.EBTC, | ||
'decimals': 8 | ||
}, | ||
'usd': { | ||
'vaults': [ | ||
'0x08c6F91e2B681FaF5e17227F2a44C307b3C1364C', //usd liq | ||
'0x352180974C71f84a934953Cf49C4E538a6F9c997', //exilir | ||
'0xeDa663610638E6557c27e2f4e973D3393e844E70', //mev | ||
'0xbc0f3B23930fff9f4894914bD745ABAbA9588265', //ultra | ||
], | ||
'accountant': [ | ||
'0xc315D6e14DDCDC7407784e2Caf815d131Bc1D3E7', //usd liq | ||
'0xBae19b38Bf727Be64AF0B578c34985c3D612e2Ba', //exilir | ||
'0x1D4F0F05e50312d3E7B65659Ef7d06aa74651e0C', //mev | ||
'0x95fE19b324bE69250138FE8EE50356e9f6d17Cfe', //ultra | ||
], | ||
'base': ADDRESSES.ethereum.USDC, | ||
'decimals': 6 | ||
} | ||
} | ||
|
||
async function updateVaultTvl(api, config) { | ||
const timestamp = api.timestamp | ||
const { vaults, accountant, base } = config | ||
const baseDecimals = config.decimals | ||
const optimism_api = new sdk.ChainApi({ timestamp, chain: 'optimism' }) | ||
|
||
const vaultsSupply = await api.multiCall({ calls: vaults, abi: 'uint256:totalSupply' }) | ||
const quotes = await api.multiCall({ calls: accountant, abi: 'uint256:getRate' }) | ||
const decimals = await api.multiCall({ calls: accountant, abi: 'uint256:decimals' }) | ||
let amount = 0 | ||
for (let i = 0; i < vaultsSupply.length; i++) { | ||
const vaultSupply = vaultsSupply[i] | ||
const quote = quotes[i] | ||
const decimal = decimals[i] | ||
amount += (vaultSupply / 10 ** decimal) * (quote / 10 ** decimal) * 10 ** baseDecimals | ||
} | ||
if(base === ADDRESSES.ethereum.EBTC) { | ||
const wbtc = await optimism_api.call({ target: '0xAB7590CeE3Ef1A863E9A5877fBB82D9bE11504da', abi: 'function categoryTVL(string _category) view returns (uint256)', params: ['liquid-vault-wbtc'] }) | ||
amount -= wbtc | ||
api.add(ADDRESSES.ethereum.WBTC, wbtc) | ||
} else if(base === ADDRESSES.ethereum.EETH) { | ||
const weth = await optimism_api.call({ target: '0xAB7590CeE3Ef1A863E9A5877fBB82D9bE11504da', abi: 'function categoryTVL(string _category) view returns (uint256)', params: ['liquid-vault-weth'] }) | ||
amount -= weth | ||
api.add(ADDRESSES.ethereum.WETH, weth) | ||
} | ||
api.add(base, amount) | ||
} | ||
|
||
|
||
async function tvl(api) { | ||
const optimismApi = new sdk.ChainApi({ chain: 'optimism', timestamp: api.timestamp }) | ||
await optimismApi.getBlock() | ||
const wethBal = await optimismApi.call({ | ||
target: '0xAB7590CeE3Ef1A863E9A5877fBB82D9bE11504da', | ||
abi: 'function categoryTVL(string _category) view returns (uint256)', | ||
params: ['liquid-weth'] | ||
}); | ||
const updatedTimestamp = await optimismApi.call({ | ||
target: '0xAB7590CeE3Ef1A863E9A5877fBB82D9bE11504da', | ||
abi: 'function categoryLastUpdated(string _category) view returns (uint256)', | ||
params: ['liquid-weth'] | ||
}); | ||
|
||
//eth vault | ||
const balETH = await api.call({ | ||
abi: "uint256:totalSupply", | ||
target: liquidVaults[0], | ||
}); | ||
const ethQuote = await api.call({ | ||
target: liquidAccountants[0], | ||
abi: 'function getRate() view returns (uint256)' | ||
}); | ||
if (api.timestamp - updatedTimestamp > 12 * 60 * 60) { | ||
throw new Error('Data is outdated') | ||
for (const config of Object.values(vault_config)) { | ||
await updateVaultTvl(api, config) | ||
} | ||
api.add(ADDRESSES.ethereum.EETH, BigInt(balETH) * BigInt(ethQuote) / BigInt(1e18) - BigInt(wethBal)); | ||
api.add(ADDRESSES.ethereum.WETH, wethBal) | ||
//usdc vault | ||
const balUSD = await api.call({ | ||
abi: "uint256:totalSupply", | ||
target: liquidVaults[1], | ||
}); | ||
const usdQuote = await api.call({ | ||
target: liquidAccountants[1], | ||
abi: 'function getRate() view returns (uint256)' | ||
}); | ||
api.add(ADDRESSES.ethereum.USDC, balUSD * usdQuote / 1e6); | ||
} | ||
|
||
module.exports = { | ||
doublecounted: true, | ||
misrepresentedTokens: true, | ||
ethereum: { | ||
tvl, | ||
tvl: tvl, | ||
}, | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only chain should be Ethereum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is ethfi staking on arbitrum and base. This is why we have multiple chains and this was done before.
The main focus is to have:
correct total etherfi total which should be
tvl: async ({ timestamp }) => { //total tvl not stake tvl
let etherfi_tvl = 0
const api = new sdk.ChainApi({ timestamp, chain: 'optimism' })
const block = await api.getBlock()
//total tvl not stake tvl
if (block < 122693890) {
etherfi_tvl = await api.call({ target: '0x6329004E903B7F420245E7aF3f355186f2432466', abi: 'uint256:getTvl' })
} else {
etherfi_tvl = await api.call({ target: '0xAB7590CeE3Ef1A863E9A5877fBB82D9bE11504da', abi: 'function categoryTVL(string _category) view returns (uint256)', params: ['tvl'] })
}
return {

[nullAddress]: etherfi_tvl
}
}
sum of:
a) EETH totalSupply on Ethereum,
b) EBTC totalSupply on Ethereum, Scroll and Berachain
EUSD on Ethereum and Scroll
Correct liquid tvl which means including all our vaults

Get rid of etherfi Vault page as it is redundant