Skip to content

Commit

Permalink
Fix member removal on RemoveStage {}
Browse files Browse the repository at this point in the history
  • Loading branch information
MightOfOaks committed Nov 10, 2024
1 parent c6e16fc commit 14c4612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions contracts/whitelists/tiered-whitelist-flex/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,6 @@ pub fn execute_remove_stage(
env.block.time < config.stages[stage_id as usize].start_time,
ContractError::AlreadyStarted {}
);
// remove the stage and following stages permanently
config.stages = config.stages.into_iter().take(stage_id as usize).collect();

// remove members from the WHITELIST_STAGES for stage_id and following stages. Reduce the num_members count
for stage in stage_id..config.stages.len() as u32 {
Expand All @@ -342,6 +340,8 @@ pub fn execute_remove_stage(
}
MEMBER_COUNT.remove(deps.storage, stage);
}
// remove the stage and following stages permanently
config.stages = config.stages.into_iter().take(stage_id as usize).collect();

CONFIG.save(deps.storage, &config)?;
Ok(Response::new()
Expand Down
5 changes: 3 additions & 2 deletions contracts/whitelists/tiered-whitelist/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,6 @@ pub fn execute_remove_stage(
env.block.time < config.stages[stage_id as usize].start_time,
ContractError::AlreadyStarted {}
);
// remove the stage and following stages permanently
config.stages = config.stages.into_iter().take(stage_id as usize).collect();

// remove members from the WHITELIST_STAGES for stage_id and following stages. Reduce the num_members count
for stage in stage_id..config.stages.len() as u32 {
Expand All @@ -343,6 +341,9 @@ pub fn execute_remove_stage(
MEMBER_COUNT.remove(deps.storage, stage);
}

// remove the stage and following stages permanently
config.stages = config.stages.into_iter().take(stage_id as usize).collect();

CONFIG.save(deps.storage, &config)?;
Ok(Response::new()
.add_attribute("action", "add_stage")
Expand Down

0 comments on commit 14c4612

Please sign in to comment.