polkadot-fellows / xcm-format

Polkadot Cross Consensus-system Message format.
Apache License 2.0
181 stars 43 forks source link

idea: Note on Intention expression as regard to existing Exchange instruction and possible Order instruction, and Market trust #47

Open dzmitry-lahoda opened 1 year ago

dzmitry-lahoda commented 1 year ago

Price

Let look at exchange instruction

ExchangeAsset = 15 { give: MultiAssetFilter, want: MultiAssets, maximal: bool }

Then, there are so called batch auctions (actually order books, but without FIFO, popular in Ethereum, example is COW protocol). As per Multi-token Batch Auctions with Uniform Clearing Prices Tom Walther 2021 paper. Sorry for images:

image image

So as you can see there is more to express in instruction and needs more parameters, ExchangeAsset expresses only part of these.

So it may be possible to consider extending ExchangeAsset with more parameters, or adding new Order instuction. Order instruction may or may not consider "returning" register with position identifier (so it can be just non fungible asset too).

dzmitry-lahoda commented 1 year ago

Trust

So when I want start on some blockchain, I can set limit and end up on other chain to settle to limit.

But really sometimes start is automatic on chain and it does not have data about limit.

It can do only slippage.

What is slippage?

It tells I trust market, and given time window of N blocks on target chain, I accept any market spot price which is not so far from what is was on some average last N blocks.

So really small ORDER_SIZE/BIG_POOL it works awesome.

How to express this?

dzmitry-lahoda commented 1 year ago

NFT

Currently assets are NFT | Fungibles.

Both of above, bread and butter, of DeFi and blockchins, easy to express for Fungibles.

How to than form/limit XCM Instuction which works only for Fungibles?

Is it considered split instuction to kind of which inputs only Fungibles, or inputs and outputs Fungibles.

So that DeFi intents expresable.