generated from BreadchainCoop/solidity-foundry-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathUpgradeValidate.s.sol
More file actions
39 lines (31 loc) · 1.6 KB
/
UpgradeValidate.s.sol
File metadata and controls
39 lines (31 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {ProxyAdmin} from '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol';
import {console2} from 'forge-std/console2.sol';
import {Common} from 'script/Common.sol';
import {SavingCircles} from 'src/contracts/SavingCircles.sol';
contract UpgradeValidate is Common {
error NewImplementationHasNoCode(address implementation);
error NewImplementationMatchesCurrent(address implementation);
function run() public view {
address proxy = vm.envAddress('PROXY_ADDRESS');
address expectedAdminOwner = vm.envAddress('EXPECTED_ADMIN_OWNER');
address expectedCurrentImplementation = vm.envAddress('EXPECTED_CURRENT_IMPLEMENTATION');
address newImplementation = vm.envAddress('NEW_IMPLEMENTATION');
address proxyAdmin = _assertDeployment(proxy, expectedCurrentImplementation, expectedAdminOwner);
if (newImplementation.code.length == 0) revert NewImplementationHasNoCode(newImplementation);
if (newImplementation == expectedCurrentImplementation) {
revert NewImplementationMatchesCurrent(newImplementation);
}
// Lightweight smoke check against proxy to confirm implementation responds.
uint256 nextId = SavingCircles(proxy).nextId();
console2.log('Validation successful');
console2.log('Proxy', proxy);
console2.log('ProxyAdmin', proxyAdmin);
console2.log('AdminOwner', ProxyAdmin(proxyAdmin).owner());
console2.log('CurrentImplementation', expectedCurrentImplementation);
console2.log('NewImplementation', newImplementation);
console2.log('SmokeCheck.nextId');
console2.log(nextId);
}
}