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

Add Morpho Vaults TVL #12316

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
57 changes: 54 additions & 3 deletions projects/moonwell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,72 @@ const moonbeamConfig = {
stakingTokenAddress: '0x511aB53F793683763E5a8829738301368a2411E3'
}

const moonbeamStaking = staking( moonbeamConfig.stakingContract, moonbeamConfig.stakingTokenAddress,)

const baseConfig = {
comptroller: '0xfBb21d0380beE3312B33c4353c8936a0F13EF26C',
stakingContract: '0xe66E3A37C3274Ac24FE8590f7D84A2427194DC17',
stakingTokenAddress: '0xA88594D404727625A9437C3f886C7643872296AE',
vaults: [
{
address: "0xa0E430870c4604CcfC7B38Ca7845B1FF653D0ff1",
decimals: 1e18,
name: "Moonwell Flagship ETH",
symbol: "mwETH",
coingeckoId: "ethereum"
},
{
address: "0xc1256Ae5FF1cf2719D4937adb3bbCCab2E00A2Ca",
decimals: 1e6,
name: "Moonwell Flagship USDC",
symbol: "mwUSDC",
coingeckoId: "usd-coin"
},
{
address: "0xf24608E0CCb972b0b0f4A6446a0BBf58c701a026",
decimals: 1e6,
name: "Moonwell Flagship EURC",
symbol: "mwEURC",
coingeckoId: "euro-coin"
},
]
}

const optimismConfig = {
comptroller: '0xCa889f40aae37FFf165BccF69aeF1E82b5C511B9',
stakingContract: '0xfB26A4947A38cb53e2D083c6490060CCCE7438c5',
stakingTokenAddress: '0xA88594D404727625A9437C3f886C7643872296AE'
}

const moonbeamStaking = staking(moonbeamConfig.stakingContract, moonbeamConfig.stakingTokenAddress,)
const baseStaking = staking(baseConfig.stakingContract, baseConfig.stakingTokenAddress,)
const optimismStaking = staking(optimismConfig.stakingContract, optimismConfig.stakingTokenAddress,)

async function getVaultTVL(api, vaults) {
const bals = await api.multiCall({
abi: "uint256:totalAssets",
calls: vaults.map(vault => vault.address),
});
for (const vault of vaults) {
api.addCGToken(vault.coingeckoId, bals[vaults.map(e => e.address).indexOf(vault.address)] / vault.decimals);
}
}

module.exports = {
moonbeam: compoundExports2({ comptroller: moonbeamConfig.comptroller, cether: '0x091608f4e4a15335145be0a279483c0f8e4c7955' }),
base: compoundExports2({ comptroller: baseConfig.comptroller, }),
base: {
tvl: (api) => new Promise((resolve, reject) => {
compoundExports2({ comptroller: baseConfig.comptroller }).tvl(api).then(() => {
getVaultTVL(api, baseConfig.vaults).then(() => {
resolve();
})
})
}),
borrowed: compoundExports2({ comptroller: baseConfig.comptroller }).borrowed,
},
optimism: compoundExports2({ comptroller: optimismConfig.comptroller, }),
hallmarks: [[1659312000, 'Nomad Bridge Exploit']]
}

module.exports.moonbeam.staking = moonbeamStaking
module.exports.moonbeam.staking = moonbeamStaking
module.exports.base.staking = baseStaking
module.exports.optimism.staking = optimismStaking
Loading