FxGenArt721

Git Source

Inherits: IFxGenArt721, IERC4906, ERC721, EIP712, Initializable, Ownable, Pausable, RoyaltyManager

Author: fx(hash)

See the documentation in {IFxGenArt721}

State Variables

contractRegistry

Returns address of the FxContractRegistry contract

address public immutable contractRegistry;

roleRegistry

Returns the address of the FxRoleRegistry contract

address public immutable roleRegistry;

nameAndSymbol_

Packed value of name and symbol where combined length is 30 bytes or less

bytes32 internal nameAndSymbol_;

name_

Project name

string internal name_;

symbol_

Project symbol

string internal symbol_;

totalSupply

Returns the current circulating supply of tokens

uint96 public totalSupply;

randomizer

Returns the address of the randomizer contract

address public randomizer;

renderer

Returns the address of the Renderer contract

address public renderer;

nonce

Current nonce for admin signatures

uint96 public nonce;

issuerInfo

Returns the issuer information of the project (primaryReceiver, ProjectInfo)

IssuerInfo public issuerInfo;

metadataInfo

Returns the metadata information of the project (baseURI, onchainPointer)

MetadataInfo public metadataInfo;

genArtInfo

Mapping of token ID to GenArtInfo struct (minter, seed, fxParams)

mapping(uint256 => GenArtInfo) public genArtInfo;

Functions

onlyMinter

Modifier for restricting calls to only registered minters

modifier onlyMinter();

onlyRole

Modifier for restricting calls to only authorized accounts with given role

modifier onlyRole(bytes32 _role);

constructor

Initializes FxContractRegistry and FxRoleRegistry

constructor(address _contractRegistry, address _roleRegistry)
    ERC721("FxGenArt721", "FXHASH")
    EIP712("FxGenArt721", "1");

initialize

Initializes new generative art project

function initialize(
    address _owner,
    InitInfo calldata _initInfo,
    ProjectInfo memory _projectInfo,
    MetadataInfo calldata _metadataInfo,
    MintInfo[] calldata _mintInfo,
    address[] calldata _royaltyReceivers,
    uint32[] calldata _allocations,
    uint96 _basisPoints
) external initializer;

Parameters

NameTypeDescription
_owneraddressAddress of token proxy owner
_initInfoInitInfoInitialization information set on project creation
_projectInfoProjectInfoProject information
_metadataInfoMetadataInfoMetadata information
_mintInfoMintInfo[]Array of authorized minter contracts and their reserves
_royaltyReceiversaddress[]Array of addresses receiving royalties
_allocationsuint32[]Array of allocation amounts for calculating royalty shares
_basisPointsuint96Total allocation scalar for calculating royalty shares

burn

Burns token ID from the circulating supply

function burn(uint256 _tokenId) external whenNotPaused;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

fulfillSeedRequest

function fulfillSeedRequest(uint256 _tokenId, bytes32 _seed) external;

mint

function mint(address _to, uint256 _amount, uint256) external onlyMinter whenNotPaused;

mintParams

Mints single fxParams token

Only callable by registered minter contracts

function mintParams(address _to, bytes calldata _fxParams) external onlyMinter whenNotPaused;

Parameters

NameTypeDescription
_toaddressAddress receiving minted token
_fxParamsbytesRandom sequence of fixed-length bytes used as input

ownerMint

Mints single token with randomly generated seed

Only callable by contract owner

function ownerMint(address _to) external onlyOwner whenNotPaused;

Parameters

NameTypeDescription
_toaddressAddress receiving token

ownerMintParams

Mints single fxParams token

Only callable by contract owner

function ownerMintParams(address _to, bytes calldata _fxParams) external onlyOwner whenNotPaused;

Parameters

NameTypeDescription
_toaddressAddress receiving minted token
_fxParamsbytesRandom sequence of fixed-length bytes used as input

reduceSupply

Reduces maximum supply of collection

function reduceSupply(uint120 _supply) external onlyOwner;

Parameters

NameTypeDescription
_supplyuint120Maximum supply amount

registerMinters

Registers minter contracts with resereve info

function registerMinters(MintInfo[] memory _mintInfo) external onlyOwner;

Parameters

NameTypeDescription
_mintInfoMintInfo[]Mint information of token reserves

setBaseRoyalties

Sets the base royalties for all secondary token sales

function setBaseRoyalties(address[] calldata _receivers, uint32[] calldata _allocations, uint96 _basisPoints)
    external
    onlyOwner;

Parameters

NameTypeDescription
_receiversaddress[]Array of addresses receiving royalties
_allocationsuint32[]Array of allocations used to calculate royalty payments
_basisPointsuint96basis points used to calculate royalty payments

setBurnEnabled

Sets flag status of public burn to enabled or disabled

function setBurnEnabled(bool _flag) external onlyOwner;

Parameters

NameTypeDescription
_flagboolStatus of burn

setMintEnabled

Sets flag status of public mint to enabled or disabled

function setMintEnabled(bool _flag) external onlyOwner;

Parameters

NameTypeDescription
_flagboolStatus of mint

setOnchainPointer

Sets the onchain pointer for reconstructing project metadata onchain

function setOnchainPointer(bytes calldata _onchainData, bytes calldata _signature) external onlyOwner;

Parameters

NameTypeDescription
_onchainDatabytesBytes-encoded metadata
_signaturebytesSignature of creator used to verify metadata update

setPrimaryReceivers

Sets the primary receiver address for primary sale proceeds

function setPrimaryReceivers(address[] calldata _receivers, uint32[] calldata _allocations) external onlyOwner;

Parameters

NameTypeDescription
_receiversaddress[]Array of addresses receiving shares from primary sales
_allocationsuint32[]Array of allocation amounts for calculating primary sales shares

setRenderer

Sets the new renderer contract

function setRenderer(address _renderer, bytes calldata _signature) external onlyOwner;

Parameters

NameTypeDescription
_rendereraddressAddress of the renderer contract
_signaturebytesSignature of creator used to verify renderer update

setRandomizer

Sets the new randomizer contract

function setRandomizer(address _randomizer) external onlyRole(ADMIN_ROLE);

Parameters

NameTypeDescription
_randomizeraddressAddress of the randomizer contract

setBaseURI

Sets the new URI of the token metadata

function setBaseURI(bytes calldata _uri) external onlyRole(METADATA_ROLE);

Parameters

NameTypeDescription
_uribytesDecoded content identifier of metadata pointer

pause

Pauses all function executions where modifier is applied

function pause() external onlyRole(MODERATOR_ROLE);

setTags

Emits an event for setting tag descriptions for the project

function setTags(uint256[] calldata _tagIds) external onlyRole(MODERATOR_ROLE);

Parameters

NameTypeDescription
_tagIdsuint256[]Array of tag IDs describing the project

unpause

Unpauses all function executions where modifier is applied

function unpause() external onlyRole(MODERATOR_ROLE);

activeMinters

function activeMinters() external view returns (address[] memory);

contractURI

Returns contract-level metadata for storefront marketplaces

function contractURI() external view returns (string memory);

primaryReceiver

function primaryReceiver() external view returns (address);

generateOnchainPointerHash

Generates typed data hash for setting project metadata onchain

function generateOnchainPointerHash(bytes calldata _data) public view returns (bytes32);

Parameters

NameTypeDescription
_databytesBytes-encoded onchain data

Returns

NameTypeDescription
<none>bytes32Typed data hash

generateRendererHash

Generates typed data hash for setting the primary receiver address

function generateRendererHash(address _renderer) public view returns (bytes32);

Parameters

NameTypeDescription
_rendereraddressAddress of the new renderer contract

Returns

NameTypeDescription
<none>bytes32Typed data hash

isMinter

Gets the authorization status for the given minter contract

function isMinter(address _minter) public view returns (bool);

Parameters

NameTypeDescription
_minteraddressAddress of the minter contract

Returns

NameTypeDescription
<none>boolAuthorization status

remainingSupply

Returns the remaining supply of tokens left to mint

function remainingSupply() public view returns (uint256);

name

function name() public view override returns (string memory);

symbol

function symbol() public view override returns (string memory);

tokenURI

function tokenURI(uint256 _tokenId) public view override returns (string memory);

_mintParams

Mints single token to given account using fxParams as input

function _mintParams(address _to, uint256 _tokenId, bytes calldata _fxParams) internal;

_mintRandom

Mints single token to given account using randomly generated seed as input

function _mintRandom(address _to, uint256 _tokenId) internal;

_registerMinters

Registers arbitrary number of minter contracts and sets their reserves

function _registerMinters(MintInfo[] memory _mintInfo) internal;

_setBaseRoyalties

Sets receivers and allocations for base royalties of token sales

function _setBaseRoyalties(address[] calldata _receivers, uint32[] calldata _allocations, uint96 _basisPoints)
    internal
    override;

_setPrimaryReceiver

Sets primary receiver address for token sales

function _setPrimaryReceiver(address[] calldata _receivers, uint32[] calldata _allocations) internal;

_setNameAndSymbol

Packs name and symbol into single slot if combined length is 30 bytes or less

function _setNameAndSymbol(string calldata _name, string calldata _symbol) internal;

_setOnchainPointer

Sets the onchain pointer for reconstructing metadata onchain

function _setOnchainPointer(bytes calldata _onchainData) internal;

_setTags

Emits event for setting the project tag descriptions

function _setTags(uint256[] calldata _tagIds) internal;

_verifySignature

Verifies that a signature was generated for the computed digest

function _verifySignature(bytes32 _digest, bytes calldata _signature) internal;

_isVerified

Checks if creator is verified by the system

function _isVerified(address _creator) internal view returns (bool);

_checkFeeReceiver

Checks if fee receiver and allocation amount are included in their respective arrays

function _checkFeeReceiver(
    address[] calldata _receivers,
    uint32[] calldata _allocations,
    address _feeReceiver,
    uint32 _feeAllocation
) internal pure;

_exists

Returns if token id exists.

function _exists(uint256 _tokenId) internal view override(ERC721, RoyaltyManager) returns (bool);