ERC721Generative
ERC721Generative
Inherits: Owned, ERC721Burnable, ERC721Royalty, ERC721Metadata_URI_autoIncrementID, ERC721Enumerable
Author: cosimo.demedici.eth *
Self-sovereign ERC-721 Generative art minter preset *
State Variables
FACTORY
Address of the factory contract
address private immutable FACTORY;scriptStorageAddress
Address of the deployed contract containing the script
address public scriptStorageAddress;feeRecipient
Address to receive fees
address public feeRecipient;feeAmount
Amount of fees
dropTime
Time when the NFT drop will happen
dropDurationAL
Duration of the AL drop
dropDurationPublic
Duration of the public drop
ALPrice
Price for addresses in the allow list
publicPrice
Price for the public
maxSupply
Maximum supply of the NFT
merkleRoot
Merkle root for the whitelist
Functions
onlyBeforeDropStart
Modifier to check if the current time is before the drop start
onlyBeforeALDropEnd
Modifier to check if the current time is before the AL drop end
constructor
Constructor that sets the factory address.
Parameters
factory_
address
of the factory contract constant set at deployment of master contract, replaces initializer modifier reducing the cost of calling initialize from the factory contract whenever a new clone is deployed.
mint
Function to mint a new NFT.
Mints a new NFT if the conditions are met. The conditions include checking the Merkle proof for the address, checking if the value sent with the transaction matches the price, and checking if the maximum supply has not been reached.
Parameters
_to
address
The address to mint the NFT to.
_merkleProof
bytes32[]
The Merkle proof for the address.
_data
bytes
Additional data to accompany the mint function.
Returns
_tokenId
uint256
The ID of the minted NFT.
_mint
Overrides the _mint function of the base contract and all extensions
Calls parent functions from the most derived to the most base contract: ERC721Metadata_URI, ERC721Royalty, ERC721
Parameters
_to
address
The address to mint the NFT to.
_id
uint256
The ID of the NFT to mint.
_data
bytes
Additional data to accompany the mint function.
_burn
Overrides the _burn function of the base contract and all extensions
Deletes royalty info from storage
Parameters
_tokenId
uint256
The ID of the NFT to burn.
withdraw
Withdraws the contract balance to the fee recipient and the owner
No need to add non reentrant modifier as the feeRecipient is set by the owner we assume it is a trusted address
setScript
Sets the script for the contract
Only callable by the owner before the drop start
Parameters
_script
bytes
The script to set
setMerkleRoot
Sets the Merkle root for the contract
Only callable by the owner
Parameters
_merkleRoot
bytes32
The Merkle root to set
setBaseURI
Sets the base URI for the contract
Only callable by the owner
Parameters
baseURI_
string
The base URI to set
deployedContract_
address
The address of the deployed contract
setDropTime
Sets the drop time for the contract
Only callable by the owner before the AL drop end
Parameters
_newDropTime
uint256
The new drop time to set
setMaxSupply
Sets the maximum supply for the contract
Only callable by the owner before the drop start
Parameters
maxSupply_
uint256
The new maximum supply to set
setDropDurationAL
Sets the AL drop duration for the contract
Only callable by the owner before the AL drop end
Parameters
_newDropDurationAL
uint256
The new AL drop duration to set
setDropDurationPublic
Sets the public drop duration for the contract
Only callable by the owner
Parameters
_newDropDurationPublic
uint256
The new public drop duration to set
setALPrice
Sets the AL price for the contract
Only callable by the owner before the drop start
Parameters
ALPrice_
uint256
The new AL price to set
setPublicPrice
Sets the public price for the contract
Only callable by the owner before the drop start
Parameters
publicPrice_
uint256
The new public price to set
setFeeRecipient
Sets the fee recipient for the contract
Only callable by the owner
Parameters
feeRecipient_
address
The new fee recipient to set
setFeeAmount
Sets the fee amount for the contract
Only callable by the owner
Parameters
feeAmount_
uint256
The new fee amount to set
setDefaultRoyalty
Sets the default royalty for the contract
Only callable by the owner
Parameters
_receiver
address
The address to receive the royalty
_feeNumerator
uint96
The fee numerator for the royalty
setTokenRoyalty
Sets the royalty for a specific token
Only callable by the owner
Parameters
_tokenId
uint256
The ID of the token
_receiver
address
The address to receive the royalty
_feeNumerator
uint96
The fee numerator for the royalty
exists
Checks if a token exists.
Parameters
_id
uint256
The token ID to check.
Returns
<none>
bool
A boolean indicating if the token exists.
getScript
Reads the script from the contract.
Returns
<none>
string
The script as a string.
supportsInterface
Checks if the contract supports a given interface.
Parameters
interfaceId
bytes4
The interface ID to check.
Returns
<none>
bool
A boolean indicating if the contract supports the interface.
receive
Fallback function that allows the contract to receive funds.
initialize
Initializes the contract, setting the initial state and granting roles.
Parameters
_data
bytes
The initialization data.
Last updated