Gasless trade document operations on TrustVC via EIP-7702 (smart account delegation) and ERC-4337 (account abstraction). Deployed on Sepolia testnet.
This package provides three contracts:
| Contract | Role |
|---|---|
EIP7702Implementation |
Shared smart account logic that EOAs delegate to via EIP-7702 |
PlatformPaymaster |
Per-platform ERC-4337 paymaster — sponsors gas for registry and title escrow operations |
PlatformAccountFactory |
Deploys PlatformPaymaster clones cheaply via EIP-1167 (Clones.cloneDeterministic) |
- Delegate — An EOA signs an EIP-7702 authorization pointing to
EIP7702Implementation. The EOA's code becomes0xef0100 || impl_address, giving it full smart-account capabilities while keeping its original private key. - Deploy paymaster — A platform calls
PlatformAccountFactory.deployPlatformPaymaster(). A minimal-proxy clone (~55k gas vs ~1.5M for a full deploy) is initialized with the platform's owner address, daily ETH limit, and TDoc deployer. - Gasless ops — Users submit
UserOperations through a bundler (Pimlico). The paymaster validates and sponsors:- Path A — Calls to authorized registries or title escrows (beneficiary/holder/owner only, daily limit enforced)
- Path B —
deployRegistry(credit-gated) andmintDocument(MINTER_ROLE gated) on the paymaster itself
EIP-7702 smart account using OpenZeppelin's Account, SignerEIP7702, and ERC7821. Deployed once; EOAs point to it via authorization.
entryPoint— immutable, baked into bytecode at deploy time- Execution via
ERC7821batch execute - Signature validation: signer must equal
address(this)(the delegating EOA)
Per-platform ERC-4337 paymaster cloned from a shared implementation.
| Variable | Description |
|---|---|
tdocDeployer |
TDocDeployer contract that mints registry clones |
authorizedRegistries |
Registries whose calls this paymaster will sponsor |
authorizedTitleEscrows |
Title escrows whose calls this paymaster will sponsor |
authorizedCallers |
Addresses (beneficiary/holder) allowed on Path A |
userWhitelist |
Deployment credits per user (max 3) |
documentsMinted |
Count of documents minted per caller |
dailyLimit |
Max ETH sponsored per user per day |
initialize(owner, dailyLimit, tdocDeployer)— called once by the factory after clone; guarded byowner() == address(0)deployRegistry(impl, name, symbol)— deploys a TradeTrust registry, consumes one credit, auto-authorizes itmintDocument(registry, beneficiary, holder, tokenId, remark)— mints a document, auto-authorizes beneficiary + holder + title escrowsetUserWhitelist / removeUserFromWhitelist— manage deployment credits (onlyOwner)addRegistry / removeRegistry— manage authorized registries (onlyOwner)addTitleEscrow / removeTitleEscrow— manage authorized title escrows (onlyOwner)addAuthorizedCaller / removeAuthorizedCaller— manage Path A callers (onlyOwner)setDailyLimit— update daily spend cap (onlyOwner)getUserDailySpend(user)— returns(spent, limit, resetsAt)
Deploys PlatformPaymaster clones deterministically.
deployPlatformPaymaster(platformAddress, dailyLimit, salt)— clones the implementation and callsinitializecomputePaymasterAddress(salt)— predict the clone address before deploymentupdateTdocDeployer(addr)— update TDoc deployer (onlyOwner)updatePaymasterImplementation(addr)— upgrade the implementation for future clones (onlyOwner)
| Contract | Address |
|---|---|
| EIP7702Implementation | 0xa46EC3920Ac5fc54F4bA33185A91ae250aDF59B8 |
| PlatformPaymaster (implementation) | 0xa24695178ea881ab7d4d105106e4906a8da4752b |
| PlatformAccountFactory | 0x7e9ef6363180baa744eb32ceab367a44f52adc9f |
| TDocDeployer | 0x64bc665056DC8bE4092e569ED13a7F273Be28cD2 |
| EntryPoint v0.8 | 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108 |
npm install @trustvc/eip7702- Node.js 18+
- A Sepolia RPC URL (e.g. Infura)
- A Pimlico API key for bundler access
npm install
cp .env.example .env # fill in PRIVATE_KEY, SEPOLIA_RPC_URL, PIMLICO_API_KEYnpm run build # compile contracts + generate ABIs + bundle JS
npm run build:sol # compile contracts only
npm run build:abis # generate ABI TypeScript files onlynpm test # runs all 45 hardhat testsDeploy in order:
# 1. Deploy the shared PlatformPaymaster implementation
npx hardhat run scripts/deployImplementation.ts --network sepolia
# 2. Deploy the factory (add PAYMASTER_IMPLEMENTATION to .env first)
npx hardhat run scripts/deployFactory.ts --network sepolia
# 3. Clone a paymaster for your platform (add FACTORY_ADDRESS to .env first)
npx hardhat run scripts/deployPlatformPaymaster.ts --network sepolia
# 4. Stake the paymaster on the EntryPoint
npx hardhat run scripts/stakePlatformPaymaster.ts --network sepolianpx hardhat run scripts/mintDocumentGasless.ts --network sepolia| Variable | Description |
|---|---|
PRIVATE_KEY |
Deployer wallet private key |
SEPOLIA_RPC_URL |
Sepolia RPC endpoint |
PIMLICO_API_KEY |
Pimlico bundler API key |
TDOC_DEPLOYER_ADDRESS |
Deployed TDocDeployer address |
PAYMASTER_IMPLEMENTATION |
PlatformPaymaster implementation address |
FACTORY_ADDRESS |
PlatformAccountFactory address |
PAYMASTER_ADDRESS |
Deployed paymaster clone address |
EIP7702_IMPL_ADDRESS |
EIP7702Implementation address |
- Solidity
^0.8.28· OpenZeppelin Contracts v5 ·@account-abstraction/contractsv0.8 - Hardhat · hardhat-toolbox-viem · Viem · Pimlico bundler
- EIP-7702 · ERC-4337 · EIP-1167 minimal proxy · Sepolia testnet