elys_std/types/elys/
perpetual.rs

1use elys_std_deriv::CosmwasmExt;
2/// Params defines the parameters for the module.
3#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(
5    Clone,
6    PartialEq,
7    Eq,
8    ::prost::Message,
9    ::serde::Serialize,
10    ::serde::Deserialize,
11    ::schemars::JsonSchema,
12    CosmwasmExt,
13)]
14#[proto_message(type_url = "/elys.perpetual.LegacyParams")]
15pub struct LegacyParams {
16    #[prost(string, tag = "1")]
17    pub leverage_max: ::prost::alloc::string::String,
18    #[prost(string, tag = "2")]
19    pub borrow_interest_rate_max: ::prost::alloc::string::String,
20    #[prost(string, tag = "3")]
21    pub borrow_interest_rate_min: ::prost::alloc::string::String,
22    #[prost(string, tag = "4")]
23    pub borrow_interest_rate_increase: ::prost::alloc::string::String,
24    #[prost(string, tag = "5")]
25    pub borrow_interest_rate_decrease: ::prost::alloc::string::String,
26    #[prost(string, tag = "6")]
27    pub health_gain_factor: ::prost::alloc::string::String,
28    #[prost(int64, tag = "7")]
29    #[serde(
30        serialize_with = "crate::serde::as_str::serialize",
31        deserialize_with = "crate::serde::as_str::deserialize"
32    )]
33    pub max_open_positions: i64,
34    #[prost(string, tag = "8")]
35    pub pool_open_threshold: ::prost::alloc::string::String,
36    #[prost(string, tag = "9")]
37    pub borrow_interest_payment_fund_percentage: ::prost::alloc::string::String,
38    #[prost(string, tag = "10")]
39    pub borrow_interest_payment_fund_address: ::prost::alloc::string::String,
40    #[prost(string, tag = "11")]
41    pub safety_factor: ::prost::alloc::string::String,
42    #[prost(bool, tag = "12")]
43    pub borrow_interest_payment_enabled: bool,
44    #[prost(bool, tag = "13")]
45    pub whitelisting_enabled: bool,
46    #[prost(string, tag = "14")]
47    pub perpetual_swap_fee: ::prost::alloc::string::String,
48    #[prost(int64, tag = "15")]
49    #[serde(
50        serialize_with = "crate::serde::as_str::serialize",
51        deserialize_with = "crate::serde::as_str::deserialize"
52    )]
53    pub max_limit_order: i64,
54    #[prost(string, tag = "16")]
55    pub fixed_funding_rate: ::prost::alloc::string::String,
56    /// minimum value for take_profit_price/current price for long, should be
57    /// greater than 1
58    #[prost(string, tag = "17")]
59    pub minimum_long_take_profit_price_ratio: ::prost::alloc::string::String,
60    /// max value for take_profit_price/current price for long, should be greater
61    /// than 1
62    #[prost(string, tag = "18")]
63    pub maximum_long_take_profit_price_ratio: ::prost::alloc::string::String,
64    /// max value for take_profit_price/current price for short, should be less
65    /// than 1
66    #[prost(string, tag = "19")]
67    pub maximum_short_take_profit_price_ratio: ::prost::alloc::string::String,
68    /// No need for minimumShortTakeProfitPriceRatio as it will be 0, checked in
69    /// validate message
70    #[prost(bool, tag = "20")]
71    pub enable_take_profit_custody_liabilities: bool,
72    /// We create this and send this value to estimate swap ONLY when opening and
73    /// closing the position Ideally this value is set to half. When trader open a
74    /// position if they receive a weight balance bonus (which is half of weight
75    /// breaking fee, ideally) then while closing position they are charged weight
76    /// breaking fee. So we just directly apply half weight breaking fee on
77    /// perpetual swaps Question: does each need to have separate value of this
78    /// because PoolParams.WeightRecoveryFeePortion can be different Also, if
79    /// trader has no bonus only fee, then overall we are only applying the fee
80    /// half time
81    #[prost(string, tag = "21")]
82    pub weight_breaking_fee_factor: ::prost::alloc::string::String,
83}
84#[allow(clippy::derive_partial_eq_without_eq)]
85#[derive(
86    Clone,
87    PartialEq,
88    Eq,
89    ::prost::Message,
90    ::serde::Serialize,
91    ::serde::Deserialize,
92    ::schemars::JsonSchema,
93    CosmwasmExt,
94)]
95#[proto_message(type_url = "/elys.perpetual.Params")]
96pub struct Params {
97    #[prost(string, tag = "1")]
98    pub leverage_max: ::prost::alloc::string::String,
99    #[prost(string, tag = "2")]
100    pub borrow_interest_rate_max: ::prost::alloc::string::String,
101    #[prost(string, tag = "3")]
102    pub borrow_interest_rate_min: ::prost::alloc::string::String,
103    #[prost(string, tag = "4")]
104    pub borrow_interest_rate_increase: ::prost::alloc::string::String,
105    #[prost(string, tag = "5")]
106    pub borrow_interest_rate_decrease: ::prost::alloc::string::String,
107    #[prost(string, tag = "6")]
108    pub health_gain_factor: ::prost::alloc::string::String,
109    #[prost(int64, tag = "7")]
110    #[serde(
111        serialize_with = "crate::serde::as_str::serialize",
112        deserialize_with = "crate::serde::as_str::deserialize"
113    )]
114    pub max_open_positions: i64,
115    #[prost(string, tag = "8")]
116    pub pool_open_threshold: ::prost::alloc::string::String,
117    #[prost(string, tag = "9")]
118    pub borrow_interest_payment_fund_percentage: ::prost::alloc::string::String,
119    #[prost(string, tag = "10")]
120    pub borrow_interest_payment_fund_address: ::prost::alloc::string::String,
121    #[prost(string, tag = "11")]
122    pub safety_factor: ::prost::alloc::string::String,
123    #[prost(bool, tag = "12")]
124    pub borrow_interest_payment_enabled: bool,
125    #[prost(bool, tag = "13")]
126    pub whitelisting_enabled: bool,
127    #[prost(string, tag = "14")]
128    pub perpetual_swap_fee: ::prost::alloc::string::String,
129    #[prost(int64, tag = "15")]
130    #[serde(
131        serialize_with = "crate::serde::as_str::serialize",
132        deserialize_with = "crate::serde::as_str::deserialize"
133    )]
134    pub max_limit_order: i64,
135    #[prost(string, tag = "16")]
136    pub fixed_funding_rate: ::prost::alloc::string::String,
137    /// minimum value for take_profit_price/current price for long, should be
138    /// greater than 1
139    #[prost(string, tag = "17")]
140    pub minimum_long_take_profit_price_ratio: ::prost::alloc::string::String,
141    /// max value for take_profit_price/current price for long, should be greater
142    /// than 1
143    #[prost(string, tag = "18")]
144    pub maximum_long_take_profit_price_ratio: ::prost::alloc::string::String,
145    /// max value for take_profit_price/current price for short, should be less
146    /// than 1
147    #[prost(string, tag = "19")]
148    pub maximum_short_take_profit_price_ratio: ::prost::alloc::string::String,
149    /// No need for minimumShortTakeProfitPriceRatio as it will be 0, checked in
150    /// validate message
151    #[prost(bool, tag = "20")]
152    pub enable_take_profit_custody_liabilities: bool,
153    /// We create this and send this value to estimate swap ONLY when opening and
154    /// closing the position Ideally this value is set to half. When trader open a
155    /// position if they receive a weight balance bonus (which is half of weight
156    /// breaking fee, ideally) then while closing position they are charged weight
157    /// breaking fee. So we just directly apply half weight breaking fee on
158    /// perpetual swaps Question: does each need to have separate value of this
159    /// because PoolParams.WeightRecoveryFeePortion can be different Also, if
160    /// trader has no bonus only fee, then overall we are only applying the fee
161    /// half time
162    #[prost(string, tag = "21")]
163    pub weight_breaking_fee_factor: ::prost::alloc::string::String,
164    #[prost(uint64, repeated, tag = "22")]
165    #[serde(
166        serialize_with = "crate::serde::as_str_vec::serialize",
167        deserialize_with = "crate::serde::as_str_vec::deserialize"
168    )]
169    pub enabled_pools: ::prost::alloc::vec::Vec<u64>,
170}
171#[allow(clippy::derive_partial_eq_without_eq)]
172#[derive(
173    Clone,
174    PartialEq,
175    Eq,
176    ::prost::Message,
177    ::serde::Serialize,
178    ::serde::Deserialize,
179    ::schemars::JsonSchema,
180    CosmwasmExt,
181)]
182#[proto_message(type_url = "/elys.perpetual.PoolAsset")]
183pub struct PoolAsset {
184    #[prost(string, tag = "1")]
185    pub liabilities: ::prost::alloc::string::String,
186    #[prost(string, tag = "2")]
187    pub custody: ::prost::alloc::string::String,
188    #[prost(string, tag = "3")]
189    pub take_profit_liabilities: ::prost::alloc::string::String,
190    #[prost(string, tag = "4")]
191    pub take_profit_custody: ::prost::alloc::string::String,
192    #[prost(string, tag = "5")]
193    pub asset_denom: ::prost::alloc::string::String,
194    #[prost(string, tag = "6")]
195    pub collateral: ::prost::alloc::string::String,
196}
197#[allow(clippy::derive_partial_eq_without_eq)]
198#[derive(
199    Clone,
200    PartialEq,
201    Eq,
202    ::prost::Message,
203    ::serde::Serialize,
204    ::serde::Deserialize,
205    ::schemars::JsonSchema,
206    CosmwasmExt,
207)]
208#[proto_message(type_url = "/elys.perpetual.LegacyPool")]
209pub struct LegacyPool {
210    #[prost(uint64, tag = "1")]
211    #[serde(alias = "amm_poolID")]
212    #[serde(
213        serialize_with = "crate::serde::as_str::serialize",
214        deserialize_with = "crate::serde::as_str::deserialize"
215    )]
216    pub amm_pool_id: u64,
217    #[prost(string, tag = "2")]
218    pub health: ::prost::alloc::string::String,
219    #[prost(string, tag = "3")]
220    pub borrow_interest_rate: ::prost::alloc::string::String,
221    #[prost(message, repeated, tag = "4")]
222    pub pool_assets_long: ::prost::alloc::vec::Vec<PoolAsset>,
223    #[prost(message, repeated, tag = "5")]
224    pub pool_assets_short: ::prost::alloc::vec::Vec<PoolAsset>,
225    #[prost(int64, tag = "6")]
226    #[serde(
227        serialize_with = "crate::serde::as_str::serialize",
228        deserialize_with = "crate::serde::as_str::deserialize"
229    )]
230    pub last_height_borrow_interest_rate_computed: i64,
231    /// funding rate, if positive longs pay shorts, if negative shorts pay longs
232    #[prost(string, tag = "7")]
233    pub funding_rate: ::prost::alloc::string::String,
234    #[prost(message, repeated, tag = "8")]
235    pub fees_collected: ::prost::alloc::vec::Vec<super::super::cosmos::base::v1beta1::Coin>,
236}
237#[allow(clippy::derive_partial_eq_without_eq)]
238#[derive(
239    Clone,
240    PartialEq,
241    Eq,
242    ::prost::Message,
243    ::serde::Serialize,
244    ::serde::Deserialize,
245    ::schemars::JsonSchema,
246    CosmwasmExt,
247)]
248#[proto_message(type_url = "/elys.perpetual.Pool")]
249pub struct Pool {
250    #[prost(uint64, tag = "1")]
251    #[serde(alias = "amm_poolID")]
252    #[serde(
253        serialize_with = "crate::serde::as_str::serialize",
254        deserialize_with = "crate::serde::as_str::deserialize"
255    )]
256    pub amm_pool_id: u64,
257    #[prost(string, tag = "2")]
258    pub health: ::prost::alloc::string::String,
259    #[prost(string, tag = "3")]
260    pub borrow_interest_rate: ::prost::alloc::string::String,
261    #[prost(message, repeated, tag = "4")]
262    pub pool_assets_long: ::prost::alloc::vec::Vec<PoolAsset>,
263    #[prost(message, repeated, tag = "5")]
264    pub pool_assets_short: ::prost::alloc::vec::Vec<PoolAsset>,
265    #[prost(int64, tag = "6")]
266    #[serde(
267        serialize_with = "crate::serde::as_str::serialize",
268        deserialize_with = "crate::serde::as_str::deserialize"
269    )]
270    pub last_height_borrow_interest_rate_computed: i64,
271    /// funding rate, if positive longs pay shorts, if negative shorts pay longs
272    #[prost(string, tag = "7")]
273    pub funding_rate: ::prost::alloc::string::String,
274    #[prost(message, repeated, tag = "8")]
275    pub fees_collected: ::prost::alloc::vec::Vec<super::super::cosmos::base::v1beta1::Coin>,
276    #[prost(string, tag = "9")]
277    pub leverage_max: ::prost::alloc::string::String,
278}
279#[allow(clippy::derive_partial_eq_without_eq)]
280#[derive(
281    Clone,
282    PartialEq,
283    Eq,
284    ::prost::Message,
285    ::serde::Serialize,
286    ::serde::Deserialize,
287    ::schemars::JsonSchema,
288    CosmwasmExt,
289)]
290#[proto_message(type_url = "/elys.perpetual.MTP")]
291pub struct Mtp {
292    #[prost(string, tag = "1")]
293    pub address: ::prost::alloc::string::String,
294    #[prost(string, tag = "2")]
295    pub collateral_asset: ::prost::alloc::string::String,
296    #[prost(string, tag = "3")]
297    pub trading_asset: ::prost::alloc::string::String,
298    #[prost(string, tag = "4")]
299    pub liabilities_asset: ::prost::alloc::string::String,
300    #[prost(string, tag = "5")]
301    pub custody_asset: ::prost::alloc::string::String,
302    #[prost(string, tag = "6")]
303    pub collateral: ::prost::alloc::string::String,
304    #[prost(string, tag = "7")]
305    pub liabilities: ::prost::alloc::string::String,
306    #[prost(string, tag = "8")]
307    pub borrow_interest_paid_custody: ::prost::alloc::string::String,
308    #[prost(string, tag = "10")]
309    pub borrow_interest_unpaid_liability: ::prost::alloc::string::String,
310    #[prost(string, tag = "11")]
311    pub custody: ::prost::alloc::string::String,
312    #[prost(string, tag = "12")]
313    pub take_profit_liabilities: ::prost::alloc::string::String,
314    #[prost(string, tag = "13")]
315    pub take_profit_custody: ::prost::alloc::string::String,
316    #[prost(string, tag = "14")]
317    pub mtp_health: ::prost::alloc::string::String,
318    #[prost(enumeration = "Position", tag = "15")]
319    #[serde(
320        serialize_with = "crate::serde::as_str::serialize",
321        deserialize_with = "crate::serde::as_str::deserialize"
322    )]
323    pub position: i32,
324    #[prost(uint64, tag = "16")]
325    #[serde(alias = "ID")]
326    #[serde(
327        serialize_with = "crate::serde::as_str::serialize",
328        deserialize_with = "crate::serde::as_str::deserialize"
329    )]
330    pub id: u64,
331    #[prost(uint64, tag = "17")]
332    #[serde(alias = "amm_poolID")]
333    #[serde(
334        serialize_with = "crate::serde::as_str::serialize",
335        deserialize_with = "crate::serde::as_str::deserialize"
336    )]
337    pub amm_pool_id: u64,
338    #[prost(string, tag = "18")]
339    pub take_profit_price: ::prost::alloc::string::String,
340    #[prost(string, tag = "19")]
341    pub take_profit_borrow_factor: ::prost::alloc::string::String,
342    #[prost(string, tag = "20")]
343    pub funding_fee_paid_custody: ::prost::alloc::string::String,
344    #[prost(string, tag = "21")]
345    pub funding_fee_received_custody: ::prost::alloc::string::String,
346    #[prost(string, tag = "22")]
347    pub open_price: ::prost::alloc::string::String,
348    #[prost(string, tag = "23")]
349    pub stop_loss_price: ::prost::alloc::string::String,
350    #[prost(uint64, tag = "24")]
351    #[serde(
352        serialize_with = "crate::serde::as_str::serialize",
353        deserialize_with = "crate::serde::as_str::deserialize"
354    )]
355    pub last_interest_calc_time: u64,
356    #[prost(uint64, tag = "25")]
357    #[serde(
358        serialize_with = "crate::serde::as_str::serialize",
359        deserialize_with = "crate::serde::as_str::deserialize"
360    )]
361    pub last_interest_calc_block: u64,
362    #[prost(uint64, tag = "26")]
363    #[serde(
364        serialize_with = "crate::serde::as_str::serialize",
365        deserialize_with = "crate::serde::as_str::deserialize"
366    )]
367    pub last_funding_calc_time: u64,
368    #[prost(uint64, tag = "27")]
369    #[serde(
370        serialize_with = "crate::serde::as_str::serialize",
371        deserialize_with = "crate::serde::as_str::deserialize"
372    )]
373    pub last_funding_calc_block: u64,
374}
375#[allow(clippy::derive_partial_eq_without_eq)]
376#[derive(
377    Clone,
378    PartialEq,
379    Eq,
380    ::prost::Message,
381    ::serde::Serialize,
382    ::serde::Deserialize,
383    ::schemars::JsonSchema,
384    CosmwasmExt,
385)]
386#[proto_message(type_url = "/elys.perpetual.InterestBlock")]
387pub struct InterestBlock {
388    #[prost(string, tag = "1")]
389    pub interest_rate: ::prost::alloc::string::String,
390    #[prost(int64, tag = "2")]
391    #[serde(
392        serialize_with = "crate::serde::as_str::serialize",
393        deserialize_with = "crate::serde::as_str::deserialize"
394    )]
395    pub block_height: i64,
396    #[prost(int64, tag = "3")]
397    #[serde(
398        serialize_with = "crate::serde::as_str::serialize",
399        deserialize_with = "crate::serde::as_str::deserialize"
400    )]
401    pub block_time: i64,
402}
403#[allow(clippy::derive_partial_eq_without_eq)]
404#[derive(
405    Clone,
406    PartialEq,
407    Eq,
408    ::prost::Message,
409    ::serde::Serialize,
410    ::serde::Deserialize,
411    ::schemars::JsonSchema,
412    CosmwasmExt,
413)]
414#[proto_message(type_url = "/elys.perpetual.FundingRateBlock")]
415pub struct FundingRateBlock {
416    #[prost(string, tag = "1")]
417    pub funding_rate_long: ::prost::alloc::string::String,
418    #[prost(string, tag = "2")]
419    pub funding_rate_short: ::prost::alloc::string::String,
420    #[prost(string, tag = "3")]
421    pub funding_share_short: ::prost::alloc::string::String,
422    #[prost(string, tag = "4")]
423    pub funding_share_long: ::prost::alloc::string::String,
424    #[prost(int64, tag = "5")]
425    #[serde(
426        serialize_with = "crate::serde::as_str::serialize",
427        deserialize_with = "crate::serde::as_str::deserialize"
428    )]
429    pub block_height: i64,
430    #[prost(int64, tag = "6")]
431    #[serde(
432        serialize_with = "crate::serde::as_str::serialize",
433        deserialize_with = "crate::serde::as_str::deserialize"
434    )]
435    pub block_time: i64,
436}
437#[allow(clippy::derive_partial_eq_without_eq)]
438#[derive(
439    Clone,
440    PartialEq,
441    Eq,
442    ::prost::Message,
443    ::serde::Serialize,
444    ::serde::Deserialize,
445    ::schemars::JsonSchema,
446    CosmwasmExt,
447)]
448#[proto_message(type_url = "/elys.perpetual.WhiteList")]
449pub struct WhiteList {
450    #[prost(string, repeated, tag = "1")]
451    pub validator_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
452}
453#[allow(clippy::derive_partial_eq_without_eq)]
454#[derive(
455    Clone,
456    PartialEq,
457    Eq,
458    ::prost::Message,
459    ::serde::Serialize,
460    ::serde::Deserialize,
461    ::schemars::JsonSchema,
462    CosmwasmExt,
463)]
464#[proto_message(type_url = "/elys.perpetual.PositionRequest")]
465pub struct PositionRequest {
466    #[prost(string, tag = "1")]
467    pub address: ::prost::alloc::string::String,
468    #[prost(uint64, tag = "2")]
469    #[serde(alias = "ID")]
470    #[serde(
471        serialize_with = "crate::serde::as_str::serialize",
472        deserialize_with = "crate::serde::as_str::deserialize"
473    )]
474    pub id: u64,
475}
476#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
477#[repr(i32)]
478#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)]
479pub enum Position {
480    Unspecified = 0,
481    Long = 1,
482    Short = 2,
483}
484impl Position {
485    /// String value of the enum field names used in the ProtoBuf definition.
486    ///
487    /// The values are not transformed in any way and thus are considered stable
488    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
489    pub fn as_str_name(&self) -> &'static str {
490        match self {
491            Position::Unspecified => "UNSPECIFIED",
492            Position::Long => "LONG",
493            Position::Short => "SHORT",
494        }
495    }
496    /// Creates an enum from field names used in the ProtoBuf definition.
497    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
498        match value {
499            "UNSPECIFIED" => Some(Self::Unspecified),
500            "LONG" => Some(Self::Long),
501            "SHORT" => Some(Self::Short),
502            _ => None,
503        }
504    }
505}
506/// GenesisState defines the perpetual module's genesis state.
507#[allow(clippy::derive_partial_eq_without_eq)]
508#[derive(
509    Clone,
510    PartialEq,
511    Eq,
512    ::prost::Message,
513    ::serde::Serialize,
514    ::serde::Deserialize,
515    ::schemars::JsonSchema,
516    CosmwasmExt,
517)]
518#[proto_message(type_url = "/elys.perpetual.GenesisState")]
519pub struct GenesisState {
520    #[prost(message, optional, tag = "1")]
521    pub params: ::core::option::Option<Params>,
522    #[prost(message, repeated, tag = "2")]
523    pub pool_list: ::prost::alloc::vec::Vec<Pool>,
524    #[prost(message, repeated, tag = "3")]
525    pub mtp_list: ::prost::alloc::vec::Vec<Mtp>,
526    #[prost(string, repeated, tag = "4")]
527    pub address_whitelist: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
528}
529#[allow(clippy::derive_partial_eq_without_eq)]
530#[derive(
531    Clone,
532    PartialEq,
533    Eq,
534    ::prost::Message,
535    ::serde::Serialize,
536    ::serde::Deserialize,
537    ::schemars::JsonSchema,
538    CosmwasmExt,
539)]
540#[proto_message(type_url = "/elys.perpetual.Fees")]
541pub struct Fees {
542    #[prost(string, tag = "1")]
543    pub total_fees_base_currency: ::prost::alloc::string::String,
544    #[prost(string, tag = "2")]
545    pub borrow_interest_fees_liability_asset: ::prost::alloc::string::String,
546    #[prost(string, tag = "3")]
547    pub borrow_interest_fees_base_currency: ::prost::alloc::string::String,
548    #[prost(string, tag = "4")]
549    pub funding_fees_liquidity_asset: ::prost::alloc::string::String,
550    #[prost(string, tag = "5")]
551    pub funding_fees_base_currency: ::prost::alloc::string::String,
552}
553#[allow(clippy::derive_partial_eq_without_eq)]
554#[derive(
555    Clone,
556    PartialEq,
557    Eq,
558    ::prost::Message,
559    ::serde::Serialize,
560    ::serde::Deserialize,
561    ::schemars::JsonSchema,
562    CosmwasmExt,
563)]
564#[proto_message(type_url = "/elys.perpetual.MtpAndPrice")]
565pub struct MtpAndPrice {
566    #[prost(message, optional, tag = "1")]
567    pub mtp: ::core::option::Option<Mtp>,
568    #[prost(string, tag = "2")]
569    pub trading_asset_price: ::prost::alloc::string::String,
570    #[prost(message, optional, tag = "3")]
571    pub pnl: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
572    #[prost(string, tag = "4")]
573    pub effective_leverage: ::prost::alloc::string::String,
574    #[prost(string, tag = "5")]
575    pub liquidation_price: ::prost::alloc::string::String,
576    #[prost(message, optional, tag = "6")]
577    pub fees: ::core::option::Option<Fees>,
578}
579/// ParamsRequest is request type for the Query/Params RPC method.
580#[allow(clippy::derive_partial_eq_without_eq)]
581#[derive(
582    Clone,
583    PartialEq,
584    Eq,
585    ::prost::Message,
586    ::serde::Serialize,
587    ::serde::Deserialize,
588    ::schemars::JsonSchema,
589    CosmwasmExt,
590)]
591#[proto_message(type_url = "/elys.perpetual.ParamsRequest")]
592#[proto_query(path = "/elys.perpetual.Query/Params", response_type = ParamsResponse)]
593pub struct ParamsRequest {}
594/// ParamsResponse is response type for the Query/Params RPC method.
595#[allow(clippy::derive_partial_eq_without_eq)]
596#[derive(
597    Clone,
598    PartialEq,
599    Eq,
600    ::prost::Message,
601    ::serde::Serialize,
602    ::serde::Deserialize,
603    ::schemars::JsonSchema,
604    CosmwasmExt,
605)]
606#[proto_message(type_url = "/elys.perpetual.ParamsResponse")]
607pub struct ParamsResponse {
608    /// params holds all the parameters of this module.
609    #[prost(message, optional, tag = "1")]
610    pub params: ::core::option::Option<Params>,
611}
612#[allow(clippy::derive_partial_eq_without_eq)]
613#[derive(
614    Clone,
615    PartialEq,
616    Eq,
617    ::prost::Message,
618    ::serde::Serialize,
619    ::serde::Deserialize,
620    ::schemars::JsonSchema,
621    CosmwasmExt,
622)]
623#[proto_message(type_url = "/elys.perpetual.PositionsRequest")]
624#[proto_query(
625    path = "/elys.perpetual.Query/GetPositions",
626    response_type = PositionsResponse
627)]
628pub struct PositionsRequest {
629    #[prost(message, optional, tag = "1")]
630    pub pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
631}
632#[allow(clippy::derive_partial_eq_without_eq)]
633#[derive(
634    Clone,
635    PartialEq,
636    Eq,
637    ::prost::Message,
638    ::serde::Serialize,
639    ::serde::Deserialize,
640    ::schemars::JsonSchema,
641    CosmwasmExt,
642)]
643#[proto_message(type_url = "/elys.perpetual.PositionsResponse")]
644pub struct PositionsResponse {
645    #[prost(message, repeated, tag = "1")]
646    pub mtps: ::prost::alloc::vec::Vec<MtpAndPrice>,
647    #[prost(message, optional, tag = "2")]
648    pub pagination:
649        ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageResponse>,
650}
651#[allow(clippy::derive_partial_eq_without_eq)]
652#[derive(
653    Clone,
654    PartialEq,
655    Eq,
656    ::prost::Message,
657    ::serde::Serialize,
658    ::serde::Deserialize,
659    ::schemars::JsonSchema,
660    CosmwasmExt,
661)]
662#[proto_message(type_url = "/elys.perpetual.PositionsByPoolRequest")]
663#[proto_query(
664    path = "/elys.perpetual.Query/GetPositionsByPool",
665    response_type = PositionsByPoolResponse
666)]
667pub struct PositionsByPoolRequest {
668    #[prost(uint64, tag = "1")]
669    #[serde(alias = "amm_poolID")]
670    #[serde(
671        serialize_with = "crate::serde::as_str::serialize",
672        deserialize_with = "crate::serde::as_str::deserialize"
673    )]
674    pub amm_pool_id: u64,
675    #[prost(message, optional, tag = "2")]
676    pub pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
677}
678#[allow(clippy::derive_partial_eq_without_eq)]
679#[derive(
680    Clone,
681    PartialEq,
682    Eq,
683    ::prost::Message,
684    ::serde::Serialize,
685    ::serde::Deserialize,
686    ::schemars::JsonSchema,
687    CosmwasmExt,
688)]
689#[proto_message(type_url = "/elys.perpetual.PositionsByPoolResponse")]
690pub struct PositionsByPoolResponse {
691    #[prost(message, repeated, tag = "1")]
692    pub mtps: ::prost::alloc::vec::Vec<MtpAndPrice>,
693    #[prost(message, optional, tag = "2")]
694    pub pagination:
695        ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageResponse>,
696}
697#[allow(clippy::derive_partial_eq_without_eq)]
698#[derive(
699    Clone,
700    PartialEq,
701    Eq,
702    ::prost::Message,
703    ::serde::Serialize,
704    ::serde::Deserialize,
705    ::schemars::JsonSchema,
706    CosmwasmExt,
707)]
708#[proto_message(type_url = "/elys.perpetual.StatusRequest")]
709#[proto_query(path = "/elys.perpetual.Query/GetStatus", response_type = StatusResponse)]
710pub struct StatusRequest {}
711#[allow(clippy::derive_partial_eq_without_eq)]
712#[derive(
713    Clone,
714    PartialEq,
715    Eq,
716    ::prost::Message,
717    ::serde::Serialize,
718    ::serde::Deserialize,
719    ::schemars::JsonSchema,
720    CosmwasmExt,
721)]
722#[proto_message(type_url = "/elys.perpetual.StatusResponse")]
723pub struct StatusResponse {
724    #[prost(uint64, tag = "1")]
725    #[serde(
726        serialize_with = "crate::serde::as_str::serialize",
727        deserialize_with = "crate::serde::as_str::deserialize"
728    )]
729    pub open_mtp_count: u64,
730    #[prost(uint64, tag = "2")]
731    #[serde(
732        serialize_with = "crate::serde::as_str::serialize",
733        deserialize_with = "crate::serde::as_str::deserialize"
734    )]
735    pub lifetime_mtp_count: u64,
736}
737#[allow(clippy::derive_partial_eq_without_eq)]
738#[derive(
739    Clone,
740    PartialEq,
741    Eq,
742    ::prost::Message,
743    ::serde::Serialize,
744    ::serde::Deserialize,
745    ::schemars::JsonSchema,
746    CosmwasmExt,
747)]
748#[proto_message(type_url = "/elys.perpetual.PositionsForAddressRequest")]
749#[proto_query(
750    path = "/elys.perpetual.Query/GetPositionsForAddress",
751    response_type = PositionsForAddressResponse
752)]
753pub struct PositionsForAddressRequest {
754    #[prost(string, tag = "1")]
755    pub address: ::prost::alloc::string::String,
756    #[prost(message, optional, tag = "2")]
757    pub pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
758}
759#[allow(clippy::derive_partial_eq_without_eq)]
760#[derive(
761    Clone,
762    PartialEq,
763    Eq,
764    ::prost::Message,
765    ::serde::Serialize,
766    ::serde::Deserialize,
767    ::schemars::JsonSchema,
768    CosmwasmExt,
769)]
770#[proto_message(type_url = "/elys.perpetual.PositionsForAddressResponse")]
771pub struct PositionsForAddressResponse {
772    #[prost(message, repeated, tag = "1")]
773    pub mtps: ::prost::alloc::vec::Vec<MtpAndPrice>,
774    #[prost(message, optional, tag = "2")]
775    pub pagination:
776        ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageResponse>,
777}
778#[allow(clippy::derive_partial_eq_without_eq)]
779#[derive(
780    Clone,
781    PartialEq,
782    Eq,
783    ::prost::Message,
784    ::serde::Serialize,
785    ::serde::Deserialize,
786    ::schemars::JsonSchema,
787    CosmwasmExt,
788)]
789#[proto_message(type_url = "/elys.perpetual.WhitelistRequest")]
790#[proto_query(
791    path = "/elys.perpetual.Query/GetWhitelist",
792    response_type = WhitelistResponse
793)]
794pub struct WhitelistRequest {
795    #[prost(message, optional, tag = "1")]
796    pub pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
797}
798#[allow(clippy::derive_partial_eq_without_eq)]
799#[derive(
800    Clone,
801    PartialEq,
802    Eq,
803    ::prost::Message,
804    ::serde::Serialize,
805    ::serde::Deserialize,
806    ::schemars::JsonSchema,
807    CosmwasmExt,
808)]
809#[proto_message(type_url = "/elys.perpetual.WhitelistResponse")]
810pub struct WhitelistResponse {
811    #[prost(string, repeated, tag = "1")]
812    pub whitelist: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
813    #[prost(message, optional, tag = "2")]
814    pub pagination:
815        ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageResponse>,
816}
817#[allow(clippy::derive_partial_eq_without_eq)]
818#[derive(
819    Clone,
820    PartialEq,
821    Eq,
822    ::prost::Message,
823    ::serde::Serialize,
824    ::serde::Deserialize,
825    ::schemars::JsonSchema,
826    CosmwasmExt,
827)]
828#[proto_message(type_url = "/elys.perpetual.IsWhitelistedRequest")]
829#[proto_query(
830    path = "/elys.perpetual.Query/IsWhitelisted",
831    response_type = IsWhitelistedResponse
832)]
833pub struct IsWhitelistedRequest {
834    #[prost(string, tag = "1")]
835    pub address: ::prost::alloc::string::String,
836}
837#[allow(clippy::derive_partial_eq_without_eq)]
838#[derive(
839    Clone,
840    PartialEq,
841    Eq,
842    ::prost::Message,
843    ::serde::Serialize,
844    ::serde::Deserialize,
845    ::schemars::JsonSchema,
846    CosmwasmExt,
847)]
848#[proto_message(type_url = "/elys.perpetual.IsWhitelistedResponse")]
849pub struct IsWhitelistedResponse {
850    #[prost(string, tag = "1")]
851    pub address: ::prost::alloc::string::String,
852    #[prost(bool, tag = "2")]
853    pub is_whitelisted: bool,
854}
855#[allow(clippy::derive_partial_eq_without_eq)]
856#[derive(
857    Clone,
858    PartialEq,
859    Eq,
860    ::prost::Message,
861    ::serde::Serialize,
862    ::serde::Deserialize,
863    ::schemars::JsonSchema,
864    CosmwasmExt,
865)]
866#[proto_message(type_url = "/elys.perpetual.QueryGetPoolRequest")]
867#[proto_query(path = "/elys.perpetual.Query/Pool", response_type = QueryGetPoolResponse)]
868pub struct QueryGetPoolRequest {
869    #[prost(uint64, tag = "1")]
870    #[serde(
871        serialize_with = "crate::serde::as_str::serialize",
872        deserialize_with = "crate::serde::as_str::deserialize"
873    )]
874    pub index: u64,
875}
876#[allow(clippy::derive_partial_eq_without_eq)]
877#[derive(
878    Clone,
879    PartialEq,
880    Eq,
881    ::prost::Message,
882    ::serde::Serialize,
883    ::serde::Deserialize,
884    ::schemars::JsonSchema,
885    CosmwasmExt,
886)]
887#[proto_message(type_url = "/elys.perpetual.QueryGetPoolResponse")]
888pub struct QueryGetPoolResponse {
889    #[prost(message, optional, tag = "1")]
890    pub pool: ::core::option::Option<PoolResponse>,
891}
892#[allow(clippy::derive_partial_eq_without_eq)]
893#[derive(
894    Clone,
895    PartialEq,
896    Eq,
897    ::prost::Message,
898    ::serde::Serialize,
899    ::serde::Deserialize,
900    ::schemars::JsonSchema,
901    CosmwasmExt,
902)]
903#[proto_message(type_url = "/elys.perpetual.QueryAllPoolRequest")]
904#[proto_query(
905    path = "/elys.perpetual.Query/Pools",
906    response_type = QueryAllPoolResponse
907)]
908pub struct QueryAllPoolRequest {
909    #[prost(message, optional, tag = "1")]
910    pub pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
911}
912#[allow(clippy::derive_partial_eq_without_eq)]
913#[derive(
914    Clone,
915    PartialEq,
916    Eq,
917    ::prost::Message,
918    ::serde::Serialize,
919    ::serde::Deserialize,
920    ::schemars::JsonSchema,
921    CosmwasmExt,
922)]
923#[proto_message(type_url = "/elys.perpetual.QueryAllPoolResponse")]
924pub struct QueryAllPoolResponse {
925    #[prost(message, repeated, tag = "1")]
926    pub pool: ::prost::alloc::vec::Vec<PoolResponse>,
927    #[prost(message, optional, tag = "2")]
928    pub pagination:
929        ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageResponse>,
930}
931#[allow(clippy::derive_partial_eq_without_eq)]
932#[derive(
933    Clone,
934    PartialEq,
935    Eq,
936    ::prost::Message,
937    ::serde::Serialize,
938    ::serde::Deserialize,
939    ::schemars::JsonSchema,
940    CosmwasmExt,
941)]
942#[proto_message(type_url = "/elys.perpetual.MTPRequest")]
943#[proto_query(path = "/elys.perpetual.Query/MTP", response_type = MtpResponse)]
944pub struct MtpRequest {
945    #[prost(string, tag = "1")]
946    pub address: ::prost::alloc::string::String,
947    #[prost(uint64, tag = "2")]
948    #[serde(alias = "ID")]
949    #[serde(
950        serialize_with = "crate::serde::as_str::serialize",
951        deserialize_with = "crate::serde::as_str::deserialize"
952    )]
953    pub id: u64,
954}
955#[allow(clippy::derive_partial_eq_without_eq)]
956#[derive(
957    Clone,
958    PartialEq,
959    Eq,
960    ::prost::Message,
961    ::serde::Serialize,
962    ::serde::Deserialize,
963    ::schemars::JsonSchema,
964    CosmwasmExt,
965)]
966#[proto_message(type_url = "/elys.perpetual.MTPResponse")]
967pub struct MtpResponse {
968    #[prost(message, optional, tag = "1")]
969    pub mtp: ::core::option::Option<MtpAndPrice>,
970}
971#[allow(clippy::derive_partial_eq_without_eq)]
972#[derive(
973    Clone,
974    PartialEq,
975    Eq,
976    ::prost::Message,
977    ::serde::Serialize,
978    ::serde::Deserialize,
979    ::schemars::JsonSchema,
980    CosmwasmExt,
981)]
982#[proto_message(type_url = "/elys.perpetual.QueryOpenEstimationRequest")]
983#[proto_query(
984    path = "/elys.perpetual.Query/OpenEstimation",
985    response_type = QueryOpenEstimationResponse
986)]
987pub struct QueryOpenEstimationRequest {
988    #[prost(enumeration = "Position", tag = "1")]
989    #[serde(
990        serialize_with = "crate::serde::as_str::serialize",
991        deserialize_with = "crate::serde::as_str::deserialize"
992    )]
993    pub position: i32,
994    #[prost(string, tag = "2")]
995    pub leverage: ::prost::alloc::string::String,
996    #[prost(string, tag = "3")]
997    pub trading_asset: ::prost::alloc::string::String,
998    #[prost(message, optional, tag = "4")]
999    pub collateral: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1000    #[prost(string, tag = "5")]
1001    pub address: ::prost::alloc::string::String,
1002    #[prost(string, tag = "6")]
1003    pub take_profit_price: ::prost::alloc::string::String,
1004    #[prost(uint64, tag = "7")]
1005    #[serde(alias = "poolID")]
1006    #[serde(
1007        serialize_with = "crate::serde::as_str::serialize",
1008        deserialize_with = "crate::serde::as_str::deserialize"
1009    )]
1010    pub pool_id: u64,
1011    #[prost(string, tag = "8")]
1012    pub limit_price: ::prost::alloc::string::String,
1013}
1014#[allow(clippy::derive_partial_eq_without_eq)]
1015#[derive(
1016    Clone,
1017    PartialEq,
1018    Eq,
1019    ::prost::Message,
1020    ::serde::Serialize,
1021    ::serde::Deserialize,
1022    ::schemars::JsonSchema,
1023    CosmwasmExt,
1024)]
1025#[proto_message(type_url = "/elys.perpetual.QueryOpenEstimationResponse")]
1026pub struct QueryOpenEstimationResponse {
1027    #[prost(enumeration = "Position", tag = "1")]
1028    #[serde(
1029        serialize_with = "crate::serde::as_str::serialize",
1030        deserialize_with = "crate::serde::as_str::deserialize"
1031    )]
1032    pub position: i32,
1033    #[prost(string, tag = "2")]
1034    pub effective_leverage: ::prost::alloc::string::String,
1035    #[prost(string, tag = "3")]
1036    pub trading_asset: ::prost::alloc::string::String,
1037    #[prost(message, optional, tag = "4")]
1038    pub collateral: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1039    #[prost(string, tag = "5")]
1040    pub hourly_interest_rate: ::prost::alloc::string::String,
1041    #[prost(message, optional, tag = "6")]
1042    pub position_size: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1043    #[prost(string, tag = "7")]
1044    pub open_price: ::prost::alloc::string::String,
1045    #[prost(string, tag = "8")]
1046    pub take_profit_price: ::prost::alloc::string::String,
1047    #[prost(string, tag = "9")]
1048    pub liquidation_price: ::prost::alloc::string::String,
1049    #[prost(message, optional, tag = "10")]
1050    pub estimated_pnl: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1051    #[prost(message, optional, tag = "11")]
1052    pub available_liquidity: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1053    #[prost(string, tag = "12")]
1054    pub slippage: ::prost::alloc::string::String,
1055    #[prost(string, tag = "13")]
1056    pub borrow_interest_rate: ::prost::alloc::string::String,
1057    #[prost(string, tag = "14")]
1058    pub funding_rate: ::prost::alloc::string::String,
1059    #[prost(string, tag = "15")]
1060    pub price_impact: ::prost::alloc::string::String,
1061    #[prost(message, optional, tag = "16")]
1062    pub custody: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1063    #[prost(message, optional, tag = "17")]
1064    pub liabilities: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1065    #[prost(string, tag = "18")]
1066    pub limit_price: ::prost::alloc::string::String,
1067    #[prost(string, tag = "19")]
1068    pub weight_breaking_fee: ::prost::alloc::string::String,
1069}
1070#[allow(clippy::derive_partial_eq_without_eq)]
1071#[derive(
1072    Clone,
1073    PartialEq,
1074    Eq,
1075    ::prost::Message,
1076    ::serde::Serialize,
1077    ::serde::Deserialize,
1078    ::schemars::JsonSchema,
1079    CosmwasmExt,
1080)]
1081#[proto_message(type_url = "/elys.perpetual.PoolResponse")]
1082pub struct PoolResponse {
1083    #[prost(uint64, tag = "1")]
1084    #[serde(alias = "amm_poolID")]
1085    #[serde(
1086        serialize_with = "crate::serde::as_str::serialize",
1087        deserialize_with = "crate::serde::as_str::deserialize"
1088    )]
1089    pub amm_pool_id: u64,
1090    #[prost(string, tag = "2")]
1091    pub health: ::prost::alloc::string::String,
1092    #[prost(string, tag = "3")]
1093    pub borrow_interest_rate: ::prost::alloc::string::String,
1094    #[prost(message, repeated, tag = "4")]
1095    pub pool_assets_long: ::prost::alloc::vec::Vec<PoolAsset>,
1096    #[prost(message, repeated, tag = "5")]
1097    pub pool_assets_short: ::prost::alloc::vec::Vec<PoolAsset>,
1098    #[prost(int64, tag = "6")]
1099    #[serde(
1100        serialize_with = "crate::serde::as_str::serialize",
1101        deserialize_with = "crate::serde::as_str::deserialize"
1102    )]
1103    pub last_height_borrow_interest_rate_computed: i64,
1104    /// funding rate, if positive longs pay shorts, if negative shorts pay longs
1105    #[prost(string, tag = "7")]
1106    pub funding_rate: ::prost::alloc::string::String,
1107    #[prost(string, tag = "8")]
1108    pub net_open_interest: ::prost::alloc::string::String,
1109    /// Rate at which long pays/receive from short
1110    /// if negative longs pay, if positive long receives
1111    #[prost(string, tag = "9")]
1112    pub long_rate: ::prost::alloc::string::String,
1113    #[prost(string, tag = "10")]
1114    pub short_rate: ::prost::alloc::string::String,
1115    #[prost(message, optional, tag = "11")]
1116    pub total_liabilities: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1117    #[prost(string, tag = "12")]
1118    pub total_long_open_interest: ::prost::alloc::string::String,
1119    #[prost(string, tag = "13")]
1120    pub total_short_open_interest: ::prost::alloc::string::String,
1121    #[prost(string, tag = "14")]
1122    pub leverage_max: ::prost::alloc::string::String,
1123}
1124#[allow(clippy::derive_partial_eq_without_eq)]
1125#[derive(
1126    Clone,
1127    PartialEq,
1128    Eq,
1129    ::prost::Message,
1130    ::serde::Serialize,
1131    ::serde::Deserialize,
1132    ::schemars::JsonSchema,
1133    CosmwasmExt,
1134)]
1135#[proto_message(type_url = "/elys.perpetual.QueryCloseEstimationRequest")]
1136#[proto_query(
1137    path = "/elys.perpetual.Query/CloseEstimation",
1138    response_type = QueryCloseEstimationResponse
1139)]
1140pub struct QueryCloseEstimationRequest {
1141    #[prost(string, tag = "1")]
1142    pub address: ::prost::alloc::string::String,
1143    #[prost(uint64, tag = "2")]
1144    #[serde(alias = "positionID")]
1145    #[serde(
1146        serialize_with = "crate::serde::as_str::serialize",
1147        deserialize_with = "crate::serde::as_str::deserialize"
1148    )]
1149    pub position_id: u64,
1150    #[prost(string, tag = "3")]
1151    pub close_amount: ::prost::alloc::string::String,
1152}
1153#[allow(clippy::derive_partial_eq_without_eq)]
1154#[derive(
1155    Clone,
1156    PartialEq,
1157    Eq,
1158    ::prost::Message,
1159    ::serde::Serialize,
1160    ::serde::Deserialize,
1161    ::schemars::JsonSchema,
1162    CosmwasmExt,
1163)]
1164#[proto_message(type_url = "/elys.perpetual.QueryCloseEstimationResponse")]
1165pub struct QueryCloseEstimationResponse {
1166    #[prost(enumeration = "Position", tag = "1")]
1167    #[serde(
1168        serialize_with = "crate::serde::as_str::serialize",
1169        deserialize_with = "crate::serde::as_str::deserialize"
1170    )]
1171    pub position: i32,
1172    #[prost(message, optional, tag = "2")]
1173    pub position_size: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1174    #[prost(message, optional, tag = "3")]
1175    pub liabilities: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1176    #[prost(string, tag = "4")]
1177    pub price_impact: ::prost::alloc::string::String,
1178    #[prost(string, tag = "5")]
1179    pub liquidation_price: ::prost::alloc::string::String,
1180    #[prost(string, tag = "6")]
1181    pub max_close_amount: ::prost::alloc::string::String,
1182    #[prost(message, optional, tag = "7")]
1183    pub borrow_interest_unpaid_liability:
1184        ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1185    #[prost(message, optional, tag = "8")]
1186    pub returning_amount: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1187    #[prost(message, optional, tag = "9")]
1188    pub paying_liabilities: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1189    #[prost(string, tag = "10")]
1190    pub closing_price: ::prost::alloc::string::String,
1191    #[prost(message, optional, tag = "11")]
1192    pub custody: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1193    #[prost(message, optional, tag = "12")]
1194    pub collateral: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1195    #[prost(string, tag = "13")]
1196    pub weight_breaking_fee: ::prost::alloc::string::String,
1197    #[prost(string, tag = "14")]
1198    pub slippage: ::prost::alloc::string::String,
1199}
1200#[allow(clippy::derive_partial_eq_without_eq)]
1201#[derive(
1202    Clone,
1203    PartialEq,
1204    Eq,
1205    ::prost::Message,
1206    ::serde::Serialize,
1207    ::serde::Deserialize,
1208    ::schemars::JsonSchema,
1209    CosmwasmExt,
1210)]
1211#[proto_message(type_url = "/elys.perpetual.MsgOpen")]
1212pub struct MsgOpen {
1213    #[prost(string, tag = "1")]
1214    pub creator: ::prost::alloc::string::String,
1215    #[prost(enumeration = "Position", tag = "2")]
1216    #[serde(
1217        serialize_with = "crate::serde::as_str::serialize",
1218        deserialize_with = "crate::serde::as_str::deserialize"
1219    )]
1220    pub position: i32,
1221    #[prost(string, tag = "3")]
1222    pub leverage: ::prost::alloc::string::String,
1223    #[prost(string, tag = "4")]
1224    pub trading_asset: ::prost::alloc::string::String,
1225    #[prost(message, optional, tag = "5")]
1226    pub collateral: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1227    #[prost(string, tag = "6")]
1228    pub take_profit_price: ::prost::alloc::string::String,
1229    #[prost(string, tag = "7")]
1230    pub stop_loss_price: ::prost::alloc::string::String,
1231    #[prost(uint64, tag = "8")]
1232    #[serde(alias = "poolID")]
1233    #[serde(
1234        serialize_with = "crate::serde::as_str::serialize",
1235        deserialize_with = "crate::serde::as_str::deserialize"
1236    )]
1237    pub pool_id: u64,
1238}
1239#[allow(clippy::derive_partial_eq_without_eq)]
1240#[derive(
1241    Clone,
1242    PartialEq,
1243    Eq,
1244    ::prost::Message,
1245    ::serde::Serialize,
1246    ::serde::Deserialize,
1247    ::schemars::JsonSchema,
1248    CosmwasmExt,
1249)]
1250#[proto_message(type_url = "/elys.perpetual.MsgOpenResponse")]
1251pub struct MsgOpenResponse {
1252    #[prost(uint64, tag = "1")]
1253    #[serde(alias = "ID")]
1254    #[serde(
1255        serialize_with = "crate::serde::as_str::serialize",
1256        deserialize_with = "crate::serde::as_str::deserialize"
1257    )]
1258    pub id: u64,
1259}
1260#[allow(clippy::derive_partial_eq_without_eq)]
1261#[derive(
1262    Clone,
1263    PartialEq,
1264    Eq,
1265    ::prost::Message,
1266    ::serde::Serialize,
1267    ::serde::Deserialize,
1268    ::schemars::JsonSchema,
1269    CosmwasmExt,
1270)]
1271#[proto_message(type_url = "/elys.perpetual.MsgClose")]
1272pub struct MsgClose {
1273    #[prost(string, tag = "1")]
1274    pub creator: ::prost::alloc::string::String,
1275    #[prost(uint64, tag = "2")]
1276    #[serde(alias = "ID")]
1277    #[serde(
1278        serialize_with = "crate::serde::as_str::serialize",
1279        deserialize_with = "crate::serde::as_str::deserialize"
1280    )]
1281    pub id: u64,
1282    #[prost(string, tag = "3")]
1283    pub amount: ::prost::alloc::string::String,
1284}
1285#[allow(clippy::derive_partial_eq_without_eq)]
1286#[derive(
1287    Clone,
1288    PartialEq,
1289    Eq,
1290    ::prost::Message,
1291    ::serde::Serialize,
1292    ::serde::Deserialize,
1293    ::schemars::JsonSchema,
1294    CosmwasmExt,
1295)]
1296#[proto_message(type_url = "/elys.perpetual.MsgCloseResponse")]
1297pub struct MsgCloseResponse {
1298    #[prost(uint64, tag = "1")]
1299    #[serde(alias = "ID")]
1300    #[serde(
1301        serialize_with = "crate::serde::as_str::serialize",
1302        deserialize_with = "crate::serde::as_str::deserialize"
1303    )]
1304    pub id: u64,
1305    #[prost(string, tag = "2")]
1306    pub amount: ::prost::alloc::string::String,
1307}
1308#[allow(clippy::derive_partial_eq_without_eq)]
1309#[derive(
1310    Clone,
1311    PartialEq,
1312    Eq,
1313    ::prost::Message,
1314    ::serde::Serialize,
1315    ::serde::Deserialize,
1316    ::schemars::JsonSchema,
1317    CosmwasmExt,
1318)]
1319#[proto_message(type_url = "/elys.perpetual.MsgUpdateParams")]
1320pub struct MsgUpdateParams {
1321    /// authority is the address that controls the module (defaults to x/gov unless
1322    /// overwritten).
1323    #[prost(string, tag = "1")]
1324    pub authority: ::prost::alloc::string::String,
1325    /// NOTE: All parameters must be supplied.
1326    #[prost(message, optional, tag = "2")]
1327    pub params: ::core::option::Option<Params>,
1328}
1329#[allow(clippy::derive_partial_eq_without_eq)]
1330#[derive(
1331    Clone,
1332    PartialEq,
1333    Eq,
1334    ::prost::Message,
1335    ::serde::Serialize,
1336    ::serde::Deserialize,
1337    ::schemars::JsonSchema,
1338    CosmwasmExt,
1339)]
1340#[proto_message(type_url = "/elys.perpetual.MsgUpdateParamsResponse")]
1341pub struct MsgUpdateParamsResponse {}
1342#[allow(clippy::derive_partial_eq_without_eq)]
1343#[derive(
1344    Clone,
1345    PartialEq,
1346    Eq,
1347    ::prost::Message,
1348    ::serde::Serialize,
1349    ::serde::Deserialize,
1350    ::schemars::JsonSchema,
1351    CosmwasmExt,
1352)]
1353#[proto_message(type_url = "/elys.perpetual.MsgWhitelist")]
1354pub struct MsgWhitelist {
1355    #[prost(string, tag = "1")]
1356    pub authority: ::prost::alloc::string::String,
1357    #[prost(string, tag = "2")]
1358    pub whitelisted_address: ::prost::alloc::string::String,
1359}
1360#[allow(clippy::derive_partial_eq_without_eq)]
1361#[derive(
1362    Clone,
1363    PartialEq,
1364    Eq,
1365    ::prost::Message,
1366    ::serde::Serialize,
1367    ::serde::Deserialize,
1368    ::schemars::JsonSchema,
1369    CosmwasmExt,
1370)]
1371#[proto_message(type_url = "/elys.perpetual.MsgWhitelistResponse")]
1372pub struct MsgWhitelistResponse {}
1373#[allow(clippy::derive_partial_eq_without_eq)]
1374#[derive(
1375    Clone,
1376    PartialEq,
1377    Eq,
1378    ::prost::Message,
1379    ::serde::Serialize,
1380    ::serde::Deserialize,
1381    ::schemars::JsonSchema,
1382    CosmwasmExt,
1383)]
1384#[proto_message(type_url = "/elys.perpetual.MsgDewhitelist")]
1385pub struct MsgDewhitelist {
1386    #[prost(string, tag = "1")]
1387    pub authority: ::prost::alloc::string::String,
1388    #[prost(string, tag = "2")]
1389    pub whitelisted_address: ::prost::alloc::string::String,
1390}
1391#[allow(clippy::derive_partial_eq_without_eq)]
1392#[derive(
1393    Clone,
1394    PartialEq,
1395    Eq,
1396    ::prost::Message,
1397    ::serde::Serialize,
1398    ::serde::Deserialize,
1399    ::schemars::JsonSchema,
1400    CosmwasmExt,
1401)]
1402#[proto_message(type_url = "/elys.perpetual.MsgDewhitelistResponse")]
1403pub struct MsgDewhitelistResponse {}
1404#[allow(clippy::derive_partial_eq_without_eq)]
1405#[derive(
1406    Clone,
1407    PartialEq,
1408    Eq,
1409    ::prost::Message,
1410    ::serde::Serialize,
1411    ::serde::Deserialize,
1412    ::schemars::JsonSchema,
1413    CosmwasmExt,
1414)]
1415#[proto_message(type_url = "/elys.perpetual.MsgClosePositions")]
1416pub struct MsgClosePositions {
1417    #[prost(string, tag = "1")]
1418    pub creator: ::prost::alloc::string::String,
1419    #[prost(message, repeated, tag = "2")]
1420    pub liquidate: ::prost::alloc::vec::Vec<PositionRequest>,
1421    #[prost(message, repeated, tag = "3")]
1422    pub stop_loss: ::prost::alloc::vec::Vec<PositionRequest>,
1423    #[prost(message, repeated, tag = "4")]
1424    pub take_profit: ::prost::alloc::vec::Vec<PositionRequest>,
1425}
1426#[allow(clippy::derive_partial_eq_without_eq)]
1427#[derive(
1428    Clone,
1429    PartialEq,
1430    Eq,
1431    ::prost::Message,
1432    ::serde::Serialize,
1433    ::serde::Deserialize,
1434    ::schemars::JsonSchema,
1435    CosmwasmExt,
1436)]
1437#[proto_message(type_url = "/elys.perpetual.MsgClosePositionsResponse")]
1438pub struct MsgClosePositionsResponse {}
1439#[allow(clippy::derive_partial_eq_without_eq)]
1440#[derive(
1441    Clone,
1442    PartialEq,
1443    Eq,
1444    ::prost::Message,
1445    ::serde::Serialize,
1446    ::serde::Deserialize,
1447    ::schemars::JsonSchema,
1448    CosmwasmExt,
1449)]
1450#[proto_message(type_url = "/elys.perpetual.MsgUpdateStopLoss")]
1451pub struct MsgUpdateStopLoss {
1452    #[prost(string, tag = "1")]
1453    pub creator: ::prost::alloc::string::String,
1454    #[prost(uint64, tag = "2")]
1455    #[serde(alias = "ID")]
1456    #[serde(
1457        serialize_with = "crate::serde::as_str::serialize",
1458        deserialize_with = "crate::serde::as_str::deserialize"
1459    )]
1460    pub id: u64,
1461    #[prost(string, tag = "3")]
1462    pub price: ::prost::alloc::string::String,
1463}
1464#[allow(clippy::derive_partial_eq_without_eq)]
1465#[derive(
1466    Clone,
1467    PartialEq,
1468    Eq,
1469    ::prost::Message,
1470    ::serde::Serialize,
1471    ::serde::Deserialize,
1472    ::schemars::JsonSchema,
1473    CosmwasmExt,
1474)]
1475#[proto_message(type_url = "/elys.perpetual.MsgUpdateStopLossResponse")]
1476pub struct MsgUpdateStopLossResponse {}
1477#[allow(clippy::derive_partial_eq_without_eq)]
1478#[derive(
1479    Clone,
1480    PartialEq,
1481    Eq,
1482    ::prost::Message,
1483    ::serde::Serialize,
1484    ::serde::Deserialize,
1485    ::schemars::JsonSchema,
1486    CosmwasmExt,
1487)]
1488#[proto_message(type_url = "/elys.perpetual.MsgUpdateTakeProfitPrice")]
1489pub struct MsgUpdateTakeProfitPrice {
1490    #[prost(string, tag = "1")]
1491    pub creator: ::prost::alloc::string::String,
1492    #[prost(uint64, tag = "2")]
1493    #[serde(alias = "ID")]
1494    #[serde(
1495        serialize_with = "crate::serde::as_str::serialize",
1496        deserialize_with = "crate::serde::as_str::deserialize"
1497    )]
1498    pub id: u64,
1499    #[prost(string, tag = "3")]
1500    pub price: ::prost::alloc::string::String,
1501}
1502#[allow(clippy::derive_partial_eq_without_eq)]
1503#[derive(
1504    Clone,
1505    PartialEq,
1506    Eq,
1507    ::prost::Message,
1508    ::serde::Serialize,
1509    ::serde::Deserialize,
1510    ::schemars::JsonSchema,
1511    CosmwasmExt,
1512)]
1513#[proto_message(type_url = "/elys.perpetual.MsgUpdateTakeProfitPriceResponse")]
1514pub struct MsgUpdateTakeProfitPriceResponse {}
1515#[allow(clippy::derive_partial_eq_without_eq)]
1516#[derive(
1517    Clone,
1518    PartialEq,
1519    Eq,
1520    ::prost::Message,
1521    ::serde::Serialize,
1522    ::serde::Deserialize,
1523    ::schemars::JsonSchema,
1524    CosmwasmExt,
1525)]
1526#[proto_message(type_url = "/elys.perpetual.MsgUpdateMaxLeverageForPool")]
1527pub struct MsgUpdateMaxLeverageForPool {
1528    /// authority is the address that controls the module (defaults to x/gov unless
1529    /// overwritten).
1530    #[prost(string, tag = "1")]
1531    pub authority: ::prost::alloc::string::String,
1532    #[prost(uint64, tag = "2")]
1533    #[serde(alias = "poolID")]
1534    #[serde(
1535        serialize_with = "crate::serde::as_str::serialize",
1536        deserialize_with = "crate::serde::as_str::deserialize"
1537    )]
1538    pub pool_id: u64,
1539    #[prost(string, tag = "3")]
1540    pub leverage_max: ::prost::alloc::string::String,
1541}
1542#[allow(clippy::derive_partial_eq_without_eq)]
1543#[derive(
1544    Clone,
1545    PartialEq,
1546    Eq,
1547    ::prost::Message,
1548    ::serde::Serialize,
1549    ::serde::Deserialize,
1550    ::schemars::JsonSchema,
1551    CosmwasmExt,
1552)]
1553#[proto_message(type_url = "/elys.perpetual.MsgUpdateMaxLeverageForPoolResponse")]
1554pub struct MsgUpdateMaxLeverageForPoolResponse {}
1555#[allow(clippy::derive_partial_eq_without_eq)]
1556#[derive(
1557    Clone,
1558    PartialEq,
1559    Eq,
1560    ::prost::Message,
1561    ::serde::Serialize,
1562    ::serde::Deserialize,
1563    ::schemars::JsonSchema,
1564    CosmwasmExt,
1565)]
1566#[proto_message(type_url = "/elys.perpetual.MsgUpdateEnabledPools")]
1567pub struct MsgUpdateEnabledPools {
1568    /// authority is the address that controls the module (defaults to x/gov unless
1569    /// overwritten).
1570    #[prost(string, tag = "1")]
1571    pub authority: ::prost::alloc::string::String,
1572    #[prost(uint64, repeated, tag = "2")]
1573    #[serde(
1574        serialize_with = "crate::serde::as_str_vec::serialize",
1575        deserialize_with = "crate::serde::as_str_vec::deserialize"
1576    )]
1577    pub enabled_pools: ::prost::alloc::vec::Vec<u64>,
1578}
1579#[allow(clippy::derive_partial_eq_without_eq)]
1580#[derive(
1581    Clone,
1582    PartialEq,
1583    Eq,
1584    ::prost::Message,
1585    ::serde::Serialize,
1586    ::serde::Deserialize,
1587    ::schemars::JsonSchema,
1588    CosmwasmExt,
1589)]
1590#[proto_message(type_url = "/elys.perpetual.MsgUpdateEnabledPoolsResponse")]
1591pub struct MsgUpdateEnabledPoolsResponse {}
1592pub struct PerpetualQuerier<'a, Q: cosmwasm_std::CustomQuery> {
1593    querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>,
1594}
1595impl<'a, Q: cosmwasm_std::CustomQuery> PerpetualQuerier<'a, Q> {
1596    pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self {
1597        Self { querier }
1598    }
1599    pub fn params(&self) -> Result<ParamsResponse, cosmwasm_std::StdError> {
1600        ParamsRequest {}.query(self.querier)
1601    }
1602    pub fn get_positions(
1603        &self,
1604        pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
1605    ) -> Result<PositionsResponse, cosmwasm_std::StdError> {
1606        PositionsRequest { pagination }.query(self.querier)
1607    }
1608    pub fn get_positions_by_pool(
1609        &self,
1610        amm_pool_id: u64,
1611        pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
1612    ) -> Result<PositionsByPoolResponse, cosmwasm_std::StdError> {
1613        PositionsByPoolRequest {
1614            amm_pool_id,
1615            pagination,
1616        }
1617        .query(self.querier)
1618    }
1619    pub fn get_status(&self) -> Result<StatusResponse, cosmwasm_std::StdError> {
1620        StatusRequest {}.query(self.querier)
1621    }
1622    pub fn get_positions_for_address(
1623        &self,
1624        address: ::prost::alloc::string::String,
1625        pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
1626    ) -> Result<PositionsForAddressResponse, cosmwasm_std::StdError> {
1627        PositionsForAddressRequest {
1628            address,
1629            pagination,
1630        }
1631        .query(self.querier)
1632    }
1633    pub fn get_whitelist(
1634        &self,
1635        pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
1636    ) -> Result<WhitelistResponse, cosmwasm_std::StdError> {
1637        WhitelistRequest { pagination }.query(self.querier)
1638    }
1639    pub fn is_whitelisted(
1640        &self,
1641        address: ::prost::alloc::string::String,
1642    ) -> Result<IsWhitelistedResponse, cosmwasm_std::StdError> {
1643        IsWhitelistedRequest { address }.query(self.querier)
1644    }
1645    pub fn pool(&self, index: u64) -> Result<QueryGetPoolResponse, cosmwasm_std::StdError> {
1646        QueryGetPoolRequest { index }.query(self.querier)
1647    }
1648    pub fn pools(
1649        &self,
1650        pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
1651    ) -> Result<QueryAllPoolResponse, cosmwasm_std::StdError> {
1652        QueryAllPoolRequest { pagination }.query(self.querier)
1653    }
1654    pub fn mtp(
1655        &self,
1656        address: ::prost::alloc::string::String,
1657        id: u64,
1658    ) -> Result<MtpResponse, cosmwasm_std::StdError> {
1659        MtpRequest { address, id }.query(self.querier)
1660    }
1661    pub fn open_estimation(
1662        &self,
1663        position: i32,
1664        leverage: ::prost::alloc::string::String,
1665        trading_asset: ::prost::alloc::string::String,
1666        collateral: ::core::option::Option<super::super::cosmos::base::v1beta1::Coin>,
1667        address: ::prost::alloc::string::String,
1668        take_profit_price: ::prost::alloc::string::String,
1669        pool_id: u64,
1670        limit_price: ::prost::alloc::string::String,
1671    ) -> Result<QueryOpenEstimationResponse, cosmwasm_std::StdError> {
1672        QueryOpenEstimationRequest {
1673            position,
1674            leverage,
1675            trading_asset,
1676            collateral,
1677            address,
1678            take_profit_price,
1679            pool_id,
1680            limit_price,
1681        }
1682        .query(self.querier)
1683    }
1684    pub fn close_estimation(
1685        &self,
1686        address: ::prost::alloc::string::String,
1687        position_id: u64,
1688        close_amount: ::prost::alloc::string::String,
1689    ) -> Result<QueryCloseEstimationResponse, cosmwasm_std::StdError> {
1690        QueryCloseEstimationRequest {
1691            address,
1692            position_id,
1693            close_amount,
1694        }
1695        .query(self.querier)
1696    }
1697}