LSP9Vault
Implementation of LSP9Vault built on top of ERC725, LSP-1-UniversalReceiver
Could be owned by an EOA or by a contract and is able to receive and send assets. Also allows for registering received assets by leveraging the key-value storage.
Public Methods​
Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally.
constructor​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
constructor(address newOwner);
Deploying a LSP9Vault contract with owner set to address initialOwner
.
Sets initialOwner
as the contract owner and the SupportedStandards:LSP9Vault
Data Key. The constructor
also allows funding the contract on deployment.
Emitted events:
UniversalReceiver
event when funding the contract on deployment.OwnershipTransferred
event wheninitialOwner
is set as the contractowner
.DataChanged
event when setting the_LSP9_SUPPORTED_STANDARDS_KEY
.UniversalReceiver
event when notifying theinitialOwner
.
Parameters​
Name | Type | Description |
---|---|---|
newOwner | address | The new owner of the contract. |
fallback​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
fallback(bytes calldata callData) external payable returns (bytes memory);
The fallback
function was called with the following amount of native tokens: msg.value
; and the following calldata: callData
.
Achieves the goal of LSP-17-ContractExtension standard by extending the contract to handle calls of functions that do not exist natively, forwarding the function call to the extension address mapped to the function being called. This function is executed when:
-
Sending data of length less than 4 bytes to the contract.
-
The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.
-
Receiving native tokens with some calldata.
- If the data is equal or longer than 4 bytes, the ERC-725Y storage is queried with the following data key: _LSP17_EXTENSION_PREFIX +
bytes4(msg.sig)
(Check LSP-2-ERC725YJSONSchema for encoding the data key)
-
If there is no address stored under the following data key, revert with
NoExtensionFoundForFunctionSelector(bytes4)
. The data key relative tobytes4(0)
is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. -
If there is an address, forward the
msg.data
to the extension using the CALL opcode, appending 52 bytes (20 bytes ofmsg.sender
and 32 bytes ofmsg.value
). Return what the calls returns, or revert if the call failed.
- If the data sent to this function is of length less than 4 bytes (not a function selector), return.
Emitted events:
UniversalReceiver
event when receiving native tokens and extension function selector is not found or not payable.
receive​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
receive() external payable;
Executed:
-
When receiving some native tokens without any additional data.
-
On empty calls to the contract.
Emitted events:
UniversalReceiver
when receiving native tokens.
RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()
- Function selector:
0xead3fbdf
function RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()
external
view
returns (uint256);
Returns​
Name | Type | Description |
---|---|---|
0 | uint256 | - |
RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()
- Function selector:
0x01bfba61
function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()
external
view
returns (uint256);
Returns​
Name | Type | Description |
---|---|---|
0 | uint256 | - |
VERSION​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
VERSION()
- Function selector:
0xffa1ad74
function VERSION() external view returns (string);
Contract version.
Returns​
Name | Type | Description |
---|---|---|
0 | string | - |
acceptOwnership​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
acceptOwnership()
- Function selector:
0x79ba5097
function acceptOwnership() external nonpayable;
msg.sender
is accepting ownership of contract: address(this)
.
Transfer ownership of the contract from the current owner()
to the pendingOwner()
. Once this function is called:
-
The current
owner()
will lose access to the functions restricted to theowner()
only. -
The
pendingOwner()
will gain access to the functions restricted to theowner()
only.
Requirements:
- Only the
pendingOwner
can call this function.- When notifying the previous owner via LSP1, the typeId used must be the
keccak256(...)
hash of LSP0OwnershipTransferred_SenderNotification.- When notifying the new owner via LSP1, the typeId used must be the
keccak256(...)
hash of LSP0OwnershipTransferred_RecipientNotification.
batchCalls​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
batchCalls(bytes[])
- Function selector:
0x6963d438
It's not possible to send value along the functions call due to the use of delegatecall
.
function batchCalls(bytes[] data) external nonpayable returns (bytes[] results);
Executing the following batch of abi-encoded function calls on the contract: data
.
Allows a caller to batch different function calls in one call. Perform a delegatecall
on self, to call different functions with preserving the context.
Parameters​
Name | Type | Description |
---|---|---|
data | bytes[] | An array of ABI encoded function calls to be called on the contract. |
Returns​
Name | Type | Description |
---|---|---|
results | bytes[] | An array of abi-encoded data returned by the functions executed. |
execute​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
execute(uint256,address,uint256,bytes)
- Function selector:
0x44c028fe
The operationType
4 DELEGATECALL
is disabled by default in the LSP9 Vault.
function execute(
uint256 operationType,
address target,
uint256 value,
bytes data
) external payable returns (bytes);
Calling address target
using operationType
, transferring value
wei and data: data
.
Generic executor function to:
-
send native tokens to any address.
-
interact with any contract by passing an abi-encoded function call in the
data
parameter. -
deploy a contract by providing its creation bytecode in the
data
parameter.
Requirements:
- Can be only called by the
owner
or by an authorised address that pass the verification check performed on the owner.- If a
value
is provided, the contract must have at least this amount in its balance to execute successfully.- If the operation type is
CREATE
(1) orCREATE2
(2),target
must beaddress(0)
.- If the operation type is
STATICCALL
(3),value
transfer is disallowed and must be 0.
Emitted events:
Executed
event for each call that uses underoperationType
:CALL
(0) andSTATICCALL
(3).ContractCreated
event, when a contract is created underoperationType
:CREATE
(1) andCREATE2
(2).UniversalReceiver
event when receiving native tokens.
Parameters​
Name | Type | Description |
---|---|---|
operationType | uint256 | The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4 |
target | address | The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2) |
value | uint256 | The amount of native tokens to transfer (in Wei) |
data | bytes | The call data, or the creation bytecode of the contract to deploy if operationType is 1 or 2 . |
Returns​
Name | Type | Description |
---|---|---|
0 | bytes | - |
executeBatch​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
executeBatch(uint256[],address[],uint256[],bytes[])
- Function selector:
0x31858452
The operationType
4 DELEGATECALL
is disabled by default in the LSP9 Vault.
function executeBatch(
uint256[] operationsType,
address[] targets,
uint256[] values,
bytes[] datas
) external payable returns (bytes[]);
Calling multiple addresses targets
using operationsType
, transferring values
wei and data: datas
.
Batch executor function that behaves the same as execute
but allowing multiple operations in the same transaction.
Requirements:
- The length of the parameters provided must be equal.
- Can be only called by the
owner
or by an authorised address that pass the verification check performed on the owner.- If a
value
is provided, the contract must have at least this amount in its balance to execute successfully.- If the operation type is
CREATE
(1) orCREATE2
(2),target
must beaddress(0)
.- If the operation type is
STATICCALL
(3),value
transfer is disallowed and must be 0.
Emitted events:
Executed
event for each call that uses underoperationType
:CALL
(0) andSTATICCALL
(3). (each iteration)ContractCreated
event, when a contract is created underoperationType
:CREATE
(1) andCREATE2
(2). (each iteration)UniversalReceiver
event when receiving native tokens.
Parameters​
Name | Type | Description |
---|---|---|
operationsType | uint256[] | The list of operations type used: CALL = 0 ; CREATE = 1 ; CREATE2 = 2 ; STATICCALL = 3 ; DELEGATECALL = 4 |
targets | address[] | The list of addresses to call. targets will be unused if a contract is created (operation types 1 and 2). |
values | uint256[] | The list of native token amounts to transfer (in Wei). |
datas | bytes[] | The list of calldata, or the creation bytecode of the contract to deploy if operationType is 1 or 2 . |
Returns​
Name | Type | Description |
---|---|---|
0 | bytes[] | - |
getData​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
getData(bytes32)
- Function selector:
0x54f6127f
function getData(bytes32 dataKey) external view returns (bytes dataValue);
Reading the ERC725Y storage for data key dataKey
returned the following value: dataValue
.
Get in the ERC725Y storage the bytes data stored at a specific data key dataKey
.
Parameters​
Name | Type | Description |
---|---|---|
dataKey | bytes32 | The data key for which to retrieve the value. |
Returns​
Name | Type | Description |
---|---|---|
dataValue | bytes | The bytes value stored under the specified data key. |
getDataBatch​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
getDataBatch(bytes32[])
- Function selector:
0xdedff9c6
function getDataBatch(
bytes32[] dataKeys
) external view returns (bytes[] dataValues);
Reading the ERC725Y storage for data keys dataKeys
returned the following values: dataValues
.
Get in the ERC725Y storage the bytes data stored at multiple data keys dataKeys
.
Parameters​
Name | Type | Description |
---|---|---|
dataKeys | bytes32[] | The array of keys which values to retrieve |
Returns​
Name | Type | Description |
---|---|---|
dataValues | bytes[] | The array of data stored at multiple keys |
owner​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
owner()
- Function selector:
0x8da5cb5b
function owner() external view returns (address);
Returns the address of the current owner.
Returns​
Name | Type | Description |
---|---|---|
0 | address | - |
pendingOwner​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
pendingOwner()
- Function selector:
0xe30c3978
If no ownership transfer is in progress, the pendingOwner will be address(0).
.
function pendingOwner() external view returns (address);
The address that ownership of the contract is transferred to. This address may use acceptOwnership()
to gain ownership of the contract.
Returns​
Name | Type | Description |
---|---|---|
0 | address | - |
renounceOwnership​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
renounceOwnership()
- Function selector:
0x715018a6
Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner will be permanently inaccessible, making these functions not callable anymore and unusable.
function renounceOwnership() external nonpayable;
msg.sender
is renouncing ownership of contract address(this)
.
Renounce ownership of the contract in a 2-step process.
-
The first call will initiate the process of renouncing ownership.
-
The second call is used as a confirmation and will leave the contract without an owner.
Requirements:
- Can be only called by the
owner
or by an authorised address that pass the verification check performed on the owner.
setData​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
setData(bytes32,bytes)
- Function selector:
0x7f23690c
function setData(bytes32 dataKey, bytes dataValue) external payable;
Setting the following data key value pair in the ERC725Y storage. Data key: dataKey
, data value: dataValue
.
Sets a single bytes value dataValue
in the ERC725Y storage for a specific data key dataKey
. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data.
Requirements:
- Can be only called by the
owner
or by an authorised address that pass the verification check performed on the owner.
Emitted events:
DataChanged
event.
Parameters​
Name | Type | Description |
---|---|---|
dataKey | bytes32 | The data key for which to set a new value. |
dataValue | bytes | The new bytes value to set. |
setDataBatch​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
setDataBatch(bytes32[],bytes[])
- Function selector:
0x97902421
function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable;
Setting the following data key value pairs in the ERC725Y storage. Data keys: dataKeys
, data values: dataValues
.
Batch data setting function that behaves the same as setData
but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction.
Requirements:
- Can be only called by the
owner
or by an authorised address that pass the verification check performed on the owner.
Emitted events:
DataChanged
event. (on each iteration of setting data)
Parameters​
Name | Type | Description |
---|---|---|
dataKeys | bytes32[] | An array of data keys to set bytes values for. |
dataValues | bytes[] | An array of bytes values to set for each dataKeys . |
supportsInterface​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
supportsInterface(bytes4)
- Function selector:
0x01ffc9a7
function supportsInterface(bytes4 interfaceId) external view returns (bool);
Checking if this contract supports the interface defined by the bytes4
interface ID interfaceId
.
Achieves the goal of ERC-165 to detect supported interfaces and LSP-17-ContractExtension by checking if the interfaceId being queried is supported on another linked extension. If the contract doesn't support the interfaceId
, it forwards the call to the supportsInterface
extension according to LSP-17-ContractExtension, and checks if the extension implements the interface defined by interfaceId
.
Parameters​
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | The interface ID to check if the contract supports it. |
Returns​
Name | Type | Description |
---|---|---|
0 | bool | true if this contract implements the interface defined by interfaceId , false otherwise. |
transferOwnership​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
transferOwnership(address)
- Function selector:
0xf2fde38b
function transferOwnership(address newOwner) external nonpayable;
Transfer ownership initiated by newOwner
.
Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner. If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that ownership has been transferred to them by calling the universalReceiver()
function on the newOwner
contract.
Requirements:
- Can be only called by the
owner
or by an authorised address that pass the verification check performed on the owner.- When notifying the new owner via LSP1, the
typeId
used must be thekeccak256(...)
hash of LSP0OwnershipTransferStarted.- Pending owner cannot accept ownership in the same tx via the LSP1 hook.
Parameters​
Name | Type | Description |
---|---|---|
newOwner | address | The address of the new owner. |
universalReceiver​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Function signature:
universalReceiver(bytes32,bytes)
- Function selector:
0x6bb56a14
function universalReceiver(
bytes32 typeId,
bytes receivedData
) external payable returns (bytes returnedValues);
Notifying the contract by calling its universalReceiver
function with the following informations: typeId: typeId
; data: data
.
Achieves the goal of LSP-1-UniversalReceiver by allowing the account to be notified about incoming/outgoing transactions and enabling reactions to these actions. The reaction is achieved by having two external contracts (LSP1UniversalReceiverDelegate) that react on the whole transaction and on the specific typeId, respectively. The function performs the following steps:
- Query the ERC-725Y storage with the data key _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY.
-
If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
-
If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of
msg.sender
and 32 bytes ofmsg.value
. If not, continue the execution of the function.
- Query the ERC-725Y storage with the data key _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX +
bytes32(typeId)
. (Check LSP-2-ERC725YJSONSchema for encoding the data key)
-
If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
-
If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of
msg.sender
and 32 bytes ofmsg.value
. If not, continue the execution of the function.
Emitted events:
UniversalReceiver
event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called.
Parameters​
Name | Type | Description |
---|---|---|
typeId | bytes32 | The type of call received. |
receivedData | bytes | The data received. |
Returns​
Name | Type | Description |
---|---|---|
returnedValues | bytes | The ABI encoded return value of the LSP1UniversalReceiverDelegate call and the LSP1TypeIdDelegate call. |
Internal Methods​
Any method labeled as internal
serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.
_checkOwner​
function _checkOwner() internal view;
Throws if the sender is not the owner.
_setOwner​
function _setOwner(address newOwner) internal nonpayable;
Changes the owner if newOwner
and oldOwner are different
This pattern is useful in inheritance.
_execute​
Providing operation type DELEGATECALL (4) as argument will result in custom error ERC725X_UnknownOperationType(4)
function _execute(
uint256 operationType,
address target,
uint256 value,
bytes data
) internal nonpayable returns (bytes);
This function overrides the ERC725XCore
internal _execute
function to disable operation type DELEGATECALL (4).
Parameters​
Name | Type | Description |
---|---|---|
operationType | uint256 | The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3. |
target | address | The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2). |
value | uint256 | The amount of native tokens to transfer (in Wei). |
data | bytes | The call data, or the creation bytecode of the contract to deploy if operationType is 1 or 2 . |
_executeBatch​
function _executeBatch(
uint256[] operationsType,
address[] targets,
uint256[] values,
bytes[] datas
) internal nonpayable returns (bytes[]);
check each operationType
provided in the batch and perform the associated low-level opcode after checking for requirements (see executeBatch
).
_executeCall​
function _executeCall(
address target,
uint256 value,
bytes data
) internal nonpayable returns (bytes result);
Perform low-level call (operation type = 0)
Parameters​
Name | Type | Description |
---|---|---|
target | address | The address on which call is executed |
value | uint256 | The value to be sent with the call |
data | bytes | The data to be sent with the call |
Returns​
Name | Type | Description |
---|---|---|
result | bytes | The data from the call |
_executeStaticCall​
function _executeStaticCall(
address target,
bytes data
) internal nonpayable returns (bytes result);
Perform low-level staticcall (operation type = 3)
Parameters​
Name | Type | Description |
---|---|---|
target | address | The address on which staticcall is executed |
data | bytes | The data to be sent with the staticcall |
Returns​
Name | Type | Description |
---|---|---|
result | bytes | The data returned from the staticcall |
_executeDelegateCall​
The msg.value
should not be trusted for any method called with operationType
: DELEGATECALL
(4).
function _executeDelegateCall(
address target,
bytes data
) internal nonpayable returns (bytes result);
Perform low-level delegatecall (operation type = 4)
Parameters​
Name | Type | Description |
---|---|---|
target | address | The address on which delegatecall is executed |
data | bytes | The data to be sent with the delegatecall |
Returns​
Name | Type | Description |
---|---|---|
result | bytes | The data returned from the delegatecall |
_deployCreate​
function _deployCreate(
uint256 value,
bytes creationCode
) internal nonpayable returns (bytes newContract);
Deploy a contract using the CREATE
opcode (operation type = 1)
Parameters​
Name | Type | Description |
---|---|---|
value | uint256 | The value to be sent to the contract created |
creationCode | bytes | The contract creation bytecode to deploy appended with the constructor argument(s) |
Returns​
Name | Type | Description |
---|---|---|
newContract | bytes | The address of the contract created as bytes |
_deployCreate2​
function _deployCreate2(
uint256 value,
bytes creationCode
) internal nonpayable returns (bytes newContract);
Deploy a contract using the CREATE2
opcode (operation type = 2)
Parameters​
Name | Type | Description |
---|---|---|
value | uint256 | The value to be sent to the contract created |
creationCode | bytes | The contract creation bytecode to deploy appended with the constructor argument(s) and a bytes32 salt |
Returns​
Name | Type | Description |
---|---|---|
newContract | bytes | The address of the contract created as bytes |
_getData​
function _getData(bytes32 dataKey) internal view returns (bytes dataValue);
Read the value stored under a specific dataKey
inside the underlying ERC725Y storage,
represented as a mapping of bytes32
data keys mapped to their bytes
data values.
mapping(bytes32 => bytes) _store
Parameters​
Name | Type | Description |
---|---|---|
dataKey | bytes32 | A bytes32 data key to read the associated bytes value from the store. |
Returns​
Name | Type | Description |
---|---|---|
dataValue | bytes | The bytes value associated with the given dataKey in the ERC725Y storage. |
_setData​
function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable;
Write a dataValue
to the underlying ERC725Y storage, represented as a mapping of
bytes32
data keys mapped to their bytes
data values.
mapping(bytes32 => bytes) _store
Emitted events:
DataChanged
event emitted after a successfulsetData
call.
Parameters​
Name | Type | Description |
---|---|---|
dataKey | bytes32 | A bytes32 data key to write the associated bytes value to the store. |
dataValue | bytes | The bytes value to associate with the given dataKey in the ERC725Y storage. |
_transferOwnership​
function _transferOwnership(address newOwner) internal nonpayable;
Set the pending owner of the contract and cancel any renounce ownership process that was previously started.
Requirements:
newOwner
cannot be the address of the contract itself.
Parameters​
Name | Type | Description |
---|---|---|
newOwner | address | The address of the new pending owner. |
_acceptOwnership​
function _acceptOwnership() internal nonpayable;
Set the pending owner of the contract as the new owner.
_renounceOwnership​
function _renounceOwnership() internal nonpayable;
Initiate or confirm the process of renouncing ownership after a specific delay of blocks have passed.
_supportsInterfaceInERC165Extension​
function _supportsInterfaceInERC165Extension(
bytes4 interfaceId
) internal view returns (bool);
Returns whether the interfaceId being checked is supported in the extension of the
supportsInterface
selector.
To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally
supported by reading whether the interfaceId queried is supported in the supportsInterface
extension if the extension is set, if not it returns false.
_getExtensionAndForwardValue​
function _getExtensionAndForwardValue(
bytes4 functionSelector
) internal view returns (address, bool);
Returns the extension address stored under the following data key:
-
_LSP17_EXTENSION_PREFIX
+<bytes4>
(Check [LSP2-ERC725YJSONSchema] for encoding the data key). -
If no extension is stored, returns the address(0).
_fallbackLSP17Extendable​
This function does not forward to the extension contract the msg.value
received by the contract that inherits LSP17Extendable
.
If you would like to forward the msg.value
to the extension contract, you can override the code of this internal function as follow:
(bool success, bytes memory result) = extension.call{value: msg.value}(
abi.encodePacked(callData, msg.sender, msg.value)
);
function _fallbackLSP17Extendable(
bytes callData
) internal nonpayable returns (bytes);
Forwards the call to an extension mapped to a function selector.
Calls _getExtensionAndForwardValue
to get the address of the extension mapped to the function selector being
called on the account. If there is no extension, the address(0)
will be returned.
Forwards the value if the extension is payable.
Reverts if there is no extension for the function being called, except for the bytes4(0)
function selector, which passes even if there is no extension for it.
If there is an extension for the function selector being called, it calls the extension with the
CALL
opcode, passing the msg.data
appended with the 20 bytes of the msg.sender
and 32 bytes of the msg.value
.
_validateAndIdentifyCaller​
function _validateAndIdentifyCaller() internal view returns (bool isURD);
Internal method restricting the call to the owner of the contract and the UniversalReceiverDelegate
Events​
ContractCreated​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
ContractCreated(uint256,address,uint256,bytes32)
- Event topic hash:
0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3
event ContractCreated(
uint256 indexed operationType,
address indexed contractAddress,
uint256 value,
bytes32 indexed salt
);
Deployed new contract at address contractAddress
and funded with value
wei (deployed using opcode: operationType
).
Emitted when a new contract was created and deployed.
Parameters​
Name | Type | Description |
---|---|---|
operationType indexed | uint256 | The opcode used to deploy the contract (CREATE or CREATE2 ). |
contractAddress indexed | address | The created contract address. |
value | uint256 | The amount of native tokens (in Wei) sent to fund the created contract on deployment. |
salt indexed | bytes32 | The salt used to deterministically deploy the contract (CREATE2 only). If CREATE opcode is used, the salt value will be bytes32(0) . |
DataChanged​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
DataChanged(bytes32,bytes)
- Event topic hash:
0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2
event DataChanged(bytes32 indexed dataKey, bytes dataValue);
The following data key/value pair has been changed in the ERC725Y storage: Data key: dataKey
, data value: dataValue
.
Emitted when data at a specific dataKey
was changed to a new value dataValue
.
Parameters​
Name | Type | Description |
---|---|---|
dataKey indexed | bytes32 | The data key for which a bytes value is set. |
dataValue | bytes | The value to set for the given data key. |
Executed​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
Executed(uint256,address,uint256,bytes4)
- Event topic hash:
0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e
event Executed(
uint256 indexed operationType,
address indexed target,
uint256 value,
bytes4 indexed selector
);
Called address target
using operationType
with value
wei and data
.
Emitted when calling an address target
(EOA or contract) with value
.
Parameters​
Name | Type | Description |
---|---|---|
operationType indexed | uint256 | The low-level call opcode used to call the target address (CALL , STATICALL or DELEGATECALL ). |
target indexed | address | The address to call. target will be unused if a contract is created (operation types 1 and 2). |
value | uint256 | The amount of native tokens transferred along the call (in Wei). |
selector indexed | bytes4 | The first 4 bytes (= function selector) of the data sent with the call. |
OwnershipRenounced​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
OwnershipRenounced()
- Event topic hash:
0xd1f66c3d2bc1993a86be5e3d33709d98f0442381befcedd29f578b9b2506b1ce
event OwnershipRenounced();
Successfully renounced ownership of the contract. This contract is now owned by anyone, it's owner is address(0)
.
Emitted when the ownership of the contract has been renounced.
OwnershipTransferStarted​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
OwnershipTransferStarted(address,address)
- Event topic hash:
0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700
event OwnershipTransferStarted(
address indexed previousOwner,
address indexed newOwner
);
The transfer of ownership of the contract was initiated. Pending new owner set to: newOwner
.
Emitted when transferOwnership(..)
was called and the first step of transferring ownership completed successfully which leads to pendingOwner
being updated.
Parameters​
Name | Type | Description |
---|---|---|
previousOwner indexed | address | The address of the previous owner. |
newOwner indexed | address | The address of the new owner. |
OwnershipTransferred​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
OwnershipTransferred(address,address)
- Event topic hash:
0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
Parameters​
Name | Type | Description |
---|---|---|
previousOwner indexed | address | - |
newOwner indexed | address | - |
RenounceOwnershipStarted​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
RenounceOwnershipStarted()
- Event topic hash:
0x81b7f830f1f0084db6497c486cbe6974c86488dcc4e3738eab94ab6d6b1653e7
event RenounceOwnershipStarted();
Ownership renouncement initiated.
Emitted when starting the renounceOwnership(..)
2-step process.
UniversalReceiver​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Event signature:
UniversalReceiver(address,uint256,bytes32,bytes,bytes)
- Event topic hash:
0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2
event UniversalReceiver(
address indexed from,
uint256 indexed value,
bytes32 indexed typeId,
bytes receivedData,
bytes returnedValue
);
*Address from
called the universalReceiver(...)
function while sending value
LYX. Notification type (typeId): typeId
- Data received:
receivedData
.*
Emitted when the universalReceiver
function was called with a specific typeId
and some receivedData
Parameters​
Name | Type | Description |
---|---|---|
from indexed | address | The address of the EOA or smart contract that called the universalReceiver(...) function. |
value indexed | uint256 | The amount sent to the universalReceiver(...) function. |
typeId indexed | bytes32 | A bytes32 unique identifier (= "hook")that describe the type of notification, information or transaction received by the contract. Can be related to a specific standard or a hook. |
receivedData | bytes | Any arbitrary data that was sent to the universalReceiver(...) function. |
returnedValue | bytes | The value returned by the universalReceiver(...) function. |
Errors​
ERC725X_ContractDeploymentFailed​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_ContractDeploymentFailed()
- Error hash:
0x0b07489b
error ERC725X_ContractDeploymentFailed();
Reverts when contract deployment failed via execute
or executeBatch
functions, This error can occur using either operation type 1 (CREATE
) or 2 (CREATE2
).
ERC725X_CreateOperationsRequireEmptyRecipientAddress​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_CreateOperationsRequireEmptyRecipientAddress()
- Error hash:
0x3041824a
error ERC725X_CreateOperationsRequireEmptyRecipientAddress();
Reverts when passing a to
address that is not address(0)
(= address zero) while deploying a contract via execute
or executeBatch
functions. This error can occur using either operation type 1 (CREATE
) or 2 (CREATE2
).
ERC725X_ExecuteParametersEmptyArray​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_ExecuteParametersEmptyArray()
- Error hash:
0xe9ad2b5f
error ERC725X_ExecuteParametersEmptyArray();
Reverts when one of the array parameter provided to the executeBatch
function is an empty array.
ERC725X_ExecuteParametersLengthMismatch​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_ExecuteParametersLengthMismatch()
- Error hash:
0x3ff55f4d
error ERC725X_ExecuteParametersLengthMismatch();
Reverts when there is not the same number of elements in the operationTypes
, targets
addresses, values
, and datas
array parameters provided when calling the executeBatch
function.
ERC725X_InsufficientBalance​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_InsufficientBalance(uint256,uint256)
- Error hash:
0x0df9a8f8
error ERC725X_InsufficientBalance(uint256 balance, uint256 value);
Reverts when trying to send more native tokens value
than available in current balance
.
Parameters​
Name | Type | Description |
---|---|---|
balance | uint256 | The balance of native tokens of the ERC725X smart contract. |
value | uint256 | The amount of native tokens sent via ERC725X.execute(...) /ERC725X.executeBatch(...) that is greater than the contract's balance . |
ERC725X_MsgValueDisallowedInStaticCall​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_MsgValueDisallowedInStaticCall()
- Error hash:
0x72f2bc6a
error ERC725X_MsgValueDisallowedInStaticCall();
Reverts when trying to send native tokens (value
/ values[]
parameter of execute
or executeBatch
functions) while making a staticcall
(operationType == 3
). Sending native tokens via staticcall
is not allowed because it is a state changing operation.
ERC725X_NoContractBytecodeProvided​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_NoContractBytecodeProvided()
- Error hash:
0xb81cd8d9
error ERC725X_NoContractBytecodeProvided();
Reverts when no contract bytecode was provided as parameter when trying to deploy a contract via execute
or executeBatch
. This error can occur using either operation type 1 (CREATE
) or 2 (CREATE2
).
ERC725X_UnknownOperationType​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725X_UnknownOperationType(uint256)
- Error hash:
0x7583b3bc
error ERC725X_UnknownOperationType(uint256 operationTypeProvided);
Reverts when the operationTypeProvided
is none of the default operation types available. (CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4)
Parameters​
Name | Type | Description |
---|---|---|
operationTypeProvided | uint256 | The unrecognised operation type number provided to ERC725X.execute(...) /ERC725X.executeBatch(...) . |
ERC725Y_DataKeysValuesLengthMismatch​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725Y_DataKeysValuesLengthMismatch()
- Error hash:
0x3bcc8979
error ERC725Y_DataKeysValuesLengthMismatch();
Reverts when there is not the same number of elements in the datakeys
and dataValues
array parameters provided when calling the setDataBatch
function.
ERC725Y_MsgValueDisallowed​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
ERC725Y_MsgValueDisallowed()
- Error hash:
0xf36ba737
error ERC725Y_MsgValueDisallowed();
Reverts when sending value to the setData
or setDataBatch
function.
LSP14CallerNotPendingOwner​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
LSP14CallerNotPendingOwner(address)
- Error hash:
0x451e4528
error LSP14CallerNotPendingOwner(address caller);
Reverts when the caller
that is trying to accept ownership of the contract is not the pending owner.
Parameters​
Name | Type | Description |
---|---|---|
caller | address | The address that tried to accept ownership. |
LSP14CannotTransferOwnershipToSelf​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
LSP14CannotTransferOwnershipToSelf()
- Error hash:
0xe052a6f8
error LSP14CannotTransferOwnershipToSelf();
Cannot transfer ownership to the address of the contract itself.
Reverts when trying to transfer ownership to the address(this)
.
LSP14MustAcceptOwnershipInSeparateTransaction​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
LSP14MustAcceptOwnershipInSeparateTransaction()
- Error hash:
0x5758dd07
error LSP14MustAcceptOwnershipInSeparateTransaction();
Cannot accept ownership in the same transaction with transferOwnership(...)
.
Reverts when pending owner accept ownership in the same transaction of transferring ownership.
LSP14NotInRenounceOwnershipInterval​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
LSP14NotInRenounceOwnershipInterval(uint256,uint256)
- Error hash:
0x1b080942
error LSP14NotInRenounceOwnershipInterval(
uint256 renounceOwnershipStart,
uint256 renounceOwnershipEnd
);
Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: renounceOwnershipStart
until: renounceOwnershipEnd
.
Reverts when trying to renounce ownership before the initial confirmation delay.
Parameters​
Name | Type | Description |
---|---|---|
renounceOwnershipStart | uint256 | The start timestamp when one can confirm the renouncement of ownership. |
renounceOwnershipEnd | uint256 | The end timestamp when one can confirm the renouncement of ownership. |
LSP1DelegateNotAllowedToSetDataKey​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
LSP1DelegateNotAllowedToSetDataKey(bytes32)
- Error hash:
0x199611f1
error LSP1DelegateNotAllowedToSetDataKey(bytes32 dataKey);
The LSP1UniversalReceiverDelegate
is not allowed to set the following data key: dataKey
.
Reverts when the Vault version of LSP1UniversalReceiverDelegate sets @lukso/lsp1-contracts/6/17 Data Keys.
Parameters​
Name | Type | Description |
---|---|---|
dataKey | bytes32 | The data key that the Vault version of LSP1UniversalReceiverDelegate is not allowed to set. |
NoExtensionFoundForFunctionSelector​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
NoExtensionFoundForFunctionSelector(bytes4)
- Error hash:
0xbb370b2b
error NoExtensionFoundForFunctionSelector(bytes4 functionSelector);
reverts when there is no extension for the function selector being called with
Parameters​
Name | Type | Description |
---|---|---|
functionSelector | bytes4 | - |
OwnableCallerNotTheOwner​
- Specification details: LSP-9-Vault
- Solidity implementation:
LSP9Vault.sol
- Error signature:
OwnableCallerNotTheOwner(address)
- Error hash:
0xbf1169c5
error OwnableCallerNotTheOwner(address callerAddress);
Reverts when only the owner is allowed to call the function.
Parameters​
Name | Type | Description |
---|---|---|
callerAddress | address | The address that tried to make the call. |