This project implements an ERC-4337 Smart Contract Wallet with support for Ethereum Sepolia, zkSync Sepolia, and Local (Anvil) networks. It includes scripts for deployment, configuration, and sending user operations.
├── src/
│ ├── Ethereum/
│ │ ├── MinimalAccount.sol # Smart contract for ERC-4337 Minimal Account
│ │ ├── ZkSyncMinimalAccount.sol # Smart contract for zkSync Minimal Account
│ ├── lib/account-abstraction/ # ERC-4337 dependencies
│ ├── mocks/ # OpenZeppelin mocks (if needed)
├── script/
│ ├── DeployMinimal.s.sol # Script to deploy MinimalAccount
│ ├── HelperConfig.s.sol # Network configuration helper
│ ├── SendPackedUserOp.s.sol # Script to sign and send user operations
├── foundry.toml # Foundry configuration file
├── README.md # Project documentation
- Foundry (for Solidity development)
- Node.js & NPM (if integrating with frontend or scripts)
- OpenZeppelin Contracts
- Account Abstraction (ERC-4337)
-
Clone the repository
git clone https://github.com/Rahber-1/Account-Abstraction.git cd Account-Abstraction -
Install dependencies
forge install forge install OpenZeppelin/openzeppelin-contracts forge install eth-infinitism/account-abstraction
-
Compile the contracts
forge build
forge script script/DeployMinimal.s.sol --rpc-url <SEPOLIA_RPC_URL> --private-key <YOUR_PRIVATE_KEY> --broadcastanvil &
forge script script/DeployMinimal.s.sol --rpc-url http://127.0.0.1:8545 --private-key <ANVIL_PRIVATE_KEY> --broadcastThe HelperConfig.s.sol file manages network configurations:
- Ethereum Sepolia (chain ID
11155111) - zkSync Sepolia (chain ID
300) - Local Anvil (chain ID
31337)
To modify configurations, update getEthSepoliaConfig(), getZksyncSepoliaConfig(), or getAnvilConfig() in HelperConfig.s.sol.
forge script script/SendPackedUserOp.s.sol --rpc-url <NETWORK_RPC> --private-key <YOUR_PRIVATE_KEY>This will:
- Generate a signed user operation using the provided sender and calldata.
- Fetch the correct network entry point from
HelperConfig. - Sign the operation using the private key.
forge testforge test -vvvvforge script script/DeployMinimal.s.sol --rpc-url <NETWORK_RPC> --sig "run()"This project is licensed under the MIT License.