-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ERC4907 docs * Add note on retaining user info upon transfer * Nits
- Loading branch information
1 parent
afdf09a
commit 5e70c80
Showing
4 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# 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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters