Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

feat(apps: morpho): Morpho Blue support #3186

Closed
wants to merge 9 commits into from

Conversation

tomrpl
Copy link

@tomrpl tomrpl commented Jan 24, 2024

Description

Checklist

  • I have followed the Contributing Guidelines
  • (optional) As a contributor, my Ethereum address/ENS is:
  • (optional) As a contributor, my Twitter handle is: @TomReppelin

How to test?

  • Morpho Blue adapter.

Test it by running

pnpm build && pnpm start

and go there:

http://localhost:5001/apps/morpho/positions?network=ethereum&groupIds%5B%5D=morpho-blue


Important note:

  1. The wbIB01 token is not supported yet:
    https://etherscan.io/address/0xcA2A7068e551d5C4482eb34880b194E4b945712F

Thus the market with the id:
0x495130878b7d2f1391e21589a8bcaef22cbc7e1fbbd6866127193b3cc239d8b1
(more info here: https://docs.morpho.org/addresses#morpho-blue-whitelisted-markets
is not supported)

  1. The collateral computation can't be done easily onchain, thus the subgraph fetch is forced here

One should see something like this:
image

Thanks!

@tomrpl tomrpl changed the title Feat(apps: morpho): Morpho Blue support feat(apps: morpho): Morpho Blue support Jan 24, 2024
@wpoulin
Copy link
Contributor

wpoulin commented Jan 24, 2024

Studio will be shutdown today in favor of codeless app integrations... meaning I'll have to do the implementation. It will be much faster since you've already done much of the work 🚀

  • We are moving away from data coming from external sources like subgraph and APIs because we do not have any control over the reliability and it's kinda slow.. From what I saw, collateral isn't mandatory for the position neither for balances and it's solely used for TVL purposes ?

Thanks for your contribution !

@tomrpl
Copy link
Author

tomrpl commented Jan 24, 2024

Hey, precisely, collateral amount on a given market is used only for the TVL.

The other collateral value used is for a user's position, query-able directly via the multicall so good on this point!

Let me know if there is anything I can do on my side, cheers!

@wpoulin
Copy link
Contributor

wpoulin commented Jan 24, 2024

I've done the implementation on our side
https://zapper.xyz/apps/ethereum/morpho?tab=assets&appPrimaryGroup=Morpho%20Blue%20markets&page=1

I'll add the missing underlying in a moment and the missing markets will automatically populate as soon as app tokens are implemented.

Do you mind if I close the PR ? Here's the official announcement about Studio https://twitter.com/zapper_fi/status/1750232224673259913

@tomrpl
Copy link
Author

tomrpl commented Jan 24, 2024

Thanks @wpoulin
Potentially for the next version, will it be possible to add any metadata? Feels a bit weird to have lots of USDC, but I imagine that it will be different in the next version!
Thanks for the update!

image

@wpoulin
Copy link
Contributor

wpoulin commented Jan 24, 2024

USDC is showing up because of

  async getImages({ contractPosition }: GetDisplayPropsParams<T>): Promise<string[]> {
    return getImagesFromToken(contractPosition.tokens[0]);
  }

tokens[0] is ⬇️ which is USDC and ETH for the current markets

  async getTokenDefinitions({ definition }: GetTokenDefinitionsParams<T, MorphoContractPositionDefinition>) {
  return [
    {
      metaType: MetaType.SUPPLIED,
      address: definition.loanTokenAddress,
      network: this.network,
    },
    ```
    I've sent you a friend request on Discord for us to keep the conversation going. Will close this PR

@wpoulin wpoulin closed this Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants