nibiru_std/proto/buf/
nibiru.perp.v2.rs

1// @generated
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Market {
5    /// the trading pair represented by this market
6    /// always BASE:QUOTE, e.g. BTC:NUSD or ETH:NUSD
7    #[prost(string, tag="1")]
8    pub pair: ::prost::alloc::string::String,
9    /// whether or not the market is enabled
10    #[prost(bool, tag="2")]
11    pub enabled: bool,
12    /// the version of the Market, only one market can exist per pair, when one is closed it cannot be reactivated,
13    /// so a new market must be created, this is the version of the market
14    #[prost(uint64, tag="14")]
15    pub version: u64,
16    /// the minimum margin ratio which a user must maintain on this market
17    #[prost(string, tag="3")]
18    pub maintenance_margin_ratio: ::prost::alloc::string::String,
19    /// the maximum leverage a user is able to be taken on this market
20    #[prost(string, tag="4")]
21    pub max_leverage: ::prost::alloc::string::String,
22    /// Latest cumulative premium fraction for a given pair.
23    /// Calculated once per funding rate interval.
24    /// A premium fraction is the difference between mark and index, divided by the
25    /// number of payments per day. (mark - index) / # payments in a day
26    #[prost(string, tag="5")]
27    pub latest_cumulative_premium_fraction: ::prost::alloc::string::String,
28    /// the percentage of the notional given to the exchange when trading
29    #[prost(string, tag="6")]
30    pub exchange_fee_ratio: ::prost::alloc::string::String,
31    /// the percentage of the notional transferred to the ecosystem fund when
32    /// trading
33    #[prost(string, tag="7")]
34    pub ecosystem_fund_fee_ratio: ::prost::alloc::string::String,
35    /// the percentage of liquidated position that will be
36    /// given to out as a reward. Half of the liquidation fee is given to the
37    /// liquidator, and the other half is given to the ecosystem fund.
38    #[prost(string, tag="8")]
39    pub liquidation_fee_ratio: ::prost::alloc::string::String,
40    /// the portion of the position size we try to liquidate if the available
41    /// margin is higher than liquidation fee
42    #[prost(string, tag="9")]
43    pub partial_liquidation_ratio: ::prost::alloc::string::String,
44    /// specifies the interval on which the funding rate is updated
45    #[prost(string, tag="10")]
46    pub funding_rate_epoch_id: ::prost::alloc::string::String,
47    /// amount of time to look back for TWAP calculations
48    #[prost(message, optional, tag="11")]
49    pub twap_lookback_window: ::core::option::Option<::prost_types::Duration>,
50    /// the amount of collateral already credited from the ecosystem fund
51    #[prost(message, optional, tag="12")]
52    pub prepaid_bad_debt: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
53    /// the maximum funding rate payment per epoch, this represents the maximum
54    /// amount of funding that can be paid out per epoch as a percentage of the
55    /// position size
56    #[prost(string, tag="13")]
57    pub max_funding_rate: ::prost::alloc::string::String,
58    /// the pair of the oracle that is used to determine the index price
59    /// for the market
60    #[prost(string, tag="15")]
61    pub oracle_pair: ::prost::alloc::string::String,
62}
63/// MarketLastVersion is used to store the last version of the market
64#[allow(clippy::derive_partial_eq_without_eq)]
65#[derive(Clone, PartialEq, ::prost::Message)]
66pub struct MarketLastVersion {
67    /// version of the market
68    #[prost(uint64, tag="1")]
69    pub version: u64,
70}
71#[allow(clippy::derive_partial_eq_without_eq)]
72#[derive(Clone, PartialEq, ::prost::Message)]
73pub struct Amm {
74    /// identifies the market this AMM belongs to
75    #[prost(string, tag="1")]
76    pub pair: ::prost::alloc::string::String,
77    /// the version of the AMM, only one AMM can exist per pair, when one is closed it cannot be reactivated,
78    /// so a new AMM must be created, this is the version of the AMM
79    #[prost(uint64, tag="8")]
80    pub version: u64,
81    /// the amount of base reserves this AMM has
82    #[prost(string, tag="2")]
83    pub base_reserve: ::prost::alloc::string::String,
84    /// the amount of quote reserves this AMM has
85    #[prost(string, tag="3")]
86    pub quote_reserve: ::prost::alloc::string::String,
87    /// sqrt(k)
88    #[prost(string, tag="4")]
89    pub sqrt_depth: ::prost::alloc::string::String,
90    /// the price multiplier of the dynamic AMM
91    #[prost(string, tag="5")]
92    pub price_multiplier: ::prost::alloc::string::String,
93    /// Total long refers to the sum of long open notional in base.
94    #[prost(string, tag="6")]
95    pub total_long: ::prost::alloc::string::String,
96    /// Total short refers to the sum of short open notional in base.
97    #[prost(string, tag="7")]
98    pub total_short: ::prost::alloc::string::String,
99    /// The settlement price if the AMM is settled.
100    #[prost(string, tag="9")]
101    pub settlement_price: ::prost::alloc::string::String,
102}
103#[allow(clippy::derive_partial_eq_without_eq)]
104#[derive(Clone, PartialEq, ::prost::Message)]
105pub struct Position {
106    /// address identifies the address owner of this position
107    #[prost(string, tag="1")]
108    pub trader_address: ::prost::alloc::string::String,
109    /// pair identifies the pair associated with this position
110    #[prost(string, tag="2")]
111    pub pair: ::prost::alloc::string::String,
112    /// the position size
113    #[prost(string, tag="3")]
114    pub size: ::prost::alloc::string::String,
115    /// amount of margin remaining in the position
116    #[prost(string, tag="4")]
117    pub margin: ::prost::alloc::string::String,
118    /// value of position in quote assets when opened
119    #[prost(string, tag="5")]
120    pub open_notional: ::prost::alloc::string::String,
121    /// The most recent cumulative premium fraction this position has.
122    /// Used to calculate the next funding payment.
123    #[prost(string, tag="6")]
124    pub latest_cumulative_premium_fraction: ::prost::alloc::string::String,
125    /// last block number this position was updated
126    #[prost(int64, tag="7")]
127    pub last_updated_block_number: i64,
128}
129/// a snapshot of the perp.amm's reserves at a given point in time
130#[allow(clippy::derive_partial_eq_without_eq)]
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct ReserveSnapshot {
133    #[prost(message, optional, tag="1")]
134    pub amm: ::core::option::Option<Amm>,
135    /// milliseconds since unix epoch
136    #[prost(int64, tag="2")]
137    pub timestamp_ms: i64,
138}
139/// DNRAllocation represents a rebates allocation for a given epoch.
140#[allow(clippy::derive_partial_eq_without_eq)]
141#[derive(Clone, PartialEq, ::prost::Message)]
142pub struct DnrAllocation {
143    /// epoch defines the reference epoch for the allocation.
144    #[prost(uint64, tag="1")]
145    pub epoch: u64,
146    /// amount of DNR allocated for the epoch.
147    #[prost(message, repeated, tag="2")]
148    pub amount: ::prost::alloc::vec::Vec<crate::proto::cosmos::base::v1beta1::Coin>,
149}
150/// The direction that the user is trading in
151/// LONG means the user is going long the base asset (e.g. buy BTC)
152/// SHORT means the user is shorting the base asset (e.g. sell BTC)
153#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
154#[repr(i32)]
155pub enum Direction {
156    Unspecified = 0,
157    Long = 1,
158    Short = 2,
159}
160impl Direction {
161    /// String value of the enum field names used in the ProtoBuf definition.
162    ///
163    /// The values are not transformed in any way and thus are considered stable
164    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
165    pub fn as_str_name(&self) -> &'static str {
166        match self {
167            Direction::Unspecified => "DIRECTION_UNSPECIFIED",
168            Direction::Long => "LONG",
169            Direction::Short => "SHORT",
170        }
171    }
172    /// Creates an enum from field names used in the ProtoBuf definition.
173    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
174        match value {
175            "DIRECTION_UNSPECIFIED" => Some(Self::Unspecified),
176            "LONG" => Some(Self::Long),
177            "SHORT" => Some(Self::Short),
178            _ => None,
179        }
180    }
181}
182/// Enumerates different options of calculating twap.
183#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
184#[repr(i32)]
185pub enum TwapCalcOption {
186    Unspecified = 0,
187    /// Spot price from quote asset reserve / base asset reserve
188    Spot = 1,
189    /// Swapping with quote assets, output denominated in base assets
190    QuoteAssetSwap = 2,
191    /// Swapping with base assets, output denominated in quote assets
192    BaseAssetSwap = 3,
193}
194impl TwapCalcOption {
195    /// String value of the enum field names used in the ProtoBuf definition.
196    ///
197    /// The values are not transformed in any way and thus are considered stable
198    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
199    pub fn as_str_name(&self) -> &'static str {
200        match self {
201            TwapCalcOption::Unspecified => "TWAP_CALC_OPTION_UNSPECIFIED",
202            TwapCalcOption::Spot => "SPOT",
203            TwapCalcOption::QuoteAssetSwap => "QUOTE_ASSET_SWAP",
204            TwapCalcOption::BaseAssetSwap => "BASE_ASSET_SWAP",
205        }
206    }
207    /// Creates an enum from field names used in the ProtoBuf definition.
208    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
209        match value {
210            "TWAP_CALC_OPTION_UNSPECIFIED" => Some(Self::Unspecified),
211            "SPOT" => Some(Self::Spot),
212            "QUOTE_ASSET_SWAP" => Some(Self::QuoteAssetSwap),
213            "BASE_ASSET_SWAP" => Some(Self::BaseAssetSwap),
214            _ => None,
215        }
216    }
217}
218/// Emitted when a position changes.
219#[allow(clippy::derive_partial_eq_without_eq)]
220#[derive(Clone, PartialEq, ::prost::Message)]
221pub struct PositionChangedEvent {
222    #[prost(message, optional, tag="1")]
223    pub final_position: ::core::option::Option<Position>,
224    /// Position notional (in quote units) after the change. In general,
225    /// 'notional = baseAmount * priceQuotePerBase', where size is the baseAmount.
226    #[prost(string, tag="2")]
227    pub position_notional: ::prost::alloc::string::String,
228    /// Transaction fee paid. A "taker" fee.
229    #[prost(message, optional, tag="3")]
230    pub transaction_fee: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
231    /// realize profits and losses after the change
232    #[prost(string, tag="4")]
233    pub realized_pnl: ::prost::alloc::string::String,
234    /// Amount of bad debt cleared by the PerpEF during the change.
235    /// Bad debt is negative net margin past the liquidation point of a position.
236    #[prost(message, optional, tag="5")]
237    pub bad_debt: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
238    /// A funding payment made or received by the trader on the current position.
239    /// 'fundingPayment' is positive if 'owner' is the sender and negative if 'owner'
240    /// is the receiver of the payment. Its magnitude is abs(size * fundingRate).
241    /// Funding payments act to converge the mark price and index price
242    /// (average price on major exchanges).
243    #[prost(string, tag="6")]
244    pub funding_payment: ::prost::alloc::string::String,
245    /// The block number at which this position was changed.
246    #[prost(int64, tag="7")]
247    pub block_height: i64,
248    /// margin_to_user is the amount of collateral received by the trader during
249    /// the position change. A positve value indicates that the trader received
250    /// funds, while a negative value indicates that the trader spent funds.
251    #[prost(string, tag="8")]
252    pub margin_to_user: ::prost::alloc::string::String,
253    /// change_reason describes the reason for why the position resulted in a
254    /// change. Change type can take the following values:
255    ///
256    /// - CHANGE_REASON_UNSPECIFIED: Unspecified change reason.
257    /// - CHANGE_REASON_ADD_MARGIN: Margin was added to the position.
258    /// - CHANGE_REASON_REMOVE_MARGIN: Margin was removed from the position.
259    /// - CHANGE_REASON_OPEN_POSITION: A new position was opened.
260    /// - CHANGE_REASON_CLOSE_POSITION: An existing position was closed.
261    #[prost(string, tag="9")]
262    pub change_reason: ::prost::alloc::string::String,
263    /// exchanged_size represent the change in size for an existing position
264    /// after the change. A positive value indicates that the position size
265    /// increased, while a negative value indicates that the position size
266    /// decreased.
267    #[prost(string, tag="10")]
268    pub exchanged_size: ::prost::alloc::string::String,
269    /// exchanged_notional represent the change in notional for an existing
270    /// position after the change. A positive value indicates that the position
271    /// notional increased, while a negative value indicates that the position
272    /// notional decreased.
273    #[prost(string, tag="11")]
274    pub exchanged_notional: ::prost::alloc::string::String,
275}
276/// Emitted when a position is liquidated. Wraps a PositionChanged event since a
277/// liquidation causes position changes.
278#[allow(clippy::derive_partial_eq_without_eq)]
279#[derive(Clone, PartialEq, ::prost::Message)]
280pub struct PositionLiquidatedEvent {
281    #[prost(message, optional, tag="1")]
282    pub position_changed_event: ::core::option::Option<PositionChangedEvent>,
283    /// Address of the account that executed the tx.
284    #[prost(string, tag="2")]
285    pub liquidator_address: ::prost::alloc::string::String,
286    /// Commission (in margin units) received by 'liquidator'.
287    #[prost(message, optional, tag="3")]
288    pub fee_to_liquidator: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
289    /// Commission (in margin units) given to the ecosystem fund.
290    #[prost(message, optional, tag="4")]
291    pub fee_to_ecosystem_fund: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
292}
293/// Emitted when a position is settled.
294#[allow(clippy::derive_partial_eq_without_eq)]
295#[derive(Clone, PartialEq, ::prost::Message)]
296pub struct PositionSettledEvent {
297    /// Identifier for the virtual pool of the position.
298    #[prost(string, tag="1")]
299    pub pair: ::prost::alloc::string::String,
300    /// Owner of the position.
301    #[prost(string, tag="2")]
302    pub trader_address: ::prost::alloc::string::String,
303    /// Settled coin as dictated by the settlement price of the perp.amm.
304    #[prost(message, repeated, tag="3")]
305    pub settled_coins: ::prost::alloc::vec::Vec<crate::proto::cosmos::base::v1beta1::Coin>,
306}
307/// Emitted when the funding rate changes for a market.
308#[allow(clippy::derive_partial_eq_without_eq)]
309#[derive(Clone, PartialEq, ::prost::Message)]
310pub struct FundingRateChangedEvent {
311    /// The pair for which the funding rate was calculated.
312    #[prost(string, tag="1")]
313    pub pair: ::prost::alloc::string::String,
314    /// The mark price of the pair.
315    #[prost(string, tag="2")]
316    pub mark_price_twap: ::prost::alloc::string::String,
317    /// The oracle index price of the pair.
318    #[prost(string, tag="3")]
319    pub index_price_twap: ::prost::alloc::string::String,
320    /// The latest premium fraction just calculated.
321    #[prost(string, tag="5")]
322    pub premium_fraction: ::prost::alloc::string::String,
323    /// The market's latest cumulative premium fraction.
324    /// The funding payment a position will pay is the difference between this
325    /// value and the latest cumulative premium fraction on the position,
326    /// multiplied by the position size.
327    #[prost(string, tag="6")]
328    pub cumulative_premium_fraction: ::prost::alloc::string::String,
329}
330/// Emitted when liquidation fails.
331#[allow(clippy::derive_partial_eq_without_eq)]
332#[derive(Clone, PartialEq, ::prost::Message)]
333pub struct LiquidationFailedEvent {
334    /// The pair for which we are trying to liquidate.
335    #[prost(string, tag="1")]
336    pub pair: ::prost::alloc::string::String,
337    /// owner of the position.
338    #[prost(string, tag="2")]
339    pub trader: ::prost::alloc::string::String,
340    /// Address of the account that executed the tx.
341    #[prost(string, tag="3")]
342    pub liquidator: ::prost::alloc::string::String,
343    /// Reason for the liquidation failure.
344    #[prost(enumeration="liquidation_failed_event::LiquidationFailedReason", tag="4")]
345    pub reason: i32,
346}
347/// Nested message and enum types in `LiquidationFailedEvent`.
348pub mod liquidation_failed_event {
349    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
350    #[repr(i32)]
351    pub enum LiquidationFailedReason {
352        Unspecified = 0,
353        /// the position is healthy and does not need to be liquidated.
354        PositionHealthy = 1,
355        /// the pair does not exist.
356        NonexistentPair = 2,
357        /// the position does not exist.
358        NonexistentPosition = 3,
359    }
360    impl LiquidationFailedReason {
361        /// String value of the enum field names used in the ProtoBuf definition.
362        ///
363        /// The values are not transformed in any way and thus are considered stable
364        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
365        pub fn as_str_name(&self) -> &'static str {
366            match self {
367                LiquidationFailedReason::Unspecified => "UNSPECIFIED",
368                LiquidationFailedReason::PositionHealthy => "POSITION_HEALTHY",
369                LiquidationFailedReason::NonexistentPair => "NONEXISTENT_PAIR",
370                LiquidationFailedReason::NonexistentPosition => "NONEXISTENT_POSITION",
371            }
372        }
373        /// Creates an enum from field names used in the ProtoBuf definition.
374        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
375            match value {
376                "UNSPECIFIED" => Some(Self::Unspecified),
377                "POSITION_HEALTHY" => Some(Self::PositionHealthy),
378                "NONEXISTENT_PAIR" => Some(Self::NonexistentPair),
379                "NONEXISTENT_POSITION" => Some(Self::NonexistentPosition),
380                _ => None,
381            }
382        }
383    }
384}
385/// This event is emitted when the amm is updated, which can be triggered by
386/// the following events:
387///
388/// - swap
389/// - edit price multiplier
390/// - edit depth
391#[allow(clippy::derive_partial_eq_without_eq)]
392#[derive(Clone, PartialEq, ::prost::Message)]
393pub struct AmmUpdatedEvent {
394    /// the final state of the AMM
395    #[prost(message, optional, tag="1")]
396    pub final_amm: ::core::option::Option<Amm>,
397    /// The mark price of the pair.
398    #[prost(string, tag="2")]
399    pub mark_price_twap: ::prost::alloc::string::String,
400    /// The oracle index price of the pair.
401    #[prost(string, tag="3")]
402    pub index_price_twap: ::prost::alloc::string::String,
403}
404/// This event is emitted at the end of every block for persisting market changes
405/// off-chain
406///
407/// Market changes are triggered by the following actions:
408///
409/// - disabling market
410/// - changing market fees
411/// - bad debt is prepaid by the ecosystem fund
412#[allow(clippy::derive_partial_eq_without_eq)]
413#[derive(Clone, PartialEq, ::prost::Message)]
414pub struct MarketUpdatedEvent {
415    /// the final state of the market
416    #[prost(message, optional, tag="1")]
417    pub final_market: ::core::option::Option<Market>,
418}
419/// EventShiftPegMultiplier: ABCI event emitted from MsgShiftPegMultiplier
420#[allow(clippy::derive_partial_eq_without_eq)]
421#[derive(Clone, PartialEq, ::prost::Message)]
422pub struct EventShiftPegMultiplier {
423    #[prost(string, tag="1")]
424    pub old_peg_multiplier: ::prost::alloc::string::String,
425    #[prost(string, tag="2")]
426    pub new_peg_multiplier: ::prost::alloc::string::String,
427    #[prost(message, optional, tag="3")]
428    pub cost_paid: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
429}
430/// EventShiftSwapInvariant: ABCI event emitted from MsgShiftSwapInvariant
431#[allow(clippy::derive_partial_eq_without_eq)]
432#[derive(Clone, PartialEq, ::prost::Message)]
433pub struct EventShiftSwapInvariant {
434    #[prost(string, tag="1")]
435    pub old_swap_invariant: ::prost::alloc::string::String,
436    #[prost(string, tag="2")]
437    pub new_swap_invariant: ::prost::alloc::string::String,
438    #[prost(message, optional, tag="3")]
439    pub cost_paid: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
440}
441/// GenesisState defines the perp module's genesis state.
442/// Thge genesis state is used not only to start the network but also useful for
443/// exporting and importing state during network upgrades.
444#[allow(clippy::derive_partial_eq_without_eq)]
445#[derive(Clone, PartialEq, ::prost::Message)]
446pub struct GenesisState {
447    #[prost(message, repeated, tag="2")]
448    pub markets: ::prost::alloc::vec::Vec<Market>,
449    #[prost(message, repeated, tag="3")]
450    pub amms: ::prost::alloc::vec::Vec<Amm>,
451    #[prost(message, repeated, tag="4")]
452    pub positions: ::prost::alloc::vec::Vec<GenesisPosition>,
453    #[prost(message, repeated, tag="5")]
454    pub reserve_snapshots: ::prost::alloc::vec::Vec<ReserveSnapshot>,
455    #[prost(uint64, tag="6")]
456    pub dnr_epoch: u64,
457    /// For testing purposes, we allow the collateral to be set at genesis
458    #[prost(string, tag="11")]
459    pub collateral_denom: ::prost::alloc::string::String,
460    #[prost(message, repeated, tag="7")]
461    pub trader_volumes: ::prost::alloc::vec::Vec<genesis_state::TraderVolume>,
462    #[prost(message, repeated, tag="8")]
463    pub global_discount: ::prost::alloc::vec::Vec<genesis_state::Discount>,
464    #[prost(message, repeated, tag="9")]
465    pub custom_discounts: ::prost::alloc::vec::Vec<genesis_state::CustomDiscount>,
466    #[prost(message, repeated, tag="10")]
467    pub market_last_versions: ::prost::alloc::vec::Vec<GenesisMarketLastVersion>,
468    #[prost(message, repeated, tag="13")]
469    pub global_volumes: ::prost::alloc::vec::Vec<genesis_state::GlobalVolume>,
470    #[prost(message, repeated, tag="12")]
471    pub rebates_allocations: ::prost::alloc::vec::Vec<DnrAllocation>,
472    #[prost(string, tag="14")]
473    pub dnr_epoch_name: ::prost::alloc::string::String,
474}
475/// Nested message and enum types in `GenesisState`.
476pub mod genesis_state {
477    #[allow(clippy::derive_partial_eq_without_eq)]
478#[derive(Clone, PartialEq, ::prost::Message)]
479    pub struct TraderVolume {
480        #[prost(string, tag="1")]
481        pub trader: ::prost::alloc::string::String,
482        #[prost(uint64, tag="2")]
483        pub epoch: u64,
484        #[prost(string, tag="3")]
485        pub volume: ::prost::alloc::string::String,
486    }
487    #[allow(clippy::derive_partial_eq_without_eq)]
488#[derive(Clone, PartialEq, ::prost::Message)]
489    pub struct Discount {
490        #[prost(string, tag="1")]
491        pub fee: ::prost::alloc::string::String,
492        #[prost(string, tag="2")]
493        pub volume: ::prost::alloc::string::String,
494    }
495    #[allow(clippy::derive_partial_eq_without_eq)]
496#[derive(Clone, PartialEq, ::prost::Message)]
497    pub struct CustomDiscount {
498        #[prost(string, tag="1")]
499        pub trader: ::prost::alloc::string::String,
500        #[prost(message, optional, tag="2")]
501        pub discount: ::core::option::Option<Discount>,
502    }
503    #[allow(clippy::derive_partial_eq_without_eq)]
504#[derive(Clone, PartialEq, ::prost::Message)]
505    pub struct GlobalVolume {
506        #[prost(uint64, tag="1")]
507        pub epoch: u64,
508        #[prost(string, tag="2")]
509        pub volume: ::prost::alloc::string::String,
510    }
511}
512/// GenesisMarketLastVersion is the last version including pair only used for
513/// genesis
514#[allow(clippy::derive_partial_eq_without_eq)]
515#[derive(Clone, PartialEq, ::prost::Message)]
516pub struct GenesisMarketLastVersion {
517    #[prost(string, tag="1")]
518    pub pair: ::prost::alloc::string::String,
519    #[prost(uint64, tag="2")]
520    pub version: u64,
521}
522#[allow(clippy::derive_partial_eq_without_eq)]
523#[derive(Clone, PartialEq, ::prost::Message)]
524pub struct GenesisPosition {
525    #[prost(string, tag="1")]
526    pub pair: ::prost::alloc::string::String,
527    #[prost(uint64, tag="2")]
528    pub version: u64,
529    #[prost(message, optional, tag="3")]
530    pub position: ::core::option::Option<Position>,
531}
532// ---------------------------------------- Positions
533
534/// QueryPositionsRequest: Request type for the
535/// "nibiru.perp.v2.Query/Positions" gRPC service method
536#[allow(clippy::derive_partial_eq_without_eq)]
537#[derive(Clone, PartialEq, ::prost::Message)]
538pub struct QueryPositionsRequest {
539    #[prost(string, tag="1")]
540    pub trader: ::prost::alloc::string::String,
541}
542/// QueryPositionsResponse: Response type for the
543/// "nibiru.perp.v2.Query/Positions" gRPC service method
544#[allow(clippy::derive_partial_eq_without_eq)]
545#[derive(Clone, PartialEq, ::prost::Message)]
546pub struct QueryPositionsResponse {
547    #[prost(message, repeated, tag="1")]
548    pub positions: ::prost::alloc::vec::Vec<QueryPositionResponse>,
549}
550/// QueryPositionStoreRequest: Request type for the
551/// "nibiru.perp.v2.Query/PositionStore" gRPC service method
552#[allow(clippy::derive_partial_eq_without_eq)]
553#[derive(Clone, PartialEq, ::prost::Message)]
554pub struct QueryPositionStoreRequest {
555    /// pagination defines a paginated request
556    #[prost(message, optional, tag="1")]
557    pub pagination: ::core::option::Option<crate::proto::cosmos::base::query::v1beta1::PageRequest>,
558}
559/// QueryPositionStoreResponse: Response type for the
560/// "nibiru.perp.v2.Query/PositionStore" gRPC service method
561#[allow(clippy::derive_partial_eq_without_eq)]
562#[derive(Clone, PartialEq, ::prost::Message)]
563pub struct QueryPositionStoreResponse {
564    /// Position responses: collection of all stored positions (with pagination)
565    #[prost(message, repeated, tag="1")]
566    pub positions: ::prost::alloc::vec::Vec<Position>,
567    /// pagination defines a paginated response
568    #[prost(message, optional, tag="2")]
569    pub pagination: ::core::option::Option<crate::proto::cosmos::base::query::v1beta1::PageResponse>,
570}
571// ---------------------------------------- Position
572
573/// QueryPositionRequest: Request type for the
574/// "nibiru.perp.v2.Query/Position" gRPC service method
575#[allow(clippy::derive_partial_eq_without_eq)]
576#[derive(Clone, PartialEq, ::prost::Message)]
577pub struct QueryPositionRequest {
578    #[prost(string, tag="1")]
579    pub pair: ::prost::alloc::string::String,
580    #[prost(string, tag="2")]
581    pub trader: ::prost::alloc::string::String,
582}
583/// QueryPositionResponse: Response type for the
584/// "nibiru.perp.v2.Query/Position" gRPC service method
585#[allow(clippy::derive_partial_eq_without_eq)]
586#[derive(Clone, PartialEq, ::prost::Message)]
587pub struct QueryPositionResponse {
588    /// The position as it exists in the blockchain state
589    #[prost(message, optional, tag="1")]
590    pub position: ::core::option::Option<Position>,
591    /// The position's current notional value, if it were to be entirely closed (in
592    /// margin units).
593    #[prost(string, tag="2")]
594    pub position_notional: ::prost::alloc::string::String,
595    /// The position's unrealized PnL.
596    #[prost(string, tag="3")]
597    pub unrealized_pnl: ::prost::alloc::string::String,
598    /// margin ratio of the position based on the spot price
599    #[prost(string, tag="4")]
600    pub margin_ratio: ::prost::alloc::string::String,
601}
602// ---------------------------------------- QueryModuleAccounts
603
604/// QueryModuleAccountsRequest: Request type for the
605/// "nibiru.perp.v2.Query/ModuleAccounts" gRPC service method
606#[allow(clippy::derive_partial_eq_without_eq)]
607#[derive(Clone, PartialEq, ::prost::Message)]
608pub struct QueryModuleAccountsRequest {
609}
610/// QueryModuleAccountsResponse: Response type for the
611/// "nibiru.perp.v2.Query/ModuleAccounts" gRPC service method
612#[allow(clippy::derive_partial_eq_without_eq)]
613#[derive(Clone, PartialEq, ::prost::Message)]
614pub struct QueryModuleAccountsResponse {
615    #[prost(message, repeated, tag="1")]
616    pub accounts: ::prost::alloc::vec::Vec<AccountWithBalance>,
617}
618#[allow(clippy::derive_partial_eq_without_eq)]
619#[derive(Clone, PartialEq, ::prost::Message)]
620pub struct AccountWithBalance {
621    #[prost(string, tag="1")]
622    pub name: ::prost::alloc::string::String,
623    #[prost(string, tag="2")]
624    pub address: ::prost::alloc::string::String,
625    #[prost(message, repeated, tag="3")]
626    pub balance: ::prost::alloc::vec::Vec<crate::proto::cosmos::base::v1beta1::Coin>,
627}
628#[allow(clippy::derive_partial_eq_without_eq)]
629#[derive(Clone, PartialEq, ::prost::Message)]
630pub struct AmmMarket {
631    #[prost(message, optional, tag="1")]
632    pub market: ::core::option::Option<Market>,
633    #[prost(message, optional, tag="2")]
634    pub amm: ::core::option::Option<Amm>,
635}
636#[allow(clippy::derive_partial_eq_without_eq)]
637#[derive(Clone, PartialEq, ::prost::Message)]
638pub struct QueryMarketsRequest {
639    #[prost(bool, tag="1")]
640    pub versioned: bool,
641}
642#[allow(clippy::derive_partial_eq_without_eq)]
643#[derive(Clone, PartialEq, ::prost::Message)]
644pub struct QueryMarketsResponse {
645    #[prost(message, repeated, tag="1")]
646    pub amm_markets: ::prost::alloc::vec::Vec<AmmMarket>,
647}
648// ---------------------------------------- QueryCollateral
649
650/// QueryCollateralRequest: Request type for the
651/// "nibiru.perp.v2.Query/Collateral" gRPC service method
652#[allow(clippy::derive_partial_eq_without_eq)]
653#[derive(Clone, PartialEq, ::prost::Message)]
654pub struct QueryCollateralRequest {
655}
656/// QueryCollateralRequest: Response type for the
657/// "nibiru.perp.v2.Query/Collateral" gRPC service method
658#[allow(clippy::derive_partial_eq_without_eq)]
659#[derive(Clone, PartialEq, ::prost::Message)]
660pub struct QueryCollateralResponse {
661    #[prost(string, tag="1")]
662    pub collateral_denom: ::prost::alloc::string::String,
663}
664// -------------------------- Settle Position --------------------------
665
666/// MsgSettlePosition: Msg to remove margin. 
667#[allow(clippy::derive_partial_eq_without_eq)]
668#[derive(Clone, PartialEq, ::prost::Message)]
669pub struct MsgSettlePosition {
670    #[prost(string, tag="1")]
671    pub sender: ::prost::alloc::string::String,
672    #[prost(string, tag="2")]
673    pub pair: ::prost::alloc::string::String,
674    #[prost(uint64, tag="3")]
675    pub version: u64,
676}
677// -------------------------- RemoveMargin --------------------------
678
679/// MsgRemoveMargin: Msg to remove margin. 
680#[allow(clippy::derive_partial_eq_without_eq)]
681#[derive(Clone, PartialEq, ::prost::Message)]
682pub struct MsgRemoveMargin {
683    #[prost(string, tag="1")]
684    pub sender: ::prost::alloc::string::String,
685    #[prost(string, tag="2")]
686    pub pair: ::prost::alloc::string::String,
687    #[prost(message, optional, tag="3")]
688    pub margin: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
689}
690#[allow(clippy::derive_partial_eq_without_eq)]
691#[derive(Clone, PartialEq, ::prost::Message)]
692pub struct MsgRemoveMarginResponse {
693    /// tokens transferred back to the trader
694    #[prost(message, optional, tag="1")]
695    pub margin_out: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
696    /// the funding payment applied on this position interaction
697    #[prost(string, tag="2")]
698    pub funding_payment: ::prost::alloc::string::String,
699    /// The resulting position
700    #[prost(message, optional, tag="3")]
701    pub position: ::core::option::Option<Position>,
702}
703// -------------------------- AddMargin --------------------------
704
705/// MsgAddMargin: Msg to remove margin. 
706#[allow(clippy::derive_partial_eq_without_eq)]
707#[derive(Clone, PartialEq, ::prost::Message)]
708pub struct MsgAddMargin {
709    #[prost(string, tag="1")]
710    pub sender: ::prost::alloc::string::String,
711    #[prost(string, tag="2")]
712    pub pair: ::prost::alloc::string::String,
713    #[prost(message, optional, tag="3")]
714    pub margin: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
715}
716#[allow(clippy::derive_partial_eq_without_eq)]
717#[derive(Clone, PartialEq, ::prost::Message)]
718pub struct MsgAddMarginResponse {
719    #[prost(string, tag="1")]
720    pub funding_payment: ::prost::alloc::string::String,
721    #[prost(message, optional, tag="2")]
722    pub position: ::core::option::Option<Position>,
723}
724// -------------------------- Liquidation --------------------------
725
726#[allow(clippy::derive_partial_eq_without_eq)]
727#[derive(Clone, PartialEq, ::prost::Message)]
728pub struct MsgMultiLiquidate {
729    #[prost(string, tag="1")]
730    pub sender: ::prost::alloc::string::String,
731    #[prost(message, repeated, tag="2")]
732    pub liquidations: ::prost::alloc::vec::Vec<msg_multi_liquidate::Liquidation>,
733}
734/// Nested message and enum types in `MsgMultiLiquidate`.
735pub mod msg_multi_liquidate {
736    #[allow(clippy::derive_partial_eq_without_eq)]
737#[derive(Clone, PartialEq, ::prost::Message)]
738    pub struct Liquidation {
739        #[prost(string, tag="1")]
740        pub pair: ::prost::alloc::string::String,
741        #[prost(string, tag="2")]
742        pub trader: ::prost::alloc::string::String,
743    }
744}
745#[allow(clippy::derive_partial_eq_without_eq)]
746#[derive(Clone, PartialEq, ::prost::Message)]
747pub struct MsgMultiLiquidateResponse {
748    #[prost(message, repeated, tag="1")]
749    pub liquidations: ::prost::alloc::vec::Vec<msg_multi_liquidate_response::LiquidationResponse>,
750}
751/// Nested message and enum types in `MsgMultiLiquidateResponse`.
752pub mod msg_multi_liquidate_response {
753    #[allow(clippy::derive_partial_eq_without_eq)]
754#[derive(Clone, PartialEq, ::prost::Message)]
755    pub struct LiquidationResponse {
756        #[prost(bool, tag="1")]
757        pub success: bool,
758        #[prost(string, tag="2")]
759        pub error: ::prost::alloc::string::String,
760        /// nullable since no fee is taken on failed liquidation
761        #[prost(message, optional, tag="3")]
762        pub liquidator_fee: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
763        /// perp ecosystem fund
764        #[prost(message, optional, tag="4")]
765        pub perp_ef_fee: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
766        // nullable since no fee is taken on failed liquidation
767
768        #[prost(string, tag="5")]
769        pub trader: ::prost::alloc::string::String,
770        #[prost(string, tag="6")]
771        pub pair: ::prost::alloc::string::String,
772    }
773}
774// -------------------------- MarketOrder --------------------------
775
776#[allow(clippy::derive_partial_eq_without_eq)]
777#[derive(Clone, PartialEq, ::prost::Message)]
778pub struct MsgMarketOrder {
779    #[prost(string, tag="1")]
780    pub sender: ::prost::alloc::string::String,
781    #[prost(string, tag="2")]
782    pub pair: ::prost::alloc::string::String,
783    #[prost(enumeration="Direction", tag="3")]
784    pub side: i32,
785    #[prost(string, tag="4")]
786    pub quote_asset_amount: ::prost::alloc::string::String,
787    #[prost(string, tag="5")]
788    pub leverage: ::prost::alloc::string::String,
789    #[prost(string, tag="6")]
790    pub base_asset_amount_limit: ::prost::alloc::string::String,
791}
792#[allow(clippy::derive_partial_eq_without_eq)]
793#[derive(Clone, PartialEq, ::prost::Message)]
794pub struct MsgMarketOrderResponse {
795    #[prost(message, optional, tag="1")]
796    pub position: ::core::option::Option<Position>,
797    /// The amount of quote assets exchanged.
798    #[prost(string, tag="2")]
799    pub exchanged_notional_value: ::prost::alloc::string::String,
800    /// The amount of base assets exchanged.
801    #[prost(string, tag="3")]
802    pub exchanged_position_size: ::prost::alloc::string::String,
803    /// The funding payment applied on this position change, measured in quote
804    /// units.
805    #[prost(string, tag="4")]
806    pub funding_payment: ::prost::alloc::string::String,
807    /// The amount of PnL realized on this position changed, measured in quote
808    /// units.
809    #[prost(string, tag="5")]
810    pub realized_pnl: ::prost::alloc::string::String,
811    /// The unrealized PnL in the position after the position change, measured in
812    /// quote units.
813    #[prost(string, tag="6")]
814    pub unrealized_pnl_after: ::prost::alloc::string::String,
815    /// The amount of margin the trader has to give to the vault.
816    /// A negative value means the vault pays the trader.
817    #[prost(string, tag="7")]
818    pub margin_to_vault: ::prost::alloc::string::String,
819    /// The position's notional value after the position change, measured in quote
820    /// units.
821    #[prost(string, tag="8")]
822    pub position_notional: ::prost::alloc::string::String,
823}
824// -------------------------- ClosePosition --------------------------
825
826#[allow(clippy::derive_partial_eq_without_eq)]
827#[derive(Clone, PartialEq, ::prost::Message)]
828pub struct MsgClosePosition {
829    #[prost(string, tag="1")]
830    pub sender: ::prost::alloc::string::String,
831    #[prost(string, tag="2")]
832    pub pair: ::prost::alloc::string::String,
833}
834#[allow(clippy::derive_partial_eq_without_eq)]
835#[derive(Clone, PartialEq, ::prost::Message)]
836pub struct MsgClosePositionResponse {
837    /// The amount of quote assets exchanged.
838    #[prost(string, tag="1")]
839    pub exchanged_notional_value: ::prost::alloc::string::String,
840    /// The amount of base assets exchanged.
841    #[prost(string, tag="2")]
842    pub exchanged_position_size: ::prost::alloc::string::String,
843    /// The funding payment applied on this position change, measured in quote
844    /// units.
845    #[prost(string, tag="3")]
846    pub funding_payment: ::prost::alloc::string::String,
847    /// The amount of PnL realized on this position changed, measured in quote
848    /// units.
849    #[prost(string, tag="4")]
850    pub realized_pnl: ::prost::alloc::string::String,
851    /// The amount of margin the trader receives after closing the position, from
852    /// the vault. Should never be negative.
853    #[prost(string, tag="5")]
854    pub margin_to_trader: ::prost::alloc::string::String,
855}
856#[allow(clippy::derive_partial_eq_without_eq)]
857#[derive(Clone, PartialEq, ::prost::Message)]
858pub struct MsgPartialClose {
859    #[prost(string, tag="1")]
860    pub sender: ::prost::alloc::string::String,
861    #[prost(string, tag="2")]
862    pub pair: ::prost::alloc::string::String,
863    #[prost(string, tag="3")]
864    pub size: ::prost::alloc::string::String,
865}
866#[allow(clippy::derive_partial_eq_without_eq)]
867#[derive(Clone, PartialEq, ::prost::Message)]
868pub struct MsgPartialCloseResponse {
869    /// The amount of quote assets exchanged.
870    #[prost(string, tag="1")]
871    pub exchanged_notional_value: ::prost::alloc::string::String,
872    /// The amount of base assets exchanged.
873    #[prost(string, tag="2")]
874    pub exchanged_position_size: ::prost::alloc::string::String,
875    /// The funding payment applied on this position change, measured in quote
876    /// units.
877    #[prost(string, tag="3")]
878    pub funding_payment: ::prost::alloc::string::String,
879    /// The amount of PnL realized on this position changed, measured in quote
880    /// units.
881    #[prost(string, tag="4")]
882    pub realized_pnl: ::prost::alloc::string::String,
883    /// The amount of margin the trader receives after closing the position, from
884    /// the vault. Should never be negative.
885    #[prost(string, tag="5")]
886    pub margin_to_trader: ::prost::alloc::string::String,
887}
888// -------------------------- DonateToEcosystemFund --------------------------
889
890#[allow(clippy::derive_partial_eq_without_eq)]
891#[derive(Clone, PartialEq, ::prost::Message)]
892pub struct MsgDonateToEcosystemFund {
893    #[prost(string, tag="1")]
894    pub sender: ::prost::alloc::string::String,
895    /// donation to the EF
896    #[prost(message, optional, tag="2")]
897    pub donation: ::core::option::Option<crate::proto::cosmos::base::v1beta1::Coin>,
898}
899#[allow(clippy::derive_partial_eq_without_eq)]
900#[derive(Clone, PartialEq, ::prost::Message)]
901pub struct MsgDonateToEcosystemFundResponse {
902}
903// -----------------------  MsgChangeCollateralDenom -----------------------
904
905/// MsgChangeCollateralDenom: Changes the collateral denom for the module.
906/// \[SUDO\] Only callable by sudoers.
907#[allow(clippy::derive_partial_eq_without_eq)]
908#[derive(Clone, PartialEq, ::prost::Message)]
909pub struct MsgChangeCollateralDenom {
910    #[prost(string, tag="1")]
911    pub sender: ::prost::alloc::string::String,
912    #[prost(string, tag="2")]
913    pub new_denom: ::prost::alloc::string::String,
914}
915#[allow(clippy::derive_partial_eq_without_eq)]
916#[derive(Clone, PartialEq, ::prost::Message)]
917pub struct MsgChangeCollateralDenomResponse {
918}
919/// -------------------------- AllocateEpochRebates --------------------------
920#[allow(clippy::derive_partial_eq_without_eq)]
921#[derive(Clone, PartialEq, ::prost::Message)]
922pub struct MsgAllocateEpochRebates {
923    #[prost(string, tag="1")]
924    pub sender: ::prost::alloc::string::String,
925    /// rebates to allocate
926    #[prost(message, repeated, tag="2")]
927    pub rebates: ::prost::alloc::vec::Vec<crate::proto::cosmos::base::v1beta1::Coin>,
928}
929#[allow(clippy::derive_partial_eq_without_eq)]
930#[derive(Clone, PartialEq, ::prost::Message)]
931pub struct MsgAllocateEpochRebatesResponse {
932    #[prost(message, repeated, tag="1")]
933    pub total_epoch_rebates: ::prost::alloc::vec::Vec<crate::proto::cosmos::base::v1beta1::Coin>,
934}
935/// -------------------------- WithdrawEpochRebates --------------------------
936#[allow(clippy::derive_partial_eq_without_eq)]
937#[derive(Clone, PartialEq, ::prost::Message)]
938pub struct MsgWithdrawEpochRebates {
939    #[prost(string, tag="1")]
940    pub sender: ::prost::alloc::string::String,
941    #[prost(uint64, repeated, tag="2")]
942    pub epochs: ::prost::alloc::vec::Vec<u64>,
943}
944#[allow(clippy::derive_partial_eq_without_eq)]
945#[derive(Clone, PartialEq, ::prost::Message)]
946pub struct MsgWithdrawEpochRebatesResponse {
947    #[prost(message, repeated, tag="1")]
948    pub withdrawn_rebates: ::prost::alloc::vec::Vec<crate::proto::cosmos::base::v1beta1::Coin>,
949}
950// -------------------------- ShiftPegMultiplier --------------------------
951
952/// MsgShiftPegMultiplier: gRPC tx msg for changing the peg multiplier.
953/// \[SUDO\] Only callable sudoers.
954#[allow(clippy::derive_partial_eq_without_eq)]
955#[derive(Clone, PartialEq, ::prost::Message)]
956pub struct MsgShiftPegMultiplier {
957    #[prost(string, tag="1")]
958    pub sender: ::prost::alloc::string::String,
959    #[prost(string, tag="2")]
960    pub pair: ::prost::alloc::string::String,
961    #[prost(string, tag="3")]
962    pub new_peg_mult: ::prost::alloc::string::String,
963}
964#[allow(clippy::derive_partial_eq_without_eq)]
965#[derive(Clone, PartialEq, ::prost::Message)]
966pub struct MsgShiftPegMultiplierResponse {
967}
968// -------------------------- ShiftSwapInvariant --------------------------
969
970/// MsgShiftSwapInvariant: gRPC tx msg for changing the swap invariant.
971/// \[SUDO\] Only callable sudoers.
972#[allow(clippy::derive_partial_eq_without_eq)]
973#[derive(Clone, PartialEq, ::prost::Message)]
974pub struct MsgShiftSwapInvariant {
975    #[prost(string, tag="1")]
976    pub sender: ::prost::alloc::string::String,
977    #[prost(string, tag="2")]
978    pub pair: ::prost::alloc::string::String,
979    #[prost(string, tag="3")]
980    pub new_swap_invariant: ::prost::alloc::string::String,
981}
982#[allow(clippy::derive_partial_eq_without_eq)]
983#[derive(Clone, PartialEq, ::prost::Message)]
984pub struct MsgShiftSwapInvariantResponse {
985}
986// -------------------------- WithdrawFromPerpFund --------------------------
987
988/// MsgWithdrawFromPerpFund: gRPC tx msg for changing the swap invariant.
989/// \[SUDO\] Only callable sudoers.
990#[allow(clippy::derive_partial_eq_without_eq)]
991#[derive(Clone, PartialEq, ::prost::Message)]
992pub struct MsgWithdrawFromPerpFund {
993    #[prost(string, tag="1")]
994    pub sender: ::prost::alloc::string::String,
995    #[prost(string, tag="2")]
996    pub amount: ::prost::alloc::string::String,
997    /// Optional denom in case withdrawing assets aside from NUSD.
998    #[prost(string, tag="3")]
999    pub denom: ::prost::alloc::string::String,
1000    #[prost(string, tag="4")]
1001    pub to_addr: ::prost::alloc::string::String,
1002}
1003#[allow(clippy::derive_partial_eq_without_eq)]
1004#[derive(Clone, PartialEq, ::prost::Message)]
1005pub struct MsgWithdrawFromPerpFundResponse {
1006}
1007// -------------------------- CloseMarket --------------------------
1008
1009/// CloseMarket: gRPC tx msg for closing a market.
1010/// Admin-only.
1011#[allow(clippy::derive_partial_eq_without_eq)]
1012#[derive(Clone, PartialEq, ::prost::Message)]
1013pub struct MsgCloseMarket {
1014    #[prost(string, tag="1")]
1015    pub sender: ::prost::alloc::string::String,
1016    #[prost(string, tag="2")]
1017    pub pair: ::prost::alloc::string::String,
1018}
1019#[allow(clippy::derive_partial_eq_without_eq)]
1020#[derive(Clone, PartialEq, ::prost::Message)]
1021pub struct MsgCloseMarketResponse {
1022}
1023// @@protoc_insertion_point(module)