Fresh Avalanche C-Chain ERC-4337 contract workspace.
This folder owns the on-chain AVAX 4337 deployment state (paymaster + references). Runtime API behavior is implemented by chains/avax/bundler.
This repository is intended to stay public and clearly attribute upstream contract sources.
- Coinbase/Base Verifying Paymaster: https://github.com/coinbase/verifying-paymaster
- Vendored at
contracts/vendor/coinbase/VerifyingPaymaster.sol. - Used as the launch paymaster because it is MIT licensed, production-used by Coinbase/Base, and explicitly compatible with EntryPoint v0.7.
- Vendored at
- ERC-4337 account-abstraction contracts: https://github.com/eth-infinitism/account-abstraction
- Used for EntryPoint references and account/factory compatibility.
- We reuse the deployed EntryPoint v0.7 singleton; we do not deploy or modify EntryPoint.
Vendored upstream source is copied as-is. Preserve SPDX headers, copyright notices, and upstream source references when making any future changes.
The launch paymaster supports two SmoothSend products:
- Developer-sponsored gas: developer pays SmoothSend, SmoothSend pays AVAX gas through the paymaster, user pays no gas.
- User pays in ERC20/USDC: SmoothSend pays AVAX gas through the paymaster, the paymaster collects USDC or another supported ERC20 from the user, and SmoothSend prices the ERC20 charge with markup.
The first contract deployment path:
- Reuse deployed ERC-4337 v0.7 EntryPoint:
0x0000000071727De22E5E9d8BAf0edAc6f37da032 - Deploy Coinbase/Base
VerifyingPaymaster. - Deploy a v0.7-compatible account factory if we need a SmoothSend-owned demo account factory.
- Fund the paymaster deposit in EntryPoint.
- Wire the AVAX bundler to sign and submit UserOperations for both sponsorship modes.
See TASKS.md for the full implementation plan and contracts/CONTRACTS.md for the contract source decision matrix.
cp .env.example .env
npm install
npm run buildRequired env vars before deployment:
DEPLOYER_PRIVATE_KEYVERIFYING_SIGNEROWNER(optional; defaults to deployer)INITIAL_PAYMASTER_DEPOSIT_AVAX(optional; defaults to0)BUNDLER_ADDRESSES(optional comma-separated allowlist)
npm run deploy:fuji
npm run deploy:mainnetVendored unchanged except SimpleAccount.sol core imports use @account-abstraction/core/* so Hardhat avoids duplicate source paths (contracts/vendor/eth-infinitism/samples/).
npm run deploy:simple-account-factory:fuji
npm run deploy:simple-account-factory:mainnetUses DEPLOYER_PRIVATE_KEY, ENTRYPOINT_V07 (defaults to canonical v0.7), and pays normal Fuji/mainnet AVAX gas for one transaction (factory constructor deploys SimpleAccount impl + factory).
After deploy, set AVAX_FUJI_SIMPLE_ACCOUNT_FACTORY on the Worker and redeploy gateway so GET /api/v1/public/avax-aa-defaults returns the address.
- EntryPoint v0.7:
0x0000000071727De22E5E9d8BAf0edAc6f37da032 - SimpleAccountFactory (samples /
@account-abstraction/contractsv0.7):0x55326f005a0959F75496cdd692505fFB520972f5 - VerifyingPaymaster:
0x3207f577792F9d549acB2A6C97c0f74EAeB166d8 - Verifying signer used at deploy time:
0x84c2f35807fC555C4A06cC12Dc0aAf9d948FeE1d - Bundler EOA (submits
handleOps):0x84c2f35807fC555C4A06cC12Dc0aAf9d948FeE1d
Note: the bundler is an off-chain service + EOA, not a smart contract.
The on-chain contract address is the paymaster (0x3207...66d8), while0x84c2...FeE1dis the EOA that broadcastsEntryPoint.handleOps(...).
Bundler / gateway references for Fuji:
AVAX_CHAIN_ID=43113
ENTRYPOINT_V07=0x0000000071727De22E5E9d8BAf0edAc6f37da032
PAYMASTER_ADDRESS=0x3207f577792F9d549acB2A6C97c0f74EAeB166d8
VERIFYING_SIGNER=0x84c2f35807fC555C4A06cC12Dc0aAf9d948FeE1d
# Cloudflare Worker (`wrangler.toml` / dashboard): public AA defaults for SDK frontends
AVAX_FUJI_SIMPLE_ACCOUNT_FACTORY=0x55326f005a0959F75496cdd692505fFB520972f5POST …/paymaster/sign returns paymasterAndData (paymaster address + encoded paymasterData + 65-byte ECDSA from VERIFYING_SIGNER). Your snippet is a successful developer-sponsored quote (token and receiver zero = native sponsor path): validUntil / validAfter bound signature freshness; success: true means the bundler can attach this blob to the UserOp and submit.
Note: deployment was done with INITIAL_PAYMASTER_DEPOSIT_AVAX=0, so fund the paymaster deposit before running sponsored UserOps.
Bundler implementation is in chains/avax/bundler.
All gateway-facing routes:
POST /— ERC-4337 JSON-RPCeth_chainIdeth_supportedEntryPointseth_estimateUserOperationGaseth_sendUserOperationeth_getUserOperationByHasheth_getUserOperationReceipt
POST /api/v1/bundler/paymaster/sign— signpaymasterAndDataGET /api/v1/bundler/health— health + paused statusGET /api/v1/bundler/balance— bundler EOA balance + paymaster EntryPoint depositGET /api/v1/bundler/safety-check— run immediate safety checkGET /metrics— Prometheus metricsGET /stats— service metrics summaryGET /ping— liveness
Security model matches Aptos relayer:
- Public traffic enters through Cloudflare Worker only.
- Worker forwards to bundler with
X-Gateway-Secret. - Bundler validates
X-Gateway-Secretfor non-health routes. - Infrastructure should also firewall bundler ingress to Cloudflare IP ranges only.