mintlayer-core icon indicating copy to clipboard operation
mintlayer-core copied to clipboard

Orders accounting

Open azarovh opened this issue 1 year ago • 0 comments

Introduces new TxOutput::AnyoneCanTake which essentially represents a buy/sell order. This output creates an account with respective balances which can be filled by anyone partially/fully or withdrawn by an authority specified in the original output. Filling an order means creating a transaction that "burns" a currency that is being bought by the order and producing corresponding amount of other currency from the order account.

Allows to exchange a token for other token, coin for any token or vice versa. Given that the exchange is arbitrary and the atoms amount not divisible price arithmetics has it's restrictions. Currently it's implemented with integers arithmetics in a way that 3 tokens sold for 100 coins one by one will cost [33; 33; 34] coins each.

Suggestions for better arithmetics as well as naming are welcome.

Api-server and wallet are stubbed in this PR.

azarovh avatar Apr 30 '24 18:04 azarovh