Agoric / dapp-inter

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

FE for IBC asset transfer #34

Closed otoole-brendan closed 1 year ago

otoole-brendan commented 1 year ago

What is the Problem Being Solved?

Current Vaults design requires users to have their collateral asset on the Agoric Chain to be able to create a vault (or add more collateral to a vault).

Users need to be able to transfer their ATOM for example from it's source chain (Cosmos Hub) to Agoric Chain either before or during vault creation in order to be able to lock up that collateral and create a vault/mint IST.

Absence of a suitable FE for this forces users to user Keplr's manual IBC transfer method which is at best a clunky, error-prone awful experience and at worst a reputation-damaging, user-repellant that will all but guarantee low uptake/use.

Description of the Design

There are two ways to approach this thatI know of 1) add deposit/withdraw feature to Agoric Smart Wallet where user will need to initiate and complete asset transfer (a al Osmosis) or 2) add an asset transfer model/FE to the Vaults UI that guides users through each step, initiates the transactions, notifies user to approve in wallet etc, completes transfer, then shows the users updated asset balance on Agoric chain that they is now available to lock up as collateral

The first option would mean the user having to spend more time in their smart wallet, something Product agrees we want to avoid (fragmented experience amongst others). The second option is better UX overall, more seamless and certain to delight users (although it's likely expected by users in which case they will appreciate us keeping in line with others).

(This design mock-up by Ekko is in progress.)

Storytime:

-Peter has completed transferring the assets he wishes to use as collateral to the Agoric chain and is ready to configure vault/lock-up collateral. -Peter can now see he has 100ATOM available on the Agoric chain that he can lock up as collateral. -Peter completes configuration of his vault, submits the offer to his Smart Wallet, approves in his smart wallet and now has a vault and minted IST.

Security Considerations

TBD

Test Plan

TBD

dckc commented 1 year ago

for reference:

dckc commented 1 year ago

Broadcasting on non-Agoric chains

A complication is that the transaction is broadcast on the sending chain; in the example case, the Cosmos hub. Odds are this is a well-trodden path for the user's Keplr wallet, but still... all our connection setup logic to date assumes we're broadcasting to an Agoric chain. (Fortunately, it's straightforward to convert an agoric1... address into a cosmos... address with the same public/private key using fromBech32 and toBech32.)

The connection details are supposed to be available in the chain registry. It might be possible to have this dapp handle new source chains dynamically, but given that adding a new asset is a whole-chain-governance action, it seems more likely that we'll release an update for each new source chain.

dckc commented 1 year ago

Osmosis doesn't use sendIbcTokens

Interesting... searching osmosis-frontend sendIbcTokens turns up nothing.

https://github.com/osmosis-labs/osmosis-frontend/blob/master/packages/stores/src/tx/ibc/ibc-transfer.ts seems to be the central part of their implementation

https://github.com/osmosis-labs/osmosis-frontend/tree/master/packages/stores/src/ibc-history main file (index.ts) is 570 LOC

otoole-brendan commented 1 year ago

adding Stride screenshot to help visualize option 2 as this is desired behavior: image

otoole-brendan commented 1 year ago

Following discussion, the design for this has changed. The asset transfer functionality will be added to smart wallet UI, not vaults UI for several reasons including being able to use for other dapps in future.

otoole-brendan commented 1 year ago

Issue moved to Agoric/wallet-app #50 via Zenhub