FNFTHandler

This contract creates and mints the FNFTs, it also tracks them, their supply, and points to the MetadataHandler.

Code

Read-Only Functions

getBalance

function getBalance(address account, uint id) external view override returns (uint) {
    return balanceOf(account, id);
}

Gets the balance of FNFTs held by account of the id passed in.

getSupply

function getSupply(uint fnftId) public view override returns (uint) {
    return supply[fnftId];
}

Gets the total supply of FNFTs within the given id.

getNextId

function getNextId() public view override returns (uint) {
    return fnftsCreated;
}

Gets the next ID that will be used in FNFT creation.

uri

function uri(uint fnftId) public view override returns (string memory) {
    return IMetadataHandler(addressesProvider.getMetadataHandler()).getTokenURI(fnftId);
}

Returns a string that is derived from calls made to and IMetadataHandler implementation

renderTokenURI

function renderTokenURI(
    uint tokenId,
    address owner
) public view returns (
    string memory baseRenderURI,
    string[] memory parameters
){
    return IMetadataHandler(addressesProvider.getMetadataHandler()).getRenderTokenURI(tokenId, owner);
}

Experimental method to offer future proofing for the iNFT standard. Points to IMetadataHandler.

State-Changing Functions

mint

function mint(address account, uint id, uint amount, bytes memory data) external override onlyRevestController {
    supply[id] += amount;
    _mint(account, id, amount, data);
    fnftsCreated += 1;
}

Creates an ERC-1155 NFT to act as the FNFT

  • Emits: CreateFNFT.

mintBatch

function mintBatch(address to, uint[] memory ids, uint[] memory amounts, bytes memory data) external override onlyRevestController {
    _mintBatch(to, ids, amounts, data);
}

Creates a batch of ERC-1155 NFTs.

  • Emits: CreateFNFT

mintBatchRec

function mintBatchRec(address[] calldata recipients, uint[] calldata quantities, uint id, uint newSupply, bytes memory data) external override onlyRevestController {
    supply[id] += newSupply;
    for(uint i = 0; i < quantities.length; i++) {
        _mint(recipients[i], id, quantities[i], data);
    }
    fnftsCreated += 1;
}

Creates a batch of ERC-1155 NFTs with specifying the recipients.

  • Emits: CreateFNFT

burn

function burn(address account, uint id, uint amount) external override onlyRevestController {
    supply[id] -= amount;
    _burn(account, id, amount);
}

Burns an ERC-1155.

burnBatch

function burnBatch(address account, uint[] memory ids, uint[] memory amounts) external override onlyRevestController {
    _burnBatch(account, ids, amounts);
}

Burns a batch of ERC-1155 NFTs.

Interface

// SPDX-License-Identifier: GNU-GPL v3.0 or later

pragma solidity >=0.8.0;


/**
 * @title Mintable interface for Revest FNFTs
 * @dev Anything that inherits from this should also be PullPayment.sol
 *
 */
interface IFNFTHandler  {
    function mint(address account, uint id, uint amount, bytes memory data) external;

    function mintBatchRec(address[] memory recipients, uint[] memory quantities, uint id, uint newSupply, bytes memory data) external;

    function mintBatch(address to, uint[] memory ids, uint[] memory amounts, bytes memory data) external;

    function setURI(string memory newuri) external;

    function burn(address account, uint id, uint amount) external;

    function burnBatch(address account, uint[] memory ids, uint[] memory amounts) external;

    function getBalance(address tokenHolder, uint id) external view returns (uint);

    function getSupply(uint fnftId) external view returns (uint);

    function getNextId() external view returns (uint);
}

ABI

Last updated