axelar-cgp-sui

Module 0x0::fill

Fill struct represents the results of a match between two orders.

use 0x0::balances;
use 0x0::deep_price;
use 0x2::object;

Struct Fill

Fill struct represents the results of a match between two orders. It is used to update the state.

struct Fill has copy, drop, store
Fields
maker_order_id: u128
maker_client_order_id: u64
execution_price: u64
balance_manager_id: object::ID
expired: bool
completed: bool
base_quantity: u64
quote_quantity: u64
taker_is_bid: bool
maker_epoch: u64
maker_deep_price: deep_price::OrderDeepPrice
taker_fee: u64
maker_fee: u64

Function maker_order_id

public fun maker_order_id(self: &fill::Fill): u128
Implementation
public fun maker_order_id(self: &Fill): u128 {
    self.maker_order_id
}

Function maker_client_order_id

public fun maker_client_order_id(self: &fill::Fill): u64
Implementation
public fun maker_client_order_id(self: &Fill): u64 {
    self.maker_client_order_id
}

Function execution_price

public fun execution_price(self: &fill::Fill): u64
Implementation
public fun execution_price(self: &Fill): u64 {
    self.execution_price
}

Function balance_manager_id

public fun balance_manager_id(self: &fill::Fill): object::ID
Implementation
public fun balance_manager_id(self: &Fill): ID {
    self.balance_manager_id
}

Function expired

public fun expired(self: &fill::Fill): bool
Implementation
public fun expired(self: &Fill): bool {
    self.expired
}

Function completed

public fun completed(self: &fill::Fill): bool
Implementation
public fun completed(self: &Fill): bool {
    self.completed
}

Function base_quantity

public fun base_quantity(self: &fill::Fill): u64
Implementation
public fun base_quantity(self: &Fill): u64 {
    self.base_quantity
}

Function taker_is_bid

public fun taker_is_bid(self: &fill::Fill): bool
Implementation
public fun taker_is_bid(self: &Fill): bool {
    self.taker_is_bid
}

Function quote_quantity

public fun quote_quantity(self: &fill::Fill): u64
Implementation
public fun quote_quantity(self: &Fill): u64 {
    self.quote_quantity
}

Function maker_epoch

public fun maker_epoch(self: &fill::Fill): u64
Implementation
public fun maker_epoch(self: &Fill): u64 {
    self.maker_epoch
}

Function maker_deep_price

public fun maker_deep_price(self: &fill::Fill): deep_price::OrderDeepPrice
Implementation
public fun maker_deep_price(self: &Fill): OrderDeepPrice {
    self.maker_deep_price
}

Function taker_fee

public fun taker_fee(self: &fill::Fill): u64
Implementation
public fun taker_fee(self: &Fill): u64 {
    self.taker_fee
}

Function maker_fee

public fun maker_fee(self: &fill::Fill): u64
Implementation
public fun maker_fee(self: &Fill): u64 {
    self.maker_fee
}

Function new

public(friend) fun new(maker_order_id: u128, maker_client_order_id: u64, execution_price: u64, balance_manager_id: object::ID, expired: bool, completed: bool, base_quantity: u64, quote_quantity: u64, taker_is_bid: bool, maker_epoch: u64, maker_deep_price: deep_price::OrderDeepPrice): fill::Fill
Implementation
public(package) fun new(
    maker_order_id: u128,
    maker_client_order_id: u64,
    execution_price: u64,
    balance_manager_id: ID,
    expired: bool,
    completed: bool,
    base_quantity: u64,
    quote_quantity: u64,
    taker_is_bid: bool,
    maker_epoch: u64,
    maker_deep_price: OrderDeepPrice,
): Fill {
    Fill {
        maker_order_id,
        maker_client_order_id,
        execution_price,
        balance_manager_id,
        expired,
        completed,
        base_quantity,
        quote_quantity,
        taker_is_bid,
        maker_epoch,
        maker_deep_price,
        taker_fee: 0,
        maker_fee: 0,
    }
}

Function get_settled_maker_quantities

Calculate the quantities to settle for the maker.

public(friend) fun get_settled_maker_quantities(self: &fill::Fill): balances::Balances
Implementation
public(package) fun get_settled_maker_quantities(self: &Fill): Balances {
    let (base, quote) = if (self.expired) {
        if (self.taker_is_bid) {
            (self.base_quantity, 0)
        } else {
            (0, self.quote_quantity)
        }
    } else {
        if (self.taker_is_bid) {
            (0, self.quote_quantity)
        } else {
            (self.base_quantity, 0)
        }
    };

    balances::new(base, quote, 0)
}

Function set_fill_maker_fee

public(friend) fun set_fill_maker_fee(self: &mut fill::Fill, fee: u64)
Implementation
public(package) fun set_fill_maker_fee(self: &mut Fill, fee: u64) {
    self.maker_fee = fee;
}

Function set_fill_taker_fee

public(friend) fun set_fill_taker_fee(self: &mut fill::Fill, fee: u64)
Implementation
public(package) fun set_fill_taker_fee(self: &mut Fill, fee: u64) {
    self.taker_fee = fee;
}