Module 0x7::native_order_book
Native order storage, keyed by (exchange, market, order_id) for single
orders and (exchange, market, account) for bulk orders. Write API is
set_ / delete_, gated by a TradingNativeCapability (re-checked via
assert_valid on every call). Native state is read only on the validator
side (Rust), never from Move.
- Function
set_single_order - Function
delete_single_order - Function
set_bulk_order - Function
delete_bulk_order - Function
native_set_single_order - Function
native_delete_single_order - Function
native_set_bulk_order - Function
native_delete_bulk_order
use 0x5::order_book_types;
use 0x7::native_order_types;
use 0x7::trading_native_capability;
Function set_single_order
Store a single order at (exchange, market, order.order_id). exchange
is derived from the cap; every call re-checks the cap via assert_valid.
public fun set_single_order<M: copy, drop, store>(cap: &trading_native_capability::TradingNativeCapability, market: address, order: native_order_types::NativeSingleOrder<M>)
Implementation
public fun set_single_order<M: store + copy + drop>(
cap: &TradingNativeCapability,
market: address,
order: NativeSingleOrder<M>,
) {
trading_native_capability::assert_valid(cap);
native_set_single_order(trading_native_capability::exchange(cap), market, order);
}
Function delete_single_order
Delete the single order at (exchange, market, order_id).
public fun delete_single_order(cap: &trading_native_capability::TradingNativeCapability, market: address, order_id: order_book_types::OrderId)
Implementation
public fun delete_single_order(
cap: &TradingNativeCapability,
market: address,
order_id: OrderId,
) {
trading_native_capability::assert_valid(cap);
native_delete_single_order(trading_native_capability::exchange(cap), market, order_id);
}
Function set_bulk_order
Store a bulk order at (exchange, market, order.account).
public fun set_bulk_order<M: copy, drop, store>(cap: &trading_native_capability::TradingNativeCapability, market: address, order: native_order_types::NativeBulkOrder<M>)
Implementation
public fun set_bulk_order<M: store + copy + drop>(
cap: &TradingNativeCapability,
market: address,
order: NativeBulkOrder<M>,
) {
trading_native_capability::assert_valid(cap);
native_set_bulk_order(trading_native_capability::exchange(cap), market, order);
}
Function delete_bulk_order
Delete the bulk order at (exchange, market, account).
public fun delete_bulk_order(cap: &trading_native_capability::TradingNativeCapability, market: address, account: address)
Implementation
public fun delete_bulk_order(
cap: &TradingNativeCapability,
market: address,
account: address,
) {
trading_native_capability::assert_valid(cap);
native_delete_bulk_order(trading_native_capability::exchange(cap), market, account);
}
Function native_set_single_order
fun native_set_single_order<M: copy, drop, store>(exchange: address, market: address, order: native_order_types::NativeSingleOrder<M>)
Implementation
native fun native_set_single_order<M: store + copy + drop>(
exchange: address,
market: address,
order: NativeSingleOrder<M>,
);
Function native_delete_single_order
fun native_delete_single_order(exchange: address, market: address, order_id: order_book_types::OrderId)
Implementation
native fun native_delete_single_order(
exchange: address,
market: address,
order_id: OrderId,
);
Function native_set_bulk_order
fun native_set_bulk_order<M: copy, drop, store>(exchange: address, market: address, order: native_order_types::NativeBulkOrder<M>)
Implementation
native fun native_set_bulk_order<M: store + copy + drop>(
exchange: address,
market: address,
order: NativeBulkOrder<M>,
);
Function native_delete_bulk_order
fun native_delete_bulk_order(exchange: address, market: address, account: address)
Implementation
native fun native_delete_bulk_order(
exchange: address,
market: address,
account: address,
);