TGViewer
Solidity Treasures Solidity Treasures @soliditypedia · 4.28K subscribers
Post #580 477
ERC-4337 paymasters that accept ERC-20s, signatures, or NFTs

OpenZeppelin Contracts v5.7 ships composable paymaster primitives, so sponsoring gas becomes a policy you write, not a bespoke contract.

The hard part in a paymaster is validatePaymasterUserOp: you must decide who to sponsor and how to charge, then reconcile in postOp after the real gas cost is known. The new base contracts split this into pluggable checks: an ERC-20 paymaster pulls token payment at that price, a signature paymaster verifies an off-chain grant, an NFT-gated one checks ownership.

Watch the postOp refund path: overcharge on validation, refund the delta after execution, or a reverting token transfer can grief the bundler. Test the postOpReverted branch.

OpenZeppelin Contracts v5.7
@soliditypedia
X (formerly Twitter) OpenZeppelin (@OpenZeppelin) on X OpenZeppelin Contracts v5.7 is live 🔒 Explore the new primitives of the library behind $36T+ in onchain value transferred: • ERC-4337 paymasters: sponsor gas via ERC-20s, signatures, or NFTs • C…
  • 👍 3
  • 🔥 1
More from @soliditypedia
  1. Sep 22, 2026Deploy at the same address on every chain, without shipping initcode. Plain CREATE2 ties t…
  2. Sep 18, 2026An on-chain guard for AI-agent transactions moves the trust to whoever signs the attestati…
  3. Sep 16, 2026A generalized MEV bot beat the attacker to the rsETH exploit in the same block When the ex…
  4. Sep 15, 2026Public-mempool gas sponsorship can't have all three: no locked money, no off-chain trust,…
  5. Sep 13, 2026A QEMU/KVM sandbox is not a boundary for a cyber-capable agent Trail of Bits gave a fronti…
  6. Sep 12, 2026This week in Solidity Allbridge halted its core bridge after a $1.65M exploit: a $1.12M Ka…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →