Skip to content

Latest commit

 

History

History
938 lines (520 loc) · 15.9 KB

File metadata and controls

938 lines (520 loc) · 15.9 KB

NonFungibleTimeCollection

The Newt team.

Non-Fungible Time collection.

A primitive to mint time, our most valuable asset, on-chain.

An ERC-721 contract with mint, buy, and transferFrom functions.

Methods

approve

function approve(address to, uint256 tokenId) external nonpayable

See {IERC721-approve}.

Parameters

Name Type Description
to address undefined
tokenId uint256 undefined

balanceOf

function balanceOf(address owner) external view returns (uint256)

See {IERC721-balanceOf}.

Parameters

Name Type Description
owner address undefined

Returns

Name Type Description
_0 uint256 undefined

burn

function burn(uint256 tokenId) external nonpayable

Burns the token with the given tokenId sending it to the address(0).

Parameters

Name Type Description
tokenId uint256 Token id of the NFT that you are burning.

buy

function buy(uint256 tokenId) external payable

Buys the token with the given tokenId.

Parameters

Name Type Description
tokenId uint256 The token id of the NFT that you are buying.

changeBuyingConditions

function changeBuyingConditions(uint256 tokenId, address currency, uint256 price, address allowedBuyer, bool forSale) external nonpayable

Changes the price and currency of the token with the given tokenId.

Parameters

Name Type Description
tokenId uint256 Token id of the NFT that you are selling.
currency address The address of the ERC-20 currency to use for the payment. Use address(0) to set native currency.
price uint256 Price of the NFT that you are selling.
allowedBuyer address address of the buyer to avoid frontruns. Use address(0) to enable everyone to buy the NFT.
forSale bool A boolean indicating if the NFT is for sale or not.

changeRoyaltyReceiver

function changeRoyaltyReceiver(uint256 tokenId, address royaltyReceiver) external nonpayable

Changes the token royalty receiver.

Parameters

Name Type Description
tokenId uint256 Token id of the NFT which royalty receiver must be updated.
royaltyReceiver address The address of the new rotalty receiver.

getApproved

function getApproved(uint256 tokenId) external view returns (address)

See {IERC721-getApproved}.

Parameters

Name Type Description
tokenId uint256 undefined

Returns

Name Type Description
_0 address undefined

initialize

function initialize(string name, string symbol, bool useNativeCurrency, address svgGeneratorContract, address owner) external nonpayable

Initializer of the contract.

Parameters

Name Type Description
name string Collection name.
symbol string Collection symbol.
useNativeCurrency bool Flag to enable native currency from the beginning.
svgGeneratorContract address The address of a contract following the ISvgGenerator interface.
owner address The owner of the contract, who will be able to execute onlyOwner functions.

isApprovedForAll

function isApprovedForAll(address owner, address operator) external view returns (bool)

See {IERC721-isApprovedForAll}.

Parameters

Name Type Description
owner address undefined
operator address undefined

Returns

Name Type Description
_0 bool undefined

isCurrencyAllowed

function isCurrencyAllowed(address) external view returns (bool)

Parameters

Name Type Description
_0 address undefined

Returns

Name Type Description
_0 bool undefined

mint

function mint(string name, string description, string category, uint256 availabilityFrom, uint256 availabilityTo, uint256 duration, uint256 royaltyBasisPoints) external nonpayable returns (uint256)

Mints a new token with the given parameters.

Parameters

Name Type Description
name string Name of the NFT that you are minting.
description string Description of the NFT that you are minting.
category string Type or category label that represents the activity for what the time is being tokenized.
availabilityFrom uint256 Unix timestamp indicating start of availability. Zero if does not have lower bound.
availabilityTo uint256 Unix timestamp indicating end of availability. Zero if does not have upper bound.
duration uint256 The actual quantity of time you are tokenizing inside availability range. Measured in seconds.
royaltyBasisPoints uint256 The royalty percentage measured in basis points. Each basis point represents 0.01%.

Returns

Name Type Description
_0 uint256 An integer representing the ID of the minted NFT.

name

function name() external view returns (string)

See {IERC721Metadata-name}.

Returns

Name Type Description
_0 string undefined

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

Name Type Description
_0 address undefined

ownerOf

function ownerOf(uint256 tokenId) external view returns (address)

See {IERC721-ownerOf}.

Parameters

Name Type Description
tokenId uint256 undefined

Returns

Name Type Description
_0 address undefined

redeem

function redeem(uint256 tokenId) external nonpayable

Redeems the token with the given tokenId.

Parameters

Name Type Description
tokenId uint256 Token id of the NFT that you are redeeming.

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

royaltyInfo

function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address, uint256)

Gets the royalty information of the token with the given tokenId.

Parameters

Name Type Description
tokenId uint256 The id of the token that you are checking.
salePrice uint256 The price of the NFT that should be used for royalty calculation.

Returns

Name Type Description
_0 address The address who will receive the royalties and the royalty amount for the given price.
_1 uint256 undefined

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters

Name Type Description
from address undefined
to address undefined
tokenId uint256 undefined
_data bytes undefined

setApprovalForAll

function setApprovalForAll(address operator, bool approved) external nonpayable

See {IERC721-setApprovalForAll}.

Parameters

Name Type Description
operator address undefined
approved bool undefined

setSvgGenerator

function setSvgGenerator(address newSvgGenerator) external nonpayable

Sets the SVG generator for the NFT image.

Parameters

Name Type Description
newSvgGenerator address The address of a contract following the ISvgGenerator signature.

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

Checks if the contract supports the specified interface.

Parameters

Name Type Description
interfaceId bytes4 The interface id of the interface that you are querying.

Returns

Name Type Description
_0 bool True if the interface is supported, false otherwise.

svgGenerator

function svgGenerator() external view returns (address)

Returns

Name Type Description
_0 address undefined

symbol

function symbol() external view returns (string)

See {IERC721Metadata-symbol}.

Returns

Name Type Description
_0 string undefined

toggleCurrencyAllowance

function toggleCurrencyAllowance(address currency) external nonpayable

Toggles the payment allowance of the given currency.

Parameters

Name Type Description
currency address The address of the ERC-20 currency to toggle allowance. Use address(0) for native currency.

tokenURI

function tokenURI(uint256 tokenId) external view returns (string)

Returns the URI of the token with the given tokenId.

Parameters

Name Type Description
tokenId uint256 Token Id of the NFT that you are getting the URI.

Returns

Name Type Description
_0 string Base64-encoded token metadata.

tokens

function tokens(uint256) external view returns (uint256 availabilityFrom, uint256 availabilityTo, uint256 duration, uint256 price, uint256 royaltyBasisPoints, address minter, address payable royaltyReceiver, address currency, address allowedBuyer, bool redeemed, bool forSale, string name, string description, string category)

Parameters

Name Type Description
_0 uint256 undefined

Returns

Name Type Description
availabilityFrom uint256 undefined
availabilityTo uint256 undefined
duration uint256 undefined
price uint256 undefined
royaltyBasisPoints uint256 undefined
minter address undefined
royaltyReceiver address payable undefined
currency address undefined
allowedBuyer address undefined
redeemed bool undefined
forSale bool undefined
name string undefined
description string undefined
category string undefined

totalMinted

function totalMinted() external view returns (uint256)

Returns

Name Type Description
_0 uint256 undefined

totalSupply

function totalSupply() external view returns (uint256)

Returns

Name Type Description
_0 uint256 undefined

transferFrom

function transferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-transferFrom}.

Parameters

Name Type Description
from address undefined
to address undefined
tokenId uint256 undefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

Name Type Description
newOwner address undefined

Events

Approval

event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)

Parameters

Name Type Description
owner indexed address undefined
approved indexed address undefined
tokenId indexed uint256 undefined

ApprovalForAll

event ApprovalForAll(address indexed owner, address indexed operator, bool approved)

Parameters

Name Type Description
owner indexed address undefined
operator indexed address undefined
approved bool undefined

CurrencyAllowanceToggled

event CurrencyAllowanceToggled(address indexed currency)

Parameters

Name Type Description
currency indexed address undefined

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

Name Type Description
previousOwner indexed address undefined
newOwner indexed address undefined

SvgGeneratorSet

event SvgGeneratorSet(address indexed svgGenerator)

Parameters

Name Type Description
svgGenerator indexed address undefined

TokenBought

event TokenBought(uint256 indexed tokenId, address seller, address buyer)

Parameters

Name Type Description
tokenId indexed uint256 undefined
seller address undefined
buyer address undefined

TokenBuyingConditionsChanged

event TokenBuyingConditionsChanged(uint256 indexed tokenId, address currency, uint256 price, address allowedBuyer, bool forSale)

Parameters

Name Type Description
tokenId indexed uint256 undefined
currency address undefined
price uint256 undefined
allowedBuyer address undefined
forSale bool undefined

TokenRedeemed

event TokenRedeemed(uint256 indexed tokenId)

Parameters

Name Type Description
tokenId indexed uint256 undefined

TokenRoyaltyReceiverChanged

event TokenRoyaltyReceiverChanged(uint256 indexed tokenId, address royaltyReceiver)

Parameters

Name Type Description
tokenId indexed uint256 undefined
royaltyReceiver address undefined

Transfer

event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)

Parameters

Name Type Description
from indexed address undefined
to indexed address undefined
tokenId indexed uint256 undefined

Errors

AlreadyRedeemed

error AlreadyRedeemed(uint256 tokenId)

Parameters

Name Type Description
tokenId uint256 undefined

CanNotBuyYourOwnToken

error CanNotBuyYourOwnToken(address buyer, uint256 tokenId)

Parameters

Name Type Description
buyer address undefined
tokenId uint256 undefined

InvalidRoyalty

error InvalidRoyalty()

InvalidTimeParams

error InvalidTimeParams()

NotForSale

error NotForSale(uint256 tokenId)

Parameters

Name Type Description
tokenId uint256 undefined

OnlyCurrentRoyaltyReceiver

error OnlyCurrentRoyaltyReceiver(uint256 tokenId)

Parameters

Name Type Description
tokenId uint256 undefined

OnlyTokenOwner

error OnlyTokenOwner(uint256 tokenId)

Parameters

Name Type Description
tokenId uint256 undefined

TokenDoesNotExist

error TokenDoesNotExist(uint256 tokenId)

Parameters

Name Type Description
tokenId uint256 undefined

TransferFailed

error TransferFailed()

UnallowedCurrency

error UnallowedCurrency(uint256 tokenId, address currency)

Parameters

Name Type Description
tokenId uint256 undefined
currency address undefined

UnauthorizedBuyer

error UnauthorizedBuyer(address buyer, uint256 tokenId)

Parameters

Name Type Description
buyer address undefined
tokenId uint256 undefined