This repository contains the tools and resources for working with ERC-4337 Account Abstraction smart contracts. This includes the code for the singleton Executor
contract.
This singleton Executor contract also supports paying gas fee in ERC20 - Wrapped ether. This needs to be deployed only with the address of wrapped native token. This doesn't support other erc20 tokens.
And this Executor contract supports Users to use any nonce in any order and enables full flexibility and potentially parallel execution. Users can use arbitrary nonces, no need to be sequential. User can use getLeastUnusedNonce() to get the lowest unused nonce.
Account abstraction allows users to interact with Ethereum using smart contract wallets instead of EOAs, without compromising decentralization, providing benefits like:
- Social recovery
- Batched transactions
- Sponsored transactions (gas abstraction)
- Signature abstraction
- Advanced authorization logic
- EntryPoint Contract (
src/Executor.sol
): The central contract that processes UserOperations - SmartAccount (
src/SmartAccount.sol
): Base implementation for smart contract accounts - BasePaymaster (
src/BasePaymaster.sol
): Helper class for creating a paymaster - NonceManager (
src/NonceManager.sol
): Handles nonce management for accounts - Helpers (
src/Helpers.sol
): Common constants and helper functions
git clone https://github.com/vishwa7dcap786/account-abstraction.git
cd account-abstraction
curl -L https://foundry.paradigm.xyz | bash
forge init
forge compile
forge test
run a local blockchain
anvil
new terminal
steps:
1.deploy().
2.update the contract address state variables with deployed contract address
3.transferAmount(0 0r 1) - mode 0 for native eth and mode 1 for wrapped eth.
4.execute()
forge script script/Counter.s.sol:CounterScript --rpc-url http://127.0.0.1:8545 --broadcast --via-ir -vvvv