fulfillers
Flood for Fulfillers

Flood for Fulfillers

Fulfillers can leverage Flood to engage with Owners and tap into existing orderflow, eliminating the need of acquiring it from scratch.

Writing a Fulfiller

The complexity of writing a Fulfiller largely depends on your strategy.

All fulfillers must implement the following interface:

interface IFulfiller {
    /**
     * @notice External function to perform arbitrary swaps to source requested items.
     *
     * @dev FloodPlain must have sent offer items prior to this call. The swap data should use the
     *      received offer items. If a fulfiller has operating capital and does not have any checks
     *      to ensure not more than the received offer items are spent, it must rely on trusted
     *      callers supplying honest swap data. Zone can enforce the access control.
     *
     * @param selectorExtension Additional bytes to prevent hooks from calling Fulfiller.
     * @param order All the details of a book order.
     * @param caller The address that called the book.
     * @param context All the swap data, or any other arbitrary data.
     *
     * @return The amount of consideration that was sourced and approved for Book to
     *         transfer. These amounts might be higher than requested amounts.
     */
    function sourceConsideration(
        bytes28 selectorExtension,
        IFloodPlain.Order calldata order,
        address caller,
        bytes calldata context
    ) external returns (uint256);
 
    /**
     * @notice External function to fill multiple orders in the same transaction.
     *
     * @param selectorExtension Additional bytes to prevent hooks from calling Fulfiller.
     * @param orders An array of orders that will be batch filled.
     * @param caller The address that called the book.
     * @param context All the swap data, or any other arbitrary data.
     *
     * @return The amount of consideration items, for each order, that were sourced and approved
     *         for FloodPlain to transfer. These amounts might be higher than requested amounts.
     */
    function sourceConsiderations(
        bytes28 selectorExtension,
        IFloodPlain.Order[] calldata orders,
        address caller,
        bytes calldata context
    ) external returns (uint256[] memory);
}

For safety reasons, we recommend Fulfillers to check the following whenever sourceConsideration is called:

  • That msg.sender is FloodPlain
  • That tx.origin is an EOA they control.
  • That MAGIC_VALUE is correct.

Seeing Orders

Fulfillers can view orders related to a Zone through any agreed mechanism between them and Owners.

Two examples include:

  • Broadcasting orders publicly onchain, by calling etchOrder on FloodPlain
  • Using the Flood offchain Orderbook

Current Limitations

To ensure stability and quality of execution, only the Flood team Fulfiller can access the offchain Orderbook for the time being.