Skip to content

Commit

Permalink
Merge pull request #201 from InjectiveLabs/f/cw-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
gorgos authored Nov 9, 2023
2 parents 07ea553 + 9ecbe9b commit be85f85
Show file tree
Hide file tree
Showing 16 changed files with 328 additions and 1,650 deletions.
409 changes: 209 additions & 200 deletions Cargo.lock

Large diffs are not rendered by default.

738 changes: 0 additions & 738 deletions contracts/atomic-order-example/Cargo.lock

This file was deleted.

28 changes: 14 additions & 14 deletions contracts/atomic-order-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ optimize = """docker run --rm -v "$(pwd)":/code \
"""

[dependencies]
cosmwasm-std = "1.4.1"
cosmwasm-storage = "1.4.1"
cw-storage-plus = "0.14.0"
cw2 = "0.14.0"
cw-utils = "0.14.0"
schemars = "0.8.8"
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.31" }
injective-cosmwasm = { version = "0.1.104" }
injective-math = { version = "0.1.4" }
protobuf = { version = "2", features = ["with-bytes"] }
injective-protobuf = { path = "../../packages/injective-protobuf", version = "0.2" }
cosmwasm-std = { version = "1.2.7", features = [ "abort", "iterator", "stargate" ] }
cosmwasm-storage = { version = "1.2.7", features = [ "iterator" ] }
cw-storage-plus = { version = "0.16.0" }
cw2 = { version = "0.16.0" }
cw-utils = { version = "0.16.0" }
schemars = { version = "0.8.8", features = [ "enumset" ] }
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.31" }
injective-cosmwasm = { version = "0.2.16", path= "../../packages/injective-cosmwasm" }
injective-math = { version = "0.2.2", path = "../../packages/injective-math" }
protobuf = { version = "2.28.0", features = ["with-bytes"] }
injective-protobuf = { path = "../../packages/injective-protobuf", version = "0.2.1" }

[dev-dependencies]
cosmwasm-schema = "1.4.1"
cw-multi-test = "0.16.2"
cosmwasm-schema = { version = "1.2.7" }
cw-multi-test = { version = "0.16.2" }
1 change: 1 addition & 0 deletions contracts/atomic-order-example/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn try_swap(
&config.market_id,
subaccount_id,
Some(contract.to_owned()),
None,
);

let coins = &info.funds[0];
Expand Down
4 changes: 2 additions & 2 deletions contracts/atomic-order-example/src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, SubMsg, WasmMsg};
use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, StdResult, SubMsg, WasmMsg};
use injective_cosmwasm::InjectiveMsgWrapper;
use injective_math::FPDecimal;
use schemars::JsonSchema;
Expand All @@ -17,7 +17,7 @@ impl CwTemplateContract {
}

pub fn call<T: Into<ExecuteMsg>>(&self, msg: T) -> StdResult<CosmosMsg> {
let msg = to_binary(&msg.into())?;
let msg = to_json_binary(&msg.into())?;
Ok(WasmMsg::Execute {
contract_addr: self.addr().into(),
msg,
Expand Down
13 changes: 7 additions & 6 deletions contracts/atomic-order-example/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use std::str::FromStr;

use cosmwasm_std::testing::{mock_info, MockApi, MockStorage};
use cosmwasm_std::{
coins, to_binary, BankMsg, Binary, ContractResult, CosmosMsg, OwnedDeps, QuerierResult, Reply,
SubMsgResponse, SubMsgResult, SystemResult, Uint128,
coins, to_json_binary, BankMsg, Binary, ContractResult, CosmosMsg, OwnedDeps, QuerierResult,
Reply, SubMsgResponse, SubMsgResult, SystemResult, Uint128,
};

use injective_cosmwasm::InjectiveMsg::CreateSpotMarketOrder;
use injective_cosmwasm::{
inj_mock_deps, inj_mock_env, HandlesMarketIdQuery, InjectiveQueryWrapper, InjectiveRoute,
MarketId, OrderInfo, OrderType, OwnedDepsExt, SpotMarket, SpotMarketResponse, SpotOrder,
SubaccountId, WasmMockQuerier,
MarketId, MarketStatus, OrderInfo, OrderType, OwnedDepsExt, SpotMarket, SpotMarketResponse,
SpotOrder, SubaccountId, WasmMockQuerier,
};
use injective_math::FPDecimal;

Expand Down Expand Up @@ -77,6 +77,7 @@ fn test_swap() {
fee_recipient: Some(env.contract.address),
price: i32_to_dec(1000),
quantity: i32_to_dec(8),
cid: None,
},
order_type: OrderType::BuyAtomic,
trigger_price: None,
Expand Down Expand Up @@ -132,12 +133,12 @@ fn create_spot_market_handler() -> impl HandlesMarketIdQuery {
taker_fee_rate: FPDecimal::from_str("0.1").unwrap(),
relayer_fee_share_rate: FPDecimal::from_str("0.4").unwrap(),
market_id,
status: 0,
status: MarketStatus::Active,
min_price_tick_size: FPDecimal::from_str("0.000000000000001").unwrap(),
min_quantity_tick_size: FPDecimal::from_str("1000000000000000").unwrap(),
}),
};
SystemResult::Ok(ContractResult::from(to_binary(&response)))
SystemResult::Ok(ContractResult::from(to_json_binary(&response)))
}
}
Temp()
Expand Down
Loading

0 comments on commit be85f85

Please sign in to comment.