Order lifecycle
Every order can be paused, resumed, re-planned and cancelled by its owner. The contract's verdict on the next slice tells you exactly why it is or is not filling.
Status
canExecute(id) returns one status, checked in this order:
| Status | Code | Meaning |
|---|---|---|
cancelled | 2 | Cancelled by its owner; the rest was refunded |
filled | 3 | Nothing left: completed, or the rest was refunded (check refunded) |
expired | 4 | Past the deadline; anyone may refund the rest to the owner |
paused | 10 | Paused by its owner; nothing fills until it is resumed |
not-started | 5 | Before the start time |
waiting-for-slot | 6 | This slot already filled; the next opens at nextSlotAt |
spread-too-high | 7 | This side's spread is above the order's cap: held |
trend-against | 8 | Trend pause is on and a trend runs with this side: held |
below-limit | 9 | The quote is worse than the order's limit price: held |
ready | 0 | The next slice can fill now |
Managing an order
| Call | Who | Effect |
|---|---|---|
pause / resume | Owner | Hold and release fills. A paused order can still be cancelled or refunded |
editOrder | Owner | Re-plan the REMAINING budget from now: slices, interval, deadline and every rule. Side, recipient and budget are fixed; a paused order stays paused |
cancel | Owner | Refund what is left at once |
closeExpired | Anyone | After the deadline, refund what is left to the owner, never to the caller |
executeSlice | Keeper or owner | Fill the current slot's slice if the verdict is ready |
The refund record
Every order keeps amountIn (deposited), remaining, refunded and amountOut, so what was actually swapped is amountIn − remaining − refunded from the order alone. The SDK's spentOf and progressOf do this for you.
The deadline is exact. A slice that lands even one second after the deadline reverts as expired; the rest is then refunded.