pendulum-chain / vortex

https://app.vortexfinance.co/
1 stars 1 forks source link

Phase 6A: Reduce user signing from 3 to 1 transactions #35

Closed prayagd closed 4 months ago

prayagd commented 5 months ago

Context

Follow-up ticket to phase 5. Currently the user has to sign 3 different transactions on the phase 5 version. This ticket to club all them in one single transaction.

There are two tickets for phase 6, the other one is https://github.com/pendulum-chain/pendulum-pay/issues/36

Requirement

Similarly to our flow on Stellar, the prototype should create a Pendulum ephemeral account for the user.

TODO

Shortcomings and Outlook

This section is only relevant for later iterations.

The PEA needs to have some native tokens in order to pay for transaction fees. The solution of this ticket requires that these tokens are "donated" by the user itself. This might not work at later iterations when the offramping flow will start on a different chain as native tokens will not be available.

Alternatively, we can use a funding account to provide these tokens. However, there is no multisig solution comparable to Stellar that will ensure that the user can't defraud us of these funds.

It could be that a safe solution can only be achieved with some custom onchain logic ("automation pallet").

prayagd commented 5 months ago

How to technically achieve this?

Reason to raise this ticket -> Currently the phase 5 does stay true to the statement of "Single click offramp". so this a follow-up ticket for it.

vadaynujra commented 5 months ago

@prayagd based on this discussion, updated this to call it the next Phase i.e. 6. Please make necessary changes to other tickets as a result?

prayagd commented 5 months ago

Hey team! Please add your planning poker estimate with Zenhub @b-yap @bogdanS98 @ebma @gianfra-t @TorstenStueber

prayagd commented 5 months ago

@TorstenStueber Can you please fill in the technical details?

TorstenStueber commented 5 months ago

Details added.

vadaynujra commented 5 months ago

@pendulum-chain/devs this ticket is ready and can be worked in parallel with Phase 6B.

gianfra-t commented 4 months ago

Maybe it is better to redefine this ticket and work directly on the implementation required for the polygon phase prototype, specifically this task?

I think this will involve more or less the same steps described right now, but the difference would be that we should monitor for the arrival of the tokens via XCM to kick the process instead of the user transferring to the ephemeral account.

ebma commented 4 months ago

True, we could consider skipping this and directly focus on the pendulum-chain/vortex#43. However, it might make sense to already build the foundation for pendulum-chain/vortex#43 in this task and make it easy to just amend the polygon logic it. This ticket is quite well-defined and already actionable while pendulum-chain/vortex#43 is not really. I fear that pendulum-chain/vortex#43 would get too large and a bit confusing if we are doing too many things at the same time. What do you think @gianfra-t? Do you think it's too much overhead to do both this and pendulum-chain/vortex#43 iteratively?

gianfra-t commented 4 months ago

No you're right we can keep this one but I would just keep in mind when doing it the final goal, such that not much logic is done that later has to be removed. I honestly cannot think right now if it will be too much overhead to make this change, but testing always takes time.

So, maybe we start working on this one on the parts we know will be required for both scenarios. That would be the creation of the temporary account and the replacement of the signatures. In the meantime we can define what are the actual steps to be done on pendulum-chain/vortex#43. The other thing is that pendulum-chain/vortex#43 will be large and confusing, but we know for sure how the XCM transaction will look like, so "downstream" of that it can be worked on.

ebma commented 4 months ago

Sounds good 👍

TorstenStueber commented 4 months ago

@gianfra-t As you already identified the main change to the ticket as it is specified right now is:

gianfra-t commented 4 months ago

@TorstenStueber maybe we can already work on the trigger part by listening to a token transfer event targeting the ephemeral account.

This will work regardless of the implementation details of the Axelar part. WDYT?

TorstenStueber commented 4 months ago

Yes, do you just want to use polkadot.js to monitor incoming XCM messages for the ephemeral account?

gianfra-t commented 4 months ago

I tested listening to Transfer event from the tokens pallet. If we change it to listen to a Deposit event it should work with the XCM message.

vadaynujra commented 4 months ago

Is this ready to be merged to staging to be able to test or still requires more work @gianfra-t?

gianfra-t commented 4 months ago

It still requires some work. In fact, due to the overlapping changes with this one and #36, #40 I think it's best to merge those two first into staging, and then this one. I will start resolving those conflict ASAP locally.

ebma commented 4 months ago

@gianfra-t these changes are already included in the polygon prototype now, right? Should we merge them back into the v1 prototype with EURC? I think it's not really required anymore, assuming that the prototypes will be replaced by the 'real' vortex UI but correct me if I'm wrong and you would like to have this feature 6a available on the EURC prototype still @pendulum-chain/product.

gianfra-t commented 4 months ago

They are merged to polygon yes. In order to make the changes required exactly for this ticket, aimed at the old prototype, it is missing the modification such that the user sends tokens to the ephemeral. I have a local branch for continuing with this, if needed.

ebma commented 4 months ago

Okay cool, I will close this ticket now assuming that we don't need to add this to the EURC prototype. @pendulum-chain/product if you object, feel free to reopen this ticket.