Closed otoole-brendan closed 1 year ago
Unlikely to be complete for RC0. Plan is to manually IBC transfer for testing for RC0 with a view to landing this before mainnet launch
Last thing on Sam's prioritized list (After everything else MVP)
References from other implementations:
Stargate client: https://cosmos.github.io/cosmjs/latest/stargate/classes/SigningStargateClient.html#sendIbcTokens
@michaelfig says:
Actually, you can ask chain RPC for a denom and port/channel transmission path given the hash of an IBC denom.
Try experimenting with agd query --node=https://main.rpc.agoric.net:443/ ibc-transfer denom-traces. If you have just one hash (I think you strip off the ibc/), then do: query --node=... ibc-transfer denom-trace HASH.
For Cosmjs, you need to do something with import {setupIbcExtension} from '@cosmjs/stargate'; and then you can call
await client.ibc.transfer.denomTrace(hash)
or something.I think you supply the setupIbcExtension as a mixin to a QueryClient.
@otoole-brendan commented on Thu Jan 19 2023
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 on Thu Jan 19 2023
for reference:
@dckc commented on Thu Jan 19 2023
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 acosmos...
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 on Thu Jan 19 2023
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 on Thu Jan 19 2023
adding Stride screenshot to help visualize option 2 as this is desired behavior:
@otoole-brendan commented on Wed Jan 25 2023
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.