Skip to main content

StopOrderTicket

Type Alias StopOrderTicket 

Source
pub type StopOrderTicket = StopOrderTicket<Otw>;

Aliased Type§

pub struct StopOrderTicket {
    pub id: UID,
    pub executors: MoveVec<Address>,
    pub gas: Balance<SUI>,
    pub account_id: u64,
    pub stop_order_type: u64,
    pub encrypted_details: MoveVec<u8>,
    /* private fields */
}

Fields§

§id: UID§executors: MoveVec<Address>

Addresses allowed to execute the order on behalf of the user.

§gas: Balance<SUI>

The executor collects the gas in case the order is placed or canceled for any reason. The user gets back the gas in case he manually cancels the order.

§account_id: u64

User account id

§stop_order_type: u64

Value to indentify the stop order type. Available values can be found in the constants module.

§encrypted_details: MoveVec<u8>

Vector containing the blake2b hash obtained from offchain on the stop order parameters. Depending on the stop order type value, a different set of parameters is expected to be used.

Parameters encoded for a SLTP stop order (stop_order_type code 0):

  • clearing_house_id: ID
  • expire_timestamp: Option
  • is_limit_order: true if limit order, false if market order
  • stop_index_price: u256
  • is_stop_loss: true if stop loss order, false if take profit order
  • position_is_ask: true if position is short, false if position is long
  • size: u64
  • price: u64 (can be set at random value if is_limit_order is false)
  • order_type: u64 (can be set at random value if is_limit_order is false)
  • salt: vector

Parameters encoded for a Standalone stop order (stop_order_type code 1):

  • clearing_house_id: ID
  • expire_timestamp: Option
  • is_limit_order: true if limit order, false if market order
  • stop_index_price: u256
  • ge_stop_index_price: true means the order can be placed when oracle index price is >= than chosen stop_index_price
  • side: bool
  • size: u64
  • price: u64 (can be set at random value if is_limit_order is false)
  • order_type: u64 (can be set at random value if is_limit_order is false)
  • reduce_only: bool
  • salt: vector