Merge pull request #119 from public-awesome/develop

Sync development > main
This commit is contained in:
Serkan Reis 2023-03-04 12:52:29 +03:00 committed by GitHub
commit e5c212751b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 19 deletions

View File

@ -45,7 +45,7 @@ export const ConfirmationModal = (props: ConfirmationModalProps) => {
<div className="flex justify-end w-full"> <div className="flex justify-end w-full">
<Button className="px-0 mt-4 mr-5 mb-4 max-h-12 bg-gray-600 hover:bg-gray-600"> <Button className="px-0 mt-4 mr-5 mb-4 max-h-12 bg-gray-600 hover:bg-gray-600">
<label <label
className="w-full h-full text-white bg-gray-600 hover:bg-gray-600 border-0 btn modal-button" className="w-full h-full text-white bg-gray-600 hover:bg-gray-600 rounded border-0 btn modal-button"
htmlFor="my-modal-2" htmlFor="my-modal-2"
> >
Go Back Go Back

View File

@ -775,15 +775,25 @@ const CollectionCreationPage: NextPage = () => {
const whitelistStartDate = new Date(Number(config?.start_time) / 1000000) const whitelistStartDate = new Date(Number(config?.start_time) / 1000000)
throw Error(`Whitelist start time (${whitelistStartDate.toLocaleString()}) does not match minting start time`) throw Error(`Whitelist start time (${whitelistStartDate.toLocaleString()}) does not match minting start time`)
} }
if (
mintingDetails?.numTokens && if (mintingDetails?.numTokens && config?.per_address_limit) {
config?.per_address_limit && if (mintingDetails.numTokens >= 100 && Number(config.per_address_limit) > 50) {
mintingDetails.numTokens > 100 && throw Error(
Number(config.per_address_limit) > mintingDetails.numTokens / 100 `Invalid limit for tokens per address (${config.per_address_limit} tokens). Tokens per address limit cannot exceed 50 regardless of the total number of tokens.`,
) )
throw Error( } else if (
`Invalid limit for tokens per address (${config.per_address_limit} tokens). The limit cannot exceed 1% of the total number of tokens.`, mintingDetails.numTokens >= 100 &&
) Number(config.per_address_limit) > Math.ceil((mintingDetails.numTokens / 100) * 3)
) {
throw Error(
`Invalid limit for tokens per address (${config.per_address_limit} tokens). Tokens per address limit cannot exceed 3% of the total number of tokens in the collection.`,
)
} else if (mintingDetails.numTokens < 100 && Number(config.per_address_limit) > 3) {
throw Error(
`Invalid limit for tokens per address (${config.per_address_limit} tokens). Tokens per address limit cannot exceed 3 for collections with less than 100 tokens in total.`,
)
}
}
} }
} else if (whitelistDetails.whitelistType === 'new') { } else if (whitelistDetails.whitelistType === 'new') {
if (whitelistDetails.members?.length === 0) throw new Error('Whitelist member list cannot be empty') if (whitelistDetails.members?.length === 0) throw new Error('Whitelist member list cannot be empty')
@ -800,15 +810,24 @@ const CollectionCreationPage: NextPage = () => {
throw new Error('Whitelist start time cannot be later than whitelist end time') throw new Error('Whitelist start time cannot be later than whitelist end time')
if (Number(whitelistDetails.startTime) !== Number(mintingDetails?.startTime)) if (Number(whitelistDetails.startTime) !== Number(mintingDetails?.startTime))
throw new Error('Whitelist start time must be the same as the minting start time') throw new Error('Whitelist start time must be the same as the minting start time')
if ( if (whitelistDetails.perAddressLimit && mintingDetails?.numTokens) {
mintingDetails?.numTokens && if (mintingDetails.numTokens >= 100 && whitelistDetails.perAddressLimit > 50) {
whitelistDetails.perAddressLimit && throw Error(
mintingDetails.numTokens > 100 && `Invalid limit for tokens per address. Tokens per address limit cannot exceed 50 regardless of the total number of tokens.`,
whitelistDetails.perAddressLimit > mintingDetails.numTokens / 100 )
) } else if (
throw Error( mintingDetails.numTokens >= 100 &&
`Invalid limit for tokens per address (${whitelistDetails.perAddressLimit} tokens). The limit cannot exceed 1% of the total number of tokens.`, whitelistDetails.perAddressLimit > Math.ceil((mintingDetails.numTokens / 100) * 3)
) ) {
throw Error(
`Invalid limit for tokens per address. Tokens per address limit cannot exceed 3% of the total number of tokens in the collection.`,
)
} else if (mintingDetails.numTokens < 100 && whitelistDetails.perAddressLimit > 3) {
throw Error(
`Invalid limit for tokens per address. Tokens per address limit cannot exceed 3 for collections with less than 100 tokens in total.`,
)
}
}
} }
} }