11

The Manage Offer operation has in its parameters:

  • The amount of selling asset being offered (integer)
  • The price willing to be accepted (a fraction defined as (integer, integer))

Would it not have been sufficient to represent the offer as:

  • The amount of selling asset being offered (integer)
  • The amount of buying asset willing to accept (integer)

What benefit is derived by defining the offer price as a fraction?

1
  • Fair point, would be good from standardisation perspective, Paths lookup returns data in a way you described: selling asset and buying asset
    – umbrel
    Jan 17, 2018 at 21:55

1 Answer 1

16

Both representation have benefits.

From what I remember, when we picked the amount + price, we considered the following properties compared to just having amount for sale & amount to buy:

  • it discourages "dust" trades. Offers with amount_s/amount_b ratio will in average end up at the same price, but individual trades will be rounded up and rounded down and it's hard to tell if there are situations where this can be exploited (it depends on the token)
  • the price doesn't change as the offer gets consumed, making change tracking easier for consumers of historical data
  • the price is managed and displayed in consistent fashion in clients (most people use price as the main parameter)
2
  • Points 2 & 3 make sense. The first point took me a while to grok. I guess you're saying that very tiny trades executed with a fractional price might be exploitable due to rounding. Is that right?
    – Synesso
    Jan 17, 2018 at 22:35
  • when using amount_s and amount_b you end up having different "steps" for amount_s and amount_b which cause the price to jitter. if the goal is to sell all of amount_s in exchange for amount_b then there has to be intermediate trades where the price is smaller than the original offer. Like I said I am not sure this is exploitable, but it seemed like a bad property :) Jan 18, 2018 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.