Skip to main content
Helpful?

ERC721PermitHash

Git Source | Generated with forge doc

State Variables

PERMIT_TYPEHASH

Value is equal to keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)");

bytes32 constant PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad;

PERMIT_FOR_ALL_TYPEHASH

Value is equal to keccak256("PermitForAll(address operator,bool approved,uint256 nonce,uint256 deadline)");

bytes32 constant PERMIT_FOR_ALL_TYPEHASH = 0x6673cb397ee2a50b6b8401653d3638b4ac8b3db9c28aa6870ffceb7574ec2f76;

Functions

hashPermit

Hashes the data that will be signed for IERC721Permit_v4.permit()

function hashPermit(address spender, uint256 tokenId, uint256 nonce, uint256 deadline)
internal
pure
returns (bytes32 digest);

Parameters

NameTypeDescription
spenderaddressThe address which may spend the tokenId
tokenIduint256The tokenId of the owner, which may be spent by spender
nonceuint256A unique non-ordered value for each signature to prevent replay attacks
deadlineuint256The time at which the signature expires

Returns

NameTypeDescription
digestbytes32The hash of the data to be signed; the equivalent to keccak256(abi.encode(PERMIT_TYPEHASH, spender, tokenId, nonce, deadline));

hashPermitForAll

Hashes the data that will be signed for IERC721Permit_v4.permit()

function hashPermitForAll(address operator, bool approved, uint256 nonce, uint256 deadline)
internal
pure
returns (bytes32 digest);

Parameters

NameTypeDescription
operatoraddressThe address which may spend any of the owner's tokenIds
approvedbooltrue if the operator is to have full permission over the owner's tokenIds; false otherwise
nonceuint256A unique non-ordered value for each signature to prevent replay attacks
deadlineuint256The time at which the signature expires

Returns

NameTypeDescription
digestbytes32The hash of the data to be signed; the equivalent to keccak256(abi.encode(PERMIT_FOR_ALL_TYPEHASH, operator, approved, nonce, deadline));
Helpful?