-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
Copy pathPeripheryDeployConfig.s.sol
76 lines (61 loc) · 3.28 KB
/
PeripheryDeployConfig.s.sol
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol";
import { stdJson } from "forge-std/StdJson.sol";
/// @title PeripheryDeployConfig
/// @notice Represents the configuration required to deploy the periphery contracts. It is expected
/// to read the file from JSON. A future improvement would be to have fallback
/// values if they are not defined in the JSON themselves.
contract PeripheryDeployConfig is Script {
string internal _json;
// General configuration.
string public create2DeploymentSalt;
// Configuration for Gelato.
address public gelatoAutomateContract;
// Configuration for standard operations Drippie contract.
address public operationsDrippieOwner;
// Configuration for the faucet Drippie contract.
address public faucetDrippieOwner;
// Configuration for the Faucet contract.
address public faucetAdmin;
address public faucetOnchainAuthModuleAdmin;
uint256 public faucetOnchainAuthModuleTtl;
uint256 public faucetOnchainAuthModuleAmount;
address public faucetOffchainAuthModuleAdmin;
uint256 public faucetOffchainAuthModuleTtl;
uint256 public faucetOffchainAuthModuleAmount;
// Configuration booleans.
bool public deployDripchecks;
bool public deployFaucetContracts;
bool public deployOperationsContracts;
constructor(string memory _path) {
console.log("PeripheryDeployConfig: reading file %s", _path);
try vm.readFile(_path) returns (string memory data) {
_json = data;
} catch {
console.log("Warning: unable to read config. Do not deploy unless you are not using config.");
return;
}
// General configuration.
create2DeploymentSalt = stdJson.readString(_json, "$.create2DeploymentSalt");
// Configuration for Gelato.
gelatoAutomateContract = stdJson.readAddress(_json, "$.gelatoAutomateContract");
// Configuration for the standard operations Drippie contract.
operationsDrippieOwner = stdJson.readAddress(_json, "$.operationsDrippieOwner");
// Configuration for the faucet Drippie contract.
faucetDrippieOwner = stdJson.readAddress(_json, "$.faucetDrippieOwner");
// Configuration for the Faucet contract.
faucetAdmin = stdJson.readAddress(_json, "$.faucetAdmin");
faucetOnchainAuthModuleAdmin = stdJson.readAddress(_json, "$.faucetOnchainAuthModuleAdmin");
faucetOnchainAuthModuleTtl = stdJson.readUint(_json, "$.faucetOnchainAuthModuleTtl");
faucetOnchainAuthModuleAmount = stdJson.readUint(_json, "$.faucetOnchainAuthModuleAmount");
faucetOffchainAuthModuleAdmin = stdJson.readAddress(_json, "$.faucetOffchainAuthModuleAdmin");
faucetOffchainAuthModuleTtl = stdJson.readUint(_json, "$.faucetOffchainAuthModuleTtl");
faucetOffchainAuthModuleAmount = stdJson.readUint(_json, "$.faucetOffchainAuthModuleAmount");
// Configuration booleans.
deployDripchecks = stdJson.readBool(_json, "$.deployDripchecks");
deployFaucetContracts = stdJson.readBool(_json, "$.deployFaucetContracts");
deployOperationsContracts = stdJson.readBool(_json, "$.deployOperationsContracts");
}
}