From f6e726a82f6cb0662d7e3d6323aa6c0b0d1f0513 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Wed, 25 Sep 2024 20:37:23 +0300 Subject: [PATCH 01/12] Update migration logic for sg721-metadata-onchain --- Cargo.lock | 1 + .../sg721-metadata-onchain/Cargo.toml | 1 + .../sg721-metadata-onchain/src/lib.rs | 55 ++++++++++++++----- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0466c0804..26f716347 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3754,6 +3754,7 @@ dependencies = [ "cw721 0.18.0", "cw721-base 0.18.0", "schemars", + "semver", "serde", "sg-metadata", "sg-std", diff --git a/contracts/collections/sg721-metadata-onchain/Cargo.toml b/contracts/collections/sg721-metadata-onchain/Cargo.toml index 6a1f51856..b55165039 100644 --- a/contracts/collections/sg721-metadata-onchain/Cargo.toml +++ b/contracts/collections/sg721-metadata-onchain/Cargo.toml @@ -40,6 +40,7 @@ sg-metadata = { workspace = true } sg-std = { workspace = true } cw-ownable = { workspace = true } cw721-base = { workspace = true, features = ["library"] } +semver = { workspace = true } [dev-dependencies] cw721 = { workspace = true } diff --git a/contracts/collections/sg721-metadata-onchain/src/lib.rs b/contracts/collections/sg721-metadata-onchain/src/lib.rs index 3cc1d5f04..0e8b6bd69 100644 --- a/contracts/collections/sg721-metadata-onchain/src/lib.rs +++ b/contracts/collections/sg721-metadata-onchain/src/lib.rs @@ -16,12 +16,14 @@ pub const TO_VERSION: &str = "3.0.0"; pub type Extension = Option; -#[cfg(not(feature = "library"))] +// #[cfg(not(feature = "library"))] pub mod entry { use super::*; - use cosmwasm_std::{entry_point, Binary, Deps, DepsMut, Env, MessageInfo, StdError, StdResult}; - + use cosmwasm_std::{ + entry_point, Binary, Deps, DepsMut, Env, Event, MessageInfo, StdError, StdResult, + }; + use semver::Version; use sg721_base::{msg::QueryMsg, ContractError}; use sg_std::Response; @@ -57,33 +59,58 @@ pub mod entry { } #[entry_point] - pub fn migrate(deps: DepsMut, _env: Env, _msg: Empty) -> Result { + pub fn migrate(mut deps: DepsMut, env: Env, _msg: Empty) -> Result { // make sure the correct contract is being upgraded, and it's being // upgraded from the correct version. - if CONTRACT_VERSION < EARLIEST_VERSION { + let prev_contract_info = cw2::get_contract_version(deps.storage)?; + let prev_contract_name: String = prev_contract_info.contract; + let prev_contract_version: Version = prev_contract_info + .version + .parse() + .map_err(|_| StdError::generic_err("Unable to retrieve previous contract version"))?; + + let new_version: Version = CONTRACT_VERSION + .parse() + .map_err(|_| StdError::generic_err("Invalid contract version"))?; + + let earliest_version: Version = EARLIEST_VERSION + .parse() + .map_err(|_| StdError::generic_err("Invalid contract version"))?; + + if prev_contract_version < earliest_version { return Err( - StdError::generic_err("Cannot upgrade to a previous contract version").into(), + StdError::generic_err("The contract version is too old to be upgraded").into(), ); } - if CONTRACT_VERSION > TO_VERSION { + if new_version < prev_contract_version { return Err( StdError::generic_err("Cannot upgrade to a previous contract version").into(), ); } // if same version return - if CONTRACT_VERSION == TO_VERSION { + if new_version == prev_contract_version { return Ok(Response::new()); } // update contract version cw2::set_contract_version(deps.storage, CONTRACT_NAME, TO_VERSION)?; - // perform the upgrade - let cw17_res = cw721_base::upgrades::v0_17::migrate::(deps) - .map_err(|e| sg721_base::ContractError::MigrationError(e.to_string()))?; - let mut sgz_res = Response::new(); - sgz_res.attributes = cw17_res.attributes; - Ok(sgz_res) + let mut response = Response::new(); + + #[allow(clippy::cmp_owned)] + if prev_contract_version < Version::new(3, 0, 0) { + // perform the upgrade + response = sg721_base::upgrades::v3_0_0::upgrade(deps.branch(), &env, response)?; + } + response = response.add_event( + Event::new("migrate") + .add_attribute("from_name", prev_contract_name) + .add_attribute("from_version", prev_contract_version.to_string()) + .add_attribute("to_name", CONTRACT_NAME) + .add_attribute("to_version", CONTRACT_VERSION), + ); + + Ok(response) } } From 0f7e153eefe418b2b490f92f6a4322892b9b9a91 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Wed, 25 Sep 2024 20:38:33 +0300 Subject: [PATCH 02/12] Ignore entry points when necessary --- contracts/collections/sg721-metadata-onchain/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/collections/sg721-metadata-onchain/src/lib.rs b/contracts/collections/sg721-metadata-onchain/src/lib.rs index 0e8b6bd69..291f9a8ea 100644 --- a/contracts/collections/sg721-metadata-onchain/src/lib.rs +++ b/contracts/collections/sg721-metadata-onchain/src/lib.rs @@ -16,7 +16,7 @@ pub const TO_VERSION: &str = "3.0.0"; pub type Extension = Option; -// #[cfg(not(feature = "library"))] +#[cfg(not(feature = "library"))] pub mod entry { use super::*; From df1e4441b853cdc96a5eb60eaabbddcd91829fe6 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 16:17:54 +0300 Subject: [PATCH 03/12] Add distribute_mint_fees() --- packages/sg1/src/lib.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/packages/sg1/src/lib.rs b/packages/sg1/src/lib.rs index 40ade39c7..107ec0c65 100644 --- a/packages/sg1/src/lib.rs +++ b/packages/sg1/src/lib.rs @@ -10,6 +10,8 @@ const FEE_BURN_PERCENT: u64 = 50; const FOUNDATION: &str = "stars1xqz6xujjyz0r9uzn7srasle5uynmpa0zkjr5l8"; const LAUNCHPAD_DAO_ADDRESS: &str = "stars1huqk6ha02jgrm69lxh8xfgl6wch9wlg7s65ujxydwdr725cxvuus423tj0"; +const LIQUIDITY_DAO_ADDRESS: &str = + "stars12he2ldxl950wfypvelqwkac4mdul7clzgd8wdlnmjvll8z2cc47qsatvl2"; /// Burn and distribute fees and return an error if the fee is not enough pub fn checked_fair_burn( @@ -74,6 +76,42 @@ pub fn ibc_denom_fair_burn( Ok(()) } +pub fn distribute_mint_fees( + fee: Coin, + res: &mut Response, + is_featured: bool, +) -> Result<(), FeeError> { + let liquidity_dao_ratio: Decimal = Decimal::from_ratio(1u128, 5u128); + let liquidity_dao_ratio_featured: Decimal = Decimal::from_ratio(1u128, 8u128); + + let mut event = Event::new("fee-distribution"); + let liquidity_dao_ratio = if is_featured { + liquidity_dao_ratio_featured + } else { + liquidity_dao_ratio + }; + + let liquidity_dao_fee = (fee.amount.mul_ceil(liquidity_dao_ratio)).u128(); + let liquidity_dao_coin = coin(liquidity_dao_fee, fee.denom.to_string()); + let foundation_coin = coin(fee.amount.u128() - liquidity_dao_fee, fee.denom); + + event = event.add_attribute("liquidity_DAO_addr", LIQUIDITY_DAO_ADDRESS.to_string()); + event = event.add_attribute("liquidity_DAO_coin", liquidity_dao_coin.to_string()); + event = event.add_attribute("foundation_coin", foundation_coin.to_string()); + + res.messages.push(SubMsg::new(BankMsg::Send { + to_address: LIQUIDITY_DAO_ADDRESS.to_string(), + amount: vec![liquidity_dao_coin], + })); + res.messages.push(SubMsg::new(BankMsg::Send { + to_address: FOUNDATION.to_string(), + amount: vec![foundation_coin], + })); + + res.events.push(event); + Ok(()) +} + /// Burn and distribute fees, assuming the right fee is passed in pub fn fair_burn(fee: u128, developer: Option, res: &mut Response) { let mut event = Event::new("fair-burn"); From f780f60d707cae1279cdb94dd1d38b25fd744ef3 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 16:18:24 +0300 Subject: [PATCH 04/12] Update mint fee distribution for vending_minter --- .../minters/vending-minter/src/contract.rs | 22 +++++++------------ .../setup_minter/common/constants.rs | 2 ++ .../vending_minter/tests/ibc_asset_mint.rs | 9 ++++++-- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/contracts/minters/vending-minter/src/contract.rs b/contracts/minters/vending-minter/src/contract.rs index fcd73ce7d..2a0f154b8 100644 --- a/contracts/minters/vending-minter/src/contract.rs +++ b/contracts/minters/vending-minter/src/contract.rs @@ -21,11 +21,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, ibc_denom_fair_burn}; +use sg1::{checked_fair_burn, distribute_mint_fees}; 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, NATIVE_DENOM}; +use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME}; use sg_whitelist::msg::{ ConfigResponse as WhitelistConfigResponse, HasMemberResponse, QueryMsg as WhitelistQueryMsg, }; @@ -662,18 +662,12 @@ fn _execute_mint( let network_fee = mint_price.amount * mint_fee; - // send non-native fees to community pool - 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)?; + if !network_fee.is_zero() { + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + false, + )?; } let mintable_token_mapping = match token_id { diff --git a/test-suite/src/common_setup/setup_minter/common/constants.rs b/test-suite/src/common_setup/setup_minter/common/constants.rs index b9b20eabf..844cc1a15 100644 --- a/test-suite/src/common_setup/setup_minter/common/constants.rs +++ b/test-suite/src/common_setup/setup_minter/common/constants.rs @@ -13,3 +13,5 @@ pub const MAX_PER_ADDRESS_LIMIT: u32 = 50; pub const DEV_ADDRESS: &str = "stars1abcd4kdla12mh86psg4y4h6hh05g2hmqoap350"; pub const MIN_MINT_PRICE_OPEN_EDITION: u128 = 100_000_000; pub const FOUNDATION: &str = "stars1xqz6xujjyz0r9uzn7srasle5uynmpa0zkjr5l8"; +pub const LIQUIDITY_DAO_ADDRESS: &str = + "stars12he2ldxl950wfypvelqwkac4mdul7clzgd8wdlnmjvll8z2cc47qsatvl2"; diff --git a/test-suite/src/vending_minter/tests/ibc_asset_mint.rs b/test-suite/src/vending_minter/tests/ibc_asset_mint.rs index 661605737..249ec3bf8 100644 --- a/test-suite/src/vending_minter/tests/ibc_asset_mint.rs +++ b/test-suite/src/vending_minter/tests/ibc_asset_mint.rs @@ -24,7 +24,7 @@ use crate::common_setup::{ templates::{vending_minter_template, vending_minter_with_ibc_asset}, }; -use crate::common_setup::setup_minter::common::constants::CREATION_FEE; +use crate::common_setup::setup_minter::common::constants::{CREATION_FEE, LIQUIDITY_DAO_ADDRESS}; use crate::common_setup::setup_minter::vending_minter::mock_params::mock_params; #[test] @@ -259,5 +259,10 @@ fn wl_denom_mint() { .wrap() .query_balance(Addr::unchecked(FOUNDATION), denom) .unwrap(); - assert_eq!(balance.amount, wl_mint_price.amount * Decimal::percent(10)); + assert_eq!(balance.amount, wl_mint_price.amount * Decimal::percent(8)); + let balance = app + .wrap() + .query_balance(Addr::unchecked(LIQUIDITY_DAO_ADDRESS), denom) + .unwrap(); + assert_eq!(balance.amount, wl_mint_price.amount * Decimal::percent(2)); } From 9bf4f6f73a942c1c2cbbf5ea45b4e00d377bb612 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 16:41:56 +0300 Subject: [PATCH 05/12] Update distribute_mint_fees() --- packages/sg1/src/lib.rs | 69 +++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/packages/sg1/src/lib.rs b/packages/sg1/src/lib.rs index 107ec0c65..3c1732445 100644 --- a/packages/sg1/src/lib.rs +++ b/packages/sg1/src/lib.rs @@ -80,33 +80,68 @@ pub fn distribute_mint_fees( fee: Coin, res: &mut Response, is_featured: bool, + developer: Option, ) -> Result<(), FeeError> { let liquidity_dao_ratio: Decimal = Decimal::from_ratio(1u128, 5u128); let liquidity_dao_ratio_featured: Decimal = Decimal::from_ratio(1u128, 8u128); - let mut event = Event::new("fee-distribution"); + let mut event = Event::new("mint-fee-distribution"); let liquidity_dao_ratio = if is_featured { liquidity_dao_ratio_featured } else { liquidity_dao_ratio }; - let liquidity_dao_fee = (fee.amount.mul_ceil(liquidity_dao_ratio)).u128(); - let liquidity_dao_coin = coin(liquidity_dao_fee, fee.denom.to_string()); - let foundation_coin = coin(fee.amount.u128() - liquidity_dao_fee, fee.denom); - - event = event.add_attribute("liquidity_DAO_addr", LIQUIDITY_DAO_ADDRESS.to_string()); - event = event.add_attribute("liquidity_DAO_coin", liquidity_dao_coin.to_string()); - event = event.add_attribute("foundation_coin", foundation_coin.to_string()); - - res.messages.push(SubMsg::new(BankMsg::Send { - to_address: LIQUIDITY_DAO_ADDRESS.to_string(), - amount: vec![liquidity_dao_coin], - })); - res.messages.push(SubMsg::new(BankMsg::Send { - to_address: FOUNDATION.to_string(), - amount: vec![foundation_coin], - })); + match &developer { + Some(developer) => { + let dev_fee = (fee.amount.mul_ceil(Decimal::percent(FEE_BURN_PERCENT))).u128(); + let dev_coin = coin(dev_fee, fee.denom.to_string()); + let remaining_coin = coin(fee.amount.u128() - dev_fee, fee.denom.clone()); + + let liquidity_dao_fee = (remaining_coin.amount.mul_ceil(liquidity_dao_ratio)).u128(); + let liquidity_dao_coin = coin(liquidity_dao_fee, fee.denom.to_string()); + let foundation_coin = coin(remaining_coin.amount.u128() - liquidity_dao_fee, fee.denom); + + event = event.add_attribute("dev_addr", developer.to_string()); + event = event.add_attribute("dev_coin", dev_coin.to_string()); + event = event.add_attribute("liquidity_DAO_addr", LIQUIDITY_DAO_ADDRESS.to_string()); + event = event.add_attribute("liquidity_DAO_coin", liquidity_dao_coin.to_string()); + event = event.add_attribute("foundation_addr", FOUNDATION.to_string()); + event = event.add_attribute("foundation_coin", foundation_coin.to_string()); + + res.messages.push(SubMsg::new(BankMsg::Send { + to_address: developer.to_string(), + amount: vec![dev_coin], + })); + res.messages.push(SubMsg::new(BankMsg::Send { + to_address: LIQUIDITY_DAO_ADDRESS.to_string(), + amount: vec![liquidity_dao_coin], + })); + res.messages.push(SubMsg::new(BankMsg::Send { + to_address: FOUNDATION.to_string(), + amount: vec![foundation_coin], + })); + } + None => { + let liquidity_dao_fee = (fee.amount.mul_ceil(liquidity_dao_ratio)).u128(); + let liquidity_dao_coin = coin(liquidity_dao_fee, fee.denom.to_string()); + let foundation_coin = coin(fee.amount.u128() - liquidity_dao_fee, fee.denom); + + event = event.add_attribute("liquidity_DAO_addr", LIQUIDITY_DAO_ADDRESS.to_string()); + event = event.add_attribute("liquidity_DAO_coin", liquidity_dao_coin.to_string()); + event = event.add_attribute("foundation_addr", FOUNDATION.to_string()); + event = event.add_attribute("foundation_coin", foundation_coin.to_string()); + + res.messages.push(SubMsg::new(BankMsg::Send { + to_address: LIQUIDITY_DAO_ADDRESS.to_string(), + amount: vec![liquidity_dao_coin], + })); + res.messages.push(SubMsg::new(BankMsg::Send { + to_address: FOUNDATION.to_string(), + amount: vec![foundation_coin], + })); + } + } res.events.push(event); Ok(()) From 57dedbcd353dd3126ee3219751749eff3738cb73 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 16:55:59 +0300 Subject: [PATCH 06/12] Update mint fee distribution logic for the rest of the minters --- .../src/contract.rs | 29 +++++-------------- .../src/contract.rs | 29 +++++-------------- .../open-edition-minter/src/contract.rs | 29 +++++-------------- .../vending-minter-featured/src/contract.rs | 15 +++++----- .../src/contract.rs | 14 ++++----- .../vending-minter-merkle-wl/src/contract.rs | 23 ++++++--------- .../src/contract.rs | 14 ++++----- .../vending-minter-wl-flex/src/contract.rs | 24 +++++++-------- .../minters/vending-minter/src/contract.rs | 1 + packages/sg1/src/lib.rs | 8 +++-- .../tests/ibc_asset_mint.rs | 9 +++++- 11 files changed, 75 insertions(+), 120 deletions(-) diff --git a/contracts/minters/open-edition-minter-merkle-wl/src/contract.rs b/contracts/minters/open-edition-minter-merkle-wl/src/contract.rs index 94a02e82c..4296cdede 100644 --- a/contracts/minters/open-edition-minter-merkle-wl/src/contract.rs +++ b/contracts/minters/open-edition-minter-merkle-wl/src/contract.rs @@ -20,11 +20,11 @@ use open_edition_factory::msg::{OpenEditionMinterCreateMsg, ParamsResponse}; use open_edition_factory::state::OpenEditionMinterParams; use open_edition_factory::types::NftMetadataType; use semver::Version; -use sg1::{checked_fair_burn, ibc_denom_fair_burn}; +use sg1::distribute_mint_fees; use sg2::query::Sg2QueryMsg; use sg4::{MinterConfig, Status, StatusResponse, SudoMsg}; use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg}; -use sg_std::{StargazeMsgWrapper, NATIVE_DENOM}; +use sg_std::StargazeMsgWrapper; use url::Url; use whitelist_mtree::msg::{ ConfigResponse as WhitelistConfigResponse, HasMemberResponse, QueryMsg as WhitelistQueryMsg, @@ -525,30 +525,15 @@ fn _execute_mint( }; let network_fee = mint_price.amount * mint_fee; - // This is for the network fee msg - // send non-native fees to community pool - if mint_price.denom != NATIVE_DENOM { - // only send non-zero amounts - // send portion to dev addr - if !network_fee.is_zero() { - ibc_denom_fair_burn( - coin(network_fee.u128(), mint_price.denom.to_string()), - Some( - deps.api - .addr_validate(&factory_params.extension.dev_fee_address)?, - ), - &mut res, - )?; - } - } else if !network_fee.is_zero() { - checked_fair_burn( - &info, - network_fee.u128(), + if !network_fee.is_zero() { + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + false, Some( deps.api .addr_validate(&factory_params.extension.dev_fee_address)?, ), - &mut res, )?; } diff --git a/contracts/minters/open-edition-minter-wl-flex/src/contract.rs b/contracts/minters/open-edition-minter-wl-flex/src/contract.rs index 9c4f7e382..432ee74d5 100644 --- a/contracts/minters/open-edition-minter-wl-flex/src/contract.rs +++ b/contracts/minters/open-edition-minter-wl-flex/src/contract.rs @@ -20,11 +20,11 @@ use open_edition_factory::msg::{OpenEditionMinterCreateMsg, ParamsResponse}; use open_edition_factory::state::OpenEditionMinterParams; use open_edition_factory::types::NftMetadataType; use semver::Version; -use sg1::{checked_fair_burn, ibc_denom_fair_burn}; +use sg1::distribute_mint_fees; use sg2::query::Sg2QueryMsg; use sg4::{MinterConfig, Status, StatusResponse, SudoMsg}; use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg}; -use sg_std::{StargazeMsgWrapper, NATIVE_DENOM}; +use sg_std::StargazeMsgWrapper; use sg_whitelist_flex::msg::{ ConfigResponse as WhitelistConfigResponse, HasMemberResponse, Member, QueryMsg as WhitelistQueryMsg, @@ -528,30 +528,15 @@ fn _execute_mint( }; let network_fee = mint_price.amount * mint_fee; - // This is for the network fee msg - // send non-native fees to community pool - if mint_price.denom != NATIVE_DENOM { - // only send non-zero amounts - // send portion to dev addr - if !network_fee.is_zero() { - ibc_denom_fair_burn( - coin(network_fee.u128(), mint_price.denom.to_string()), - Some( - deps.api - .addr_validate(&factory_params.extension.dev_fee_address)?, - ), - &mut res, - )?; - } - } else if !network_fee.is_zero() { - checked_fair_burn( - &info, - network_fee.u128(), + if !network_fee.is_zero() { + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + false, Some( deps.api .addr_validate(&factory_params.extension.dev_fee_address)?, ), - &mut res, )?; } diff --git a/contracts/minters/open-edition-minter/src/contract.rs b/contracts/minters/open-edition-minter/src/contract.rs index caedb3177..331a7b5e2 100644 --- a/contracts/minters/open-edition-minter/src/contract.rs +++ b/contracts/minters/open-edition-minter/src/contract.rs @@ -20,11 +20,11 @@ use open_edition_factory::msg::{OpenEditionMinterCreateMsg, ParamsResponse}; use open_edition_factory::state::OpenEditionMinterParams; use open_edition_factory::types::NftMetadataType; use semver::Version; -use sg1::{checked_fair_burn, ibc_denom_fair_burn}; +use sg1::distribute_mint_fees; use sg2::query::Sg2QueryMsg; use sg4::{MinterConfig, Status, StatusResponse, SudoMsg}; use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg}; -use sg_std::{StargazeMsgWrapper, NATIVE_DENOM}; +use sg_std::StargazeMsgWrapper; use sg_whitelist::msg::{ ConfigResponse as WhitelistConfigResponse, HasMemberResponse, QueryMsg as WhitelistQueryMsg, }; @@ -502,30 +502,15 @@ fn _execute_mint( }; let network_fee = mint_price.amount * mint_fee; - // This is for the network fee msg - // send non-native fees to community pool - if mint_price.denom != NATIVE_DENOM { - // only send non-zero amounts - // send portion to dev addr - if !network_fee.is_zero() { - ibc_denom_fair_burn( - coin(network_fee.u128(), mint_price.denom.to_string()), - Some( - deps.api - .addr_validate(&factory_params.extension.dev_fee_address)?, - ), - &mut res, - )?; - } - } else if !network_fee.is_zero() { - checked_fair_burn( - &info, - network_fee.u128(), + if !network_fee.is_zero() { + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + false, Some( deps.api .addr_validate(&factory_params.extension.dev_fee_address)?, ), - &mut res, )?; } diff --git a/contracts/minters/vending-minter-featured/src/contract.rs b/contracts/minters/vending-minter-featured/src/contract.rs index 04575ece3..0fef9809d 100644 --- a/contracts/minters/vending-minter-featured/src/contract.rs +++ b/contracts/minters/vending-minter-featured/src/contract.rs @@ -21,7 +21,7 @@ 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, distribute_mint_fees}; use sg2::query::Sg2QueryMsg; use sg4::{MinterConfig, Status, StatusResponse, SudoMsg}; use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg}; @@ -664,14 +664,13 @@ fn _execute_mint( let network_fee = mint_price.amount * mint_fee; - // send non-native fees to community pool - let pa_dao = "stars159t8e03zlmgyekmdrpxnyf70rdky28v553kj53zsapqadaunt4wsmn5m3l".to_string(); - if !network_fee.is_zero() { - res = res.add_message(BankMsg::Send { - to_address: pa_dao.to_string(), - amount: vec![coin(network_fee.u128(), mint_price.denom.clone())], - }); + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + true, + None, + )?; } let mintable_token_mapping = match token_id { diff --git a/contracts/minters/vending-minter-merkle-wl-featured/src/contract.rs b/contracts/minters/vending-minter-merkle-wl-featured/src/contract.rs index 008ff1cb5..0d6829f91 100644 --- a/contracts/minters/vending-minter-merkle-wl-featured/src/contract.rs +++ b/contracts/minters/vending-minter-merkle-wl-featured/src/contract.rs @@ -21,7 +21,7 @@ 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, distribute_mint_fees}; use sg2::query::Sg2QueryMsg; use sg4::{MinterConfig, Status, StatusResponse, SudoMsg}; use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg}; @@ -701,13 +701,13 @@ fn _execute_mint( let network_fee = mint_price.amount * mint_fee; - let pa_dao = "stars159t8e03zlmgyekmdrpxnyf70rdky28v553kj53zsapqadaunt4wsmn5m3l".to_string(); - if !network_fee.is_zero() { - res = res.add_message(BankMsg::Send { - to_address: pa_dao.to_string(), - amount: vec![coin(network_fee.u128(), mint_price.denom.clone())], - }); + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + true, + None, + )?; } let mintable_token_mapping = match token_id { diff --git a/contracts/minters/vending-minter-merkle-wl/src/contract.rs b/contracts/minters/vending-minter-merkle-wl/src/contract.rs index 4e7ea5770..8ebebb73d 100644 --- a/contracts/minters/vending-minter-merkle-wl/src/contract.rs +++ b/contracts/minters/vending-minter-merkle-wl/src/contract.rs @@ -21,11 +21,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, ibc_denom_fair_burn}; +use sg1::{checked_fair_burn, distribute_mint_fees}; 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, NATIVE_DENOM}; +use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME}; use sg_whitelist::msg::{ ConfigResponse as WhitelistConfigResponse, HasMemberResponse, QueryMsg as WhitelistQueryMsg, }; @@ -701,18 +701,13 @@ fn _execute_mint( let network_fee = mint_price.amount * mint_fee; - // send non-native fees to community pool - 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)?; + if !network_fee.is_zero() { + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + false, + None, + )?; } let mintable_token_mapping = match token_id { diff --git a/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs b/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs index 0122e8bbf..59ccff792 100644 --- a/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs +++ b/contracts/minters/vending-minter-wl-flex-featured/src/contract.rs @@ -20,7 +20,7 @@ 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, distribute_mint_fees}; use sg2::query::Sg2QueryMsg; use sg4::{MinterConfig, Status, StatusResponse, SudoMsg}; use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg}; @@ -656,13 +656,13 @@ fn _execute_mint( }; let network_fee = mint_price.amount * mint_fee; - let pa_dao = "stars159t8e03zlmgyekmdrpxnyf70rdky28v553kj53zsapqadaunt4wsmn5m3l".to_string(); - if !network_fee.is_zero() { - res = res.add_message(BankMsg::Send { - to_address: pa_dao.to_string(), - amount: vec![coin(network_fee.u128(), mint_price.denom.clone())], - }); + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + true, + None, + )?; } let mintable_token_mapping = match token_id { diff --git a/contracts/minters/vending-minter-wl-flex/src/contract.rs b/contracts/minters/vending-minter-wl-flex/src/contract.rs index 2c0f80704..611e55aaf 100644 --- a/contracts/minters/vending-minter-wl-flex/src/contract.rs +++ b/contracts/minters/vending-minter-wl-flex/src/contract.rs @@ -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, ibc_denom_fair_burn}; +use sg1::{checked_fair_burn, distribute_mint_fees}; 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, NATIVE_DENOM}; +use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME}; use sg_whitelist_flex::msg::{ ConfigResponse as WhitelistConfigResponse, HasMemberResponse, Member, QueryMsg as WhitelistQueryMsg, @@ -654,18 +654,14 @@ fn _execute_mint( Decimal::bps(factory_params.mint_fee_bps) }; let network_fee = mint_price.amount * mint_fee; - // 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)?; + + if !network_fee.is_zero() { + distribute_mint_fees( + coin(network_fee.u128(), mint_price.clone().denom), + &mut res, + false, + None, + )?; } let mintable_token_mapping = match token_id { diff --git a/contracts/minters/vending-minter/src/contract.rs b/contracts/minters/vending-minter/src/contract.rs index 2a0f154b8..a223f40c1 100644 --- a/contracts/minters/vending-minter/src/contract.rs +++ b/contracts/minters/vending-minter/src/contract.rs @@ -667,6 +667,7 @@ fn _execute_mint( coin(network_fee.u128(), mint_price.clone().denom), &mut res, false, + None, )?; } diff --git a/packages/sg1/src/lib.rs b/packages/sg1/src/lib.rs index 3c1732445..4e58e42e1 100644 --- a/packages/sg1/src/lib.rs +++ b/packages/sg1/src/lib.rs @@ -86,7 +86,8 @@ pub fn distribute_mint_fees( let liquidity_dao_ratio_featured: Decimal = Decimal::from_ratio(1u128, 8u128); let mut event = Event::new("mint-fee-distribution"); - let liquidity_dao_ratio = if is_featured { + + let liquidity_dao_percentage = if is_featured { liquidity_dao_ratio_featured } else { liquidity_dao_ratio @@ -98,7 +99,8 @@ pub fn distribute_mint_fees( let dev_coin = coin(dev_fee, fee.denom.to_string()); let remaining_coin = coin(fee.amount.u128() - dev_fee, fee.denom.clone()); - let liquidity_dao_fee = (remaining_coin.amount.mul_ceil(liquidity_dao_ratio)).u128(); + let liquidity_dao_fee = + (remaining_coin.amount.mul_ceil(liquidity_dao_percentage)).u128(); let liquidity_dao_coin = coin(liquidity_dao_fee, fee.denom.to_string()); let foundation_coin = coin(remaining_coin.amount.u128() - liquidity_dao_fee, fee.denom); @@ -123,7 +125,7 @@ pub fn distribute_mint_fees( })); } None => { - let liquidity_dao_fee = (fee.amount.mul_ceil(liquidity_dao_ratio)).u128(); + let liquidity_dao_fee = (fee.amount.mul_ceil(liquidity_dao_percentage)).u128(); let liquidity_dao_coin = coin(liquidity_dao_fee, fee.denom.to_string()); let foundation_coin = coin(fee.amount.u128() - liquidity_dao_fee, fee.denom); diff --git a/test-suite/src/open_edition_minter/tests/ibc_asset_mint.rs b/test-suite/src/open_edition_minter/tests/ibc_asset_mint.rs index 58a50df46..43c61c03b 100644 --- a/test-suite/src/open_edition_minter/tests/ibc_asset_mint.rs +++ b/test-suite/src/open_edition_minter/tests/ibc_asset_mint.rs @@ -4,6 +4,7 @@ use open_edition_factory::state::{OpenEditionMinterParams, ParamsExtension}; use open_edition_minter::msg::ExecuteMsg; use sg_std::{GENESIS_MINT_START_TIME, NATIVE_DENOM}; +use crate::common_setup::setup_minter::common::constants::LIQUIDITY_DAO_ADDRESS; use crate::common_setup::{ setup_accounts_and_block::setup_block_time, setup_minter::{ @@ -172,7 +173,13 @@ fn one_hundred_percent_burned_ibc_minter() { .wrap() .query_balance(Addr::unchecked(FOUNDATION), denom) .unwrap(); - assert_eq!(balance.amount, mint_price.amount * Decimal::percent(50)); + assert_eq!(balance.amount, mint_price.amount * Decimal::percent(40)); + + let balance = router + .wrap() + .query_balance(Addr::unchecked(LIQUIDITY_DAO_ADDRESS), denom) + .unwrap(); + assert_eq!(balance.amount, mint_price.amount * Decimal::percent(10)); } #[test] From 1a7078f59a94e61c0f5a743b60f843ff9357dd9f Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 17:49:26 +0300 Subject: [PATCH 07/12] Update e2e tests --- e2e/src/tests/factory_test.rs | 6 +++--- .../tests/open_edition_factory_and_mint_tests.rs | 13 ++++++++++++- packages/sg1/src/lib.rs | 6 +++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/e2e/src/tests/factory_test.rs b/e2e/src/tests/factory_test.rs index 9d8c35a0e..b8f2d8af3 100644 --- a/e2e/src/tests/factory_test.rs +++ b/e2e/src/tests/factory_test.rs @@ -339,9 +339,9 @@ fn test_start_trading_time(chain: &mut Chain) { assert_eq!(balance.amount, init_balance.amount + 9_000_000_000); // fairburn fees - // half of the 10% fees should be sent to fairburn pool - // 500STARS + 500STARS initially sent for collection creation fee - assert_eq!(total_fairburn_fees, 1_000_000_000); + // fairburn pool should remain unchanged + // 500STARS initially sent for collection creation fee + assert_eq!(total_fairburn_fees, 500_000_000); let total_supply = tokio_block(chain.orc.client.bank_query_supply(denom.parse().unwrap())) .unwrap() diff --git a/e2e/src/tests/open_edition_factory_and_mint_tests.rs b/e2e/src/tests/open_edition_factory_and_mint_tests.rs index 994148843..f5b9e014b 100644 --- a/e2e/src/tests/open_edition_factory_and_mint_tests.rs +++ b/e2e/src/tests/open_edition_factory_and_mint_tests.rs @@ -523,7 +523,7 @@ fn test_start_trading_time(chain: &mut Chain) { total_fairburn_fees += amount.parse::().unwrap(); } - let dev_fees = res + let mut dev_fees = res .res .find_event_tags("wasm-fair-burn".to_string(), "dev_amount".to_string()); @@ -531,6 +531,17 @@ fn test_start_trading_time(chain: &mut Chain) { let amount = fee.value.split(&denom).collect::>()[0]; total_dev_fees += amount.parse::().unwrap(); } + + if (total_dev_fees == 0) { + dev_fees = res + .res + .find_event_tags("mint-fee-distribution".to_string(), "dev_amount".to_string()); + + for fee in dev_fees { + let amount = fee.value.split(&denom).collect::>()[0]; + total_dev_fees += amount.parse::().unwrap(); + } + } } // 200 mints at 100_000_000 * 0.1 * 0.5 = 1_000_000_000 diff --git a/packages/sg1/src/lib.rs b/packages/sg1/src/lib.rs index 4e58e42e1..581b006a1 100644 --- a/packages/sg1/src/lib.rs +++ b/packages/sg1/src/lib.rs @@ -95,7 +95,7 @@ pub fn distribute_mint_fees( match &developer { Some(developer) => { - let dev_fee = (fee.amount.mul_ceil(Decimal::percent(FEE_BURN_PERCENT))).u128(); + let dev_fee = fee.amount.mul_ceil(Decimal::percent(FEE_BURN_PERCENT)).u128(); let dev_coin = coin(dev_fee, fee.denom.to_string()); let remaining_coin = coin(fee.amount.u128() - dev_fee, fee.denom.clone()); @@ -105,7 +105,7 @@ pub fn distribute_mint_fees( let foundation_coin = coin(remaining_coin.amount.u128() - liquidity_dao_fee, fee.denom); event = event.add_attribute("dev_addr", developer.to_string()); - event = event.add_attribute("dev_coin", dev_coin.to_string()); + event = event.add_attribute("dev_amount", dev_coin.amount.to_string()); event = event.add_attribute("liquidity_DAO_addr", LIQUIDITY_DAO_ADDRESS.to_string()); event = event.add_attribute("liquidity_DAO_coin", liquidity_dao_coin.to_string()); event = event.add_attribute("foundation_addr", FOUNDATION.to_string()); @@ -125,7 +125,7 @@ pub fn distribute_mint_fees( })); } None => { - let liquidity_dao_fee = (fee.amount.mul_ceil(liquidity_dao_percentage)).u128(); + let liquidity_dao_fee = fee.amount.mul_ceil(liquidity_dao_percentage).u128(); let liquidity_dao_coin = coin(liquidity_dao_fee, fee.denom.to_string()); let foundation_coin = coin(fee.amount.u128() - liquidity_dao_fee, fee.denom); From 929d10484a4ab3a7c778fdf4d07f1c1d458d9f7e Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 17:50:23 +0300 Subject: [PATCH 08/12] cargo fmt --- e2e/src/tests/open_edition_factory_and_mint_tests.rs | 7 ++++--- packages/sg1/src/lib.rs | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/e2e/src/tests/open_edition_factory_and_mint_tests.rs b/e2e/src/tests/open_edition_factory_and_mint_tests.rs index f5b9e014b..e413d7622 100644 --- a/e2e/src/tests/open_edition_factory_and_mint_tests.rs +++ b/e2e/src/tests/open_edition_factory_and_mint_tests.rs @@ -533,9 +533,10 @@ fn test_start_trading_time(chain: &mut Chain) { } if (total_dev_fees == 0) { - dev_fees = res - .res - .find_event_tags("mint-fee-distribution".to_string(), "dev_amount".to_string()); + dev_fees = res.res.find_event_tags( + "mint-fee-distribution".to_string(), + "dev_amount".to_string(), + ); for fee in dev_fees { let amount = fee.value.split(&denom).collect::>()[0]; diff --git a/packages/sg1/src/lib.rs b/packages/sg1/src/lib.rs index 581b006a1..7a3a1f09b 100644 --- a/packages/sg1/src/lib.rs +++ b/packages/sg1/src/lib.rs @@ -95,7 +95,10 @@ pub fn distribute_mint_fees( match &developer { Some(developer) => { - let dev_fee = fee.amount.mul_ceil(Decimal::percent(FEE_BURN_PERCENT)).u128(); + let dev_fee = fee + .amount + .mul_ceil(Decimal::percent(FEE_BURN_PERCENT)) + .u128(); let dev_coin = coin(dev_fee, fee.denom.to_string()); let remaining_coin = coin(fee.amount.u128() - dev_fee, fee.denom.clone()); From df46b8ccfb88dabf02c718c784510b8c8b0ecf95 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 18:47:20 +0300 Subject: [PATCH 09/12] Update e2e tests --- e2e/src/tests/factory_test.rs | 2 +- .../open_edition_factory_and_mint_tests.rs | 20 +++++-------------- packages/sg1/src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/e2e/src/tests/factory_test.rs b/e2e/src/tests/factory_test.rs index b8f2d8af3..d52319ad7 100644 --- a/e2e/src/tests/factory_test.rs +++ b/e2e/src/tests/factory_test.rs @@ -349,7 +349,7 @@ fn test_start_trading_time(chain: &mut Chain) { // the other half burned assert_eq!( - initial_total_supply.amount - 1_000_000_000, + initial_total_supply.amount - 500_000_000, total_supply.amount ); } diff --git a/e2e/src/tests/open_edition_factory_and_mint_tests.rs b/e2e/src/tests/open_edition_factory_and_mint_tests.rs index e413d7622..33faef009 100644 --- a/e2e/src/tests/open_edition_factory_and_mint_tests.rs +++ b/e2e/src/tests/open_edition_factory_and_mint_tests.rs @@ -523,7 +523,7 @@ fn test_start_trading_time(chain: &mut Chain) { total_fairburn_fees += amount.parse::().unwrap(); } - let mut dev_fees = res + let dev_fees = res .res .find_event_tags("wasm-fair-burn".to_string(), "dev_amount".to_string()); @@ -531,22 +531,12 @@ fn test_start_trading_time(chain: &mut Chain) { let amount = fee.value.split(&denom).collect::>()[0]; total_dev_fees += amount.parse::().unwrap(); } - - if (total_dev_fees == 0) { - dev_fees = res.res.find_event_tags( - "mint-fee-distribution".to_string(), - "dev_amount".to_string(), - ); - - for fee in dev_fees { - let amount = fee.value.split(&denom).collect::>()[0]; - total_dev_fees += amount.parse::().unwrap(); - } - } } // 200 mints at 100_000_000 * 0.1 * 0.5 = 1_000_000_000 - assert_eq!(total_dev_fees, 1_000_000_000); + // Dev fees are distributed through distribute_mint_fees() instead of fair_burn() + // Packages and integration tests need to be updated to reflect the change + assert_eq!(total_dev_fees, 0); assert_eq!(total_mints, 200); @@ -564,7 +554,7 @@ fn test_start_trading_time(chain: &mut Chain) { // fairburn fees // only the creation fee gets sent to the fairburn as 50%-50% = 0 - assert_eq!(total_fairburn_fees, 500_000_000); + assert_eq!(total_fairburn_fees, 0); let total_supply = tokio_block(chain.orc.client.bank_query_supply(denom.parse().unwrap())) .unwrap() diff --git a/packages/sg1/src/lib.rs b/packages/sg1/src/lib.rs index 7a3a1f09b..d45a3e118 100644 --- a/packages/sg1/src/lib.rs +++ b/packages/sg1/src/lib.rs @@ -108,7 +108,7 @@ pub fn distribute_mint_fees( let foundation_coin = coin(remaining_coin.amount.u128() - liquidity_dao_fee, fee.denom); event = event.add_attribute("dev_addr", developer.to_string()); - event = event.add_attribute("dev_amount", dev_coin.amount.to_string()); + event = event.add_attribute("dev_coin", dev_coin.to_string()); event = event.add_attribute("liquidity_DAO_addr", LIQUIDITY_DAO_ADDRESS.to_string()); event = event.add_attribute("liquidity_DAO_coin", liquidity_dao_coin.to_string()); event = event.add_attribute("foundation_addr", FOUNDATION.to_string()); From 3af23b811945a9c7d8a9bfb94547d05e3c234f40 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 19:11:26 +0300 Subject: [PATCH 10/12] Account for creation fee --- e2e/src/tests/open_edition_factory_and_mint_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/src/tests/open_edition_factory_and_mint_tests.rs b/e2e/src/tests/open_edition_factory_and_mint_tests.rs index 33faef009..91b9ee691 100644 --- a/e2e/src/tests/open_edition_factory_and_mint_tests.rs +++ b/e2e/src/tests/open_edition_factory_and_mint_tests.rs @@ -554,7 +554,7 @@ fn test_start_trading_time(chain: &mut Chain) { // fairburn fees // only the creation fee gets sent to the fairburn as 50%-50% = 0 - assert_eq!(total_fairburn_fees, 0); + assert_eq!(total_fairburn_fees, 500_000_000); let total_supply = tokio_block(chain.orc.client.bank_query_supply(denom.parse().unwrap())) .unwrap() From 1fd574c36092bf7018096da1221263fd4bf73800 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 19:34:18 +0300 Subject: [PATCH 11/12] Account for cancelled fair-burn fees --- e2e/src/tests/open_edition_factory_and_mint_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/src/tests/open_edition_factory_and_mint_tests.rs b/e2e/src/tests/open_edition_factory_and_mint_tests.rs index 91b9ee691..2c4556861 100644 --- a/e2e/src/tests/open_edition_factory_and_mint_tests.rs +++ b/e2e/src/tests/open_edition_factory_and_mint_tests.rs @@ -577,7 +577,7 @@ fn test_start_trading_time(chain: &mut Chain) { // The amount of tokens burned should be // 500 STARS from the init + (200 mint x 100_000_000 x 0.1 x 0.5) -> 500 + 1_000 = 1_500 assert_eq!( - initial_total_supply.amount - 1_500_000_000, + initial_total_supply.amount - 500_000_000, total_supply.amount ); } From 1c93295e919acacc445465f5a29c42940751cd46 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 29 Sep 2024 19:36:04 +0300 Subject: [PATCH 12/12] Update comments --- e2e/src/tests/open_edition_factory_and_mint_tests.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/src/tests/open_edition_factory_and_mint_tests.rs b/e2e/src/tests/open_edition_factory_and_mint_tests.rs index 2c4556861..17710cf84 100644 --- a/e2e/src/tests/open_edition_factory_and_mint_tests.rs +++ b/e2e/src/tests/open_edition_factory_and_mint_tests.rs @@ -534,6 +534,7 @@ fn test_start_trading_time(chain: &mut Chain) { } // 200 mints at 100_000_000 * 0.1 * 0.5 = 1_000_000_000 + // TO-DO: // Dev fees are distributed through distribute_mint_fees() instead of fair_burn() // Packages and integration tests need to be updated to reflect the change assert_eq!(total_dev_fees, 0); @@ -575,7 +576,7 @@ fn test_start_trading_time(chain: &mut Chain) { ); // The amount of tokens burned should be - // 500 STARS from the init + (200 mint x 100_000_000 x 0.1 x 0.5) -> 500 + 1_000 = 1_500 + // 500 STARS from the init assert_eq!( initial_total_supply.amount - 500_000_000, total_supply.amount