Rook
Search…
⌃K

Market Maker Integration Guide

How to integrate you market making operation with the HidingBook

Integration guide

Please Refer to the HidingBook API when reading this document

Sign and post an order

  1. 1.
    Call the GET /info endpoint to get the required information for signing orders
  2. 2.
    Add capability to sign a 0xv4 RFQ order with your hot wallet
    1. 4.
      You can also refer to 0x's documentation for how to sign orders
  3. 3.
    See the 0xv4 RFQ order params in 0x documentation
    1. 1.
      Most of the order params are populated by you based on your trade
    2. 2.
      Obtain some of these order params from the orderDetails of the /info endpoint
      1. 1.
        txOrigin
      2. 2.
        pool
      3. 3.
        verifyingContract
      4. 4.
        chainId
      5. 5.
        taker
  4. 4.
    Post your orders to the Hiding Book via the POST /orders endpoint for validation. The server will alert you of any errors, insufficient balances, or insufficient allowances.
  5. 5.
    Manage allowances
    1. 1.
      Market maker must approve token transfer allowances where the spender is the 0xv4 verifyingContract provided in the GET /info endpoint.

Cancel an order

  1. 1.
    1. 1.
      The order's maker needs to sign and broadcast a cancel transaction to the blockchain. There are a variety of ways to cancel orders, including cancel one order, batch cancel many orders, etc.

Monitor your orders for fills

  1. 1.
    Use Ethereum event logs
  2. 2.
    Search using topic 0x829fa99d94dc4636925b38632e625736a614c154d55006b7ab6bea979c210c32
  3. 4.
    Filter the event log data to only orders you care about
    1. 1.
      Maker address must be your address
    2. 2.
      To address of event log's origination must be the 0x proxy 0xdef1c0ded9bec7f1a1670819833240f027b25eff
    3. 3.
      Match the orderHash corresponding to the orderHash you signed. If it matches one of yours, then your order was filled. This is important because if you're using the 0xv4 protocol for any other purposes, this ensures that this is a Rook order and not a 0xv4 RFQ order that you performed on the same address
  4. 5.
    Determining an order's status
    1. 1.
      Use the order data's status and refer to 0x's OrderStatus enum

Collect ROOK rewards from the MEV you capture

  1. 1.
    Manually using our app: https://app.rook.fi
  2. 2.
    Programmatically using our rewards contracts directly