In this first version, the app would trust the coordinator to make the payment.
Requirements:
User must already have a DLC channel with us.
User must have enough funds to cover the invoice.
Flow:
User inputs Lightning invoice.
[Optional] Coordinator verifies that payment can be made on Lightning (by sending a probe?).
Update DLC channel.
Coordinator pays invoice.
Point number 2 is important for this to be as close to atomic as possible (without actually being atomic yet).
With an open position
It's easier to do this with an open position, because you can just resize the user position to reduce their margin, sending their margin to the coordinator reserve.
Since the feature we are ultimately targeting is paying using USDp, it makes sense to limit this feature to short positions with leverage 1.
Without a position
It would still be nice to pay without a position, but this would require changes to rust-dlc. I would recommend to not tackle this now.
MVP
In this first version, the app would trust the coordinator to make the payment.
Requirements:
Flow:
Point number 2 is important for this to be as close to atomic as possible (without actually being atomic yet).
With an open position
It's easier to do this with an open position, because you can just resize the user position to reduce their margin, sending their margin to the coordinator reserve.
Since the feature we are ultimately targeting is paying using USDp, it makes sense to limit this feature to short positions with leverage 1.
Without a position
It would still be nice to pay without a position, but this would require changes to
rust-dlc
. I would recommend to not tackle this now.