Skip to content
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

Fix cw-abc hatcher instantiation #830

Merged
merged 1 commit into from
May 20, 2024
Merged
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
6 changes: 4 additions & 2 deletions contracts/external/cw-abc/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,17 @@ pub fn toggle_pause(deps: DepsMut, info: MessageInfo) -> Result<Response, Contra
.add_attribute("is_paused", is_paused.to_string()))
}

/// Add and remove addresses from the hatcher allowlist (only callable by owner)
/// Add and remove addresses from the hatcher allowlist (only callable by owner and self)
pub fn update_hatch_allowlist(
deps: DepsMut,
env: Env,
info: MessageInfo,
to_add: Vec<HatcherAllowlistEntryMsg>,
to_remove: Vec<String>,
) -> Result<Response, ContractError> {
cw_ownable::assert_owner(deps.storage, &info.sender)?;
if env.contract.address != info.sender {
cw_ownable::assert_owner(deps.storage, &info.sender)?;
}

let list = hatcher_allowlist();

Expand Down
11 changes: 8 additions & 3 deletions contracts/external/cw-abc/src/test_tube/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,13 @@ fn test_allowlist() {
},
closed: ClosedConfig {},
},
hatcher_allowlist: None,
hatcher_allowlist: Some(vec![HatcherAllowlistEntryMsg {
addr: "replaced to accounts[9]".to_string(),
config: HatcherAllowlistConfigMsg {
config_type: HatcherAllowlistConfigType::Address {},
contribution_limits_override: None,
},
}]),
curve_type: CurveType::Constant {
value: Uint128::one(),
scale: 1,
Expand Down Expand Up @@ -403,8 +409,7 @@ fn test_allowlist() {
))
);

// Enable the allow list, normally this would be passed in through
// instantiation.
// Update the allowlist
abc.execute(
&ExecuteMsg::UpdateHatchAllowlist {
to_add: vec![
Expand Down
18 changes: 17 additions & 1 deletion contracts/external/cw-abc/src/test_tube/test_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,17 @@ impl TestEnvBuilder {
funding_pool_forwarding: Some(accounts[0].address()),
supply: SupplyToken {
subdenom: DENOM.to_string(),
metadata: None,
metadata: Some(NewDenomMetadata {
description: "Awesome token, get it meow!".to_string(),
additional_denom_units: Some(vec![DenomUnit {
denom: "cat".to_string(),
exponent: 6,
aliases: vec![],
}]),
display: "cat".to_string(),
name: "Cat Token".to_string(),
symbol: "CAT".to_string(),
}),
decimals: 6,
max_supply: Some(Uint128::from(1_000_000_000u128)),
},
Expand Down Expand Up @@ -297,6 +307,12 @@ impl TestEnvBuilder {

msg.funding_pool_forwarding = Some(accounts[0].address());

if let Some(allowlist) = msg.hatcher_allowlist.as_mut() {
for member in allowlist {
member.addr = accounts[9].address();
}
}

let abc = CwAbc::deploy(app, &msg, &accounts[0])?;

let issuer_addr = CwAbc::query(&abc, &QueryMsg::TokenContract {})?;
Expand Down
Loading