diff --git a/contracts/sei-tester/src/contract.rs b/contracts/sei-tester/src/contract.rs index 567b31a..ea6d1c0 100644 --- a/contracts/sei-tester/src/contract.rs +++ b/contracts/sei-tester/src/contract.rs @@ -212,7 +212,10 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult contract_address, lookback_seconds, } => to_binary(&query_dex_twaps(deps, contract_address, lookback_seconds)?), - QueryMsg::OrderSimulation { order } => to_binary(&query_order_simulation(deps, order)?), + QueryMsg::OrderSimulation { + order, + contract_address, + } => to_binary(&query_order_simulation(deps, order, contract_address)?), QueryMsg::Epoch {} => to_binary(&query_epoch(deps)?), QueryMsg::GetOrders { contract_address, @@ -265,9 +268,11 @@ pub fn query_dex_twaps( pub fn query_order_simulation( deps: Deps, order: Order, + contract_address: String, ) -> StdResult { + let contract_addr = deps.api.addr_validate(&contract_address)?; let querier = SeiQuerier::new(&deps.querier); - let res: OrderSimulationResponse = querier.query_order_simulation(order)?; + let res: OrderSimulationResponse = querier.query_order_simulation(order, contract_addr)?; Ok(res) } diff --git a/contracts/sei-tester/src/msg.rs b/contracts/sei-tester/src/msg.rs index bb107ce..dd50afe 100644 --- a/contracts/sei-tester/src/msg.rs +++ b/contracts/sei-tester/src/msg.rs @@ -99,6 +99,7 @@ pub enum QueryMsg { }, OrderSimulation { order: Order, + contract_address: String, }, Epoch {}, GetOrders { diff --git a/packages/sei-cosmwasm/Cargo.toml b/packages/sei-cosmwasm/Cargo.toml index 892b6ca..6fdbcef 100644 --- a/packages/sei-cosmwasm/Cargo.toml +++ b/packages/sei-cosmwasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sei-cosmwasm" -version = "0.3.0" +version = "0.4.1" edition = "2021" description = "Bindings and helpers for cosmwasm contracts to interact with sei blockchain" license = "Apache-2.0" diff --git a/packages/sei-cosmwasm/README.md b/packages/sei-cosmwasm/README.md index 77cbe4c..1063212 100644 --- a/packages/sei-cosmwasm/README.md +++ b/packages/sei-cosmwasm/README.md @@ -8,7 +8,7 @@ Add the sei-cosmwasm dependency to your smart contract's `Cargo.toml` file: ```toml [dependencies] -sei-cosmwasm = { version = "0.3.0" } +sei-cosmwasm = { version = "0.4.1" } ``` ## Functionality diff --git a/packages/sei-cosmwasm/src/querier.rs b/packages/sei-cosmwasm/src/querier.rs index a7d8661..3d40939 100644 --- a/packages/sei-cosmwasm/src/querier.rs +++ b/packages/sei-cosmwasm/src/querier.rs @@ -60,10 +60,17 @@ impl<'a> SeiQuerier<'a> { self.querier.query(&request) } - pub fn query_order_simulation(&self, order: Order) -> StdResult { + pub fn query_order_simulation( + &self, + order: Order, + contract_address: Addr, + ) -> StdResult { let request = SeiQueryWrapper { route: SeiRoute::Dex, - query_data: SeiQuery::OrderSimulation { order }, + query_data: SeiQuery::OrderSimulation { + contract_address, + order, + }, } .into(); diff --git a/packages/sei-cosmwasm/src/query.rs b/packages/sei-cosmwasm/src/query.rs index 3db14bc..c185128 100644 --- a/packages/sei-cosmwasm/src/query.rs +++ b/packages/sei-cosmwasm/src/query.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{Addr, CustomQuery}; +use cosmwasm_std::{Addr, CustomQuery, Decimal}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -42,6 +42,7 @@ pub enum SeiQuery { id: u64, }, OrderSimulation { + contract_address: Addr, order: Order, }, } @@ -85,5 +86,5 @@ pub struct GetOrderByIdResponse { /// OrderSimulationResponse is data format returned from OrderSimulation query #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct OrderSimulationResponse { - pub executed_quantity: String, + pub executed_quantity: Decimal, }