Very interesting discussion and it’s apparent that the decision made here will have major ramifications for the broader community.
I’ve been doing some tinkering on what could be a cool, pragmatic middle ground. I drafted something on FigJam here https://www.figma.com/file/WKXpQAHdkVIbsSXxvmUOKi/Stateswap?node-id=0%3A1&t=kOk1eeI487ljVGhg-1
But you can see it here as a screenshot:
** Please be patient with me** I haven’t built anything on Polkadot before, so some of my assumptions may be incorrect or poorly formed.
Two major issues I see at the moment is the poor onboarding into the ecosystem and the fragmented liquidity inherent in the current design.
My idea hopefully solves both.
If we allow DEX’s to virtually share their liquidity with Statemint we will be able to create a virtual AMM on Statemint that doesn’t need to compete for liquidity. This virtual AMM will be able to provide price endpoints for the tokens that need to be traded and the settlement orders can then be executed on the Parachain DEX with the best price action.
Remote locking on XCM V3 may be an interesting MVP use case to test it’s viability.
Let’s walk through a very simple example of how the flow would work:
Alice would like to buy $BOKKE. Bokke is a new parachain for betting on the upcoming Rugby World Cup. However Alice is on Acala. She’s comfortable there and couldn’t be bothered figuring out a new ecosystem. She just wants to speculate on the token. Problem is that there is no liquidity for $BOKKE on Acala.
So she goes to a Swap widget for Polkadot, she wants to swap 1 xcDOT on Acala for xcBOKKE and keep custody of the xcBOKKE on Acala.
The Swap widget, queries the virtual AMM on Statemint and comes back with the current best price point based on the DEX there
Kolbe. It’s 1 DOT for 5 $BOKKE.
Alice is happy with the price point and clicks to execute the order.
- On Acala, 1 xcDOT leaves her wallet and gets sent Statemint
- Statemint executes the swap on the
- Statemint sends the $BOKKE token to Alice’s wallet on Acala
There are a few issues here which could potentially make this technically unfeasible:
- Statemint has an ability and permissions to remotely execute swaps on other Parachains. I don’t believe this is currently possible. If we look just at Astar, Acala and Moonbeam, they use Solidity contracts which wouldn’t be exposed to substrate level calls. So this would need to built as a pallet that Parachains would need to opt into in order to connect their parachains to StateSwap. Oak Network may have some interesting thoughts on this piece.
- Latency may be very poor. If we have 6 seconds for finality, then this simple example may already get us past 15 seconds. Which is definitely below par outside of Ethereum L1. On other chains where latency provides a poor UX, there has emerged off chain settlors that will settle immediately for a small fee. This could be explored further.
- Slippage due to latency and lack of composability. There is a risk that the settlement may fail if there is big price movement on the
Kolbe DEX before settlement occurs. Probably further justification for off chain settlors
Anyway those are my thoughts.
They’ll probably evolve over time but it may be useful as a talking point.