Skip to main content

ERC725

Standard Specifications
Solidity implementation

ERC725 bundle.

Bundle ERC725X and ERC725Y together into one smart contract.

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

References
constructor(address initialOwner);

Deploying an ERC725 smart contract and setting address initialOwner as the contract owner.

Deploy a new ERC725 contract with the provided initialOwner as the contract owner.

Requirements:

  • initialOwner CANNOT be the zero address.

Parameters

NameTypeDescription
initialOwneraddressthe owner of the contract.

execute

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: execute(uint256,address,uint256,bytes)
  • Function selector: 0x44c028fe
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:

  • SHOULD only be callable by the owner of the contract.
  • if a value is provided, the contract MUST have at least this amount to transfer to target from its balance and execute successfully.
  • if the operation type is STATICCALL (3) or DELEGATECALL (4), value transfer is disallowed and SHOULD be 0.
  • target SHOULD be address(0) when deploying a new contract via operationType CREATE (1), or CREATE2 (2).

Emitted events:

  • Executed event when a call is made with operationType 0 (CALL), 3 (STATICCALL) or 4 (DELEGATECALL).
  • ContractCreated event when deploying a new contract with operationType 1 (CREATE) or 2 (CREATE2).

Parameters

NameTypeDescription
operationTypeuint256The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4
targetaddressThe address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2)
valueuint256The amount of native tokens to transfer (in Wei)
databytesThe call data, or the creation bytecode of the contract to deploy if operationType is 1 or 2.

Returns

NameTypeDescription
0bytes-

executeBatch

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: executeBatch(uint256[],address[],uint256[],bytes[])
  • Function selector: 0x31858452
Warning
  • The msg.value should not be trusted for any method called with operationType: DELEGATECALL (4).
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:

  • All the array parameters provided MUST be equal and have the same length.
  • SHOULD only be callable by the owner of the contract.
  • The contract MUST have in its balance at least the sum of all the values to transfer and execute successfully each calldata payloads.

Emitted events:

  • Executed event, when a call is made with operationType 0 (CALL), 3 (STATICCALL) or 4 (DELEGATECALL)
  • ContractCreated event, when deploying a contract with operationType 1 (CREATE) or 2 (CREATE2)

Parameters

NameTypeDescription
operationsTypeuint256[]The list of operations type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4
targetsaddress[]The list of addresses to call. targets will be unused if a contract is created (operation types 1 and 2).
valuesuint256[]The list of native token amounts to transfer (in Wei).
datasbytes[]The list of calldata, or the creation bytecode of the contract to deploy if operationType is 1 or 2.

Returns

NameTypeDescription
0bytes[]-

getData

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

NameTypeDescription
dataKeybytes32The data key for which to retrieve the value.

Returns

NameTypeDescription
dataValuebytesThe bytes value stored under the specified data key.

getDataBatch

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

NameTypeDescription
dataKeysbytes32[]The array of keys which values to retrieve

Returns

NameTypeDescription
dataValuesbytes[]The array of data stored at multiple keys

owner

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: owner()
  • Function selector: 0x8da5cb5b
function owner() external view returns (address);

Returns the address of the current owner.

Returns

NameTypeDescription
0address-

renounceOwnership

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: renounceOwnership()
  • Function selector: 0x715018a6
function renounceOwnership() external nonpayable;

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.


setData

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: setData(bytes32,bytes)
  • Function selector: 0x7f23690c
Warning

Note for developers: despite the fact that this function is set as payable, if the function is not intended to receive value (= native tokens), an additional check should be implemented to ensure that msg.value sent was equal to 0.

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:

  • SHOULD only be callable by the owner.

Emitted events:

Parameters

NameTypeDescription
dataKeybytes32The data key for which to set a new value.
dataValuebytesThe new bytes value to set.

setDataBatch

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: setDataBatch(bytes32[],bytes[])
  • Function selector: 0x97902421
Warning

Note for developers: despite the fact that this function is set as payable, if the function is not intended to receive value (= native tokens), an additional check should be implemented to ensure that msg.value sent was equal to 0.

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:

  • SHOULD only be callable by the owner of the contract.

Emitted events:

Parameters

NameTypeDescription
dataKeysbytes32[]An array of data keys to set bytes values for.
dataValuesbytes[]An array of bytes values to set for each dataKeys.

supportsInterface

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: supportsInterface(bytes4)
  • Function selector: 0x01ffc9a7
function supportsInterface(bytes4 interfaceId) external view returns (bool);

See IERC165-supportsInterface.

Parameters

NameTypeDescription
interfaceIdbytes4-

Returns

NameTypeDescription
0bool-

transferOwnership

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Function signature: transferOwnership(address)
  • Function selector: 0xf2fde38b
function transferOwnership(address newOwner) external nonpayable;

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddress-

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

function _execute(
uint256 operationType,
address target,
uint256 value,
bytes data
) internal nonpayable returns (bytes);

check the operationType provided and perform the associated low-level opcode after checking for requirements (see execute).


_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

NameTypeDescription
targetaddressThe address on which call is executed
valueuint256The value to be sent with the call
databytesThe data to be sent with the call

Returns

NameTypeDescription
resultbytesThe data from the call

_executeStaticCall

function _executeStaticCall(
address target,
bytes data
) internal nonpayable returns (bytes result);

Perform low-level staticcall (operation type = 3)

Parameters

NameTypeDescription
targetaddressThe address on which staticcall is executed
databytesThe data to be sent with the staticcall

Returns

NameTypeDescription
resultbytesThe data returned from the staticcall

_executeDelegateCall

Warning

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

NameTypeDescription
targetaddressThe address on which delegatecall is executed
databytesThe data to be sent with the delegatecall

Returns

NameTypeDescription
resultbytesThe 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

NameTypeDescription
valueuint256The value to be sent to the contract created
creationCodebytesThe contract creation bytecode to deploy appended with the constructor argument(s)

Returns

NameTypeDescription
newContractbytesThe 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

NameTypeDescription
valueuint256The value to be sent to the contract created
creationCodebytesThe contract creation bytecode to deploy appended with the constructor argument(s) and a bytes32 salt

Returns

NameTypeDescription
newContractbytesThe 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

NameTypeDescription
dataKeybytes32A bytes32 data key to read the associated bytes value from the store.

Returns

NameTypeDescription
dataValuebytesThe 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 successful setData call.

Parameters

NameTypeDescription
dataKeybytes32A bytes32 data key to write the associated bytes value to the store.
dataValuebytesThe bytes value to associate with the given dataKey in the ERC725Y storage.

Events

ContractCreated

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

NameTypeDescription
operationType indexeduint256The opcode used to deploy the contract (CREATE or CREATE2).
contractAddress indexedaddressThe created contract address.
valueuint256The amount of native tokens (in Wei) sent to fund the created contract on deployment.
salt indexedbytes32The salt used to deterministically deploy the contract (CREATE2 only). If CREATE opcode is used, the salt value will be bytes32(0).

DataChanged

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

NameTypeDescription
dataKey indexedbytes32The data key for which a bytes value is set.
dataValuebytesThe value to set for the given data key.

Executed

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

NameTypeDescription
operationType indexeduint256The low-level call opcode used to call the target address (CALL, STATICALL or DELEGATECALL).
target indexedaddressThe address to call. target will be unused if a contract is created (operation types 1 and 2).
valueuint256The amount of native tokens transferred along the call (in Wei).
selector indexedbytes4The first 4 bytes (= function selector) of the data sent with the call.

OwnershipTransferred

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Event signature: OwnershipTransferred(address,address)
  • Event topic hash: 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

Parameters

NameTypeDescription
previousOwner indexedaddress-
newOwner indexedaddress-

Errors

ERC725X_ContractDeploymentFailed

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

NameTypeDescription
balanceuint256The balance of native tokens of the ERC725X smart contract.
valueuint256The amount of native tokens sent via ERC725X.execute(...)/ERC725X.executeBatch(...) that is greater than the contract's balance.

ERC725X_MsgValueDisallowedInDelegateCall

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Error signature: ERC725X_MsgValueDisallowedInDelegateCall()
  • Error hash: 0x5ac83135
error ERC725X_MsgValueDisallowedInDelegateCall();

Reverts when trying to send native tokens (value / values[] parameter of execute or executeBatch functions) while making a delegatecall (operationType == 4). Sending native tokens via staticcall is not allowed because msg.value is persisting.


ERC725X_MsgValueDisallowedInStaticCall

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

NameTypeDescription
operationTypeProvideduint256The unrecognised operation type number provided to ERC725X.execute(...)/ERC725X.executeBatch(...).

ERC725Y_DataKeysValuesEmptyArray

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Error signature: ERC725Y_DataKeysValuesEmptyArray()
  • Error hash: 0x97da5f95
error ERC725Y_DataKeysValuesEmptyArray();

Reverts when one of the array parameter provided to setDataBatch function is an empty array.


ERC725Y_DataKeysValuesLengthMismatch

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.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

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Error signature: ERC725Y_MsgValueDisallowed()
  • Error hash: 0xf36ba737
error ERC725Y_MsgValueDisallowed();

Reverts when sending value to the setData or setDataBatch function.


OwnableCallerNotTheOwner

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Error signature: OwnableCallerNotTheOwner(address)
  • Error hash: 0xbf1169c5
error OwnableCallerNotTheOwner(address callerAddress);

Reverts when only the owner is allowed to call the function.

Parameters

NameTypeDescription
callerAddressaddressThe address that tried to make the call.

OwnableCannotSetZeroAddressAsOwner

References
  • Specification details: ERC-725
  • Solidity implementation: ERC725.sol
  • Error signature: OwnableCannotSetZeroAddressAsOwner()
  • Error hash: 0x1ad8836c
error OwnableCannotSetZeroAddressAsOwner();

Reverts when trying to set address(0) as the contract owner when deploying the contract, initializing it or transferring ownership of the contract.