On Kwenta, all transactions are processed as delayed orders. These delayed orders function similarly to market orders but incorporate a time delay. Some may remember the next-price order system in our perps v1 implementation. These delayed orders improve on this mechanism.
Instead of executing a 'next-price' order following a Chainlink price update, the system now allows the executor (either a trader or a keeper) to complete the transaction after a specified number of seconds have elapsed.
EX, if a 15-second delay is set and a price update transpires 10 seconds after an order is placed, a keeper has the option to execute the order at that time, or they may wait the full 15 seconds before the order needs to be executed.
Once a delayed order fails to execute within this set time window, it goes stale. Once stale, the order needs to be canceled in order to place another, as traders can only have one active delayed order per market.
Once stale, the order cannot be canceled until 120 seconds have passed since going stale.