A simple ERC-4337 compatible smart contract account with a designated owner account. 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 anOwnable
contract. 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
isValidSignature
method. This only works when the owner ofLightAccount
also 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
isValidSignature
function may not use any forbidden opcodes such asTIMESTAMP
orNUMBER
, 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 aLightAccount
may not be anotherLightAccount
if you want to send user operations through a bundler. -
Event
SimpleAccountInitialized
renamed toLightAccountInitialized
. -
Uses custom errors.
See the current deployments in Deployments.md.
forge build
forge test -vvv
The 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:Deploy_LightAccountFactory [WALLET_OPTION] --sender [SENDER_ADDRESS]--rpc-url [RPC_URL] -vvvv --broadcast --verify
Make sure the provided RPC_URL
is set to an RPC for the chain you wish to deploy on.
bash utils/inspect.sh
slither .