From 5efb637a18ec96414dcf2d88f7b1ba7596b7c493 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 7 Apr 2023 12:23:21 +0300 Subject: [PATCH 1/5] Update checks for minimum mint price on Collection Actions > Update Mint Price --- components/collections/actions/Action.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/components/collections/actions/Action.tsx b/components/collections/actions/Action.tsx index 40f6dee..c628b30 100644 --- a/components/collections/actions/Action.tsx +++ b/components/collections/actions/Action.tsx @@ -297,9 +297,6 @@ export const CollectionActions = ({ if (minterContractAddress === '' && sg721ContractAddress === '') { throw new Error('Please enter minter and sg721 contract addresses!') } - if (type === 'update_mint_price' && priceState.value < 50) { - throw new Error('Mint price must be at least 50 STARS') - } if (wallet.client && type === 'update_mint_price') { const contractConfig = wallet.client.queryContractSmart(minterContractAddress, { @@ -337,6 +334,22 @@ export const CollectionActions = ({ .catch((error) => { throw new Error(String(error).substring(String(error).lastIndexOf('Error:') + 7)) }) + } else { + await contractConfig.then(async (config) => { + const factoryParameters = await wallet.client?.queryContractSmart(config.factory, { + params: {}, + }) + if ( + factoryParameters.params.min_mint_price.amount && + priceState.value < Number(factoryParameters.params.min_mint_price.amount) / 1000000 + ) { + throw new Error( + `Updated mint price cannot be lower than the minimum mint price of ${ + Number(factoryParameters.params.min_mint_price.amount) / 1000000 + } STARS`, + ) + } + }) } }) } From ec28295278cb3afaed4980ff248acb8d82bb25e7 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 7 Apr 2023 12:24:02 +0300 Subject: [PATCH 2/5] Update checks for minimum mint price on Vending Minter Dashboard > Execute > Update Mint Price --- pages/contracts/vendingMinter/execute.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pages/contracts/vendingMinter/execute.tsx b/pages/contracts/vendingMinter/execute.tsx index 17787e2..b37d37c 100644 --- a/pages/contracts/vendingMinter/execute.tsx +++ b/pages/contracts/vendingMinter/execute.tsx @@ -113,9 +113,6 @@ const VendingMinterExecutePage: NextPage = () => { if (contractState.value === '') { throw new Error('Please enter the contract address.') } - if (type === 'update_mint_price' && priceState.value < 50) { - throw new Error('Mint price must be at least 50 STARS') - } if (wallet.client && type === 'update_mint_price') { const contractConfig = wallet.client.queryContractSmart(contractState.value, { @@ -153,6 +150,22 @@ const VendingMinterExecutePage: NextPage = () => { .catch((error) => { throw new Error(String(error).substring(String(error).lastIndexOf('Error:') + 7)) }) + } else { + await contractConfig.then(async (config) => { + const factoryParameters = await wallet.client?.queryContractSmart(config.factory, { + params: {}, + }) + if ( + factoryParameters.params.min_mint_price.amount && + priceState.value < Number(factoryParameters.params.min_mint_price.amount) / 1000000 + ) { + throw new Error( + `Updated mint price cannot be lower than the minimum mint price of ${ + Number(factoryParameters.params.min_mint_price.amount) / 1000000 + } STARS`, + ) + } + }) } }) } From 3471aeb653aee8cfba01829f3852e6206db1e84a Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 7 Apr 2023 12:24:38 +0300 Subject: [PATCH 3/5] Update checks for minimum mint price on Collection Creation --- .../collections/creation/MintingDetails.tsx | 5 +++-- pages/collections/create.tsx | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/components/collections/creation/MintingDetails.tsx b/components/collections/creation/MintingDetails.tsx index e7042ff..7f6d806 100644 --- a/components/collections/creation/MintingDetails.tsx +++ b/components/collections/creation/MintingDetails.tsx @@ -13,6 +13,7 @@ interface MintingDetailsProps { onChange: (data: MintingDetailsDataProps) => void numberOfTokens: number | undefined uploadMethod: UploadMethod + minimumMintPrice: number } export interface MintingDetailsDataProps { @@ -23,7 +24,7 @@ export interface MintingDetailsDataProps { paymentAddress?: string } -export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: MintingDetailsProps) => { +export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod, minimumMintPrice }: MintingDetailsProps) => { const wallet = useWallet() const [timestamp, setTimestamp] = useState() @@ -40,7 +41,7 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: Minti id: 'unitPrice', name: 'unitPrice', title: 'Unit Price', - subtitle: 'Price of each token (min. 50 STARS)', + subtitle: `Price of each token (min. ${minimumMintPrice} STARS)`, placeholder: '50', }) diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 17e4db7..fe8e4ea 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -94,6 +94,8 @@ const CollectionCreationPage: NextPage = () => { const [baseMinterCreationFee, setBaseMinterCreationFee] = useState(null) const [vendingMinterUpdatableCreationFee, setVendingMinterUpdatableCreationFee] = useState(null) const [baseMinterUpdatableCreationFee, setBaseMinterUpdatableCreationFee] = useState(null) + const [minimumMintPrice, setMinimumMintPrice] = useState('0') + const [minimumUpdatableMintPrice, setMinimumUpdatableMintPrice] = useState('0') const [uploading, setUploading] = useState(false) const [isMintingComplete, setIsMintingComplete] = useState(false) @@ -784,8 +786,13 @@ const CollectionCreationPage: NextPage = () => { const checkMintingDetails = () => { if (!mintingDetails) throw new Error('Please fill out the minting details') if (mintingDetails.numTokens < 1 || mintingDetails.numTokens > 10000) throw new Error('Invalid number of tokens') - if (Number(mintingDetails.unitPrice) < 50000000) - throw new Error('Invalid unit price: The minimum unit price is 50 STARS') + if (collectionDetails?.updatable) { + if (Number(mintingDetails.unitPrice) < Number(minimumUpdatableMintPrice)) + throw new Error( + `Invalid unit price: The minimum unit price is ${Number(minimumUpdatableMintPrice) / 1000000} STARS`, + ) + } else if (Number(mintingDetails.unitPrice) < Number(minimumMintPrice)) + throw new Error(`Invalid unit price: The minimum unit price is ${Number(minimumMintPrice) / 1000000} STARS`) if ( !mintingDetails.perAddressLimit || mintingDetails.perAddressLimit < 1 || @@ -929,12 +936,14 @@ const CollectionCreationPage: NextPage = () => { if (VENDING_FACTORY_ADDRESS) { const vendingFactoryParameters = await client.queryContractSmart(VENDING_FACTORY_ADDRESS, { params: {} }) setVendingMinterCreationFee(vendingFactoryParameters?.params?.creation_fee?.amount) + setMinimumMintPrice(vendingFactoryParameters?.params?.min_mint_price?.amount) } if (VENDING_FACTORY_UPDATABLE_ADDRESS) { const vendingFactoryUpdatableParameters = await client.queryContractSmart(VENDING_FACTORY_UPDATABLE_ADDRESS, { params: {}, }) setVendingMinterUpdatableCreationFee(vendingFactoryUpdatableParameters?.params?.creation_fee?.amount) + setMinimumUpdatableMintPrice(vendingFactoryUpdatableParameters?.params?.min_mint_price?.amount) } } @@ -1285,6 +1294,11 @@ const CollectionCreationPage: NextPage = () => { Date: Fri, 7 Apr 2023 12:28:19 +0300 Subject: [PATCH 4/5] Update checks for minimum mint price for Whitelists --- components/collections/creation/WhitelistDetails.tsx | 2 +- pages/collections/create.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/collections/creation/WhitelistDetails.tsx b/components/collections/creation/WhitelistDetails.tsx index 1418aa0..66fde9e 100644 --- a/components/collections/creation/WhitelistDetails.tsx +++ b/components/collections/creation/WhitelistDetails.tsx @@ -49,7 +49,7 @@ export const WhitelistDetails = ({ onChange }: WhitelistDetailsProps) => { id: 'unit-price', name: 'unitPrice', title: 'Unit Price', - subtitle: 'Token price for whitelisted addresses \n (min. 25 STARS)', + subtitle: 'Token price for whitelisted addresses \n (min. 0 STARS)', placeholder: '25', }) diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index fe8e4ea..54b67a4 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -855,8 +855,8 @@ const CollectionCreationPage: NextPage = () => { } else if (whitelistDetails.whitelistType === 'new') { if (whitelistDetails.members?.length === 0) throw new Error('Whitelist member list cannot be empty') if (whitelistDetails.unitPrice === '') throw new Error('Whitelist unit price is required') - if (Number(whitelistDetails.unitPrice) < 25000000) - throw new Error('Invalid unit price: The minimum unit price for whitelisted addresses is 25 STARS') + if (Number(whitelistDetails.unitPrice) < 0) + throw new Error('Invalid unit price: The unit price cannot be negative') if (whitelistDetails.startTime === '') throw new Error('Start time is required') if (whitelistDetails.endTime === '') throw new Error('End time is required') if (!whitelistDetails.perAddressLimit || whitelistDetails.perAddressLimit === 0) From d4c27b22372c77f0e56f126c286f045d68a55921 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 7 Apr 2023 12:32:34 +0300 Subject: [PATCH 5/5] Bump Studio version --- .env.example | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 2136b8d..51989e5 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -APP_VERSION=0.5.7 +APP_VERSION=0.5.8 NEXT_PUBLIC_PINATA_ENDPOINT_URL=https://api.pinata.cloud/pinning/pinFileToIPFS NEXT_PUBLIC_SG721_CODE_ID=1911 diff --git a/package.json b/package.json index 766941c..daa9b97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stargaze-studio", - "version": "0.5.7", + "version": "0.5.8", "workspaces": [ "packages/*" ],