Module 0x7::native_position
Native perp position storage, keyed by (exchange, market, account).
Write API is set_position / delete_position, 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_position - Function
delete_position - Function
native_set_position - Function
native_delete_position
use 0x7::native_position_types;
use 0x7::trading_native_capability;
Function set_position
Set the position at (exchange, market, account). exchange is
derived from the cap; every call re-checks the cap via
assert_valid.
public fun set_position(cap: &trading_native_capability::TradingNativeCapability, market: address, account: address, position: native_position_types::Position)
Implementation
public fun set_position(
cap: &TradingNativeCapability,
market: address,
account: address,
position: Position,
) {
trading_native_capability::assert_valid(cap);
native_set_position(trading_native_capability::exchange(cap), market, account, position);
}
Function delete_position
Delete the position at (exchange, market, account).
public fun delete_position(cap: &trading_native_capability::TradingNativeCapability, market: address, account: address)
Implementation
public fun delete_position(
cap: &TradingNativeCapability,
market: address,
account: address,
) {
trading_native_capability::assert_valid(cap);
native_delete_position(trading_native_capability::exchange(cap), market, account);
}
Function native_set_position
fun native_set_position(exchange: address, market: address, account: address, position: native_position_types::Position)
Implementation
native fun native_set_position(
exchange: address,
market: address,
account: address,
position: Position,
);
Function native_delete_position
fun native_delete_position(exchange: address, market: address, account: address)
Implementation
native fun native_delete_position(
exchange: address,
market: address,
account: address,
);