Skip to main content

ve3_shared/helpers/
denom.rs

1use osmosis_std_derive::CosmwasmExt;
2use std::convert::{TryFrom, TryInto};
3
4// see https://github.com/notional-labs/wasmd/blob/v0.30.0-sdk469.4/proto/cosmwasm/tokenfactory/v1beta1/tx.proto
5
6/// Coin defines a token with a denomination and an amount.
7///
8/// NOTE: The amount field is an Int which implements the custom method
9/// signatures required by gogoproto.
10#[derive(
11  Clone,
12  PartialEq,
13  Eq,
14  ::prost::Message,
15  serde::Serialize,
16  serde::Deserialize,
17  schemars::JsonSchema,
18  CosmwasmExt,
19)]
20#[proto_message(type_url = "/cosmos.base.v1beta1.Coin")]
21pub struct Coin {
22  #[prost(string, tag = "1")]
23  pub denom: ::prost::alloc::string::String,
24  #[prost(string, tag = "2")]
25  pub amount: ::prost::alloc::string::String,
26}
27
28/// MsgCreateDenom defines the message structure for the CreateDenom gRPC service
29/// method. It allows an account to create a new denom. It requires a sender
30/// address and a sub denomination. The (sender_address, sub_denomination) tuple
31/// must be unique and cannot be re-used.
32///
33/// The resulting denom created is defined as
34/// <factory/{creatorAddress}/{subdenom}>. The resulting denom's admin is
35/// originally set to be the creator, but this can be changed later. The token
36/// denom does not indicate the current admin.
37#[derive(
38  Clone,
39  PartialEq,
40  Eq,
41  ::prost::Message,
42  serde::Serialize,
43  serde::Deserialize,
44  schemars::JsonSchema,
45  CosmwasmExt,
46)]
47#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgCreateDenom")]
48pub struct MsgCreateDenom {
49  #[prost(string, tag = "1")]
50  pub sender: ::prost::alloc::string::String,
51  /// subdenom can be up to 44 "alphanumeric" characters long.
52  #[prost(string, tag = "2")]
53  pub subdenom: ::prost::alloc::string::String,
54}
55
56/// MsgCreateDenomResponse is the return value of MsgCreateDenom
57/// It returns the full string of the newly created denom
58#[derive(
59  Clone,
60  PartialEq,
61  Eq,
62  ::prost::Message,
63  serde::Serialize,
64  serde::Deserialize,
65  schemars::JsonSchema,
66  CosmwasmExt,
67)]
68#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse")]
69pub struct MsgCreateDenomResponse {
70  #[prost(string, tag = "1")]
71  pub new_token_denom: ::prost::alloc::string::String,
72}
73
74/// MsgMint is the sdk.Msg type for allowing an admin account to mint
75/// more of a token.  For now, we only support minting to the sender account
76#[derive(
77  Clone,
78  PartialEq,
79  Eq,
80  ::prost::Message,
81  serde::Serialize,
82  serde::Deserialize,
83  schemars::JsonSchema,
84  CosmwasmExt,
85)]
86#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgMint")]
87pub struct MsgMint {
88  #[prost(string, tag = "1")]
89  pub sender: ::prost::alloc::string::String,
90  #[prost(message, optional, tag = "2")]
91  pub amount: ::core::option::Option<Coin>,
92  #[prost(string, tag = "3")]
93  pub mint_to_address: ::prost::alloc::string::String,
94}
95
96#[derive(
97  Clone,
98  PartialEq,
99  Eq,
100  ::prost::Message,
101  serde::Serialize,
102  serde::Deserialize,
103  schemars::JsonSchema,
104  CosmwasmExt,
105)]
106#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgMintResponse")]
107pub struct MsgMintResponse {}
108
109/// MsgBurn is the sdk.Msg type for allowing an admin account to burn
110/// a token.  For now, we only support burning from the sender account.
111#[derive(
112  Clone,
113  PartialEq,
114  Eq,
115  ::prost::Message,
116  serde::Serialize,
117  serde::Deserialize,
118  schemars::JsonSchema,
119  CosmwasmExt,
120)]
121#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgBurn")]
122pub struct MsgBurn {
123  #[prost(string, tag = "1")]
124  pub sender: ::prost::alloc::string::String,
125  #[prost(message, optional, tag = "2")]
126  pub amount: ::core::option::Option<Coin>,
127  #[prost(string, tag = "3")]
128  pub burn_from_address: ::prost::alloc::string::String,
129}
130
131#[derive(
132  Clone,
133  PartialEq,
134  Eq,
135  ::prost::Message,
136  serde::Serialize,
137  serde::Deserialize,
138  schemars::JsonSchema,
139  CosmwasmExt,
140)]
141#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgBurnResponse")]
142pub struct MsgBurnResponse {}