Veyronn Documentation
Trade Settlement
Atomic report preparation, execution-price selection, and state transition ordering.
Atomic wrapper
Price-sensitive actions execute through the oracle router:
executeWithReports(marketIds, reports, protocolCall)
Conceptually, the router:
- verifies every report
- installs transaction-scoped quotes
- calls the protocol action
- clears all quotes
- returns the protocol result
If report verification or protocol execution fails, the entire transaction reverts.
Bid and ask
Execution uses side-aware prices:
| Action | Execution price | | --- | --- | | Open long | Ask | | Open short | Bid | | Close long | Bid | | Close short | Ask |
The benchmark price is used for display and trigger evaluation. Bid/ask selection prevents fills from always occurring at a favorable midpoint.
Open ordering
The protocol updates funding, validates market and account state, checks the execution price and slippage, computes fee and reserved collateral, applies open-interest and skew changes, records the position, and emits the open event.
Partial close
PnL, funding, fee, and returned collateral are proportional to the reduced size. Remaining position size and collateral stay open, and market open interest decreases by the reduction.
Full close
The protocol applies final PnL, funding, and fee; returns remaining positive equity to free collateral; updates realized PnL and open interest; marks the position closed; and emits PositionClosed.
Liquidation
The protocol recomputes funding and equity with a fresh adverse-side execution price. It rejects liquidation while maintenance margin remains sufficient. A valid liquidation closes the position, pays a bounded keeper bonus from residual equity, records bad debt if equity is insufficient, and emits PositionLiquidated.