diff --git a/Cargo.lock b/Cargo.lock index 86daad9..ab104da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -710,30 +710,15 @@ dependencies = [ "zeroize", ] -[[package]] -name = "cw-controllers" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24bd6738c3fd59c87d2f84911c1cad1e4f2d1c58ecaa6e52549b4f78f4ed6f07" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 0.16.0", - "cw-utils 0.16.0", - "schemars", - "serde", - "thiserror", -] - [[package]] name = "cw-goop" version = "0.2.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.2", - "cw2 1.1.1", + "cw-storage-plus", + "cw-utils", + "cw2", "rust_decimal", "schemars", "serde", @@ -748,8 +733,8 @@ checksum = "127c7bb95853b8e828bdab97065c81cb5ddc20f7339180b61b2300565aaa99d1" dependencies = [ "anyhow", "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.2", + "cw-storage-plus", + "cw-utils", "derivative", "itertools", "k256 0.11.6", @@ -759,17 +744,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cw-storage-plus" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b6f91c0b94481a3e9ef1ceb183c37d00764f8751e39b45fc09f4d9b970d469" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", -] - [[package]] name = "cw-storage-plus" version = "1.1.0" @@ -781,21 +755,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cw-utils" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a84c6c1c0acc3616398eba50783934bd6c964bad6974241eaee3460c8f5b26" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw2 0.16.0", - "schemars", - "semver", - "serde", - "thiserror", -] - [[package]] name = "cw-utils" version = "1.0.2" @@ -804,26 +763,13 @@ checksum = "1b9f351a4e4d81ef7c890e44d903f8c0bdcdc00f094fd3a181eaf70c0eec7a3a" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw2 1.1.1", + "cw2", "schemars", "semver", "serde", "thiserror", ] -[[package]] -name = "cw2" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91398113b806f4d2a8d5f8d05684704a20ffd5968bf87e3473e1973710b884ad" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 0.16.0", - "schemars", - "serde", -] - [[package]] name = "cw2" version = "1.1.1" @@ -832,25 +778,12 @@ checksum = "9431d14f64f49e41c6ef5561ed11a5391c417d0cb16455dea8cdcb9037a8d197" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus 1.1.0", + "cw-storage-plus", "schemars", "serde", "thiserror", ] -[[package]] -name = "cw721" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c4d286625ccadc957fe480dd3bdc54ada19e0e6b5b9325379db3130569e914" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-utils 1.0.2", - "schemars", - "serde", -] - [[package]] name = "der" version = "0.6.1" @@ -1379,9 +1312,9 @@ dependencies = [ "cosmwasm-std", "cw-goop", "cw-multi-test", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.2", - "cw2 1.1.1", + "cw-storage-plus", + "cw-utils", + "cw2", "ethereum-verify", "ethers-core", "ethers-signers", @@ -1394,7 +1327,6 @@ dependencies = [ "sha2 0.10.8", "sha3", "thiserror", - "whitelist-immutable", ] [[package]] @@ -2272,53 +2204,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sg-std" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db53aebc2b4f981dc20a51213544adde8beaace6880345627f4babe2e1bc3ab" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-utils 1.0.2", - "cw721", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "sg-whitelist" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c54f7d541542d54e9f33fe8aaa3fca7672d7477d3a926d0597cf9188a0c350a" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.2", - "cw2 1.1.1", - "rust_decimal", - "schemars", - "serde", - "sg-std", - "sg1", - "thiserror", -] - -[[package]] -name = "sg1" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991d30973e55895e49139e94f3e862b3d9b2eb44326c6bf147067cea59912449" -dependencies = [ - "cosmwasm-std", - "cw-utils 1.0.2", - "serde", - "sg-std", - "thiserror", -] - [[package]] name = "sha2" version = "0.8.2" @@ -2730,25 +2615,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "whitelist-immutable" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c99dcfc4d44987fa3a633d1b56d7d452feb6b39ae05aff65e767bc4d318ff8fd" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-controllers", - "cw-storage-plus 1.1.0", - "cw-utils 1.0.2", - "cw2 1.1.1", - "schemars", - "serde", - "sg-std", - "sg-whitelist", - "thiserror", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 2e2694f..ab2271e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,6 @@ url = "2.2.2" sha2 = { version = "0.10.2", default-features = false } ethereum-verify = "3.3.0" headstash-contract = { version = "0.2.0", path = "contracts/headstash-contract" } -whitelist-immutable = "3.3.0" cw-goop = { version = "0.2.0", path = "contracts/cw-goop" } semver = "1" cw-ownable = "0.5.1" diff --git a/contracts/cw-goop/src/contract.rs b/contracts/cw-goop/src/contract.rs index 1414bfe..9519220 100644 --- a/contracts/cw-goop/src/contract.rs +++ b/contracts/cw-goop/src/contract.rs @@ -116,7 +116,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::Members { start_after, limit } => { to_binary(&query_members(deps, start_after, limit)?) } - QueryMsg::HasMember { member } => to_binary(&query_has_member(deps, member)?), + QueryMsg::HasMember { address } => to_binary(&query_has_member(deps, address)?), QueryMsg::Member { member } => to_binary(&query_member(deps, member)?), QueryMsg::Config {} => to_binary(&query_config(deps, env)?), QueryMsg::AdminList {} => to_binary(&query_admin_list(deps)?), @@ -162,12 +162,8 @@ pub fn query_get_headstash_amount(deps: Deps, address: String) -> StdResult StdResult { - let addr = member; - - Ok(HasMemberResponse { - has_member: GOOPLIST.has(deps.storage, addr), - }) +pub fn query_has_member(deps: Deps, address: String) -> StdResult { + Ok(GOOPLIST.has(deps.storage, address),) } pub fn query_member(deps: Deps, member: String) -> StdResult { diff --git a/contracts/cw-goop/src/helpers/interface.rs b/contracts/cw-goop/src/helpers/interface.rs index f54d15d..89fab92 100644 --- a/contracts/cw-goop/src/helpers/interface.rs +++ b/contracts/cw-goop/src/helpers/interface.rs @@ -31,4 +31,12 @@ impl CwGoopContract { }))?; Ok(get_headstash_amount) } + + pub fn includes(&self, querier: &QuerierWrapper, address: String) -> StdResult { + let includes: bool = querier.query(&QueryRequest::Wasm(WasmQuery::Smart { + contract_addr: self.addr().into(), + msg: to_binary(&QueryMsg::HasMember { address })?, + }))?; + Ok(includes) + } } diff --git a/contracts/cw-goop/src/msg.rs b/contracts/cw-goop/src/msg.rs index af8d11c..3938a42 100644 --- a/contracts/cw-goop/src/msg.rs +++ b/contracts/cw-goop/src/msg.rs @@ -40,8 +40,8 @@ pub enum QueryMsg { start_after: Option, limit: Option, }, - #[returns(HasMemberResponse)] - HasMember { member: String }, + #[returns(bool)] + HasMember { address: String }, #[returns(MemberResponse)] Member { member: String }, #[returns(ConfigResponse)] diff --git a/contracts/headstash-contract/Cargo.toml b/contracts/headstash-contract/Cargo.toml index 8e0dff4..de1a9cd 100644 --- a/contracts/headstash-contract/Cargo.toml +++ b/contracts/headstash-contract/Cargo.toml @@ -40,7 +40,6 @@ schemars = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } cw-goop = { workspace = true, features = ["library"] } -whitelist-immutable = { workspace = true, features = ["library"] } [dev-dependencies] diff --git a/contracts/headstash-contract/src/query.rs b/contracts/headstash-contract/src/query.rs index 70cea50..a065cba 100644 --- a/contracts/headstash-contract/src/query.rs +++ b/contracts/headstash-contract/src/query.rs @@ -2,7 +2,7 @@ use crate::{msg::QueryMsg, state::CONFIG}; use cosmwasm_std::{entry_point, to_binary, Binary}; use cosmwasm_std::{ Env}; use cosmwasm_std::{Deps, StdResult}; -use whitelist_immutable::helpers::WhitelistImmutableContract; +use cw_goop::helpers::interface::CwGoopContract; #[cfg_attr(not(feature = "library"), entry_point)] @@ -23,7 +23,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { pub fn query_headstash_is_eligible(deps: Deps, eth_address: String) -> StdResult { let config = CONFIG.load(deps.storage)?; match config.cw_goop_address { - Some(address) => WhitelistImmutableContract(deps.api.addr_validate(&address)?) + Some(address) => CwGoopContract(deps.api.addr_validate(&address)?) .includes(&deps.querier, eth_address), None => Err(cosmwasm_std::StdError::NotFound { kind: "Cw Goop Contract".to_string(),