Polystream integrates ERC-4337 Account Abstraction to provide a seamless user experience by abstracting away complex blockchain interactions. This architecture allows users to interact with DeFi protocols without managing gas fees directly or dealing with the traditional complications of cryptocurrency wallets.
The EntryPoint.sol contract is the central hub through which all user operations are processed:
// Core contract that validates and executes UserOperationscontract EntryPoint{functionhandleOps(UserOperation[]calldataops,addresspayablebeneficiary)external;functionhandleAggregatedOps(...)external;functionsimulateValidation(UserOperationcalldatauserOp)external;// Additional functionality...}
Validates signatures and transaction parameters
Executes batched user operations
Manages gas refunds and paymaster interactions
Provides simulation capabilities for off-chain validation
2. Bundler
Bundlers are a critical component of the ERC-4337 infrastructure that collect "UserOperation" objects from users and submit them to the EntryPoint contract:
While the bundler itself is typically an off-chain service, your codebase integrates with bundlers through:
UserOperation creation and signing in client-side code
Verification and validation mechanisms in the smart contracts
Tests for bundler compatibility
The core bundler interaction happens through the SendUserOp interface which is referenced in the AASigner class:
The UserOperation.ts structure is the fundamental data type in ERC-4337:
Sponsored Transactions
Polystream implements sponsored transactions through paymasters, allowing users to execute transactions without holding ETH. This creates a "Web2-like" experience where users don't need to understand gas or acquire ETH to use the platform.
The PaymasterFlow implementation is referenced in several test files, showing how transactions can be sponsored:
Paymasters can sponsor gas fees and can implement different payment models:
Free transactions: Subsidizing user operations as a business expense
Token payments: Users pay in ERC-20 tokens instead of ETH
Subscription models: Users with active subscriptions get free transactions
Dealing with popups and signing for every transaction is one of the worst parts of crypto UX.
Thanks to ERC4337, you won't need to sign endless transaction prompts:
Set up once with a single approval
No more constant wallet connection requests
No more confusing technical permissions
No more gas fee surprises
If interaction is needed, you'll only see one final confirmation - not dozens of confusing approval requests.