You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.9 KiB
Markdown
78 lines
1.9 KiB
Markdown
# ERC4907A
|
|
|
|
[`erc721a/contracts/extensions/ERC4907A.sol`](https://github.com/chiru-labs/ERC721A/blob/main/contracts/extensions/ERC4907A.sol)
|
|
|
|
[ERC4907](https://eips.ethereum.org/EIPS/eip-4907) 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`](#setUser) to change or reset the user.
|
|
|
|
To reset or alter the user information after each transfer, you will need to override either
|
|
[`_beforeTokenTransfers`](erc721a.md#_beforeTokenTransfers) or
|
|
[`_afterTokenTransfers`](erc721a.md#_afterTokenTransfers) in ERC721A.
|
|
|
|
Inherits:
|
|
|
|
- [ERC721A](erc721a.md)
|
|
- [IERC4907A](interfaces.md#ierc4907a)
|
|
|
|
|
|
## Functions
|
|
|
|
### setUser
|
|
|
|
```solidity
|
|
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
|
|
|
|
```solidity
|
|
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
|
|
|
|
```solidity
|
|
function userExpires(uint256 tokenId) public view virtual returns (uint256)
|
|
```
|
|
|
|
Returns the user's expires of `tokenId`.
|
|
|
|
### \_explicitUserOf
|
|
|
|
```solidity
|
|
function _explicitUserOf(uint256 tokenId) internal view virtual returns (address)
|
|
```
|
|
|
|
Returns the user address for `tokenId`, ignoring the expiry status.
|
|
|
|
|
|
## Events
|
|
|
|
### UpdateUser
|
|
|
|
`IERC4907-UpdateUser`
|
|
|
|
```solidity
|
|
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.
|
|
|