DelayedOrderGateway is covered here; orderGatewayV2 is limited to use by the Perp v3 frontend and API (no external functions for direct contract interaction).
The order gateways have two key roles:
Route orders to the optimal liquidity source
Prevent trades from front-running the oracle using a 3 second delay
Workflow
Call createOrder() to generate an order, including createdAt and executableAt timestamps
Wait for executableAt() timestamp
Call executeOrder() with orderId to execute a trade
Call cancelOrder() with orderID to cancel an unexecuted order
Contract
/// @notice Create an order (but do not execute)functioncreateOrder(DelayedOrderType orderType,bytescalldata data) emitOrderCreated(orderId,delayedOrder.sender,marketId, abi.encode(delayedOrder));
/// @notice Execute an order (probably first call createOrder)functionexecuteOrder(uint256 orderId,bytescalldata makerData)returns (int256 base,int256 quote);