Module orderbook

Module orderbook 

Source
Expand description

Orderbook and tick level management for the stablecoin DEX.

Modulesยง

__packing_orderbook
__packing_tick_level

Structsยง

Orderbook
Orderbook for token pair with price-time priority Uses tick-based pricing with bitmaps for price discovery
OrderbookHandler
Type-safe handler for accessing #struct_name in storage.
TickLevel
Represents a price level in the orderbook with a doubly-linked list of orders Orders are maintained in FIFO order at each tick level
TickLevelHandler
Type-safe handler for accessing #struct_name in storage.

Constantsยง

MAX_PRICE_POST_MODERATO ๐Ÿ”’
MAX_PRICE_PRE_MODERATO ๐Ÿ”’
MAX_TICK
MIN_PRICE_POST_MODERATO ๐Ÿ”’
MIN_PRICE_PRE_MODERATO ๐Ÿ”’
MIN_TICK
Constants from Solidity implementation
PRICE_SCALE

Functionsยง

compute_book_key
Compute deterministic book key from base, quote token pair
price_to_tick_post_moderato
Convert scaled price to relative tick post moderato hardfork
price_to_tick_pre_moderato
Convert scaled price to relative tick pre moderato hardfork
tick_to_price
Convert relative tick to scaled price