-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathAggregationModePaymentServiceDeployer.s.sol
More file actions
35 lines (25 loc) · 1.5 KB
/
AggregationModePaymentServiceDeployer.s.sol
File metadata and controls
35 lines (25 loc) · 1.5 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
pragma solidity ^0.8.12;
import {AggregationModePaymentService} from "../../src/core/AggregationModePaymentService.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "forge-std/Script.sol";
import "forge-std/StdJson.sol";
contract AggregationModePaymentServiceDeployer is Script {
function run(string memory configPath, string memory outputPath) external returns (address, address) {
string memory configData = vm.readFile(configPath);
address owner = stdJson.readAddress(configData, ".permissions.paymentServiceOwner");
address recipient = stdJson.readAddress(configData, ".permissions.recipient");
vm.startBroadcast();
AggregationModePaymentService implementation = new AggregationModePaymentService();
ERC1967Proxy proxy =
new ERC1967Proxy(address(implementation), abi.encodeWithSignature("initialize(address,address)", owner, recipient));
vm.stopBroadcast();
string memory addresses = "addresses";
vm.serializeAddress(addresses, "aggregationModePaymentService", address(proxy));
string memory addressesStr =
vm.serializeAddress(addresses, "aggregationModePaymentServiceImplementation", address(implementation));
string memory parentObject = "parent";
string memory finalJson = vm.serializeString(parentObject, "addresses", addressesStr);
vm.writeJson(finalJson, outputPath);
return (address(proxy), address(implementation));
}
}