From b13efec0e0b61c0ff277916e6d6077a6047e6eda Mon Sep 17 00:00:00 2001 From: Jorge Izquierdo Date: Wed, 21 Feb 2018 12:30:16 -0700 Subject: [PATCH 1/4] Add ERCProxy draft --- EIPS/eip-draft-erc-proxy.md | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 EIPS/eip-draft-erc-proxy.md diff --git a/EIPS/eip-draft-erc-proxy.md b/EIPS/eip-draft-erc-proxy.md new file mode 100644 index 00000000000000..6d10aaec9704ef --- /dev/null +++ b/EIPS/eip-draft-erc-proxy.md @@ -0,0 +1,70 @@ +## Preamble + + EIP: + Title: ERC Proxy + Author: Manuel Araoz (Zeppelin), Jorge Izquierdo (Aragon) + Type: Standard Track + Category: ERC + Status: Draft + Created: 2018-02-21 + + +## Simple Summary +Proxy contracts are being increasingly used as both as an upgradeability mechanism +and a way to save gas when deploying many instances of a particular contract. This +standard proposes a set of interfaces for proxies to signal how they work and what +their main implementation is. + +## Abstract +Using proxies that delegate their own logic to another contract is becoming an +increasingly popular technique for both smart contract upgradeability and creating +cheap clone contracts. + +We don't believe there is value in standardizing any particular implementation +of a DelegateProxy, given its simplicity, but we believe there is a lot of value +in agreeing on an interface all proxies use that allows for a standard way to +operate with proxies. + +An example implementation of a DelegateProxy can be found in aragonOS or zeppelinOS +[//TODO links]. + +## Standardized interface + +```solidity +interface ERCProxy { + function proxyType() public pure returns (uint256 proxyTypeId); + function implementation() public view returns (address codeAddr); +} +``` + +### Code address (`implementation()`) +The returned code address is the address the proxy would delegate calls to at that +moment in time, for that message. + +### Proxy Type (`proxyType()`) + +Checking the proxy type is the way to check whether a contract is a proxy at all. +When a contract fails to return to this method or it returns 0, it can be assumed +that the contract is not a proxy. + +It also allows for communicating a bit more of information about how the proxy +operates. It is a pure function, therefore making it effectively constant as +it cannot return a different value depending on state changes. + +- **Forwarding proxy** (`id = 1`): The proxy will always forward to the same code +address. The following invariant should always be true: once the proxy returns +a non-zero code address, that code address should never change. + +- **Upgradeable proxy** (`id = 2`): The proxy code address can be changed depending +on some arbitrary logic implemented either at the proxy level or in its forwarded +logic. + +## Benefits + +- **Source code verification**: right now when checking the code of a proxy in explorers +like Etherscan, it just shows the code in the proxy itself but not the actual +code of the contract. By standardizing this construct, they will be able to show +both the actual ABI and code for the contract. + +## Copyright +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From 356a76a9b2b329eaf6888d966c6998dbf166c875 Mon Sep 17 00:00:00 2001 From: Jorge Izquierdo Date: Wed, 21 Feb 2018 17:57:56 -0700 Subject: [PATCH 2/4] Add missing links --- EIPS/eip-draft-erc-proxy.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EIPS/eip-draft-erc-proxy.md b/EIPS/eip-draft-erc-proxy.md index 6d10aaec9704ef..e2b16a193898ed 100644 --- a/EIPS/eip-draft-erc-proxy.md +++ b/EIPS/eip-draft-erc-proxy.md @@ -25,8 +25,7 @@ of a DelegateProxy, given its simplicity, but we believe there is a lot of value in agreeing on an interface all proxies use that allows for a standard way to operate with proxies. -An example implementation of a DelegateProxy can be found in aragonOS or zeppelinOS -[//TODO links]. +An example implementation of a DelegateProxy can be found in [aragonOS](https://github.com/aragon/aragonOS/blob/dev/contracts/common/DelegateProxy.sol) or [zeppelinOS](https://github.com/zeppelinos/labs/blob/master/upgradeability_with_vtable/contracts/Proxy.sol). ## Standardized interface From 621b2f9f681974e27784a3f6dade10758b106de2 Mon Sep 17 00:00:00 2001 From: Jorge Izquierdo Date: Sun, 15 Apr 2018 10:14:53 +0200 Subject: [PATCH 3/4] Re-format EIP897 --- EIPS/{eip-draft-erc-proxy.md => eip-897.md} | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename EIPS/{eip-draft-erc-proxy.md => eip-897.md} (91%) diff --git a/EIPS/eip-draft-erc-proxy.md b/EIPS/eip-897.md similarity index 91% rename from EIPS/eip-draft-erc-proxy.md rename to EIPS/eip-897.md index e2b16a193898ed..d253e497a64b5a 100644 --- a/EIPS/eip-draft-erc-proxy.md +++ b/EIPS/eip-897.md @@ -1,13 +1,13 @@ -## Preamble - - EIP: - Title: ERC Proxy - Author: Manuel Araoz (Zeppelin), Jorge Izquierdo (Aragon) - Type: Standard Track - Category: ERC - Status: Draft - Created: 2018-02-21 - +--- +eip: 897 +title: ERC DelegateProxy +author: Jorge Izquierdo , Manuel Araoz +type: Standards Track +category: ERC +status: Draft +created: 2018-02-21 +discussions-to: https://github.com/ethereum/EIPs/pulls/897 +--- ## Simple Summary Proxy contracts are being increasingly used as both as an upgradeability mechanism From b2d5bd97a3da3a70bb5b55a56f26141c065d6d1e Mon Sep 17 00:00:00 2001 From: Jorge Izquierdo Date: Sun, 15 Apr 2018 10:20:09 +0200 Subject: [PATCH 4/4] ERC897: add reference to implementations --- EIPS/eip-897.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-897.md b/EIPS/eip-897.md index d253e497a64b5a..163732702ab228 100644 --- a/EIPS/eip-897.md +++ b/EIPS/eip-897.md @@ -25,7 +25,11 @@ of a DelegateProxy, given its simplicity, but we believe there is a lot of value in agreeing on an interface all proxies use that allows for a standard way to operate with proxies. -An example implementation of a DelegateProxy can be found in [aragonOS](https://github.com/aragon/aragonOS/blob/dev/contracts/common/DelegateProxy.sol) or [zeppelinOS](https://github.com/zeppelinos/labs/blob/master/upgradeability_with_vtable/contracts/Proxy.sol). +## Implementations + +- **aragonOS**: [AppProxyUpgradeable](https://github.com/aragon/aragonOS/blob/dev/contracts/apps/AppProxyUpgradeable.sol), [AppProxyPinned](https://github.com/aragon/aragonOS/blob/dev/contracts/apps/AppProxyPinned.sol) and [KernelProxy](https://github.com/aragon/aragonOS/blob/dev/contracts/kernel/KernelProxy.sol) + +- **zeppelinOS**: [Proxy](https://github.com/zeppelinos/labs/blob/2da9e859db81a61f2449d188e7193788ca721c65/upgradeability_ownership/contracts/Proxy.sol) ## Standardized interface