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