ERC-7196 Simple token (simplified ERC-20) (Simple token, Simplified ERC-20)
Draft · Tokens · created 2023-06-21
A simple token standard that removes transferFrom, approve, and allowance from ERC-20. The token contract handles only transfers, while permission management such as approvals is handled by the smart contract wallet.
Why it is needed
ERC-20 is a token standard designed on the premise of externally owned account (EOA) wallets. Because an EOA wallet cannot store state or code, letting another contract spend your tokens requires relying on the approve and allowance functions built into the token contract. This makes the token contract more complex and brings along the risks that stem from how these functions are implemented. Most token-related proposals move in the direction of adding more functionality to tokens, but this proposal takes the opposite direction. It makes the token contract as simple as possible, responsible only for transfers, and lets a smart contract wallet (including account abstraction) with code and state handle additional functionality such as permission management at the user level.
What to implement
function totalSupply() external view returns (uint256 total): Queries the total supply of the token.function balanceOf(address owner) external view returns (uint256 balance): Queries the token balance held by the owner address.function transfer(address to, uint256 value) external returns (bool success): Sends value tokens to address to and returns a boolean indicating success.
In depth
Only four required interfaces
A compliant contract MUST implement the IERC7196 interface. It consists of only four parts: the Transfer event, totalSupply, balanceOf, and transfer. ERC-20's transferFrom, approve, and allowance are not included. Key terms such as MUST are to be interpreted according to RFC 2119 and RFC 8174.
Removing approve and allowance from the token
The approval and allowance functions are not managed by the token contract. Instead, these permissions are managed at the user level, i.e., in the smart contract wallet. The original text explains that this change not only increases the user's autonomy and control but also reduces specific risks tied to how ERC-20 contracts implement these functions. The token asset contract itself remains simple, responsible only for the transfer function.
Calling the counterparty's contract instead of transferFrom
The transferFrom function is also removed. The original text presents, as a better way to call another party's token assets, accessing the counterparty's own contract instead of directly accessing the token asset contract. This changes the ERC-20 approach, in which a third party pulls tokens based on an allowance recorded in the token contract, into an approach where the asset movement passes through the owner's wallet contract.
Compatibility with ERC-20 is one-directional
This ERC is forward compatible with ERC-20. That is, because ERC-20 is backward compatible with this ERC, every fungible token can be made compatible with this proposal. Conversely, this ERC is not backward compatible with ERC-20. A token that implements only this ERC lacks some functions required by ERC-20, so it is not compatible with existing dapps built on the assumption of ERC-20.
Behavior of the reference implementation
The reference implementation keeps only an address-to-balance mapping (_balances) and total supply (_totalSupply) as state. transfer uses require to check that the amount sent is no more than the caller's balance (value <= _balances[msg.sender]) and that the recipient address is not the zero address (to != address(0)), then subtracts and adds balances using SafeMath, emits a Transfer event, and returns true. The ERC-165 identifier for this interface is 0xc1b31357.
Still at the Draft stage
The status of this proposal is Draft. It should be kept in mind that this is a draft-stage proposal whose content may change or whose progress may stall going forward.
Things to watch out for
- Not compatible with existing ERC-20 dapps: This ERC is not backward compatible with ERC-20, which creates incompatibility issues with existing dapps.