Market contract
MarketContract holds one netted position per account and side. It owns margin, order escrow, credit, and the market's risk configuration.
The paired strategy vault holds liquidity. Each market has one immutable feed_id. Its constructor binds the vault, settlement token, oracle, treasury, and owner.
The owner can upgrade market code while retaining the market address and its authority over the paired vault. The vault has no upgrade entry, so its fixed code still trusts the registered market's current behavior.
Orders and positions
| Reference | What it defines |
|---|---|
| Orders | create_order, cancel_order, execute_order, get_order, get_order_counter, and all six order kinds. |
| Position lifecycle | get_position, position fields, increases, decreases, size locks, and full-close sweeps. |
| Margin and leverage | Margin requirements, maintenance equity, and position validation. |
| Profit and loss | Price marks, rounding, profit caps, and aggregate vault marks. |
| Pricing | accrue, price selection, cache behavior, and the position price floor. |
| Fees and settlement | Trade and impact fees, escrowed execution fees, settlement legs, and payout fallback. |
| Funding rate | Funding accrual, claim_credit, get_claimable_credit, and the credit pool. |
| Borrowing rate | Utilization, the borrowing curve, and side reserves. |
Forced closes and liquidity
| Reference | What it defines |
|---|---|
| Liquidation | execute_liquidation, eligibility, fees, bad debt, and delist deadlines. |
| Auto-deleveraging | get_adl, update_adl_state, execute_adl, side flags, and forced profit realization. |
| Vault orders | create_vault_order, cancel_vault_order, execute_vault_order, get_vault_order, minimum output, and redeem locks. |
Administration and shared references
| Reference | What it defines |
|---|---|
| Constructor and dependencies | __constructor, dependency views, ownership, and upgrade. |
| Configuration | set_config, get_config, field units, validation bounds, and constants. |
| Market status | set_status, get_status, set_terminal_price, get_retirement, transitions, and entry gates. |
| Storage | Every key, record, and storage time-to-live rule. |
| Events | Topics, data fields, and receipt ordering. |
| Errors | Market and ownership error codes. |
| Units and scales | Integer precision and rounding conventions. |
User actions authorize creation, cancellation, and credit claims. Price-bearing keeper entries are permissionless. A keeper argument names the reward recipient.
The transaction reference covers batch composition, fee forwarding, and session authorization. Live addresses and parameters appear in Deployments.