How it works
Trading Flow
- Order Creation:
- Users deposit tokens to the exchange
- They can create buy or sell orders at specific price points
- Orders are stored in the appropriate order book
- Order Matching:
- When a new order arrives, the system checks for matching orders
- Orders are matched at the specified price point
- Partial fills are supported when full matches aren't available
- Settlement:
- Matched trades are settled immediately
- Tokens are transferred between parties
- Service fees are collected and distributed
Fee Structure
- Fees are configurable by the deployer
- Default fee is 1% (represented as 10 in the contract)
- Fees are collected in the traded tokens
- Fees can be updated by the deployer
Price Levels
The system maintains two order books:
- Sell order book (sellOB)
- Buy order book (buyOB)
Each price level contains:
- Total volume at that price
- Linked list of individual orders
- Order metadata (seller address, amount)

