Skip to content

Commit

Permalink
Check wl denom when setting wl
Browse files Browse the repository at this point in the history
  • Loading branch information
yubrew committed Aug 25, 2023
1 parent 8befc63 commit d0f23cb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
13 changes: 11 additions & 2 deletions contracts/minters/vending-minter-wl-flex/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::state::{
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
coin, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env, Event,
MessageInfo, Order, Reply, ReplyOn, StdError, StdResult, Timestamp, Uint128, WasmMsg,
coin, ensure, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env,
Event, MessageInfo, Order, Reply, ReplyOn, StdError, StdResult, Timestamp, Uint128, WasmMsg,
};
use cw2::set_contract_version;
use cw721_base::Extension;
Expand Down Expand Up @@ -429,6 +429,15 @@ pub fn execute_set_whitelist(
});
}

// Whitelist denom should match factory mint denom
ensure!(
factory.params.min_mint_price.denom == wl_config.mint_price.denom,
ContractError::InvalidDenom {
expected: factory.params.min_mint_price.denom,
got: wl_config.mint_price.denom,
}
);

CONFIG.save(deps.storage, &config)?;

Ok(Response::default()
Expand Down
14 changes: 12 additions & 2 deletions contracts/minters/vending-minter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ use crate::validation::{check_dynamic_per_address_limit, get_three_percent_of_to
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
coin, coins, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty, Env,
Event, MessageInfo, Order, Reply, ReplyOn, StdError, StdResult, Timestamp, Uint128, WasmMsg,
coin, coins, ensure, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Empty,
Env, Event, MessageInfo, Order, Reply, ReplyOn, StdError, StdResult, Timestamp, Uint128,
WasmMsg,
};
use cw2::set_contract_version;
use cw721_base::Extension;
Expand Down Expand Up @@ -448,6 +449,15 @@ pub fn execute_set_whitelist(
});
}

// Whitelist denom should match factory mint denom
ensure!(
factory.params.min_mint_price.denom == wl_config.mint_price.denom,
ContractError::InvalidDenom {
expected: factory.params.min_mint_price.denom,
got: wl_config.mint_price.denom,
}
);

CONFIG.save(deps.storage, &config)?;

Ok(Response::default()
Expand Down

0 comments on commit d0f23cb

Please sign in to comment.