ERC-927 General-purpose permission delegation interface (Generalised authorisations)
Stagnant · Signatures & auth · created 2018-03-12
Unifies the 'delegated authority' patterns that used to be built separately per contract, such as a token's approve or ERC777's operator, into a single common canCall function, so that any contract can grant and check third-party permissions the same way.
Why it is needed
Smart contracts often need to let a third party perform specific actions on a user's behalf. The most common examples are a token's approve or operator, but similar situations exist throughout the ecosystem, such as delegating ENS domain operations. Yet every standard designs this delegation feature from scratch. The result is a proliferation of mutually incompatible implementations of the same underlying pattern: checking delegated authority. For wallets or apps to build a permission management screen, they must separately support different functions and semantics for each contract, and developers must reimplement new authorization logic from scratch for every standard.
What to implement
function canCall(address owner, address caller, address callee, bytes4 func) view returns(bool);: Checks whether caller has authority, on behalf of owner, to call the func function of the callee contract.function authoriseCaller(address owner, address caller, address callee, bytes4 func);: Grants caller authority, on behalf of owner, to call callee's func function.function revokeCaller(address owner, address caller, address callee, bytes4 func);: Revokes a previously granted authorization for caller to call callee's func.
In depth
The parameter structure of canCall
canCall(address owner, address caller, address callee, bytes4 func) takes four values. owner is the resource owner; if authorization is granted, this function call is treated as if owner performed it directly. caller is the address actually making the call right now, callee is the target contract being called, and func is the 4-byte signature of the function being called. As an example from the original text, if Alice has authorized Bob to transfer tokens on her behalf, then when Bob executes the transfer, owner is Alice, caller is Bob, callee is the token contract, and func is the signature of the transfer function.
Operates on top of the EIP 926 metadata provider structure
This standard is implemented via the metadata provider mechanism defined in EIP 926. The callee contract first retrieves the provider for the owner address from the metadata registry contract at a well-known address, then calls canCall() on that provider with the parameters described above. If canCall returns false, callee reverts execution. In other words, the authorization decision logic itself is delegated to the provider contract designated by owner.
Standardizing authorization grant and revocation via authoriseCaller / revokeCaller
The provider SHOULD provide a standard interface that lets users set and revoke authorization themselves. authoriseCaller(owner, caller, callee, func) and revokeCaller(owner, caller, callee, func) are that interface, with argument meanings identical to canCall. The implementing contract MUST check whether msg.sender has authority to call these functions on behalf of owner, and the case owner == msg.sender must always be permitted. It is also recommended to use this standard itself (canCall) when deciding whether another caller may set authorization on someone else's behalf.
Handling blanket authorisation when func is 0
The implementing contract SHOULD treat a func value of 0 as blanket authorization for all of callee's functions. Conversely, when revoking authorization by setting authorised to false and func to 0, only the blanket authorization needs to be cleared, and authorizations granted separately for individual functions may remain intact. In other words, 'revoke all' and 'revoke individual' are managed independently of each other.
Design background: the influence of ds-auth and OAuth
The original text states that this pattern was inspired by ds-auth and OAuth. The Motivation section points out that situations requiring third-party delegated calls, such as ERC20 approval, ERC777 operators, and delegation of ENS domain operations, are scattered throughout the ecosystem, and that each standard reinvents this independently, producing many mutually incompatible implementations. This EIP proposes a general-purpose authorization check method that all contracts can use in common, in order to reduce this duplication.
Compatibility and implementation status
The original text states that, since this standard adds a new authorization-checking mechanism, there is no backward compatibility issue with existing systems. However, the Implementation section is left as 'TBD' in the original text, so no example implementation has been presented yet. This proposal's status is Stagnant, meaning it is no longer actively progressing and has stalled.