Skip to content
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
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 55 additions & 4 deletions projects/seamless/index.js
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";
Expand Down Expand Up @@ -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) => {
Copy link
Member

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 :(

Copy link
Author

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.

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, atm we dont support partial doublecounted tvl :(

base: { tvl: SeamlesMorphoVaultsTVL },
},
{ methodology },
]);
Loading