Skip to content

Commit

Permalink
remove stargaze deps
Browse files Browse the repository at this point in the history
  • Loading branch information
discoverdefiteam committed Oct 25, 2023
1 parent 805f368 commit 0d12e68
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 157 deletions.
154 changes: 10 additions & 144 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 3 additions & 7 deletions contracts/cw-goop/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
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)?),
Expand Down Expand Up @@ -162,12 +162,8 @@ pub fn query_get_headstash_amount(deps: Deps, address: String) -> StdResult<Head
}


pub fn query_has_member(deps: Deps, member: String) -> StdResult<HasMemberResponse> {
let addr = member;

Ok(HasMemberResponse {
has_member: GOOPLIST.has(deps.storage, addr),
})
pub fn query_has_member(deps: Deps, address: String) -> StdResult<bool> {
Ok(GOOPLIST.has(deps.storage, address),)
}

pub fn query_member(deps: Deps, member: String) -> StdResult<Member> {
Expand Down
8 changes: 8 additions & 0 deletions contracts/cw-goop/src/helpers/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ impl CwGoopContract {
}))?;
Ok(get_headstash_amount)
}

pub fn includes(&self, querier: &QuerierWrapper, address: String) -> StdResult<bool> {
let includes: bool = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_binary(&QueryMsg::HasMember { address })?,
}))?;
Ok(includes)
}
}
4 changes: 2 additions & 2 deletions contracts/cw-goop/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub enum QueryMsg {
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(HasMemberResponse)]
HasMember { member: String },
#[returns(bool)]
HasMember { address: String },
#[returns(MemberResponse)]
Member { member: String },
#[returns(ConfigResponse)]
Expand Down
1 change: 0 additions & 1 deletion contracts/headstash-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions contracts/headstash-contract/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -23,7 +23,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
pub fn query_headstash_is_eligible(deps: Deps, eth_address: String) -> StdResult<bool> {
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(),
Expand Down

0 comments on commit 0d12e68

Please sign in to comment.