fx(hash)

Docs

Core Contracts

  1. FxContractRegistry: Registry contract that manages all deployed smart contracts registered by fxhash

  2. FxGenArt721: ERC-721 implementation contract that allows for minting of new tokens, burning of existing tokens and managing of token royalties

  3. FxIssuerFactory: Factory contract that clones the FxGenArt721 implementation to create new Generative Art Projects

  4. FxMintTicket721: ERC-721 implementation contract that allows for minting of new tickets, burning of exisiting tickets, and enforcing of harberger taxes over ticket ownership

  5. FxRoleRegistry: Registry contract that implements AccessControl to manage different roles within the system, such as admin, creator, minter, and moderator

  6. FxTicketFactory: Factory contract that clones the FxMintTicket721 implementation to create new Mint Tickets for an existing FxGenArt721 project

Periphery Contracts

  1. DutchAuction: Minter contract that distributes new FxGenArt721 and FxMintTicket721 tokens at a linear price over a fixed interval of time

  2. FixedPrice: Minter contract that distributes new FxGenArt721 and FxMintTicket721 tokens at a fixed price

  3. IPFSRenderer: Renderer contract that constructs offchain metadata of FxGenArt721 and FxMintTicket721 tokens pinned to IPFS

  4. PseudoRandomizer: Randomizer contract that provides a pseudo-randomness keccak256 hash using the token ID, sender's address, current block number, and hash of the previous block

  5. ONCHFSRenderer: Renderer contract that constructs onchain metadata of FxGenArt721 and FxMintTicket721 tokens stored through ONCHFS

  6. TicketRedeemer: Minter contract that burns an existing FxMintTicket721 token and mints a new FxGenArt721 token

Setup

  1. Clone repository
git clone https://github.com/fxhash/fxhash-evm-contracts.git
  1. Create .env file in root directory
DEPLOYER_PRIVATE_KEY=
ETHERSCAN_API_KEY=
GOERLI_RPC_URL=
MAINNET_RPC_URL=
SEPOLIA_RPC_URL=
  1. Install dependencies
forge install
npm ci
  1. Activate husky and commitlint
npx husky install
npx husky add .husky/commit-msg  'npx --no -- commitlint --edit ${1}'
  1. Run tests
npm run test
  1. Run prettier
npm run prettier
  1. Deploy contracts
forge script script/Deploy.s.sol --rpc-url $GOERLI_RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --verify --etherscan-api-key $ETHERSCAN_API_KEY --broadcast
  1. View documentation locally
forge doc --serve --port 3000

Contents

FxIssuerFactory

Git Source

Inherits: IFxIssuerFactory, Ownable, Pausable

Author: fx(hash)

See the documentation in {IFxIssuerFactory}

State Variables

roleRegistry

Returns the address of the FxRoleRegistry contract

address public immutable roleRegistry;

implementation

Returns address of current FxGenArt721 implementation contract

address public implementation;

projectId

Returns counter of latest project ID

uint96 public projectId;

nonces

Mapping of deployer address to nonce value for precomputing token address

mapping(address => uint256) public nonces;

projects

Mapping of project ID to address of FxGenArt721 token contract

mapping(uint96 => address) public projects;

Functions

constructor

Initializes factory owner, FxRoleRegistry and FxGenArt721 implementation

constructor(address _admin, address _roleRegistry, address _implementation);

createProjectWithTicket

Creates new generative art project with new mint ticket in single transaction

function createProjectWithTicket(
    bytes calldata _projectCreationInfo,
    bytes calldata _ticketCreationInfo,
    address _ticketFactory
) external whenNotPaused returns (address genArtToken, address mintTicket);

Parameters

NameTypeDescription
_projectCreationInfobytesBytes-encoded data for project creation
_ticketCreationInfobytesBytes-encoded data for ticket creation
_ticketFactoryaddress

Returns

NameTypeDescription
genArtTokenaddressAddress of newly created FxGenArt721 proxy
mintTicketaddressAddress of newly created FxMintTicket721 proxy

unpause

Enables new FxGenArt721 tokens from being created

function unpause() external onlyOwner;

pause

Stops new FxGenArt721 tokens from being created

function pause() external onlyOwner;

setImplementation

Sets new FxGenArt721 implementation contract

function setImplementation(address _implementation) external onlyOwner;

Parameters

NameTypeDescription
_implementationaddressAddress of the implementation contract

createProject

Creates new generative art project with single parameter

function createProject(bytes memory _creationInfo) public returns (address genArt721);

Parameters

NameTypeDescription
_creationInfobytesBytes-encoded data for project creation

Returns

NameTypeDescription
genArt721addressgenArtToken Address of newly created FxGenArt721 proxy

createProjectWithParams

Creates new generative art project

function createProjectWithParams(
    address _owner,
    InitInfo memory _initInfo,
    ProjectInfo memory _projectInfo,
    MetadataInfo memory _metadataInfo,
    MintInfo[] memory _mintInfo,
    address[] memory _royaltyReceivers,
    uint32[] memory _allocations,
    uint96 _basisPoints
) public whenNotPaused returns (address genArtToken);

Parameters

NameTypeDescription
_owneraddressAddress of project owner
_initInfoInitInfoInitialization information
_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

Returns

NameTypeDescription
genArtTokenaddressAddress of newly created FxGenArt721 proxy

getTokenAddress

Calculates the CREATE2 address of a new FxGenArt721 proxy

function getTokenAddress(address _sender) external view returns (address);

_setImplementation

Sets the FxGenArt721 implementation contract

function _setImplementation(address _implementation) internal;

FxTicketFactory

Git Source

Inherits: IFxTicketFactory, Ownable

Author: fx(hash)

See the documentation in {IFxTicketFactory}

State Variables

implementation

Returns address of current FxMintTicket721 implementation contract

address public implementation;

minGracePeriod

Returns the minimum duration of time before a ticket enters harberger taxation

uint48 public minGracePeriod;

ticketId

Returns counter of latest token ID

uint48 public ticketId;

nonces

Mapping of deployer address to nonce value for precomputing ticket address

mapping(address => uint256) public nonces;

tickets

Mapping of token ID to address of FxMintTicket721 token contract

mapping(uint48 => address) public tickets;

Functions

constructor

Initializes factory owner, FxMintTicket721 implementation and minimum grace period

constructor(address _admin, address _implementation, uint48 _gracePeriod);

createTicket

Creates new mint ticket

function createTicket(bytes calldata _creationInfo) external returns (address mintTicket);

Parameters

NameTypeDescription
_creationInfobytes

setImplementation

Sets new FxMintTicket721 implementation contract

function setImplementation(address _implementation) external onlyOwner;

Parameters

NameTypeDescription
_implementationaddressAddress of the implementation contract

setMinGracePeriod

Sets the new minimum grace period

function setMinGracePeriod(uint48 _gracePeriod) external onlyOwner;

Parameters

NameTypeDescription
_gracePerioduint48Minimum time duration before a ticket enters harberger taxation

createTicket

Creates new mint ticket

function createTicket(
    address _owner,
    address _genArt721,
    address _redeemer,
    address _renderer,
    uint48 _gracePeriod,
    MintInfo[] memory _mintInfo
) public returns (address mintTicket);

Parameters

NameTypeDescription
_owneraddressAddress of project owner
_genArt721addressAddress of GenArt721 token contract
_redeemeraddressAddress of TicketRedeemer minter contract
_rendereraddress
_gracePerioduint48Duration of time before token enters harberger taxation
_mintInfoMintInfo[]Array of authorized minter contracts and their reserves

getTicketAddress

Calculates the CREATE2 address of a new FxMintTicket721 proxy

function getTicketAddress(address _sender) external view returns (address);

_setImplementation

Sets the FxMintTicket721 implementation contract

function _setImplementation(address _implementation) internal;

_setMinGracePeriod

Sets the minimum grace period of time for when token enters harberger taxation

function _setMinGracePeriod(uint48 _gracePeriod) internal;

Contents

IDutchAuction

Git Source

Inherits: IMinter

Author: fx(hash)

Minter for distributing tokens at linear prices over fixed periods of time

Functions

auctions

Mapping of token address to reserve ID to reserve information

function auctions(address, uint256) external view returns (bool, uint248);

buy

Purchases tokens at a linear price over fixed amount of time

function buy(address _token, uint256 _reserveId, uint256 _amount, address _to) external payable;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Amount of tokens to purchase
_toaddressAddress receiving the purchased tokens

buyAllowlist

Purchases tokens through an allowlist at a linear price over fixed amount of time

function buyAllowlist(
    address _token,
    uint256 _reserveId,
    address _to,
    uint256[] calldata _indexes,
    bytes32[][] calldata _proofs
) external payable;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_toaddressAddress receiving the purchased tokens
_indexesuint256[]Array of indices containing purchase info inside the BitMap
_proofsbytes32[][]Array of merkle proofs used for verifying the purchase

buyMintPass

Purchases tokens through a mint pass at a linear price over fixed amount of time

function buyMintPass(
    address _token,
    uint256 _reserveId,
    uint256 _amount,
    address _to,
    uint256 _index,
    bytes calldata _signature
) external payable;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Number of tokens being purchased
_toaddressAddress receiving the purchased tokens
_indexuint256Index of puchase info inside the BitMap
_signaturebytesArray of merkle proofs used for verifying the purchase

getFirstValidReserve

Returns the earliest valid reserveId that can mint a token

function getFirstValidReserve(address _token) external view returns (uint256);

getLatestUpdate

Gets the latest timestamp update made to token reserves

function getLatestUpdate(address _token) external view returns (uint40);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint40Timestamp of latest update

getPrice

Gets the current auction price

function getPrice(address _token, uint256 _reserveId) external view returns (uint256);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve

Returns

NameTypeDescription
<none>uint256price Price of the token

merkleRoots

Mapping of token address to reserve ID to merkle root

function merkleRoots(address, uint256) external view returns (bytes32);

numberMinted

Mapping of token address to reserve ID to number of tokens minted

function numberMinted(address _token, uint256 _reserveId) external view returns (uint256);

pause

Pauses all function executions where modifier is applied

function pause() external;

refund

Refunds an auction buyer with their rebate amount

function refund(address _token, uint256 _reserveId, address _buyer) external;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the mint
_buyeraddressAddress of the buyer receiving the refund

refunds

Mapping of token address to reserve ID to refund amount

function refunds(address, uint256) external view returns (uint256);

reserves

Mapping of token address to reserve ID to reserve information (allocation, price, max mint)

function reserves(address _token, uint256 _reserveId) external view returns (uint64, uint64, uint128);

saleProceeds

Mapping of token address to reserve ID to amount of sale proceeds

function saleProceeds(address _token, uint256 _reserveId) external view returns (uint256);

setMintDetails

Sets the mint details for token reserves

Mint Details: struct of auction information, merkle root, and signer address

function setMintDetails(ReserveInfo calldata _reserveInfo, bytes calldata _mintDetails) external;

Parameters

NameTypeDescription
_reserveInfoReserveInfoReserve information for the token
_mintDetailsbytesDetails of the mint pertaining to the minter

unpause

Unpauses all function executions where modifier is applied

function unpause() external;

withdraw

Withdraws sale processed of primary sales to receiver

function withdraw(address _token, uint256 _reserveId) external;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve

Events

MintDetailsSet

Event emitted when the mint details for a Dutch auction are set

event MintDetailsSet(
    address indexed _token,
    uint256 indexed _reserveId,
    ReserveInfo _reserveInfo,
    bytes32 _merkleRoot,
    address _mintPassSigner,
    AuctionInfo _auctionInfo
);

Parameters

NameTypeDescription
_tokenaddressAddress of the token being minted
_reserveIduint256ID of the reserve
_reserveInfoReserveInfoThe reserve info of the Dutch auction
_merkleRootbytes32The merkle root allowlisted buyers
_mintPassSigneraddressThe signing account for mint passes
_auctionInfoAuctionInfoDutch auction information

Purchase

Event emitted when a purchase is made during the auction

event Purchase(
    address indexed _token,
    uint256 indexed _reserveId,
    address indexed _buyer,
    address _to,
    uint256 _amount,
    uint256 _price
);

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_buyeraddressAddress of the buyer
_toaddressAddress where the purchased tokens will be sent
_amountuint256Amount of tokens purchased
_priceuint256Price at which the tokens were purchased

RefundClaimed

Event emitted when a refund is claimed by a buyer

event RefundClaimed(address indexed _token, uint256 indexed _reserveId, address indexed _buyer, uint256 _refundAmount);

Parameters

NameTypeDescription
_tokenaddressAddress of the token for which the refund is claimed
_reserveIduint256ID of the reserve
_buyeraddressAddress of the buyer claiming the refund
_refundAmountuint256Amount of refund claimed

Withdrawn

Event emitted when the sale proceeds are withdrawn

event Withdrawn(address indexed _token, uint256 indexed _reserveId, address indexed _creator, uint256 _proceeds);

Parameters

NameTypeDescription
_tokenaddressAddress of the token
_reserveIduint256ID of the reserve
_creatoraddressAddress of the creator of the project
_proceedsuint256Amount of sale proceeds withdrawn

Errors

AddressZero

Error thrown when receiver is zero address

error AddressZero();

InsufficientFunds

Error thrown when no funds available to withdraw

error InsufficientFunds();

InsufficientPrice

Error thrown when the price is insufficient

error InsufficientPrice();

InvalidAllocation

Error thrown when the allocation amount is zero

error InvalidAllocation();

InvalidAmount

Error thrown when the purchase amount is zero

error InvalidAmount();

InvalidPayment

Error thrown when payment does not equal price

error InvalidPayment();

InvalidPrice

Error thrown when the price is zero

error InvalidPrice();

InvalidPriceCurve

Error thrown when the passing a price curve with less than 2 points

error InvalidPriceCurve();

InvalidReserve

Error thrown when a reserve does not exist

error InvalidReserve();

InvalidStep

Error thrown when the step length is not equally divisible by the auction duration

error InvalidStep();

InvalidToken

Error thrown when the token is address zero

error InvalidToken();

NoAllowlist

Error thrown when buying through allowlist and no allowlist exists

error NoAllowlist();

NoPublicMint

Error thrown when calling buy when either an allowlist or signer exists

error NoPublicMint();

NoRefund

Error thrown when there is no refund available

error NoRefund();

NoSigningAuthority

Error thrown when buy with a mint pass and no signing authority exists

error NoSigningAuthority();

NotEnded

Error thrown if auction has not ended

error NotEnded();

NonRefundableDA

Error thrown if auction is not a refundable dutch auction

error NonRefundableDA();

NotStarted

Error thrown when the auction has not started

error NotStarted();

OnlyAuthorityOrAllowlist

Error thrown when setting both an allowlist and mint signer

error OnlyAuthorityOrAllowlist();

PricesOutOfOrder

Error thrown when the prices are out of order

error PricesOutOfOrder();

IERC5192

Git Source

Minimal Soulbound NFTs

Functions

locked

Returns the locking status of an Soulbound Token

SBTs assigned to zero address are considered invalid, and queries about them do throw

function locked(uint256 tokenId) external view returns (bool);

Parameters

NameTypeDescription
tokenIduint256The identifier for an SBT

Events

Locked

Emitted when the locking status is changed to locked

If a token is minted and the status is locked, this event should be emitted

event Locked(uint256 tokenId);

Parameters

NameTypeDescription
tokenIduint256The identifier for a token

Unlocked

Emitted when the locking status is changed to unlocked

If a token is minted and the status is unlocked, this event should be emitted

event Unlocked(uint256 tokenId);

Parameters

NameTypeDescription
tokenIduint256The identifier for a token

IFixedPrice

Git Source

Inherits: IMinter

Author: fx(hash)

Minter for distributing tokens at fixed prices

Functions

buy

Purchases tokens at a fixed price

function buy(address _token, uint256 _reserveId, uint256 _amount, address _to) external payable;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve
_amountuint256Amount of tokens being purchased
_toaddressAddress receiving the purchased tokens

buyAllowlist

Purchases tokens through an allowlist at a fixed price

function buyAllowlist(
    address _token,
    uint256 _reserveId,
    address _to,
    uint256[] calldata _indexes,
    bytes32[][] calldata _proofs
) external payable;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_toaddressAddress receiving the purchased tokens
_indexesuint256[]Array of indices regarding purchase info inside the BitMap
_proofsbytes32[][]Array of merkle proofs used for verifying the purchase

buyMintPass

Purchases tokens through a mint pass at a fixed price

function buyMintPass(
    address _token,
    uint256 _reserveId,
    uint256 _amount,
    address _to,
    uint256 _index,
    bytes calldata _signature
) external payable;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Number of tokens being purchased
_toaddressAddress receiving the purchased tokens
_indexuint256Index of puchase info inside the BitMap
_signaturebytesArray of merkle proofs used for verifying the purchase

getFirstValidReserve

Returns the earliest valid reserveId that can mint a token

function getFirstValidReserve(address _token) external view returns (uint256);

getLatestUpdate

Gets the latest timestamp update made to token reserves

function getLatestUpdate(address _token) external view returns (uint40);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint40Timestamp of latest update

getSaleProceed

Gets the proceed amount from a token sale

function getSaleProceed(address _token) external view returns (uint128);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint128Amount of proceeds

merkleRoots

Mapping of token address to reserve ID to merkle roots

function merkleRoots(address, uint256) external view returns (bytes32);

pause

Pauses all function executions where modifier is applied

function pause() external;

prices

Mapping of token address to reserve ID to prices

function prices(address, uint256) external view returns (uint256);

reserves

Mapping of token address to reserve ID to reserve information

function reserves(address, uint256) external view returns (uint64, uint64, uint128);

setMintDetails

Sets the mint details for token reserves

Mint Details: token price, merkle root, and signer address

function setMintDetails(ReserveInfo calldata _reserveInfo, bytes calldata _mintDetails) external;

Parameters

NameTypeDescription
_reserveInfoReserveInfoReserve information for the token
_mintDetailsbytesDetails of the mint pertaining to the minter

unpause

Unpauses all function executions where modifier is applied

function unpause() external;

withdraw

Withdraws the sale proceeds to the sale receiver

function withdraw(address _token) external;

Parameters

NameTypeDescription
_tokenaddressAddress of the token withdrawing proceeds from

Events

MintDetailsSet

Event emitted when a new fixed price mint has been set

event MintDetailsSet(
    address indexed _token,
    uint256 indexed _reserveId,
    uint256 _price,
    ReserveInfo _reserveInfo,
    bytes32 _merkleRoot,
    address _mintPassSigner,
    bool _openEdition,
    bool _timeUnlimited
);

Parameters

NameTypeDescription
_tokenaddressAddress of the token being minted
_reserveIduint256ID of the reserve
_priceuint256Amount of fixed price mint
_reserveInfoReserveInfoReserve information for the mint
_merkleRootbytes32The merkle root allowlisted buyers
_mintPassSigneraddressThe signing account for mint passes
_openEditionboolStatus of an open edition mint
_timeUnlimitedboolStatus of a mint with unlimited time

Purchase

Event emitted when a purchase is made

event Purchase(
    address indexed _token,
    uint256 indexed _reserveId,
    address indexed _buyer,
    uint256 _amount,
    address _to,
    uint256 _price
);

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the mint
_buyeraddressAddress purchasing the tokens
_amountuint256Amount of tokens being purchased
_toaddressAddress to which the tokens are being transferred
_priceuint256Price of the purchase

Withdrawn

Event emitted when sale proceeds are withdrawn

event Withdrawn(address indexed _token, address indexed _creator, uint256 _proceeds);

Parameters

NameTypeDescription
_tokenaddressAddress of the token
_creatoraddressAddress of the project creator
_proceedsuint256Amount of proceeds being withdrawn

Errors

AddressZero

Error thrown when receiver is zero address

error AddressZero();

Ended

Error thrown when the sale has already ended

error Ended();

InsufficientFunds

Error thrown when no funds available to withdraw

error InsufficientFunds();

InvalidAllocation

Error thrown when the allocation amount is zero

error InvalidAllocation();

InvalidPayment

Error thrown when payment does not equal price

error InvalidPayment();

InvalidReserve

Error thrown thrown when reserve does not exist

error InvalidReserve();

InvalidTimes

Error thrown when reserve start and end times are invalid

error InvalidTimes();

InvalidToken

Error thrown when token address is invalid

error InvalidToken();

NoAllowlist

Error thrown when buying through allowlist and no allowlist exists

error NoAllowlist();

NoPublicMint

Error thrown when calling buy when either an allowlist or signer exists

error NoPublicMint();

NoSigningAuthority

Error thrown when buy with a mint pass and no signing authority exists

error NoSigningAuthority();

NotStarted

Error thrown when the auction has not started

error NotStarted();

OnlyAuthorityOrAllowlist

Error thrown when setting both an allowlist and mint signer

error OnlyAuthorityOrAllowlist();

TooMany

Error thrown when amount purchased exceeds remaining allocation

error TooMany();

IFxContractRegistry

Git Source

Author: fx(hash)

Registry for managing fxhash smart contracts

Functions

configInfo

Returns the system config information

function configInfo() external view returns (address, uint32, uint32, uint32, uint64, string memory, string memory);

contracts

Mapping of hashed contract name to contract address

function contracts(bytes32) external view returns (address);

register

Registers deployed contract addresses based on hashed value of name

function register(string[] calldata _names, address[] calldata _contracts) external;

Parameters

NameTypeDescription
_namesstring[]Array of contract names
_contractsaddress[]Array of contract addresses

setConfig

Sets the system config information

function setConfig(ConfigInfo calldata _configInfo) external;

Parameters

NameTypeDescription
_configInfoConfigInfoConfig information (lock time, referrer share, default metadata)

Events

ContractRegistered

Event emitted when contract gets registered

event ContractRegistered(string indexed _contractName, bytes32 indexed _hashedName, address indexed _contractAddr);

Parameters

NameTypeDescription
_contractNamestringName of the contract
_hashedNamebytes32Hashed name of the contract
_contractAddraddressAddress of the contract

ConfigUpdated

Event emitted when the config information is updated

event ConfigUpdated(address indexed _owner, ConfigInfo _configInfo);

Parameters

NameTypeDescription
_owneraddressAddress of the registry owner
_configInfoConfigInfoUpdated config information

Errors

LengthMismatch

Error thrown when array lengths do not match

error LengthMismatch();

LengthZero

Error thrown when array length is zero

error LengthZero();

IFxGenArt721

Git Source

Inherits: ISeedConsumer, IToken

Author: fx(hash)

ERC-721 token for generative art projects created on fxhash

Functions

activeMinters

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

burn

Burns token ID from the circulating supply

function burn(uint256 _tokenId) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

contractRegistry

Returns address of the FxContractRegistry contract

function contractRegistry() external view returns (address);

contractURI

Returns contract-level metadata for storefront marketplaces

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

fulfillSeedRequest

Fullfills the random seed request on the FxGenArt721 token contract

function fulfillSeedRequest(uint256 _tokenId, bytes32 _seed) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_seedbytes32Hash of the random seed

genArtInfo

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

function genArtInfo(uint256 _tokenId) external view returns (address, bytes32, bytes memory);

generateOnchainPointerHash

Generates typed data hash for setting project metadata onchain

function generateOnchainPointerHash(bytes calldata _data) external 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) external view returns (bytes32);

Parameters

NameTypeDescription
_rendereraddressAddress of the new renderer contract

Returns

NameTypeDescription
<none>bytes32Typed data hash

initialize

Initializes new generative art project

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

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

isMinter

Gets the authorization status for the given minter contract

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

Parameters

NameTypeDescription
_minteraddressAddress of the minter contract

Returns

NameTypeDescription
<none>boolAuthorization status

issuerInfo

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

function issuerInfo() external view returns (address, ProjectInfo memory);

metadataInfo

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

function metadataInfo() external view returns (bytes memory, address);

mint

Mints arbitrary number of tokens

Only callable by registered minter contracts

function mint(address _to, uint256 _amount, uint256 _payment) external;

Parameters

NameTypeDescription
_toaddressAddress receiving tokens
_amountuint256Number of tokens being minted
_paymentuint256Total payment amount of the transaction

mintParams

Mints single fxParams token

Only callable by registered minter contracts

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

Parameters

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

nonce

Current nonce for admin signatures

function nonce() external returns (uint96);

ownerMint

Mints single token with randomly generated seed

Only callable by contract owner

function ownerMint(address _to) external;

Parameters

NameTypeDescription
_toaddressAddress receiving token

ownerMintParams

Mints single fxParams token

Only callable by contract owner

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

Parameters

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

pause

Pauses all function executions where modifier is applied

function pause() external;

primaryReceiver

Returns address of primary receiver for token sales

function primaryReceiver() external view returns (address);

randomizer

Returns the address of the randomizer contract

function randomizer() external view returns (address);

reduceSupply

Reduces maximum supply of collection

function reduceSupply(uint120 _supply) external;

Parameters

NameTypeDescription
_supplyuint120Maximum supply amount

registerMinters

Registers minter contracts with resereve info

function registerMinters(MintInfo[] memory _mintInfo) external;

Parameters

NameTypeDescription
_mintInfoMintInfo[]Mint information of token reserves

remainingSupply

Returns the remaining supply of tokens left to mint

function remainingSupply() external view returns (uint256);

renderer

Returns the address of the Renderer contract

function renderer() external view returns (address);

roleRegistry

Returns the address of the FxRoleRegistry contract

function roleRegistry() external view returns (address);

setBaseRoyalties

Sets the base royalties for all secondary token sales

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

Parameters

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

setBaseURI

Sets the new URI of the token metadata

function setBaseURI(bytes calldata _uri) external;

Parameters

NameTypeDescription
_uribytesDecoded content identifier of metadata pointer

setBurnEnabled

Sets flag status of public burn to enabled or disabled

function setBurnEnabled(bool _flag) external;

Parameters

NameTypeDescription
_flagboolStatus of burn

setMintEnabled

Sets flag status of public mint to enabled or disabled

function setMintEnabled(bool _flag) external;

Parameters

NameTypeDescription
_flagboolStatus of mint

setOnchainPointer

Sets the onchain pointer for reconstructing project metadata onchain

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

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;

Parameters

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

setRandomizer

Sets the new randomizer contract

function setRandomizer(address _randomizer) external;

Parameters

NameTypeDescription
_randomizeraddressAddress of the randomizer contract

setRenderer

Sets the new renderer contract

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

Parameters

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

setTags

Emits an event for setting tag descriptions for the project

function setTags(uint256[] calldata _tagIds) external;

Parameters

NameTypeDescription
_tagIdsuint256[]Array of tag IDs describing the project

totalSupply

Returns the current circulating supply of tokens

function totalSupply() external view returns (uint96);

unpause

Unpauses all function executions where modifier is applied

function unpause() external;

Events

BaseURIUpdated

Event emitted when the base URI is updated

event BaseURIUpdated(bytes _uri);

Parameters

NameTypeDescription
_uribytesDecoded content identifier of metadata pointer

BurnEnabled

Event emitted when public burn is enabled or disabled

event BurnEnabled(bool indexed _flag);

Parameters

NameTypeDescription
_flagboolStatus of burn

MintEnabled

Event emitted when public mint is enabled or disabled

event MintEnabled(bool indexed _flag);

Parameters

NameTypeDescription
_flagboolStatus of mint

ProjectDeleted

Event emitted when project is deleted only once supply is set to zero

event ProjectDeleted();

ProjectInitialized

Event emitted when new project is initialized

event ProjectInitialized(
    address indexed _primaryReceiver, ProjectInfo _projectInfo, MetadataInfo _metadataInfo, MintInfo[] _mintInfo
);

Parameters

NameTypeDescription
_primaryReceiveraddressAddress of splitter contract receiving primary sales
_projectInfoProjectInfoProject information
_metadataInfoMetadataInfoMetadata information of token
_mintInfoMintInfo[]Array of authorized minter contracts and their reserves

PrimaryReceiverUpdated

Event emitted when the primary receiver address is updated

event PrimaryReceiverUpdated(address indexed _receiver, address[] _receivers, uint32[] _allocations);

Parameters

NameTypeDescription
_receiveraddressThe split address receiving funds on behalf of the users
_receiversaddress[]Array of addresses receiving a portion of the funds in a split
_allocationsuint32[]Array of allocation shares for the split

ProjectTags

Event emitted when project tags are set

event ProjectTags(uint256[] indexed _tagIds);

Parameters

NameTypeDescription
_tagIdsuint256[]Array of tag IDs describing the project

RandomizerUpdated

Event emitted when Randomizer contract is updated

event RandomizerUpdated(address indexed _randomizer);

Parameters

NameTypeDescription
_randomizeraddressAddress of new Randomizer contract

RendererUpdated

Event emitted when Renderer contract is updated

event RendererUpdated(address indexed _renderer);

Parameters

NameTypeDescription
_rendereraddressAddress of new Renderer contract

OnchainPointerUpdated

Event emitted when onchain data of project is updated

event OnchainPointerUpdated(address _pointer);

Parameters

NameTypeDescription
_pointeraddressSSTORE2 pointer to the onchain data

SupplyReduced

Event emitted when maximum supply is reduced

event SupplyReduced(uint120 indexed _prevSupply, uint120 indexed _newSupply);

Parameters

NameTypeDescription
_prevSupplyuint120Amount of previous supply
_newSupplyuint120Amount of new supply

Errors

AllocationExceeded

Error thrown when total minter allocation exceeds maximum supply

error AllocationExceeded();

BurnInactive

Error thrown when burning is inactive

error BurnInactive();

FeeReceiverMissing

Error thrown when the fee receiver address is not included in the receiver allocations

error FeeReceiverMissing();

InsufficientSupply

Error thrown when remaining supply is zero

error InsufficientSupply();

InvalidAmount

Error thrown when max supply amount is invalid

error InvalidAmount();

InvalidInputSize

Error thrown when input size does not match actual byte size of params data

error InvalidInputSize();

InvalidStartTime

Error thrown when reserve start time is invalid

error InvalidStartTime();

InvalidEndTime

Error thrown when reserve end time is invalid

error InvalidEndTime();

InvalidFeeReceiver

Error thrown when the configured fee receiver is not valid

error InvalidFeeReceiver();

MintActive

Error thrown when minting is active

error MintActive();

MintInactive

Error thrown when minting is inactive

error MintInactive();

NotAuthorized

Error thrown when caller is not authorized to execute transaction

error NotAuthorized();

NotOwner

Error thrown when signer is not the owner

error NotOwner();

SupplyRemaining

Error thrown when supply is remaining

error SupplyRemaining();

UnauthorizedAccount

Error thrown when caller does not have the specified role

error UnauthorizedAccount();

UnauthorizedMinter

Error thrown when caller does not have minter role

error UnauthorizedMinter();

UnregisteredMinter

Error thrown when minter is not registered on token contract

error UnregisteredMinter();

IFxIssuerFactory

Git Source

Author: fx(hash)

Factory for managing newly deployed FxGenArt721 tokens

Functions

createProjectWithParams

Creates new generative art project

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

Parameters

NameTypeDescription
_owneraddressAddress of project owner
_initInfoInitInfoInitialization information
_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

Returns

NameTypeDescription
<none>addressgenArtToken Address of newly created FxGenArt721 proxy

createProject

Creates new generative art project with single parameter

function createProject(bytes memory _creationInfo) external returns (address);

Parameters

NameTypeDescription
_creationInfobytesBytes-encoded data for project creation

Returns

NameTypeDescription
<none>addressgenArtToken Address of newly created FxGenArt721 proxy

createProjectWithTicket

Creates new generative art project with new mint ticket in single transaction

function createProjectWithTicket(
    bytes calldata _projectCreationInfo,
    bytes calldata _ticketCreationInfo,
    address _tickeFactory
) external returns (address, address);

Parameters

NameTypeDescription
_projectCreationInfobytesBytes-encoded data for project creation
_ticketCreationInfobytesBytes-encoded data for ticket creation
_tickeFactoryaddressAddress of FxTicketFactory contract

Returns

NameTypeDescription
<none>addressgenArtToken Address of newly created FxGenArt721 proxy
<none>addressmintTicket Address of newly created FxMintTicket721 proxy

getTokenAddress

Calculates the CREATE2 address of a new FxGenArt721 proxy

function getTokenAddress(address _sender) external view returns (address);

implementation

Returns address of current FxGenArt721 implementation contract

function implementation() external view returns (address);

nonces

Mapping of deployer address to nonce value for precomputing token address

function nonces(address _deployer) external view returns (uint256);

pause

Stops new FxGenArt721 tokens from being created

function pause() external;

projectId

Returns counter of latest project ID

function projectId() external view returns (uint96);

projects

Mapping of project ID to address of FxGenArt721 token contract

function projects(uint96) external view returns (address);

roleRegistry

Returns the address of the FxRoleRegistry contract

function roleRegistry() external view returns (address);

setImplementation

Sets new FxGenArt721 implementation contract

function setImplementation(address _implementation) external;

Parameters

NameTypeDescription
_implementationaddressAddress of the implementation contract

unpause

Enables new FxGenArt721 tokens from being created

function unpause() external;

Events

ImplementationUpdated

Event emitted when the FxGenArt721 implementation contract is updated

event ImplementationUpdated(address indexed _owner, address indexed _implementation);

Parameters

NameTypeDescription
_owneraddressAddress of the factory owner
_implementationaddressAddress of the new FxGenArt721 implementation contract

ProjectCreated

Event emitted when a new generative art project is created

event ProjectCreated(uint96 indexed _projectId, address indexed _genArtToken, address indexed _owner);

Parameters

NameTypeDescription
_projectIduint96ID of the project
_genArtTokenaddressAddress of newly deployed FxGenArt721 token contract
_owneraddressAddress of project owner

Errors

InvalidOwner

Error thrown when owner is zero address

error InvalidOwner();

InvalidPrimaryReceiver

Error thrown when primary receiver is zero address

error InvalidPrimaryReceiver();

NotAuthorized

Error thrown when caller is not authorized to execute transaction

error NotAuthorized();

IFxMintTicket721

Git Source

Inherits: IToken

Author: fx(hash)

ERC-721 token for mint tickets used to redeem FxGenArt721 tokens

Functions

activeMinters

Returns the list of active minters

function activeMinters(uint256) external view returns (address);

balances

Mapping of wallet address to pending balance available for withdrawal

function balances(address) external view returns (uint256);

baseURI

Returns the decoded content identifier of the metadata pointer

function baseURI() external view returns (bytes memory);

burn

Burns token ID from the circulating supply

function burn(uint256 _tokenId) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

claim

Claims token at current price and sets new price of token with initial deposit amount

function claim(uint256 _tokenId, uint256 _maxPrice, uint80 _newPrice) external payable;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_maxPriceuint256Maximum payment amount allowed to prevent front-running of listing price
_newPriceuint80New listing price of token

contractRegistry

Returns the address of the FxContractRegistry contract

function contractRegistry() external view returns (address);

contractURI

Gets the contact-level metadata for the ticket

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

Returns

NameTypeDescription
<none>stringURI of the contract metadata

deposit

Deposits taxes for given token

function deposit(uint256 _tokenId) external payable;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

depositAndSetPrice

Deposits taxes for given token and set new price for same token

function depositAndSetPrice(uint256 _tokenId, uint80 _newPrice) external payable;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_newPriceuint80New listing price of token

initialize

Initializes new generative art project

function initialize(
    address _owner,
    address _genArt721,
    address _redeemer,
    address _renderer,
    uint48 _gracePeriod,
    MintInfo[] calldata _mintInfo
) external;

Parameters

NameTypeDescription
_owneraddressAddress of contract owner
_genArt721addressAddress of GenArt721 token contract
_redeemeraddressAddress of TicketRedeemer minter contract
_rendereraddressAddress of renderer contract
_gracePerioduint48Period time before token enters harberger taxation
_mintInfoMintInfo[]Array of authorized minter contracts and their reserves

isForeclosed

Checks if token is foreclosed

function isForeclosed(uint256 _tokenId) external view returns (bool);

Parameters

NameTypeDescription
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>boolStatus of foreclosure

genArt721

Returns address of the FxGenArt721 token contract

function genArt721() external view returns (address);

getAuctionPrice

Gets the current auction price of the token

function getAuctionPrice(uint256 _currentPrice, uint256 _foreclosureTime) external view returns (uint256);

Parameters

NameTypeDescription
_currentPriceuint256Listing price of the token
_foreclosureTimeuint256Timestamp of the foreclosure

getDailyTax

Gets the daily tax amount based on current price

function getDailyTax(uint256 _currentPrice) external pure returns (uint256);

Parameters

NameTypeDescription
_currentPriceuint256Current listing price

Returns

NameTypeDescription
<none>uint256Daily tax amount

getDepositAmounts

Gets the deposit amount owed and remaining after change in price, claim or burn

function getDepositAmounts(uint256 _dailyTax, uint256 _depositAmount, uint256 _foreclosureTime)
    external
    view
    returns (uint256, uint256);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Total amount of taxes deposited
_foreclosureTimeuint256Timestamp of current foreclosure

Returns

NameTypeDescription
<none>uint256Deposit amount owed
<none>uint256Deposit amount remaining

getExcessTax

Gets the excess amount of taxes paid

function getExcessTax(uint256 _dailyTax, uint256 _depositAmount) external view returns (uint256);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Total amount of taxes deposited

Returns

NameTypeDescription
<none>uint256Excess amount of taxes

getNewForeclosure

Gets the new foreclosure timestamp

function getNewForeclosure(uint256 _dailyTax, uint256 _depositAmount, uint256 _foreclosureTime)
    external
    view
    returns (uint48);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Amount of taxes being deposited
_foreclosureTimeuint256Timestamp of current foreclosure

Returns

NameTypeDescription
<none>uint48Timestamp of new foreclosure

getTaxDuration

Gets the total duration of time covered

function getTaxDuration(uint256 _dailyTax, uint256 _depositAmount) external pure returns (uint256);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Amount of taxes being deposited

Returns

NameTypeDescription
<none>uint256Total time duration

gracePeriod

Returns default grace period of time for each token

function gracePeriod() external view returns (uint48);

mint

Mints arbitrary number of tokens

Only callable by registered minter contracts

function mint(address _to, uint256 _amount, uint256 _payment) external;

Parameters

NameTypeDescription
_toaddressAddress receiving tokens
_amountuint256Number of tokens being minted
_paymentuint256Total payment amount of the transaction

minters

Returns the active status of a registered minter contract

function minters(address) external view returns (uint8);

pause

Pauses all function executions where modifier is set

function pause() external;

primaryReceiver

Returns address of primary receiver for token sales

function primaryReceiver() external view returns (address);

redeemer

Returns the address of the TickeRedeemer contract

function redeemer() external view returns (address);

renderer

Returns the address of the renderer contract

function renderer() external view returns (address);

registerMinters

Registers minter contracts with resereve info

function registerMinters(MintInfo[] memory _mintInfo) external;

roleRegistry

Returns the address of the FxRoleRegistry contract

function roleRegistry() external view returns (address);

setBaseURI

Sets the new URI of the token metadata

function setBaseURI(bytes calldata _uri) external;

Parameters

NameTypeDescription
_uribytesDecoded content identifier of metadata pointer

setPrice

Sets new price for given token

function setPrice(uint256 _tokenId, uint80 _newPrice) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_newPriceuint80New price of the token

taxes

Mapping of ticket ID to tax information (grace period, foreclosure time, current price, deposit amount)

function taxes(uint256) external returns (uint48, uint48, uint80, uint80);

totalSupply

Returns the current circulating supply of tokens

function totalSupply() external returns (uint48);

unpause

Unpauses all function executions where modifier is set

function unpause() external;

updateStartTime

Updates taxation start time to the current timestamp

function updateStartTime(uint256 _tokenId) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

withdraw

Withdraws available balance amount to given address

function withdraw(address _to) external;

Parameters

NameTypeDescription
_toaddressAddress being withdrawn to

Events

BaseURIUpdated

Event emitted when the base URI is updated

event BaseURIUpdated(bytes _uri);

Parameters

NameTypeDescription
_uribytesDecoded content identifier of metadata pointer

Claimed

Event emitted when token is claimed at either listing or auction price

event Claimed(
    uint256 indexed _tokenId,
    address indexed _claimer,
    uint128 _newPrice,
    uint48 _foreclosureTime,
    uint80 _depositAmount,
    uint256 _payment
);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_claimeraddressAddress of the token claimer
_newPriceuint128Updated listing price of token
_foreclosureTimeuint48Timestamp of new foreclosure date
_depositAmountuint80Total amount of taxes deposited
_paymentuint256Current price of token in addition to taxes deposited

Deposited

Event emitted when additional taxes are deposited

event Deposited(uint256 indexed _tokenId, address indexed _depositer, uint48 _foreclosureTime, uint80 _depositAmount);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_depositeraddressAddress of tax depositer
_foreclosureTimeuint48Timestamp of new foreclosure date
_depositAmountuint80Total amount of taxes deposited

SetPrice

Event emitted when new listing price is set

event SetPrice(uint256 indexed _tokenId, uint128 _newPrice, uint128 _foreclosureTime, uint128 _depositAmount);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_newPriceuint128New listing price of token
_foreclosureTimeuint128Timestamp of new foreclosure date
_depositAmountuint128Adjusted amount of taxes deposited due to price change

StartTimeUpdated

Event emitted when taxation start time is updated to current timestamp

event StartTimeUpdated(uint256 indexed _tokenId, address indexed _owner, uint128 _foreclosureTime);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_owneraddressAddress of token owner
_foreclosureTimeuint128Timestamp of foreclosure date

TicketInitialized

Event emitted when mint ticket is initialized

event TicketInitialized(
    address indexed _genArt721,
    address indexed _redeemer,
    address indexed _renderer,
    uint48 _gracePeriod,
    MintInfo[] _mintInfo
);

Parameters

NameTypeDescription
_genArt721addressAddress of FxGenArt721 token contract
_redeemeraddressAddress of TicketRedeemer contract
_rendereraddressAddress of renderer contract
_gracePerioduint48Time period before token enters harberger taxation
_mintInfoMintInfo[]Array of authorized minter contracts and their reserves

Withdraw

Event emitted when balance is withdrawn

event Withdraw(address indexed _caller, address indexed _to, uint256 indexed _balance);

Parameters

NameTypeDescription
_calleraddressAddress of caller
_toaddressAddress receiving balance amount
_balanceuint256Amount of ether being withdrawn

Errors

AllocationExceeded

Error thrown when total minter allocation exceeds maximum supply

error AllocationExceeded();

Foreclosure

Error thrown when token is in foreclosure

error Foreclosure();

GracePeriodActive

Error thrown when token is being claimed within the grace period

error GracePeriodActive();

GracePeriodInactive

Error thrown when token is outside of the grace period

error GracePeriodInactive();

InsufficientDeposit

Error thrown when deposit amount is not for at least one day

error InsufficientDeposit();

InsufficientPayment

Error thrown when payment amount does not meet price plus daily tax amount

error InsufficientPayment();

InvalidEndTime

Error thrown when reserve end time is invalid

error InvalidEndTime();

InvalidPrice

Error thrown when new listing price is less than the mininmum amount

error InvalidPrice();

InvalidStartTime

Error thrown when reserve start time is invalid

error InvalidStartTime();

PriceExceeded

Error thrown when current price exceeds maximum payment amount

error PriceExceeded();

MintActive

Error thrown when minting is active

error MintActive();

NotAuthorized

Error thrown when caller is not authorized to execute transaction

error NotAuthorized();

UnauthorizedAccount

Error thrown when caller does not have the specified role

error UnauthorizedAccount();

UnauthorizedMinter

Error thrown when caller does not have minter role

error UnauthorizedMinter();

UnauthorizedRedeemer

Error thrown when caller does not have the redeemer role

error UnauthorizedRedeemer();

UnregisteredMinter

Error thrown when caller is not a registered minter

error UnregisteredMinter();

IFxRoleRegistry

Git Source

Author: fx(hash)

Registry for managing AccessControl roles throughout the system

Functions

setRoleAdmin

Sets the admin of a new or existing role

function setRoleAdmin(bytes32 _role) external;

Parameters

NameTypeDescription
_rolebytes32Hash of the role name

IFxTicketFactory

Git Source

Author: fx(hash)

Factory for managing newly deployed FxMintTicket721 tokens

Functions

createTicket

Creates new mint ticket

function createTicket(
    address _owner,
    address _genArt721,
    address _redeemer,
    address _renderer,
    uint48 _gracePeriod,
    MintInfo[] memory _mintInfo
) external returns (address);

Parameters

NameTypeDescription
_owneraddressAddress of project owner
_genArt721addressAddress of GenArt721 token contract
_redeemeraddressAddress of TicketRedeemer minter contract
_rendereraddress
_gracePerioduint48Duration of time before token enters harberger taxation
_mintInfoMintInfo[]Array of authorized minter contracts and their reserves

createTicket

Creates new mint ticket for new generative art project in single transaction

function createTicket(bytes calldata _creationInfo) external returns (address);

Parameters

NameTypeDescription
_creationInfobytesBytes-encoded data for ticket creation

Returns

NameTypeDescription
<none>addressmintTicket Address of newly created FxMintTicket721 proxy

getTicketAddress

Calculates the CREATE2 address of a new FxMintTicket721 proxy

function getTicketAddress(address _sender) external view returns (address);

implementation

Returns address of current FxMintTicket721 implementation contract

function implementation() external view returns (address);

minGracePeriod

Returns the minimum duration of time before a ticket enters harberger taxation

function minGracePeriod() external view returns (uint48);

nonces

Mapping of deployer address to nonce value for precomputing ticket address

function nonces(address _deployer) external view returns (uint256);

setMinGracePeriod

Sets the new minimum grace period

function setMinGracePeriod(uint48 _gracePeriod) external;

Parameters

NameTypeDescription
_gracePerioduint48Minimum time duration before a ticket enters harberger taxation

setImplementation

Sets new FxMintTicket721 implementation contract

function setImplementation(address _implementation) external;

Parameters

NameTypeDescription
_implementationaddressAddress of the implementation contract

ticketId

Returns counter of latest token ID

function ticketId() external view returns (uint48);

tickets

Mapping of token ID to address of FxMintTicket721 token contract

function tickets(uint48 _ticketId) external view returns (address);

Events

GracePeriodUpdated

Event emitted when the minimum grace period is updated

event GracePeriodUpdated(address indexed _owner, uint48 indexed _gracePeriod);

Parameters

NameTypeDescription
_owneraddressAddress of the factory owner
_gracePerioduint48Time duration of the new grace period

ImplementationUpdated

Event emitted when the FxMintTicket721 implementation contract is updated

event ImplementationUpdated(address indexed _owner, address indexed _implementation);

Parameters

NameTypeDescription
_owneraddressAddress of the factory owner
_implementationaddressAddress of the new FxMintTicket721 implementation contract

TicketCreated

Event emitted when new FxMintTicket721 is created

event TicketCreated(uint96 indexed _ticketId, address indexed _mintTicket, address indexed _owner);

Parameters

NameTypeDescription
_ticketIduint96ID of the ticket contract
_mintTicketaddressAddress of newly deployed FxMintTicket721 token contract
_owneraddressAddress of ticket owner

Errors

InvalidGracePeriod

Error thrown when grace period is less than minimum requirement of one day

error InvalidGracePeriod();

InvalidOwner

Error thrown when owner is zero address

error InvalidOwner();

InvalidRedeemer

Error thrown when redeemer contract is zero address

error InvalidRedeemer();

InvalidRenderer

Error thrown when renderer contract is zero address

error InvalidRenderer();

InvalidToken

Error thrown when token contract is zero address

error InvalidToken();

IIPFSRenderer

Git Source

Inherits: IRenderer

Author: fx(hash)

Renderer for constructing offchain metadata of FxGenArt721 tokens pinned to IPFS

Functions

contractRegistry

Returns address of the FxContractRegistry contract

function contractRegistry() external view returns (address);

contractURI

Gets the contact-level metadata for the project

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

Returns

NameTypeDescription
<none>stringURI of the contract metadata

getMetadataURL

Generates the metadata URL for a token ID

function getMetadataURL(address _contractAddr, string memory _baseURI, uint256 _tokenId)
    external
    view
    returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_baseURIstringURI of the content identifier
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringURL of the JSON metadata

tokenURI

Gets the metadata for a token

function tokenURI(uint256 _tokenId, bytes calldata _data) external view returns (string memory);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_databytesAdditional data used to construct metadata

Returns

NameTypeDescription
<none>stringURI of the token metadata

IMinter

Git Source

Author: fx(hash)

Interface for FxGenArt721 tokens to interact with minters

Functions

setMintDetails

Sets the mint details for token reserves

function setMintDetails(ReserveInfo calldata _reserveInfo, bytes calldata _mintDetails) external;

Parameters

NameTypeDescription
_reserveInfoReserveInfoReserve information for the token
_mintDetailsbytesDetails of the mint pertaining to the minter

IONCHFSRenderer

Git Source

Inherits: IRenderer

Author: fx(hash)

Renderer for reconstructing metadata of FxGenArt721 tokens stored onchain through ONCHFS

Functions

contractRegistry

Returns address of the FxContractRegistry contract

function contractRegistry() external view returns (address);

contractURI

Gets the contact-level metadata for the project

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

Returns

NameTypeDescription
<none>stringURI of the contract metadata

getAnimationURL

Generates the animation URL for a token ID

function getAnimationURL(bytes32 _onchfsCID, uint256 _tokenId, address _minter, bytes32 _seed, bytes memory _fxParams)
    external
    pure
    returns (string memory);

Parameters

NameTypeDescription
_onchfsCIDbytes32CID hash of token animation
_tokenIduint256ID of the token
_minteraddressAddress of initial token owner
_seedbytes32Hash of randomly generated seed
_fxParamsbytesRandom sequence of fixed-length bytes used as token input

Returns

NameTypeDescription
<none>stringURL of the animation pointer

getAttributes

Generates the list of attributes for a token ID

function getAttributes(address _contractAddr, string memory _baseURI, uint256 _tokenId)
    external
    view
    returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_baseURIstringURI of the content identifier
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringList of token attributes

getExternalURL

Generates the external URL for a token ID

function getExternalURL(address _contractAddr, uint256 _tokenId) external view returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringURL of the external token pointer

getImageURL

Generates the image URL for a token ID

function getImageURL(address _contractAddr, string memory _baseURI, uint256 _tokenId)
    external
    view
    returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_baseURIstringURI of the content identifier
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringURL of the image pointer

tokenURI

Gets the metadata for a token

function tokenURI(uint256 _tokenId, bytes calldata _data) external view returns (string memory);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_databytesAdditional data used to construct metadata

Returns

NameTypeDescription
<none>stringURI of the token metadata

IPseudoRandomizer

Git Source

Inherits: IRandomizer

Author: fx(hash)

Randomizer for generating psuedorandom seeds for newly minted tokens

Functions

generateSeed

Generates random seed for token using entropy

function generateSeed(uint256 _tokenId) external view returns (bytes32);

Parameters

NameTypeDescription
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>bytes32Hash of the seed

requestRandomness

Requests random seed for a given token

function requestRandomness(uint256 _tokenId) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

IRandomizer

Git Source

Author: fx(hash)

Interface for FxGenArt721 tokens to interact with randomizers

Functions

requestRandomness

Requests random seed for a given token

function requestRandomness(uint256 _tokenId) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

IRenderer

Git Source

Author: fx(hash)

Interface for FxGenArt721 tokens to interact with renderers

Functions

contractRegistry

Returns address of the FxContractRegistry contract

function contractRegistry() external view returns (address);

contractURI

Gets the contact-level metadata for the project

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

Returns

NameTypeDescription
<none>stringURI of the contract metadata

tokenURI

Gets the metadata for a token

function tokenURI(uint256 _tokenId, bytes calldata _data) external view returns (string memory);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_databytesAdditional data used to construct metadata

Returns

NameTypeDescription
<none>stringURI of the token metadata

IRoyaltyManager

Git Source

Author: fx(hash)

Extension for managing secondary royalties of FxGenArt721 tokens

Functions

getRoyalties

Gets the royalties for a specific token ID

function getRoyalties(uint256 _tokenId) external view returns (address[] memory, uint256[] memory);

Parameters

NameTypeDescription
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>address[]Total receivers and basis points
<none>uint256[]

royaltyInfo

Returns the royalty information for a specific token ID and sale price

function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address, uint256);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_salePriceuint256Sale price of the token

Returns

NameTypeDescription
<none>addressreceiver Address receiving royalties
<none>uint256royaltyAmount Amount to royalties being paid out

Events

TokenIdRoyaltiesUpdated

Event emitted when the royalties for a token ID have been updated

event TokenIdRoyaltiesUpdated(uint256 indexed _tokenId, address _receiver, uint96 _basisPoints);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_receiveraddressAddresses receiving the royalties
_basisPointsuint96Points used to calculate royalty payments (100 = 1%)

TokenRoyaltiesUpdated

Event emitted when the royalties for a list of receivers have been updated

event TokenRoyaltiesUpdated(
    address indexed _receiver, address[] _receivers, uint32[] _allocations, uint96 _basisPoints
);

Parameters

NameTypeDescription
_receiveraddressThe address receiving royalties for the token either an account or a split address
_receiversaddress[]Array of addresses receiving royalties
_allocationsuint32[]Array of allocations used to determine the proportional share of royalty payments
_basisPointsuint96Points used to calculate royalty payments (100 = 1%)

Errors

BaseRoyaltiesNotSet

Error thrown when the royalties are not set

error BaseRoyaltiesNotSet();

InvalidRoyaltyConfig

Error thrown when royalty configuration is greater than or equal to 100%

error InvalidRoyaltyConfig();

LengthMismatch

Error thrown when array lengths do not match

error LengthMismatch();

MoreThanOneRoyaltyReceiver

Error thrown when more than one royalty receiver is set

error MoreThanOneRoyaltyReceiver();

NonExistentToken

Error thrown when the token ID does not exist

error NonExistentToken();

NoRoyaltyReceiver

Error thrown when royalty receiver is zero address

error NoRoyaltyReceiver();

OverMaxBasisPointsAllowed

Error thrown when total basis points exceeds maximum value allowed

error OverMaxBasisPointsAllowed();

TokenRoyaltiesNotSet

Error thrown when the token royalties are not set

error TokenRoyaltiesNotSet();

ISeedConsumer

Git Source

Author: fx(hash)

Interface for randomizers to interact with FxGenArt721 tokens

Functions

fulfillSeedRequest

Fullfills the random seed request on the FxGenArt721 token contract

function fulfillSeedRequest(uint256 _tokenId, bytes32 _seed) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_seedbytes32Hash of the random seed

Events

SeedFulfilled

Event emitted when a seed request is fulfilled for a specific token

event SeedFulfilled(address indexed _randomizer, uint256 indexed _tokenId, bytes32 _seed);

Parameters

NameTypeDescription
_randomizeraddressAddress of the randomizer contract
_tokenIduint256ID of the token
_seedbytes32Hash of the random seed

ISplitsMain

Git Source

Author: 0xSplits

Interface for SplitsFactory to interact with SplitsMain

Functions

createSplit

function createSplit(
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee,
    address controller
) external returns (address);

distributeETH

function distributeETH(
    address split,
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee,
    address distributorAddress
) external;

getHash

function getHash(address split) external view returns (bytes32);

predictImmutableSplitAddress

function predictImmutableSplitAddress(
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee
) external view returns (address);

updateSplit

function updateSplit(
    address split,
    address[] calldata accounts,
    uint32[] calldata percentAllocations,
    uint32 distributorFee
) external;

withdraw

function withdraw(address account, uint256 withdrawETH, address[] calldata tokens) external;

ITicketRedeemer

Git Source

Inherits: IMinter

Author: fx(hash)

Minter for redeeming FxGenArt721 tokens by burning FxMintTicket721 tokens

Functions

pause

Pauses all function executions where modifier is applied

function pause() external;

redeem

Burns a ticket and mints a new token to the caller

function redeem(address _ticket, address _to, uint256 _tokenId, bytes calldata _fxParams) external;

Parameters

NameTypeDescription
_ticketaddressAddress of the ticket contract
_toaddressAddress of token receiver
_tokenIduint256ID of the ticket being burned
_fxParamsbytesRandom sequence of fixed-length bytes used for token input

setMintDetails

Sets the mint details for token reserves

Mint Details: ticket contract address

function setMintDetails(ReserveInfo calldata _reserveInfo, bytes calldata _mintDetails) external;

Parameters

NameTypeDescription
_reserveInfoReserveInfoReserve information for the token
_mintDetailsbytesDetails of the mint pertaining to the minter

tickets

Mapping of FxGenArt721 token address to FxMintTicket721 token address

function tickets(address) external view returns (address);

unpause

Unpauses all function executions where modifier is applied

function unpause() external;

Events

MintDetailsSet

Event emitted when the mint details are set for a ticket contract

event MintDetailsSet(address indexed _ticket, address indexed _token);

Parameters

NameTypeDescription
_ticketaddressAddress of the ticket contract
_tokenaddressAddress of the token contract that can be redeemed through the ticket

Redeemed

Event emitted when a ticket is burned and a new token is minted

event Redeemed(address indexed _ticket, uint256 indexed _tokenId, address indexed _owner, address _token);

Parameters

NameTypeDescription
_ticketaddressAddress of the ticket contract
_tokenIduint256ID of the token being burned
_owneraddressAddress of the owner receiving the token
_tokenaddressAddress of the token being minted

Errors

AlreadySet

Error thrown when mint details are already set for a ticket contract

error AlreadySet();

InvalidToken

Error thrown when token address is invalid

error InvalidToken();

NotAuthorized

Error thrown when the caller is not authorized

error NotAuthorized();

ZeroAddress

Error thrown when receiver is zero address

error ZeroAddress();

IToken

Git Source

Author: fx(hash)

Interface for minters to interact with tokens

Functions

mint

Mints arbitrary number of tokens

Only callable by registered minter contracts

function mint(address _to, uint256 _amount, uint256 _payment) external;

Parameters

NameTypeDescription
_toaddressAddress receiving tokens
_amountuint256Number of tokens being minted
_paymentuint256Total payment amount of the transaction

primaryReceiver

Returns address of primary receiver for token sales

function primaryReceiver() external view returns (address);

Contents

LibIPFSEncoder

Git Source

Author: fx(hash)

Library for encoding IPFS CID hashes

Functions

encodeURL

Encodes IPFS CID hash to URL string format

function encodeURL(bytes32 _value) internal pure returns (string memory);

AuctionInfo

Git Source

Struct of dutch auction information

  • refunded Flag indicating if refunds are enabled
  • stepLength Duration (in seconds) of each auction step
  • prices Array of prices for each step of the auction
struct AuctionInfo {
    bool refunded;
    uint248 stepLength;
    uint256[] prices;
}

ConfigInfo

Git Source

Struct of system config information

  • feeReceiver Address receiving platform fees
  • primaryFeeAllocation Amount of basis points allocated to calculate platform fees on primary sale proceeds
  • secondaryFeeAllocation Amount of basis points allocated to calculate platform fees on royalty payments
  • lockTime Locked time duration added to mint start time for unverified creators
  • referrerShare Share amount distributed to accounts referring tokens
  • defaultMetadataURI Default base URI of token metadata
  • externalURI External URI for displaying tokens
struct ConfigInfo {
    address feeReceiver;
    uint32 primaryFeeAllocation;
    uint32 secondaryFeeAllocation;
    uint32 lockTime;
    uint64 referrerShare;
    string defaultMetadataURI;
    string externalURI;
}

GenArtInfo

Git Source

Struct of generative art information

  • minter Address of initial token owner
  • seed Hash of randomly generated seed
  • fxParams Random sequence of fixed-length bytes used as token input
struct GenArtInfo {
    address minter;
    bytes32 seed;
    bytes fxParams;
}

InitInfo

Git Source

Struct of initialization information used on project creation

  • name Name of project
  • symbol Symbol of project
  • primaryReceiver Address of splitter contract receiving primary sales
  • randomizer Address of Randomizer contract
  • renderer Address of Renderer contract
  • tagIds Array of tag IDs describing the project
  • 'onchainData' Onchain data to be stored using SSTORE2 and available to renderers
struct InitInfo {
    string name;
    string symbol;
    address[] primaryReceivers;
    uint32[] allocations;
    address randomizer;
    address renderer;
    uint256[] tagIds;
    bytes onchainData;
}

IssuerInfo

Git Source

Struct of issuer information

  • primaryReceiver Address of splitter contract receiving primary sales
  • projectInfo Project information
  • activeMinters Array of authorized minter contracts used for enumeration
  • minters Mapping of minter contract to authorization status
struct IssuerInfo {
    address primaryReceiver;
    ProjectInfo projectInfo;
    address[] activeMinters;
    mapping(address => uint8) minters;
}

MetadataInfo

Git Source

Struct of metadata information

  • baseURI Decoded URI of content identifier
  • onchainPointer Address of bytes-encoded data rendered onchain
struct MetadataInfo {
    bytes baseURI;
    address onchainPointer;
}

MintInfo

Git Source

Struct of mint information

  • minter Address of the minter contract
  • reserveInfo Reserve information
  • params Optional bytes data decoded inside minter
struct MintInfo {
    address minter;
    ReserveInfo reserveInfo;
    bytes params;
}

MinterInfo

Git Source

Struct of minter information

  • totalMints Total number of mints executed by the minter
  • totalPaid Total amount paid by the minter
struct MinterInfo {
    uint128 totalMints;
    uint128 totalPaid;
}

ProjectInfo

Git Source

Struct of project information

  • mintEnabled Flag inidicating if minting is enabled
  • burnEnabled Flag inidicating if burning is enabled
  • maxSupply Maximum supply of tokens
  • inputSize Maximum input size of fxParams bytes data
  • earliestStartTime Earliest possible start time for registering minters
struct ProjectInfo {
    bool mintEnabled;
    bool burnEnabled;
    uint120 maxSupply;
    uint88 inputSize;
    uint32 earliestStartTime;
}

RefundInfo

Git Source

Struct of refund information

  • lastPrice Price of last sale before selling out
  • minterInfo Mapping of minter address to struct of minter information
struct RefundInfo {
    uint256 lastPrice;
    mapping(address minter => MinterInfo) minterInfo;
}

ReserveInfo

Git Source

Struct of reserve information

  • startTime Start timestamp of minter
  • endTime End timestamp of minter
  • allocation Allocation amount for minter
struct ReserveInfo {
    uint64 startTime;
    uint64 endTime;
    uint128 allocation;
}

RoyaltyInfo

Git Source

Struct of royalty information

  • receiver Address receiving royalties
  • basisPoints Points used to calculate the royalty payment (0.01%)
struct RoyaltyInfo {
    address receiver;
    uint96 basisPoints;
}

TaxInfo

Git Source

Struct of tax information

  • startTime Timestamp of when harberger taxation begins
  • foreclosureTime Timestamp of token foreclosure
  • currentPrice Current listing price of token
  • depositAmount Total amount of taxes deposited
struct TaxInfo {
    uint48 startTime;
    uint48 foreclosureTime;
    uint80 currentPrice;
    uint80 depositAmount;
}

Contents

Contents

Allowlist

Git Source

Author: fx(hash)

Extension for claiming tokens through merkle trees

Functions

_claimSlot

Claims a merkle tree slot

function _claimSlot(
    address _token,
    uint256 _reserveId,
    uint256 _index,
    address _claimer,
    bytes32[] memory _proof,
    LibBitmap.Bitmap storage _bitmap
) internal;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve
_indexuint256Index in the merkle tree
_claimeraddressAddress of allowlist slot claimer
_proofbytes32[]Merkle proof used for validating claim
_bitmapLibBitmap.BitmapBitmap used for checking if index is already claimed

_getMerkleRoot

Gets the merkle root of a token reserve

function _getMerkleRoot(address _token, uint256 _reserveId) internal view virtual returns (bytes32);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve

Events

SlotClaimed

Event emitted when allowlist slot is claimed

event SlotClaimed(address indexed _token, uint256 indexed _reserveId, address indexed _claimer, uint256 _index);

Parameters

NameTypeDescription
_tokenaddressAddress of the token
_reserveIduint256ID of the reserve
_claimeraddressAddress of the claimer
_indexuint256Index of purchase info inside the BitMap

Errors

InvalidProof

Error thrown when the merkle proof for an index is invalid

error InvalidProof();

SlotAlreadyClaimed

Error thrown when an index in the merkle tree has already been claimed

error SlotAlreadyClaimed();

MintPass

Git Source

Inherits: EIP712

Author: fx(hash)

Extension for claiming tokens through mint passes

State Variables

reserveNonce

Mapping of token address to reserve ID to reserve nonce

mapping(address => mapping(uint256 => uint256)) public reserveNonce;

signingAuthorities

Mapping of token address to reserve ID to address of mint pass authority

mapping(address => mapping(uint256 => address)) public signingAuthorities;

Functions

constructor

Initializes EIP-712

constructor() EIP712("MINT_PASS", "1");

generateTypedDataHash

Generates the typed data hash for a mint pass claim

function generateTypedDataHash(
    address _token,
    uint256 _reserveId,
    uint256 _reserveNonce,
    uint256 _index,
    address _claimer
) public view returns (bytes32);

Parameters

NameTypeDescription
_tokenaddressaddress of token for the reserve
_reserveIduint256Id of the reserve to mint the token from
_reserveNonceuint256
_indexuint256Index of the mint pass
_claimeraddressAddress of mint pass claimer

Returns

NameTypeDescription
<none>bytes32Digest of typed data hash claimer

_claimMintPass

Validates a mint pass claim

function _claimMintPass(
    address _token,
    uint256 _reserveId,
    uint256 _index,
    address _claimer,
    bytes calldata _signature,
    LibBitmap.Bitmap storage _bitmap
) internal;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve
_indexuint256Index of the mint pass
_claimeraddressAccount associated with the mint pass
_signaturebytesSignature of the mint pass claimer
_bitmapLibBitmap.BitmapBitmap used for checking if index is already claimed

Events

PassClaimed

Event emitted when mint pass is claimed

event PassClaimed(address indexed _token, uint256 indexed _reserveId, address indexed _claimer, uint256 _index);

Parameters

NameTypeDescription
_tokenaddressAddress of the token
_reserveIduint256ID of the reserve
_claimeraddressAddress of the mint pass claimer
_indexuint256Index of purchase info inside the BitMap

Errors

InvalidSignature

Error thrown when the signature of mint pass claimer is invalid

error InvalidSignature();

PassAlreadyClaimed

Error thrown when a mint pass has already been claimed

error PassAlreadyClaimed();

DutchAuction

Git Source

Inherits: IDutchAuction, Allowlist, MintPass, Ownable, Pausable

Author: fx(hash)

See the documentation in {IDutchAuction}

State Variables

claimedMerkleTreeSlots

Mapping of token address to reserve ID to Bitmap of claimed merkle tree slots

mapping(address => mapping(uint256 => LibBitmap.Bitmap)) internal claimedMerkleTreeSlots;

claimedMintPasses

Mapping of token address to reserve ID to Bitmap of claimed mint passes

mapping(address => mapping(uint256 => LibBitmap.Bitmap)) internal claimedMintPasses;

latestUpdates

Mapping of token address to timestamp of latest update made for token reserves

LibMap.Uint40Map internal latestUpdates;

firstValidReserve

Mapping of token to the last valid reserveId that can mint on behalf of the token

LibMap.Uint40Map internal firstValidReserve;

auctions

Mapping of token address to reserve ID to reserve information

mapping(address => AuctionInfo[]) public auctions;

merkleRoots

Mapping of token address to reserve ID to merkle root

mapping(address => mapping(uint256 => bytes32)) public merkleRoots;

refunds

Mapping of token address to reserve ID to refund amount

mapping(address => mapping(uint256 => RefundInfo)) public refunds;

reserves

Mapping of token address to reserve ID to reserve information (allocation, price, max mint)

mapping(address => ReserveInfo[]) public reserves;

saleProceeds

Mapping of token address to reserve ID to amount of sale proceeds

mapping(address => mapping(uint256 => uint256)) public saleProceeds;

numberMinted

Mapping of token address to reserve ID to number of tokens minted

mapping(address => mapping(uint256 => uint256)) public numberMinted;

Functions

buy

Purchases tokens at a linear price over fixed amount of time

function buy(address _token, uint256 _reserveId, uint256 _amount, address _to) external payable whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Amount of tokens to purchase
_toaddressAddress receiving the purchased tokens

buyAllowlist

Purchases tokens through an allowlist at a linear price over fixed amount of time

function buyAllowlist(
    address _token,
    uint256 _reserveId,
    address _to,
    uint256[] calldata _indexes,
    bytes32[][] calldata _proofs
) external payable whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_toaddressAddress receiving the purchased tokens
_indexesuint256[]Array of indices containing purchase info inside the BitMap
_proofsbytes32[][]Array of merkle proofs used for verifying the purchase

buyMintPass

Purchases tokens through a mint pass at a linear price over fixed amount of time

function buyMintPass(
    address _token,
    uint256 _reserveId,
    uint256 _amount,
    address _to,
    uint256 _index,
    bytes calldata _signature
) external payable whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Number of tokens being purchased
_toaddressAddress receiving the purchased tokens
_indexuint256Index of puchase info inside the BitMap
_signaturebytesArray of merkle proofs used for verifying the purchase

refund

Refunds an auction buyer with their rebate amount

function refund(address _token, uint256 _reserveId, address _buyer) external whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the mint
_buyeraddressAddress of the buyer receiving the refund

setMintDetails

Mint Details: struct of auction information, merkle root, and signer address

function setMintDetails(ReserveInfo calldata _reserve, bytes calldata _mintDetails) external whenNotPaused;

withdraw

Withdraws sale processed of primary sales to receiver

function withdraw(address _token, uint256 _reserveId) external whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve

pause

Pauses all function executions where modifier is applied

function pause() external onlyOwner;

unpause

Unpauses all function executions where modifier is applied

function unpause() external onlyOwner;

getFirstValidReserve

Returns the earliest valid reserveId that can mint a token

function getFirstValidReserve(address _token) public view returns (uint256);

getLatestUpdate

Gets the latest timestamp update made to token reserves

function getLatestUpdate(address _token) public view returns (uint40);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint40Timestamp of latest update

getPrice

Gets the current auction price

function getPrice(address _token, uint256 _reserveId) public view returns (uint256);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve

Returns

NameTypeDescription
<none>uint256price Price of the token

_buy

Purchases arbitrary amount of tokens at auction price and mints tokens to given account

function _buy(address _token, uint256 _reserveId, uint256 _amount, address _to) internal;

_setLatestUpdate

Sets timestamp of the latest update to token reserves

function _setLatestUpdate(address _token, uint256 _timestamp) internal;

_setFirstValidReserve

function _setFirstValidReserve(address _token, uint256 _reserveId) internal;

_getMerkleRoot

Gets the merkle root of a token reserve

function _getMerkleRoot(address _token, uint256 _reserveId) internal view override returns (bytes32);

_getPrice

Gets the current price of auction reserve

function _getPrice(ReserveInfo memory _reserve, AuctionInfo storage _daInfo) internal view returns (uint256);

_recordLastPrice

function _recordLastPrice(ReserveInfo memory _reserve, address _token, uint256 _reserveId)
    internal
    returns (uint256 lastPrice);

_validateInput

Validates token address, reserve information and given account

function _validateInput(address _token, uint256 _reserveId, address _buyer) internal view;

FixedPrice

Git Source

Inherits: IFixedPrice, Allowlist, MintPass, Ownable, Pausable

Author: fx(hash)

See the documentation in {IFixedPrice}

State Variables

claimedMerkleTreeSlots

Mapping of token address to reserve ID to Bitmap of claimed merkle tree slots

mapping(address => mapping(uint256 => LibBitmap.Bitmap)) internal claimedMerkleTreeSlots;

claimedMintPasses

Mapping of token address to reserve ID to Bitmap of claimed mint passes

mapping(address => mapping(uint256 => LibBitmap.Bitmap)) internal claimedMintPasses;

latestUpdates

Mapping of token address to timestamp of latest update made for token reserves

LibMap.Uint40Map internal latestUpdates;

firstValidReserve

Mapping of token to the last valid reserveId that can mint on behalf of the token

LibMap.Uint40Map internal firstValidReserve;

saleProceeds

Mapping of token address to sale proceeds

LibMap.Uint128Map internal saleProceeds;

merkleRoots

Mapping of token address to reserve ID to merkle roots

mapping(address => mapping(uint256 => bytes32)) public merkleRoots;

prices

Mapping of token address to reserve ID to prices

mapping(address => uint256[]) public prices;

reserves

Mapping of token address to reserve ID to reserve information

mapping(address => ReserveInfo[]) public reserves;

Functions

buy

Purchases tokens at a fixed price

function buy(address _token, uint256 _reserveId, uint256 _amount, address _to) external payable whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve
_amountuint256Amount of tokens being purchased
_toaddressAddress receiving the purchased tokens

buyAllowlist

Purchases tokens through an allowlist at a fixed price

function buyAllowlist(
    address _token,
    uint256 _reserveId,
    address _to,
    uint256[] calldata _indexes,
    bytes32[][] calldata _proofs
) external payable whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_toaddressAddress receiving the purchased tokens
_indexesuint256[]Array of indices regarding purchase info inside the BitMap
_proofsbytes32[][]Array of merkle proofs used for verifying the purchase

buyMintPass

Purchases tokens through a mint pass at a fixed price

function buyMintPass(
    address _token,
    uint256 _reserveId,
    uint256 _amount,
    address _to,
    uint256 _index,
    bytes calldata _signature
) external payable whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Number of tokens being purchased
_toaddressAddress receiving the purchased tokens
_indexuint256Index of puchase info inside the BitMap
_signaturebytesArray of merkle proofs used for verifying the purchase

setMintDetails

Mint Details: token price, merkle root, and signer address

function setMintDetails(ReserveInfo calldata _reserve, bytes calldata _mintDetails) external whenNotPaused;

withdraw

Withdraws the sale proceeds to the sale receiver

function withdraw(address _token) external whenNotPaused;

Parameters

NameTypeDescription
_tokenaddressAddress of the token withdrawing proceeds from

pause

Pauses all function executions where modifier is applied

function pause() external onlyOwner;

unpause

Unpauses all function executions where modifier is applied

function unpause() external onlyOwner;

getFirstValidReserve

Returns the earliest valid reserveId that can mint a token

function getFirstValidReserve(address _token) public view returns (uint256);

getLatestUpdate

Gets the latest timestamp update made to token reserves

function getLatestUpdate(address _token) public view returns (uint40);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint40Timestamp of latest update

getSaleProceed

Gets the proceed amount from a token sale

function getSaleProceed(address _token) public view returns (uint128);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint128Amount of proceeds

_buy

Purchases arbitrary amount of tokens at auction price and mints tokens to given account

function _buy(address _token, uint256 _reserveId, uint256 _amount, address _to) internal;

_setLatestUpdate

Sets timestamp of the latest update to token reserves

function _setLatestUpdate(address _token, uint256 _timestamp) internal;

_setFirstValidReserve

Sets earliest valid reserve

function _setFirstValidReserve(address _token, uint256 _reserveId) internal;

_setSaleProceeds

Sets the proceed amount from the token sale

function _setSaleProceeds(address _token, uint256 _amount) internal;

_getMerkleRoot

Gets the merkle root of a token reserve

function _getMerkleRoot(address _token, uint256 _reserveId) internal view override returns (bytes32);

TicketRedeemer

Git Source

Inherits: ITicketRedeemer, Ownable, Pausable

Author: fx(hash)

See the documentation in {ITicketRedeemer}

State Variables

tickets

Mapping of FxGenArt721 token address to FxMintTicket721 token address

mapping(address => address) public tickets;

Functions

redeem

Burns a ticket and mints a new token to the caller

function redeem(address _token, address _to, uint256 _ticketId, bytes calldata _fxParams) external whenNotPaused;

Parameters

NameTypeDescription
_tokenaddress
_toaddressAddress of token receiver
_ticketIduint256
_fxParamsbytesRandom sequence of fixed-length bytes used for token input

setMintDetails

Mint Details: ticket contract address

function setMintDetails(ReserveInfo calldata, bytes calldata _mintDetails) external whenNotPaused;

pause

Pauses all function executions where modifier is applied

function pause() external onlyOwner;

unpause

Unpauses all function executions where modifier is applied

function unpause() external onlyOwner;

Contents

PseudoRandomizer

Git Source

Inherits: IPseudoRandomizer

Author: fx(hash)

See the documentation in {IPseudoRandomizer}

Functions

requestRandomness

function requestRandomness(uint256 _tokenId) external;

generateSeed

Generates random seed for token using entropy

function generateSeed(uint256 _tokenId) public view returns (bytes32);

Parameters

NameTypeDescription
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>bytes32Hash of the seed

Contents

FxContractRegistry

Git Source

Inherits: IFxContractRegistry, Ownable

Author: fx(hash)

See the documentation in {IFxContractRegistry}

State Variables

configInfo

Returns the system config information

ConfigInfo public configInfo;

contracts

Mapping of hashed contract name to contract address

mapping(bytes32 => address) public contracts;

Functions

constructor

Initializes registry owner and system config information

constructor(address _admin, ConfigInfo memory _configInfo) Ownable;

register

Registers deployed contract addresses based on hashed value of name

function register(string[] calldata _names, address[] calldata _contracts) external onlyOwner;

Parameters

NameTypeDescription
_namesstring[]Array of contract names
_contractsaddress[]Array of contract addresses

setConfig

Sets the system config information

function setConfig(ConfigInfo calldata _configInfo) external onlyOwner;

Parameters

NameTypeDescription
_configInfoConfigInfoConfig information (lock time, referrer share, default metadata)

_setConfigInfo

Sets the system config information

function _setConfigInfo(ConfigInfo memory _configInfo) internal;

FxRoleRegistry

Git Source

Inherits: AccessControl, IFxRoleRegistry

Author: fx(hash)

See the documentation in {IFxRoleRegistry}

Functions

constructor

Initializes registry owner and role admins

constructor(address _admin);

setRoleAdmin

Sets the admin of a new or existing role

function setRoleAdmin(bytes32 _role) external onlyRole(ADMIN_ROLE);

Parameters

NameTypeDescription
_rolebytes32Hash of the role name

Contents

IPFSRenderer

Git Source

Inherits: IIPFSRenderer

Author: fx(hash)

See the documentation in {IIPFSRenderer}

State Variables

contractRegistry

address public immutable contractRegistry;

Functions

constructor

Initializes FxContractRegistry

constructor(address _contractRegistry);

contractURI

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

tokenURI

function tokenURI(uint256 _tokenId, bytes calldata _data) external view returns (string memory);

getMetadataURL

Generates the metadata URL for a token ID

function getMetadataURL(address _contractAddr, string memory _baseURI, uint256 _tokenId)
    public
    view
    returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_baseURIstringURI of the content identifier
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringURL of the JSON metadata

ONCHFSRenderer

Git Source

Inherits: IONCHFSRenderer

Author: fx(hash)

See the documentation in {IONCHFSRenderer}

State Variables

contractRegistry

address public immutable contractRegistry;

Functions

constructor

Initializes FxContractRegistry

constructor(address _contractRegistry);

contractURI

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

tokenURI

function tokenURI(uint256 _tokenId, bytes calldata _data) external view returns (string memory);

getAttributes

Generates the list of attributes for a token ID

function getAttributes(address _contractAddr, string memory _baseURI, uint256 _tokenId)
    public
    view
    returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_baseURIstringURI of the content identifier
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringList of token attributes

getExternalURL

Generates the external URL for a token ID

function getExternalURL(address _contractAddr, uint256 _tokenId) public view returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringURL of the external token pointer

getImageURL

Generates the image URL for a token ID

function getImageURL(address _contractAddr, string memory _baseURI, uint256 _tokenId)
    public
    view
    returns (string memory);

Parameters

NameTypeDescription
_contractAddraddressAddress of the token contract
_baseURIstringURI of the content identifier
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>stringURL of the image pointer

getAnimationURL

Generates the animation URL for a token ID

function getAnimationURL(bytes32 _onchfsCID, uint256 _tokenId, address _minter, bytes32 _seed, bytes memory _fxParams)
    public
    pure
    returns (string memory);

Parameters

NameTypeDescription
_onchfsCIDbytes32CID hash of token animation
_tokenIduint256ID of the token
_minteraddressAddress of initial token owner
_seedbytes32Hash of randomly generated seed
_fxParamsbytesRandom sequence of fixed-length bytes used as token input

Returns

NameTypeDescription
<none>stringURL of the animation pointer

_renderJSON

Reconstructs JSON metadata of token onchain

function _renderJSON(
    address _contractAddr,
    uint256 _tokenId,
    string memory _description,
    string memory _baseURI,
    string memory _animationURL
) internal view returns (string memory);

Contents

Contents

RoyaltyManager

Git Source

Inherits: IRoyaltyManager

Author: fx(hash)

See the documentation in {IRoyaltyManager}

State Variables

baseRoyalties

Returns royalty information of index in array list

RoyaltyInfo public baseRoyalties;

tokenRoyalties

Mapping of token ID to array of royalty information

mapping(uint256 => RoyaltyInfo) public tokenRoyalties;

Functions

getRoyalties

Gets the royalties for a specific token ID

function getRoyalties(uint256 _tokenId)
    external
    view
    returns (address[] memory receivers, uint256[] memory basisPoints);

Parameters

NameTypeDescription
_tokenIduint256ID of the token

Returns

NameTypeDescription
receiversaddress[]Total receivers and basis points
basisPointsuint256[]

royaltyInfo

Returns the royalty information for a specific token ID and sale price

function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 amount);

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_salePriceuint256Sale price of the token

Returns

NameTypeDescription
receiveraddressAddress receiving royalties
amountuint256royaltyAmount Amount to royalties being paid out

_getOrCreateSplit

function _getOrCreateSplit(address[] calldata _receivers, uint32[] calldata _allocations)
    internal
    returns (address receiver);

_setBaseRoyalties

Sets the base royalties for all tokens

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

Parameters

NameTypeDescription
_receiversaddress[]Array of addresses receiving royalties
_allocationsuint32[]Array of allocation amounts for calculating royalty shares
_basisPointsuint96Total allocation scalar for calculating royalty shares

_setTokenRoyalties

compute split if necessary

Sets the royalties for a specific token ID

function _setTokenRoyalties(uint256 _tokenId, address _receiver, uint96 _basisPoints) internal;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_receiveraddressAddress receiving royalty payments
_basisPointsuint96Total allocation scalar for calculating royalty shares

_exists

Checks if the token ID exists

function _exists(uint256 _tokenId) internal view virtual returns (bool);

_checkRoyalties

*Checks if:

  1. Total basis points of royalties exceeds 10,000 (100%)
  2. A single receiver exceeds 2,500 (25%)*
function _checkRoyalties(address[] memory _receivers, uint32[] memory _allocations, uint96 _basisPoints)
    internal
    pure;

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);

FxMintTicket721

Git Source

Inherits: IFxMintTicket721, IERC4906, IERC5192, ERC721, Initializable, Ownable, Pausable

Author: fx(hash)

See the documentation in {IFxMintTicket721}

State Variables

contractRegistry

Returns the address of the FxContractRegistry contract

address public immutable contractRegistry;

roleRegistry

Returns the address of the FxRoleRegistry contract

address public immutable roleRegistry;

genArt721

Returns address of the FxGenArt721 token contract

address public genArt721;

totalSupply

Returns the current circulating supply of tokens

uint48 public totalSupply;

gracePeriod

Returns default grace period of time for each token

uint48 public gracePeriod;

baseURI

Returns the decoded content identifier of the metadata pointer

bytes public baseURI;

redeemer

Returns the address of the TickeRedeemer contract

address public redeemer;

renderer

Returns the address of the renderer contract

address public renderer;

activeMinters

Returns the list of active minters

address[] public activeMinters;

balances

Mapping of wallet address to pending balance available for withdrawal

mapping(address => uint256) public balances;

minters

Returns the active status of a registered minter contract

mapping(address => uint8) public minters;

taxes

Mapping of ticket ID to tax information (grace period, foreclosure time, current price, deposit amount)

mapping(uint256 => TaxInfo) public taxes;

Functions

onlyRole

Modifier for restricting calls to only callers with the specified role

modifier onlyRole(bytes32 _role);

constructor

Initializes FxContractRegistry and FxRoleRegistry

constructor(address _contractRegistry, address _roleRegistry) ERC721("FxMintTicket721", "FXTICKET");

initialize

Initializes new generative art project

function initialize(
    address _owner,
    address _genArt721,
    address _redeemer,
    address _renderer,
    uint48 _gracePeriod,
    MintInfo[] calldata _mintInfo
) external initializer;

Parameters

NameTypeDescription
_owneraddressAddress of contract owner
_genArt721addressAddress of GenArt721 token contract
_redeemeraddressAddress of TicketRedeemer minter contract
_rendereraddressAddress of renderer contract
_gracePerioduint48Period time before token enters harberger taxation
_mintInfoMintInfo[]Array of authorized minter contracts and their reserves

burn

Burns token ID from the circulating supply

function burn(uint256 _tokenId) external whenNotPaused;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

claim

Claims token at current price and sets new price of token with initial deposit amount

function claim(uint256 _tokenId, uint256 _maxPrice, uint80 _newPrice) external payable;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_maxPriceuint256Maximum payment amount allowed to prevent front-running of listing price
_newPriceuint80New listing price of token

depositAndSetPrice

Deposits taxes for given token and set new price for same token

function depositAndSetPrice(uint256 _tokenId, uint80 _newPrice) external payable;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_newPriceuint80New listing price of token

mint

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

updateStartTime

Updates taxation start time to the current timestamp

function updateStartTime(uint256 _tokenId) external;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

withdraw

Withdraws available balance amount to given address

function withdraw(address _to) external;

Parameters

NameTypeDescription
_toaddressAddress being withdrawn to

deposit

Deposits taxes for given token

function deposit(uint256 _tokenId) public payable;

Parameters

NameTypeDescription
_tokenIduint256ID of the token

setPrice

Sets new price for given token

function setPrice(uint256 _tokenId, uint80 _newPrice) public;

Parameters

NameTypeDescription
_tokenIduint256ID of the token
_newPriceuint80New price of the token

registerMinters

Registers minter contracts with resereve info

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

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 set

function pause() external onlyRole(MODERATOR_ROLE);

unpause

Unpauses all function executions where modifier is set

function unpause() external onlyRole(MODERATOR_ROLE);

contractURI

Gets the contact-level metadata for the ticket

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

Returns

NameTypeDescription
<none>stringURI of the contract metadata

locked

Returns the locking status of an Soulbound Token

SBTs assigned to zero address are considered invalid, and queries about them do throw

function locked(uint256 _tokenId) external view returns (bool);

Parameters

NameTypeDescription
_tokenIduint256

primaryReceiver

function primaryReceiver() external view returns (address);

isApprovedForAll

function isApprovedForAll(address _owner, address _operator) public view override(ERC721, IERC721) returns (bool);

tokenURI

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

getAuctionPrice

Gets the current auction price of the token

function getAuctionPrice(uint256 _currentPrice, uint256 _foreclosureTime) public view returns (uint256);

Parameters

NameTypeDescription
_currentPriceuint256Listing price of the token
_foreclosureTimeuint256Timestamp of the foreclosure

getDepositAmounts

Gets the deposit amount owed and remaining after change in price, claim or burn

function getDepositAmounts(uint256 _dailyTax, uint256 _depositAmount, uint256 _foreclosureTime)
    public
    view
    returns (uint256 depositOwed, uint256 depositRemaining);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Total amount of taxes deposited
_foreclosureTimeuint256Timestamp of current foreclosure

Returns

NameTypeDescription
depositOweduint256Deposit amount owed
depositRemaininguint256

isForeclosed

Checks if token is foreclosed

function isForeclosed(uint256 _tokenId) public view returns (bool);

Parameters

NameTypeDescription
_tokenIduint256ID of the token

Returns

NameTypeDescription
<none>boolStatus of foreclosure

getDailyTax

Gets the daily tax amount based on current price

function getDailyTax(uint256 _currentPrice) public pure returns (uint256);

Parameters

NameTypeDescription
_currentPriceuint256Current listing price

Returns

NameTypeDescription
<none>uint256Daily tax amount

getExcessTax

Gets the excess amount of taxes paid

function getExcessTax(uint256 _dailyTax, uint256 _depositAmount) public pure returns (uint256);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Total amount of taxes deposited

Returns

NameTypeDescription
<none>uint256Excess amount of taxes

getNewForeclosure

Gets the new foreclosure timestamp

function getNewForeclosure(uint256 _dailyTax, uint256 _depositAmount, uint256 _currentForeclosure)
    public
    pure
    returns (uint48);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Amount of taxes being deposited
_currentForeclosureuint256

Returns

NameTypeDescription
<none>uint48Timestamp of new foreclosure

getTaxDuration

Gets the total duration of time covered

function getTaxDuration(uint256 _dailyTax, uint256 _depositAmount) public pure returns (uint256);

Parameters

NameTypeDescription
_dailyTaxuint256Daily tax amount based on current price
_depositAmountuint256Amount of taxes being deposited

Returns

NameTypeDescription
<none>uint256Total time duration

_registerMinters

Registers arbitrary number of minter contracts and sets their reserves

function _registerMinters(MintInfo[] memory _mintInfo) internal;

_beforeTokenTransfer

*Tokens can only be transferred when either of these conditions is met:

  1. This contract executes transfer when token is in foreclosure and claimed at auction price
  2. This contract executes transfer when token is not in foreclosure and claimed at listing price
  3. Token owner executes transfer when token is not in foreclosure
  4. Registered minter contract executes burn when token is not in foreclosure*
function _beforeTokenTransfer(address _from, address, uint256 _tokenId, uint256) internal view override;

_isVerified

Checks if creator is verified by the system

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

Contents

Constants

Git Source

FX_CONTRACT_REGISTRY

string constant FX_CONTRACT_REGISTRY = "FX_CONTRACT_REGISTRY";

FX_GEN_ART_721

string constant FX_GEN_ART_721 = "FX_GEN_ART_721";

FX_ISSUER_FACTORY

string constant FX_ISSUER_FACTORY = "FX_ISSUER_FACTORY";

FX_MINT_TICKET_721

string constant FX_MINT_TICKET_721 = "FX_MINT_TICKET_721";

FX_ROLE_REGISTRY

string constant FX_ROLE_REGISTRY = "FX_ROLE_REGISTRY";

FX_TICKET_FACTORY

string constant FX_TICKET_FACTORY = "FX_TICKET_FACTORY";

DUTCH_AUCTION

string constant DUTCH_AUCTION = "DUTCH_AUCTION";

FIXED_PRICE

string constant FIXED_PRICE = "FIXED_PRICE";

ONCHFS_RENDERER

string constant ONCHFS_RENDERER = "ONCHFS_RENDERER";

IPFS_RENDERER

string constant IPFS_RENDERER = "IPFS_RENDERER";

PSEUDO_RANDOMIZER

string constant PSEUDO_RANDOMIZER = "PSEUDO_RANDOMIZER";

TICKET_REDEEMER

string constant TICKET_REDEEMER = "TICKET_REDEEMER";

CLAIM_TYPEHASH

bytes32 constant CLAIM_TYPEHASH =
    keccak256("Claim(address token,uint256 reserveId,uint96 nonce,uint256 index,address user)");

SET_ONCHAIN_POINTER_TYPEHASH

bytes32 constant SET_ONCHAIN_POINTER_TYPEHASH = keccak256("SetOnchainPointer(bytes onchainData,uint96 nonce)");

SET_PRIMARY_RECEIVER_TYPEHASH

bytes32 constant SET_PRIMARY_RECEIVER_TYPEHASH = keccak256("SetPrimaryReceiver(address receiver,uint96 nonce)");

SET_RENDERER_TYPEHASH

bytes32 constant SET_RENDERER_TYPEHASH = keccak256("SetRenderer(address renderer,uint96 nonce)");

IPFS_URL

bytes constant IPFS_URL =
    hex"697066733a2f2f172c151325290607391d2c391b242225180a020b291b260929391d1b31222525202804120031280917120b280400";

IPFS_PREFIX

string constant IPFS_PREFIX = "ipfs://";

API_VERSION

string constant API_VERSION = "0.2";

ATTRIBUTES_ENDPOINT

string constant ATTRIBUTES_ENDPOINT = "/attributes.json";

METADATA_ENDPOINT

string constant METADATA_ENDPOINT = "/metadata.json";

THUMBNAIL_ENDPOINT

string constant THUMBNAIL_ENDPOINT = "/thumbnail.json";

FX_HASH_QUERY

string constant FX_HASH_QUERY = "/?fxhash=";

FX_PARAMS_QUERY

string constant FX_PARAMS_QUERY = "#0x";

ITERATION_QUERY

string constant ITERATION_QUERY = "&fxiteration=";

MINTER_QUERY

string constant MINTER_QUERY = "&fxminter=";

ONCHFS_PREFIX

string constant ONCHFS_PREFIX = "onchfs://";

UNINITIALIZED

uint8 constant UNINITIALIZED = 0;

FALSE

uint8 constant FALSE = 1;

TRUE

uint8 constant TRUE = 2;

LOCK_TIME

uint32 constant LOCK_TIME = 3600;

TIME_UNLIMITED

uint64 constant TIME_UNLIMITED = type(uint64).max;

OPEN_EDITION_SUPPLY

uint120 constant OPEN_EDITION_SUPPLY = type(uint120).max;

LAUNCH_TIMESTAMP

uint256 constant LAUNCH_TIMESTAMP = 1702558800;

ADMIN_ROLE

bytes32 constant ADMIN_ROLE = keccak256("ADMIN_ROLE");

BANNED_USER_ROLE

bytes32 constant BANNED_USER_ROLE = keccak256("BANNED_USER_ROLE");

CREATOR_ROLE

bytes32 constant CREATOR_ROLE = keccak256("CREATOR_ROLE");

METADATA_ROLE

bytes32 constant METADATA_ROLE = keccak256("METADATA_ROLE");

MINTER_ROLE

bytes32 constant MINTER_ROLE = keccak256("MINTER_ROLE");

MODERATOR_ROLE

bytes32 constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE");

SIGNER_ROLE

bytes32 constant SIGNER_ROLE = keccak256("SIGNER_ROLE");

ALLOCATION_DENOMINATOR

uint32 constant ALLOCATION_DENOMINATOR = 1_000_000;

FEE_DENOMINATOR

uint96 constant FEE_DENOMINATOR = 10_000;

MAX_ROYALTY_BPS

uint96 constant MAX_ROYALTY_BPS = 2500;

SPLITS_MAIN

address constant SPLITS_MAIN = 0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE;

AUCTION_DECAY_RATE

uint256 constant AUCTION_DECAY_RATE = 200;

DAILY_TAX_RATE

uint256 constant DAILY_TAX_RATE = 27;

MINIMUM_PRICE

uint256 constant MINIMUM_PRICE = 0.001 ether;

ONE_DAY

uint256 constant ONE_DAY = 86_400;

SCALING_FACTOR

uint256 constant SCALING_FACTOR = 10_000;

TEN_MINUTES

uint256 constant TEN_MINUTES = 600;