ERC721Warper
ERC721Warper
_owners
mapping(uint256 => address) _owners
Mapping from token ID to owner address
__assetClass
function __assetClass() external pure returns (bytes4)
Returns the warper asset class ID.
setApprovalForAll
function setApprovalForAll(address, bool) external virtual
Method is disabled, kept only for interface compatibility purposes.
approve
function approve(address, uint256) external virtual
Method is disabled, kept only for interface compatibility purposes.
mint
function mint(address to, uint256 tokenId, bytes data) external
_Safely mints `tokenId` and transfers it to `to`.
Requirements:
- needs to pass validation of `_beforeTokenTransfer()`.
- `tokenId` must not exist.
- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
Emits a {Transfer} event._
transferFrom
function transferFrom(address from, address to, uint256 tokenId) external
Need to fulfill all the requirements of `_transfer()`
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 tokenId) public
Need to fulfill all the requirements of `_transfer()`
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) public
Need to fulfill all the requirements of `_transfer()`
supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)
_Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created.
This function call must use less than 30 000 gas._
balanceOf
function balanceOf(address owner) public view returns (uint256)
The rental count calculations get offloaded to the Warper Controller -> Renting Manager
ownerOf
function ownerOf(uint256 tokenId) public view returns (address)
The ownership is dependant on the rental status - Renting Manager is responsible for tracking the state: - NONE: revert with an error - AVAILABLE: means, that the token is not currently rented. Metahub is the owner by default. - RENTED: Use the Warpers internal ownership constructs
getApproved
function getApproved(uint256 tokenId) public view returns (address)
_Returns the account approved for `tokenId` token.
Requirements:
- `tokenId` must exist._
isApprovedForAll
function isApprovedForAll(address, address operator) public view returns (bool)
_Returns if the `operator` is allowed to manage all of the assets of `owner`.
See {setApprovalForAll}_
_validateOriginal
function _validateOriginal(address original) internal virtual
Validates the original NFT.
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal
_ONLY THE RENTING MANAGER CAN CALL THIS METHOD. This validates every single transfer that the warper can perform. Renting Manager can be the only source of transfers, so it can properly synchronise the rental agreement ownership. Hook that is called before any token transfer. This includes minting and burning.
Calling conditions:
- When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`.
- When `from` is zero, `tokenId` will be minted for `to`.
- When `to` is zero, ``from``'s `tokenId` will be burned.
- `from` and `to` are never both zero._
_safeTransfer
function _safeTransfer(address from, address to, uint256 tokenId, bytes data) internal
_Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked.
`data` is additional data, it has no specified format and it is sent in call to `to`.
This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. implement alternative mechanisms to perform token transfer, such as signature-based.
Requirements:
- Needs to fulfill all the requirements of `_transfer()`
- `from` cannot be the zero address.
- `to` cannot be the zero address.
- `tokenId` token must exist and be owned by `from`.
- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
Emits a {Transfer} event._
_transfer
function _transfer(address from, address to, uint256 tokenId) internal
_Transfers `tokenId` from `from` to `to`.
Requirements:
- `to` cannot be the zero address.
- needs to pass validation of `_beforeTokenTransfer()`.
Emits a {Transfer} event._
_exists
function _exists(uint256 tokenId) internal view returns (bool)
_Returns whether `tokenId` exists.
Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
Tokens start existing when they are minted (`mint`), and stop existing when they are burned (`_burn`).
_warperController
function _warperController() internal view returns (contract IERC721WarperController)
Get the associated warper controller.
_checkOnERC721Received
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes data) private returns (bool)
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract.
Name | Type | Description |
---|---|---|
from | address | address representing the previous owner of the given token ID |
to | address | target address that will receive the tokens |
tokenId | uint256 | uint256 ID of the token to be transferred |
data | bytes | bytes optional data to send along with the call |
Name | Type | Description |
---|---|---|
[0] | bool | bool whether the call correctly returned the expected magic value |
_getWarperRentalStatus
function _getWarperRentalStatus(uint256 tokenId) private view returns (enum Rentings.RentalStatus)
Get the rental status of a token.