Repository navigation
Add EntryPoint v0.6 and v0.7 contract bindings #31
Copy link
Copy link
Open
Description
Title
Add EntryPoint v0.6 and v0.7 contract bindings
Labels
enhancement, account-abstraction, contract, entrypoint
Description
Implement contract bindings for the ERC-4337 EntryPoint contract, which is the core singleton contract that processes UserOperations. Reference: eth-infinitism/account-abstraction
Requirements
Contract Addresses
- Add EntryPoint v0.6 address:
0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 - Add EntryPoint v0.7 address (when finalized)
- Network-specific EntryPoint registry
Core Methods
-
handleOps:
pub fn handleOps( ops: []const UserOperation, beneficiary: Address, ) !Hash
-
handleAggregatedOps:
pub fn handleAggregatedOps( opsPerAggregator: []const UserOpsPerAggregator, beneficiary: Address, ) !Hash
-
getUserOpHash:
pub fn getUserOpHash(userOp: UserOperation) Hash
-
getNonce:
pub fn getNonce(sender: Address, key: u256) u256
View Functions
-
balanceOf(account: Address) u256- Get account's deposit -
getDepositInfo(account: Address) DepositInfo -
getSenderAddress(initCode: []u8) Address- Calculate sender address
Deposit Management
-
depositTo(account: Address, amount: u256)- Add deposit -
withdrawTo(withdrawAddress: Address, amount: u256)- Withdraw -
addStake(unstakeDelaySec: u32, amount: u256)- Stake for entity
Events
- Define event types:
UserOperationEvent- UserOp executedAccountDeployed- New account createdUserOperationRevertReason- UserOp failedDeposited- Deposit madeWithdrawn- Withdrawal madeStakeLocked- Entity stakedStakeUnlocked- Stake unlockedStakeWithdrawn- Stake withdrawn
Event Parsing
- Parse
UserOperationEvent:pub const UserOperationEvent = struct { userOpHash: Hash, sender: Address, paymaster: Address, nonce: u256, success: bool, actualGasCost: u256, actualGasUsed: u256, };
EntryPoint Contract Binding
- Create contract wrapper:
pub const EntryPoint = struct { address: Address, provider: *Provider, pub fn v06(provider: *Provider) EntryPoint; pub fn v07(provider: *Provider) EntryPoint; pub fn at(address: Address, provider: *Provider) EntryPoint; };
File Structure
src/account_abstraction/
├── entrypoint.zig # EntryPoint contract bindings
├── entrypoint_abi.zig # ABI definitions
└── events.zig # Event types and parsing
Example Usage
const entrypoint = zigeth.accountAbstraction.EntryPoint.v06(provider);
// Get account nonce
const nonce = try entrypoint.getNonce(account_address, 0);
// Check deposit
const deposit = try entrypoint.balanceOf(account_address);
// Listen for UserOperationEvents
const filter = try entrypoint.createUserOpFilter(account_address);
const logs = try provider.eth.getLogs(filter);References
- EntryPoint contract: https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/core/EntryPoint.sol
- ERC-4337: https://eips.ethereum.org/EIPS/eip-4337
- Deployed addresses: https://github.com/eth-infinitism/account-abstraction#deployed-addresses
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity