Skip to main content

ERC721OwlExpiring

ERC721OwlExpiring​

This implementation is an extension of OwlProtocol's base {ERC721Owl} contract. After a set amount of time determined at mint, the tokenId will no longer belong to the minter. The update is not done through a transaction but rather by overriding standaring {ERC721Owl} view function to return null results after token expiry has passed.

The default mint(address,uint256) is disabled in favor of a new signature that allows setting of an expiry time.

Initially, setting the expiry time is done by MINTER_ROLE during the minting process however consequent updates to the expiry time (but before expiry has taken place) must be done by EXPIRY_ROLE. After expiry, tokenId is able to reminted by MINTER_ROLE but can also be extended by EXPIRY_ROLE

EXPIRY_ROLE​

bytes32 EXPIRY_ROLE

ERC165TAG​

bytes4 ERC165TAG

expires​

mapping(uint256 => uint256) expires

initialize​

function initialize(address _admin, string _name, string _symbol, string baseURI_, address _forwarder, address _receiver, uint96 _feeNumerator) external

Initializes contract (replaces constructor in proxy pattern)

NameTypeDescription
_adminaddressowner
_namestringname
_symbolstringsymbol
baseURI_stringuri
_forwarderaddresstrusted forwarder address for openGSN
_receiveraddressaddress of receiver of royalty fees
_feeNumeratoruint96numerator of fee proportion (numerator / 10000)

proxyInitialize​

function proxyInitialize(address _admin, string _name, string _symbol, string baseURI_, address _forwarder, address _receiver, uint96 _feeNumerator) external

Initializes contract through beacon proxy (replaces constructor in proxy pattern)

__ERC721OwlExpiring_init​

function __ERC721OwlExpiring_init(address _admin, string _name, string _symbol, string baseURI_, address _forwarder, address _receiver, uint96 _feeNumerator) internal

__ERC721OwlExpiring_init_unchained​

function __ERC721OwlExpiring_init_unchained() internal

grantExpiry​

function grantExpiry(address to) public

Must have DEFAULT_ADMIN_ROLE

Grants EXPIRY_ROLE to to

NameTypeDescription
toaddressaddress to

ownerOf​

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

See {IERC721-ownerOf}.

tokenURI​

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

See {IERC721Metadata-tokenURI}.

approve​

function approve(address to, uint256 tokenId) public virtual

See {IERC721-approve}.

getApproved​

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

See {IERC721-getApproved}.

transferFrom​

function transferFrom(address from, address to, uint256 tokenId) public

See {IERC721-transferFrom}.

safeTransferFrom​

function safeTransferFrom(address from, address to, uint256 tokenId) public

See {IERC721-safeTransferFrom}.

mint​

function mint(address, uint256) public pure

function disabled

safeMint​

function safeMint(address, uint256) public pure

function disabled

mint​

function mint(address to, uint256 tokenId, uint256 expireTime) public

Must have MINTER_ROLE

Allows MINTER_ROLE to mint NFTs

NameTypeDescription
toaddressaddress to
tokenIduint256tokenId value
expireTimeuint256

safeMint​

function safeMint(address to, uint256 tokenId, uint256 expireTime) public

Must have MINTER_ROLE

Allows caller to mint NFTs (safeMint)

NameTypeDescription
toaddressaddress to
tokenIduint256tokenId value
expireTimeuint256

extendExpiry​

function extendExpiry(uint256 tokenId, uint256 extendAmount) external

Must have EXPIRY_ROLE.

expires mapping is updated with new expire time

NameTypeDescription
tokenIduint256to update
extendAmountuint256amount of time to extend by

getExpiry​

function getExpiry(uint256 tokenId) external view returns (uint256)

exposes read access to expires mapping

NameTypeDescription
[0]uint256expireTime block.timestamp of when tokenId expires

_expired​

function _expired(uint256 tokenId) internal view virtual returns (bool)

checks if tokenId is expired

NameTypeDescription
[0]boolbool expired

supportsInterface​

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

ERC165 Support

NameTypeDescription
interfaceIdbytes4hash of the interface testing for
NameTypeDescription
[0]boolbool whether interface is supported