EIP.tools

EIP.tools

⚠️ DraftStandards Track: ERC

ERC-7855: Fungible Token with gas rebates

Built-in gas rebates, secure signature validation, and optimized transfer mechanisms.

Authors
Created2025-01-01
Discussion Linkhttps://ethereum-magicians.org/t/erc-7849-fungible-token-with-gas-rebates/22356

Markdown

https://raw.githubusercontent.com/ethereum/ERCs/bb...
Pull Request#822PR closed (unmerged)

EIP-GPT summary

Contents
AbstractMotivationSpecificationCore VariablesFeaturesFunctionsView FunctionsState-Changing FunctionsEventsGas Rebate SystemError HandlingRationaleBackwards CompatibilitySecurity ConsiderationsCopyright

Abstract

This proposal introduces a new fungible token standard focused on security, efficiency, and interoperability. It extends traditional ERC-20 functionality with built-in gas rebates, secure signature validation using EIP-712, and optimized transfer mechanisms. The standard includes protections against common attack vectors while maintaining full compatibility with existing token interfaces.

Motivation

Current fungible token standards lack built-in security features and gas optimization mechanisms. This proposal addresses these limitations by incorporating:

  • Native gas rebate system to reduce transaction costs
  • EIP-712 compliant signatures for gasless approvals
  • Strong security measures against common vulnerabilities
  • Efficient state management and error handling

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.

Core Variables

  • name: Token name
  • symbol: Token symbol
  • decimals: Number of decimal places
  • totalSupply: Total token supply
  • _balances: Mapping of address to token balance
  • _allowances: Mapping of owner address to spender address to allowed amount

Features

  • Gas rebate system
  • EIP-712 signature validation
  • Nonce tracking for replay protection

Functions

View Functions

name()

  • Returns the token name
  • Type: string

symbol()

  • Returns the token symbol
  • Type: string

decimals()

  • Returns number of decimals
  • Type: uint8

totalSupply()

  • Returns total token supply
  • Type: uint256

balanceOf(address account)

  • Returns token balance of specified account
  • Type: uint256

allowance(address owner, address spender)

  • Returns remaining allowance for spender
  • Type: uint256

State-Changing Functions

transfer(address to, uint256 amount)

  • Transfers tokens to specified address
  • Includes gas rebate processing
  • Returns: bool

approve(address spender, uint256 amount)

  • Approves spender to spend tokens
  • Returns: bool

transferFrom(address from, address to, uint256 amount)

  • Transfers tokens between addresses
  • Requires sufficient allowance
  • Returns: bool

permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)

  • Processes gasless approvals using EIP-712 signatures
  • Validates signature and deadline
  • No return value

Events

Transfer

  • Emitted on token transfers
event Transfer(address indexed from, address indexed to, uint256 value)

Approval

  • Emitted on approval updates
event Approval(address indexed owner, address indexed spender, uint256 value)

GasRebate

  • Emitted when gas rebate is processed
event GasRebate(address indexed user, uint256 amount)

Gas Rebate System

  • Limited to first 10,000 transactions
  • Rebate amount = 25% of base transaction cost
  • One-time rebate per user
  • Requires contract to hold ETH for rebates

Error Handling

Custom errors for common failure cases:

  • InsufficientBalance
  • InsufficientAllowance
  • InvalidSignature
  • ExpiredDeadline
  • MaxRebatesReached
  • TransferToZeroAddress
  • ApproveToZeroAddress

Rationale

The design choices in this proposal prioritize:

  1. Security through custom error handling and signature validation
  2. Gas efficiency via rebate mechanisms
  3. Interoperability through standard EIP-712 implementation
  4. User experience through gasless approvals

Backwards Compatibility

This proposal maintains full backwards compatibility with ERC-20 while adding enhanced functionality.

Security Considerations

  • Implements nonce tracking for signature validation
  • Uses custom errors for efficient error handling
  • Includes checks against zero-address transfers
  • Limits gas rebates to prevent abuse
  • Validates EIP-712 signatures for permit operations

Copyright and related rights waived via CC0.

EIP.tools

EIP.tools

Search, read, and map Ethereum improvement proposals, ERCs, RIPs, and CAIPs from one focused interface.

Farcaster
by @apoorveth