pub struct Config {Show 35 fields
pub trading_fee_notional_size: Decimal256,
pub trading_fee_counter_collateral: Decimal256,
pub crank_execs: u32,
pub max_leverage: Number,
pub funding_rate_sensitivity: Decimal256,
pub funding_rate_max_annualized: Decimal256,
pub borrow_fee_rate_min_annualized: NumberGtZero,
pub borrow_fee_rate_max_annualized: NumberGtZero,
pub carry_leverage: Decimal256,
pub mute_events: bool,
pub liquifunding_delay_seconds: u32,
pub protocol_tax: Decimal256,
pub unstake_period_seconds: u32,
pub target_utilization: NonZero<Decimal256>,
pub borrow_fee_sensitivity: NumberGtZero,
pub max_xlp_rewards_multiplier: NumberGtZero,
pub min_xlp_rewards_multiplier: NumberGtZero,
pub delta_neutrality_fee_sensitivity: NumberGtZero,
pub delta_neutrality_fee_cap: NumberGtZero,
pub delta_neutrality_fee_tax: Decimal256,
pub crank_fee_charged: Usd,
pub crank_fee_surcharge: Usd,
pub crank_fee_reward: Usd,
pub minimum_deposit_usd: Usd,
pub liquifunding_delay_fuzz_seconds: u32,
pub max_liquidity: MaxLiquidity,
pub disable_position_nft_exec: bool,
pub liquidity_cooldown_seconds: u32,
pub exposure_margin_ratio: Decimal256,
pub referral_reward_ratio: Decimal256,
pub spot_price: SpotPriceConfig,
pub _unused1: Option<u32>,
pub _unused2: Option<u32>,
pub _unused3: Option<Collateral>,
pub _unused4: Option<u32>,
}Expand description
Configuration info for the vAMM Set by admin-only Since this tends to cross the message boundary all the numeric types are u32 or lower helper functions are available where more bits are needed
Fields§
§trading_fee_notional_size: Decimal256The fee to open a position, as a percentage of the notional size
trading_fee_counter_collateral: Decimal256The fee to open a position, as a percentage of the counter-side collateral
crank_execs: u32default number of crank exeuctions to do when none specified
max_leverage: NumberThe maximum allowed leverage when opening a position
funding_rate_sensitivity: Decimal256Impacts how much the funding rate changes in response to net notional changes.
funding_rate_max_annualized: Decimal256The maximum annualized rate for a funding payment
borrow_fee_rate_min_annualized: NumberGtZeroThe minimum annualized rate for borrow fee payments
borrow_fee_rate_max_annualized: NumberGtZeroThe maximum annualized rate for borrow fee payments
carry_leverage: Decimal256Needed to ensure financial model is balanced
Must be at most 1 less than the Config::max_leverage
mute_events: boolDo not emit events (default is false, events will be emitted)
liquifunding_delay_seconds: u32Delay between liquifundings, in seconds
protocol_tax: Decimal256The percentage of fees that are taken for the protocol
unstake_period_seconds: u32How long it takes to unstake xLP tokens into LP tokens, in seconds
target_utilization: NonZero<Decimal256>Target utilization ratio liquidity, given as a ratio. (Must be between 0 and 1).
borrow_fee_sensitivity: NumberGtZeroBorrow fee sensitivity parameter.
max_xlp_rewards_multiplier: NumberGtZeroMaximum multiplier for xLP versus LP borrow fee shares.
For example, if this number is 5, then as liquidity in the protocol approaches 100% in LP and 0% in xLP, any xLP token will receive 5x the rewards of an LP token.
min_xlp_rewards_multiplier: NumberGtZeroMinimum counterpoint to Config::max_xlp_rewards_multiplier
delta_neutrality_fee_sensitivity: NumberGtZeroDelta neutrality fee sensitivity parameter.
Higher values indicate markets with greater depth of liquidity, and allow for larger divergence for delta neutrality in the markets.
This value is specified in the notional asset.
delta_neutrality_fee_cap: NumberGtZeroDelta neutrality fee cap parameter, given as a percentage
delta_neutrality_fee_tax: Decimal256Proportion of delta neutrality inflows that are sent to the protocol.
crank_fee_charged: UsdThe crank fee to be paid into the system, in collateral
crank_fee_surcharge: UsdThe crank surcharge charged for every 10 items in the deferred execution queue.
This is intended to create backpressure in times of high congestion.
For every 10 items in the deferred execution queue, this amount is added to the crank fee charged on performing a deferred execution message.
This is only charged while adding new items to the queue, not when performing ongoing tasks like liquifunding or liquidations.
crank_fee_reward: UsdThe crank fee to be sent to crankers, in collateral
minimum_deposit_usd: UsdMinimum deposit collateral, given in USD
liquifunding_delay_fuzz_seconds: u32The liquifunding delay fuzz factor, in seconds.
Up to how many seconds will we perform a liquifunding early. This will be part of a semi-randomly generated value and will allow us to schedule liquifundings arbitrarily to smooth out spikes in traffic.
max_liquidity: MaxLiquidityThe maximum amount of liquidity that can be deposited into the market.
disable_position_nft_exec: boolDisable the ability to proxy CW721 execution messages for positions. Even if this is true, queries will still work as usual.
liquidity_cooldown_seconds: u32The liquidity cooldown period.
After depositing new funds into the market, liquidity providers will have a period of time where they cannot withdraw their funds. This is intended to prevent an MEV attack where someone can reorder transactions to extract fees from traders without taking on any impairment risk.
This protection is only triggered by deposit of new funds; reinvesting existing yield does not introduce a cooldown.
While the cooldown is in place, providers are prevented from either withdrawing liquidity or transferring their LP and xLP tokens.
For migration purposes, this value defaults to 0, meaning no cooldown period.
exposure_margin_ratio: Decimal256Ratio of notional size used for the exposure component of the liquidation margin.
referral_reward_ratio: Decimal256Portion of trading fees given as rewards to referrers.
spot_price: SpotPriceConfigThe spot price config for this market
_unused1: Option<u32>Just for historical reasons/migrations
_unused2: Option<u32>Just for historical reasons/migrations
_unused3: Option<Collateral>Just for historical reasons/migrations
_unused4: Option<u32>Just for historical reasons/migrations
Implementations§
source§impl Config
impl Config
sourcepub fn calculate_trade_fee(
&self,
old_notional_size_in_collateral: Signed<Collateral>,
new_notional_size_in_collateral: Signed<Collateral>,
old_counter_collateral: Collateral,
new_counter_collateral: Collateral,
) -> Result<Collateral>
pub fn calculate_trade_fee( &self, old_notional_size_in_collateral: Signed<Collateral>, new_notional_size_in_collateral: Signed<Collateral>, old_counter_collateral: Collateral, new_counter_collateral: Collateral, ) -> Result<Collateral>
Calculate the trade fee based on the given old and new position parameters.
When opening a new position, you can use Config::calculate_trade_fee_open.
sourcepub fn calculate_trade_fee_open(
&self,
notional_size_in_collateral: Signed<Collateral>,
counter_collateral: Collateral,
) -> Result<Collateral>
pub fn calculate_trade_fee_open( &self, notional_size_in_collateral: Signed<Collateral>, counter_collateral: Collateral, ) -> Result<Collateral>
Same as Config::calculate_trade_fee but for opening a new position.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<Config> for ConfigUpdate
impl From<Config> for ConfigUpdate
source§impl JsonSchema for Config
impl JsonSchema for Config
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moresource§impl PartialEq for Config
impl PartialEq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more