Skip to content

Fix linting issues #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test-suite/src/common_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ pub mod helpers;
pub mod msg;
pub mod setup_accounts_and_block;
pub mod setup_collection_whitelist;
pub mod setup_whitelist_merkletree;
pub mod setup_minter;
pub mod setup_whitelist_merkletree;
pub mod templates;
3 changes: 1 addition & 2 deletions test-suite/src/common_setup/contract_boxes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ pub fn contract_collection_whitelist() -> Box<dyn Contract<StargazeMsgWrapper>>
Box::new(contract)
}


pub fn contract_open_edition_minter() -> Box<dyn Contract<StargazeMsgWrapper>> {
let contract = ContractWrapper::new(
open_edition_minter::contract::execute,
Expand Down Expand Up @@ -148,4 +147,4 @@ pub fn contract_whitelist_merkletree() -> Box<dyn Contract<StargazeMsgWrapper>>
whitelist_mtree::contract::query,
);
Box::new(contract)
}
}
5 changes: 2 additions & 3 deletions test-suite/src/common_setup/setup_whitelist_merkletree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn setup_whitelist_mtree_contract(
creator: &Addr,
whitelist_code_id: Option<u64>,
denom: Option<&str>,
merkle_root: String
merkle_root: String,
) -> Addr {
let whitelist_code_id = match whitelist_code_id {
Some(value) => value,
Expand All @@ -25,7 +25,6 @@ pub fn setup_whitelist_mtree_contract(
None => NATIVE_DENOM,
};


let msg = WhitelistInstantiateMsg {
start_time: Timestamp::from_nanos(GENESIS_MINT_START_TIME + 100),
end_time: Timestamp::from_nanos(GENESIS_MINT_START_TIME + 10_000_000),
Expand All @@ -34,7 +33,7 @@ pub fn setup_whitelist_mtree_contract(
admins: vec![creator.to_string()],
admins_mutable: true,
merkle_root,
merkle_tree_uri: None
merkle_tree_uri: None,
};
router
.instantiate_contract(
Expand Down
2 changes: 1 addition & 1 deletion test-suite/src/whitelist_merkletree.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod tests;
mod tests;
2 changes: 1 addition & 1 deletion test-suite/src/whitelist_merkletree/tests.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod integration_tests;
mod integration_tests;
39 changes: 17 additions & 22 deletions test-suite/src/whitelist_merkletree/tests/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
#[cfg(test)]
mod tests {
use cosmwasm_std::{Addr, Timestamp, coin};
use cosmwasm_std::{coin, Addr, Timestamp};
use cw_multi_test::Executor;
use rs_merkle::MerkleTree;
use sg_multi_test::StargazeApp;
use sg_std::{GENESIS_MINT_START_TIME, NATIVE_DENOM};

use whitelist_mtree::{
msg::*,
tests::{hasher::SortingSha256Hasher, test_helpers::hash_and_build_tree},
msg::*
};

use crate::common_setup::contract_boxes::{contract_whitelist_merkletree, custom_mock_app};

type Tree = MerkleTree::<SortingSha256Hasher>;
type Tree = MerkleTree<SortingSha256Hasher>;

const CREATOR: &str = "creator";
const START_TIME: Timestamp = Timestamp::from_nanos(GENESIS_MINT_START_TIME);
const END_TIME: Timestamp = Timestamp::from_nanos(GENESIS_MINT_START_TIME + 1000);


fn get_init_address_list_1() -> Vec<String> {
vec![
Expand Down Expand Up @@ -47,7 +46,7 @@ mod tests {
pub fn instantiate_with_root(
app: &mut StargazeApp,
per_address_limit: u32,
merkle_root: String
merkle_root: String,
) -> Addr {
let msg = InstantiateMsg {
admins: vec![],
Expand All @@ -57,7 +56,7 @@ mod tests {
mint_price: coin(1000000u128, NATIVE_DENOM),
per_address_limit,
merkle_root,
merkle_tree_uri: None
merkle_tree_uri: None,
};
let wl_id = app.store_code(contract_whitelist_merkletree());
app.instantiate_contract(
Expand All @@ -71,31 +70,29 @@ mod tests {
.unwrap()
}



pub fn query_admin_list(app: &mut StargazeApp, wl_addr: Addr) {
let res: AdminListResponse = app
.wrap()
.query_wasm_smart(wl_addr, &QueryMsg::AdminList { })
.query_wasm_smart(wl_addr, &QueryMsg::AdminList {})
.unwrap();
assert_eq!(res.admins.len(), 0);
assert_eq!(res.mutable, false)
}

pub fn query_includes_address(
app: &mut StargazeApp,
wl_addr: Addr,
app: &mut StargazeApp,
wl_addr: Addr,
addr_to_check: String,
proof_hashes: Vec<String>
proof_hashes: Vec<String>,
) {
let res: HasMemberResponse = app
.wrap()
.query_wasm_smart(
wl_addr,
&QueryMsg::HasMember {
member: addr_to_check.to_string(),
proof_hashes
}
&QueryMsg::HasMember {
member: addr_to_check.to_string(),
proof_hashes,
},
)
.unwrap();
assert!(res.has_member);
Expand All @@ -116,7 +113,7 @@ mod tests {
let per_address_limit = 1;
let tree: Tree = hash_and_build_tree(&addrs);
let wl_addr = instantiate_with_root(&mut app, per_address_limit, tree.root_hex().unwrap());

let addr_to_check = addrs[0].clone();
let proof = tree.proof(&vec![0]);
let proof_hashes = proof.proof_hashes_hex();
Expand All @@ -131,7 +128,7 @@ mod tests {
let mut app = custom_mock_app();
let addrs = get_init_address_list_2();
let per_address_limit = 99;

let tree: Tree = hash_and_build_tree(&addrs);
let wl_addr = instantiate_with_root(&mut app, per_address_limit, tree.root_hex().unwrap());
let addr_to_check = addrs[1].clone();
Expand All @@ -152,7 +149,7 @@ mod tests {

let tree: Tree = hash_and_build_tree(&addrs);
let wl_addr = instantiate_with_root(&mut app, per_address_limit, tree.root_hex().unwrap());

let addr_to_check = addrs[0].clone();
query_admin_list(&mut app, wl_addr.clone());

Expand All @@ -162,6 +159,4 @@ mod tests {
query_includes_address(&mut app, wl_addr.clone(), addr_to_check, proof_hashes);
query_per_address_limit(&mut app, wl_addr, per_address_limit)
}


}