Skip to content

Commit

Permalink
Address clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MightOfOaks committed Nov 5, 2024
1 parent 5f6a681 commit 8623b89
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 45 deletions.
1 change: 1 addition & 0 deletions contracts/minters/vending-minter-featured/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ pub fn execute_mint_for(
// mint -> _execute_mint(recipient: None, token_id: None)
// mint_to(recipient: "friend") -> _execute_mint(Some(recipient), token_id: None)
// mint_for(recipient: "friend2", token_id: 420) -> _execute_mint(recipient, token_id)
#[allow(clippy::too_many_arguments)]
fn _execute_mint(
deps: DepsMut,
env: Env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ pub fn execute_mint_for(
// mint -> _execute_mint(recipient: None, token_id: None)
// mint_to(recipient: "friend") -> _execute_mint(Some(recipient), token_id: None)
// mint_for(recipient: "friend2", token_id: 420) -> _execute_mint(recipient, token_id)
#[allow(clippy::too_many_arguments)]
fn _execute_mint(
deps: DepsMut,
env: Env,
Expand Down
1 change: 1 addition & 0 deletions contracts/minters/vending-minter-merkle-wl/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ pub fn execute_mint_for(
// mint -> _execute_mint(recipient: None, token_id: None)
// mint_to(recipient: "friend") -> _execute_mint(Some(recipient), token_id: None)
// mint_for(recipient: "friend2", token_id: 420) -> _execute_mint(recipient, token_id)
#[allow(clippy::too_many_arguments)]
fn _execute_mint(
deps: DepsMut,
env: Env,
Expand Down
1 change: 1 addition & 0 deletions contracts/minters/vending-minter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ pub fn execute_mint_for(
// mint -> _execute_mint(recipient: None, token_id: None)
// mint_to(recipient: "friend") -> _execute_mint(Some(recipient), token_id: None)
// mint_for(recipient: "friend2", token_id: 420) -> _execute_mint(recipient, token_id)
#[allow(clippy::too_many_arguments)]
fn _execute_mint(
deps: DepsMut,
env: Env,
Expand Down
29 changes: 14 additions & 15 deletions contracts/whitelists/tiered-whitelist-flex/src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod interface;
pub mod validators;

use crate::contract::MIN_MINT_PRICE;
use crate::state::{Config, Stage, CONFIG};
use crate::ContractError;
use cosmwasm_std::{ensure, Env, StdError, Storage};
Expand Down Expand Up @@ -36,20 +35,20 @@ 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 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(),
// ));
// }

ensure!(
stages[0].start_time > env.block.time,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::contract::{MAX_PER_ADDRESS_LIMIT, MIN_MINT_PRICE};
use crate::contract::MAX_PER_ADDRESS_LIMIT;
use crate::state::{Config, Stage, CONFIG};
use crate::ContractError;
use cosmwasm_std::{ensure, Env, StdError, StdResult, Storage};
Expand Down Expand Up @@ -59,20 +59,20 @@ 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 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(),
// ));
// }

ensure!(
stages[0].start_time > env.block.time,
Expand Down
30 changes: 15 additions & 15 deletions contracts/whitelists/tiered-whitelist/src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod interface;
pub mod validators;

use crate::contract::{MAX_PER_ADDRESS_LIMIT, MIN_MINT_PRICE};
use crate::contract::MAX_PER_ADDRESS_LIMIT;
use crate::state::{Config, Stage, CONFIG};
use crate::ContractError;
use cosmwasm_std::{ensure, Env, StdError, Storage};
Expand Down Expand Up @@ -51,20 +51,20 @@ 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 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(),
// ));
// }

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

0 comments on commit 8623b89

Please sign in to comment.