1. How to Track the Open Event
When a Book is created, an Open
event is emitted, similar to the PairCreated
event in the Uniswap V2 factory.
/**
* @notice Event emitted when a new book is opened
* @param id The book id
* @param base The base currency
* @param quote The quote currency
* @param unitSize The unit size of the book
* @param makerPolicy The maker fee policy
* @param takerPolicy The taker fee policy
* @param hooks The hooks contract
*/
#[derive(Drop, starknet::Event)]
pub struct Open {
#[key]
pub id: felt252,
#[key]
pub base: ContractAddress,
#[key]
pub quote: ContractAddress,
pub unit_size: u64,
pub maker_policy: FeePolicy,
pub taker_policy: FeePolicy,
pub hooks: ContractAddress,
}
In Clober, the hook ID is typically set to a zero byte, meaning no hooks are used.
Note: There is no on-chain method to directly retrieve the list of created book IDs. Instead, you can use the Subgraph to query the currently created books and their properties.