ERC721Vault

Contract that can hold ETH and ERC721 tokens. Instances are ownable by an NFT.

Functions

getPermissionHash

Calculates permission using EIP712.

Params:

Name

Type

Description

eip712TypeHash

bytes32

EIP712 function signature.

delegate

address

Beneficiary of the permission.

token

address

Address of ERC721 contract that minted this token.

tokenId

uint256

Id of the ERC721 token.

nonce

uint256

Random data to prevent reusing of permission multiple times. Contract nonce could be a good candidate.

Returns:

Name

Type

Description

permissionHash

bytes32

Hash of the calculated permission.

initialize

Should be called by a NFT minting contract as part of the mint function.

onERC721Received

Function that gets called on receipt of an ERC721 token.

Params:

Name

Type

Description

operator

address

Address of the operator

from

address

Address of the sender

tokenId

uint256

Id of the ERC721

data

bytes

Any additional data

Returns:

Name

Type

Description

selector

bytes4

The bytes representing the onERC721Received selector

transferERC721

Transfer ERC721 tokens out of the vault. Access control: only owner. Token transfer: transfer any ERC721 token.

Params:

Name

Type

Description

token

address

Address of ERC721 contract that minted this token.

to

address

Address of the recipient.

tokenId

uint256

Id of the ERC721 token.

transferETH

Transfer ETH out of the vault.

Params:

Name

Type

Description

to

address

Address of the recipient

amount

uint256

Amount of ETH to transfer