Skip to content

Commit

Permalink
Bump version to 0.4.0 (#19)
Browse files Browse the repository at this point in the history
* Bump version to 0.4.0

* Update OrderSimulation return type

* Fix order simulation issue

Co-authored-by: Cyson <[email protected]>
  • Loading branch information
LCyson and Cyson authored Aug 10, 2022
1 parent c1c84d2 commit 656c083
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
9 changes: 7 additions & 2 deletions contracts/sei-tester/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ pub fn query(deps: Deps<SeiQueryWrapper>, _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,
Expand Down Expand Up @@ -265,9 +268,11 @@ pub fn query_dex_twaps(
pub fn query_order_simulation(
deps: Deps<SeiQueryWrapper>,
order: Order,
contract_address: String,
) -> StdResult<OrderSimulationResponse> {
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)
}
Expand Down
1 change: 1 addition & 0 deletions contracts/sei-tester/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub enum QueryMsg {
},
OrderSimulation {
order: Order,
contract_address: String,
},
Epoch {},
GetOrders {
Expand Down
2 changes: 1 addition & 1 deletion packages/sei-cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/sei-cosmwasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions packages/sei-cosmwasm/src/querier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,17 @@ impl<'a> SeiQuerier<'a> {
self.querier.query(&request)
}

pub fn query_order_simulation(&self, order: Order) -> StdResult<OrderSimulationResponse> {
pub fn query_order_simulation(
&self,
order: Order,
contract_address: Addr,
) -> StdResult<OrderSimulationResponse> {
let request = SeiQueryWrapper {
route: SeiRoute::Dex,
query_data: SeiQuery::OrderSimulation { order },
query_data: SeiQuery::OrderSimulation {
contract_address,
order,
},
}
.into();

Expand Down
5 changes: 3 additions & 2 deletions packages/sei-cosmwasm/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{Addr, CustomQuery};
use cosmwasm_std::{Addr, CustomQuery, Decimal};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -42,6 +42,7 @@ pub enum SeiQuery {
id: u64,
},
OrderSimulation {
contract_address: Addr,
order: Order,
},
}
Expand Down Expand Up @@ -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,
}

0 comments on commit 656c083

Please sign in to comment.