Skip to content

ERC: Proxy Account #725

@frozeman

Description

@frozeman

This proposal has moved to ERC-725 (source).

This issue exists as an archive only.

Original Text
eip: <to be assigned>
title: ERC-725 Smart Contract Based Account
author: Fabian Vogelsteller <fabian@lukso.network>, Tyler Yasaka (@tyleryasaka)
discussions-to: https://github.com/ethereum/EIPs/issues/725
status: Draft
type: Standards Track
category: ERC
requires: ERC165, ERC173, ERC1271 (optional)
created: 2017-10-02
updated: 2020-07-02

This is the new 725 v2 standard, that is radically different from ERC 725 v1. ERC 725 v1 is be moved to #734 as a new key manager standard.

Simple Summary

A standard interface for a smart contract based account with attachable key value store.

Abstract

The following describes standard functions for a unique smart contract based account that can be used by humans,
groups, organisations, objects and machines.

The standard is divided into two sub standards:

ERC725X:
Can execute arbitrary smart contracts using and deploy other smart contracts.

ERC725Y:
Can hold arbitrary data through a generic key/value store.

Motivation

Standardizing a minimal interface for a smart contract based account allows any interface to operate through these account types.
Smart contact based accounts following this standard have the following advantages:

  • can hold any asset (native token, e.g. ERC20 like tokens)
  • can execute any smart contract and deploy smart contracts
  • have upgradeable security (through owner change, e.g. to a gnosis safe)
  • are basic enough to work for for a long time
  • are extensible though additional standardisation of the key/value data.
  • can function as an owner/controller or proxy of other smart contracts

Specification

ERC725X

ERC165 identifier: 0x44c028fe

execute

Executes a call on any other smart contracts, transfers the blockchains native token, or deploys a new smart contract.
MUST only be called by the current owner of the contract.

function execute(uint256 operationType, address to, uint256 value, bytes data)

The operationType can execute the following operations:

  • 0 for call
  • 1 for delegatecall
  • 2 for create2
  • 3 for create

Others may be added in the future.

Triggers Event: ContractCreated if a contract was created

Events

ContractCreated

MUST be triggered when execute creates a new contract using the _operationType 1.

event ContractCreated(address indexed contractAddress)

ERC725Y

ERC165 identifier: 0x2bd57b73

getData

Returns the data at the specified key.

function getData(bytes32 key) external view returns(bytes value)

setData

Sets the data at a specific key. MUST only be called by the current owner of the contract.

Triggers Event: DataChanged

function setData(bytes32 _key, bytes memory _value) external

Events

DataChanged

MUST be triggered when setData was successfully called.

event DataChanged(bytes32 indexed key, bytes value)

Ownership

This contract is controlled by an owner. The owner can be a smart contract or an external account.
This standard requires ERC173 and should implement the functions:

  • owner() view
  • transferOwnership(address newOwner)
  • and the Event event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Data keys

Data keys, should be the keccak256 hash of a type name.
e.g. keccak256('ERCXXXMyNewKeyType') is 0x6935a24ea384927f250ee0b954ed498cd9203fc5d2bf95c735e52e6ca675e047

Multiple keys of the same type

If you require multiple keys of the same key type they MUST be defined as follows:

  • The keytype name MUST have a [] add and then hashed
  • The key hash MUST contain the number of all elements, and is required to be updated when a new key element is added.

For all other elements:

  • The first 16 bytes are the first 16 bytes of the key hash
  • The second 16 bytes is a uint128 of the number of the element
  • Elements start at number 0
Example

This would looks as follows for ERCXXXMyNewKeyType[] (keccak256: 0x4f876465dbe22c8495f4e4f823d846957ddb8ce6006afe66ddc5bac4f0626767):

  • element number: key: 0x4f876465dbe22c8495f4e4f823d846957ddb8ce6006afe66ddc5bac4f0626767, value: 0x0000000000000000000000000000000000000000000000000000000000000002 (2 elements)
  • element 1: key: 0x4f876465dbe22c8495f4e4f823d8469500000000000000000000000000000000, value: 0x123... (element 0)
  • element 2: key: 0x4f876465dbe22c8495f4e4f823d8469500000000000000000000000000000001, value: 0x321... (element 1)
    ...

Default key values

ERC725 key standards need to be defined within new standards, we suggest the following defaults:

Name Description Key value
SupportedStandards Allows to determine standards supported by this contract 0xeafec4d89fa9619884b6b89135626455000000000000000000000000xxxxxxxx, where xxxxxxxx is the 4 bytes identifier of the standard supported Value can be defined by the standard, by default it should be the 4 bytes identifier e.g. 0x7a30e6fc
SupportedStandards > ERC725Account Allows to determine standards supported by this contract 0xeafec4d89fa9619884b6b89135626455000000000000000000000000afdeb5d6, where afdeb5d6 is the 4 bytes part of the hash of keccak256('ERC725Account') Value is the 4 bytes identifier 0xafdeb5d6
ERC725Account

An ERC725Account is an ERC725 smart contract based account for storing of assets and execution of other smart contracts.

  • ERC173 to be controllable by an owner, that could be am external account, or smart contract
  • ERC725X to interact with other smart contracts
  • ERC725Y to attach data to the account for future extensibility
  • COULD have ERC1271 to be able to verify signatures from owners.
  • Should fire the event ValueReceived(address indexed sender, uint256 indexed value) if ETH is received.

A full implementation of an ERC725Account can be found found here.

Rationale

The purpose of an smart contract account is to allow an entity to exist as a first-class citizen with the ability to execute arbitrary contract calls.

Implementation

Solidity Interfaces

// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.5.0 <0.7.0;

//ERC165 identifier: `0x44c028fe`
interface IERC725X  /* is ERC165, ERC173 */ {
    event ContractCreated(address indexed contractAddress);
    event Executed(uint256 indexed operation, address indexed to, uint256 indexed  value, bytes data);

    function execute(uint256 operationType, address to, uint256 value, bytes memory data) external;
}

//ERC165 identifier: `0x2bd57b73`
interface IERC725Y /* is ERC165, ERC173 */ {
    event DataChanged(bytes32 indexed key, bytes value);

    function getData(bytes32 key) external view returns (bytes memory value);
    function setData(bytes32 key, bytes memory value) external;
}

interface IERC725 /* is IERC725X, IERC725Y */ {

}

interface IERC725Account /* is IERC725, IERC725Y, IERC1271 */ {
    event ValueReceived(address indexed sender, uint256 indexed value);
}

Flow chart

ERC725v2-flow

Additional References

Copyright

Copyright and related rights waived via CC0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions