Architecture

Understand UniswapX reactors, fill contracts, and direct fill settlement paths across supported order formats.

UniswapX architecture diagram showing the relationship between reactors, fill contracts, and order settlement

Reactors

Order Reactors settle UniswapX orders. They validate a specific order type, resolve inputs and outputs, execute against a filler strategy, and verify fulfillment.

Reactors process orders using the following steps:

  • Validate the order
  • Resolve the order into inputs and outputs
  • Pull input tokens from the swapper to the fill contract using Permit2 and permitWitnessTransferFrom with the order as witness
  • Call reactorCallback on the fill contract
  • Verify that the output tokens were received by the output recipients

Reactors implement the IReactor interface which abstracts the specifics of the order specification. This allows for different reactor implementations with different order formats to be used with the same interface, allowing for shared infrastructure and easy extension by fillers.

Current reactor implementations:

ReactorDescription
PriorityOrderReactorSettles orders via filler competition using priority gas fees
V2DutchOrderReactorSettles linear decay Dutch orders using block timestamp for auction decay
V3DutchOrderReactorSettles linear decay Dutch orders using block number instead of timestamp, enabling finer granularity on chains like Arbitrum (250ms block resolution)
ExclusiveDutchOrderReactorSettles linear decay Dutch orders with exclusivity period before decay begins
LimitOrderReactorSettles simple static limit orders

Fill Contracts

Order fill contracts fill UniswapX orders. They specify the filler's strategy for fulfilling orders and are called by the reactor with reactorCallback.

Sample fill contract implementations are provided in the UniswapX repo:

ContractDescription
SwapRouter02ExecutorFills orders using Uniswap v2 and Uniswap v3 via the SwapRouter02 router

For filler implementation and operational guidance, see the Filler Integration Overview.

Direct Fill

If a filler wants to fill orders using funds on-hand rather than a fill contract, they can do so gas efficiently using the directFill macro by specifying address(1) as the fill contract. This will pull tokens from the filler using msg.sender to satisfy the order outputs.

More details on the UniswapX protocol are available in the UniswapX Whitepaper and the UniswapX Repo.