ERC-4886 Proxy ownership registry (Proxy Ownership Register)
Stagnant · Accounts & wallets · created 2022-09-03
An on-chain registry that lets a nominator designate a proxy address, allowing cold wallet assets to be safely stored while still proving ownership, and letting newly received assets go directly to a specified delivery address.
Why it is needed
In situations that require proving asset ownership, such as Discord role verification, whitelist minting, or DAO voting, users must sign or interact with a contract directly using the wallet holding that asset. As a result, a wallet holding valuable assets cannot be fully isolated in cold storage, and every interaction exposes it to the risk of asset theft by a malicious contract. Users end up having to choose between security and convenience, worried that storing assets in a cold wallet means missing out on benefits, which lowers overall trust in the Ethereum ecosystem. In addition, newly issued assets are only delivered to the wallet used for the interaction, leaving no way to receive them directly into the wallet intended for storage.
What to implement
function nominationExists(address _nominator) external view returns (bool);: Returns whether a nomination exists for the specified nominator address.function nominationExistsForCaller() external view returns (bool);: Returns whether a nomination exists for msg.sender.function proxyRecordExists(address _proxy) external view returns (bool);: Returns whether a proxy record exists for the given proxy address.function proxyRecordExistsForCaller() external view returns (bool);: Returns whether a proxy record exists for msg.sender.function nominatorRecordExists(address _nominator) external view returns (bool);: Returns whether a proxy record exists for the given nominator address.function nominatorRecordExistsForCaller() external view returns (bool);: Returns whether a proxy record exists for msg.sender.function getProxyRecord(address _proxy) external view returns (address nominator, address proxy, address delivery);: Returns the nominator, proxy, and delivery address for the given proxy address.function getProxyRecordForCaller() external view returns (address nominator, address proxy, address delivery);: Returns the nominator, proxy, and delivery address using msg.sender as the proxy address.function getNominatorRecord(address _nominator) external view returns (address nominator, address proxy, address delivery);: Returns the nominator, proxy, and delivery addresses for the given nominator address.function getNominatorRecordForCaller() external view returns (address nominator, address proxy, address delivery);: Returns the nominator, proxy, and delivery addresses using msg.sender as the nominator address.function addressIsActive(address _receivedAddress) external view returns (bool);: Returns whether the given address is the nominator or proxy address of an active proxy record.function addressIsActiveForCaller() external view returns (bool);: Returns whether msg.sender is the nominator or proxy address of an active proxy record.function getNomination(address _nominator) external view returns (address proxy);: Takes a nominator address and returns the nominated proxy address.function getNominationForCaller() external view returns (address proxy);: Returns the proxy address of the nomination if msg.sender is the nominator.function getAddresses(address _receivedAddress) external view returns (address nominator, address delivery, bool isProxied);: Returns the nominator, delivery address, and proxy status (isProxied) for the given address.function getAddressesForCaller() external view returns (address nominator, address delivery, bool isProxied);: Returns the nominator, delivery address, and proxy status (isProxied) for msg.sender.function getRole(address _roleAddress) external view returns (string memory currentRole);: Returns the current role of the given address as a string (None, Nominator - Pending, Nominator - Active, Proxy - Active).function getRoleForCaller() external view returns (string memory currentRole);: Returns the current role of msg.sender as a string.function makeNomination(address _proxy, uint256 _provider) external payable;: msg.sender nominates the given address as a proxy.function acceptNomination(address _nominator, address _delivery, uint256 _provider) external;: msg.sender, acting as proxy, accepts the nominator's nomination and sets the delivery address.function updateDeliveryAddress(address _delivery, uint256 _provider) external;: If msg.sender is the proxy, changes the delivery address to a new value.function deleteRecordByNominator(uint256 _provider) external;: If msg.sender is the nominator, deletes the record and nomination.function deleteRecordByProxy(uint256 _provider) external;: If msg.sender is the proxy, deletes the record and nomination.
In depth
Nominations, proxy records, and the two-step structure
A proxy relationship is created in two steps. First, the nominator nominates an address to serve as proxy using makeNomination, which creates a Nomination that is still pending. Only when the nominated proxy address calls acceptNomination to accept and sets a delivery address does a Proxy Record get registered and activated in the registry. Both the nominator and the proxy can delete the record and nomination at any time, and unless deleted, the proxy relationship persists eternally.
The data structure stored by the registry
Nominations are stored as a mapping (address => address) from the nominator address to the proposed proxy address. Proxy records are stored as a mapping (address => struct) keyed by the proxy address, containing a struct with the nominator address and delivery address. In other words, the proxy address is the reference point for lookups, from which both the nominator and delivery address are obtained. The delivery address is first set by the proxy in acceptNomination, and can be changed at any time afterward via updateDeliveryAddress. Only the proxy has this authority to change it.
Rules against duplicate nominations and nominator reversion
An address that is already acting as a nominator or proxy in an active proxy relationship cannot be nominated again. If the registry receives a nominator address, it reverts. This is the more important rule. Because the proxy enjoys benefits on behalf of the nominator, if the nominator also simultaneously received the same benefits, the same holdings would be double counted across two addresses. Once the nominator deletes the record, they can interact directly again immediately, and the proxy immediately loses the related benefits.
Backward-compatible handling for addresses with no mapping
If the registry receives an address with no active mapping, it returns that same address as both the nominator and delivery address. In other words, a plain address that has not set up a proxy relationship is treated as acting on its own behalf, preserving existing behavior. Thanks to this, contracts or apps querying this registry can apply the same lookup logic to every address, with no effect on users who do not use a proxy.
View functions for lookups
The registry provides various lookup functions. nominationExists, proxyRecordExists, and nominatorRecordExists each check for the existence of a nomination or record, while getProxyRecord and getNominatorRecord together return the nominator, proxy, and delivery addresses. getAddresses returns the nominator and delivery address along with whether the given address is a proxy (isProxied), and getRole reports the current status of an address as a string. Most functions also come with a ForCaller version based on msg.sender, so a contract can call them with no arguments when looking itself up.
State-changing functions and the provider parameter
makeNomination, acceptNomination, updateDeliveryAddress, deleteRecordByNominator, and deleteRecordByProxy are all state-changing functions that all require a uint256 parameter called _provider. If there is no separate Provider ID, you can pass 0 to use the default EPS provider. acceptNomination takes both the nominator and delivery address together, and acceptance only succeeds if the nominator passed in matches the nominator actually recorded in the nomination. Record deletion is split into deleteRecordByNominator, called from the nominator side, and deleteRecordByProxy, called from the proxy side; if a record exists, both the record and nomination are deleted together, and if no record exists, only the nomination is deleted.
The four states distinguished by getRole
getRole and getRoleForCaller return the current status of an address as a string. None means the address appears in neither a nomination nor a record at all, Nominator - Pending means it has nominated as a nominator but the proxy has not yet accepted, Nominator - Active means the nomination has been accepted and it has become the nominator of an active proxy record, and Proxy - Active means it has become the proxy of an active proxy record. These four states let the calling side clearly distinguish the current stage of the relationship.
Proposal status
This proposal is in Stagnant status, meaning discussion is no longer progressing and has stalled. The body lists contract addresses deployed on mainnet, Ropsten, and Rinkeby as test cases. However, since the standard itself is a stalled proposal, it should be noted that it could be resumed or revised.
Things to watch out for
- Risk of delivery address misentry: If the proxy specifies the wrong delivery address, new assets could be sent to an unintended address. The source text states that this responsibility is at the same level as the risk of entering the wrong address in an ordinary transaction.
- Preventing unauthorized proxies through two-sided signature confirmation: Since a proxy record is only activated when both the nominator's nomination and the proxy's acceptance are present, both addresses must agree via signature for the relationship to be established.