-
Notifications
You must be signed in to change notification settings - Fork 395
Expand file tree
/
Copy pathAlignedProofAggregationServiceDeployer.s.sol
More file actions
55 lines (43 loc) · 2.47 KB
/
AlignedProofAggregationServiceDeployer.s.sol
File metadata and controls
55 lines (43 loc) · 2.47 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pragma solidity ^0.8.12;
import {AlignedProofAggregationService} from "../../src/core/AlignedProofAggregationService.sol";
import {IAlignedProofAggregationService} from "../../src/core/IAlignedProofAggregationService.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "forge-std/Script.sol";
import "forge-std/StdJson.sol";
contract AlignedProofAggregationServiceDeployer is Script {
function run(string memory configPath, string memory outputPath) external returns (address, address) {
string memory config_data = vm.readFile(configPath);
address alignedAggregatorAddress = stdJson.readAddress(config_data, ".address.alignedAggregatorAddress");
address sp1VerifierAddress = stdJson.readAddress(config_data, ".address.sp1VerifierAddress");
bytes32 sp1AggregationProgramVKHash =
stdJson.readBytes32(config_data, ".programs_id.sp1AggregationProgramVKHash");
address risc0VerifierAddress = stdJson.readAddress(config_data, ".address.risc0VerifierAddress");
bytes32 risc0AggregationProgramImageId =
stdJson.readBytes32(config_data, ".programs_id.risc0AggregationProgramImageId");
address ownerAddress = stdJson.readAddress(config_data, ".permissions.owner");
vm.startBroadcast();
AlignedProofAggregationService alignedProofAggregationService = new AlignedProofAggregationService();
ERC1967Proxy proxy = new ERC1967Proxy(
address(alignedProofAggregationService),
abi.encodeWithSignature(
"initialize(address,address,address,address,bytes32,bytes32)",
ownerAddress,
alignedAggregatorAddress,
sp1VerifierAddress,
risc0VerifierAddress,
risc0AggregationProgramImageId,
sp1AggregationProgramVKHash
)
);
vm.stopBroadcast();
string memory addresses = "addresses";
vm.serializeAddress(addresses, "alignedProofAggregationService", address(proxy));
string memory addressesStr = vm.serializeAddress(
addresses, "alignedProofAggregationServiceImplementation", address(alignedProofAggregationService)
);
string memory parentObject = "parent";
string memory finalJson = vm.serializeString(parentObject, "addresses", addressesStr);
vm.writeJson(finalJson, outputPath);
return (address(proxy), address(alignedProofAggregationService));
}
}