Skip to content

Commit 629cebe

Browse files
committed
feat: add implementation deployment scripts and update documentation
- Introduced new scripts for deploying the DonationHandler implementation on both mainnet and sepolia in package.json. - Expanded PRODUCTION_UPGRADE.md with instructions for deploying the implementation without ProxyAdmin access, including verification steps and handoff to the proxy owner.
1 parent b0a1c46 commit 629cebe

3 files changed

Lines changed: 65 additions & 0 deletions

File tree

PRODUCTION_UPGRADE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,39 @@ Based on your deployments:
2121
- [ ] Gas costs acceptable (~1.5M gas per network)
2222
- [ ] Have sufficient ETH/native tokens on all networks
2323

24+
## 🔄 Alternative: Deploy implementation only (not the ProxyAdmin owner)
25+
26+
If you don't have access to the ProxyAdmin owner key, you can still deploy and verify the new implementation. The proxy owner then performs the upgrade on their side.
27+
28+
### 1. Deploy and verify the implementation
29+
30+
```bash
31+
source .env
32+
yarn deploy:implementation:mainnet
33+
# or for testnet first: yarn deploy:implementation:sepolia
34+
```
35+
36+
The script will output the new implementation address. Save it (e.g. `export NEW_IMPLEMENTATION_ADDRESS=0x...`).
37+
38+
### 2. Hand off to the proxy owner
39+
40+
Send the **implementation address** to the ProxyAdmin owner. They should run:
41+
42+
```solidity
43+
proxyAdmin.upgrade(proxy, NEW_IMPLEMENTATION_ADDRESS);
44+
```
45+
46+
Or via `cast`:
47+
48+
```bash
49+
cast send $PROXY_ADMIN_ADDRESS "upgrade(address,address)" $PROXY_ADDRESS $NEW_IMPLEMENTATION_ADDRESS \
50+
--rpc-url $MAINNET_RPC --private-key $OWNER_PRIVATE_KEY
51+
```
52+
53+
No need for you to have proxy or ProxyAdmin addresses in `.env` for this flow; only `PRIVATE_KEY` and RPC URL are required to deploy and verify the implementation.
54+
55+
---
56+
2457
## 🔍 Step 1: Find Your Proxy Addresses
2558

2659
Your proxy addresses are in the broadcast folder. Let's extract them:

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"upgrade:mainnet": "bash -c 'source .env && forge script script/UpgradeDonationHandler.s.sol:UpgradeDonationHandler --rpc-url $MAINNET_RPC --broadcast --verify -vvvv'",
2020
"upgrade:mainnet:simulate": "bash -c 'source .env && forge script script/UpgradeDonationHandler.s.sol:UpgradeDonationHandler --fork-url $MAINNET_RPC -vvvv'",
2121
"upgrade:sepolia": "bash -c 'source .env && forge script script/UpgradeDonationHandler.s.sol:UpgradeDonationHandler --rpc-url $SEPOLIA_RPC --broadcast --verify -vvvv'",
22+
"deploy:implementation:mainnet": "bash -c 'source .env && forge script script/DeployDonationHandlerImplementation.s.sol:DeployDonationHandlerImplementation --rpc-url $MAINNET_RPC --broadcast --verify -vvvv'",
23+
"deploy:implementation:sepolia": "bash -c 'source .env && forge script script/DeployDonationHandlerImplementation.s.sol:DeployDonationHandlerImplementation --rpc-url $SEPOLIA_RPC --broadcast --verify -vvvv'",
2224
"lint:check": "yarn lint:sol && forge fmt --check",
2325
"lint:fix": "sort-package-json && forge fmt && yarn lint:sol --fix",
2426
"lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.22;
3+
4+
/// @notice Deploys and verifies only the DonationHandler implementation (no proxy, no upgrade).
5+
/// Use this when you are not the ProxyAdmin owner: deploy + verify, then give the implementation
6+
/// address to the owner so they can call proxyAdmin.upgrade(proxy, implementationAddress).
7+
8+
import {DonationHandler} from '../src/contracts/DonationHandler.sol';
9+
import {Script} from 'forge-std/Script.sol';
10+
import {console} from 'forge-std/console.sol';
11+
12+
contract DeployDonationHandlerImplementation is Script {
13+
function run() external {
14+
uint256 deployerPrivateKey = vm.envUint('PRIVATE_KEY');
15+
16+
console.log('=== Deploying DonationHandler implementation only ===');
17+
18+
vm.startBroadcast(deployerPrivateKey);
19+
20+
DonationHandler implementation = new DonationHandler();
21+
console.log('Implementation deployed to:', address(implementation));
22+
23+
vm.stopBroadcast();
24+
25+
console.log('\n=== Hand off to proxy owner ===');
26+
console.log('Give this address to the ProxyAdmin owner to run:');
27+
console.log(' proxyAdmin.upgrade(proxy,', address(implementation), ')');
28+
console.log('export NEW_IMPLEMENTATION_ADDRESS=', address(implementation));
29+
}
30+
}

0 commit comments

Comments
 (0)