elys_stdd/types/elys/
stablestake.rs

1use elys_std_deriv::CosmwasmExt;
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(
4    Clone,
5    PartialEq,
6    Eq,
7    ::prost::Message,
8    ::serde::Serialize,
9    ::serde::Deserialize,
10    ::schemars::JsonSchema,
11    CosmwasmExt,
12)]
13#[proto_message(type_url = "/elys.stablestake.Debt")]
14pub struct Debt {
15    #[prost(string, tag = "1")]
16    pub address: ::prost::alloc::string::String,
17    #[prost(string, tag = "2")]
18    pub borrowed: ::prost::alloc::string::String,
19    #[prost(string, tag = "3")]
20    pub interest_paid: ::prost::alloc::string::String,
21    #[prost(string, tag = "4")]
22    pub interest_stacked: ::prost::alloc::string::String,
23    #[prost(uint64, tag = "5")]
24    #[serde(
25        serialize_with = "crate::serde::as_str::serialize",
26        deserialize_with = "crate::serde::as_str::deserialize"
27    )]
28    pub borrow_time: u64,
29    #[prost(uint64, tag = "6")]
30    #[serde(
31        serialize_with = "crate::serde::as_str::serialize",
32        deserialize_with = "crate::serde::as_str::deserialize"
33    )]
34    pub last_interest_calc_time: u64,
35    #[prost(uint64, tag = "7")]
36    #[serde(
37        serialize_with = "crate::serde::as_str::serialize",
38        deserialize_with = "crate::serde::as_str::deserialize"
39    )]
40    pub last_interest_calc_block: u64,
41}
42#[allow(clippy::derive_partial_eq_without_eq)]
43#[derive(
44    Clone,
45    PartialEq,
46    Eq,
47    ::prost::Message,
48    ::serde::Serialize,
49    ::serde::Deserialize,
50    ::schemars::JsonSchema,
51    CosmwasmExt,
52)]
53#[proto_message(type_url = "/elys.stablestake.LegacyParams")]
54pub struct LegacyParams {
55    #[prost(string, tag = "1")]
56    pub deposit_denom: ::prost::alloc::string::String,
57    #[prost(string, tag = "2")]
58    pub redemption_rate: ::prost::alloc::string::String,
59    #[prost(int64, tag = "3")]
60    #[serde(
61        serialize_with = "crate::serde::as_str::serialize",
62        deserialize_with = "crate::serde::as_str::deserialize"
63    )]
64    pub epoch_length: i64,
65    #[prost(string, tag = "4")]
66    pub interest_rate: ::prost::alloc::string::String,
67    #[prost(string, tag = "5")]
68    pub interest_rate_max: ::prost::alloc::string::String,
69    #[prost(string, tag = "6")]
70    pub interest_rate_min: ::prost::alloc::string::String,
71    #[prost(string, tag = "7")]
72    pub interest_rate_increase: ::prost::alloc::string::String,
73    #[prost(string, tag = "8")]
74    pub interest_rate_decrease: ::prost::alloc::string::String,
75    #[prost(string, tag = "9")]
76    pub health_gain_factor: ::prost::alloc::string::String,
77    #[prost(string, tag = "10")]
78    pub total_value: ::prost::alloc::string::String,
79}
80/// Params defines the parameters for the module.
81#[allow(clippy::derive_partial_eq_without_eq)]
82#[derive(
83    Clone,
84    PartialEq,
85    Eq,
86    ::prost::Message,
87    ::serde::Serialize,
88    ::serde::Deserialize,
89    ::schemars::JsonSchema,
90    CosmwasmExt,
91)]
92#[proto_message(type_url = "/elys.stablestake.Params")]
93pub struct Params {
94    #[prost(string, tag = "1")]
95    pub deposit_denom: ::prost::alloc::string::String,
96    #[prost(string, tag = "2")]
97    pub redemption_rate: ::prost::alloc::string::String,
98    #[prost(int64, tag = "3")]
99    #[serde(
100        serialize_with = "crate::serde::as_str::serialize",
101        deserialize_with = "crate::serde::as_str::deserialize"
102    )]
103    pub epoch_length: i64,
104    #[prost(string, tag = "4")]
105    pub interest_rate: ::prost::alloc::string::String,
106    #[prost(string, tag = "5")]
107    pub interest_rate_max: ::prost::alloc::string::String,
108    #[prost(string, tag = "6")]
109    pub interest_rate_min: ::prost::alloc::string::String,
110    #[prost(string, tag = "7")]
111    pub interest_rate_increase: ::prost::alloc::string::String,
112    #[prost(string, tag = "8")]
113    pub interest_rate_decrease: ::prost::alloc::string::String,
114    #[prost(string, tag = "9")]
115    pub health_gain_factor: ::prost::alloc::string::String,
116    #[prost(string, tag = "10")]
117    pub total_value: ::prost::alloc::string::String,
118    #[prost(string, tag = "11")]
119    pub max_leverage_ratio: ::prost::alloc::string::String,
120    #[prost(string, tag = "12")]
121    pub max_withdraw_ratio: ::prost::alloc::string::String,
122}
123#[allow(clippy::derive_partial_eq_without_eq)]
124#[derive(
125    Clone,
126    PartialEq,
127    Eq,
128    ::prost::Message,
129    ::serde::Serialize,
130    ::serde::Deserialize,
131    ::schemars::JsonSchema,
132    CosmwasmExt,
133)]
134#[proto_message(type_url = "/elys.stablestake.BalanceBorrowed")]
135pub struct BalanceBorrowed {
136    #[prost(string, tag = "1")]
137    pub usd_amount: ::prost::alloc::string::String,
138    #[prost(string, tag = "2")]
139    pub percentage: ::prost::alloc::string::String,
140}
141#[allow(clippy::derive_partial_eq_without_eq)]
142#[derive(
143    Clone,
144    PartialEq,
145    Eq,
146    ::prost::Message,
147    ::serde::Serialize,
148    ::serde::Deserialize,
149    ::schemars::JsonSchema,
150    CosmwasmExt,
151)]
152#[proto_message(type_url = "/elys.stablestake.InterestBlock")]
153pub struct InterestBlock {
154    #[prost(string, tag = "1")]
155    pub interest_rate: ::prost::alloc::string::String,
156    #[prost(int64, tag = "2")]
157    #[serde(
158        serialize_with = "crate::serde::as_str::serialize",
159        deserialize_with = "crate::serde::as_str::deserialize"
160    )]
161    pub block_time: i64,
162    #[prost(uint64, tag = "3")]
163    #[serde(
164        serialize_with = "crate::serde::as_str::serialize",
165        deserialize_with = "crate::serde::as_str::deserialize"
166    )]
167    pub block_height: u64,
168}
169#[allow(clippy::derive_partial_eq_without_eq)]
170#[derive(
171    Clone,
172    PartialEq,
173    Eq,
174    ::prost::Message,
175    ::serde::Serialize,
176    ::serde::Deserialize,
177    ::schemars::JsonSchema,
178    CosmwasmExt,
179)]
180#[proto_message(type_url = "/elys.stablestake.LegacyInterestBlock")]
181pub struct LegacyInterestBlock {
182    #[prost(string, tag = "1")]
183    pub interest_rate: ::prost::alloc::string::String,
184    #[prost(int64, tag = "2")]
185    #[serde(
186        serialize_with = "crate::serde::as_str::serialize",
187        deserialize_with = "crate::serde::as_str::deserialize"
188    )]
189    pub block_time: i64,
190}
191/// GenesisState defines the stablestake module's genesis state.
192#[allow(clippy::derive_partial_eq_without_eq)]
193#[derive(
194    Clone,
195    PartialEq,
196    Eq,
197    ::prost::Message,
198    ::serde::Serialize,
199    ::serde::Deserialize,
200    ::schemars::JsonSchema,
201    CosmwasmExt,
202)]
203#[proto_message(type_url = "/elys.stablestake.GenesisState")]
204pub struct GenesisState {
205    #[prost(message, optional, tag = "1")]
206    pub params: ::core::option::Option<Params>,
207    #[prost(message, repeated, tag = "2")]
208    pub debt_list: ::prost::alloc::vec::Vec<Debt>,
209    #[prost(message, repeated, tag = "3")]
210    pub interest_list: ::prost::alloc::vec::Vec<InterestBlock>,
211}
212#[allow(clippy::derive_partial_eq_without_eq)]
213#[derive(
214    Clone,
215    PartialEq,
216    Eq,
217    ::prost::Message,
218    ::serde::Serialize,
219    ::serde::Deserialize,
220    ::schemars::JsonSchema,
221    CosmwasmExt,
222)]
223#[proto_message(type_url = "/elys.stablestake.AmmPool")]
224pub struct AmmPool {
225    #[prost(uint64, tag = "1")]
226    #[serde(alias = "ID")]
227    #[serde(
228        serialize_with = "crate::serde::as_str::serialize",
229        deserialize_with = "crate::serde::as_str::deserialize"
230    )]
231    pub id: u64,
232    #[prost(message, repeated, tag = "2")]
233    pub total_liabilities: ::prost::alloc::vec::Vec<super::super::cosmos::base::v1beta1::Coin>,
234}
235/// QueryParamsRequest is request type for the Query/Params RPC method.
236#[allow(clippy::derive_partial_eq_without_eq)]
237#[derive(
238    Clone,
239    PartialEq,
240    Eq,
241    ::prost::Message,
242    ::serde::Serialize,
243    ::serde::Deserialize,
244    ::schemars::JsonSchema,
245    CosmwasmExt,
246)]
247#[proto_message(type_url = "/elys.stablestake.QueryParamsRequest")]
248#[proto_query(
249    path = "/elys.stablestake.Query/Params",
250    response_type = QueryParamsResponse
251)]
252pub struct QueryParamsRequest {}
253/// QueryParamsResponse is response type for the Query/Params RPC method.
254#[allow(clippy::derive_partial_eq_without_eq)]
255#[derive(
256    Clone,
257    PartialEq,
258    Eq,
259    ::prost::Message,
260    ::serde::Serialize,
261    ::serde::Deserialize,
262    ::schemars::JsonSchema,
263    CosmwasmExt,
264)]
265#[proto_message(type_url = "/elys.stablestake.QueryParamsResponse")]
266pub struct QueryParamsResponse {
267    /// params holds all the parameters of this module.
268    #[prost(message, optional, tag = "1")]
269    pub params: ::core::option::Option<Params>,
270}
271#[allow(clippy::derive_partial_eq_without_eq)]
272#[derive(
273    Clone,
274    PartialEq,
275    Eq,
276    ::prost::Message,
277    ::serde::Serialize,
278    ::serde::Deserialize,
279    ::schemars::JsonSchema,
280    CosmwasmExt,
281)]
282#[proto_message(type_url = "/elys.stablestake.QueryAmmPoolRequest")]
283#[proto_query(
284    path = "/elys.stablestake.Query/AmmPool",
285    response_type = QueryAmmPoolResponse
286)]
287pub struct QueryAmmPoolRequest {
288    #[prost(uint64, tag = "1")]
289    #[serde(alias = "ID")]
290    #[serde(
291        serialize_with = "crate::serde::as_str::serialize",
292        deserialize_with = "crate::serde::as_str::deserialize"
293    )]
294    pub id: u64,
295}
296#[allow(clippy::derive_partial_eq_without_eq)]
297#[derive(
298    Clone,
299    PartialEq,
300    Eq,
301    ::prost::Message,
302    ::serde::Serialize,
303    ::serde::Deserialize,
304    ::schemars::JsonSchema,
305    CosmwasmExt,
306)]
307#[proto_message(type_url = "/elys.stablestake.QueryAmmPoolResponse")]
308pub struct QueryAmmPoolResponse {
309    #[prost(message, optional, tag = "1")]
310    pub amm_pool: ::core::option::Option<AmmPool>,
311}
312#[allow(clippy::derive_partial_eq_without_eq)]
313#[derive(
314    Clone,
315    PartialEq,
316    Eq,
317    ::prost::Message,
318    ::serde::Serialize,
319    ::serde::Deserialize,
320    ::schemars::JsonSchema,
321    CosmwasmExt,
322)]
323#[proto_message(type_url = "/elys.stablestake.QueryAllAmmPoolsRequest")]
324#[proto_query(
325    path = "/elys.stablestake.Query/AllAmmPools",
326    response_type = QueryAllAmmPoolsResponse
327)]
328pub struct QueryAllAmmPoolsRequest {}
329#[allow(clippy::derive_partial_eq_without_eq)]
330#[derive(
331    Clone,
332    PartialEq,
333    Eq,
334    ::prost::Message,
335    ::serde::Serialize,
336    ::serde::Deserialize,
337    ::schemars::JsonSchema,
338    CosmwasmExt,
339)]
340#[proto_message(type_url = "/elys.stablestake.QueryAllAmmPoolsResponse")]
341pub struct QueryAllAmmPoolsResponse {
342    #[prost(message, repeated, tag = "1")]
343    pub amm_pools: ::prost::alloc::vec::Vec<AmmPool>,
344}
345/// QueryBorrowRatioRequest is request type for the Query/BorrowRatio RPC method.
346#[allow(clippy::derive_partial_eq_without_eq)]
347#[derive(
348    Clone,
349    PartialEq,
350    Eq,
351    ::prost::Message,
352    ::serde::Serialize,
353    ::serde::Deserialize,
354    ::schemars::JsonSchema,
355    CosmwasmExt,
356)]
357#[proto_message(type_url = "/elys.stablestake.QueryBorrowRatioRequest")]
358#[proto_query(
359    path = "/elys.stablestake.Query/BorrowRatio",
360    response_type = QueryBorrowRatioResponse
361)]
362pub struct QueryBorrowRatioRequest {}
363/// QueryBorrowRatioResponse is response type for the Query/BorrowRatio RPC
364/// method.
365#[allow(clippy::derive_partial_eq_without_eq)]
366#[derive(
367    Clone,
368    PartialEq,
369    Eq,
370    ::prost::Message,
371    ::serde::Serialize,
372    ::serde::Deserialize,
373    ::schemars::JsonSchema,
374    CosmwasmExt,
375)]
376#[proto_message(type_url = "/elys.stablestake.QueryBorrowRatioResponse")]
377pub struct QueryBorrowRatioResponse {
378    #[prost(string, tag = "1")]
379    pub total_deposit: ::prost::alloc::string::String,
380    #[prost(string, tag = "2")]
381    pub total_borrow: ::prost::alloc::string::String,
382    #[prost(string, tag = "3")]
383    pub borrow_ratio: ::prost::alloc::string::String,
384}
385#[allow(clippy::derive_partial_eq_without_eq)]
386#[derive(
387    Clone,
388    PartialEq,
389    Eq,
390    ::prost::Message,
391    ::serde::Serialize,
392    ::serde::Deserialize,
393    ::schemars::JsonSchema,
394    CosmwasmExt,
395)]
396#[proto_message(type_url = "/elys.stablestake.MsgBond")]
397pub struct MsgBond {
398    #[prost(string, tag = "1")]
399    pub creator: ::prost::alloc::string::String,
400    #[prost(string, tag = "2")]
401    pub amount: ::prost::alloc::string::String,
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.stablestake.MsgBondResponse")]
415pub struct MsgBondResponse {}
416#[allow(clippy::derive_partial_eq_without_eq)]
417#[derive(
418    Clone,
419    PartialEq,
420    Eq,
421    ::prost::Message,
422    ::serde::Serialize,
423    ::serde::Deserialize,
424    ::schemars::JsonSchema,
425    CosmwasmExt,
426)]
427#[proto_message(type_url = "/elys.stablestake.MsgUnbond")]
428pub struct MsgUnbond {
429    #[prost(string, tag = "1")]
430    pub creator: ::prost::alloc::string::String,
431    #[prost(string, tag = "2")]
432    pub amount: ::prost::alloc::string::String,
433}
434#[allow(clippy::derive_partial_eq_without_eq)]
435#[derive(
436    Clone,
437    PartialEq,
438    Eq,
439    ::prost::Message,
440    ::serde::Serialize,
441    ::serde::Deserialize,
442    ::schemars::JsonSchema,
443    CosmwasmExt,
444)]
445#[proto_message(type_url = "/elys.stablestake.MsgUnbondResponse")]
446pub struct MsgUnbondResponse {}
447#[allow(clippy::derive_partial_eq_without_eq)]
448#[derive(
449    Clone,
450    PartialEq,
451    Eq,
452    ::prost::Message,
453    ::serde::Serialize,
454    ::serde::Deserialize,
455    ::schemars::JsonSchema,
456    CosmwasmExt,
457)]
458#[proto_message(type_url = "/elys.stablestake.MsgUpdateParams")]
459pub struct MsgUpdateParams {
460    /// authority is the address that controls the module (defaults to x/gov unless
461    /// overwritten).
462    #[prost(string, tag = "1")]
463    pub authority: ::prost::alloc::string::String,
464    /// NOTE: All parameters must be supplied.
465    #[prost(message, optional, tag = "2")]
466    pub params: ::core::option::Option<Params>,
467}
468#[allow(clippy::derive_partial_eq_without_eq)]
469#[derive(
470    Clone,
471    PartialEq,
472    Eq,
473    ::prost::Message,
474    ::serde::Serialize,
475    ::serde::Deserialize,
476    ::schemars::JsonSchema,
477    CosmwasmExt,
478)]
479#[proto_message(type_url = "/elys.stablestake.MsgUpdateParamsResponse")]
480pub struct MsgUpdateParamsResponse {}
481pub struct StablestakeQuerier<'a, Q: cosmwasm_std::CustomQuery> {
482    querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>,
483}
484impl<'a, Q: cosmwasm_std::CustomQuery> StablestakeQuerier<'a, Q> {
485    pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self {
486        Self { querier }
487    }
488    pub fn params(&self) -> Result<QueryParamsResponse, cosmwasm_std::StdError> {
489        QueryParamsRequest {}.query(self.querier)
490    }
491    pub fn borrow_ratio(&self) -> Result<QueryBorrowRatioResponse, cosmwasm_std::StdError> {
492        QueryBorrowRatioRequest {}.query(self.querier)
493    }
494    pub fn amm_pool(&self, id: u64) -> Result<QueryAmmPoolResponse, cosmwasm_std::StdError> {
495        QueryAmmPoolRequest { id }.query(self.querier)
496    }
497    pub fn all_amm_pools(&self) -> Result<QueryAllAmmPoolsResponse, cosmwasm_std::StdError> {
498        QueryAllAmmPoolsRequest {}.query(self.querier)
499    }
500}