levana_perpswap_cosmos/contracts/market/config/
defaults.rs

1#![allow(missing_docs)]
2use super::MaxLiquidity;
3use crate::storage::{NonZero, Number, NumberGtZero, Usd};
4use cosmwasm_std::Decimal256;
5
6pub struct ConfigDefaults {}
7
8impl ConfigDefaults {
9    pub fn trading_fee_notional_size() -> Decimal256 {
10        "0.001".parse().unwrap()
11    }
12
13    pub fn trading_fee_counter_collateral() -> Decimal256 {
14        "0.001".parse().unwrap()
15    }
16    pub const fn crank_execs() -> u32 {
17        7
18    }
19    pub fn max_leverage() -> Number {
20        Number::try_from("30").unwrap()
21    }
22    pub fn funding_rate_sensitivity() -> Decimal256 {
23        "10".parse().unwrap()
24    }
25    pub fn funding_rate_max_annualized() -> Decimal256 {
26        "0.9".parse().unwrap()
27    }
28    pub fn borrow_fee_rate_min_annualized() -> NumberGtZero {
29        "0.01".parse().unwrap()
30    }
31    pub fn borrow_fee_rate_max_annualized() -> NumberGtZero {
32        "0.60".parse().unwrap()
33    }
34    pub fn carry_leverage() -> Decimal256 {
35        "10".parse().unwrap()
36    }
37    pub const fn mute_events() -> bool {
38        false
39    }
40    pub const fn liquifunding_delay_seconds() -> u32 {
41        60 * 60 * 24
42    }
43    pub fn protocol_tax() -> Decimal256 {
44        "0.3".parse().unwrap()
45    }
46    pub const fn unstake_period_seconds() -> u32 {
47        // 45 day
48        60 * 60 * 24 * 45
49    }
50    pub fn target_utilization() -> NonZero<Decimal256> {
51        "0.8".parse().unwrap()
52    }
53
54    pub fn borrow_fee_sensitivity() -> NumberGtZero {
55        // Try to realize the bias over a 3 day period.
56        //
57        // See: https://phobosfinance.atlassian.net/browse/PERP-606
58        //
59        // Spreadsheet calculated this value:
60        //
61        // https://docs.google.com/spreadsheets/d/15EG3I6XnaUKI20ja7XiCqLOjFS80QhKdnoL-PsjzJ-0/edit#gid=0
62        NumberGtZero::try_from((Number::ONE / Number::try_from("12").unwrap()).unwrap()).unwrap()
63    }
64
65    pub fn max_xlp_rewards_multiplier() -> NumberGtZero {
66        "2".parse().unwrap()
67    }
68    pub fn min_xlp_rewards_multiplier() -> NumberGtZero {
69        "1".parse().unwrap()
70    }
71    pub fn delta_neutrality_fee_sensitivity() -> NumberGtZero {
72        "50000000".parse().unwrap()
73    }
74    pub fn delta_neutrality_fee_cap() -> NumberGtZero {
75        "0.005".parse().unwrap()
76    }
77    pub fn delta_neutrality_fee_tax() -> Decimal256 {
78        "0.05".parse().unwrap()
79    }
80    pub fn crank_fee_charged() -> Usd {
81        "0.1".parse().unwrap()
82    }
83    pub fn crank_fee_surcharge() -> Usd {
84        "0.08".parse().unwrap()
85    }
86    pub fn crank_fee_reward() -> Usd {
87        "0.09".parse().unwrap()
88    }
89    pub fn minimum_deposit_usd() -> Usd {
90        "5".parse().unwrap()
91    }
92
93    pub const fn liquifunding_delay_fuzz_seconds() -> u32 {
94        60 * 60
95    }
96    pub const fn max_liquidity() -> MaxLiquidity {
97        MaxLiquidity::Unlimited {}
98    }
99    pub const fn disable_position_nft_exec() -> bool {
100        false
101    }
102    pub const fn liquidity_cooldown_seconds() -> u32 {
103        // FIXME in the future, bump to 6.5 hours. Holding off for now because
104        // otherwise we'll get confusing messages from sync-config. Wait until
105        // we're about to migrate contracts again.
106
107        // Default to 1 hour
108        60 * 60
109    }
110    pub fn exposure_margin_ratio() -> Decimal256 {
111        "0.005".parse().unwrap()
112    }
113    pub fn referral_reward_ratio() -> Decimal256 {
114        "0.05".parse().unwrap()
115    }
116}