Skip to content

Commit

Permalink
Include mint price denom check in stage validation
Browse files Browse the repository at this point in the history
  • Loading branch information
MightOfOaks committed Nov 10, 2024
1 parent 87753c9 commit c6e16fc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 42 deletions.
22 changes: 8 additions & 14 deletions contracts/whitelists/tiered-whitelist-flex/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,14 @@ pub fn validate_stages(env: &Env, stages: &[Stage]) -> Result<(), ContractError>
StdError::generic_err("Cannot have more than 3 stages")
);

// // Check mint price is valid
// if stages
// .iter()
// .any(|stage| stage.mint_price.amount.u128() < MIN_MINT_PRICE)
// {
// return Err(ContractError::InvalidUnitPrice(
// MIN_MINT_PRICE,
// stages
// .iter()
// .map(|s| s.mint_price.amount.u128())
// .min()
// .unwrap(),
// ));
// }
// Check stages have matching mint price denoms
let mint_denom = stages[0].mint_price.denom.clone();
ensure!(
stages
.iter()
.all(|stage| stage.mint_price.denom == mint_denom),
StdError::generic_err("All stages must have the same mint price denom")
);

ensure!(
stages[0].start_time > env.block.time,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,14 @@ pub fn validate_stages(env: &Env, stages: &[Stage]) -> Result<(), ContractError>
});
}

// // Check mint price is valid
// if stages
// .iter()
// .any(|stage| stage.mint_price.amount.u128() < MIN_MINT_PRICE)
// {
// return Err(ContractError::InvalidUnitPrice(
// MIN_MINT_PRICE,
// stages
// .iter()
// .map(|s| s.mint_price.amount.u128())
// .min()
// .unwrap(),
// ));
// }
// Check stages have matching mint price denoms
let mint_denom = stages[0].mint_price.denom.clone();
ensure!(
stages
.iter()
.all(|stage| stage.mint_price.denom == mint_denom),
StdError::generic_err("All stages must have the same mint price denom")
);

ensure!(
stages[0].start_time > env.block.time,
Expand Down
22 changes: 8 additions & 14 deletions contracts/whitelists/tiered-whitelist/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,14 @@ pub fn validate_stages(env: &Env, stages: &[Stage]) -> Result<(), ContractError>
});
}

// // Check mint price is valid
// if stages
// .iter()
// .any(|stage| stage.mint_price.amount.u128() < MIN_MINT_PRICE)
// {
// return Err(ContractError::InvalidUnitPrice(
// MIN_MINT_PRICE,
// stages
// .iter()
// .map(|s| s.mint_price.amount.u128())
// .min()
// .unwrap(),
// ));
// }
// Check stages have matching mint price denoms
let mint_denom = stages[0].mint_price.denom.clone();
ensure!(
stages
.iter()
.all(|stage| stage.mint_price.denom == mint_denom),
StdError::generic_err("All stages must have the same mint price denom")
);

ensure!(
stages[0].start_time > env.block.time,
Expand Down

0 comments on commit c6e16fc

Please sign in to comment.