Comprehensive deployment and management scripts for the HedgePod system.
scripts/
├── deploy/ # Deployment scripts
│ ├── deployer.ts # ⭐ Main comprehensive deployment script
│ └── deploy-all.js # Multi-network deployment orchestrator
│
├── verify/ # Verification scripts
│ └── verify.ts # Contract verification script
│
│
├── abi/ # ABI management
│ ├── saveAbi.mjs # Save contract ABIs
│ └── cleanAbi.mjs # Clean old ABIs
│
├── check/ # Balance and status checks
│ └── checkBalance.mjs # Check deployer balances
│
├── environment/ # Environment variable management
│ └── envUpdater.mjs # Update .env with contract addresses
│
├── faucet/ # Test token management
│ └── mintUSDC.mjs # Mint test USDC for testing
│
├── logs/ # Logging utilities
│ ├── console_logger.mjs # Colored console output
│ └── data/
│ └── data_logger.mjs # Save deployment data
│
└── roles/ # Access control
└── assignRoles.mjs # Assign roles to contracts
# Install all dependencies
make install
# Compile contracts
make compile
# Run tests
make test
# Deploy to Base Sepolia
make deploy-base
# Deploy to all networks
make deploy-all
# Start frontend
make frontend-dev
# Start backend agent
make backend-dev# Deploy to specific network
npx hardhat run scripts/deploy/deployer.ts --network baseSepolia
# Deploy to World Chain
npx hardhat run scripts/deploy/deployer.ts --network worldchain
# Verify contracts
npx hardhat run scripts/verify/verify.ts --network baseSepoliaThe scripts/deploy/deployer.ts script provides comprehensive deployment with:
- ✅ Colored console output with detailed logging
- ✅ Automatic ABI saving to
deployments/abis/ - ✅ Deployment data saved to
deployments/{network}.json - ✅ Timestamped deployment history
- ✅ Frontend contracts data export
- ✅ Backend contracts data export
- ✅ Explorer links for all contracts
- ✅ Verification commands generated
- ✅ Error handling and rollback support
- YieldOracle - Multi-source oracle (Pyth + Chainlink)
- AutoYieldToken - LayerZero OFT with yield routing
- HedgePodVault - Main vault contract
- VolatilityFeeHook - Uniswap v4 dynamic fee hook
Network configurations are now centralized in config/networks.ts:
// Edit config/networks.ts to add or update networks
export const NETWORK_CONFIG: Record<string, NetworkConfig> = {
baseSepolia: {
name: "Base Sepolia",
explorerUrl: "https://sepolia.basescan.org",
pythOracle: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
depositToken: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
lzEndpoint: "0x6EDCE65403992e310A62460808c4b910D972f10f",
chainlinkOracle: "0x0000000000000000000000000000000000000000",
},
// Add more networks...
};See config/README.md for full documentation.
# Clean old ABIs
make clean-abis
# ABIs are automatically saved during deployment to:
# - deployments/abis/YieldOracle.json
# - deployments/abis/AutoYieldToken.json
# - deployments/abis/HedgePodVault.json
# - deployments/abis/VolatilityFeeHook.json# Check deployer balance
make check-balance
# Or directly:
npx hardhat run scripts/check/checkBalance.mjs --network baseSepolia# Mint test USDC
make mint-usdc
# Or directly:
npx hardhat run scripts/faucet/mintUSDC.mjs --network baseSepoliaAfter deployment, data is saved to multiple locations:
deployments/
├── baseSepolia.json # Latest deployment
├── worldchain.json # Latest deployment
├── deployment-baseSepolia-{timestamp}.json # History
└── abis/ # Contract ABIs
├── YieldOracle.json
├── AutoYieldToken.json
├── HedgePodVault.json
└── VolatilityFeeHook.json
frontend/lib/data/
└── contracts_data.json # Imported by frontend app
backend/src/data/
└── contracts_data.json # Used by agent
The deployment script generates verification commands for you:
# YieldOracle
npx hardhat verify --network baseSepolia <address> <pythOracle> <chainlinkOracle>
# AutoYieldToken
npx hardhat verify --network baseSepolia <address> <lzEndpoint> 100
# HedgePodVault
npx hardhat verify --network baseSepolia <address> <depositToken> <autoYieldToken> <pythOracle> <ethPriceId> <usdcPriceId>
# VolatilityFeeHook
npx hardhat verify --network baseSepolia <address> <pythOracle> <poolManager> <priceId>make verify-base
# Enter contract address when prompted| Network | Network ID | Config Key | Status |
|---|---|---|---|
| Base Sepolia | baseSepolia | ✅ Configured | Testnet |
| World Chain | worldchain | ✅ Configured | Mainnet |
| Celo | celo | ✅ Configured | Mainnet |
| Polygon | polygon | ✅ Configured | Mainnet |
| Zircuit | zircuit | Testnet | |
| Arbitrum | arbitrum | ✅ Configured | Mainnet |
| Optimism | optimism | ✅ Configured | Mainnet |
| Avalanche | avalanche | Mainnet |
- Update
hardhat.config.ts:
networks: {
newNetwork: {
url: process.env.NEW_NETWORK_RPC,
accounts: [process.env.PRIVATE_KEY],
}
}- Update
scripts/deploy-new.ts:
const NETWORK_CONFIG = {
newNetwork: {
name: "New Network",
explorerUrl: "https://explorer.newnetwork.com",
pythOracle: "0x...",
chainlinkOracle: "0x...",
lzEndpoint: "0x...",
depositToken: "0x...",
}
};- Deploy:
npx hardhat run scripts/deploy-new.ts --network newNetwork# Check balance first
make check-balance
# Get testnet ETH from faucets# Wait a few minutes after deployment
# Then run verification manually with correct parameters# Update NETWORK_CONFIG in deploy-new.ts
# Get addresses from:
# - Pyth: https://pyth.network/developers/price-feed-ids
# - Chainlink: https://docs.chain.link/data-feeds/price-feeds/addressesAll deployment steps are logged with:
- 🚀 Deployment actions
- ✅ Success messages
- 🔗 Explorer links
- 💾 File save locations
- 📊 Summary tables
When adding new deployment features:
- Update
deploy-new.tswith new contract deployments - Add configuration to
NETWORK_CONFIG - Update this README
- Add Makefile commands if needed
- Test on testnet first
MIT License - see LICENSE for details