This guide explains how to deploy new implementations of DistributionCreator and Distributor contracts across all supported chains for upgrading existing proxies.
Deploy new implementations across all chains and generate summary for Gnosis Safe transactions:
# 1. Deploy to all chains
./helpers/deployUpgradeImplementations.sh
# 2. Generate summary report
./helpers/generateUpgradeSummary.sh
# 3. Check results
cat deployments/upgrade-summary.mdforge script scripts/deployUpgradeImplementationsSingle.s.sol \
--rpc-url <chain> \
--broadcast \
--verify# Arbitrum
forge script scripts/deployUpgradeImplementationsSingle.s.sol --rpc-url arbitrum --broadcast --verify
# Base
forge script scripts/deployUpgradeImplementationsSingle.s.sol --rpc-url base --broadcast --verify
# Polygon
forge script scripts/deployUpgradeImplementationsSingle.s.sol --rpc-url polygon --broadcast --verify
# Optimism
forge script scripts/deployUpgradeImplementationsSingle.s.sol --rpc-url optimism --broadcast --verify
# Mainnet
forge script scripts/deployUpgradeImplementationsSingle.s.sol --rpc-url mainnet --broadcast --verifyThe deployment process consists of:
- Deploying new implementation contracts on each chain
- Verifying the contracts on block explorers
- Saving deployment addresses to JSON files per chain
- Using these addresses to create Gnosis Safe upgrade transactions
scripts/deployUpgradeImplementationsSingle.s.sol- Foundry script for single chain deploymenthelpers/deployUpgradeImplementations.sh- Bash script for automated multi-chain deploymenthelpers/generateUpgradeSummary.sh- Script to generate summary reports from deploymentsdeployments/*.json- Generated JSON files with deployment addresses per chaindeployments/upgrade-summary.csv- CSV summary of all deploymentsdeployments/upgrade-summary.md- Markdown summary with Gnosis Safe templates
-
Environment Variables: Ensure your
.envfile contains:DEPLOYER_PRIVATE_KEY=your_private_key_here # RPC URLs for each chain MAINNET_NODE_URI=https://... POLYGON_NODE_URI=https://... # ... and so on for all chains # Etherscan API keys for verification MAINNET_ETHERSCAN_API_KEY=... POLYGON_ETHERSCAN_API_KEY=... # ... and so on
-
Dependencies: Make sure you have:
- Foundry installed and updated (
foundryup) - Sufficient balance on deployer address for gas on each chain
- Foundry installed and updated (
Run the bash script to deploy across all chains:
./helpers/deployUpgradeImplementations.shThis will:
- Iterate through all supported chains
- Skip chains without configured RPC URLs
- Handle failures gracefully and continue
- Generate logs for each chain in
deployments/ - Create a summary file with results
Deploy to a specific chain:
forge script scripts/deployUpgradeImplementationsSingle.s.sol \
--rpc-url <chain_name> \
--broadcast \
--verifyExamples:
# Deploy to Arbitrum
forge script scripts/deployUpgradeImplementationsSingle.s.sol \
--rpc-url arbitrum \
--broadcast \
--verify
# Deploy to Base
forge script scripts/deployUpgradeImplementationsSingle.s.sol \
--rpc-url base \
--broadcast \
--verifyIf verification fails or you want to verify manually later:
forge script scripts/deployUpgradeImplementationsSingle.s.sol \
--rpc-url <chain_name> \
--broadcastAfter deployment, you'll find the following files in the deployments/ directory:
Example: deployments/arbitrum-upgrade-implementations.json
{
"chainId": 42161,
"chainName": "arbitrum",
"distributionCreatorImplementation": "0x...",
"distributorImplementation": "0x...",
"timestamp": 1234567890,
"deployer": "0x..."
}deployments/<chain>-upgrade-implementations.json- Individual deployment datadeployments/<chain>-deployment.log- Deployment logsdeployments/upgrade-summary.csv- CSV summary of all deploymentsdeployments/upgrade-summary.md- Markdown summary with Gnosis Safe templatesdeployments/deployment-summary-<timestamp>.txt- Overall deployment status
If automatic verification fails, verify manually:
# Verify DistributionCreator
forge verify-contract \
<implementation_address> \
contracts/DistributionCreator.sol:DistributionCreator \
--chain <chain_name> \
--watch
# Verify Distributor
forge verify-contract \
<implementation_address> \
contracts/Distributor.sol:Distributor \
--chain <chain_name> \
--watchAfter deploying implementations, create upgrade transactions:
- Review the summary: Check
deployments/upgrade-summary.md - For each chain, navigate to the Gnosis Safe UI
- Create a new transaction to the proxy contract
- Call
upgradeTo(address)orupgradeToAndCall(address,bytes)function - Use the implementation address from the JSON file
- Get multiple signers to review the transaction
- Execute the upgrade transaction
- Monitor contract behavior after upgrade
For a UUPS proxy:
// Function: upgradeTo(address)
// Implementation: 0x... (from JSON file)To: 0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd (DistributionCreator Proxy)
Value: 0 ETH
Function: upgradeTo(address)
Parameter: 0x<DistributionCreator Implementation Address>
To: 0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae (Distributor Proxy)
Value: 0 ETH
Function: upgradeTo(address)
Parameter: 0x<Distributor Implementation Address>
- Check RPC URL is correct and accessible
- Try with a different RPC provider
- Some chains may have rate limits
- Verify manually using the commands above
- Check Etherscan API key is correct
- Some explorers may have delays - try again later
- Ensure deployer has sufficient native token balance
- Adjust gas price if needed:
--with-gas-price <amount> - Use
--legacyflag for chains without EIP-1559
ZKSync: Requires special compilation
forge script --zksync --system-mode=true ...Skale: May need custom gas settings
forge script --legacy ...Chain not supported: Deploy manually and add to JSON format
Before upgrading proxies, verify:
- All implementations deployed successfully
- All contracts verified on block explorers
- JSON files saved with correct addresses
- Deployment address matches expected deployer
- Storage layout compatible with previous version
- No constructor initializes state (use
initialize()instead) - Tested on testnet first
- Multiple signers reviewed transactions
- Monitoring plan in place
IMPORTANT:
- Test upgrades on testnets first
- Verify storage layout compatibility
- Check for breaking changes in new implementation
- Have multiple signers review upgrade transactions
- Monitor contract behavior after upgrade
- Always upgrade DistributionCreator first, then Distributor
- Keep backup of all implementation addresses
- High gas costs - deploy during low activity periods
- Use gas estimation tools
- Lower gas costs
- Faster confirmation times
- May have different gas mechanics
- Check block explorer supports verification
- Some may require manual verification
- Save all JSON files to secure location
- Document implementation addresses in internal docs
- Create upgrade proposals for each chain
- Schedule upgrade transactions
- Monitor contracts after upgrades
- Update documentation with new version
- Generate summary report:
./helpers/generateUpgradeSummary.sh
For issues or questions:
- Check Foundry documentation: https://book.getfoundry.sh/
- Review deployment logs in
deployments/folder - Contact team for chain-specific issues