Skip to content

Commit

Permalink
add adminmodule types generation
Browse files Browse the repository at this point in the history
  • Loading branch information
joldie777 committed Oct 16, 2024
1 parent cc49ece commit 0abc631
Show file tree
Hide file tree
Showing 6 changed files with 351 additions and 15 deletions.
301 changes: 301 additions & 0 deletions packages/neutron-std/src/types/cosmos/adminmodule/adminmodule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
use neutron_std_derive::CosmwasmExt;
/// GenesisState defines the adminmodule module's genesis state.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.GenesisState")]
pub struct GenesisState {
#[prost(string, repeated, tag = "1")]
pub admins: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.QueryAdminsRequest")]
#[proto_query(
path = "/cosmos.adminmodule.adminmodule.Query/Admins",
response_type = QueryAdminsResponse
)]
pub struct QueryAdminsRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.QueryAdminsResponse")]
pub struct QueryAdminsResponse {
#[prost(string, repeated, tag = "1")]
pub admins: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.QueryArchivedProposalsRequest")]
#[proto_query(
path = "/cosmos.adminmodule.adminmodule.Query/ArchivedProposals",
response_type = QueryArchivedProposalsResponse
)]
pub struct QueryArchivedProposalsRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.QueryArchivedProposalsLegacyRequest")]
#[proto_query(
path = "/cosmos.adminmodule.adminmodule.Query/ArchivedProposalsLegacy",
response_type = QueryArchivedProposalsLegacyResponse
)]
pub struct QueryArchivedProposalsLegacyRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.QueryProposalsResponse")]
pub struct QueryProposalsResponse {
#[prost(message, repeated, tag = "1")]
pub proposals: ::prost::alloc::vec::Vec<super::super::gov::v1::Proposal>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.QueryArchivedProposalsResponse")]
pub struct QueryArchivedProposalsResponse {
#[prost(message, repeated, tag = "1")]
pub proposals: ::prost::alloc::vec::Vec<super::super::gov::v1::Proposal>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.QueryArchivedProposalsLegacyResponse")]
pub struct QueryArchivedProposalsLegacyResponse {
#[prost(message, repeated, tag = "1")]
pub proposals_legacy: ::prost::alloc::vec::Vec<super::super::gov::v1beta1::Proposal>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgDeleteAdmin")]
pub struct MsgDeleteAdmin {
#[prost(string, tag = "1")]
pub creator: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub admin: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgDeleteAdminResponse")]
pub struct MsgDeleteAdminResponse {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgAddAdmin")]
pub struct MsgAddAdmin {
#[prost(string, tag = "1")]
pub creator: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub admin: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgAddAdminResponse")]
pub struct MsgAddAdminResponse {}
/// MsgSubmitProposalLegacy defines an sdk.Msg type that supports submitting arbitrary
/// proposal Content.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgSubmitProposalLegacy")]
pub struct MsgSubmitProposalLegacy {
#[prost(message, optional, tag = "1")]
pub content: ::core::option::Option<crate::shim::Any>,
#[prost(string, tag = "2")]
pub proposer: ::prost::alloc::string::String,
}
/// MsgSubmitProposalLegacyResponse defines the Msg/SubmitProposalLegacy response type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgSubmitProposalLegacyResponse")]
pub struct MsgSubmitProposalLegacyResponse {
#[prost(uint64, tag = "1")]
#[serde(alias = "proposalID")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub proposal_id: u64,
}
/// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary
/// proposal Content.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgSubmitProposal")]
pub struct MsgSubmitProposal {
/// messages are the arbitrary messages to be executed if proposal passes.
#[prost(message, repeated, tag = "1")]
pub messages: ::prost::alloc::vec::Vec<crate::shim::Any>,
#[prost(string, tag = "2")]
pub proposer: ::prost::alloc::string::String,
}
/// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.adminmodule.adminmodule.MsgSubmitProposalResponse")]
pub struct MsgSubmitProposalResponse {
#[prost(uint64, tag = "1")]
#[serde(alias = "proposalID")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub proposal_id: u64,
}
pub struct AdminmoduleQuerier<'a, Q: cosmwasm_std::CustomQuery> {
querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>,
}
impl<'a, Q: cosmwasm_std::CustomQuery> AdminmoduleQuerier<'a, Q> {
pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self {
Self { querier }
}
pub fn admins(&self) -> Result<QueryAdminsResponse, cosmwasm_std::StdError> {
QueryAdminsRequest {}.query(self.querier)
}
pub fn archived_proposals(
&self,
) -> Result<QueryArchivedProposalsResponse, cosmwasm_std::StdError> {
QueryArchivedProposalsRequest {}.query(self.querier)
}
pub fn archived_proposals_legacy(
&self,
) -> Result<QueryArchivedProposalsLegacyResponse, cosmwasm_std::StdError> {
QueryArchivedProposalsLegacyRequest {}.query(self.querier)
}
}
1 change: 1 addition & 0 deletions packages/neutron-std/src/types/cosmos/adminmodule/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod adminmodule;
1 change: 1 addition & 0 deletions packages/neutron-std/src/types/cosmos/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod adminmodule;
pub mod app;
pub mod auth;
pub mod authz;
Expand Down
18 changes: 18 additions & 0 deletions packages/neutron-std/src/types/neutron/dex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,18 @@ pub struct PoolReserves {
pub key: ::core::option::Option<PoolReservesKey>,
#[prost(string, tag = "2")]
pub reserves_maker_denom: ::prost::alloc::string::String,
/// DEPRECATED: price_taker_to_maker will be removed in future release, `maker_price` should always be used.
#[deprecated]
#[prost(string, tag = "3")]
pub price_taker_to_maker: ::prost::alloc::string::String,
/// DEPRECATED: price_opposite_taker_maker was an internal implementation detail and will be removed in a future release.
/// It is being kept strictly for backwards compatibility. The actual field value is unused.
#[deprecated]
#[prost(string, tag = "4")]
pub price_opposite_taker_to_maker: ::prost::alloc::string::String,
/// This is the price of the PoolReserves denominated in the opposite token. (ie. 1 TokenA with a maker_price of 10 is worth 10 TokenB )
#[prost(string, tag = "5")]
pub maker_price: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Expand Down Expand Up @@ -213,8 +221,13 @@ pub struct LimitOrderTranche {
/// Order deletion still functions the same and the orders will be deleted at the end of the block
#[prost(message, optional, tag = "6")]
pub expiration_time: ::core::option::Option<crate::shim::Timestamp>,
/// DEPRECATED: price_taker_to_maker will be removed in future release, `maker_price` should always be used.
#[deprecated]
#[prost(string, tag = "7")]
pub price_taker_to_maker: ::prost::alloc::string::String,
/// This is the price of the LimitOrder denominated in the opposite token. (ie. 1 TokenA with a maker_price of 10 is worth 10 TokenB )
#[prost(string, tag = "8")]
pub maker_price: ::prost::alloc::string::String,
}
/// Params defines the parameters for the module.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -454,6 +467,11 @@ pub struct MsgPlaceLimitOrder {
pub max_amount_out: ::prost::alloc::string::String,
#[prost(string, tag = "11")]
pub limit_sell_price: ::prost::alloc::string::String,
/// min_average_sell_price is an optional parameter that sets a required minimum average price for the entire trade.
/// if the min_average_sell_price is not met the trade will fail.
/// If min_average_sell_price is omitted limit_sell_price will be used instead
#[prost(string, tag = "12")]
pub min_average_sell_price: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Expand Down
31 changes: 16 additions & 15 deletions proto-build/src/code_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,22 @@ impl CodeGenerator {
// Compile proto files for each file in `protos` variable
// `buf generate —template {<buf_gen_template} <proto_file>`
for project in all_related_projects {
let buf_root = if project.name == "cosmos" || project.name == "ics23" {
self.root.join(&project.project_dir).join("proto")
} else {
WalkDir::new(&self.root.join(&project.project_dir))
.into_iter()
.filter_map(|e| e.ok())
.find(|e| {
e.file_name()
.to_str()
.map(|s| s == "buf.yaml" || s == "buf.yml")
.unwrap_or(false)
})
.map(|e| e.path().parent().unwrap().to_path_buf())
.unwrap()
};
let buf_root =
if project.name == "cosmos" || project.name == "ics23" || project.name == "admin" {
self.root.join(&project.project_dir).join("proto")
} else {
WalkDir::new(&self.root.join(&project.project_dir))
.into_iter()
.filter_map(|e| e.ok())
.find(|e| {
e.file_name()
.to_str()
.map(|s| s == "buf.yaml" || s == "buf.yml")
.unwrap_or(false)
})
.map(|e| e.path().parent().unwrap().to_path_buf())
.unwrap()
};

debug!("buf_root for project {:?}: {:?}", project.name, buf_root);

Expand Down
Loading

0 comments on commit 0abc631

Please sign in to comment.