ProofPay smart contracts are built with Solidity ^0.8.20 and use the UUPS (Universal Upgradeable Proxy Standard) pattern for upgradeability.
Purpose: Validates payments using EAS attestations
Key Features:
- Links user wallets to EAS attestations
- Validates attestation status before payments
- Integrates with EAS contract on Base
Functions:
linkAttestation(bytes32 attestationUID)- Link user's attestationcanPay(address user)- Check if user can make paymentsvalidatePayment(address from, address to, uint256 amount)- Validate payment between users
Events:
AttestationLinked(address indexed user, bytes32 indexed attestationUID)PaymentValidated(address indexed from, address indexed to, uint256 amount)
Purpose: ERC20 utility token for platform rewards and governance
Key Features:
- Fixed max supply: 1 billion tokens
- Burnable
- Minter role management
- Batch transfer functionality
- Upgradeable via UUPS
Functions:
mint(address to, uint256 amount)- Mint new tokens (minters only)addMinter(address minter)- Add minter role (owner only)batchTransfer(address[] recipients, uint256[] amounts)- Batch transfer
Purpose: Execute batch payments to multiple recipients
Key Features:
- Native and ERC20 token support
- Attestation validation for all recipients
- Automatic refund of excess funds
- Failed payment tracking
Functions:
batchPayNative(Payment[] payments)- Batch payment in ETHbatchPayToken(address token, Payment[] payments)- Batch payment in ERC20
Purpose: Secure escrow for payments with attestation validation
Key Features:
- Native and ERC20 token support
- Release by sender
- Refund capability
- Reentrancy protection
Functions:
createEscrowNative(bytes32 escrowId, address recipient)- Create escrow with ETHcreateEscrowToken(bytes32 escrowId, address recipient, address token, uint256 amount)- Create escrow with tokensreleaseEscrow(bytes32 escrowId)- Release funds to recipientrefundEscrow(bytes32 escrowId)- Refund to sender
Utility library for EAS attestation verification
Functions:
verifyAttestation(address easAddress, bytes32 uid)- Verify attestation validitydecodeKYCData(bytes data)- Decode KYC attestation data
All contracts use UUPS proxy pattern for upgradeability.
- Deploy Implementation Contract
PaymentValidator implementation = new PaymentValidator();- Deploy Proxy with Initialization
bytes memory initData = abi.encodeWithSelector(
PaymentValidator.initialize.selector,
easAddress,
kycSchemaUID
);
ERC1967Proxy proxy = new ERC1967Proxy(
address(implementation),
initData
);- Use Proxy Address
PaymentValidator validator = PaymentValidator(address(proxy));- Deploy new implementation
- Call
upgradeTo(address newImplementation)on proxy (owner only)
-
UUPS Upgradeability
- Only owner can upgrade
- Prevents unauthorized upgrades
-
Reentrancy Protection
- All payment functions use
nonReentrantmodifier - Custom reentrancy guard with logging
- All payment functions use
-
Access Control
- Ownable pattern for admin functions
- Minter role for token minting
-
Attestation Validation
- All payments require valid attestations
- Checks for revocation and expiration
- Use of
calldatafor array parameters - Efficient storage patterns
- Minimal external calls
Run tests with Foundry:
cd contracts
forge test -vvvGenerate coverage:
forge coverage --report lcov- Network: Base Mainnet
- Chain ID: 8453
- RPC: https://mainnet.base.org
- Explorer: https://basescan.org
- EAS Contract: 0x4200000000000000000000000000000000000021
- PaymentValidator: TBD
- ProofToken: TBD
- PaymentBatch: TBD
- PaymentEscrow: TBD
- TBD