web icon indicating copy to clipboard operation
web copied to clipboard

Portals - LP Tokens as DeFi Positions

Open gomesalexandre opened this issue 7 months ago • 0 comments

Overview

Preface q. for engineering/product: Is this sane/do we want this

Rationale why we may not: Mixing LPs as assets in wallet, and as in DeFi positions has historically been both confusing for users and a nightmare. However, a counterpoint to this potentionally not being a good idea would be that since those would be read-only opportunities, we could link users to the relevant dApp so that users could manage their position. A counterpoint to the counterpoint however, would be that since users can Zap in/out, why would they want to go to the dApp to manage their position?

Actual Overview

See https://github.com/shapeshift/web/issues/6981#issuecomment-2206869446 - this issue is about displaying LP positions as DeFi positions

  1. How do we display the DeFi positions? ideally: we don't and let Zapper do it effectively: Zapper isn't so good with all chains and will miss many opportunities. IMO, having them as tokens is a good MVP, but eventually, we could use the DeFi opportunities abstraction to parse and upsert https://api.portals.fi/v2/tokens list as DeFi opportunities. For all intents and purposes, the shape is very similar to Zapper's, which will make things relatively easy to work with (effectively a lot of copypasta to do the Zapper/Portals translation)

References and additional details

This guy who does the read-only opportunities thing for Zapper (same idea here) https://github.com/shapeshift/web/blob/657a879247013bfed91fd101704dc83a99941994/src/state/apis/zapper/zapperApi.ts#L104

  • https://github.com/shapeshift/web/pull/7299
  • https://api.portals.fi/v2/tokens
  • https://api.portals.fi/docs#/Account/AccountController_getAccountV2

Acceptance Criteria

  • An RTK API similar to zapperApi (portalsApi) is implemented to handle LP tokens as read-only opportunities
  • Similar to zapperApi, we only fetch data for what users have - we should be able to leverage https://api.portals.fi/docs#/Account/AccountController_getAccountV2 for it

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

gomesalexandre avatar Jul 03 '24 22:07 gomesalexandre