Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions contracts/sei-tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ optimize = """docker run --rm -v "$(pwd)":/code \

[dependencies]
sei-cosmwasm = { path = "../../packages/sei-cosmwasm" }
cosmwasm-std = "1.0.0"
cosmwasm-storage = "1.0.0"
cw-storage-plus = "0.13.2"
cw2 = "0.13.2"
schemars = "0.8.8"
cosmwasm-std = "1.3"
cosmwasm-storage = "1.3"
cw-storage-plus = "1.1"
cw2 = "1.1"
schemars = "0.8"
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
base64 = { version = "0.13.0" }
thiserror = { version = "1.0.31" }
protobuf = { version = "3.2.0", features = ["with-bytes"] }

[dev-dependencies]
cosmwasm-schema = "1.0.0"
cosmwasm-schema = "1.3"
cw-multi-test = "0.16.0"
sei-integration-tests = { path = "../../packages/sei-integration-tests" }
94 changes: 39 additions & 55 deletions contracts/sei-tester/tests/sei_tester_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::vec;

use cosmwasm_std::{
coin, from_binary,
testing::{MockApi, MockStorage},
Expand Down Expand Up @@ -27,18 +29,12 @@ use sei_tester::{
const ADMIN: &str = "admin";
const NATIVE_DENOM: &str = "usei";

pub type SeiRouter = Router<BankKeeper, SeiModule, WasmKeeper<SeiMsg, SeiQueryWrapper>, StakeKeeper, DistributionKeeper, FailingModule<IbcMsg, IbcQuery, Empty>, FailingModule<GovMsg, Empty, Empty>>;
pub type SeiApp = App<BankKeeper, MockApi, MockStorage, SeiModule, WasmKeeper<SeiMsg, SeiQueryWrapper>, StakeKeeper, DistributionKeeper, FailingModule<IbcMsg, IbcQuery, Empty>, FailingModule<GovMsg, Empty, Empty>>;
/// Init balances via bank

fn init_default_balances(
router: &mut Router<
BankKeeper,
SeiModule,
WasmKeeper<SeiMsg, SeiQueryWrapper>,
StakeKeeper,
DistributionKeeper,
FailingModule<IbcMsg, IbcQuery, Empty>,
FailingModule<GovMsg, Empty, Empty>,
>,
router: &mut SeiRouter,
_api: &dyn Api,
storage: &mut dyn Storage,
) {
Expand Down Expand Up @@ -88,28 +84,19 @@ fn init_default_balances(
.unwrap();
}


/// Helper for setting up test

fn setup_test(
app: &mut App<
BankKeeper,
MockApi,
MockStorage,
SeiModule,
WasmKeeper<SeiMsg, SeiQueryWrapper>,
StakeKeeper,
DistributionKeeper,
FailingModule<IbcMsg, IbcQuery, Empty>,
FailingModule<GovMsg, Empty, Empty>,
>,
app: &mut SeiApp,
) -> Addr {
let sei_tester_code = app.store_code(Box::new(
ContractWrapper::new(execute, instantiate, query)
.with_reply(sei_tester::contract::reply)
.with_sudo(sei_tester::contract::sudo),
)); //::<SeiMsg, SeiQueryWrapper>

let sei_tester_addr = app
app
.instantiate_contract(
sei_tester_code,
Addr::unchecked(ADMIN),
Expand All @@ -118,9 +105,8 @@ fn setup_test(
"sei_tester",
Some(ADMIN.to_string()),
)
.unwrap();
.unwrap()

sei_tester_addr
}

/// Basic msg examples
Expand Down Expand Up @@ -260,14 +246,14 @@ fn test_dex_module_integration_orders() {
let status_description = "order1".to_string();

let order1: Order = Order {
price: price,
quantity: quantity,
price,
quantity,
price_denom: price_denom.clone(),
asset_denom: asset_denom.clone(),
order_type: order_type,
position_direction: position_direction,
data: data, // serialized order data, defined by the specific target contract
status_description: status_description,
order_type,
position_direction,
data, // serialized order data, defined by the specific target contract
status_description,
nominal: Decimal::zero(),
};
orders.push(order1);
Expand Down Expand Up @@ -305,8 +291,8 @@ fn test_dex_module_integration_orders() {
.execute_multi(
Addr::unchecked(ADMIN),
vec![CosmosMsg::Custom(SeiMsg::PlaceOrders {
orders: orders,
funds: funds,
orders,
funds,
contract_address: Addr::unchecked(&contract_addr),
})],
)
Expand Down Expand Up @@ -419,8 +405,7 @@ fn test_dex_module_integration_orders() {
assert!(error.is_some());

// CancelOrders for a contract address that doesn't exist
let mut nonexistent_order_ids: Vec<u64> = Vec::new();
nonexistent_order_ids.push(3);
let nonexistent_order_ids: Vec<u64> = vec![0];
let res = app.execute_multi(
Addr::unchecked(ADMIN),
vec![CosmosMsg::Custom(SeiMsg::CancelOrders {
Expand All @@ -432,8 +417,7 @@ fn test_dex_module_integration_orders() {
assert!(error.is_some());

// CancelOrders for order id 1
let mut cancel_order_ids: Vec<u64> = Vec::new();
cancel_order_ids.push(0);
let cancel_order_ids: Vec<u64> = vec![0];
let arr = app
.execute_multi(
Addr::unchecked(ADMIN),
Expand Down Expand Up @@ -504,14 +488,14 @@ fn test_dex_module_query_order_simulation() {
let status_description = "order1".to_string();

let order1: Order = Order {
price: price,
quantity: quantity,
price,
quantity,
price_denom: price_denom.clone(),
asset_denom: asset_denom.clone(),
order_type: order_type,
position_direction: position_direction,
data: data, // serialized order data, defined by the specific target contract
status_description: status_description,
order_type,
position_direction,
data, // serialized order data, defined by the specific target contract
status_description,
nominal: Decimal::zero(),
};
orders.push(order1);
Expand Down Expand Up @@ -547,9 +531,9 @@ fn test_dex_module_query_order_simulation() {
app.execute_multi(
Addr::unchecked(ADMIN),
vec![CosmosMsg::Custom(SeiMsg::PlaceOrders {
orders: orders,
funds: funds,
contract_address: Addr::unchecked(&sei_tester_addr.to_string()),
orders,
funds,
contract_address: Addr::unchecked(sei_tester_addr.to_string()),
})],
)
.unwrap();
Expand Down Expand Up @@ -801,27 +785,27 @@ fn test_dex_module_query_dex_twap() {
let status_description = "order1".to_string();

let order1: Order = Order {
price: price,
quantity: quantity,
price,
quantity,
price_denom: price_denom.clone(),
asset_denom: asset_denom.clone(),
order_type: order_type,
position_direction: position_direction,
data: data, // serialized order data, defined by the specific target contract
status_description: status_description,
order_type,
position_direction,
data, // serialized order data, defined by the specific target contract
status_description,
nominal: Decimal::zero(),
};
orders.push(order1);

app.execute_multi(
Addr::unchecked(ADMIN),
vec![CosmosMsg::Custom(SeiMsg::PlaceOrders {
orders: orders,
orders,
funds: vec![Coin {
denom: "usei".to_string(),
amount: Uint128::new(10),
}],
contract_address: Addr::unchecked(&sei_tester_addr.to_string()),
contract_address: Addr::unchecked(sei_tester_addr.to_string()),
})],
)
.unwrap();
Expand Down Expand Up @@ -860,12 +844,12 @@ fn test_dex_module_query_dex_twap() {
app.execute_multi(
Addr::unchecked(ADMIN),
vec![CosmosMsg::Custom(SeiMsg::PlaceOrders {
orders: orders,
orders,
funds: vec![Coin {
denom: "usei".to_string(),
amount: Uint128::new(10),
}],
contract_address: Addr::unchecked(&sei_tester_addr.to_string()),
contract_address: Addr::unchecked(sei_tester_addr.to_string()),
})],
)
.unwrap();
Expand All @@ -881,7 +865,7 @@ fn test_dex_module_query_dex_twap() {
.query(&QueryRequest::Custom(SeiQueryWrapper {
route: SeiRoute::Dex,
query_data: SeiQuery::DexTwaps {
contract_address: Addr::unchecked(&sei_tester_addr.to_string()),
contract_address: Addr::unchecked(sei_tester_addr.to_string()),
lookback_seconds: 6,
},
}))
Expand Down
8 changes: 4 additions & 4 deletions packages/sei-cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ readme = "README.md"
backtraces = ["cosmwasm-std/backtraces"]

[dependencies]
cosmwasm-std = "1.1"
schemars = "0.8.3"
serde = { version = "1.0.127", default-features = false, features = ["derive"] }
cosmwasm-std = "1.3"
schemars = "0.8"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_repr = "0.1.8"
protobuf = { version = "=3.2.0", features = ["with-bytes"] }

[dev-dependencies]
cosmwasm-schema = "1.0.0"
cosmwasm-schema = "1.3"
8 changes: 4 additions & 4 deletions packages/sei-integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ readme = "README.md"
cw-multi-test = "0.16"
anyhow = "1"
sei-cosmwasm = { path = "../sei-cosmwasm", version = "0.4.10" }
cosmwasm-std = "1.0.0"
cw20-base = "0.13.4"
schemars = "0.8.8"
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
cosmwasm-std = "1.3"
cw20-base = "1.1"
schemars = "0.8"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }