Protocol / 03
Transaction lifecycle
The contract records transfers and events. The operational order lifecycle continues off-chain and returns through owner-only functions.
Buy order
Approve settlement token
The wallet approves the active proxy for margin, fee and interest.
Create the order
createBuyOrder transfers margin to fundReceiver, collects fee and interest, and emits OrderCreated.
Execute off-chain
The backend observes the event and manages brokerage execution. This state is not stored in the contract.
Complete or cancel
The owner emits fill status and mints tokens, or invokes cancellation and refund logic.
Sell order
Approve stock token and USDT
The wallet approves token margin plus USDT for fee and interest.
Create and execute
Token margin moves to tokenReceiver; the off-chain operator handles brokerage execution.
Reconcile
The owner burns stock tokens after execution or invokes the refund path.
Open finding MED-01. The contract stores no order status and validates no state transition. Events are not a complete on-chain order book.