NFT Collection Factory

A factory to create NFT collections.

Call this factory to create NFT collections.

This creates and initializes an ERC-1167 minimal proxy pointing to an NFT collection contract implementation.

function adminUpdateNFTCollectionImplementation(address _implementation) external nonpayable

Allows Foundation to change the NFTCollection implementation used for future collections. This call will auto-increment the version. Existing collections are not impacted.

Parameters

NameTypeDescription
_implementationaddressThe new NFTCollection collection implementation address.
function adminUpdateNFTDropCollectionImplementation(address _implementation) external nonpayable

Allows Foundation to change the NFTDropCollection implementation used for future collections. This call will auto-increment the version. Existing collections are not impacted.

Parameters

NameTypeDescription
_implementationaddressThe new NFTDropCollection collection implementation address.
function createNFTCollection(string name, string symbol, uint96 nonce) external nonpayable returns (address collection)

Create a new collection contract.

The nonce must be unique for the msg.sender + implementation version, otherwise this call will revert.

Parameters

NameTypeDescription
namestringThe collection's name.
symbolstringThe collection's symbol.
nonceuint96An arbitrary value used to allow a creator to mint multiple collections with a counterfactual address.

Returns

NameTypeDescription
collectionaddressThe address of the newly created collection contract.
function createNFTDropCollection(string name, string symbol, string baseURI, bool isRevealed, uint32 maxTokenId, address approvedMinter, uint96 nonce) external nonpayable returns (address collection)

Create a new drop collection contract.

The nonce must be unique for the msg.sender + implementation version, otherwise this call will revert.

Parameters

NameTypeDescription
namestringThe collection's name.
symbolstringThe collection's symbol.
baseURIstringThe base URI for the collection.
isRevealedboolWhether the collection is revealed or not.
maxTokenIduint32The max token id for this collection.
approvedMinteraddressAn optional address to grant the MINTER_ROLE.
nonceuint96An arbitrary value used to allow a creator to mint multiple collections with a counterfactual address.

Returns

NameTypeDescription
collectionaddressThe address of the newly created collection contract.
function createNFTDropCollectionWithPaymentAddress(string name, string symbol, string baseURI, bool isRevealed, uint32 maxTokenId, address approvedMinter, uint96 nonce, address payable paymentAddress) external nonpayable returns (address collection)

Create a new drop collection contract with a custom payment address.

All params other than paymentAddress are the same as in createNFTDropCollection. The nonce must be unique for the msg.sender + implementation version, otherwise this call will revert.

Parameters

NameTypeDescription
namestringThe collection's name.
symbolstringThe collection's symbol.
baseURIstringThe base URI for the collection.
isRevealedboolWhether the collection is revealed or not.
maxTokenIduint32The max token id for this collection.
approvedMinteraddressAn optional address to grant the MINTER_ROLE.
nonceuint96An arbitrary value used to allow a creator to mint multiple collections with a counterfactual address.
paymentAddressaddress payableThe address that will receive royalties and mint payments.

Returns

NameTypeDescription
collectionaddressThe address of the newly created collection contract.
function createNFTDropCollectionWithPaymentFactory(string name, string symbol, string baseURI, bool isRevealed, uint32 maxTokenId, address approvedMinter, uint96 nonce, CallWithoutValue paymentAddressFactoryCall) external nonpayable returns (address collection)

Parameters

NameTypeDescription
namestring
symbolstring
baseURIstring
isRevealedbool
maxTokenIduint32
approvedMinteraddress
nonceuint96
paymentAddressFactoryCallCallWithoutValue

Returns

NameTypeDescription
collectionaddress
function implementationNFTCollection() external view returns (address)

The address of the implementation all new NFTCollections will leverage.

When this is changed, versionNFTCollection is incremented.

Returns

NameTypeDescription
_0addressThe implementation address for NFTCollection.
function implementationNFTDropCollection() external view returns (address)

The address of the implementation all new NFTDropCollections will leverage.

When this is changed, versionNFTDropCollection is incremented.

Returns

NameTypeDescription
_0addressThe implementation address for NFTDropCollection.
function initialize(uint32 _versionNFTCollection) external nonpayable

Initializer called after contract creation.

This is used so that this factory will resume versions from where our original factory had left off.

Parameters

NameTypeDescription
_versionNFTCollectionuint32The current implementation version for NFTCollections.
function predictNFTCollectionAddress(address creator, uint96 nonce) external view returns (address collection)

Returns the address of a collection given the current implementation version, creator, and nonce. This will return the same address whether the collection has already been created or not.

Parameters

NameTypeDescription
creatoraddressThe creator of the collection.
nonceuint96An arbitrary value used to allow a creator to mint multiple collections with a counterfactual address.

Returns

NameTypeDescription
collectionaddressThe address of the collection contract that would be created by this nonce.
function predictNFTDropCollectionAddress(address creator, uint96 nonce) external view returns (address collection)

Returns the address of an NFTDropCollection collection given the current implementation version, creator, and nonce. This will return the same address whether the collection has already been created or not.

Parameters

NameTypeDescription
creatoraddressThe creator of the collection.
nonceuint96An arbitrary value used to allow a creator to mint multiple collections with a counterfactual address.

Returns

NameTypeDescription
collectionaddressThe address of the collection contract that would be created by this nonce.
function rolesManager() external view returns (contract IRoles)

The contract address which manages common roles.

Defines a centralized admin role definition for permissioned functions below.

Returns

NameTypeDescription
_0contract IRolesThe contract address with role definitions.
function versionNFTCollection() external view returns (uint32)

The implementation version of new NFTCollections.

This is auto-incremented each time implementationNFTCollection is changed.

Returns

NameTypeDescription
_0uint32The current NFTCollection implementation version.
function versionNFTDropCollection() external view returns (uint32)

The implementation version of new NFTDropCollections.

This is auto-incremented each time implementationNFTDropCollection is changed.

Returns

NameTypeDescription
_0uint32The current NFTDropCollection implementation version.
event ImplementationNFTCollectionUpdated(address indexed implementation, uint256 indexed version)

Emitted when the implementation of NFTCollection used by new collections is updated.

Parameters

NameTypeDescription
implementation indexedaddressThe new implementation contract address.
version indexeduint256The version of the new implementation, auto-incremented.
event ImplementationNFTDropCollectionUpdated(address indexed implementationNFTDropCollection, uint256 indexed version)

Emitted when the implementation of NFTDropCollection used by new collections is updated.

Parameters

NameTypeDescription
implementationNFTDropCollection indexedaddressThe new implementation contract address.
version indexeduint256The version of the new implementation, auto-incremented.
event Initialized(uint8 version)

Parameters

NameTypeDescription
versionuint8
event NFTCollectionCreated(address indexed collection, address indexed creator, uint256 indexed version, string name, string symbol, uint256 nonce)

Emitted when a new NFTCollection is created from this factory.

Parameters

NameTypeDescription
collection indexedaddressThe address of the new NFT collection contract.
creator indexedaddressThe address of the creator which owns the new collection.
version indexeduint256The implementation version used by the new collection.
namestringThe name of the collection contract created.
symbolstringThe symbol of the collection contract created.
nonceuint256The nonce used by the creator when creating the collection, used to define the address of the collection.
event NFTDropCollectionCreated(address indexed collection, address indexed creator, address indexed approvedMinter, string name, string symbol, string baseURI, bool isRevealed, uint256 maxTokenId, address paymentAddress, uint256 version, uint256 nonce)

Emitted when a new NFTDropCollection is created from this factory.

Parameters

NameTypeDescription
collection indexedaddressThe address of the new NFT drop collection contract.
creator indexedaddressThe address of the creator which owns the new collection.
approvedMinter indexedaddressAn optional address to grant the MINTER_ROLE.
namestringThe collection's name.
symbolstringThe collection's symbol.
baseURIstringThe base URI for the collection.
isRevealedboolWhether the collection is revealed or not.
maxTokenIduint256The max tokenID for this collection.
paymentAddressaddressThe address that will receive royalties and mint payments.
versionuint256The implementation version used by the new NFTDropCollection collection.
nonceuint256The nonce used by the creator to create this collection.