// SPDX-License-Identifier: GPL-3.0-or-later
// code borrowed from OpenZeppelin and @uniswap/v3-periphery
pragma solidity 0.8.6;
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";
/**
* @title ERC721Enhanced
* @author solace.fi
* @notice An extension of `ERC721`.
*
* The base is OpenZeppelin's `ERC721Enumerable` which also includes the `Metadata` extension. This extension includes simpler transfers, gasless approvals, and better enumeration.
*/
interface IERC721EnhancedInitializable is IERC721EnumerableUpgradeable {
/***************************************
SIMPLER TRANSFERS
***************************************/
/**
* @notice Transfers `tokenID` from `msg.sender` to `to`.
* @dev This was excluded from the official `ERC721` standard in favor of `transferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
* @param to The receipient of the token.
* @param tokenID The token to transfer.
*/
function transfer(address to, uint256 tokenID) external;
/**
* @notice Safely transfers `tokenID` from `msg.sender` to `to`.
* @dev This was excluded from the official `ERC721` standard in favor of `safeTransferFrom(address from, address to, uint256 tokenID)`. We elect to include it.
* @param to The receipient of the token.
* @param tokenID The token to transfer.
*/
function safeTransfer(address to, uint256 tokenID) external;
/***************************************
GASLESS APPROVALS
***************************************/
/**
* @notice Approve of a specific `tokenID` for spending by `spender` via signature.
* @param spender The account that is being approved.
* @param tokenID The ID of the token that is being approved for spending.
* @param deadline The deadline timestamp by which the call must be mined for the approve to work.
* @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`.
* @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`.
* @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`.
*/
function permit(
address spender,
uint256 tokenID,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Returns the current nonce for `tokenID`. This value must be
* included whenever a signature is generated for `permit`.
* Every successful call to `permit` increases ``tokenID``'s nonce by one. This
* prevents a signature from being used multiple times.
* @param tokenID ID of the token to request nonce.
* @return nonce Nonce of the token.
*/
function nonces(uint256 tokenID) external view returns (uint256 nonce);
/**
* @notice The permit typehash used in the `permit` signature.
* @return typehash The typehash for the `permit`.
*/
// solhint-disable-next-line func-name-mixedcase
function PERMIT_TYPEHASH() external view returns (bytes32 typehash);
/**
* @notice The domain separator used in the encoding of the signature for `permit`, as defined by `EIP712`.
* @return seperator The domain seperator for `permit`.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32 seperator);
/***************************************
CHANGEABLE URIS
***************************************/
/// @notice Emitted when the base URI is set.
event BaseURISet(string baseURI);
/***************************************
MISC
***************************************/
/**
* @notice Determines if a token exists or not.
* @param tokenID The ID of the token to query.
* @return status True if the token exists, false if it doesn't.
*/
function exists(uint256 tokenID) external view returns (bool status);
} |