[Draft] LeaveNoDust order type #95
Open
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.
Description
POC new order type which scales the adjusts the actual sell amount to the account's maximum balance of the sell token at settlement time. This is useful when users want to have fill-or-kill semantics in cases where the sell balance may be changing. An example could be a user wishing to disperse of a rebasing tokens (e.g. a lending protocol's debt token) fully, while the debt token amount increasing on every block.
Leaving some small amount of dust in the account, would lead to debt further accruing and the user never really being able to pay back their loan.
We considered partially fillable limit order, but given those don't have a guarantee to be 100% executed and sometimes leave small amounts of dusts in the trading account, this was deemed not useful.
If implemented, solvers need to be aware of this smart order type to adjust the sell amount they are trying to settle based on the block at which they get included.
Changes
Note, that
isValidSignatureis by default implemented as fetchinggetTradeableOrderand asserting that it's equivalent to the actual order the solver is proposing to settle (cf. 1, 2).How to test
Tests are missing