-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat: add Seamless Morpho vaults to TVL #13129
Open
fredwes
wants to merge
1
commit into
DefiLlama:main
Choose a base branch
from
seamless-protocol: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.
+55
−4
Open
Changes from all commits
Commits
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 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,9 +1,13 @@ | ||
const { aaveExports } = require("../helper/aave"); | ||
const { getLogs2 } = require("../helper/cache/getLogs"); | ||
const { sumTokens2 } = require("../helper/unwrapLPs"); | ||
const abi = require("./abis.json"); | ||
const { mergeExports } = require("../helper/utils"); | ||
const methodologies = require("../helper/methodologies"); | ||
|
||
const SEAMLESS_GOVERNOR_SHORT_TIMELOCK = "0x8768c789C6df8AF1a92d96dE823b4F80010Db294"; | ||
const MORPHO_VAULTS_FACTORY_v1_1 = "0xFf62A7c278C62eD665133147129245053Bbf5918"; | ||
|
||
const AAVE_ADDRESSES_PROVIDER_REGISTRY = "0x90C5055530C0465AbB077FA016a3699A3F53Ef99"; | ||
const AAVE_POOL_DATA_PROVIDER = "0x2A0979257105834789bC6b9E1B00446DFbA8dFBa"; | ||
const GEYSER_REGISTRY = "0xD5815fC3D736120d07a1fA92bA743c1167dA89d8"; | ||
|
@@ -44,7 +48,54 @@ async function geyserTvl(api) { | |
|
||
const baseAAVE = aaveExports("base", AAVE_ADDRESSES_PROVIDER_REGISTRY, undefined, [AAVE_POOL_DATA_PROVIDER], { v3: true }); | ||
|
||
module.exports = mergeExports([{ | ||
methodology: methodologies.lendingMarket, | ||
base: baseAAVE, | ||
}, { base: { tvl: geyserTvl } }]); | ||
const SeamlesMorphoVaultsTVL = async (api) => { | ||
const allVaults = ( | ||
await getLogs2({ | ||
api, | ||
factory: MORPHO_VAULTS_FACTORY_v1_1, | ||
eventAbi: | ||
"event CreateMetaMorpho(address indexed metaMorpho, address indexed caller, address initialOwner, uint256 initialTimelock, address indexed asset, string name, string symbol, bytes32 salt)", | ||
fromBlock: 24831748, | ||
}) | ||
).map((log) => log.metaMorpho); | ||
|
||
const allVaultOwners = await api.multiCall({ | ||
calls: allVaults, | ||
abi: "function owner() public view returns (address)", | ||
}); | ||
|
||
const seamlessMorphoVaults = allVaults.filter( | ||
(_, i) => | ||
allVaultOwners[i].toLowerCase() === | ||
SEAMLESS_GOVERNOR_SHORT_TIMELOCK.toLowerCase() | ||
); | ||
|
||
const underlyingAssets = await api.multiCall({ | ||
calls: seamlessMorphoVaults, | ||
abi: "function asset() public view returns (address)", | ||
}); | ||
const totalAssets = await api.multiCall({ | ||
calls: seamlessMorphoVaults, | ||
abi: "function totalAssets() public view returns (uint256)", | ||
}); | ||
|
||
underlyingAssets.forEach((asset, i) => { | ||
api.add(asset, totalAssets[i]); | ||
}); | ||
|
||
return api.getBalances(); | ||
}; | ||
|
||
const methodology = `Counts the tokens deposited in Seamless Protocol owned vaults even when those vaults exist on other protocols (this is marked as double counted). Other sources of TVL are not double counted such as lending market TVL which follows uses the following methodology: ${methodologies.lendingMarket}`; | ||
|
||
module.exports = mergeExports([ | ||
{ | ||
base: baseAAVE, | ||
}, | ||
{ base: { tvl: geyserTvl } }, | ||
{ | ||
doublecounted: true, | ||
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. hmm, atm we dont support partial doublecounted tvl :( |
||
base: { tvl: SeamlesMorphoVaultsTVL }, | ||
}, | ||
{ methodology }, | ||
]); |
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.
we can create a new sublisting for this, but how do these vaults work? can users borrow against their deposits here? other issue is, even if your team is curating the morpho vaults, the tvl belongs to morpho project. We are thinking of adding curator category to tackle this, but atm, we reject curator projects :(
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.
These vaults will lend assets to Morpho borrowing markets (rebalancing across markets to obtain the best risk adjusted yield), users cannot borrow against these assets as collateral, it's the same as other yield vaults like those on Yearn or Beefy that allocate to Aave, Compound, Morpho, etc. Seamless protocol in this case is the owner of these vaults NOT the curator. Seamless Protocol governance controls these vaults and earns the fees not Morpho, although we did deploy them using a factory contract that was deployed by Morpho vs forking or building from scratch a separate ERC4626 vault contract like other Seamless vault contracts.