-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Update New Vaults : Upshift #16908
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
krishnafractol
wants to merge
12
commits into
DefiLlama:main
Choose a base branch
from
krishnafractol:main
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.
+95
−6
Open
Update New Vaults : Upshift #16908
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2f022db
Updated Pools in Upshift
krishnafractol 4d852d9
Merge branch 'DefiLlama:main' into main
krishnafractol 426b493
Updated New Pools
krishnafractol f1bfb37
Merge branch 'DefiLlama:main' into main
krishnafractol 1ca5254
Merge branch 'DefiLlama:main' into main
krishnafractol e19a2c1
Updated Upshift Vaults
krishnafractol a3e0595
Merge branch 'DefiLlama:main' into main
krishnafractol e673338
Merge branch 'DefiLlama:main' into main
krishnafractol 80ab654
Updated New Vaults and Sui TVL
krishnafractol ccbee9e
Merge branch 'DefiLlama:main' into main
krishnafractol a8ed7e0
Updated the Sui Vault to use RPC
krishnafractol 026ea81
removed console
krishnafractol 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,72 @@ | ||
| const { sumERC4626VaultsExport } = require('../helper/erc4626') | ||
| const abi = require('./vaultsv2.json') | ||
| const { getConfig } = require('../helper/cache') | ||
|
|
||
| const suiVaultsEndpoint = "https://vaults.api.sui-prod.bluefin.io/api/v1/vaults"; | ||
|
|
||
| const config = { | ||
| ethereum: ["0xB7858b66dFA38b9Cb74d00421316116A7851c273", "0x80E1048eDE66ec4c364b4F22C8768fc657FF6A42", "0x18a5a3D575F34e5eBa92ac99B0976dBe26f9F869", "0xEBac5e50003d4B17Be422ff9775043cD61002f7f", "0xd684AF965b1c17D628ee0d77cae94259c41260F4", "0x5Fde59415625401278c4d41C6beFCe3790eb357f", "0xe1B4d34E8754600962Cd944B535180Bd758E6c2e", "0xc824A08dB624942c5E5F330d56530cD1598859fD","0xeb402fc96C7ed2f889d837C9976D6d821c1B5f01", "0x419386E3Ef42368e602720CC458e00c0B28c47A7", "0xB78dAf3fD674B81ebeaaa88d711506fa069E1C5E","0x7383c2454D23A1e34B35ba02674be0a41Bd5aa56","0xc428439fB7B1EFE56360Eb837Ca98F551fdD9B26","0x686c83Aa81ba206354fDcbc2cd282B4531365E29","0x396A3f77EE1faf5A3C46e878bA7b7a2dcbe55517", "0xE9B725010A9E419412ed67d0fA5f3A5f40159D32", "0x828BC5895b78b2fb591018Ca5bDC2064742D6D0f", "0x8AcA0841993ef4C87244d519166e767f49362C21"], | ||
| ethereum: ["0x69FC3f84FD837217377d9Dae0212068cEB65818e","0xdA89af5bF2eb0B225d787aBfA9095610f2E79e7D","0xEAA3b922E9fEbCa37d1c02D2142A59595094C605","0xf7b65fBA4d02110089fC6e2bE6d73809b45852f8","0x6625bA54DC861e9f5c678983dBa5BA96d19a9224","0x787f5541Ee40cD0c94175251686DDBbcf69A7344","0xD066649Bcb7d8D3335fE29CaD0AED6E17D5828B5","0x02991EE6134dEE504668e2227C5879Dd78EfCDc3","0x998D7b14c123c1982404562b68edDB057b0477cB","0x0985C88929A776a2E059615137a48bA5A473E25D","0xB7858b66dFA38b9Cb74d00421316116A7851c273", "0x80E1048eDE66ec4c364b4F22C8768fc657FF6A42", "0x18a5a3D575F34e5eBa92ac99B0976dBe26f9F869", "0xEBac5e50003d4B17Be422ff9775043cD61002f7f", "0xd684AF965b1c17D628ee0d77cae94259c41260F4", "0x5Fde59415625401278c4d41C6beFCe3790eb357f", "0xe1B4d34E8754600962Cd944B535180Bd758E6c2e", "0xc824A08dB624942c5E5F330d56530cD1598859fD","0xeb402fc96C7ed2f889d837C9976D6d821c1B5f01", "0x419386E3Ef42368e602720CC458e00c0B28c47A7", "0xB78dAf3fD674B81ebeaaa88d711506fa069E1C5E","0x7383c2454D23A1e34B35ba02674be0a41Bd5aa56","0xc428439fB7B1EFE56360Eb837Ca98F551fdD9B26","0x686c83Aa81ba206354fDcbc2cd282B4531365E29","0x396A3f77EE1faf5A3C46e878bA7b7a2dcbe55517", "0xE9B725010A9E419412ed67d0fA5f3A5f40159D32", "0x828BC5895b78b2fb591018Ca5bDC2064742D6D0f", "0x8AcA0841993ef4C87244d519166e767f49362C21", "0x866C6c6627303Be103814150fC0e886BE5D9ea83"], | ||
| avax: ["0x3408b22d8895753C9A3e14e4222E981d4E9A599E", "0xB2bFb52cfc40584AC4e9e2B36a5B8d6554A56e0b"], | ||
| base: ["0x4e2D90f0307A93b54ACA31dc606F93FE6b9132d2"], | ||
| hyperliquid: ["0x96C6cBB6251Ee1c257b2162ca0f39AA5Fa44B1FB"], | ||
| hyperliquid: ["0x96C6cBB6251Ee1c257b2162ca0f39AA5Fa44B1FB", "0xc061d38903b99aC12713B550C2CB44B221674F94" ], | ||
| bsc: ["0xD0b717ef23817b1a127139830Cf0FcD449ef74F0"], | ||
| mezo: ["0x221B2D9aD7B994861Af3f4c8A80c86C4aa86Bf53"] | ||
| } | ||
|
|
||
| const v2Vaults = { | ||
| ethereum: ["0xAEEb2fB279a5aA837367B9D2582F898a63b06ca1","0xA38d92eC538e9aa3edb980b89701A9d38a1FE015","0x63C5d615e937697a80606788965E209414738820","0x18EE038C114a07f4B08b420fb1E4149a4F357249","0x3cC0D33B1AEac3d23eA89214b3AC5B4607032167","0x0C949AAf28bF0318bAa5f2cbF2F2D970f57879aB","0xd411aCaE2Bc7019322277A21ff005d94705661C5"], | ||
| hyperliquid: ["0x8fFDcd8A96d293f45aA044d10b899F9D71897E8a" ], | ||
| plasma: ["0x517677A19D8ae6FF600FB86C3C7bFCCD651e3eec"], | ||
| } | ||
|
|
||
|
|
||
|
|
||
| // Custom function to handle v2 vaults with getTotalAssets | ||
| async function sumV2Vaults(api, vaults) { | ||
| const assets = await api.multiCall({ abi: abi[1], calls: vaults }) | ||
| const totalAssets = await api.multiCall({ abi: abi[0], calls: vaults }) | ||
|
|
||
| api.addTokens(assets, totalAssets) | ||
| } | ||
|
|
||
| // Merge all chains from both configs | ||
| const allChains = new Set([...Object.keys(config), ...Object.keys(v2Vaults)]) | ||
|
|
||
| const suiVaultsTvl = async () => { | ||
| const vaults = await getConfig('upshift/suiVaults',suiVaultsEndpoint); | ||
| const totalTvl = vaults.filter(vault => vault.status === "active").reduce((acc, vault) => { | ||
| acc += vault.totalDepositsInUsdE9 / 1e9; | ||
| return acc; | ||
| }, 0); | ||
| return { | ||
| usd: totalTvl, | ||
| }; | ||
| } | ||
|
|
||
| module.exports = { | ||
| doublecounted: true, | ||
| methodology: "TVL is the sum of tokens deposited in erc4626 vaults", | ||
| } | ||
|
|
||
| Object.keys(config).forEach(chain => { | ||
| allChains.forEach(chain => { | ||
| module.exports[chain] = { | ||
| tvl: sumERC4626VaultsExport({ vaults: config[chain], isOG4626: true }) | ||
| tvl: async (api) => { | ||
| // Handle ERC4626 vaults if they exist for this chain | ||
| if (config[chain]) { | ||
| await api.erc4626Sum({ calls: config[chain], isOG4626: true }) | ||
| } | ||
|
|
||
| // Handle v2 vaults if they exist for this chain | ||
| if (v2Vaults[chain]) { | ||
| await sumV2Vaults(api, v2Vaults[chain]) | ||
| } | ||
|
|
||
| return api.getBalances() | ||
| } | ||
| } | ||
| }) | ||
| }) | ||
|
|
||
|
|
||
|
|
||
| module.exports.sui = { | ||
| tvl: suiVaultsTvl, | ||
| } | ||
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [ | ||
| { | ||
| "inputs": [], | ||
| "name": "getTotalAssets", | ||
| "outputs": [ | ||
| { | ||
| "internalType": "uint256", | ||
| "name": "", | ||
| "type": "uint256" | ||
| } | ||
| ], | ||
| "stateMutability": "view", | ||
| "type": "function" | ||
| }, | ||
| { | ||
| "inputs": [], | ||
| "name": "asset", | ||
| "outputs": [ | ||
| { | ||
| "internalType": "address", | ||
| "name": "", | ||
| "type": "address" | ||
| } | ||
| ], | ||
| "stateMutability": "view", | ||
| "type": "function" | ||
| } | ||
| ] |
Oops, something went wrong.
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.
can we please read token balances from the sui RPC instead?
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.
Updated it