ERC-7988 Minimal Avatar Smart Wallet (MASW)

Draft · Accounts & wallets · created 2025-07-08

An immutable-code delegate wallet that an EOA can designate via EIP-7702, providing signed batch calls and gas sponsorship through a single fixed ABI, reducing wallet-specific interface fragmentation.

Why it is needed

EIP-7702 lets an EOA delegate execution to arbitrary contract code on a per-transaction basis, but things get complicated when each wallet uses a different ABI and fee settlement scheme. dApps and relayers must build separate adapters for each wallet, and gas sponsorship becomes harder to scale because relayers cannot reliably expect predictable rewards when fee payment paths differ by wallet. Indexers, debuggers, and static analysis tools must also separately interpret each wallet's distinct bytecode and call structure, lowering the accuracy of decoding and gas estimation. Without a standard for how far customization can go, the scope of security verification also varies by wallet, fragmenting research and hardening efforts.

What to implement

In depth

executeBatch validation steps

The targets, values, and calldatas arrays must all be the same length and greater than 0, and block.timestamp must be at or before expiry. The stored metaNonce must match the value used in the signature, and it is incremented only after the match is confirmed. The EIP-712 digest must be recovered and must match the owner, or if a recoveryModule is set, approval from that module is required for validity.

Policy module hooks

If policyModule is not zero, preCheck is called before the list of calls executes and postCheck is called after. Both functions receive the sender, rawData, and the total ETH value transferred, and must return true to pass; a revert or a false return rejects the entire batch. An aggregator structure that chains multiple sub-policies and stops at the first failure point is also permitted.

Recovery module

If a recoveryModule is set, isValidSignature(hash, sig) performs signature verification in its place, and it must return 0x1626ba7e for a valid signature. This allows alternative authentication methods to be plugged in besides signing with the owner's private key.

Gas sponsorship and fee structure

The relayer and owner agree on (token, fee) off-chain in advance, and this value is included in the signed batch data, so the relayer cannot arbitrarily raise the fee. If another relayer broadcasts the same signed batch first, that relayer takes the fee and the original transaction is necessarily reverted, which naturally aligns competition among relayers. Relayers must check the avatar's balance in advance before submitting, and if funds are insufficient the transaction is invalidated in the mempool.

Domain separator construction

DOMAIN_SEPARATOR is constructed by encoding the EIP712Domain type hash with the name "MASW", version "1", the actual chain ID (block.chainid, using 0 is forbidden), and _owner. The owner is placed in the verifyingContract slot, designed so the separator stays the same before and after delegation.

Storage slot layout

Slot 0 is the monotonically increasing metaNonce, slot 1 is the reentrancy guard flag _entered, slot 2 is the Policy module address, and slot 3 is the Recovery module address. owner and DOMAIN_SEPARATOR are declared immutable and do not occupy separate storage slots.

Nonce-Race

MASW uses a single global metaNonce rather than a per-batch one. If two relayers submit simultaneously with the same nonce, one succeeds and the other is reverted. It is recommended to set expiry short, typically 30 seconds or less, to reduce the impact of the race, and the wallet UI should surface such failures to the user.

Proposal status

This ERC is currently in Draft status, not yet finalized, and its detailed provisions or ABI composition may change or discussion may stall going forward.

Things to watch out for

Original ERC · ← ERCs