Skip to main content

PepuSponsoredPaymasterV7 Contract

Reference for the paymaster contracts: v2 PepuSponsoredPaymasterV7 (live on mainnet) and v1 PepuVerifyingPaymasterV7 (retired): functions, events, errors, roles and timelocks. Names come from the SDK's pepuSponsoredPaymasterV2Abi and the spec; the contract source is services/paymaster/contracts/src.

The v2 paymaster is at 0xdb28528C9399C33c9A0297E8A62F39145acbC30D (about block 10537341). Owner 0x5966…4A1, manager 0x063A…aBb0; the free pool was seeded with 300 PEPU. The v1 paymaster at 0x2B6FED323bFA24f0475f4e1Dd3C7F6Cc1f3ae8B0 is retired: its EntryPoint deposit was withdrawn (0), so it cannot sponsor anything. Never deposit to it.

v1: PepuVerifyingPaymasterV7​

A fork of Pimlico's singleton verifying paymaster with ERC-20 mode removed. Its job is narrow: check that paymasterAndData carries a valid ECDSA signature from an authorised signer over an approved time window, then pay gas from its EntryPoint deposit.

ItemDetail
Address0x2B6FED323bFA24f0475f4e1Dd3C7F6Cc1f3ae8B0 (retired)
Stake and depositRetired. The EntryPoint deposit is withdrawn (0)
Signed prefixpaymaster(20) ‖ verificationGasLimit(16) ‖ postOpGasLimit(16) ‖ mode(1)=0x00 ‖ validUntil(6) ‖ validAfter(6), then the 65-byte signature
Hashkeccak of sender, nonce, account gas limits, preVerificationGas, gas fees, hashes of initCode, callData and the prefix, then with chainid, EIP-191 signed. A frozen cross-language test vector pins both sides
SignersMulti-signer (MultiSigner): a manager can add or remove signers without a redeploy
CapsNone on chain. Every economic safeguard is in the policy service
Bundler gateNot enforced

The main risk is signer-key compromise: any signature from an authorised signer is honoured up to the deposit. The mitigation is keeping the float small and rotating signers. See Policy, Caps and the Circuit Breaker.

v2: PepuSponsoredPaymasterV7​

One contract that is both paymaster and vault. All PEPU sits in its EntryPoint deposit; an internal ledger records which sponsor owns what, with totalLiabilities equal to the sum of ledgers and totalLiabilities at most the EntryPoint balance. Deployed at 0xdb28528C9399C33c9A0297E8A62F39145acbC30D.

How it validates​

paymasterData is mode(1)=0x02 ‖ validUntil(6) ‖ validAfter(6) ‖ sponsorId(32) ‖ signature(65) (97 bytes signed, sponsorId inside the hash). sponsorId is 0x00..00 for the free pool or keccak256(bytes(appId)) for a project. Validation, in order:

  1. Caller is the EntryPoint. The mode byte must be exactly 0x02, and the bundler gate is unconditional: tx.origin must be an allowlisted bundler (address(0) is allowlisted so estimation works).
  2. Signature exactly 65 bytes, low-s, from an authorised signer, otherwise SIG_VALIDATION_FAILED with no state change (so stubs never revert or charge).
  3. validUntil non-zero; paymaster post-op gas limit at least 40,000; the op's maxFeePerGas at most the sponsor's cap.
  4. The sponsor must be claimed and not paused; for the free pool, enabled and under freeMaxOpCost. A project must also have a non-zero per-wallet daily limit (ZeroDailyLimit otherwise); only the free pool may run with 0 = off.
  5. Every Kernel execute target (single 0x00 or batch 0x01) must be on the sponsor's allowlist. Empty means nothing.
  6. Daily limit (projects) and per-wallet daily limit, keyed on the signed validAfter day.
  7. The sponsor's balance covers maxCost. The full maxCost is deducted; postOp refunds maxCost - charge to the same sponsor. charge includes a post-op overhead (20,000 gas at deploy, floor 18,000) plus the worst case of the EntryPoint's 10% unused-gas penalty, so the ledger can never be short. Both are snapshotted into the context at validation, so postOp makes no cold storage read of the overhead and an owner changing it mid-flight cannot change an in-flight op's charge (worst-case postOp 13,918 gas against the 18,000 floor).

Because the gate uses ORIGIN, which ERC-7562 bans, v2 is supported only behind a self-run bundler with safe mode off whose executor is allowlisted. See Bundler Overview.

Functions​

GroupFunctionsWho
ERC-4337validatePaymasterUserOp, postOp, getHashEntryPoint (hash view for anyone)
Deposits (one-way)depositFor(projectId), fundFreePool(), creditSurplusToFreePool()Anyone
ClaimsclaimProject(Claim), reclaimProject(Claim), executeReclaim, cancelReclaim, views claimDigest, domainSeparator, claimUsed, signerRemovedAt, pendingReclaim, vetoedReclaimant, PENDING_EXPIRYClaim: anyone with a signer attestation. Execute: anyone after the delay and within 30 days. Cancel: the current project owner, once per new owner; for a pending first claim of a funded, unowned project, the contract owner or manager
Project settingssetTargets, setDailyLimit, setSenderDailyLimit, setMaxFeePerGas, setRequiredAccountCodehash, setPaused, proposeProjectOwner, acceptProjectOwnershipThe project's own owner only
Free poolsetFreeTier, setFreeMaxFeePerGas (owner); pauseFreePool, setFreeTargets (owner or manager)Owner, manager
GovernanceproposeAdminChange, executeAdminChange, cancelAdminChange (kind 1 signer, 2 bundler; address(0) allowed as a bundler only), removeSigner, removeBundlers, setManager, setPostOpOverheadGas (can only lower), addStake (delay at most 30 days), unlockStake, withdrawStake (stake only)Owner, manager (stake functions and setManager, setPostOpOverheadGas are owner only)
OwnershipOpenZeppelin Ownable2Step: transferOwnership, acceptOwnership, renounceOwnershipOwner
ViewsgetProject, getSenderSpend, isTargetAllowed, projectIdOf, effectiveMaxFeePerGas, requiredAccountCodehash, pendingAdminChange, surplus, totalLiabilities, adminChangeDelay, defaultMaxFeePerGas, postOpOverheadGas, maxPostOpOverheadGas, freeEnabled, freeMaxOpCost, manager, entryPoint, signers, isBundlerAllowedAnyone

There is no receive() or plain deposit(), and no withdrawal function of any kind for ledger funds. The contract never calls entryPoint.withdrawTo (a test scans the bytecode for that selector). withdrawStake moves only the separate EntryPoint stake balance. claimProject sets only the owner, so the owner follows with setTargets, setDailyLimit and setSenderDailyLimit. A claim of a project with no deposited funds is immediate; the claim of a project that already holds funds is pending for adminChangeDelay (event ProjectClaimProposed), signer-bound, cancellable by the contract owner or manager, and finished by anyone with executeReclaim. setMaxFeePerGas and setFreeMaxFeePerGas cannot exceed defaultMaxFeePerGas; setFreeTier rejects a non-zero per-wallet limit below the per-op cap (InvalidFreeTierConfig); proposeProjectOwner(id, address(0)) withdraws a nomination.

Events​

ProjectClaimed, ProjectClaimProposed (pending first claim; the contract owner and manager should watch), ProjectReclaimProposed (owners should watch), ProjectReclaimCancelled, Deposited, TargetSet, DailyLimitSet, SenderDailyLimitSet, PausedSet, ProjectOwnershipTransferStarted, ProjectOwnershipTransferred, FreeTierConfigured, SurplusCreditedToFreePool, ManagerSet, PostOpOverheadGasSet, BundlerAllowlistUpdated, SignerAdded, SignerRemoved, AdminChangeProposed (projects should watch), AdminChangeCancelled, MaxFeePerGasSet, RequiredAccountCodehashSet, OpenZeppelin OwnershipTransferStarted and OwnershipTransferred, SponsorReserved and UserOpSettled.

Errors​

NotEntryPoint, NotOwnerOrManager, NotProjectOwner, NotPendingProjectOwner, InvalidOwner, OwnableInvalidOwner, OwnableUnauthorizedAccount, ReentrancyGuardReentrantCall; validation: PaymasterModeInvalid, PaymasterAndDataLengthInvalid, PaymasterConfigLengthInvalid, PaymasterSignatureLengthInvalid, BundlerNotAllowed, InvalidValidityWindow, PostOpGasLimitTooLow, MaxFeePerGasTooHigh, AccountCodehashMismatch, UnknownSponsor, SponsorPaused, FreeTierDisabled, OpCostTooHigh, CostTooLarge, UnsupportedCallData, TargetNotAllowed, DailyLimitExceeded, SenderDailyLimitExceeded, InsufficientSponsorBalance; claims: InvalidAppId, InvalidClaimSignature, ClaimExpired, ClaimAlreadyUsed, ClaimDeadlineTooFar, ProjectAlreadyClaimed, ProjectNotClaimed, NoPendingReclaim (also an expired claim), ReclaimNotReady, ReclaimSignerRemoved, ReclaimNotCancellable; config: ZeroAmount, ZeroDailyLimit, ZeroFeeCap, DelayTooShort, DelayTooLong, OverheadOutOfBounds, InvalidAdminChange, AdminChangeAlreadyProposed, AdminChangeNotProposed, AdminChangeNotReady, InvalidFreeTierConfig, NothingToCredit. The SDK exposes decodePaymasterRevert to decode revert data.

Roles​

RoleHeld byCanCannot
AnyoneDeposit, fund the free pool, submit claims, execute re-claims, credit surplus to the free poolWithdraw
Project ownerEstablished by an attested claimSettings, pause, voluntary transfer, cancel a re-claim (once per new owner)Touch any other project or the free pool; withdraw
OwnerThe deployer by default; two-step transfer, renounce supportedFree-tier parameters, manager, lower overhead, addStake, unlockStake, withdrawStake, cancel a pending first claimReach any ledger money or a project's settings
ManagerShould be a different address (the deploy script refuses owner = manager without an explicit override)Propose and execute signer and bundler additions (timelocked), instant removals, free-pool targets and pause, cancel a pending first claimWithdraw, change a project, touch the stake
Signer(s)The policy service keyApprove ops and attest claims (one shared set)Withdraw; pay itself unless it is an allowlisted bundler

Timelocks​

ChangeDelay
Signer or bundler additionadminChangeDelay: immutable, constructor-enforced between 48 hours and 30 days (deploy default 48 hours)
Re-claim of an owned project, and the first claim of a project that holds fundsThe same delay; announced, cancellable (the current owner once per new owner; the contract owner or manager for a first claim), void if its attesting signer was removed since
Any pending claim, re-claim or admin additionLapses 30 days after it becomes executable (PENDING_EXPIRY)
Removals (signer, bundler), pause, limit and fee-cap changesInstant
Attestation validityAt most 1 hour (ClaimDeadlineTooFar)

A project's defence during a timelock window is to pause and tighten its limits.

Size and pinned build​

Runtime size is 23,722 bytes against the 24,576-byte EIP-170 limit (854 bytes of headroom), so any further change needs a size check. It fits only because this contract is compiled with 8,000 optimizer runs (25,115 bytes at 1,000,000), which costs about 0.2% on validation and 0.5% on postOp; foundry.toml applies that to this contract only, so the deployed v1 build is unchanged. The deploy script pins the creation-bytecode hash 0x86153ab5c7faa3a83ea9949b2a44ebba196ce367227d376b9a28290e3a468164, which reproduces only from LF line-ending sources (enforced by .gitattributes).

Common failures​

SymptomCauseFix
AA33 with BundlerNotAllowedExecutor not on the v2 allowlistUse the PEPU bundler
TargetNotAllowedCall goes outside the allowlistOwner runs setTargets
UnknownSponsorProject not claimed (or its claim is still pending)Claim it, and executeReclaim after the delay if the project already held funds; deposits are not spendable before
ZeroDailyLimit at validationThe project never called setSenderDailyLimitRun setSenderDailyLimit
PaymasterModeInvalidv1-layout data sent to v2Use v2 paymaster data from the v2 route