| eip | title | description | author | discussions-to | status | type | category | created |
|---|---|---|---|---|---|---|---|---|
7849 |
Fungible Token with gas rebates |
Built-in gas rebates, secure signature validation, and optimized transfer mechanisms. |
Amitesh Gautam (@blockchainDevAmitesh) <blockchaindev.amitesh@gmail.com> |
Draft |
Standards Track |
EIP |
2025-01-06 |
EIP-7849 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.
Current fungible token standards lack built-in security features and gas optimization mechanisms. EIP-7849 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
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.
npm installnpm run compilenpx hardhat testor
npm run testsnpm run nodename: Token namesymbol: Token symboldecimals: Number of decimal placestotalSupply: Total token supply_balances: Mapping of address to token balance_allowances: Mapping of owner address to spender address to allowed amount
- Gas rebate system
- EIP-712 signature validation
- Nonce tracking for replay protection
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
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
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)- 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
Custom errors for common failure cases:
InsufficientBalanceInsufficientAllowanceInvalidSignatureExpiredDeadlineMaxRebatesReachedTransferToZeroAddressApproveToZeroAddress
The design choices in EIP-7849 prioritize:
- Security through custom error handling and signature validation
- Gas efficiency via rebate mechanisms
- Interoperability through standard EIP-712 implementation
- User experience through gasless approvals
EIP-7849 maintains full backwards compatibility with ERC-20 while adding enhanced functionality.
- 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 MIT.