0x0::fill
Fill
struct represents the results of a match between two orders.
Fill
maker_order_id
maker_client_order_id
execution_price
balance_manager_id
expired
completed
original_maker_quantity
base_quantity
taker_is_bid
quote_quantity
maker_epoch
maker_deep_price
taker_fee
taker_fee_is_deep
maker_fee
maker_fee_is_deep
new
get_settled_maker_quantities
set_fill_maker_fee
set_fill_taker_fee
use 0x0::balances;
use 0x0::deep_price;
use 0x2::object;
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
maker_order_id: u128
maker_client_order_id: u64
execution_price: u64
balance_manager_id: object::ID
expired: bool
completed: bool
original_maker_quantity: u64
base_quantity: u64
quote_quantity: u64
taker_is_bid: bool
maker_epoch: u64
maker_deep_price: deep_price::OrderDeepPrice
taker_fee: u64
taker_fee_is_deep: bool
maker_fee: u64
maker_fee_is_deep: bool
maker_order_id
public fun maker_order_id(self: &fill::Fill): u128
public fun maker_order_id(self: &Fill): u128 {
self.maker_order_id
}
maker_client_order_id
public fun maker_client_order_id(self: &fill::Fill): u64
public fun maker_client_order_id(self: &Fill): u64 {
self.maker_client_order_id
}
execution_price
public fun execution_price(self: &fill::Fill): u64
public fun execution_price(self: &Fill): u64 {
self.execution_price
}
balance_manager_id
public fun balance_manager_id(self: &fill::Fill): object::ID
public fun balance_manager_id(self: &Fill): ID {
self.balance_manager_id
}
expired
public fun expired(self: &fill::Fill): bool
completed
public fun completed(self: &fill::Fill): bool
original_maker_quantity
public fun original_maker_quantity(self: &fill::Fill): u64
public fun original_maker_quantity(self: &Fill): u64 {
self.original_maker_quantity
}
base_quantity
public fun base_quantity(self: &fill::Fill): u64
public fun base_quantity(self: &Fill): u64 {
self.base_quantity
}
taker_is_bid
public fun taker_is_bid(self: &fill::Fill): bool
public fun taker_is_bid(self: &Fill): bool {
self.taker_is_bid
}
quote_quantity
public fun quote_quantity(self: &fill::Fill): u64
public fun quote_quantity(self: &Fill): u64 {
self.quote_quantity
}
maker_epoch
public fun maker_epoch(self: &fill::Fill): u64
public fun maker_epoch(self: &Fill): u64 {
self.maker_epoch
}
maker_deep_price
public fun maker_deep_price(self: &fill::Fill): deep_price::OrderDeepPrice
public fun maker_deep_price(self: &Fill): OrderDeepPrice {
self.maker_deep_price
}
taker_fee
public fun taker_fee(self: &fill::Fill): u64
taker_fee_is_deep
public fun taker_fee_is_deep(self: &fill::Fill): bool
public fun taker_fee_is_deep(self: &Fill): bool {
self.taker_fee_is_deep
}
maker_fee
public fun maker_fee(self: &fill::Fill): u64
maker_fee_is_deep
public fun maker_fee_is_deep(self: &fill::Fill): bool
public fun maker_fee_is_deep(self: &Fill): bool {
self.maker_fee_is_deep
}
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, original_maker_quantity: u64, base_quantity: u64, quote_quantity: u64, taker_is_bid: bool, maker_epoch: u64, maker_deep_price: deep_price::OrderDeepPrice, taker_fee_is_deep: bool, maker_fee_is_deep: bool): fill::Fill
public(package) fun new(
maker_order_id: u128,
maker_client_order_id: u64,
execution_price: u64,
balance_manager_id: ID,
expired: bool,
completed: bool,
original_maker_quantity: u64,
base_quantity: u64,
quote_quantity: u64,
taker_is_bid: bool,
maker_epoch: u64,
maker_deep_price: OrderDeepPrice,
taker_fee_is_deep: bool,
maker_fee_is_deep: bool,
): Fill {
Fill {
maker_order_id,
maker_client_order_id,
execution_price,
balance_manager_id,
expired,
completed,
original_maker_quantity,
base_quantity,
quote_quantity,
taker_is_bid,
maker_epoch,
maker_deep_price,
taker_fee: 0,
taker_fee_is_deep,
maker_fee: 0,
maker_fee_is_deep,
}
}
get_settled_maker_quantities
Calculate the quantities to settle for the maker.
public(friend) fun get_settled_maker_quantities(self: &fill::Fill): balances::Balances
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)
}
set_fill_maker_fee
public(friend) fun set_fill_maker_fee(self: &mut fill::Fill, fee: u64)
public(package) fun set_fill_maker_fee(self: &mut Fill, fee: u64) {
self.maker_fee = fee;
}
set_fill_taker_fee
public(friend) fun set_fill_taker_fee(self: &mut fill::Fill, fee: u64)
public(package) fun set_fill_taker_fee(self: &mut Fill, fee: u64) {
self.taker_fee = fee;
}