A set of lightweight ERC-4337 compatible smart contract accounts with designated ownership. Account Kit is the easiest way to integrate Light Account.
Like eth-infinitism's SimpleAccount, but with the following changes:
-
Instead of the default storage slots, uses namespaced storage to avoid clashes when switching implementations.
-
Ownership can be transferred via
transferOwnership, similar to the behavior of anOwnablecontract. This is a simple single-step operation, so care must be taken to ensure that the ownership is being transferred to the correct address. -
Supports ERC-1271 signature validation for both validating the signature on user operations and in exposing its own
isValidSignaturemethod. This only works when the owner ofLightAccountalso support ERC-1271.ERC-4337's bundler validation rules limit the types of contracts that can be used as owners to validate user operation signatures. For example, the contract's
isValidSignaturefunction may not use any forbidden opcodes such asTIMESTAMPorNUMBER, and the contract may not be an ERC-1967 proxy as it accesses a constant implementation slot not associated with the account, violating storage access rules. This also means that the owner of aLightAccountmay not be anotherLightAccountif you want to send user operations through a bundler. -
Improves gas estimation by enabling switching between
ecrecoverand ERC-1271 signature validation by prepending aSignatureTypebyte to the user operation signature. AllowedSignatureTypevalues:SignatureType.EOA: For an EOA owner. Signature is validated usingecrecover.SignatureType.CONTRACT: For a contract owner. Signature is validated usingowner.isValidSignature.
-
The factory uses Solady's
LibClone.createDeterministicERC1967instead of OpenZeppelin'sERC1967Proxy. -
The factory includes ownership and entry point staking capabilities to address mempool limitations for unstaked entities as defined in ERC-7562.
-
Event
SimpleAccountInitializedrenamed toLightAccountInitialized. -
Uses custom errors.
Like LightAccount, but with the following changes:
-
Multiple owners are supported. They can be specified at account deployment, or updated via
updateOwners. This is a simple single-step operation, so care must be taken to ensure that the ownership is being updated to the correct address(es). -
Allowed
SignatureTypevalues:SignatureType.EOA: For EOA owners. Signature is validated usingecrecover.SignatureType.CONTRACT_WITH_ADDR: For contract owners. Signature is validated usingowner.isValidSignature. The contract owner address MUST be passed as part of the signature, following the format:SignatureType.CONTRACT_WITH_ADDR || contractOwnerAddress || signature, where||is the byte concatenation operator.
See the current deployments by network under the deployments folder.
forge buildforge test -vvvThe deploy script supports any wallet options provided by Foundry, including local private keys, mneumonics, hardware wallets, and remote signers. Append the chosen signing method's option to the field marked [WALLET_OPTION] in the following script command, and set the sender address in the field [SENDER_ADDRESS].
forge script script/Deploy_LightAccountFactory.s.sol [WALLET_OPTION] --sender [SENDER_ADDRESS] --rpc-url [RPC_URL] -vvvv --broadcast --verify
forge script script/Deploy_MultiOwnerLightAccountFactory.s.sol [WALLET_OPTION] --sender [SENDER_ADDRESS] --rpc-url [RPC_URL] -vvvv --broadcast --verifyMake sure the provided RPC_URL is set to an RPC for the chain you wish to deploy on.
bash utils/inspect.shslither .Light Account uses dependencies via git submodules, pinned to release branches. Dependencies that cannot be reliably pinned (or those that needed to be modified) have been copied directly into the repository. These are listed below:
| File | Description | Source |
|---|---|---|
| CustomSlotInitializable.sol | A fork of OpenZeppelin's Initializable contract that allows custom storage slots to be used. |
Initializable.sol (932fddf) |
| EIP712.sol | Copied from Solady. | EIP712.sol (eac17da) |
| LibClone.sol | Copied from Solady. | LibClone.sol (7a1f591) |
| UUPSUpgradeable.sol | Copied from Solady. | UUPSUpgradeable.sol (a061f38) |
