OrderBookMarket
Last updated
Was this helpful?
Last updated
Was this helpful?
Inherits:
A more advanced market with multiple asks and bids, matching them on price-time priority or some other logic. Here we integrate with:
ListingRegistry for multi-lot listings
BrokerNetSettlement for broker-based settlement
DirectSettlement for on-chain direct settlement
Creates a listing in the order book. For demonstration, we just create a single-lot array or a multi-lot array. Returns listingId.
Executes (fills) a trade against an existing listing. If there's more shares requested than available, it reverts. If fully filled, the listing is removed from the registry. Splits the logic between broker settlement or direct settlement.
Cancels a listing if the seller no longer wants to sell or if partially filled.
*Settlement logic for broker-based trades that uses BrokerNetSettlement.
If both buyer and seller are brokers, we simply update net balances.
If only one side is broker, you could optionally do partial direct settlement, but for simplicity, we'll treat either side as a broker => net settlement approach.*
Stub function to call a "fake" broker-check contract. Returns true if address is recognized as a broker.