1.9 KiB
ERC4907A
erc721a/contracts/extensions/ERC4907A.sol
ERC4907 compliant extension of ERC721A, which allows owners and authorized addresses to add a time-limited role with restricted permissions to ERC721 tokens.
This implementation does not reset the user information upon token transfer.
The new owner must call setUser
to change or reset the user.
To reset or alter the user information after each transfer, you will need to override either
_beforeTokenTransfers
or
_afterTokenTransfers
in ERC721A.
Inherits:
Functions
setUser
function setUser(uint256 tokenId, address user, uint64 expires) public virtual
Sets the user
and expires
for tokenId
.
The zero address indicates there is no user.
Requirements:
- The caller must own
tokenId
or be an approved operator.
userOf
function userOf(uint256 tokenId) public view virtual returns (address)
Returns the user address for tokenId
.
The zero address indicates that there is no user or if the user is expired.
userExpires
function userExpires(uint256 tokenId) public view virtual returns (uint256)
Returns the user's expires of tokenId
.
_explicitUserOf
function _explicitUserOf(uint256 tokenId) internal view virtual returns (address)
Returns the user address for tokenId
, ignoring the expiry status.
Events
UpdateUser
IERC4907-UpdateUser
event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires)
Emitted when the user
of an NFT or the expires
of the user
is changed.
The zero address for user indicates that there is no user address.