NFT Company
Search…
ERC20Vault
Contract that can hold ETH and ERC20 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 token.
amount
uint256
Amount of the token for which permission to spend is being granted.
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.
transferERC20
Transfer ERC20 tokens out of the vault. Access control: only owner. Token transfer: transfer any ERC20 token.
Params:
Name
Type
Description
token
address
Address of token being transferred.
to
address
Address of the recipient.
amount
uint256
Amount of tokens to transfer.
transferETH
Transfer ETH out of the vault.
Params:
Name
Type
Description
to
address
Address of the recipient
amount
uint256
Amount of ETH to transfer
Last modified 3mo ago
Copy link