PeripheryDeployConfig.s.sol 6.82 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// 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;

    address public faucetAdmin;
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
    address public faucetDrippieOwner;
    uint256 public faucetDripV1Value;
    uint256 public faucetDripV1Interval;
    uint256 public faucetDripV1Threshold;
    uint256 public faucetDripV2Value;
    uint256 public faucetDripV2Interval;
    uint256 public faucetDripV2Threshold;
    uint256 public faucetAdminDripV1Value;
    uint256 public faucetAdminDripV1Interval;
    uint256 public faucetAdminDripV1Threshold;
    address public faucetGelatoTreasury;
    address public faucetGelatoRecipient;
    uint256 public faucetGelatoBalanceV1DripInterval;
    uint256 public faucetGelatoBalanceV1Value;
    uint256 public faucetGelatoThreshold;
31
    address public faucetOnchainAuthModuleAdmin;
32 33
    uint256 public faucetOnchainAuthModuleTtl;
    uint256 public faucetOnchainAuthModuleAmount;
34
    address public faucetOffchainAuthModuleAdmin;
35 36
    uint256 public faucetOffchainAuthModuleTtl;
    uint256 public faucetOffchainAuthModuleAmount;
tre's avatar
tre committed
37
    bool public installOpChainFaucetsDrips;
38
    bool public archivePreviousOpChainFaucetsDrips;
tre's avatar
tre committed
39 40 41 42 43 44 45
    uint256 public smallOpChainFaucetDripValue;
    uint256 public smallOpChainFaucetDripInterval;
    uint256 public largeOpChainFaucetDripValue;
    uint256 public largeOpChainFaucetDripInterval;
    uint256 public opChainAdminWalletDripValue;
    uint256 public opChainAdminWalletDripInterval;
    address public opL1BridgeAddress;
tre's avatar
tre committed
46
    address public baseL1BridgeAddress;
tre's avatar
tre committed
47 48 49 50 51 52
    address public zoraL1BridgeAddress;
    address public pgnL1BridgeAddress;
    address public orderlyL1BridgeAddress;
    address public modeL1BridgeAddress;
    address public lyraL1BridgeAddress;
    address[5] public smallFaucetsL1BridgeAddresses;
tre's avatar
tre committed
53
    address[2] public largeFaucetsL1BridgeAddresses;
tre's avatar
tre committed
54
    uint256 public dripVersion;
55
    uint256 public previousDripVersion;
56 57 58 59 60 61 62 63 64 65 66

    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;
        }

        faucetAdmin = stdJson.readAddress(_json, "$.faucetAdmin");
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
        faucetDrippieOwner = stdJson.readAddress(_json, "$.faucetDrippieOwner");
        faucetDripV1Value = stdJson.readUint(_json, "$.faucetDripV1Value");
        faucetDripV1Interval = stdJson.readUint(_json, "$.faucetDripV1Interval");
        faucetDripV1Threshold = stdJson.readUint(_json, "$.faucetDripV1Threshold");
        faucetDripV2Value = stdJson.readUint(_json, "$.faucetDripV2Value");
        faucetDripV2Interval = stdJson.readUint(_json, "$.faucetDripV2Interval");
        faucetDripV2Threshold = stdJson.readUint(_json, "$.faucetDripV2Threshold");
        faucetAdminDripV1Value = stdJson.readUint(_json, "$.faucetAdminDripV1Value");
        faucetAdminDripV1Interval = stdJson.readUint(_json, "$.faucetAdminDripV1Interval");
        faucetAdminDripV1Threshold = stdJson.readUint(_json, "$.faucetAdminDripV1Threshold");
        faucetGelatoTreasury = stdJson.readAddress(_json, "$.faucetGelatoTreasury");
        faucetGelatoRecipient = stdJson.readAddress(_json, "$.faucetGelatoRecipient");
        faucetGelatoBalanceV1DripInterval = stdJson.readUint(_json, "$.faucetGelatoBalanceV1DripInterval");
        faucetGelatoBalanceV1Value = stdJson.readUint(_json, "$.faucetGelatoBalanceV1Value");
        faucetGelatoThreshold = stdJson.readUint(_json, "$.faucetGelatoThreshold");
82
        faucetOnchainAuthModuleAdmin = stdJson.readAddress(_json, "$.faucetOnchainAuthModuleAdmin");
83 84
        faucetOnchainAuthModuleTtl = stdJson.readUint(_json, "$.faucetOnchainAuthModuleTtl");
        faucetOnchainAuthModuleAmount = stdJson.readUint(_json, "$.faucetOnchainAuthModuleAmount");
85
        faucetOffchainAuthModuleAdmin = stdJson.readAddress(_json, "$.faucetOffchainAuthModuleAdmin");
86 87
        faucetOffchainAuthModuleTtl = stdJson.readUint(_json, "$.faucetOffchainAuthModuleTtl");
        faucetOffchainAuthModuleAmount = stdJson.readUint(_json, "$.faucetOffchainAuthModuleAmount");
tre's avatar
tre committed
88
        installOpChainFaucetsDrips = stdJson.readBool(_json, "$.installOpChainFaucetsDrips");
89
        archivePreviousOpChainFaucetsDrips = stdJson.readBool(_json, "$.archivePreviousOpChainFaucetsDrips");
tre's avatar
tre committed
90
        opL1BridgeAddress = stdJson.readAddress(_json, "$.opL1BridgeAddress");
tre's avatar
tre committed
91
        baseL1BridgeAddress = stdJson.readAddress(_json, "$.baseL1BridgeAddress");
tre's avatar
tre committed
92 93 94 95 96 97
        zoraL1BridgeAddress = stdJson.readAddress(_json, "$.zoraL1BridgeAddress");
        pgnL1BridgeAddress = stdJson.readAddress(_json, "$.pgnL1BridgeAddress");
        orderlyL1BridgeAddress = stdJson.readAddress(_json, "$.orderlyL1BridgeAddress");
        modeL1BridgeAddress = stdJson.readAddress(_json, "$.modeL1BridgeAddress");
        lyraL1BridgeAddress = stdJson.readAddress(_json, "$.lyraL1BridgeAddress");
        dripVersion = stdJson.readUint(_json, "$.dripVersion");
98
        previousDripVersion = stdJson.readUint(_json, "$.previousDripVersion");
tre's avatar
tre committed
99 100 101 102 103 104 105
        smallOpChainFaucetDripValue = stdJson.readUint(_json, "$.smallOpChainFaucetDripValue");
        smallOpChainFaucetDripInterval = stdJson.readUint(_json, "$.smallOpChainFaucetDripInterval");
        largeOpChainFaucetDripValue = stdJson.readUint(_json, "$.largeOpChainFaucetDripValue");
        largeOpChainFaucetDripInterval = stdJson.readUint(_json, "$.largeOpChainFaucetDripInterval");
        opChainAdminWalletDripValue = stdJson.readUint(_json, "$.opChainAdminWalletDripValue");
        opChainAdminWalletDripInterval = stdJson.readUint(_json, "$.opChainAdminWalletDripInterval");
        largeFaucetsL1BridgeAddresses[0] = opL1BridgeAddress;
tre's avatar
tre committed
106
        largeFaucetsL1BridgeAddresses[1] = baseL1BridgeAddress;
tre's avatar
tre committed
107 108 109 110 111 112 113 114 115 116 117 118 119
        smallFaucetsL1BridgeAddresses[0] = zoraL1BridgeAddress;
        smallFaucetsL1BridgeAddresses[1] = pgnL1BridgeAddress;
        smallFaucetsL1BridgeAddresses[2] = orderlyL1BridgeAddress;
        smallFaucetsL1BridgeAddresses[3] = modeL1BridgeAddress;
        smallFaucetsL1BridgeAddresses[4] = lyraL1BridgeAddress;
    }

    function getSmallFaucetsL1BridgeAddressesCount() public view returns (uint256 count) {
        return smallFaucetsL1BridgeAddresses.length;
    }

    function getLargeFaucetsL1BridgeAddressesCount() public view returns (uint256 count) {
        return largeFaucetsL1BridgeAddresses.length;
120 121
    }
}