GenericVault
A generic vault contract that can hold any type of assets and execute arbitrary transactions
constructor
receive
Emits an event when native coin is received
execute
Executes a state-changing call on a target
Access to this function SHOULD be protected
Parameters
Name | Type | Description |
---|---|---|
target | address | Contract to call |
data | bytes | Data sent to the target, including function selector |
value | uint256 | Native coin value sent with the call |
executeStatic
Executes a static call (non state-changing) on a target
Parameters
Name | Type | Description |
---|---|---|
target | address | Contract to call |
data | bytes | Data sent to the target, including function selector |
isValidSignature
Should return whether the signature provided is valid for the provided data
Parameters
Name | Type | Description |
---|---|---|
hash | bytes32 | Hash of the data to be signed |
signature | bytes | Signature byte array associated with hash |
onERC721Received
_Whenever an {IERC721} tokenId
token is transferred to this contract via {IERC721-safeTransferFrom}
by operator
from from
, this function is called.
It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector
._
onERC1155Received
_Handles the receipt of a single ERC-1155 token type. This function is
called at the end of a safeTransferFrom
after the balance has been updated.
NOTE: To accept the transfer, this must return
bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
(i.e. 0xf23a6e61, or its own function selector)._
Parameters
Name | Type | Description |
---|---|---|
address | ||
address | ||
uint256 | ||
uint256 | ||
bytes |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) if transfer is allowed |
onERC1155BatchReceived
_Handles the receipt of a multiple ERC-1155 token types. This function
is called at the end of a safeBatchTransferFrom
after the balances have
been updated.
NOTE: To accept the transfer(s), this must return
bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))
(i.e. 0xbc197c81, or its own function selector)._
Parameters
Name | Type | Description |
---|---|---|
address | ||
address | ||
uint256[] | ||
uint256[] | ||
bytes |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) if transfer is allowed |
supportsInterface
_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[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas._