Repository navigation
Manage offer v9 - #1431
Merged
Merged
Manage offer v9#1431
Conversation
amount we sell vs buy
This fixes an edge case that would cause certain sell operations (via the order book) to fail
Contributor
|
r+ d1977c0 |
Contributor
Author
|
@latobarita: retry |
latobarita
added a commit
that referenced
this pull request
Dec 4, 2017
Manage offer v9 Reviewed-by: vogel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the way manage offer works when attempting to sell XLMs.
In v8 of the protocol, the bad scenario looks like this:
attempt to create an offer to sell XLMs for some other asset but with an XLM balance that is too low.
Internally, the offer is first run throw the order book (in case the offer can be taken right away).
The problem is that if the offer is only partially taken, a new offer needs to be created but if there was enough outstanding offers in the order book the XLM balance could be below the reserve required to create an offer - and the operation fails (meaning no XLMs were sold).
The v9 implementation instead assumes that the offer would be created, and thus limits the XLMs that can be sold like this to the ones above the larger reserve.
This causes the behavior to be deterministic (from a success/failure point of view) as the only thing that matters is that the starting balance can accommodate the creation of an offer (the same way you need to have a balance to sell other assets).
An alternative that was considered was to simply not fail on the last step (which allows to sell a few more XLMs that way) but it would break manageOffer's contract that is that the outcome of calling manageOffer to create an offer before or after different offers are created should be the same.
This would allow selling more XLMs in manageOffer than from a regular offer, creating additional incentives to not have standing offers.
resolves #1430