0x0::trade_params
TradeParams module contains the trade parameters for a trading pair.
TradeParams
new
maker_fee
taker_fee
taker_fee_for_user
stake_required
TradeParams
struct TradeParams has copy, drop, store
new
public(friend) fun new(taker_fee: u64, maker_fee: u64, stake_required: u64): trade_params::TradeParams
public(package) fun new(
taker_fee: u64,
maker_fee: u64,
stake_required: u64,
): TradeParams {
TradeParams { taker_fee, maker_fee, stake_required }
}
maker_fee
public(friend) fun maker_fee(trade_params: &trade_params::TradeParams): u64
public(package) fun maker_fee(trade_params: &TradeParams): u64 {
trade_params.maker_fee
}
taker_fee
public(friend) fun taker_fee(trade_params: &trade_params::TradeParams): u64
public(package) fun taker_fee(trade_params: &TradeParams): u64 {
trade_params.taker_fee
}
taker_fee_for_user
Returns the taker fee for a user based on the active stake and volume in deep. Taker fee is halved if user has enough stake and volume.
public(friend) fun taker_fee_for_user(self: &trade_params::TradeParams, active_stake: u64, volume_in_deep: u128): u64
public(package) fun taker_fee_for_user(
self: &TradeParams,
active_stake: u64,
volume_in_deep: u128,
): u64 {
if (
active_stake >= self.stake_required &&
volume_in_deep >= (self.stake_required as u128)
) {
self.taker_fee / 2
} else {
self.taker_fee
}
}
stake_required
public(friend) fun stake_required(trade_params: &trade_params::TradeParams): u64
public(package) fun stake_required(trade_params: &TradeParams): u64 {
trade_params.stake_required
}