Prerequisites
Fund Deployer Wallet
Ensure your deployer wallet has sufficient ETH on Base Sepolia for gas fees. Get testnet ETH from:
Environment Variables Reference
Private key of the deployer wallet (with 0x prefix)
Ethereum address of the agent that will control the PolicyVaultThis address can call
withdraw() to spend funds within policy limits.RPC endpoint for Base Sepolia networkYou can use a public endpoint or your own Alchemy/Infura URL.
Chain ID for Base Sepolia testnet
USDC token contract address on Base SepoliaUsed by the Escrow contract for payments.
Daily spending limit for PolicyVault in ETH
- Can be specified as a whole number (e.g.,
50) or decimal (e.g.,10.5) - Values are parsed to 18 decimals internally
- Example:
50= 50 ETH daily limit
Deployment Process
Run the deployment script:What Happens During Deployment
Compile Contracts
Contracts are compiled using solc compiler:
PolicyVault.solEscrow.solAgentRegistry.sol
Deploy Contracts
Contracts are deployed in sequence with nonce management:
- PolicyVault - Initialized with
AGENT_ADDRESSandDAILY_LIMIT - Escrow - Initialized with
USDC_ADDRESS - AgentRegistry - No constructor arguments
Link Contracts
Cross-contract connections are established:
- PolicyVault: Add Escrow to allowlist
- AgentRegistry: Set Escrow contract address
- Escrow: Set AgentRegistry address
Deployment Script Details
The deployment script (backend/scripts/deploy-base-sepolia-contracts.mjs) performs several key functions:
Compiler Configuration
Constructor Arguments
Contract Linking
After deployment, contracts are linked together:Verification
After deployment, verify the contracts on BaseScan:Repeat the verification command for each contract (Escrow, AgentRegistry) with appropriate constructor arguments.
Troubleshooting
Insufficient Funds
Invalid Agent Address
AGENT_ADDRESS is a valid Ethereum address with 0x prefix.
Wrong Network
Next Steps
AgentRegistry
Register your agent service
Escrow
Create trustless payments