Skip to content

Commit

Permalink
&str to string
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Gabriele committed Nov 27, 2023
1 parent a2283f3 commit fb94f61
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 27 deletions.
5 changes: 2 additions & 3 deletions contracts/minters/base-minter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use cw2::set_contract_version;
use cw_utils::{must_pay, nonpayable, parse_reply_instantiate_data};
use sg1::checked_fair_burn;
use sg2::query::Sg2QueryMsg;
use sg2::UriScheme;
use sg4::{QueryMsg, Status, StatusResponse, SudoMsg};
use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg};
use sg721_base::msg::{CollectionInfoResponse, QueryMsg as Sg721QueryMsg};
Expand Down Expand Up @@ -53,7 +52,7 @@ pub fn instantiate(
uri_scheme: factory_params
.params
.uri_scheme
.unwrap_or(UriScheme::Ipfs)
.unwrap_or("ipfs".to_owned())
.to_string(),
extension: Empty {},
};
Expand Down Expand Up @@ -122,7 +121,7 @@ pub fn execute_mint_sender(
) -> Result<Response, ContractError> {
let config = CONFIG.load(deps.storage)?;
let collection_address = COLLECTION_ADDRESS.load(deps.storage)?;
let token_uri = token_uri.trim();
let token_uri = token_uri.trim().to_owned();

// This is a 1:1 minter, minted at min_mint_price
// Should mint and then list on the marketplace for secondary sales
Expand Down
3 changes: 1 addition & 2 deletions contracts/minters/open-edition-minter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use open_edition_factory::types::NftMetadataType;
use semver::Version;
use sg1::{checked_fair_burn, ibc_denom_fair_burn};
use sg2::query::Sg2QueryMsg;
use sg2::UriScheme;
use sg4::{Status, StatusResponse, SudoMsg};
use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg};
use sg_std::{StargazeMsgWrapper, NATIVE_DENOM};
Expand Down Expand Up @@ -59,7 +58,7 @@ pub fn instantiate(

let uri_scheme = factory_params
.uri_scheme
.unwrap_or(UriScheme::Ipfs)
.unwrap_or("ipfs".to_owned())
.to_string();

match msg.init_msg.nft_data.nft_data_type {
Expand Down
3 changes: 1 addition & 2 deletions contracts/minters/vending-minter-wl-flex/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use rand_xoshiro::Xoshiro128PlusPlus;
use semver::Version;
use sg1::{checked_fair_burn, ibc_denom_fair_burn};
use sg2::query::Sg2QueryMsg;
use sg2::UriScheme;
use sg4::{MinterConfig, Status, StatusResponse, SudoMsg};
use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg};
use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME, NATIVE_DENOM};
Expand Down Expand Up @@ -75,7 +74,7 @@ pub fn instantiate(

let uri_scheme = factory_params
.uri_scheme
.unwrap_or(UriScheme::Ipfs)
.unwrap_or("ipfs".to_owned())
.to_string();

// sanitize base token uri
Expand Down
3 changes: 1 addition & 2 deletions contracts/minters/vending-minter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use rand_xoshiro::Xoshiro128PlusPlus;
use semver::Version;
use sg1::{checked_fair_burn, ibc_denom_fair_burn};
use sg2::query::Sg2QueryMsg;
use sg2::UriScheme;
use sg4::{MinterConfig, Status, StatusResponse, SudoMsg};
use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg};
use sg_std::{StargazeMsgWrapper, GENESIS_MINT_START_TIME, NATIVE_DENOM};
Expand Down Expand Up @@ -90,7 +89,7 @@ pub fn instantiate(

let uri_scheme = factory_params
.uri_scheme
.unwrap_or(UriScheme::Ipfs)
.unwrap_or("ipfs".to_owned())
.to_string();

// sanitize base token uri
Expand Down
19 changes: 1 addition & 18 deletions packages/sg2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::fmt;

use cosmwasm_schema::cw_serde;
use cosmwasm_std::Coin;

Expand All @@ -20,21 +18,6 @@ pub struct MinterParams<T> {
pub min_mint_price: Coin,
pub mint_fee_bps: u64,
pub max_trading_offset_secs: u64,
pub uri_scheme: Option<UriScheme>,
pub uri_scheme: Option<String>,
pub extension: T,
}

#[cw_serde]
pub enum UriScheme {
Https,
Ipfs,
}

impl fmt::Display for UriScheme {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Ipfs => write!(f, "ipfs"),
Self::Https => write!(f, "https"),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub fn mock_params() -> BaseMinterParams {
mint_fee_bps: MINT_FEE_BPS,
max_trading_offset_secs: 60 * 60 * 24 * 7,
extension: None,
uri_scheme: Some("ipfs".to_owned()),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub fn mock_params_proper() -> OpenEditionMinterParams {
min_mint_price: coin(MIN_MINT_PRICE_OPEN_EDITION, NATIVE_DENOM),
mint_fee_bps: MINT_FEE_FAIR_BURN,
max_trading_offset_secs: 60 * 60 * 24 * 7,
uri_scheme: Some("ipfs".to_owned()),
extension: ParamsExtension {
max_per_address_limit: 10,
airdrop_mint_fee_bps: 100,
Expand All @@ -98,6 +99,7 @@ pub fn mock_params_custom(custom_params: OpenEditionMinterCustomParams) -> OpenE
min_mint_price: coin(MIN_MINT_PRICE_OPEN_EDITION, denom),
mint_fee_bps,
max_trading_offset_secs: 60 * 60 * 24 * 7,
uri_scheme: Some("ipfs".to_owned()),
extension: ParamsExtension {
max_per_address_limit: 10,
airdrop_mint_fee_bps: 100,
Expand All @@ -122,6 +124,7 @@ pub fn mock_params_custom_min_mint_price(
min_mint_price,
mint_fee_bps: MINT_FEE_FAIR_BURN,
max_trading_offset_secs: 60 * 60 * 24 * 7,
uri_scheme: Some("ipfs".to_owned()),
extension: ParamsExtension {
max_per_address_limit: 10,
airdrop_mint_fee_bps: 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub fn mock_params(mint_denom: Option<String>) -> VendingMinterParams {
),
mint_fee_bps: MINT_FEE_FAIR_BURN,
max_trading_offset_secs: 60 * 60 * 24 * 7,
uri_scheme: Some("ipfs".to_owned()),
extension: ParamsExtension {
max_token_limit: MAX_TOKEN_LIMIT,
max_per_address_limit: MAX_PER_ADDRESS_LIMIT,
Expand Down
3 changes: 3 additions & 0 deletions test-suite/src/open_edition_minter/tests/ibc_asset_mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fn check_custom_create_minter_denom() {
min_mint_price: init_msg.mint_price.clone(),
mint_fee_bps: MINT_FEE_FAIR_BURN,
max_trading_offset_secs: 60 * 60 * 24 * 7,
uri_scheme: Some("ipfs".to_owned()),
extension: ParamsExtension {
max_per_address_limit: 10,
airdrop_mint_fee_bps: 100,
Expand Down Expand Up @@ -121,6 +122,7 @@ fn one_hundred_percent_burned_ibc_minter() {
min_mint_price: init_msg.mint_price.clone(),
mint_fee_bps: 10000,
max_trading_offset_secs: 60 * 60 * 24 * 7,
uri_scheme: Some("ipfs".to_owned()),
extension: ParamsExtension {
max_per_address_limit: 10,
airdrop_mint_fee_bps: 100,
Expand Down Expand Up @@ -202,6 +204,7 @@ fn zero_mint_fee() {
min_mint_price: init_msg.mint_price.clone(),
mint_fee_bps: 0,
max_trading_offset_secs: 60 * 60 * 24 * 7,
uri_scheme: Some("ipfs".to_owned()),
extension: ParamsExtension {
max_per_address_limit: 10,
airdrop_mint_fee_bps: 100,
Expand Down

0 comments on commit fb94f61

Please sign in to comment.