Contract Deployment
Step-by-step guide to deploy ERC-1066-x402 contracts to testnets and mainnets.
Prerequisites
1. Foundry Installed
Terminal
curl -L https://foundry.paradigm.xyz | bash
foundryup
forge --version # Verify installation2. Private Key with Testnet Tokens
Export your private key as environment variable and ensure the wallet has testnet tokens for gas fees.
Security
Never commit your private key. Use environment variables or a secure secret manager.
3. Testnet Tokens
Get testnet tokens from faucets:
- • Hyperion Testnet: Contact Metis DevOps
- • Metis Sepolia: Public faucet
- • Mantle Testnet: Mantle faucet
- • Avalanche Fuji: https://faucet.avalanche.network/
Environment Setup
Set your private key as an environment variable:
Terminal
# Set your private key (NEVER commit this!)
# You can use with or without 0x prefix - both formats are supported
export PRIVATE_KEY=your_private_key_here
# OR
export PRIVATE_KEY=0xyour_private_key_here
# Verify it's set
echo $PRIVATE_KEYNote
The deployment scripts automatically handle PRIVATE_KEY with or without the
0x prefix.Deploy Contracts
Choose a testnet and deploy using NPM scripts (recommended) or Foundry directly:
Using NPM Scripts (Recommended)
Terminal
# Deploy to Hyperion Testnet
npm run deploy:hyperion:testnet
# Deploy to Metis Sepolia
npm run deploy:metis:sepolia
# Deploy to Mantle Testnet
npm run deploy:mantle:testnet
# Deploy to Avalanche Fuji
npm run deploy:avalanche:fujiUsing Foundry Directly
Terminal
# Hyperion Testnet
forge script script/Deploy.s.sol:Deploy \
--rpc-url hyperion_testnet \
--broadcast \
--verify
# Metis Sepolia
forge script script/Deploy.s.sol:Deploy \
--rpc-url metis_sepolia \
--broadcast \
--verifyAfter deployment, you'll see output like:
Terminal
PolicyRegistry deployed at: 0x1234567890123456789012345678901234567890
SimpleSpendingValidator deployed at: 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd
IntentExecutor deployed at: 0x9876543210987654321098765432109876543210
Chain ID: 133717Save Addresses
Save these addresses. You'll need them for gateway configuration.
Verify Deployment
1. Check on Block Explorer
Verify contracts are deployed and verified on the block explorer for your network.
2. Verify Contract Code
Contracts should be verified automatically if --verify flag was used.
3. Test Contract Functions
Terminal
# Check PolicyRegistry owner
cast call "owner()" --rpc-url
# Check IntentExecutor validator
cast call "validator()" --rpc-url