Update per_address_limit checks performed during Vending Minter creation

This commit is contained in:
Serkan Reis 2023-03-03 11:05:16 +03:00
parent dd2d1b3670
commit 4f76a73fb6

View File

@ -748,12 +748,17 @@ const CollectionCreationPage: NextPage = () => {
mintingDetails.perAddressLimit > mintingDetails.numTokens
)
throw new Error('Invalid limit for tokens per address')
if (mintingDetails.numTokens < 100 && mintingDetails.perAddressLimit > 3)
throw new Error(
'Invalid limit for tokens per address. Tokens per address limit cannot exceed 3 for collections with less than 100 tokens in total.',
)
if (
mintingDetails.numTokens > 100 &&
mintingDetails.numTokens < 100 * mintingDetails.perAddressLimit &&
mintingDetails.perAddressLimit > mintingDetails.numTokens / 100
mintingDetails.numTokens >= 100 &&
mintingDetails.perAddressLimit > Math.ceil((mintingDetails.numTokens / 100) * 3)
)
throw new Error('Invalid limit for tokens per address. The limit cannot exceed 1% of the total number of tokens.')
throw new Error(
'Invalid limit for tokens per address. Tokens per address limit cannot exceed 3% of the total number of tokens in the collection.',
)
if (mintingDetails.startTime === '') throw new Error('Start time is required')
if (Number(mintingDetails.startTime) < new Date().getTime() * 1000000) throw new Error('Invalid start time')
}