Protocol
Everything About Zones

Everything about Zones

Zone Overview

In the most general terms, a Zone is tasked with validating orders and controlling access to them. It stands as a gatekeeper between users and Fulfillers, and allows order flow owners to monetize their orderflow, however they deem fit.

Zones are incredibly flexible and powerful, and can be used to implement a wide variety of models, like:

  • Permissionless orderflow auctions, with kickbacks to users.
  • Flexible fee structure based on order type, size, or any other parameter.
  • RFQ like auctions
  • The one you want to build!

How do Zones work?

When creating orders, you specify a Zone by setting the zone field in the order struct.

When an order is being filled, Flood settlment contract, FloodPlain, validates the order against the order zone. FloodPlain expects the Zone to adhere at minimum to the following interface:

interface IZone {
    /**
     * @notice Check if a direct fill order is valid.
     *
     * @dev Reverts if not valid.
     *
     * @param order     The components of an order, excluding its signature.
     * @param book      The address of the book where the order is created (e.g.: FloodPlain).
     * @param caller    The address that is fulfilling the order by calling the book and supplying
     *                  all the fulfillment parameters.
     * @param orderHash The EIP712 hash of the order components.
     */
    function validateOrder(IFloodPlain.Order calldata order, address book, address caller, bytes32 orderHash)
        external
        view;
 
    /**
     * @notice Check if an order with specific fulfillment parameters is valid.
     *
     * @dev Reverts if not valid.
     *
     * @param order     The components of an order, excluding its signature.
     * @param book      The address of the book where the order is created (e.g.: FloodPlain).
     * @param fulfiller The address that is fulfilling the order by supplying consideration items.
     * @param caller    The address that is fulfilling the order by calling the book and supplying
     *                  all the fulfillment parameters.
     * @param orderHash The EIP712 hash of the order components.
     * @param context   The extra data supplied by the caller, which might include swap
     *                  instructions for the fulfiller.
     */
    function validateOrder(
        IFloodPlain.Order calldata order,
        address book,
        address fulfiller,
        address caller,
        bytes32 orderHash,
        bytes calldata context
    ) external view;
}

On top of this, a Zone can implement its own logic to communicate fees to Fulfillers, monetize orderflow, and restrict who can see and fill orders.