gmsol_store/constants/
market.rs

1use crate::states::Factor;
2
3const SECONDS_PER_YEAR: Factor = 3600 * 24 * 365;
4
5/// Default receiver factor.
6pub const DEFAULT_RECEIVER_FACTOR: Factor = 70_000_000_000_000_000_000;
7
8/// Default swap impact exponent.
9pub const DEFAULT_SWAP_IMPACT_EXPONENT: Factor = super::MARKET_USD_UNIT;
10/// Default swap impact positive factor.
11pub const DEFAULT_SWAP_IMPACT_POSITIVE_FACTOR: Factor = 0;
12/// Default swap impact negative factor.
13pub const DEFAULT_SWAP_IMPACT_NEGATIVE_FACTOR: Factor = 0;
14
15/// Default swap fee factor for positive impact.
16pub const DEFAULT_SWAP_FEE_FACTOR_FOR_POSITIVE_IMPACT: Factor = 0;
17/// Default swap fee factor for negative impact.
18pub const DEFAULT_SWAP_FEE_FACTOR_FOR_NEGATIVE_IMPACT: Factor = 0;
19
20/// Default min position size usd.
21pub const DEFAULT_MIN_POSITION_SIZE_USD: Factor = super::MARKET_USD_UNIT;
22/// Default min collateral value.
23pub const DEFAULT_MIN_COLLATERAL_VALUE: Factor = super::MARKET_USD_UNIT;
24/// Default min collateral factor.
25pub const DEFAULT_MIN_COLLATERAL_FACTOR: Factor = super::MARKET_USD_UNIT / 100;
26/// Default min collateral factor for open interest for long
27pub const DEFAULT_MIN_COLLATERAL_FACTOR_FOR_OPEN_INTEREST_FOR_LONG: Factor = 380_000_000_000;
28/// Default min collateral factor for open interest for short
29pub const DEFAULT_MIN_COLLATERAL_FACTOR_FOR_OPEN_INTEREST_FOR_SHORT: Factor = 380_000_000_000;
30/// Default max positive position impact factor.
31pub const DEFAULT_MAX_POSITIVE_POSITION_IMPACT_FACTOR: Factor = 500_000_000_000_000_000;
32/// Default max negative position impact factor.
33pub const DEFAULT_MAX_NEGATIVE_POSITION_IMPACT_FACTOR: Factor = 500_000_000_000_000_000;
34/// Default max position impact factor for liquidations.
35pub const DEFAULT_MAX_POSITION_IMPACT_FACTOR_FOR_LIQUIDATIONS: Factor = 0;
36
37/// Default position impact exponent.
38pub const DEFAULT_POSITION_IMPACT_EXPONENT: Factor = 2 * super::MARKET_USD_UNIT;
39/// Default position impact positive factor.
40pub const DEFAULT_POSITION_IMPACT_POSITIVE_FACTOR: Factor = 10_000_000_000_000;
41/// Default position impact negative factor.
42pub const DEFAULT_POSITION_IMPACT_NEGATIVE_FACTOR: Factor = 20_000_000_000_000;
43
44/// Default order fee factor for positive impact.
45pub const DEFAULT_ORDER_FEE_FACTOR_FOR_POSITIVE_IMPACT: Factor = 50_000_000_000_000_000;
46/// Default order fee factor for negative impact.
47pub const DEFAULT_ORDER_FEE_FACTOR_FOR_NEGATIVE_IMPACT: Factor = 70_000_000_000_000_000;
48
49/// Default liquidation fee factor.
50pub const DEFAULT_LIQUIDATION_FEE_FACTOR: Factor = 20 * super::MARKET_USD_UNIT / 10_000;
51
52/// Default position impact distribute factor.
53pub const DEFAULT_POSITION_IMPACT_DISTRIBUTE_FACTOR: Factor = 230_000_000_000_000_000;
54/// Default min position impact pool amount.
55pub const DEFAULT_MIN_POSITION_IMPACT_POOL_AMOUNT: Factor = 1_500_000_000;
56
57/// Default borrowing fee factor for long.
58pub const DEFAULT_BORROWING_FEE_FACTOR_FOR_LONG: Factor = 2_780_000_000_000;
59/// Default borrowing fee factor for short.
60pub const DEFAULT_BORROWING_FEE_FACTOR_FOR_SHORT: Factor = 2_780_000_000_000;
61/// Default borrowing fee exponent for long.
62pub const DEFAULT_BORROWING_FEE_EXPONENT_FOR_LONG: Factor = super::MARKET_USD_UNIT;
63/// Default borrowing fee exponent for short.
64pub const DEFAULT_BORROWING_FEE_EXPONENT_FOR_SHORT: Factor = super::MARKET_USD_UNIT;
65/// Default borrowing fee optimal usage factor for long.
66pub const DEFAULT_BORROWING_FEE_OPTIMAL_USAGE_FACTOR_FOR_LONG: Factor =
67    75 * super::MARKET_USD_UNIT / 100;
68/// Default borrowing fee optimal usage factor for short.
69pub const DEFAULT_BORROWING_FEE_OPTIMAL_USAGE_FACTOR_FOR_SHORT: Factor =
70    75 * super::MARKET_USD_UNIT / 100;
71/// Default borrowing fee base factor for long.
72pub const DEFAULT_BORROWING_FEE_BASE_FACTOR_FOR_LONG: Factor =
73    60 * super::MARKET_USD_UNIT / 100 / SECONDS_PER_YEAR;
74/// Default borrowing fee base factor for short.
75pub const DEFAULT_BORROWING_FEE_BASE_FACTOR_FOR_SHORT: Factor =
76    60 * super::MARKET_USD_UNIT / 100 / SECONDS_PER_YEAR;
77/// Default borrowing fee above optimal usage factor for long.
78pub const DEFAULT_BORROWING_FEE_ABOVE_OPTIMAL_USAGE_FACTOR_FOR_LONG: Factor =
79    150 * super::MARKET_USD_UNIT / 100 / SECONDS_PER_YEAR;
80/// Default borrowing fee above optimal usage factor for short.
81pub const DEFAULT_BORROWING_FEE_ABOVE_OPTIMAL_USAGE_FACTOR_FOR_SHORT: Factor =
82    150 * super::MARKET_USD_UNIT / 100 / SECONDS_PER_YEAR;
83
84/// Default funding fee exponent.
85pub const DEFAULT_FUNDING_FEE_EXPONENT: Factor = super::MARKET_USD_UNIT;
86/// Default funding factor.
87pub const DEFAULT_FUNDING_FEE_FACTOR: Factor = 2_000_000_000_000;
88/// Default funding fee max factor per second.
89pub const DEFAULT_FUNDING_FEE_MAX_FACTOR_PER_SECOND: Factor = 1_500_000_000_000;
90/// Default funding fee min factor per second.
91pub const DEFAULT_FUNDING_FEE_MIN_FACTOR_PER_SECOND: Factor = 30_000_000_000;
92/// Default funding fee increase factor per second.
93pub const DEFAULT_FUNDING_FEE_INCREASE_FACTOR_PER_SECOND: Factor = 116_000_000;
94/// Default funding fee decrease factor per second.
95pub const DEFAULT_FUNDING_FEE_DECREASE_FACTOR_PER_SECOND: Factor = 0;
96/// Default funding fee threshold for stable funding.
97pub const DEFAULT_FUNDING_FEE_THRESHOLD_FOR_STABLE_FUNDING: Factor = 5_000_000_000_000_000_000;
98/// Default funding fee threshold for decrease funding.
99pub const DEFAULT_FUNDING_FEE_THRESHOLD_FOR_DECREASE_FUNDING: Factor = 0;
100
101/// Default reserve factor.
102pub const DEFAULT_RESERVE_FACTOR: Factor = 50_000_000_000_000_000_000;
103/// Default open interest reserve factor.
104pub const DEFAULT_OPEN_INTEREST_RESERVE_FACTOR: Factor = 45_000_000_000_000_000_000;
105
106/// Default max pnl factor for long deposit.
107pub const DEFAULT_MAX_PNL_FACTOR_FOR_LONG_DEPOSIT: Factor = 60_000_000_000_000_000_000;
108/// Default max pnl factor for short deposit.
109pub const DEFAULT_MAX_PNL_FACTOR_FOR_SHORT_DEPOSIT: Factor = 60_000_000_000_000_000_000;
110/// Default max pnl factor for long withdrawal.
111pub const DEFAULT_MAX_PNL_FACTOR_FOR_LONG_WITHDRAWAL: Factor = 60_000_000_000_000_000_000;
112/// Default max pnl factor for short withdrawal.
113pub const DEFAULT_MAX_PNL_FACTOR_FOR_SHORT_WITHDRAWAL: Factor = 60_000_000_000_000_000_000;
114/// Default max pnl factor for long trader.
115pub const DEFAULT_MAX_PNL_FACTOR_FOR_LONG_TRADER: Factor = 60_000_000_000_000_000_000;
116/// Default max pnl factor for short trader.
117pub const DEFAULT_MAX_PNL_FACTOR_FOR_SHORT_TRADER: Factor = 60_000_000_000_000_000_000;
118/// Default max pnl factor for long adl.
119pub const DEFAULT_MAX_PNL_FACTOR_FOR_LONG_ADL: Factor = 55_000_000_000_000_000_000;
120/// Default max pnl factor for short adl.
121pub const DEFAULT_MAX_PNL_FACTOR_FOR_SHORT_ADL: Factor = 55_000_000_000_000_000_000;
122/// Default min pnl factor after long adl.
123pub const DEFAULT_MIN_PNL_FACTOR_AFTER_LONG_ADL: Factor = 50_000_000_000_000_000_000;
124/// Default min pnl factor after short adl.
125pub const DEFAULT_MIN_PNL_FACTOR_AFTER_SHORT_ADL: Factor = 50_000_000_000_000_000_000;
126
127/// Default max pool amount for long token.
128pub const DEFAULT_MAX_POOL_AMOUNT_FOR_LONG_TOKEN: Factor = 900_000_000_000;
129/// Default max pool amount for short token.
130pub const DEFAULT_MAX_POOL_AMOUNT_FOR_SHORT_TOKEN: Factor = 900_000_000_000;
131
132/// Default max pool value for deposit for long token.
133pub const DEFAULT_MAX_POOL_VALUE_FOR_DEPOSIT_LONG_TOKEN: Factor = 750_000 * super::MARKET_USD_UNIT;
134/// Default max pool value for deposit for short token.
135pub const DEFAULT_MAX_POOL_VALUE_FOR_DEPOSIT_SHORT_TOKEN: Factor = 750_000 * super::MARKET_USD_UNIT;
136
137/// Default max open interest for long.
138pub const DEFAULT_MAX_OPEN_INTEREST_FOR_LONG: Factor = 450_000 * super::MARKET_USD_UNIT;
139/// Default max open interest for short.
140pub const DEFAULT_MAX_OPEN_INTEREST_FOR_SHORT: Factor = 450_000 * super::MARKET_USD_UNIT;
141
142/// Default min tokens for first deposit.
143pub const DEFAULT_MIN_TOKENS_FOR_FIRST_DEPOSIT: Factor = 0;
144
145/// Default skip borrowing fee for smaller side.
146pub const DEFAULT_SKIP_BORROWING_FEE_FOR_SMALLER_SIDE: bool = true;
147
148/// Default ignore open interest for usage factor.
149pub const DEFAULT_IGNORE_OPEN_INTEREST_FOR_USAGE_FACTOR: bool = false;