Alert Source Discuss
⚠️ Draft Standards Track: ERC

ERC-7196: Simple token, Simplified ERC-20

Designed for smart contract wallets, this removes the transferFrom, approve, and allowance functions from ERC-20 tokens.

Authors Xiang (@wenzhenxiang), Ben77 (@ben2077), Mingshi S. (@newnewsms)
Created 2023-06-21
Discussion Link https://ethereum-magicians.org/t/simple-token-designed-for-smart-contract-wallet-aa/14757
Requires EIP-20

Abstract

This ERC is a new asset designed based on the user contract wallet (including account abstraction), and is forward compatible with ERC-20. To keep token assets simple, this ERC removes the transferFrom, approve and allowance functions of ERC-20.

Motivation

ERC-20 defines Ethereum-based standard tokens that can be traded and transferred, but the essence of ERC-20 is based on the externally-owned account (EOA) wallet design. An EOA wallet has no state and code storage, and the smart contract wallet is different.

Almost all ERCs related to tokens add functions, but our opinion is the opposite. We think the token contract should be simpler, with more functions taken care of by the smart contract wallet.

Our proposal is to design a simpler token asset based on the smart contract wallet.

It aims to achieve the following goals:

  1. Keep the asset contract simple: only responsible for the transfer functions.
  2. approve and allowance functions are not managed by the token contract, Instead, these permissions are managed at the user level, offering greater flexibility and control to users. This change not only enhances user autonomy but also mitigates certain risks associated with the ERC-20 contract’s implementation of these functions.
  3. Remove the transferFrom function. A better way to call the other party’s token assets is to access the other party’s own contract instead of directly accessing the token asset contract.
  4. Forward compatibility with ERC-20 means that all fungible tokens can be compatible with this proposal.

Specification

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.

Compliant contracts MUST implement the following interface:

pragma solidity ^0.8.20;

/**
 * @title ERC7196 Simple token interface 
 * @dev See https://ercs.ethereum.org/ERCS/erc-7196
 */
interface IERC7196 {
    /**
     * @notice Used to notify transfer tokens.
     * @param from Address of the from
     * @param to Address of the receive
     * @param value The transaction amount 
     */
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 value
    );
	
    /**
     * @notice Get the total supply
     * @return total The total supply amount
     */
    function totalSupply() 
        external  
        view
        returns (uint256 total);
	  
    /**
     * @notice get the balance of owenr address
     * @param owner Address of the owner
     * @return balance The balance of the owenr address
     */
    function balanceOf(address owner) 
        external
        view
        returns (uint256 balance);

    /**
     * @notice Transfer token
     * @param to Address of the to
     * @param value The transaction amount 
     * @return success The bool value returns whether the transfer is successful
     */
    function transfer(address to, uint256 value)
        external
        returns (bool success);

}

Rationale

The proposal is to simplify token standards by removing transferFrom, approve and allowance functions. This simplification aims to enhance security, reduce complexity, and improve efficiency, making the standard more suitable for smart contract wallet environments while maintaining essential functionalities.

Backwards Compatibility

As mentioned in the beginning, this ERC is forward compatible with ERC-20, ERC-20 is backward compatible with this ERC.

Reference Implementation

forward compatible with ERC-20

pragma solidity ^0.8.20;

import "./IERC7196.sol";
import "../../math/SafeMath.sol";

/**
 * @title Standard ERC7196 token
 * @dev Note: the ERC-165 identifier for this interface is 0xc1b31357
 * @dev Implementation of the basic standard token.
 */
contract ERC7196 is IERC7196 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

    uint256 private _totalSupply;

    function totalSupply() external view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address owner) external view returns (uint256) {
        return _balances[owner];
    }

    function transfer(address to, uint256 value) external returns (bool) {
        require(value <= _balances[msg.sender]);
        require(to != address(0));

        _balances[msg.sender] = _balances[msg.sender].sub(value);
        _balances[to] = _balances[to].add(value);
        emit Transfer(msg.sender, to, value);
        return true;
    }

}

Security Considerations

It should be noted that this ERC is not backward compatible with ERC-20, so there will be incompatibility with existing dapps.

Copyright and related rights waived via CC0.

Citation

Please cite this document as:

Xiang (@wenzhenxiang), Ben77 (@ben2077), Mingshi S. (@newnewsms), "ERC-7196: Simple token, Simplified ERC-20 [DRAFT]," Ethereum Improvement Proposals, no. 7196, June 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7196.