@@ -5,10 +5,10 @@ import "forge-std/Vm.sol";
55import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol " ;
66import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
77
8- import { EmptyContract } from "../src/utils/EmptyContract.sol " ;
9- import { BLSApkRegistry } from "../src/bls/BLSApkRegistry.sol " ;
10- import { OracleManager } from "../src/core/OracleManager.sol " ;
11- import { console, Script } from "forge-std/Script.sol " ;
8+ import {EmptyContract} from "../ ../src/utils/EmptyContract.sol " ;
9+ import {BLSApkRegistry} from "../ ../src/bls/BLSApkRegistry.sol " ;
10+ import {OracleManager} from "../ ../src/core/OracleManager.sol " ;
11+ import {console, Script} from "forge-std/Script.sol " ;
1212
1313contract deployOracleScript is Script {
1414 EmptyContract public emptyContract;
@@ -24,53 +24,56 @@ contract deployOracleScript is Script {
2424
2525 function run () public {
2626 uint256 deployerPrivateKey = vm.envUint ("PRIVATE_KEY " );
27- address relayerManagerAddr = vm.envAddress ("RELAYER_MANAGER " );
27+ address relayerManagerAddr = vm.envAddress ("RELAYER_MANAGER " );
2828
2929 address deployerAddress = vm.addr (deployerPrivateKey);
3030 vm.startBroadcast (deployerPrivateKey);
3131
32+ // Deploy BLSApkRegistry proxy and delegate to a empty contract first
3233 emptyContract = new EmptyContract ();
33- TransparentUpgradeableProxy proxyBlsApkRegistry = new TransparentUpgradeableProxy (address (emptyContract), deployerAddress, "" );
34+ TransparentUpgradeableProxy proxyBlsApkRegistry =
35+ new TransparentUpgradeableProxy (address (emptyContract), deployerAddress, "" );
3436 blsApkRegistry = BLSApkRegistry (address (proxyBlsApkRegistry));
3537 blsApkRegistryImplementation = new BLSApkRegistry ();
3638 blsApkRegistryProxyAdmin = ProxyAdmin (getProxyAdminAddress (address (proxyBlsApkRegistry)));
3739
38-
39- TransparentUpgradeableProxy proxyOracleManager = new TransparentUpgradeableProxy (address (emptyContract), deployerAddress, "" );
40+ // Deploy OracleManager proxy and delegate to a empty contract first
41+ TransparentUpgradeableProxy proxyOracleManager =
42+ new TransparentUpgradeableProxy (address (emptyContract), deployerAddress, "" );
4043 oracleManager = OracleManager (address (proxyOracleManager));
4144 oracleManagerImplementation = new OracleManager ();
4245 oracleManagerAdmin = ProxyAdmin (getProxyAdminAddress (address (proxyOracleManager)));
4346
44-
47+ // Upgrade and initialize the implementations
4548 blsApkRegistryProxyAdmin.upgradeAndCall (
4649 ITransparentUpgradeableProxy (address (blsApkRegistry)),
4750 address (blsApkRegistryImplementation),
4851 abi.encodeWithSelector (
49- BLSApkRegistry.initialize.selector ,
50- deployerAddress,
51- relayerManagerAddr,
52- address (proxyOracleManager)
52+ BLSApkRegistry.initialize.selector , deployerAddress, relayerManagerAddr, address (proxyOracleManager)
5353 )
5454 );
5555
5656 oracleManagerAdmin.upgradeAndCall (
5757 ITransparentUpgradeableProxy (address (oracleManager)),
5858 address (oracleManagerImplementation),
5959 abi.encodeWithSelector (
60- OracleManager.initialize.selector ,
61- deployerAddress,
62- proxyBlsApkRegistry,
63- deployerAddress
60+ OracleManager.initialize.selector , deployerAddress, proxyBlsApkRegistry, deployerAddress
6461 )
6562 );
6663
6764 console.log ("deploy proxyBlsApkRegistry: " , address (proxyBlsApkRegistry));
6865 console.log ("deploy proxyOracleManager: " , address (proxyOracleManager));
6966 string memory path = "deployed_addresses.json " ;
70- string memory data = string (abi.encodePacked (
71- '{"proxyBlsApkRegistry": " ' , vm.toString (address (proxyBlsApkRegistry)), '", ' ,
72- '"proxyOracleManager": " ' , vm.toString (address (proxyOracleManager)), '"} '
73- ));
67+ string memory data = string (
68+ abi.encodePacked (
69+ '{"proxyBlsApkRegistry": " ' ,
70+ vm.toString (address (proxyBlsApkRegistry)),
71+ '", ' ,
72+ '"proxyOracleManager": " ' ,
73+ vm.toString (address (proxyOracleManager)),
74+ '"} '
75+ )
76+ );
7477 vm.writeJson (data, path);
7578 vm.stopBroadcast ();
7679 }
0 commit comments