penumbra_sdk_proto/gen/
penumbra.core.component.distributions.v1.rs

1// This file is @generated by prost-build.
2/// Distribution configuration data.
3#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct DistributionsParameters {
5    /// The amount of staking token issued per block.
6    #[prost(uint64, tag = "1")]
7    pub staking_issuance_per_block: u64,
8    /// The amount of staking token flowing from the community pool to the liquidity tournament each block.
9    #[prost(uint64, tag = "2")]
10    pub liquidity_tournament_incentive_per_block: u64,
11    /// If non-zero, no rewards will be distributed at a height >= this height.
12    #[prost(uint64, tag = "3")]
13    pub liquidity_tournament_end_block: u64,
14}
15impl ::prost::Name for DistributionsParameters {
16    const NAME: &'static str = "DistributionsParameters";
17    const PACKAGE: &'static str = "penumbra.core.component.distributions.v1";
18    fn full_name() -> ::prost::alloc::string::String {
19        "penumbra.core.component.distributions.v1.DistributionsParameters".into()
20    }
21    fn type_url() -> ::prost::alloc::string::String {
22        "/penumbra.core.component.distributions.v1.DistributionsParameters".into()
23    }
24}
25/// Genesis data for the distributions module.
26#[derive(Clone, Copy, PartialEq, ::prost::Message)]
27pub struct GenesisContent {
28    #[prost(message, optional, tag = "1")]
29    pub distributions_params: ::core::option::Option<DistributionsParameters>,
30}
31impl ::prost::Name for GenesisContent {
32    const NAME: &'static str = "GenesisContent";
33    const PACKAGE: &'static str = "penumbra.core.component.distributions.v1";
34    fn full_name() -> ::prost::alloc::string::String {
35        "penumbra.core.component.distributions.v1.GenesisContent".into()
36    }
37    fn type_url() -> ::prost::alloc::string::String {
38        "/penumbra.core.component.distributions.v1.GenesisContent".into()
39    }
40}
41/// Request for retrieving the pool size of the current epoch from the chain state.
42#[derive(Clone, Copy, PartialEq, ::prost::Message)]
43pub struct CurrentLqtPoolSizeRequest {}
44impl ::prost::Name for CurrentLqtPoolSizeRequest {
45    const NAME: &'static str = "CurrentLqtPoolSizeRequest";
46    const PACKAGE: &'static str = "penumbra.core.component.distributions.v1";
47    fn full_name() -> ::prost::alloc::string::String {
48        "penumbra.core.component.distributions.v1.CurrentLqtPoolSizeRequest".into()
49    }
50    fn type_url() -> ::prost::alloc::string::String {
51        "/penumbra.core.component.distributions.v1.CurrentLqtPoolSizeRequest".into()
52    }
53}
54/// Response containing the pool size for the current epoch.
55#[derive(Clone, Copy, PartialEq, ::prost::Message)]
56pub struct CurrentLqtPoolSizeResponse {
57    /// The current epoch index.
58    #[prost(uint64, tag = "1")]
59    pub epoch_index: u64,
60    /// The total LQT pool size for the current epoch.
61    #[prost(message, optional, tag = "2")]
62    pub pool_size: ::core::option::Option<super::super::super::num::v1::Amount>,
63}
64impl ::prost::Name for CurrentLqtPoolSizeResponse {
65    const NAME: &'static str = "CurrentLqtPoolSizeResponse";
66    const PACKAGE: &'static str = "penumbra.core.component.distributions.v1";
67    fn full_name() -> ::prost::alloc::string::String {
68        "penumbra.core.component.distributions.v1.CurrentLqtPoolSizeResponse".into()
69    }
70    fn type_url() -> ::prost::alloc::string::String {
71        "/penumbra.core.component.distributions.v1.CurrentLqtPoolSizeResponse".into()
72    }
73}
74/// Request for retrieving the pool size at a specific epoch.
75#[derive(Clone, Copy, PartialEq, ::prost::Message)]
76pub struct LqtPoolSizeByEpochRequest {
77    /// The epoch for which we want to retrieve the pool size.
78    #[prost(uint64, tag = "1")]
79    pub epoch: u64,
80}
81impl ::prost::Name for LqtPoolSizeByEpochRequest {
82    const NAME: &'static str = "LqtPoolSizeByEpochRequest";
83    const PACKAGE: &'static str = "penumbra.core.component.distributions.v1";
84    fn full_name() -> ::prost::alloc::string::String {
85        "penumbra.core.component.distributions.v1.LqtPoolSizeByEpochRequest".into()
86    }
87    fn type_url() -> ::prost::alloc::string::String {
88        "/penumbra.core.component.distributions.v1.LqtPoolSizeByEpochRequest".into()
89    }
90}
91/// Response containing the pool size at a specific epoch.
92#[derive(Clone, Copy, PartialEq, ::prost::Message)]
93pub struct LqtPoolSizeByEpochResponse {
94    /// The epoch for which the pool size is returned.
95    #[prost(uint64, tag = "1")]
96    pub epoch_index: u64,
97    /// The total LQT pool size for the given epoch.
98    #[prost(message, optional, tag = "2")]
99    pub pool_size: ::core::option::Option<super::super::super::num::v1::Amount>,
100}
101impl ::prost::Name for LqtPoolSizeByEpochResponse {
102    const NAME: &'static str = "LqtPoolSizeByEpochResponse";
103    const PACKAGE: &'static str = "penumbra.core.component.distributions.v1";
104    fn full_name() -> ::prost::alloc::string::String {
105        "penumbra.core.component.distributions.v1.LqtPoolSizeByEpochResponse".into()
106    }
107    fn type_url() -> ::prost::alloc::string::String {
108        "/penumbra.core.component.distributions.v1.LqtPoolSizeByEpochResponse".into()
109    }
110}
111/// Event emitted when the size of the LQT pool increases.
112#[derive(Clone, Copy, PartialEq, ::prost::Message)]
113pub struct EventLqtPoolSizeIncrease {
114    /// The epoch in which the pool size increase occurred.
115    #[prost(uint64, tag = "1")]
116    pub epoch: u64,
117    /// The amount by which the LQT pool size increased in the block.
118    #[prost(message, optional, tag = "2")]
119    pub increase: ::core::option::Option<super::super::super::num::v1::Amount>,
120    /// The new total size of the LQT pool after the increase in the block.
121    #[prost(message, optional, tag = "3")]
122    pub new_total: ::core::option::Option<super::super::super::num::v1::Amount>,
123}
124impl ::prost::Name for EventLqtPoolSizeIncrease {
125    const NAME: &'static str = "EventLqtPoolSizeIncrease";
126    const PACKAGE: &'static str = "penumbra.core.component.distributions.v1";
127    fn full_name() -> ::prost::alloc::string::String {
128        "penumbra.core.component.distributions.v1.EventLqtPoolSizeIncrease".into()
129    }
130    fn type_url() -> ::prost::alloc::string::String {
131        "/penumbra.core.component.distributions.v1.EventLqtPoolSizeIncrease".into()
132    }
133}
134/// Generated client implementations.
135#[cfg(feature = "rpc")]
136pub mod distributions_service_client {
137    #![allow(
138        unused_variables,
139        dead_code,
140        missing_docs,
141        clippy::wildcard_imports,
142        clippy::let_unit_value,
143    )]
144    use tonic::codegen::*;
145    use tonic::codegen::http::Uri;
146    /// Query operations for the distributions component.
147    #[derive(Debug, Clone)]
148    pub struct DistributionsServiceClient<T> {
149        inner: tonic::client::Grpc<T>,
150    }
151    impl DistributionsServiceClient<tonic::transport::Channel> {
152        /// Attempt to create a new client by connecting to a given endpoint.
153        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
154        where
155            D: TryInto<tonic::transport::Endpoint>,
156            D::Error: Into<StdError>,
157        {
158            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
159            Ok(Self::new(conn))
160        }
161    }
162    impl<T> DistributionsServiceClient<T>
163    where
164        T: tonic::client::GrpcService<tonic::body::BoxBody>,
165        T::Error: Into<StdError>,
166        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
167        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
168    {
169        pub fn new(inner: T) -> Self {
170            let inner = tonic::client::Grpc::new(inner);
171            Self { inner }
172        }
173        pub fn with_origin(inner: T, origin: Uri) -> Self {
174            let inner = tonic::client::Grpc::with_origin(inner, origin);
175            Self { inner }
176        }
177        pub fn with_interceptor<F>(
178            inner: T,
179            interceptor: F,
180        ) -> DistributionsServiceClient<InterceptedService<T, F>>
181        where
182            F: tonic::service::Interceptor,
183            T::ResponseBody: Default,
184            T: tonic::codegen::Service<
185                http::Request<tonic::body::BoxBody>,
186                Response = http::Response<
187                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
188                >,
189            >,
190            <T as tonic::codegen::Service<
191                http::Request<tonic::body::BoxBody>,
192            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
193        {
194            DistributionsServiceClient::new(InterceptedService::new(inner, interceptor))
195        }
196        /// Compress requests with the given encoding.
197        ///
198        /// This requires the server to support it otherwise it might respond with an
199        /// error.
200        #[must_use]
201        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
202            self.inner = self.inner.send_compressed(encoding);
203            self
204        }
205        /// Enable decompressing responses.
206        #[must_use]
207        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
208            self.inner = self.inner.accept_compressed(encoding);
209            self
210        }
211        /// Limits the maximum size of a decoded message.
212        ///
213        /// Default: `4MB`
214        #[must_use]
215        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
216            self.inner = self.inner.max_decoding_message_size(limit);
217            self
218        }
219        /// Limits the maximum size of an encoded message.
220        ///
221        /// Default: `usize::MAX`
222        #[must_use]
223        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
224            self.inner = self.inner.max_encoding_message_size(limit);
225            self
226        }
227        pub async fn current_lqt_pool_size(
228            &mut self,
229            request: impl tonic::IntoRequest<super::CurrentLqtPoolSizeRequest>,
230        ) -> std::result::Result<
231            tonic::Response<super::CurrentLqtPoolSizeResponse>,
232            tonic::Status,
233        > {
234            self.inner
235                .ready()
236                .await
237                .map_err(|e| {
238                    tonic::Status::unknown(
239                        format!("Service was not ready: {}", e.into()),
240                    )
241                })?;
242            let codec = tonic::codec::ProstCodec::default();
243            let path = http::uri::PathAndQuery::from_static(
244                "/penumbra.core.component.distributions.v1.DistributionsService/CurrentLqtPoolSize",
245            );
246            let mut req = request.into_request();
247            req.extensions_mut()
248                .insert(
249                    GrpcMethod::new(
250                        "penumbra.core.component.distributions.v1.DistributionsService",
251                        "CurrentLqtPoolSize",
252                    ),
253                );
254            self.inner.unary(req, path, codec).await
255        }
256        pub async fn lqt_pool_size_by_epoch(
257            &mut self,
258            request: impl tonic::IntoRequest<super::LqtPoolSizeByEpochRequest>,
259        ) -> std::result::Result<
260            tonic::Response<super::LqtPoolSizeByEpochResponse>,
261            tonic::Status,
262        > {
263            self.inner
264                .ready()
265                .await
266                .map_err(|e| {
267                    tonic::Status::unknown(
268                        format!("Service was not ready: {}", e.into()),
269                    )
270                })?;
271            let codec = tonic::codec::ProstCodec::default();
272            let path = http::uri::PathAndQuery::from_static(
273                "/penumbra.core.component.distributions.v1.DistributionsService/LqtPoolSizeByEpoch",
274            );
275            let mut req = request.into_request();
276            req.extensions_mut()
277                .insert(
278                    GrpcMethod::new(
279                        "penumbra.core.component.distributions.v1.DistributionsService",
280                        "LqtPoolSizeByEpoch",
281                    ),
282                );
283            self.inner.unary(req, path, codec).await
284        }
285    }
286}
287/// Generated server implementations.
288#[cfg(feature = "rpc")]
289pub mod distributions_service_server {
290    #![allow(
291        unused_variables,
292        dead_code,
293        missing_docs,
294        clippy::wildcard_imports,
295        clippy::let_unit_value,
296    )]
297    use tonic::codegen::*;
298    /// Generated trait containing gRPC methods that should be implemented for use with DistributionsServiceServer.
299    #[async_trait]
300    pub trait DistributionsService: std::marker::Send + std::marker::Sync + 'static {
301        async fn current_lqt_pool_size(
302            &self,
303            request: tonic::Request<super::CurrentLqtPoolSizeRequest>,
304        ) -> std::result::Result<
305            tonic::Response<super::CurrentLqtPoolSizeResponse>,
306            tonic::Status,
307        >;
308        async fn lqt_pool_size_by_epoch(
309            &self,
310            request: tonic::Request<super::LqtPoolSizeByEpochRequest>,
311        ) -> std::result::Result<
312            tonic::Response<super::LqtPoolSizeByEpochResponse>,
313            tonic::Status,
314        >;
315    }
316    /// Query operations for the distributions component.
317    #[derive(Debug)]
318    pub struct DistributionsServiceServer<T> {
319        inner: Arc<T>,
320        accept_compression_encodings: EnabledCompressionEncodings,
321        send_compression_encodings: EnabledCompressionEncodings,
322        max_decoding_message_size: Option<usize>,
323        max_encoding_message_size: Option<usize>,
324    }
325    impl<T> DistributionsServiceServer<T> {
326        pub fn new(inner: T) -> Self {
327            Self::from_arc(Arc::new(inner))
328        }
329        pub fn from_arc(inner: Arc<T>) -> Self {
330            Self {
331                inner,
332                accept_compression_encodings: Default::default(),
333                send_compression_encodings: Default::default(),
334                max_decoding_message_size: None,
335                max_encoding_message_size: None,
336            }
337        }
338        pub fn with_interceptor<F>(
339            inner: T,
340            interceptor: F,
341        ) -> InterceptedService<Self, F>
342        where
343            F: tonic::service::Interceptor,
344        {
345            InterceptedService::new(Self::new(inner), interceptor)
346        }
347        /// Enable decompressing requests with the given encoding.
348        #[must_use]
349        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
350            self.accept_compression_encodings.enable(encoding);
351            self
352        }
353        /// Compress responses with the given encoding, if the client supports it.
354        #[must_use]
355        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
356            self.send_compression_encodings.enable(encoding);
357            self
358        }
359        /// Limits the maximum size of a decoded message.
360        ///
361        /// Default: `4MB`
362        #[must_use]
363        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
364            self.max_decoding_message_size = Some(limit);
365            self
366        }
367        /// Limits the maximum size of an encoded message.
368        ///
369        /// Default: `usize::MAX`
370        #[must_use]
371        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
372            self.max_encoding_message_size = Some(limit);
373            self
374        }
375    }
376    impl<T, B> tonic::codegen::Service<http::Request<B>>
377    for DistributionsServiceServer<T>
378    where
379        T: DistributionsService,
380        B: Body + std::marker::Send + 'static,
381        B::Error: Into<StdError> + std::marker::Send + 'static,
382    {
383        type Response = http::Response<tonic::body::BoxBody>;
384        type Error = std::convert::Infallible;
385        type Future = BoxFuture<Self::Response, Self::Error>;
386        fn poll_ready(
387            &mut self,
388            _cx: &mut Context<'_>,
389        ) -> Poll<std::result::Result<(), Self::Error>> {
390            Poll::Ready(Ok(()))
391        }
392        fn call(&mut self, req: http::Request<B>) -> Self::Future {
393            match req.uri().path() {
394                "/penumbra.core.component.distributions.v1.DistributionsService/CurrentLqtPoolSize" => {
395                    #[allow(non_camel_case_types)]
396                    struct CurrentLqtPoolSizeSvc<T: DistributionsService>(pub Arc<T>);
397                    impl<
398                        T: DistributionsService,
399                    > tonic::server::UnaryService<super::CurrentLqtPoolSizeRequest>
400                    for CurrentLqtPoolSizeSvc<T> {
401                        type Response = super::CurrentLqtPoolSizeResponse;
402                        type Future = BoxFuture<
403                            tonic::Response<Self::Response>,
404                            tonic::Status,
405                        >;
406                        fn call(
407                            &mut self,
408                            request: tonic::Request<super::CurrentLqtPoolSizeRequest>,
409                        ) -> Self::Future {
410                            let inner = Arc::clone(&self.0);
411                            let fut = async move {
412                                <T as DistributionsService>::current_lqt_pool_size(
413                                        &inner,
414                                        request,
415                                    )
416                                    .await
417                            };
418                            Box::pin(fut)
419                        }
420                    }
421                    let accept_compression_encodings = self.accept_compression_encodings;
422                    let send_compression_encodings = self.send_compression_encodings;
423                    let max_decoding_message_size = self.max_decoding_message_size;
424                    let max_encoding_message_size = self.max_encoding_message_size;
425                    let inner = self.inner.clone();
426                    let fut = async move {
427                        let method = CurrentLqtPoolSizeSvc(inner);
428                        let codec = tonic::codec::ProstCodec::default();
429                        let mut grpc = tonic::server::Grpc::new(codec)
430                            .apply_compression_config(
431                                accept_compression_encodings,
432                                send_compression_encodings,
433                            )
434                            .apply_max_message_size_config(
435                                max_decoding_message_size,
436                                max_encoding_message_size,
437                            );
438                        let res = grpc.unary(method, req).await;
439                        Ok(res)
440                    };
441                    Box::pin(fut)
442                }
443                "/penumbra.core.component.distributions.v1.DistributionsService/LqtPoolSizeByEpoch" => {
444                    #[allow(non_camel_case_types)]
445                    struct LqtPoolSizeByEpochSvc<T: DistributionsService>(pub Arc<T>);
446                    impl<
447                        T: DistributionsService,
448                    > tonic::server::UnaryService<super::LqtPoolSizeByEpochRequest>
449                    for LqtPoolSizeByEpochSvc<T> {
450                        type Response = super::LqtPoolSizeByEpochResponse;
451                        type Future = BoxFuture<
452                            tonic::Response<Self::Response>,
453                            tonic::Status,
454                        >;
455                        fn call(
456                            &mut self,
457                            request: tonic::Request<super::LqtPoolSizeByEpochRequest>,
458                        ) -> Self::Future {
459                            let inner = Arc::clone(&self.0);
460                            let fut = async move {
461                                <T as DistributionsService>::lqt_pool_size_by_epoch(
462                                        &inner,
463                                        request,
464                                    )
465                                    .await
466                            };
467                            Box::pin(fut)
468                        }
469                    }
470                    let accept_compression_encodings = self.accept_compression_encodings;
471                    let send_compression_encodings = self.send_compression_encodings;
472                    let max_decoding_message_size = self.max_decoding_message_size;
473                    let max_encoding_message_size = self.max_encoding_message_size;
474                    let inner = self.inner.clone();
475                    let fut = async move {
476                        let method = LqtPoolSizeByEpochSvc(inner);
477                        let codec = tonic::codec::ProstCodec::default();
478                        let mut grpc = tonic::server::Grpc::new(codec)
479                            .apply_compression_config(
480                                accept_compression_encodings,
481                                send_compression_encodings,
482                            )
483                            .apply_max_message_size_config(
484                                max_decoding_message_size,
485                                max_encoding_message_size,
486                            );
487                        let res = grpc.unary(method, req).await;
488                        Ok(res)
489                    };
490                    Box::pin(fut)
491                }
492                _ => {
493                    Box::pin(async move {
494                        let mut response = http::Response::new(empty_body());
495                        let headers = response.headers_mut();
496                        headers
497                            .insert(
498                                tonic::Status::GRPC_STATUS,
499                                (tonic::Code::Unimplemented as i32).into(),
500                            );
501                        headers
502                            .insert(
503                                http::header::CONTENT_TYPE,
504                                tonic::metadata::GRPC_CONTENT_TYPE,
505                            );
506                        Ok(response)
507                    })
508                }
509            }
510        }
511    }
512    impl<T> Clone for DistributionsServiceServer<T> {
513        fn clone(&self) -> Self {
514            let inner = self.inner.clone();
515            Self {
516                inner,
517                accept_compression_encodings: self.accept_compression_encodings,
518                send_compression_encodings: self.send_compression_encodings,
519                max_decoding_message_size: self.max_decoding_message_size,
520                max_encoding_message_size: self.max_encoding_message_size,
521            }
522        }
523    }
524    /// Generated gRPC service name
525    pub const SERVICE_NAME: &str = "penumbra.core.component.distributions.v1.DistributionsService";
526    impl<T> tonic::server::NamedService for DistributionsServiceServer<T> {
527        const NAME: &'static str = SERVICE_NAME;
528    }
529}