Agoric / dapp-inter

User application for Agoric Inter Protocol—Vaults, BLD Boost, Liquidations, etc.
2 stars 7 forks source link

Implement one-click any-to-any asset onboarding feature via Leap Elements #210

Closed otoole-brendan closed 6 months ago

otoole-brendan commented 8 months ago

What is the Problem Being Solved?

A user's experience/journey to get a supported PSM or collateral asset over to the Agoric chain in order to be able to use Inter apps is not intuitive, is confusing and requires broad knowledge of IBC infrastructure and it's nuances (differnt ibc denoms etc for assets coming from different chains).

This experience makes it painful and frustrating to easily interact with Inter apps - resulting in user drop-off and ultimately loss of business/TVL.

Note this is a part of the Product's End User UX and Asset Onboarding project/rock for Q4

Current Flow

  1. User navigates to app.inter.trade
  2. User connects wallet (let's assume they have a smart wallet provisioned)
  3. User attempts to open an stATOM vault but discovers they can't because they have no stATOM on Agoric chain. They could either: a) have no crypto at all and so need fiat onramp to purchase BLD/IST. This might be all they're after or they might then swap that on Osmosis for stATOM and then mint more IST against it. b) have Ethereum assets and so need to bridge them over to Cosmos before swapping them to stATOM c) have other IBC assets but need to complete Cosmos swap to get stATOM d) have stATOM on another Cosmos chain but need to get it to Agoric chain
  4. For a) that user needs to leave the app and go to kado.money to use CC to buy IST or BLD
  5. For b) that user needs to leave the app and go to satellite.money, gravity bridge or app.squidrouter.com to bridge for example USDC from Ethereum to axl.USDC or similar to Osmosis or Crescent, then swap for stATOM and lastly send to Agoric chain before navigating back to app.
  6. For c) that user needs to leave the app to use ibc.fun or similar Cosmos cross-chain swap which utilizes Skip API to swap from one IBC asset they have to stATOM on the Agoric chain then return to the app
  7. For d) that user would either have to leave the app to go to wallet UI to IBC transfer to the Agoric chain then return to app or use Keplr IBC send functionality via pop-up

Description of the Design

This user onboarding/onramp can be massively improved upon by integrating Leap Elements or the Skip API. Leap elements is a FE SDK that provides several one-click solutions depending on the user's status - it can be easily integrated on our FE and utilizes Skip API, Squid and Kado.

A full Skip API integration offers the cross-chain swap utility similar to Leap Elements and Post-route actions (read: open a vault in same transaction as cross-chain swap). While this is an even greater simplification for the user - this integration is more expensive - plus it wouldn't include Kado and Squid so we'd likely have to integrate those separately.

Given this Leap Elements seems to be offer the highest value for the cheapest cost.

New Flow with Leap Elements:

  1. As above
  2. As above
  3. User attempts to open an stATOM vault but discovers they can't because they have no stATOM on Agoric chain.
  4. User hits 'Deposit stATOM' button which launches the Leap Elements widget/modal. Depending on what they need they select 'Cosmos Swap', 'IBC Transfer/Send', 'Fiat On-ramp' or 'Cross Chain Swap' on the left pane, enter 'From' and 'To' from dropdowns including chain and token, enter amount and one-click to transact.
  5. their stATOM balances updates on the Agoric chain and the user is able to open a vault
image

Security Considerations

TBC

Test Plan

TBC

otoole-brendan commented 8 months ago

@samsiegart could you please provide a quick estimate on this? Also if you can check it's viability by confirming it works with Keplr? How do we think offer legibility would work with this, especially with the cross-chain swaps with Skip API?

samsiegart commented 7 months ago

@samsiegart could you please provide a quick estimate on this? Also if you can check it's viability by confirming it works with Keplr? How do we think offer legibility would work with this, especially with the cross-chain swaps with Skip API?

Quick estimate is 5 points

It should work in Keplr, yea. I asked the leap team in discord and they pointed me to https://cosmos.leapwallet.io/transact/bridge as an example that uses elements and it did work with Keplr

Offer legibility wouldn't be applicable with the swaps unfortunately, since it's not going through Zoe

otoole-brendan commented 7 months ago

@samsiegart let's sync to understand how much we can customize. For example, can we determine what assets users can use Kado to onboard to (we'd want to limit to IST, BLD, Inter assets, PSM assets). Similarly - we shouldn't let users send non-supported assets to Agoric chain if there is no use for them there. There are also performance considerations.

Allow listed assets we should let them send to Agoric chain (and be onboardable via Kado):

What would be the process to update later when future assets are added as Vault collateral for example?

zmanian commented 7 months ago

It would be better to replace the entire deposit flow with Leap elements than the currently non-working statom desposit flow

otoole-brendan commented 7 months ago

@zmanian Thats the plan. When they hit 'Deposit stATOM' in app it'll bring up the Leap Elements modal instead of bringing them to Wallet UI where they can only IBC transfer to Agoric chain

samsiegart commented 6 months ago

Trying to integrate leap elements as documented:

otoole-brendan commented 6 months ago

Have reviewed the UX/design and looks good. Note - Kado are fixing issue to make Agoric destination available. Kado can be added later but for the sake of the Vaults deposit funds flow - it's not critical (users who are trying to open a vault are locking up other assets and are not looking to buy IST with credit card)