Book Manager
Clober’s orderbook contract adopts a monolithic design, where a single contract called BookManager contains all the book instances. As a result, all orders, reserves, and states are managed within a single contract.
The major interfaces of the BookManager are as follows:
- Open: This creates a new Book instance within the BookManager. Note that this does not create a separate contract. It is configured through the Book’s setting, known as the BookKey.
- Make: This function places a new (bid-side) maker order on a designated Book.
- Take: This function places a new (ask-side) taker order that consumes the counterparty maker orders at a specific tick on a designated Book. Note that technically it is possible to take from a non-top-of-the-book price, even though it is not reasonable to do so.
- Claim: When a maker order is filled, the user may call this function to receive the proceeds.
- Cancel: Users may cancel their maker orders using this function.
There are additional functions regarding the lock pattern, which will be discussed in the later sections.