Skip to content

[Draft] LeaveNoDust order type#95

Open
fleupold wants to merge 2 commits into
mainfrom
leave_no_dust
Open

[Draft] LeaveNoDust order type#95
fleupold wants to merge 2 commits into
mainfrom
leave_no_dust

Conversation

@fleupold

Copy link
Copy Markdown
Contributor

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

  • smart order poc

Note, that isValidSignature is by default implemented as fetching getTradeableOrder and asserting that it's equivalent to the actual order the solver is proposing to settle (cf. 1, 2).

How to test

Tests are missing

Comment thread src/types/LeaveNoDust.sol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants