From 1d58f5527f356cbadec0423c7420a925368de978 Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Fri, 19 Jul 2024 17:01:17 +0300 Subject: [PATCH] rewrite dex_stargate to use new helpers --- Cargo.lock | 19 +- Cargo.toml | 2 +- .../dex_stargate/schema/execute_msg.json | 64 +++- contracts/dex_stargate/schema/query_msg.json | 81 +++-- contracts/dex_stargate/src/contract.rs | 285 +++++++----------- contracts/dex_stargate/src/msg.rs | 17 +- contracts/reflect/schema/execute_msg.json | 54 ++++ contracts/reflect/schema/query_msg.json | 212 +++++++++++++ 8 files changed, 499 insertions(+), 235 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 416ce3c..e3aadb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -822,18 +822,21 @@ dependencies = [ [[package]] name = "neutron-sdk" -version = "0.10.0" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=main#039d33c22590bf481a9a716c0842c2930829fffd" +version = "0.11.0" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/remove-stargate#7187b4bae4888c7fb1b57da4b16f364cc3bfea92" dependencies = [ "bech32", + "chrono", "cosmos-sdk-proto 0.20.0", "cosmwasm-schema 2.0.4", "cosmwasm-std 2.0.4", + "neutron-std-derive", "prost 0.12.6", "prost-types 0.12.6", "protobuf", "schemars", "serde", + "serde-cw-value", "serde-json-wasm 1.0.1", "serde_json", "speedate", @@ -841,6 +844,18 @@ dependencies = [ "thiserror", ] +[[package]] +name = "neutron-std-derive" +version = "0.20.1" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/remove-stargate#7187b4bae4888c7fb1b57da4b16f364cc3bfea92" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "prost-types 0.12.6", + "quote", + "syn 1.0.109", +] + [[package]] name = "neutron_interchain_queries" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index b9be99c..b9ca2d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ incremental = false overflow-checks = true [workspace.dependencies] -neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" } +neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/remove-stargate" } prost = "0.12.4" prost-types = "0.12.4" cosmos-sdk-proto = { version = "0.20.0", default-features = false } diff --git a/contracts/dex_stargate/schema/execute_msg.json b/contracts/dex_stargate/schema/execute_msg.json index 4fb2dd9..de4796b 100644 --- a/contracts/dex_stargate/schema/execute_msg.json +++ b/contracts/dex_stargate/schema/execute_msg.json @@ -131,6 +131,7 @@ "required": [ "amount_in", "limit_sell_price", + "max_amount_out", "order_type", "receiver", "tick_index_in_to_out", @@ -142,20 +143,20 @@ "type": "string" }, "expiration_time": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] }, "limit_sell_price": { "type": "string" }, "max_amount_out": { - "type": [ - "string", - "null" - ] + "type": "string" }, "order_type": { "type": "integer", @@ -250,10 +251,7 @@ "routes": { "type": "array", "items": { - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/definitions/MultiHopRoute" } } } @@ -266,12 +264,48 @@ "DepositOptions": { "type": "object", "required": [ - "disable_autoswap" + "disable_autoswap", + "fail_tx_on_bel" ], "properties": { "disable_autoswap": { - "description": "Autoswap provides a mechanism for users to deposit the entirety of their specified deposit amounts by paying a small fee. By default the `autoswap` option is enabled.", "type": "boolean" + }, + "fail_tx_on_bel": { + "type": "boolean" + } + } + }, + "MultiHopRoute": { + "type": "object", + "required": [ + "hops" + ], + "properties": { + "hops": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Timestamp": { + "type": "object", + "required": [ + "nanos", + "seconds" + ], + "properties": { + "nanos": { + "description": "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive.", + "type": "integer", + "format": "int32" + }, + "seconds": { + "description": "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", + "type": "integer", + "format": "int64" } } } diff --git a/contracts/dex_stargate/schema/query_msg.json b/contracts/dex_stargate/schema/query_msg.json index 80e2940..32b92a8 100644 --- a/contracts/dex_stargate/schema/query_msg.json +++ b/contracts/dex_stargate/schema/query_msg.json @@ -392,10 +392,7 @@ "routes": { "type": "array", "items": { - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/definitions/MultiHopRoute" } } } @@ -414,6 +411,7 @@ "required": [ "amount_in", "creator", + "max_amount_out", "order_type", "receiver", "tick_index_in_to_out", @@ -428,17 +426,17 @@ "type": "string" }, "expiration_time": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "anyOf": [ + { + "$ref": "#/definitions/Timestamp" + }, + { + "type": "null" + } + ] }, "max_amount_out": { - "type": [ - "string", - "null" - ] + "type": "string" }, "order_type": { "type": "integer", @@ -563,11 +561,22 @@ } ], "definitions": { - "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", - "type": "string" + "MultiHopRoute": { + "type": "object", + "required": [ + "hops" + ], + "properties": { + "hops": { + "type": "array", + "items": { + "type": "string" + } + } + } }, "PageRequest": { + "description": "PageRequest is to be embedded in gRPC request messages for efficient pagination. Ex:\n\nmessage SomeRequest { Foo some_parameter = 1; PageRequest pagination = 2; }", "type": "object", "required": [ "count_total", @@ -578,34 +587,54 @@ ], "properties": { "count_total": { - "description": "**count_total** is set to true to indicate that the result set should include a count of the total number of items available for pagination in UIs. count_total is only respected when offset is used. It is ignored when key is set.", + "description": "count_total is set to true to indicate that the result set should include a count of the total number of items available for pagination in UIs. count_total is only respected when offset is used. It is ignored when key is set.", "type": "boolean" }, "key": { - "description": "**key** is a value returned in PageResponse.next_key to begin querying the next page most efficiently. Only one of offset or key should be set.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] + "description": "key is a value returned in PageResponse.next_key to begin querying the next page most efficiently. Only one of offset or key should be set.", + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } }, "limit": { - "description": "**limit** is the total number of results to be returned in the result page. If left empty it will default to a value to be set by each app.", + "description": "limit is the total number of results to be returned in the result page. If left empty it will default to a value to be set by each app.", "type": "integer", "format": "uint64", "minimum": 0.0 }, "offset": { - "description": "**offset** is a numeric offset that can be used when key is unavailable. It is less efficient than using key. Only one of offset or key should be set.", + "description": "offset is a numeric offset that can be used when key is unavailable. It is less efficient than using key. Only one of offset or key should be set.", "type": "integer", "format": "uint64", "minimum": 0.0 }, "reverse": { - "description": "reverse is set to true if results are to be returned in the descending order.", + "description": "reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43", "type": "boolean" } } + }, + "Timestamp": { + "type": "object", + "required": [ + "nanos", + "seconds" + ], + "properties": { + "nanos": { + "description": "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive.", + "type": "integer", + "format": "int32" + }, + "seconds": { + "description": "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", + "type": "integer", + "format": "int64" + } + } } } } diff --git a/contracts/dex_stargate/src/contract.rs b/contracts/dex_stargate/src/contract.rs index 7a8e314..04abda6 100644 --- a/contracts/dex_stargate/src/contract.rs +++ b/contracts/dex_stargate/src/contract.rs @@ -1,35 +1,13 @@ use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use cosmwasm_std::{ - entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, - StdResult, + entry_point, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, + StdError, StdResult, }; use cw2::set_contract_version; -use neutron_sdk::{ - bindings::msg::NeutronMsg, - stargate::dex::msg::{ - msg_cancel_limit_order, msg_deposit, msg_multi_hop_swap, msg_place_limit_order, - msg_withdraw_filled_limit_order, msg_withdrawal, - }, - stargate::dex::query::{ - get_estimate_multi_hop_swap, get_estimate_place_limit_order, - get_inactive_limit_order_tranche, get_inactive_limit_order_tranche_all, - get_limit_order_tranche, get_limit_order_tranche_all, get_limit_order_tranche_user, - get_limit_order_tranche_user_all, get_limit_order_tranche_user_all_by_address, get_params, - get_pool, get_pool_by_id, get_pool_metadata, get_pool_metadata_all, get_pool_reserves, - get_pool_reserves_all, get_tick_liquidity_all, get_user_deposits_all, - }, - stargate::dex::types::{ - AllInactiveLimitOrderTrancheRequest, AllLimitOrderTrancheRequest, AllPoolMetadataRequest, - AllPoolReservesRequest, AllTickLiquidityRequest, AllUserDepositsRequest, - AllUserLimitOrdersRequest, CancelLimitOrderRequest, DepositRequest, - EstimateMultiHopSwapRequest, EstimatePlaceLimitOrderRequest, - GetInactiveLimitOrderTrancheRequest, GetLimitOrderTrancheRequest, GetPoolMetadataRequest, - GetPoolReservesRequest, LimitOrderTrancheUserAllRequest, LimitOrderTrancheUserRequest, - LimitOrderType, MultiHopSwapRequest, ParamsRequest, PlaceLimitOrderRequest, - PoolByIdRequest, PoolRequest, WithdrawFilledLimitOrderRequest, WithdrawalRequest, - }, - sudo::msg::SudoMsg, -}; +use neutron_sdk::{bindings::msg::NeutronMsg, sudo::msg::SudoMsg}; +use std::convert::TryInto; + +use neutron_sdk::proto_types::neutron::dex; const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME")); const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -52,7 +30,7 @@ pub fn execute( env: Env, _info: MessageInfo, msg: ExecuteMsg, -) -> StdResult> { +) -> StdResult { deps.api .debug(format!("WASMDEBUG: execute: received msg: {:?}", msg).as_str()); match msg { @@ -65,17 +43,19 @@ pub fn execute( tick_indexes_a_to_b, fees, options, - } => Ok(Response::new().add_message(msg_deposit(DepositRequest { - sender: env.contract.address.to_string(), - receiver, - token_a, - token_b, - amounts_a, - amounts_b, - tick_indexes_a_to_b, - fees, - options, - }))), + } => Ok( + Response::new().add_message(Into::::into(dex::MsgDeposit { + creator: env.contract.address.to_string(), + receiver, + token_a, + token_b, + amounts_a, + amounts_b, + tick_indexes_a_to_b, + fees, + options, + })), + ), ExecuteMsg::Withdrawal { receiver, @@ -85,8 +65,8 @@ pub fn execute( tick_indexes_a_to_b, fees, } => Ok( - Response::new().add_message(msg_withdrawal(WithdrawalRequest { - sender: env.contract.address.to_string(), + Response::new().add_message(Into::::into(dex::MsgWithdrawal { + creator: env.contract.address.to_string(), receiver, token_a, token_b, @@ -95,7 +75,7 @@ pub fn execute( fees, })), ), - + #[allow(deprecated)] ExecuteMsg::PlaceLimitOrder { receiver, token_in, @@ -107,33 +87,34 @@ pub fn execute( expiration_time, max_amount_out, } => Ok( - Response::new().add_message(msg_place_limit_order(PlaceLimitOrderRequest { - sender: env.contract.address.to_string(), + Response::new().add_message(Into::::into(dex::MsgPlaceLimitOrder { + creator: env.contract.address.to_string(), receiver, token_in, token_out, tick_index_in_to_out, limit_sell_price, amount_in, - order_type: LimitOrderType::try_from(order_type).map_err(StdError::generic_err)?, + order_type, expiration_time, max_amount_out, })), ), - ExecuteMsg::WithdrawFilledLimitOrder { tranche_key } => Ok(Response::new().add_message( - msg_withdraw_filled_limit_order(WithdrawFilledLimitOrderRequest { - sender: env.contract.address.to_string(), + Into::::into(dex::MsgWithdrawFilledLimitOrder { + creator: env.contract.address.to_string(), tranche_key, }), )), - ExecuteMsg::CancelLimitOrder { tranche_key } => Ok(Response::new().add_message( - msg_cancel_limit_order(CancelLimitOrderRequest { - sender: env.contract.address.to_string(), - tranche_key, - }), - )), + ExecuteMsg::CancelLimitOrder { tranche_key } => { + Ok( + Response::new().add_message(Into::::into(dex::MsgCancelLimitOrder { + creator: env.contract.address.to_string(), + tranche_key, + })), + ) + } ExecuteMsg::MultiHopSwap { receiver, @@ -142,8 +123,8 @@ pub fn execute( exit_limit_price, pick_best_route, } => Ok( - Response::new().add_message(msg_multi_hop_swap(MultiHopSwapRequest { - sender: env.contract.address.to_string(), + Response::new().add_message(Into::::into(dex::MsgMultiHopSwap { + creator: env.contract.address.to_string(), receiver, routes, amount_in, @@ -158,40 +139,31 @@ pub fn execute( pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { deps.api .debug(format!("WASMDEBUG: query: received msg: {:?}", msg).as_str()); + + let dexQuerier = dex::DexQuerier::new(&deps.querier); + match msg { - QueryMsg::Params {} => Ok(to_json_binary(&get_params(deps, ParamsRequest {})?)?), + QueryMsg::Params {} => Ok(to_json_binary(&dexQuerier.params()?)?), QueryMsg::GetLimitOrderTrancheUser { address, tranche_key, calc_withdrawable_shares, - } => Ok(to_json_binary(&get_limit_order_tranche_user( - deps, - LimitOrderTrancheUserRequest { - address, - tranche_key, - calc_withdrawable_shares, - }, + } => Ok(to_json_binary(&dexQuerier.limit_order_tranche_user( + address, + tranche_key, + calc_withdrawable_shares, )?)?), - QueryMsg::AllLimitOrderTrancheUser { pagination } => { - Ok(to_json_binary(&get_limit_order_tranche_user_all( - deps, - LimitOrderTrancheUserAllRequest { pagination }, - )?)?) - } + QueryMsg::AllLimitOrderTrancheUser { pagination } => Ok(to_json_binary( + &dexQuerier.limit_order_tranche_user_all(pagination)?, + )?), QueryMsg::AllLimitOrderTrancheUserByAddress { address, pagination, } => Ok(to_json_binary( - &get_limit_order_tranche_user_all_by_address( - deps, - AllUserLimitOrdersRequest { - address, - pagination, - }, - )?, + &dexQuerier.limit_order_tranche_user_all_by_address(address, pagination)?, )?), QueryMsg::GetLimitOrderTranche { @@ -199,104 +171,71 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { tick_index, token_in, tranche_key, - } => Ok(to_json_binary(&get_limit_order_tranche( - deps, - GetLimitOrderTrancheRequest { - pair_id, - tick_index, - token_in, - tranche_key, - }, + } => Ok(to_json_binary(&dexQuerier.limit_order_tranche( + pair_id, + tick_index, + token_in, + tranche_key, )?)?), QueryMsg::AllLimitOrderTranche { pair_id, token_in, pagination, - } => Ok(to_json_binary(&get_limit_order_tranche_all( - deps, - AllLimitOrderTrancheRequest { - pair_id, - token_in, - pagination, - }, - )?)?), + } => Ok(to_json_binary( + &dexQuerier.limit_order_tranche_all(pair_id, token_in, pagination)?, + )?), QueryMsg::AllUserDeposits { address, include_pool_data, pagination, - } => Ok(to_json_binary(&get_user_deposits_all( - deps, - AllUserDepositsRequest { - address, - include_pool_data, - pagination, - }, + } => Ok(to_json_binary(&dexQuerier.user_deposits_all( + address, + pagination, + include_pool_data, )?)?), QueryMsg::AllTickLiquidity { pair_id, token_in, pagination, - } => Ok(to_json_binary(&get_tick_liquidity_all( - deps, - AllTickLiquidityRequest { - pair_id, - token_in, - pagination, - }, - )?)?), + } => Ok(to_json_binary( + &dexQuerier.tick_liquidity_all(pair_id, token_in, pagination)?, + )?), QueryMsg::GetInactiveLimitOrderTranche { pair_id, token_in, tick_index, tranche_key, - } => Ok(to_json_binary(&get_inactive_limit_order_tranche( - deps, - GetInactiveLimitOrderTrancheRequest { - pair_id, - token_in, - tick_index, - tranche_key, - }, + } => Ok(to_json_binary(&dexQuerier.inactive_limit_order_tranche( + pair_id, + token_in, + tick_index, + tranche_key, )?)?), - QueryMsg::AllInactiveLimitOrderTranche { pagination } => { - Ok(to_json_binary(&get_inactive_limit_order_tranche_all( - deps, - AllInactiveLimitOrderTrancheRequest { pagination }, - )?)?) - } + QueryMsg::AllInactiveLimitOrderTranche { pagination } => Ok(to_json_binary( + &dexQuerier.inactive_limit_order_tranche_all(pagination)?, + )?), QueryMsg::AllPoolReserves { pair_id, token_in, pagination, - } => Ok(to_json_binary(&get_pool_reserves_all( - deps, - AllPoolReservesRequest { - pair_id, - token_in, - pagination, - }, - )?)?), + } => Ok(to_json_binary( + &dexQuerier.pool_reserves_all(pair_id, token_in, pagination)?, + )?), QueryMsg::GetPoolReserves { pair_id, token_in, tick_index, fee, - } => Ok(to_json_binary(&get_pool_reserves( - deps, - GetPoolReservesRequest { - pair_id, - token_in, - tick_index, - fee, - }, - )?)?), + } => Ok(to_json_binary( + &dexQuerier.pool_reserves(pair_id, token_in, tick_index, fee)?, + )?), QueryMsg::EstimateMultiHopSwap { creator, @@ -305,16 +244,13 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { amount_in, exit_limit_price, pick_best_route, - } => Ok(to_json_binary(&get_estimate_multi_hop_swap( - deps, - EstimateMultiHopSwapRequest { - creator, - receiver, - routes, - amount_in, - exit_limit_price, - pick_best_route, - }, + } => Ok(to_json_binary(&dexQuerier.estimate_multi_hop_swap( + creator, + receiver, + routes, + amount_in, + exit_limit_price, + pick_best_route, )?)?), QueryMsg::EstimatePlaceLimitOrder { @@ -327,48 +263,31 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { order_type, expiration_time, max_amount_out, - } => Ok(to_json_binary(&get_estimate_place_limit_order( - deps, - EstimatePlaceLimitOrderRequest { - creator, - receiver, - token_in, - token_out, - tick_index_in_to_out, - amount_in, - order_type: LimitOrderType::try_from(order_type).map_err(StdError::generic_err)?, - expiration_time, - max_amount_out, - }, + } => Ok(to_json_binary(&dexQuerier.estimate_place_limit_order( + creator, + receiver, + token_in, + token_out, + tick_index_in_to_out, + amount_in, + order_type, + expiration_time, + max_amount_out, )?)?), QueryMsg::Pool { pair_id, tick_index, fee, - } => Ok(to_json_binary(&get_pool( - deps, - PoolRequest { - pair_id, - tick_index, - fee, - }, - )?)?), + } => Ok(to_json_binary(&dexQuerier.pool(pair_id, tick_index, fee)?)?), - QueryMsg::PoolById { pool_id } => Ok(to_json_binary(&get_pool_by_id( - deps, - PoolByIdRequest { pool_id }, - )?)?), + QueryMsg::PoolById { pool_id } => Ok(to_json_binary(&dexQuerier.pool_by_id(pool_id)?)?), - QueryMsg::GetPoolMetadata { id } => Ok(to_json_binary(&get_pool_metadata( - deps, - GetPoolMetadataRequest { id }, - )?)?), + QueryMsg::GetPoolMetadata { id } => Ok(to_json_binary(&dexQuerier.pool_metadata(id)?)?), - QueryMsg::AllPoolMetadata { pagination } => Ok(to_json_binary(&get_pool_metadata_all( - deps, - AllPoolMetadataRequest { pagination }, - )?)?), + QueryMsg::AllPoolMetadata { pagination } => { + Ok(to_json_binary(&dexQuerier.pool_metadata_all(pagination)?)?) + } } } diff --git a/contracts/dex_stargate/src/msg.rs b/contracts/dex_stargate/src/msg.rs index b6c06fc..1b8abc8 100644 --- a/contracts/dex_stargate/src/msg.rs +++ b/contracts/dex_stargate/src/msg.rs @@ -1,5 +1,6 @@ -use neutron_sdk::bindings::query::PageRequest; -use neutron_sdk::stargate::dex::types::DepositOptions; +use neutron_sdk::proto_types::neutron::dex::{DepositOptions, MultiHopRoute}; +use neutron_sdk::proto_types::{cosmos::base::query::v1beta1::PageRequest, neutron::dex}; +use neutron_sdk::shim::Timestamp; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -34,8 +35,8 @@ pub enum ExecuteMsg { tick_index_in_to_out: i64, amount_in: String, order_type: i32, - expiration_time: Option, - max_amount_out: Option, + expiration_time: Option, + max_amount_out: String, limit_sell_price: String, }, WithdrawFilledLimitOrder { @@ -46,7 +47,7 @@ pub enum ExecuteMsg { }, MultiHopSwap { receiver: String, - routes: Vec>, + routes: Vec, amount_in: String, exit_limit_price: String, pick_best_route: bool, @@ -113,7 +114,7 @@ pub enum QueryMsg { EstimateMultiHopSwap { creator: String, receiver: String, - routes: Vec>, + routes: Vec, amount_in: String, exit_limit_price: String, pick_best_route: bool, @@ -126,8 +127,8 @@ pub enum QueryMsg { tick_index_in_to_out: i64, amount_in: String, order_type: i32, - expiration_time: Option, - max_amount_out: Option, + expiration_time: Option, + max_amount_out: String, }, Pool { pair_id: String, diff --git a/contracts/reflect/schema/execute_msg.json b/contracts/reflect/schema/execute_msg.json index 70d05fb..11859e1 100644 --- a/contracts/reflect/schema/execute_msg.json +++ b/contracts/reflect/schema/execute_msg.json @@ -208,6 +208,22 @@ } ] }, + "AnyMsg": { + "description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + } + }, "BankMsg": { "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", "oneOf": [ @@ -432,6 +448,19 @@ }, "additionalProperties": false }, + { + "description": "`CosmosMsg::Any` is the replaces the \"stargate message\" – a message wrapped in a [protobuf Any](https://protobuf.dev/programming-guides/proto3/#any) that is suppored by the chain. It behaves the same as `CosmosMsg::Stargate` but has a better name and slightly improved syntax.\n\nThis is feature-gated at compile time with `cosmwasm_2_0` because a chain running CosmWasm < 2.0 cannot process this.", + "type": "object", + "required": [ + "any" + ], + "properties": { + "any": { + "$ref": "#/definitions/AnyMsg" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -872,6 +901,31 @@ } }, "additionalProperties": false + }, + { + "description": "This is translated to a [[MsgFundCommunityPool](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#LL69C1-L76C2). `depositor` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "fund_community_pool" + ], + "properties": { + "fund_community_pool": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "description": "The amount to spend", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + } + } + }, + "additionalProperties": false } ] }, diff --git a/contracts/reflect/schema/query_msg.json b/contracts/reflect/schema/query_msg.json index 75f442e..76128e6 100644 --- a/contracts/reflect/schema/query_msg.json +++ b/contracts/reflect/schema/query_msg.json @@ -84,6 +84,52 @@ } }, "additionalProperties": false + }, + { + "description": "This calls into the native bank module for querying metadata for a specific bank token. Return value is DenomMetadataResponse", + "type": "object", + "required": [ + "denom_metadata" + ], + "properties": { + "denom_metadata": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This calls into the native bank module for querying metadata for all bank tokens that have a metadata entry. Return value is AllDenomMetadataResponse", + "type": "object", + "required": [ + "all_denom_metadata" + ], + "properties": { + "all_denom_metadata": { + "type": "object", + "properties": { + "pagination": { + "anyOf": [ + { + "$ref": "#/definitions/PageRequest" + }, + { + "type": "null" + } + ] + } + } + } + }, + "additionalProperties": false } ] }, @@ -91,6 +137,120 @@ "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, + "DistributionQuery": { + "oneOf": [ + { + "description": "See ", + "type": "object", + "required": [ + "delegator_withdraw_address" + ], + "properties": { + "delegator_withdraw_address": { + "type": "object", + "required": [ + "delegator_address" + ], + "properties": { + "delegator_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "See ", + "type": "object", + "required": [ + "delegation_rewards" + ], + "properties": { + "delegation_rewards": { + "type": "object", + "required": [ + "delegator_address", + "validator_address" + ], + "properties": { + "delegator_address": { + "type": "string" + }, + "validator_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "See ", + "type": "object", + "required": [ + "delegation_total_rewards" + ], + "properties": { + "delegation_total_rewards": { + "type": "object", + "required": [ + "delegator_address" + ], + "properties": { + "delegator_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "See ", + "type": "object", + "required": [ + "delegator_validators" + ], + "properties": { + "delegator_validators": { + "type": "object", + "required": [ + "delegator_address" + ], + "properties": { + "delegator_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "GrpcQuery": { + "description": "Queries the chain using a grpc query. This allows to query information that is not exposed in our API. The chain needs to allowlist the supported queries. The drawback of this query is that you have to handle the protobuf encoding and decoding yourself.\n\nThe returned data is protobuf encoded. The protobuf type depends on the query.\n\nTo find the path, as well as the request and response types, you can query the chain's gRPC endpoint using a tool like [grpcurl](https://github.com/fullstorydev/grpcurl).", + "type": "object", + "required": [ + "data", + "path" + ], + "properties": { + "data": { + "description": "The expected protobuf message type (not [Any](https://protobuf.dev/programming-guides/proto3/#any)), binary encoded", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "path": { + "description": "The fully qualified endpoint path used for routing. It follows the format `/service_path/method_name`, eg. \"/cosmos.authz.v1beta1.Query/Grants\"", + "type": "string" + } + } + }, "IbcQuery": { "description": "These are queries to the various IBC modules to see the state of the contract's IBC connection. These will return errors if the contract is not \"ibc enabled\"", "oneOf": [ @@ -301,6 +461,34 @@ } ] }, + "PageRequest": { + "description": "Simplified version of the PageRequest type for pagination from the cosmos-sdk", + "type": "object", + "required": [ + "limit", + "reverse" + ], + "properties": { + "key": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "reverse": { + "type": "boolean" + } + } + }, "QueryRequest_for_InterchainQueries": { "oneOf": [ { @@ -339,6 +527,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionQuery" + } + }, + "additionalProperties": false + }, { "description": "A Stargate query is encoded the same way as abci_query, with path and protobuf encoded request data. The format is defined in [ADR-21](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-021-protobuf-query-encoding.md). The response is protobuf encoded data directly without a JSON response wrapper. The caller is responsible for compiling the proper protobuf definitions for both requests and responses.", "deprecated": true, @@ -394,6 +594,18 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "grpc" + ], + "properties": { + "grpc": { + "$ref": "#/definitions/GrpcQuery" + } + }, + "additionalProperties": false } ] },