-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Fix Turtle Club TVL #16646
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
ftarantuviez
wants to merge
20
commits into
DefiLlama:main
Choose a base branch
from
turtle-dao: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.
Open
Fix Turtle Club TVL #16646
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
291a61d
Turtle Club Treasury & TVL
Ralphy105 bfc23e0
Added Solidly NFTs to treasury adapter
Ralphy105 6986802
add/change treasury assets
Ralphy105 6e9bc5a
Erc721 fixes and add exception tokens
Ralphy105 9f94653
asset changes (now hits 7.44m/7.74m)
Ralphy105 6168376
asset recommenting
Ralphy105 562e2b2
update assets
Ralphy105 61a57d7
Merge branch 'main' into main
Ralphy105 c2f2c3c
Add eUSDC-2 and Morpho
Ralphy105 bd7e666
price usdc2 at usdc
Ralphy105 90588a4
Merge branch 'main' of https://github.com/turtle-dao/DefiLlama-Adapters
Ralphy105 b6c7e89
Merge branch 'DefiLlama:main' into main
Ralphy105 8585f14
remove try catch
Ralphy105 2bc7506
Merge branch 'main' of https://github.com/turtle-dao/DefiLlama-Adapters
Ralphy105 5c42fee
Merge branch 'DefiLlama:main' into main
Ralphy105 33e93ba
Add etherex staking position and lagoon vaults
Ralphy105 f9ad5f5
not forgetting the doublecounted param
Ralphy105 2891520
Merge branch 'DefiLlama:main' into main
Ralphy105 a09cdcb
fix: turtle tvl
ftarantuviez d2d5975
Merge branch 'DefiLlama:main' into main
ftarantuviez 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const { log } = require("../helper/utils"); | ||
|
||
|
||
const getVaultsERC20Tvl = async (api, vaults) => { | ||
for (const vault of vaults) { | ||
try { | ||
// Get total supply of the boring vault token | ||
const totalSupply = await api.call({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we count the underlying collateral rather than the receipt token supply? |
||
abi: 'erc20:totalSupply', | ||
target: vault, | ||
}); | ||
|
||
// Add the vault token to balances with its total supply | ||
// The vault token itself represents the TVL | ||
api.add(vault, totalSupply); | ||
} catch (error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please no try/catch |
||
log(`Error fetching data for boring vault:`, error.message); | ||
} | ||
} | ||
} | ||
|
||
const getERC4626VaultsTvl = async (api, vaults) => { | ||
for (const vault of vaults) { | ||
try { | ||
// Get the underlying asset from the vault | ||
const asset = await api.call({ | ||
abi: 'function asset() view returns (address)', | ||
target: vault, | ||
}); | ||
|
||
// Get total assets from the morpho vault | ||
const totalAssets = await api.call({ | ||
abi: 'function totalAssets() view returns (uint256)', | ||
target: vault, | ||
}); | ||
|
||
|
||
// Add the underlying asset with the total assets amount | ||
// This represents the actual underlying assets held by the vault | ||
api.add(asset, totalAssets); | ||
|
||
} catch (error) { | ||
log(`Error fetching data for morpho vault ${vault}:`, error.message); | ||
// Continue with other vaults if one fails | ||
} | ||
} | ||
} | ||
|
||
module.exports = { | ||
getVaultsERC20Tvl, | ||
getERC4626VaultsTvl, | ||
} |
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,17 +1,31 @@ | ||
const { sumTokensExport } = require("../helper/unwrapLPs"); | ||
const { tokens, vaultContracts } = require("./assets"); | ||
|
||
const plainTokens = Object.values(tokens).map(chain => Object.values(chain)).flat(1); | ||
|
||
const { getVaultsERC20Tvl, getERC4626VaultsTvl } = require("./helpers"); | ||
const { turtleVaults } = require("./assets"); | ||
|
||
module.exports = { | ||
// All vaults currently ethereum | ||
doublecounted: true, | ||
ethereum: { | ||
tvl: sumTokensExport({ | ||
owners: vaultContracts, | ||
tokens: plainTokens, | ||
permitFailure: true, | ||
tokenConfig: { onlyWhitelisted: false }, | ||
}), | ||
tvl: async (api) => { | ||
const erc20Vaults = turtleVaults.ethereum.filter(vault => vault.strategy === "erc20").map(vault => vault.address); | ||
|
||
// Handle Boring Vaults | ||
await getVaultsERC20Tvl(api, erc20Vaults); | ||
const erc4626Vaults = turtleVaults.ethereum.filter(vault => vault.strategy === "erc4626").map(vault => vault.address); | ||
|
||
// Handle Morpho Vaults | ||
await getERC4626VaultsTvl(api, erc4626Vaults); | ||
|
||
return api.getBalances(); | ||
}, | ||
}, | ||
linea: { | ||
tvl: async (api) => { | ||
const erc4626Vaults = turtleVaults.linea.filter(vault => vault.strategy === "erc4626").map(vault => vault.address); | ||
|
||
// Handle ERC4626 Vaults | ||
await getERC4626VaultsTvl(api, erc4626Vaults); | ||
|
||
return api.getBalances(); | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
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
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.
I dont think this mapping is required https://coins.llama.fi/prices/current/linea:0xe4eeb461ad1e4ef8b8ef71a33694ccd84af051c4