Writing your own Zone

Writing a Zone

Writing a Zone allows you choose your own Fulfillers, set your own rules, charge fees and more.

Should you write your own Zone?

First, let's talk about when you don't need to write your own Zone.

  • When you're trading for yourself
  • When you're testing Flood out

In those cases, you can use Flood default Zone.

You do want to write your own Zone when:

  • You want to add extra validation to orders.
  • You want to monetize your orderflow
  • You want to control over who can see and fill your orders.

In general, if you have your own app, you probably want to write your own Zone.

Writing a Zone

We recommend you start by forking the Flood Default Zone (opens in a new tab) which is simple and showcases a few features like Access Control and Pausability. Next, you will probably want to whitelist the Optimal Fulfiller, this will allow you to use the Optimal Fulfiller to fill your orders, meaning you can get started sending orders right away. To have the Optimal Fulfiller respect your fees, you will need to implement the following interface:

     * @notice Get the fee information.
     * @param order The components of an order, excluding its signature.
     * @return The address of the fee recipient who should receive the fees.
     * @return The fee cut in BPS that should be taken from the output tokens.
    function fee(IFloodPlain.Order calldata order) external view returns (address, uint256);

We are commited to onboarding protocols and apps to Flood with their own Zones, so don't hesitate to reach out to us if you need help!