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

minter updates #622

Merged
merged 3 commits into from
Oct 11, 2023
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
3 changes: 3 additions & 0 deletions contracts/collections/sg721-base/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ where
Ok(Response::new()
.add_attribute("action", "instantiate")
.add_attribute("collection_name", info.name)
.add_attribute("collection_symbol", info.symbol)
.add_attribute("collection_creator", collection_info.creator)
.add_attribute("minter", msg.minter)
.add_attribute("image", image.to_string()))
}

Expand Down
22 changes: 17 additions & 5 deletions contracts/minters/vending-minter-wl-flex/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use cw_utils::{may_pay, maybe_addr, nonpayable, parse_reply_instantiate_data};
use rand_core::{RngCore, SeedableRng};
use rand_xoshiro::Xoshiro128PlusPlus;
use semver::Version;
use sg1::checked_fair_burn;
use sg1::{checked_fair_burn, ibc_denom_fair_burn};
use sg2::query::Sg2QueryMsg;
use sg4::{MinterConfig, Status, StatusResponse, SudoMsg};
use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg};
use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME};
use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME, NATIVE_DENOM};
use sg_whitelist_flex::msg::{
ConfigResponse as WhitelistConfigResponse, HasMemberResponse, Member,
QueryMsg as WhitelistQueryMsg,
Expand Down Expand Up @@ -619,7 +619,7 @@ fn _execute_mint(

let mint_price: Coin = mint_price(deps.as_ref(), is_admin)?;
// Exact payment only accepted
let payment = may_pay(&info, &config.mint_price.denom)?;
let payment = may_pay(&info, &mint_price.denom)?;
if payment != mint_price.amount {
return Err(ContractError::IncorrectPaymentAmount(
coin(payment.u128(), &config.mint_price.denom),
Expand All @@ -641,7 +641,19 @@ fn _execute_mint(
Decimal::bps(factory_params.mint_fee_bps)
};
let network_fee = mint_price.amount * mint_fee;
checked_fair_burn(&info, network_fee.u128(), None, &mut res)?;
// use ibc_denom_fair_burn for non native denoms
if mint_price.denom != NATIVE_DENOM {
// only send non-zero amounts
if !network_fee.is_zero() {
ibc_denom_fair_burn(
coin(network_fee.u128(), mint_price.clone().denom),
None,
&mut res,
)?;
}
} else {
checked_fair_burn(&info, network_fee.u128(), None, &mut res)?;
}

let mintable_token_mapping = match token_id {
Some(token_id) => {
Expand Down Expand Up @@ -1009,7 +1021,7 @@ pub fn mint_price(deps: Deps, is_admin: bool) -> Result<Coin, StdError> {
if is_admin {
return Ok(coin(
factory_params.extension.airdrop_mint_price.amount.u128(),
config.mint_price.denom,
factory_params.extension.airdrop_mint_price.denom,
));
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/minters/vending-minter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ fn _execute_mint(

let mint_price: Coin = mint_price(deps.as_ref(), is_admin)?;
// Exact payment only accepted
let payment = may_pay(&info, &config.mint_price.denom)?;
let payment = may_pay(&info, &mint_price.denom)?;
if payment != mint_price.amount {
return Err(ContractError::IncorrectPaymentAmount(
coin(payment.u128(), &config.mint_price.denom),
Expand Down Expand Up @@ -1045,7 +1045,7 @@ pub fn mint_price(deps: Deps, is_admin: bool) -> Result<Coin, StdError> {
if is_admin {
return Ok(coin(
factory_params.extension.airdrop_mint_price.amount.u128(),
config.mint_price.denom,
factory_params.extension.airdrop_mint_price.denom,
));
}

Expand Down