From aacd22a3b77c7ab27b69815e18fe69149e727368 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Wed, 28 Aug 2024 02:12:51 -0400 Subject: [PATCH 1/8] Add new SimulateXX queries --- packages/neutron-sdk/src/bindings/dex/msg.rs | 4 +- .../neutron-sdk/src/bindings/dex/query.rs | 56 +++- .../neutron-sdk/src/bindings/dex/types.rs | 122 +++++++- .../src/proto_types/NEUTRON_COMMIT | 2 +- .../src/proto_types/neutron/dex/mod.rs | 292 +++++++++++++++++- .../proto_types/neutron/interchainqueries.rs | 2 + proto-build/src/main.rs | 2 +- 7 files changed, 468 insertions(+), 12 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/dex/msg.rs b/packages/neutron-sdk/src/bindings/dex/msg.rs index c7d711e5..d1e06baa 100644 --- a/packages/neutron-sdk/src/bindings/dex/msg.rs +++ b/packages/neutron-sdk/src/bindings/dex/msg.rs @@ -3,7 +3,7 @@ use cosmwasm_std::Uint128; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use super::types::{DepositOption, MultiHopRoute, PrecDec}; +use super::types::{DepositOptions, MultiHopRoute, PrecDec}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] @@ -26,7 +26,7 @@ pub enum DexMsg { /// Fees to use for each deposit fees: Vec, /// Additional deposit options - options: Vec, + options: Vec, }, /// Withdraw is used to redeem PoolShares for the user’s pro-rata /// portion of tokens within a liquidity pool. Users can withdraw from a pool at any time diff --git a/packages/neutron-sdk/src/bindings/dex/query.rs b/packages/neutron-sdk/src/bindings/dex/query.rs index 0f39f74b..5b50f752 100644 --- a/packages/neutron-sdk/src/bindings/dex/query.rs +++ b/packages/neutron-sdk/src/bindings/dex/query.rs @@ -1,6 +1,10 @@ use crate::bindings::dex::types::{ - DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, MultiHopRoute, Params, - Pool, PoolMetadata, PoolReserves, PrecDec, TickLiquidity, + DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, MsgCancelLimitOrder, + MsgCancelLimitOrderResponse, MsgDeposit, MsgDepositResponse, MsgMultiHopSwap, + MsgMultiHopSwapResponse, MsgPlaceLimitOrder, MsgPlaceLimitOrderResponse, + MsgWithdrawFilledLimitOrder, MsgWithdrawFilledLimitOrderResponse, MsgWithdrawal, + MsgWithdrawalResponse, MultiHopRoute, Params, Pool, PoolMetadata, PoolReserves, PrecDec, + TickLiquidity, }; use crate::bindings::query::{PageRequest, PageResponse}; use cosmwasm_std::{Coin, Int128}; @@ -106,6 +110,18 @@ pub enum DexQuery { PoolMetadata { id: u64 }, /// Queries a list of PoolMetadata items. PoolMetadataAll { pagination: Option }, + /// Simulates MsgDeposit + SimulateDeposit { msg: MsgDeposit }, + /// Simulates MsgWithdrawal + SimulateWithdrawal { msg: MsgWithdrawal }, + /// Simulates MsgPlaceLimitOrder + SimulatePlaceLimitOrder { msg: MsgPlaceLimitOrder }, + /// Simulates MsgWithdrawFilledLimitOrder + SimulateWithdrawFilledLimitOrder { msg: MsgWithdrawFilledLimitOrder }, + /// Simulates MsgCancelLimitOrder + SimulateCancelLimitOrder { msg: MsgCancelLimitOrder }, + /// Simulates MsgMultiHopSwap + SimulateMultiHopSwap { msg: MsgMultiHopSwap }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] @@ -229,3 +245,39 @@ pub struct AllPoolMetadataResponse { pub pool_metadata: Vec, pub pagination: Option, } + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct SimulateDepositResponse { + resp: MsgDepositResponse, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct SimulateWithdrawalResponse { + resp: MsgWithdrawalResponse, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct SimulatePlaceLimitOrderResponse { + resp: MsgPlaceLimitOrderResponse, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct SimulateWithdrawFilledLimitOrderResponse { + resp: MsgWithdrawFilledLimitOrderResponse, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct SimulateCancelLimitOrderResponse { + resp: MsgCancelLimitOrderResponse, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct SimulateMultiHopSwapResponse { + resp: MsgMultiHopSwapResponse, +} diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs index 95204533..56684042 100644 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ b/packages/neutron-sdk/src/bindings/dex/types.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::Int128; +use cosmwasm_std::{Coin, Int128, Uint128}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -78,6 +78,13 @@ pub struct TradePairID { pub taker_denom: String, } +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] +#[serde(rename_all = "snake_case")] +pub struct FailedDeposit { + pub deposit_idx: u64, + pub error: String, +} + // TODO implement math for PrecDec #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] @@ -102,8 +109,9 @@ impl From for PrecDec { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -pub struct DepositOption { - pub disable_swap: bool, +pub struct DepositOptions { + pub disable_autoswap: bool, + pub fail_tx_on_bel: bool, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] @@ -189,3 +197,111 @@ pub struct PoolReservesKey { pub tick_index_taker_to_maker: i64, pub fee: Option, } + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgDeposit { + pub token_a: String, + pub token_b: String, + pub amounts_a: Vec, + pub amounts_b: Vec, + pub tick_indexes_a_to_b: Vec, + pub fees: Vec, + pub options: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgDepositResponse { + pub reserve0_deposited: Vec, + pub reserve1_deposited: Vec, + pub failed_deposits: Vec, + pub shares_issued: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgWithdrawal { + pub creator: String, + pub receiver: String, + pub token_a: String, + pub token_b: String, + pub shares_to_remove: Vec, + pub tick_indexes_a_to_b: Vec, + pub fees: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgWithdrawalResponse { + pub reserve0_withdrawn: Uint128, + pub reserve1_withdrawn: Uint128, + pub shares_burned: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgPlaceLimitOrder { + pub token_in: String, + pub token_out: String, + pub tick_index_in_to_out: i64, + pub amount_in: Uint128, + pub order_type: LimitOrderType, + pub expiration_time: Option, + pub max_amount_out: Option, + pub limit_sell_price: PrecDec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgPlaceLimitOrderResponse { + pub tranche_key: String, + pub coin_in: Coin, + pub taker_coin_out: Coin, + pub taker_coin_in: Coin, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgWithdrawFilledLimitOrder { + pub creator: String, + pub tranche_key: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgWithdrawFilledLimitOrderResponse { + pub taker_coin_out: Coin, + pub maker_coin_out: Coin, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgCancelLimitOrder { + pub creator: String, + pub tranche_key: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgCancelLimitOrderResponse { + pub taker_coin_out: Coin, + pub maker_coin_out: Coin, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgMultiHopSwap { + pub routes: Vec, + pub amount_in: Uint128, + pub exit_limit_price: PrecDec, + pub pick_best_route: bool, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct MsgMultiHopSwapResponse { + pub coin_out: Coin, + pub route: MultiHopRoute, + pub dust: Vec, +} diff --git a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT index 5469c48c..940ccb39 100644 --- a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT +++ b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT @@ -1 +1 @@ -v4.1.0 \ No newline at end of file +f0fe2f9adfd5ff6c092d50c6a30adb4efab8a590 \ No newline at end of file diff --git a/packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs index ad490437..007b04f2 100644 --- a/packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs +++ b/packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs @@ -351,6 +351,8 @@ pub struct MsgDepositResponse { pub reserve1_deposited: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(message, repeated, tag = "3")] pub failed_deposits: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "4")] + pub shares_issued: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive( @@ -400,7 +402,14 @@ pub struct MsgWithdrawal { CosmwasmExt, )] #[proto_message(type_url = "/neutron.dex.MsgWithdrawalResponse")] -pub struct MsgWithdrawalResponse {} +pub struct MsgWithdrawalResponse { + #[prost(string, tag = "1")] + pub reserve0_withdrawn: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub reserve1_withdrawn: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub shares_burned: ::prost::alloc::vec::Vec, +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -470,6 +479,9 @@ pub struct MsgPlaceLimitOrderResponse { /// maker portion which will have withdrawn in the future #[prost(message, optional, tag = "3")] pub taker_coin_out: ::core::option::Option, + /// Total amount of the token in that was immediately swapped for takerOutCoin + #[prost(message, optional, tag = "4")] + pub taker_coin_in: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive( @@ -501,7 +513,14 @@ pub struct MsgWithdrawFilledLimitOrder { CosmwasmExt, )] #[proto_message(type_url = "/neutron.dex.MsgWithdrawFilledLimitOrderResponse")] -pub struct MsgWithdrawFilledLimitOrderResponse {} +pub struct MsgWithdrawFilledLimitOrderResponse { + /// Total amount of taker reserves that were withdrawn + #[prost(message, optional, tag = "1")] + pub taker_coin_out: ::core::option::Option, + /// Total amount of maker reserves that were withdrawn --only applies to inactive LimitOrders + #[prost(message, optional, tag = "2")] + pub maker_coin_out: ::core::option::Option, +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -532,7 +551,14 @@ pub struct MsgCancelLimitOrder { CosmwasmExt, )] #[proto_message(type_url = "/neutron.dex.MsgCancelLimitOrderResponse")] -pub struct MsgCancelLimitOrderResponse {} +pub struct MsgCancelLimitOrderResponse { + /// Total amount of taker reserves that were withdrawn + #[prost(message, optional, tag = "1")] + pub taker_coin_out: ::core::option::Option, + /// Total amount of maker reserves that were canceled + #[prost(message, optional, tag = "2")] + pub maker_coin_out: ::core::option::Option, +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -592,6 +618,10 @@ pub struct MsgMultiHopSwap { pub struct MsgMultiHopSwapResponse { #[prost(message, optional, tag = "1")] pub coin_out: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub route: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub dust: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive( @@ -1363,6 +1393,7 @@ pub struct QueryGetPoolReservesResponse { response_type = QueryEstimateMultiHopSwapResponse )] pub struct QueryEstimateMultiHopSwapRequest { + /// DEPRECATED: Use QuerySimulateMultiHopSwap #[prost(string, tag = "1")] pub creator: ::prost::alloc::string::String, #[prost(string, tag = "2")] @@ -1411,6 +1442,7 @@ pub struct QueryEstimateMultiHopSwapResponse { response_type = QueryEstimatePlaceLimitOrderResponse )] pub struct QueryEstimatePlaceLimitOrderRequest { + /// DEPRECATED: Use QuerySimulatePlaceLimitOrder #[prost(string, tag = "1")] pub creator: ::prost::alloc::string::String, #[prost(string, tag = "2")] @@ -1615,6 +1647,222 @@ pub struct QueryAllPoolMetadataResponse { pub pagination: ::core::option::Option, } +#[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.dex.QuerySimulateDepositRequest")] +#[proto_query( + path = "/neutron.dex.Query/SimulateDeposit", + response_type = QuerySimulateDepositResponse +)] +pub struct QuerySimulateDepositRequest { + #[prost(message, optional, tag = "1")] + pub msg: ::core::option::Option, +} +#[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.dex.QuerySimulateDepositResponse")] +pub struct QuerySimulateDepositResponse { + #[prost(message, optional, tag = "1")] + pub resp: ::core::option::Option, +} +#[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.dex.QuerySimulateWithdrawalRequest")] +#[proto_query( + path = "/neutron.dex.Query/SimulateWithdrawal", + response_type = QuerySimulateWithdrawalResponse +)] +pub struct QuerySimulateWithdrawalRequest { + #[prost(message, optional, tag = "1")] + pub msg: ::core::option::Option, +} +#[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.dex.QuerySimulateWithdrawalResponse")] +pub struct QuerySimulateWithdrawalResponse { + #[prost(message, optional, tag = "1")] + pub resp: ::core::option::Option, +} +#[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.dex.QuerySimulatePlaceLimitOrderRequest")] +#[proto_query( + path = "/neutron.dex.Query/SimulatePlaceLimitOrder", + response_type = QuerySimulatePlaceLimitOrderResponse +)] +pub struct QuerySimulatePlaceLimitOrderRequest { + #[prost(message, optional, tag = "1")] + pub msg: ::core::option::Option, +} +#[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.dex.QuerySimulatePlaceLimitOrderResponse")] +pub struct QuerySimulatePlaceLimitOrderResponse { + #[prost(message, optional, tag = "1")] + pub resp: ::core::option::Option, +} +#[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.dex.QuerySimulateWithdrawFilledLimitOrderRequest")] +#[proto_query( + path = "/neutron.dex.Query/SimulateWithdrawFilledLimitOrder", + response_type = QuerySimulateWithdrawFilledLimitOrderResponse +)] +pub struct QuerySimulateWithdrawFilledLimitOrderRequest { + #[prost(message, optional, tag = "1")] + pub msg: ::core::option::Option, +} +#[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.dex.QuerySimulateWithdrawFilledLimitOrderResponse")] +pub struct QuerySimulateWithdrawFilledLimitOrderResponse { + #[prost(message, optional, tag = "1")] + pub resp: ::core::option::Option, +} +#[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.dex.QuerySimulateCancelLimitOrderRequest")] +#[proto_query( + path = "/neutron.dex.Query/SimulateCancelLimitOrder", + response_type = QuerySimulateCancelLimitOrderResponse +)] +pub struct QuerySimulateCancelLimitOrderRequest { + #[prost(message, optional, tag = "1")] + pub msg: ::core::option::Option, +} +#[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.dex.QuerySimulateCancelLimitOrderResponse")] +pub struct QuerySimulateCancelLimitOrderResponse { + #[prost(message, optional, tag = "1")] + pub resp: ::core::option::Option, +} +#[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.dex.QuerySimulateMultiHopSwapRequest")] +#[proto_query( + path = "/neutron.dex.Query/SimulateMultiHopSwap", + response_type = QuerySimulateMultiHopSwapResponse +)] +pub struct QuerySimulateMultiHopSwapRequest { + #[prost(message, optional, tag = "1")] + pub msg: ::core::option::Option, +} +#[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.dex.QuerySimulateMultiHopSwapResponse")] +pub struct QuerySimulateMultiHopSwapResponse { + #[prost(message, optional, tag = "1")] + pub resp: ::core::option::Option, +} pub struct DexQuerier<'a, Q: cosmwasm_std::CustomQuery> { querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, } @@ -1758,6 +2006,7 @@ impl<'a, Q: cosmwasm_std::CustomQuery> DexQuerier<'a, Q> { } .query(self.querier) } + #[deprecated] pub fn estimate_multi_hop_swap( &self, creator: ::prost::alloc::string::String, @@ -1777,6 +2026,7 @@ impl<'a, Q: cosmwasm_std::CustomQuery> DexQuerier<'a, Q> { } .query(self.querier) } + #[deprecated] #[allow(clippy::too_many_arguments)] pub fn estimate_place_limit_order( &self, @@ -1831,4 +2081,40 @@ impl<'a, Q: cosmwasm_std::CustomQuery> DexQuerier<'a, Q> { ) -> Result { QueryAllPoolMetadataRequest { pagination }.query(self.querier) } + pub fn simulate_deposit( + &self, + msg: ::core::option::Option, + ) -> Result { + QuerySimulateDepositRequest { msg }.query(self.querier) + } + pub fn simulate_withdrawal( + &self, + msg: ::core::option::Option, + ) -> Result { + QuerySimulateWithdrawalRequest { msg }.query(self.querier) + } + pub fn simulate_place_limit_order( + &self, + msg: ::core::option::Option, + ) -> Result { + QuerySimulatePlaceLimitOrderRequest { msg }.query(self.querier) + } + pub fn simulate_withdraw_filled_limit_order( + &self, + msg: ::core::option::Option, + ) -> Result { + QuerySimulateWithdrawFilledLimitOrderRequest { msg }.query(self.querier) + } + pub fn simulate_cancel_limit_order( + &self, + msg: ::core::option::Option, + ) -> Result { + QuerySimulateCancelLimitOrderRequest { msg }.query(self.querier) + } + pub fn simulate_multi_hop_swap( + &self, + msg: ::core::option::Option, + ) -> Result { + QuerySimulateMultiHopSwapRequest { msg }.query(self.querier) + } } diff --git a/packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs b/packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs index 218970d1..75abbb1b 100644 --- a/packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs +++ b/packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs @@ -234,6 +234,8 @@ pub struct MsgSubmitQueryResult { pub sender: ::prost::alloc::string::String, /// is the IBC client ID for an IBC connection between Neutron chain and target /// chain (where the result was obtained from) + /// Deprecated: populating this field does not make any affect + #[deprecated] #[prost(string, tag = "3")] #[serde(alias = "clientID")] pub client_id: ::prost::alloc::string::String, diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs index 52f00d8c..c6d110c5 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 = "v4.1.0"; +const NEUTRON_REV: &str = "f0fe2f9adfd5ff6c092d50c6a30adb4efab8a590"; /// The wasmd commit or tag to be cloned and used to build the proto files const WASMD_REV: &str = "v0.51.0"; From f17d7f802538daa392f8a0fa87fc82e68edead05 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Fri, 30 Aug 2024 20:14:14 -0400 Subject: [PATCH 2/8] make some fields optional -DepositOptions -FailedDeposit --- packages/neutron-sdk/src/bindings/dex/types.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs index 56684042..3fe5034d 100644 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ b/packages/neutron-sdk/src/bindings/dex/types.rs @@ -81,8 +81,8 @@ pub struct TradePairID { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] #[serde(rename_all = "snake_case")] pub struct FailedDeposit { - pub deposit_idx: u64, - pub error: String, + pub deposit_idx: Option, + pub error: Option, } // TODO implement math for PrecDec @@ -110,8 +110,8 @@ impl From for PrecDec { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct DepositOptions { - pub disable_autoswap: bool, - pub fail_tx_on_bel: bool, + pub disable_autoswap: Option, + pub fail_tx_on_bel: Option, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] From 13efe0a1112dece2d7b241b1c81b4823d26b14b8 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Fri, 30 Aug 2024 20:57:02 -0400 Subject: [PATCH 3/8] more optional fields on responses --- packages/neutron-sdk/src/bindings/dex/types.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs index 3fe5034d..2b19a390 100644 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ b/packages/neutron-sdk/src/bindings/dex/types.rs @@ -215,7 +215,7 @@ pub struct MsgDeposit { pub struct MsgDepositResponse { pub reserve0_deposited: Vec, pub reserve1_deposited: Vec, - pub failed_deposits: Vec, + pub failed_deposits: Option>, pub shares_issued: Vec, } @@ -257,8 +257,8 @@ pub struct MsgPlaceLimitOrder { pub struct MsgPlaceLimitOrderResponse { pub tranche_key: String, pub coin_in: Coin, - pub taker_coin_out: Coin, - pub taker_coin_in: Coin, + pub taker_coin_out: Option, + pub taker_coin_in: Option, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] @@ -271,8 +271,8 @@ pub struct MsgWithdrawFilledLimitOrder { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct MsgWithdrawFilledLimitOrderResponse { - pub taker_coin_out: Coin, - pub maker_coin_out: Coin, + pub taker_coin_out: Option, + pub maker_coin_out: Option, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] @@ -285,8 +285,8 @@ pub struct MsgCancelLimitOrder { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct MsgCancelLimitOrderResponse { - pub taker_coin_out: Coin, - pub maker_coin_out: Coin, + pub taker_coin_out: Option, + pub maker_coin_out: Option, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] @@ -303,5 +303,5 @@ pub struct MsgMultiHopSwap { pub struct MsgMultiHopSwapResponse { pub coin_out: Coin, pub route: MultiHopRoute, - pub dust: Vec, + pub dust: Option>, } From fc90769f86a4d13a5af043092ac3928cefbb3b5c Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Fri, 30 Aug 2024 22:09:38 -0400 Subject: [PATCH 4/8] more optional fields --- packages/neutron-sdk/src/bindings/dex/types.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs index 2b19a390..965f9f85 100644 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ b/packages/neutron-sdk/src/bindings/dex/types.rs @@ -234,8 +234,8 @@ pub struct MsgWithdrawal { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct MsgWithdrawalResponse { - pub reserve0_withdrawn: Uint128, - pub reserve1_withdrawn: Uint128, + pub reserve0_withdrawn: Option, + pub reserve1_withdrawn: Option, pub shares_burned: Vec, } From a4e23feabb57b57369b4820cc0e28333a240b550 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Mon, 2 Sep 2024 18:23:21 -0400 Subject: [PATCH 5/8] make trancheKey optional on PlaceLimitOrderResp --- packages/neutron-sdk/src/bindings/dex/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs index 965f9f85..c41cba40 100644 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ b/packages/neutron-sdk/src/bindings/dex/types.rs @@ -255,7 +255,7 @@ pub struct MsgPlaceLimitOrder { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct MsgPlaceLimitOrderResponse { - pub tranche_key: String, + pub tranche_key: Option, pub coin_in: Coin, pub taker_coin_out: Option, pub taker_coin_in: Option, From 90e60affb79802726c274081c99ed17656f80715 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Wed, 4 Sep 2024 16:38:29 -0400 Subject: [PATCH 6/8] remove simulate bindings --- .../neutron-sdk/src/bindings/dex/query.rs | 56 +-------- .../neutron-sdk/src/bindings/dex/types.rs | 110 +----------------- 2 files changed, 5 insertions(+), 161 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/dex/query.rs b/packages/neutron-sdk/src/bindings/dex/query.rs index 5b50f752..f7caf7e6 100644 --- a/packages/neutron-sdk/src/bindings/dex/query.rs +++ b/packages/neutron-sdk/src/bindings/dex/query.rs @@ -1,8 +1,8 @@ use crate::bindings::dex::types::{ - DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, MsgCancelLimitOrder, - MsgCancelLimitOrderResponse, MsgDeposit, MsgDepositResponse, MsgMultiHopSwap, - MsgMultiHopSwapResponse, MsgPlaceLimitOrder, MsgPlaceLimitOrderResponse, - MsgWithdrawFilledLimitOrder, MsgWithdrawFilledLimitOrderResponse, MsgWithdrawal, + DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, + MsgCancelLimitOrderResponse, MsgDepositResponse, + MsgMultiHopSwapResponse, MsgPlaceLimitOrderResponse, + MsgWithdrawFilledLimitOrderResponse, MsgWithdrawalResponse, MultiHopRoute, Params, Pool, PoolMetadata, PoolReserves, PrecDec, TickLiquidity, }; @@ -110,18 +110,6 @@ pub enum DexQuery { PoolMetadata { id: u64 }, /// Queries a list of PoolMetadata items. PoolMetadataAll { pagination: Option }, - /// Simulates MsgDeposit - SimulateDeposit { msg: MsgDeposit }, - /// Simulates MsgWithdrawal - SimulateWithdrawal { msg: MsgWithdrawal }, - /// Simulates MsgPlaceLimitOrder - SimulatePlaceLimitOrder { msg: MsgPlaceLimitOrder }, - /// Simulates MsgWithdrawFilledLimitOrder - SimulateWithdrawFilledLimitOrder { msg: MsgWithdrawFilledLimitOrder }, - /// Simulates MsgCancelLimitOrder - SimulateCancelLimitOrder { msg: MsgCancelLimitOrder }, - /// Simulates MsgMultiHopSwap - SimulateMultiHopSwap { msg: MsgMultiHopSwap }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] @@ -245,39 +233,3 @@ pub struct AllPoolMetadataResponse { pub pool_metadata: Vec, pub pagination: Option, } - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct SimulateDepositResponse { - resp: MsgDepositResponse, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct SimulateWithdrawalResponse { - resp: MsgWithdrawalResponse, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct SimulatePlaceLimitOrderResponse { - resp: MsgPlaceLimitOrderResponse, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct SimulateWithdrawFilledLimitOrderResponse { - resp: MsgWithdrawFilledLimitOrderResponse, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct SimulateCancelLimitOrderResponse { - resp: MsgCancelLimitOrderResponse, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct SimulateMultiHopSwapResponse { - resp: MsgMultiHopSwapResponse, -} diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs index c41cba40..7c2786f2 100644 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ b/packages/neutron-sdk/src/bindings/dex/types.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{Coin, Int128, Uint128}; +use cosmwasm_std::{Int128}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -197,111 +197,3 @@ pub struct PoolReservesKey { pub tick_index_taker_to_maker: i64, pub fee: Option, } - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgDeposit { - pub token_a: String, - pub token_b: String, - pub amounts_a: Vec, - pub amounts_b: Vec, - pub tick_indexes_a_to_b: Vec, - pub fees: Vec, - pub options: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgDepositResponse { - pub reserve0_deposited: Vec, - pub reserve1_deposited: Vec, - pub failed_deposits: Option>, - pub shares_issued: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgWithdrawal { - pub creator: String, - pub receiver: String, - pub token_a: String, - pub token_b: String, - pub shares_to_remove: Vec, - pub tick_indexes_a_to_b: Vec, - pub fees: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgWithdrawalResponse { - pub reserve0_withdrawn: Option, - pub reserve1_withdrawn: Option, - pub shares_burned: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgPlaceLimitOrder { - pub token_in: String, - pub token_out: String, - pub tick_index_in_to_out: i64, - pub amount_in: Uint128, - pub order_type: LimitOrderType, - pub expiration_time: Option, - pub max_amount_out: Option, - pub limit_sell_price: PrecDec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgPlaceLimitOrderResponse { - pub tranche_key: Option, - pub coin_in: Coin, - pub taker_coin_out: Option, - pub taker_coin_in: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgWithdrawFilledLimitOrder { - pub creator: String, - pub tranche_key: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgWithdrawFilledLimitOrderResponse { - pub taker_coin_out: Option, - pub maker_coin_out: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgCancelLimitOrder { - pub creator: String, - pub tranche_key: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgCancelLimitOrderResponse { - pub taker_coin_out: Option, - pub maker_coin_out: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgMultiHopSwap { - pub routes: Vec, - pub amount_in: Uint128, - pub exit_limit_price: PrecDec, - pub pick_best_route: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgMultiHopSwapResponse { - pub coin_out: Coin, - pub route: MultiHopRoute, - pub dust: Option>, -} From b46325e33b003c33ca4ab45349b81d534a6ad37f Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Wed, 4 Sep 2024 16:44:27 -0400 Subject: [PATCH 7/8] remove dex bindings --- .../schema/execute_msg.json | 17 ++++++++ packages/neutron-sdk/schema/neutron_msg.json | 40 +++++++++++++++---- .../neutron-sdk/src/bindings/dex/query.rs | 8 +--- .../neutron-sdk/src/bindings/dex/types.rs | 2 +- 4 files changed, 52 insertions(+), 15 deletions(-) diff --git a/contracts/neutron_interchain_txs/schema/execute_msg.json b/contracts/neutron_interchain_txs/schema/execute_msg.json index 6e64e370..62b9e3f1 100644 --- a/contracts/neutron_interchain_txs/schema/execute_msg.json +++ b/contracts/neutron_interchain_txs/schema/execute_msg.json @@ -22,6 +22,16 @@ "interchain_account_id": { "type": "string" }, + "ordering": { + "anyOf": [ + { + "$ref": "#/definitions/ChannelOrdering" + }, + { + "type": "null" + } + ] + }, "register_fee": { "type": "array", "items": { @@ -122,6 +132,13 @@ } ], "definitions": { + "ChannelOrdering": { + "type": "string", + "enum": [ + "ORDER_ORDERED", + "ORDER_UNORDERED" + ] + }, "Coin": { "type": "object", "required": [ diff --git a/packages/neutron-sdk/schema/neutron_msg.json b/packages/neutron-sdk/schema/neutron_msg.json index 73a09990..d43ee446 100644 --- a/packages/neutron-sdk/schema/neutron_msg.json +++ b/packages/neutron-sdk/schema/neutron_msg.json @@ -25,6 +25,17 @@ "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" }, + "ordering": { + "description": "**ordering** is an order of channel. Can be ordered or unordered. Set to ordered if not specified.", + "anyOf": [ + { + "$ref": "#/definitions/ChannelOrdering" + }, + { + "type": "null" + } + ] + }, "register_fee": { "description": "*register_fee** is a fees required to be payed to register interchain account", "type": [ @@ -160,7 +171,7 @@ ], "properties": { "new_keys": { - "description": "*new_keys** is the new query keys to retrive.", + "description": "*new_keys** is the new query keys to retrieve.", "type": [ "array", "null" @@ -810,6 +821,13 @@ }, "additionalProperties": false }, + "ChannelOrdering": { + "type": "string", + "enum": [ + "ORDER_ORDERED", + "ORDER_UNORDERED" + ] + }, "ClearAdminProposal": { "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", "deprecated": true, @@ -907,14 +925,20 @@ }, "additionalProperties": false }, - "DepositOption": { + "DepositOptions": { "type": "object", - "required": [ - "disable_swap" - ], "properties": { - "disable_swap": { - "type": "boolean" + "disable_autoswap": { + "type": [ + "boolean", + "null" + ] + }, + "fail_tx_on_bel": { + "type": [ + "boolean", + "null" + ] } }, "additionalProperties": false @@ -968,7 +992,7 @@ "description": "Additional deposit options", "type": "array", "items": { - "$ref": "#/definitions/DepositOption" + "$ref": "#/definitions/DepositOptions" } }, "receiver": { diff --git a/packages/neutron-sdk/src/bindings/dex/query.rs b/packages/neutron-sdk/src/bindings/dex/query.rs index f7caf7e6..0f39f74b 100644 --- a/packages/neutron-sdk/src/bindings/dex/query.rs +++ b/packages/neutron-sdk/src/bindings/dex/query.rs @@ -1,10 +1,6 @@ use crate::bindings::dex::types::{ - DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, - MsgCancelLimitOrderResponse, MsgDepositResponse, - MsgMultiHopSwapResponse, MsgPlaceLimitOrderResponse, - MsgWithdrawFilledLimitOrderResponse, - MsgWithdrawalResponse, MultiHopRoute, Params, Pool, PoolMetadata, PoolReserves, PrecDec, - TickLiquidity, + DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, MultiHopRoute, Params, + Pool, PoolMetadata, PoolReserves, PrecDec, TickLiquidity, }; use crate::bindings::query::{PageRequest, PageResponse}; use cosmwasm_std::{Coin, Int128}; diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs index 7c2786f2..58c4742b 100644 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ b/packages/neutron-sdk/src/bindings/dex/types.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{Int128}; +use cosmwasm_std::Int128; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; From 6d9b56e2708b5fe2dca63073c66f7eb9acd14641 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Thu, 19 Sep 2024 17:55:06 -0400 Subject: [PATCH 8/8] update protos --- .../src/proto_types/NEUTRON_COMMIT | 2 +- .../neutron/contractmanager/mod.rs | 55 +++++-- .../neutron/{cron.rs => cron/mod.rs} | 155 ++++++++++++++++-- .../src/proto_types/neutron/cron/v1.rs | 79 +++++++++ proto-build/src/main.rs | 2 +- 5 files changed, 269 insertions(+), 24 deletions(-) rename packages/neutron-sdk/src/proto_types/neutron/{cron.rs => cron/mod.rs} (60%) create mode 100644 packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs diff --git a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT index 6fb93118..a5b899e1 100644 --- a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT +++ b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT @@ -1 +1 @@ -d557574271951b6e0fd3c7467e0a2981e068b826 \ No newline at end of file +6bef62c6d9182b51fd5facc41088689c809b96d5 \ No newline at end of file diff --git a/packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs index f882ee5e..19185a55 100644 --- a/packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs +++ b/packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs @@ -132,10 +132,34 @@ pub struct QueryParamsResponse { )] #[proto_message(type_url = "/neutron.contractmanager.QueryFailuresRequest")] #[proto_query( - path = "/neutron.contractmanager.Query/AddressFailure", + path = "/neutron.contractmanager.Query/AddressFailures", response_type = QueryFailuresResponse )] pub struct QueryFailuresRequest { + /// address of the contract which Sudo call failed. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub pagination: ::core::option::Option, +} +/// QueryFailureRequest is request type for the Query/Failures RPC method. +#[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.contractmanager.QueryFailureRequest")] +#[proto_query( + path = "/neutron.contractmanager.Query/AddressFailure", + response_type = QueryFailureResponse +)] +pub struct QueryFailureRequest { /// address of the contract which Sudo call failed. #[prost(string, tag = "1")] pub address: ::prost::alloc::string::String, @@ -147,8 +171,23 @@ pub struct QueryFailuresRequest { deserialize_with = "crate::serde::as_str::deserialize" )] pub failure_id: u64, - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, +} +/// QueryFailureResponse is response type for the Query/Failure RPC method. +#[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.contractmanager.QueryFailureResponse")] +pub struct QueryFailureResponse { + #[prost(message, optional, tag = "1")] + pub failure: ::core::option::Option, } /// QueryFailuresResponse is response type for the Query/Failures RPC method. #[allow(clippy::derive_partial_eq_without_eq)] @@ -226,24 +265,20 @@ impl<'a, Q: cosmwasm_std::CustomQuery> ContractmanagerQuerier<'a, Q> { &self, address: ::prost::alloc::string::String, failure_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryFailuresRequest { + ) -> Result { + QueryFailureRequest { address, failure_id, - pagination, } .query(self.querier) } pub fn address_failures( &self, address: ::prost::alloc::string::String, - failure_id: u64, pagination: ::core::option::Option, ) -> Result { QueryFailuresRequest { address, - failure_id, pagination, } .query(self.querier) @@ -251,12 +286,10 @@ impl<'a, Q: cosmwasm_std::CustomQuery> ContractmanagerQuerier<'a, Q> { pub fn failures( &self, address: ::prost::alloc::string::String, - failure_id: u64, pagination: ::core::option::Option, ) -> Result { QueryFailuresRequest { address, - failure_id, pagination, } .query(self.querier) 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 60% rename from packages/neutron-sdk/src/proto_types/neutron/cron.rs rename to packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs index 8afa0a3f..f22c6ab9 100644 --- a/packages/neutron-sdk/src/proto_types/neutron/cron.rs +++ b/packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs @@ -1,5 +1,6 @@ +pub mod v1; use neutron_std_derive::CosmwasmExt; -/// Params defines the parameters for the module. +/// Defines the parameters for the module. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -24,6 +25,7 @@ pub struct Params { )] pub limit: u64, } +/// Defines the schedule for execution #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -47,7 +49,7 @@ pub struct Schedule { deserialize_with = "crate::serde::as_str::deserialize" )] pub period: u64, - /// Msgs that will be executed every period amount of time + /// Msgs that will be executed every certain number of blocks, specified in the `period` field #[prost(message, repeated, tag = "3")] pub msgs: ::prost::alloc::vec::Vec, /// Last execution's block height @@ -57,7 +59,15 @@ pub struct Schedule { deserialize_with = "crate::serde::as_str::deserialize" )] pub last_execute_height: u64, + /// 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 execution_stage: i32, } +/// Defines the contract and the message to pass #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -71,13 +81,14 @@ pub struct Schedule { )] #[proto_message(type_url = "/neutron.cron.MsgExecuteContract")] pub struct MsgExecuteContract { - /// Contract is the address of the smart contract + /// 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 + /// JSON encoded message to be passed to the contract #[prost(string, tag = "2")] pub msg: ::prost::alloc::string::String, } +/// Defines the number of current schedules #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -91,7 +102,7 @@ pub struct MsgExecuteContract { )] #[proto_message(type_url = "/neutron.cron.ScheduleCount")] pub struct ScheduleCount { - /// Count is the number of current schedules + /// The number of current schedules #[prost(int32, tag = "1")] #[serde( serialize_with = "crate::serde::as_str::serialize", @@ -99,7 +110,37 @@ pub struct ScheduleCount { )] pub count: i32, } -/// GenesisState defines the cron module's genesis state. +/// 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 ExecutionStage { + /// Execution at the end of the block + EndBlocker = 0, + /// Execution at the beginning of the block + BeginBlocker = 1, +} +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 { + ExecutionStage::EndBlocker => "EXECUTION_STAGE_END_BLOCKER", + ExecutionStage::BeginBlocker => "EXECUTION_STAGE_BEGIN_BLOCKER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "EXECUTION_STAGE_END_BLOCKER" => Some(Self::EndBlocker), + "EXECUTION_STAGE_BEGIN_BLOCKER" => Some(Self::BeginBlocker), + _ => None, + } + } +} +/// Defines the cron module's genesis state. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -119,6 +160,7 @@ pub struct GenesisState { #[prost(message, optional, tag = "1")] pub params: ::core::option::Option, } +/// The request type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -133,6 +175,7 @@ pub struct GenesisState { #[proto_message(type_url = "/neutron.cron.QueryParamsRequest")] #[proto_query(path = "/neutron.cron.Query/Params", response_type = QueryParamsResponse)] pub struct QueryParamsRequest {} +/// The response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -150,6 +193,7 @@ pub struct QueryParamsResponse { #[prost(message, optional, tag = "1")] pub params: ::core::option::Option, } +/// The request type for the Query/Schedule RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -170,6 +214,7 @@ pub struct QueryGetScheduleRequest { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, } +/// The response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -186,6 +231,7 @@ pub struct QueryGetScheduleResponse { #[prost(message, optional, tag = "1")] pub schedule: ::core::option::Option, } +/// The request type for the Query/Schedules RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -206,6 +252,7 @@ pub struct QuerySchedulesRequest { #[prost(message, optional, tag = "1")] pub pagination: ::core::option::Option, } +/// The response type for the Query/Params RPC method. #[allow(clippy::derive_partial_eq_without_eq)] #[derive( Clone, @@ -225,7 +272,94 @@ pub struct QuerySchedulesResponse { pub pagination: ::core::option::Option, } -/// MsgUpdateParams is the MsgUpdateParams request type. +/// 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 { + /// The address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Name of the schedule + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + /// Period in blocks + #[prost(uint64, tag = "3")] + #[serde( + serialize_with = "crate::serde::as_str::serialize", + deserialize_with = "crate::serde::as_str::deserialize" + )] + pub period: u64, + /// Msgs that will be executed every certain number of blocks, specified in the `period` field + #[prost(message, repeated, tag = "4")] + pub msgs: ::prost::alloc::vec::Vec, + /// 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 execution_stage: i32, +} +/// 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 {} +/// 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 { + /// The address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// Name of the schedule + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +/// 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 {} +/// The MsgUpdateParams request type. /// /// Since: 0.47 #[allow(clippy::derive_partial_eq_without_eq)] @@ -241,17 +375,16 @@ pub struct QuerySchedulesResponse { )] #[proto_message(type_url = "/neutron.cron.MsgUpdateParams")] pub struct MsgUpdateParams { - /// Authority is the address of the governance account. + /// The address of the governance account. #[prost(string, tag = "1")] pub authority: ::prost::alloc::string::String, - /// params defines the x/cron parameters to update. + /// Defines the x/cron parameters to update. /// /// NOTE: All parameters must be supplied. #[prost(message, optional, tag = "2")] pub params: ::core::option::Option, } -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. +/// Defines the response structure for executing a MsgUpdateParams message. /// /// Since: 0.47 #[allow(clippy::derive_partial_eq_without_eq)] 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..6776522a --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs @@ -0,0 +1,79 @@ +use neutron_std_derive::CosmwasmExt; +/// Defines the schedule for execution +#[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 certain number of blocks, specified in the `period` field + #[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, +} +/// Defines the contract and the message to pass +#[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 { + /// The address of the smart contract + #[prost(string, tag = "1")] + pub contract: ::prost::alloc::string::String, + /// JSON encoded message to be passed to the contract + #[prost(string, tag = "2")] + pub msg: ::prost::alloc::string::String, +} +/// Defines the number of current schedules +#[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 { + /// 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 0bf0c9fe..1308432c 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 = "d557574271951b6e0fd3c7467e0a2981e068b826"; +const NEUTRON_REV: &str = "6bef62c6d9182b51fd5facc41088689c809b96d5"; /// The wasmd commit or tag to be cloned and used to build the proto files const WASMD_REV: &str = "v0.51.0";