⚠️ These contracts are unaudited prototypes and may contain serious vulnerabilities. DO NOT USE IN PRODUCTION.
A secure ERC-1967 proxy implementation for EIP-7702 smart accounts.
The EIP-7702 Proxy provides a secure way to upgrade EOAs to smart contract wallets through EIP-7702 delegation. It solves critical security challenges in the EIP-7702 design space while allowing the use of existing smart account implementations.
- Signature-based authorization from the EOA for initial implementation setting and initialization
- Atomic implementation setting + initialization to prevent front-running
- Account state validation through implementation-specific configurable validator
- Reliable protection against signature replay through external nonce tracking
- ERC-1967 compliant implementation storage
- Ability to set the ERC-1967 storage slot via the proxy itself
- Built-in token receiver for uninitialized state
- Safe handling of A → B → A delegation patterns
- Implementation-agnostic design
- Compatible with any ERC-1967 implementation
- Manages safe implementation upgrades through
setImplementation
- Validates EOA signatures for all state changes
- Provides fallback to
DefaultReceiver
when uninitialized - Overrides
isValidSignature
to provide a final fallbackecrecover
check
- External nonce management for signature validation in storage-safe location
- Prevents signature replay attacks
- Maintains nonce integrity across delegations
- Interface for implementation-specific state validation
- Called to ensure correct initialization or other account state
- Reverts invalid state transitions
- Inherits from Solady's
Receiver
- Provides a default implementation for token compatibility
-
Deploy singleton instance of
EIP7702Proxy
with immutable parameters:NonceTracker
for signature securityDefaultReceiver
for token compatibility
-
Sign an EIP-7702 authorization with the EOA to delegate to the
EIP7702Proxy
-
Sign a payload for
setImplementation
with the EOA, which includes the new implementation address, initialization calldata, and the address of an account state validator -
Submit transaction with EIP-7702 authorization and call to
setImplementation(bytes args, bytes signature)
with:address newImplementation
: address of the new implementationbytes calldata callData
: initialization calldataaddress validator
: address of the account state validatorbytes calldata signature
: ECDSA signature over the initialization hash from the EOAbool allowCrossChainReplay
: whether to allow cross-chain replay
Now the EOA has been upgraded to the smart account implementation and had its state initialized.
If the smart account implementation supports UUPS upgradeability, it will work as designed by submitting upgrade calls to the account.