diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index e859d84c..7085787d 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -1,6 +1,7 @@ use crate::{ bindings::types::{KVKey, ProtobufAny}, interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem, MAX_TX_FILTERS}, + proto_types::neutron::cron::ExecutionStage, sudo::msg::RequestPacketTimeoutHeight, NeutronError, NeutronResult, }; @@ -217,8 +218,8 @@ pub enum NeutronMsg { period: u64, /// list of cosmwasm messages to be executed msgs: Vec, - /// blocker where schedule should be executed - blocker: u64, + /// execution stage where schedule will be executed + execution_stage: String, }, /// RemoveSchedule removes the schedule with a given `name`. @@ -511,18 +512,18 @@ impl NeutronMsg { /// * **name** is a name of the schedule; /// * **period** is a period of schedule execution in blocks; /// * **msgs** is the messages that will be executed. - /// * **blocker** is a blocker where schedule will be executed. + /// * **execution_stage** is a stage where schedule will be executed. pub fn submit_add_schedule( name: String, period: u64, msgs: Vec, - blocker: u64, + execution_stage: ExecutionStage, ) -> Self { NeutronMsg::AddSchedule { name, period, msgs, - blocker, + execution_stage: execution_stage.as_str_name().to_string(), } } diff --git a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT index ad742879..6b2dc5da 100644 --- a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT +++ b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT @@ -1 +1 @@ -ef1d7992fbdd6a927a2c7c4b4eebe2dfe2cdd27a \ No newline at end of file +fd5e5e5bd6d061f19a566e71aaaeaabe59406069 \ No newline at end of file diff --git a/packages/neutron-sdk/src/proto_types/neutron/cron.rs b/packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs similarity index 74% rename from packages/neutron-sdk/src/proto_types/neutron/cron.rs rename to packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs index 2b12121a..d8463b70 100644 --- a/packages/neutron-sdk/src/proto_types/neutron/cron.rs +++ b/packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs @@ -1,3 +1,4 @@ +pub mod v1; use neutron_std_derive::CosmwasmExt; /// Params defines the parameters for the module. #[allow(clippy::derive_partial_eq_without_eq)] @@ -57,13 +58,13 @@ pub struct Schedule { deserialize_with = "crate::serde::as_str::deserialize" )] pub last_execute_height: u64, - /// Blocker where the messages will be executed - #[prost(enumeration = "BlockerType", tag = "5")] + /// Execution stage when messages will be executed + #[prost(enumeration = "ExecutionStage", tag = "5")] #[serde( serialize_with = "crate::serde::as_str::serialize", deserialize_with = "crate::serde::as_str::deserialize" )] - pub blocker: i32, + pub execution_stage: i32, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive( @@ -106,33 +107,33 @@ pub struct ScheduleCount { )] pub count: i32, } -/// BlockerType defines when messages will be executed in the block +/// ExecutionStage defines when messages will be executed in the block #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum BlockerType { - Begin = 0, - End = 1, - Both = 2, +pub enum ExecutionStage { + BeginBlocker = 0, + EndBlocker = 1, + BothBlockers = 2, } -impl BlockerType { +impl ExecutionStage { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - BlockerType::Begin => "BEGIN", - BlockerType::End => "END", - BlockerType::Both => "BOTH", + ExecutionStage::BeginBlocker => "BEGIN_BLOCKER", + ExecutionStage::EndBlocker => "END_BLOCKER", + ExecutionStage::BothBlockers => "BOTH_BLOCKERS", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { - "BEGIN" => Some(Self::Begin), - "END" => Some(Self::End), - "BOTH" => Some(Self::Both), + "BEGIN_BLOCKER" => Some(Self::BeginBlocker), + "END_BLOCKER" => Some(Self::EndBlocker), + "BOTH_BLOCKERS" => Some(Self::BothBlockers), _ => None, } } @@ -263,6 +264,90 @@ pub struct QuerySchedulesResponse { pub pagination: ::core::option::Option, } +/// MsgAddSchedule is the MsgAddSchedule request 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 = "/neutron.cron.MsgAddSchedule")] +pub struct MsgAddSchedule { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + #[prost(uint64, tag = "3")] + #[serde( + serialize_with = "crate::serde::as_str::serialize", + deserialize_with = "crate::serde::as_str::deserialize" + )] + pub period: u64, + #[prost(message, repeated, tag = "4")] + pub msgs: ::prost::alloc::vec::Vec, + #[prost(enumeration = "ExecutionStage", tag = "5")] + #[serde( + serialize_with = "crate::serde::as_str::serialize", + deserialize_with = "crate::serde::as_str::deserialize" + )] + pub execution_stage: i32, +} +/// MsgAddScheduleResponse defines the response structure for executing a +/// MsgAddSchedule message. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive( + Clone, + PartialEq, + Eq, + ::prost::Message, + ::serde::Serialize, + ::serde::Deserialize, + ::schemars::JsonSchema, + CosmwasmExt, +)] +#[proto_message(type_url = "/neutron.cron.MsgAddScheduleResponse")] +pub struct MsgAddScheduleResponse {} +/// MsgRemoveSchedule is the MsgRemoveSchedule request 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 = "/neutron.cron.MsgRemoveSchedule")] +pub struct MsgRemoveSchedule { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +/// MsgRemoveScheduleResponse defines the response structure for executing a +/// MsgRemoveSchedule message. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive( + Clone, + PartialEq, + Eq, + ::prost::Message, + ::serde::Serialize, + ::serde::Deserialize, + ::schemars::JsonSchema, + CosmwasmExt, +)] +#[proto_message(type_url = "/neutron.cron.MsgRemoveScheduleResponse")] +pub struct MsgRemoveScheduleResponse {} /// MsgUpdateParams is the MsgUpdateParams request type. /// /// Since: 0.47 diff --git a/packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs b/packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs new file mode 100644 index 00000000..9b0cd757 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs @@ -0,0 +1,76 @@ +use neutron_std_derive::CosmwasmExt; +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive( + Clone, + PartialEq, + Eq, + ::prost::Message, + ::serde::Serialize, + ::serde::Deserialize, + ::schemars::JsonSchema, + CosmwasmExt, +)] +#[proto_message(type_url = "/neutron.cron.v1.Schedule")] +pub struct Schedule { + /// Name of schedule + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// Period in blocks + #[prost(uint64, tag = "2")] + #[serde( + serialize_with = "crate::serde::as_str::serialize", + deserialize_with = "crate::serde::as_str::deserialize" + )] + pub period: u64, + /// Msgs that will be executed every period amount of time + #[prost(message, repeated, tag = "3")] + pub msgs: ::prost::alloc::vec::Vec, + /// Last execution's block height + #[prost(uint64, tag = "4")] + #[serde( + serialize_with = "crate::serde::as_str::serialize", + deserialize_with = "crate::serde::as_str::deserialize" + )] + pub last_execute_height: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive( + Clone, + PartialEq, + Eq, + ::prost::Message, + ::serde::Serialize, + ::serde::Deserialize, + ::schemars::JsonSchema, + CosmwasmExt, +)] +#[proto_message(type_url = "/neutron.cron.v1.MsgExecuteContract")] +pub struct MsgExecuteContract { + /// Contract is the address of the smart contract + #[prost(string, tag = "1")] + pub contract: ::prost::alloc::string::String, + /// Msg is json encoded message to be passed to the contract + #[prost(string, tag = "2")] + pub msg: ::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 = "/neutron.cron.v1.ScheduleCount")] +pub struct ScheduleCount { + /// Count is the number of current schedules + #[prost(int32, tag = "1")] + #[serde( + serialize_with = "crate::serde::as_str::serialize", + deserialize_with = "crate::serde::as_str::deserialize" + )] + pub count: i32, +} diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs index 1632ee24..47d86d82 100644 --- a/proto-build/src/main.rs +++ b/proto-build/src/main.rs @@ -23,7 +23,7 @@ const SLINKY_REPO: &str = "https://github.com/skip-mev/slinky.git"; const COSMOS_SDK_REV: &str = "v0.50.8-neutron"; /// The Neutron commit or tag to be cloned and used to build the proto files -const NEUTRON_REV: &str = "ef1d7992fbdd6a927a2c7c4b4eebe2dfe2cdd27a"; +const NEUTRON_REV: &str = "fd5e5e5bd6d061f19a566e71aaaeaabe59406069"; /// The wasmd commit or tag to be cloned and used to build the proto files const WASMD_REV: &str = "v0.51.0";