8.2 KiB
Complete Deployment Guide
Overview
This guide covers the complete deployment process for the DeFi Oracle Meta Mainnet (ChainID 138), including blockchain infrastructure and smart contracts.
Prerequisites
- Azure CLI installed and authenticated
- Terraform >= 1.0 installed
- kubectl configured for AKS
- Helm 3.x installed
- Foundry (forge, cast, anvil) installed
- .env file configured with required variables
Deployment Order
The deployment follows this order:
- Blockchain Infrastructure (Azure/Kubernetes)
- Smart Contracts (in proper dependency order)
Step 1: Check Deployment Status
First, check the current deployment status:
./scripts/deployment/check-deployment-status.sh
This will show:
- Current contract deployment status
- Infrastructure status
- Missing configuration
Step 2: Deploy Blockchain Infrastructure (if needed)
If the blockchain infrastructure is not deployed:
Option A: Deploy to Azure/Kubernetes (Production)
-
Deploy Infrastructure with Terraform:
cd terraform terraform init terraform plan terraform apply -
Get AKS Credentials:
az aks get-credentials --resource-group az-p-we-rg-comp-001 --name az-p-we-aks-main -
Deploy Kubernetes Resources:
kubectl apply -f k8s/base/namespace.yaml helm install besu-validators ./helm/besu-network -f helm/besu-network/values-validators.yaml -n besu-network helm install besu-sentries ./helm/besu-network -f helm/besu-network/values-sentries.yaml -n besu-network helm install besu-rpc ./helm/besu-network -f helm/besu-network/values-rpc.yaml -n besu-network -
Get RPC URL:
- After deployment, get the RPC endpoint from the Application Gateway
- Update
.envwithRPC_URL
Option B: Start Local Testnet (Development/Testing)
For local testing, start an Anvil testnet:
./scripts/deployment/start-local-testnet.sh
This will:
- Start Anvil testnet on port 8545
- Set Chain ID to 138
- Update
.envwithRPC_URL=http://localhost:8545 - Prefund test accounts
Step 3: Deploy Smart Contracts
Deploy all contracts in proper order:
./scripts/deployment/deploy-all-ordered.sh
This script will:
- Check RPC endpoint - Verify blockchain is accessible
- Deploy Mock LINK Token (if not configured)
- Deploy CCIP Router - Cross-chain message router
- Deploy WETH9 - Standard WETH implementation
- Deploy WETH10 - Enhanced WETH with flash loans
- Deploy CCIPWETH9Bridge - Cross-chain WETH9 bridge
- Deploy CCIPWETH10Bridge - Cross-chain WETH10 bridge
- Deploy Oracle Aggregator - Oracle price feed aggregator
- Update .env file - Save all deployed addresses
Manual Deployment (Alternative)
If you prefer to deploy contracts manually:
1. Deploy Mock LINK Token (if needed)
forge script script/DeployMockLinkToken.s.sol:DeployMockLinkToken \
--rpc-url $RPC_URL \
--broadcast \
--private-key $PRIVATE_KEY \
-vvv
Update .env:
CCIP_FEE_TOKEN=<deployed_address>
2. Deploy CCIP Router
forge script script/DeployCCIPRouter.s.sol:DeployCCIPRouter \
--sig "run(address,uint256,uint256)" \
$CCIP_FEE_TOKEN \
1000000000000000 \
1000000000 \
--rpc-url $RPC_URL \
--broadcast \
--private-key $PRIVATE_KEY \
-vvv
Update .env:
CCIP_ROUTER=<deployed_address>
3. Deploy WETH9
forge script script/DeployWETH.s.sol:DeployWETH \
--rpc-url $RPC_URL \
--broadcast \
--private-key $PRIVATE_KEY \
-vvv
Update .env:
WETH9_ADDRESS=<deployed_address>
4. Deploy WETH10
forge script script/DeployWETH10.s.sol:DeployWETH10 \
--rpc-url $RPC_URL \
--broadcast \
--private-key $PRIVATE_KEY \
-vvv
Update .env:
WETH10_ADDRESS=<deployed_address>
5. Deploy CCIPWETH9Bridge
forge script script/DeployCCIPWETH9Bridge.s.sol:DeployCCIPWETH9Bridge \
--rpc-url $RPC_URL \
--broadcast \
--private-key $PRIVATE_KEY \
-vvv
Update .env:
CCIPWETH9BRIDGE_ADDRESS=<deployed_address>
6. Deploy CCIPWETH10Bridge
forge script script/DeployCCIPWETH10Bridge.s.sol:DeployCCIPWETH10Bridge \
--rpc-url $RPC_URL \
--broadcast \
--private-key $PRIVATE_KEY \
-vvv
Update .env:
CCIPWETH10BRIDGE_ADDRESS=<deployed_address>
7. Deploy Oracle Aggregator
forge script script/DeployOracle.s.sol:DeployOracle \
--rpc-url $RPC_URL \
--broadcast \
--private-key $PRIVATE_KEY \
-vvv
Update .env:
ORACLE_AGGREGATOR_ADDRESS=<deployed_address>
Step 4: Verify Deployment
Verify all contracts are deployed:
./scripts/deployment/check-deployment-status.sh
This will check:
- Contract addresses in
.env - Contract existence on-chain
- Infrastructure status
Step 5: Configure Contracts
Configure CCIP Router
Add supported chains:
cast send $CCIP_ROUTER "addSupportedChain(uint64)" 5009297550715157269 \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
Configure CCIP Bridges
Add destination chains for bridges:
# For WETH9 Bridge
cast send $CCIPWETH9BRIDGE_ADDRESS "addDestination(uint64,address)" \
5009297550715157269 \
<destination_bridge_address> \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
# For WETH10 Bridge
cast send $CCIPWETH10BRIDGE_ADDRESS "addDestination(uint64,address)" \
5009297550715157269 \
<destination_bridge_address> \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
Environment Variables
Ensure .env file contains:
# Deployer
PRIVATE_KEY=<your_private_key>
# Blockchain
RPC_URL=<rpc_endpoint>
# CCIP Configuration
CCIP_ROUTER=<ccip_router_address>
CCIP_FEE_TOKEN=<link_token_address>
# WETH Configuration
WETH9_ADDRESS=<weth9_address>
WETH10_ADDRESS=<weth10_address>
# Bridge Configuration
CCIPWETH9BRIDGE_ADDRESS=<weth9_bridge_address>
CCIPWETH10BRIDGE_ADDRESS=<weth10_bridge_address>
# Oracle Configuration
ORACLE_AGGREGATOR_ADDRESS=<oracle_aggregator_address>
Deployment Checklist
- Blockchain infrastructure deployed (or local testnet running)
- RPC endpoint accessible
- PRIVATE_KEY configured in
.env - Mock LINK Token deployed (if needed)
- CCIP Router deployed and configured
- WETH9 deployed
- WETH10 deployed
- CCIPWETH9Bridge deployed
- CCIPWETH10Bridge deployed
- Oracle Aggregator deployed
- All addresses updated in
.env - Contracts verified on explorer (if applicable)
- Configuration verified
Troubleshooting
RPC Endpoint Not Accessible
-
Check if blockchain is running:
curl -X POST $RPC_URL -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' -
For local testnet, check if Anvil is running:
lsof -Pi :8545 -sTCP:LISTEN
Contract Deployment Fails
-
Check deployer balance:
cast balance <deployer_address> --rpc-url $RPC_URL -
Check gas prices:
cast gas-price --rpc-url $RPC_URL -
Verify contract compilation:
forge build
Missing Dependencies
-
Check if OpenZeppelin is installed:
ls lib/openzeppelin-contracts -
Install dependencies:
forge install OpenZeppelin/openzeppelin-contracts@v4.9.6
Next Steps
After deployment:
- Verify Contracts - Verify contracts on explorer
- Test Contracts - Run test suite
- Configure Monitoring - Set up monitoring and alerts
- Documentation - Update documentation with deployed addresses
- Integration - Integrate with external services
Support
For issues or questions:
- Check deployment logs
- Review contract documentation
- Verify configuration
- Check troubleshooting section