Skip to main content

juno_std/types/capability/
v1.rs

1use juno_std_derive::CosmwasmExt;
2/// Capability defines an implementation of an object capability. The index
3/// provided to a Capability must be globally unique.
4#[allow(clippy::derive_partial_eq_without_eq)]
5#[derive(
6	Clone,
7	PartialEq,
8	Eq,
9	::prost::Message,
10	::serde::Serialize,
11	::serde::Deserialize,
12	::schemars::JsonSchema,
13	CosmwasmExt,
14)]
15#[proto_message(type_url = "/capability.v1.Capability")]
16pub struct Capability {
17	#[prost(uint64, tag = "1")]
18	#[serde(
19		serialize_with = "crate::serde::as_str::serialize",
20		deserialize_with = "crate::serde::as_str::deserialize"
21	)]
22	pub index: u64,
23}
24/// Owner defines a single capability owner. An owner is defined by the name of
25/// capability and the module name.
26#[allow(clippy::derive_partial_eq_without_eq)]
27#[derive(
28	Clone,
29	PartialEq,
30	Eq,
31	::prost::Message,
32	::serde::Serialize,
33	::serde::Deserialize,
34	::schemars::JsonSchema,
35	CosmwasmExt,
36)]
37#[proto_message(type_url = "/capability.v1.Owner")]
38pub struct Owner {
39	#[prost(string, tag = "1")]
40	pub module: ::prost::alloc::string::String,
41	#[prost(string, tag = "2")]
42	pub name: ::prost::alloc::string::String,
43}
44/// CapabilityOwners defines a set of owners of a single Capability. The set of
45/// owners must be unique.
46#[allow(clippy::derive_partial_eq_without_eq)]
47#[derive(
48	Clone,
49	PartialEq,
50	Eq,
51	::prost::Message,
52	::serde::Serialize,
53	::serde::Deserialize,
54	::schemars::JsonSchema,
55	CosmwasmExt,
56)]
57#[proto_message(type_url = "/capability.v1.CapabilityOwners")]
58pub struct CapabilityOwners {
59	#[prost(message, repeated, tag = "1")]
60	pub owners: ::prost::alloc::vec::Vec<Owner>,
61}
62/// GenesisOwners defines the capability owners with their corresponding index.
63#[allow(clippy::derive_partial_eq_without_eq)]
64#[derive(
65	Clone,
66	PartialEq,
67	Eq,
68	::prost::Message,
69	::serde::Serialize,
70	::serde::Deserialize,
71	::schemars::JsonSchema,
72	CosmwasmExt,
73)]
74#[proto_message(type_url = "/capability.v1.GenesisOwners")]
75pub struct GenesisOwners {
76	/// index is the index of the capability owner.
77	#[prost(uint64, tag = "1")]
78	#[serde(
79		serialize_with = "crate::serde::as_str::serialize",
80		deserialize_with = "crate::serde::as_str::deserialize"
81	)]
82	pub index: u64,
83	/// index_owners are the owners at the given index.
84	#[prost(message, optional, tag = "2")]
85	pub index_owners: ::core::option::Option<CapabilityOwners>,
86}
87/// GenesisState defines the capability module's genesis state.
88#[allow(clippy::derive_partial_eq_without_eq)]
89#[derive(
90	Clone,
91	PartialEq,
92	Eq,
93	::prost::Message,
94	::serde::Serialize,
95	::serde::Deserialize,
96	::schemars::JsonSchema,
97	CosmwasmExt,
98)]
99#[proto_message(type_url = "/capability.v1.GenesisState")]
100pub struct GenesisState {
101	/// index is the capability global index.
102	#[prost(uint64, tag = "1")]
103	#[serde(
104		serialize_with = "crate::serde::as_str::serialize",
105		deserialize_with = "crate::serde::as_str::deserialize"
106	)]
107	pub index: u64,
108	/// owners represents a map from index to owners of the capability index
109	/// index key is string to allow amino marshalling.
110	#[prost(message, repeated, tag = "2")]
111	pub owners: ::prost::alloc::vec::Vec<GenesisOwners>,
112}