From c6cd795fefdcbbcb93c60421a32f596950f3d90e Mon Sep 17 00:00:00 2001 From: tre Date: Tue, 31 Oct 2023 17:03:49 -0700 Subject: [PATCH 1/3] Configure scripts for drippie --- .../periphery-deploy-config/4460.json | 16 +- .../periphery-deploy-config/58008.json | 16 +- .../periphery-deploy-config/84532.json | 16 +- .../periphery-deploy-config/901.json | 16 +- .../periphery-deploy-config/919.json | 16 +- .../periphery-deploy-config/999999999.json | 16 +- .../optimism-goerli.json | 16 +- .../optimism-sepolia.json | 16 +- .../periphery-deploy-config/sepolia.json | 38 ++++ .../scripts/DeployPeriphery.s.sol | 178 ++++++++++++++++++ .../scripts/PeripheryDeployConfig.s.sol | 44 +++++ 11 files changed, 380 insertions(+), 8 deletions(-) create mode 100644 packages/contracts-bedrock/periphery-deploy-config/sepolia.json diff --git a/packages/contracts-bedrock/periphery-deploy-config/4460.json b/packages/contracts-bedrock/periphery-deploy-config/4460.json index a429b89f9a69..f52288d9ce57 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/4460.json +++ b/packages/contracts-bedrock/periphery-deploy-config/4460.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/58008.json b/packages/contracts-bedrock/periphery-deploy-config/58008.json index a429b89f9a69..f52288d9ce57 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/58008.json +++ b/packages/contracts-bedrock/periphery-deploy-config/58008.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/84532.json b/packages/contracts-bedrock/periphery-deploy-config/84532.json index a429b89f9a69..f52288d9ce57 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/84532.json +++ b/packages/contracts-bedrock/periphery-deploy-config/84532.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/901.json b/packages/contracts-bedrock/periphery-deploy-config/901.json index a429b89f9a69..f52288d9ce57 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/901.json +++ b/packages/contracts-bedrock/periphery-deploy-config/901.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/919.json b/packages/contracts-bedrock/periphery-deploy-config/919.json index a429b89f9a69..f52288d9ce57 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/919.json +++ b/packages/contracts-bedrock/periphery-deploy-config/919.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/999999999.json b/packages/contracts-bedrock/periphery-deploy-config/999999999.json index a429b89f9a69..f52288d9ce57 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/999999999.json +++ b/packages/contracts-bedrock/periphery-deploy-config/999999999.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json b/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json index a429b89f9a69..7d369d97a179 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json +++ b/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0x636Af16bf2f682dD3109e60102b8E1A089FedAa8", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json b/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json index a429b89f9a69..f52288d9ce57 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json +++ b/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json @@ -20,5 +20,19 @@ "faucetOnchainAuthModuleAmount": 1000000000000000000, "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", "faucetOffchainAuthModuleTtl": 86400, - "faucetOffchainAuthModuleAmount": 50000000000000000 + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": false, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 } diff --git a/packages/contracts-bedrock/periphery-deploy-config/sepolia.json b/packages/contracts-bedrock/periphery-deploy-config/sepolia.json new file mode 100644 index 000000000000..70e8b5aa5141 --- /dev/null +++ b/packages/contracts-bedrock/periphery-deploy-config/sepolia.json @@ -0,0 +1,38 @@ +{ + "faucetAdmin": "0x212E789D4523D4BAF464f8Fb2A9B9dff2B36e5A6", + "faucetDrippieOwner": "0x10ab157483dd308f8B38aCF2ad823dfD255F56b5", + "faucetDripV1Value": 20000000000000000000, + "faucetDripV1Interval": 3600, + "faucetDripV1Threshold": 100000000000000000000, + "faucetDripV2Interval": 604800, + "faucetDripV2Threshold": 20000000000000000000, + "faucetDripV2Value": 500000000000000000000, + "faucetAdminDripV1Interval": 86400, + "faucetAdminDripV1Threshold": 100000000000000000, + "faucetAdminDripV1Value": 1000000000000000000, + "faucetGelatoTreasury": "0x644CB00854EDC55FE8CCC9c1967BABb22F08Ad2f", + "faucetGelatoRecipient": "0x0E9b4649eB0760A4F01646636E032D68cFDe58FF", + "faucetGelatoBalanceV1DripInterval": 86400, + "faucetGelatoBalanceV1Value": 1000000000000000000, + "faucetGelatoThreshold": 100000000000000000, + "faucetOnchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", + "faucetOnchainAuthModuleTtl": 86400, + "faucetOnchainAuthModuleAmount": 1000000000000000000, + "faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC", + "faucetOffchainAuthModuleTtl": 86400, + "faucetOffchainAuthModuleAmount": 50000000000000000, + "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", + "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", + "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", + "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", + "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", + "installOpChainFaucetsDrips": true, + "dripVersion": 1, + "smallOpChainFaucetDripValue": 2000000000000000000, + "smallOpChainFaucetDripInterval": 86400, + "largeOpChainFaucetDripValue": 34000000000000000000, + "largeOpChainFaucetDripInterval": 86400, + "opChainAdminWalletDripValue": 1000000000000000000, + "opChainAdminWalletDripInterval": 2592000 +} diff --git a/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol b/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol index 9099a21a02ce..aa4f614f8a1c 100644 --- a/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol +++ b/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol @@ -47,6 +47,10 @@ contract DeployPeriphery is Deployer { initializeFaucet(); installFaucetAuthModulesConfigs(); + + if (cfg.installOpChainFaucetsDrips()) { + installOpChainFaucetsDrippieConfigs(); + } } /// @notice Deploy all of the proxies @@ -264,6 +268,180 @@ contract DeployPeriphery is Deployer { console.log("Faucet drip configs successfully installed"); } + /// @notice installs drip configs that deposit funds to all OP Chain faucets. This function + /// should only be called on an L1 testnet. + function installOpChainFaucetsDrippieConfigs() public { + uint256 drippieOwnerPrivateKey = vm.envUint("DRIPPIE_OWNER_PRIVATE_KEY"); + vm.startBroadcast(drippieOwnerPrivateKey); + + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + console.log("Installing OP Chain faucet drips at %s", address(drippie)); + installSmallOpChainFaucetsDrips(); + installLargeOpChainFaucetsDrips(); + installSmallOpChainAdminWalletDrips(); + installLargeOpChainAdminWalletDrips(); + + vm.stopBroadcast(); + + console.log("OP chain faucet drip configs successfully installed"); + } + + /// @notice installs drips that send funds to small OP chain faucets on the scheduled interval. + function installSmallOpChainFaucetsDrips() public { + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + address faucetProxy = mustGetAddress("FaucetProxy"); + uint256 arrayLength = cfg.getSmallFaucetsL1BridgeAddressesCount(); + for (uint256 i = 0; i < arrayLength; i++) { + address l1BridgeAddress = cfg.smallFaucetsL1BridgeAddresses(i); + string memory dripNamePrefix = string.concat("faucet-drip-", vm.toString(l1BridgeAddress)); + string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); + string memory dripName = string.concat(dripNamePrefix, versionSuffix); + if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { + console.log("installing %s", dripName); + Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); + actions[0] = Drippie.DripAction({ + target: payable(l1BridgeAddress), + data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", faucetProxy, 200000, ""), + value: cfg.smallOpChainFaucetDripValue() + }); + drippie.create({ + _name: dripName, + _config: Drippie.DripConfig({ + reentrant: false, + interval: cfg.smallOpChainFaucetDripInterval(), + dripcheck: CheckTrue(mustGetAddress("CheckTrue")), + checkparams: abi.encode(""), + actions: actions + }) + }); + console.log("%s installed successfully", dripName); + } else { + console.log("%s already installed.", dripName); + } + + _activateIfPausedDrip(drippie, dripName); + } + } + + /// @notice installs drips that send funds to small OP chain faucets on the scheduled interval. + function installSmallOpChainAdminWalletDrips() public { + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + require( + cfg.faucetOnchainAuthModuleAdmin() == cfg.faucetOffchainAuthModuleAdmin(), + "installSmallOpChainAdminWalletDrips: Only handles identical admin wallet addresses" + ); + address adminWallet = cfg.faucetOnchainAuthModuleAdmin(); + uint256 arrayLength = cfg.getSmallFaucetsL1BridgeAddressesCount(); + for (uint256 i = 0; i < arrayLength; i++) { + address l1BridgeAddress = cfg.smallFaucetsL1BridgeAddresses(i); + string memory dripNamePrefix = string.concat("faucet-admin-drip-", vm.toString(l1BridgeAddress)); + string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); + string memory dripName = string.concat(dripNamePrefix, versionSuffix); + if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { + console.log("installing %s", dripName); + Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); + actions[0] = Drippie.DripAction({ + target: payable(l1BridgeAddress), + data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", adminWallet, 200000, ""), + value: cfg.opChainAdminWalletDripValue() + }); + drippie.create({ + _name: dripName, + _config: Drippie.DripConfig({ + reentrant: false, + interval: cfg.opChainAdminWalletDripInterval(), + dripcheck: CheckTrue(mustGetAddress("CheckTrue")), + checkparams: abi.encode(""), + actions: actions + }) + }); + console.log("%s installed successfully", dripName); + } else { + console.log("%s already installed.", dripName); + } + + _activateIfPausedDrip(drippie, dripName); + } + } + + /// @notice installs drips that send funds to small OP chain faucets on the scheduled interval. + function installLargeOpChainAdminWalletDrips() public { + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + require( + cfg.faucetOnchainAuthModuleAdmin() == cfg.faucetOffchainAuthModuleAdmin(), + "installLargeOpChainAdminWalletDrips: Only handles identical admin wallet addresses" + ); + address adminWallet = cfg.faucetOnchainAuthModuleAdmin(); + uint256 arrayLength = cfg.getLargeFaucetsL1BridgeAddressesCount(); + for (uint256 i = 0; i < arrayLength; i++) { + address l1BridgeAddress = cfg.largeFaucetsL1BridgeAddresses(i); + string memory dripNamePrefix = string.concat("faucet-admin-drip-", vm.toString(l1BridgeAddress)); + string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); + string memory dripName = string.concat(dripNamePrefix, versionSuffix); + if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { + console.log("installing %s", dripName); + Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); + actions[0] = Drippie.DripAction({ + target: payable(l1BridgeAddress), + data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", adminWallet, 200000, ""), + value: cfg.opChainAdminWalletDripValue() + }); + drippie.create({ + _name: dripName, + _config: Drippie.DripConfig({ + reentrant: false, + interval: cfg.opChainAdminWalletDripInterval(), + dripcheck: CheckTrue(mustGetAddress("CheckTrue")), + checkparams: abi.encode(""), + actions: actions + }) + }); + console.log("%s installed successfully", dripName); + } else { + console.log("%s already installed.", dripName); + } + + _activateIfPausedDrip(drippie, dripName); + } + } + + /// @notice installs drips that send funds to large OP chain faucets on the scheduled interval. + function installLargeOpChainFaucetsDrips() public { + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + address faucetProxy = mustGetAddress("FaucetProxy"); + uint256 arrayLength = cfg.getLargeFaucetsL1BridgeAddressesCount(); + for (uint256 i = 0; i < arrayLength; i++) { + address l1BridgeAddress = cfg.largeFaucetsL1BridgeAddresses(i); + string memory dripNamePrefix = string.concat("faucet-drip-", vm.toString(l1BridgeAddress)); + string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); + string memory dripName = string.concat(dripNamePrefix, versionSuffix); + if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { + console.log("installing %s", dripName); + Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); + actions[0] = Drippie.DripAction({ + target: payable(l1BridgeAddress), + data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", faucetProxy, 200000, ""), + value: cfg.smallOpChainFaucetDripValue() + }); + drippie.create({ + _name: dripName, + _config: Drippie.DripConfig({ + reentrant: false, + interval: cfg.smallOpChainFaucetDripInterval(), + dripcheck: CheckTrue(mustGetAddress("CheckTrue")), + checkparams: abi.encode(""), + actions: actions + }) + }); + console.log("%s installed successfully", dripName); + } else { + console.log("%s already installed.", dripName); + } + + _activateIfPausedDrip(drippie, dripName); + } + } + /// @notice installs the FaucetDripV1 drip on the faucet drippie contract. function installFaucetDripV1() public broadcast { Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); diff --git a/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol b/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol index 900d6b898950..c00ecbc74e1c 100644 --- a/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol +++ b/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol @@ -34,6 +34,22 @@ contract PeripheryDeployConfig is Script { address public faucetOffchainAuthModuleAdmin; uint256 public faucetOffchainAuthModuleTtl; uint256 public faucetOffchainAuthModuleAmount; + bool public installOpChainFaucetsDrips; + uint256 public smallOpChainFaucetDripValue; + uint256 public smallOpChainFaucetDripInterval; + uint256 public largeOpChainFaucetDripValue; + uint256 public largeOpChainFaucetDripInterval; + uint256 public opChainAdminWalletDripValue; + uint256 public opChainAdminWalletDripInterval; + address public opL1BridgeAddress; + address public zoraL1BridgeAddress; + address public pgnL1BridgeAddress; + address public orderlyL1BridgeAddress; + address public modeL1BridgeAddress; + address public lyraL1BridgeAddress; + address[5] public smallFaucetsL1BridgeAddresses; + address[1] public largeFaucetsL1BridgeAddresses; + uint256 public dripVersion; constructor(string memory _path) { console.log("PeripheryDeployConfig: reading file %s", _path); @@ -66,5 +82,33 @@ contract PeripheryDeployConfig is Script { faucetOffchainAuthModuleAdmin = stdJson.readAddress(_json, "$.faucetOffchainAuthModuleAdmin"); faucetOffchainAuthModuleTtl = stdJson.readUint(_json, "$.faucetOffchainAuthModuleTtl"); faucetOffchainAuthModuleAmount = stdJson.readUint(_json, "$.faucetOffchainAuthModuleAmount"); + installOpChainFaucetsDrips = stdJson.readBool(_json, "$.installOpChainFaucetsDrips"); + opL1BridgeAddress = stdJson.readAddress(_json, "$.opL1BridgeAddress"); + 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"); + 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; + 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; } } From f4b6aa35f6ab8c343481f5a843af5962002f7933 Mon Sep 17 00:00:00 2001 From: tre Date: Wed, 1 Nov 2023 14:25:24 -0700 Subject: [PATCH 2/3] Add Base faucet to drippie --- packages/contracts-bedrock/periphery-deploy-config/4460.json | 1 + .../contracts-bedrock/periphery-deploy-config/58008.json | 1 + .../contracts-bedrock/periphery-deploy-config/84532.json | 1 + packages/contracts-bedrock/periphery-deploy-config/901.json | 1 + packages/contracts-bedrock/periphery-deploy-config/919.json | 1 + .../contracts-bedrock/periphery-deploy-config/999999999.json | 1 + .../periphery-deploy-config/optimism-goerli.json | 1 + .../periphery-deploy-config/optimism-sepolia.json | 1 + .../contracts-bedrock/periphery-deploy-config/sepolia.json | 1 + .../contracts-bedrock/scripts/PeripheryDeployConfig.s.sol | 5 ++++- 10 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/contracts-bedrock/periphery-deploy-config/4460.json b/packages/contracts-bedrock/periphery-deploy-config/4460.json index f52288d9ce57..3aea969e5dce 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/4460.json +++ b/packages/contracts-bedrock/periphery-deploy-config/4460.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/58008.json b/packages/contracts-bedrock/periphery-deploy-config/58008.json index f52288d9ce57..3aea969e5dce 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/58008.json +++ b/packages/contracts-bedrock/periphery-deploy-config/58008.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/84532.json b/packages/contracts-bedrock/periphery-deploy-config/84532.json index f52288d9ce57..3aea969e5dce 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/84532.json +++ b/packages/contracts-bedrock/periphery-deploy-config/84532.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/901.json b/packages/contracts-bedrock/periphery-deploy-config/901.json index f52288d9ce57..3aea969e5dce 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/901.json +++ b/packages/contracts-bedrock/periphery-deploy-config/901.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/919.json b/packages/contracts-bedrock/periphery-deploy-config/919.json index f52288d9ce57..3aea969e5dce 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/919.json +++ b/packages/contracts-bedrock/periphery-deploy-config/919.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/999999999.json b/packages/contracts-bedrock/periphery-deploy-config/999999999.json index f52288d9ce57..3aea969e5dce 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/999999999.json +++ b/packages/contracts-bedrock/periphery-deploy-config/999999999.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json b/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json index 7d369d97a179..906d5f9990c1 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json +++ b/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0x636Af16bf2f682dD3109e60102b8E1A089FedAa8", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json b/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json index f52288d9ce57..3aea969e5dce 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json +++ b/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/periphery-deploy-config/sepolia.json b/packages/contracts-bedrock/periphery-deploy-config/sepolia.json index 70e8b5aa5141..1bba77af8b51 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/sepolia.json +++ b/packages/contracts-bedrock/periphery-deploy-config/sepolia.json @@ -22,6 +22,7 @@ "faucetOffchainAuthModuleTtl": 86400, "faucetOffchainAuthModuleAmount": 50000000000000000, "opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", + "baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", "pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3", "zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", "orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333", diff --git a/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol b/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol index c00ecbc74e1c..4838a3badaa7 100644 --- a/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol +++ b/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol @@ -42,13 +42,14 @@ contract PeripheryDeployConfig is Script { uint256 public opChainAdminWalletDripValue; uint256 public opChainAdminWalletDripInterval; address public opL1BridgeAddress; + address public baseL1BridgeAddress; address public zoraL1BridgeAddress; address public pgnL1BridgeAddress; address public orderlyL1BridgeAddress; address public modeL1BridgeAddress; address public lyraL1BridgeAddress; address[5] public smallFaucetsL1BridgeAddresses; - address[1] public largeFaucetsL1BridgeAddresses; + address[2] public largeFaucetsL1BridgeAddresses; uint256 public dripVersion; constructor(string memory _path) { @@ -84,6 +85,7 @@ contract PeripheryDeployConfig is Script { faucetOffchainAuthModuleAmount = stdJson.readUint(_json, "$.faucetOffchainAuthModuleAmount"); installOpChainFaucetsDrips = stdJson.readBool(_json, "$.installOpChainFaucetsDrips"); opL1BridgeAddress = stdJson.readAddress(_json, "$.opL1BridgeAddress"); + baseL1BridgeAddress = stdJson.readAddress(_json, "$.baseL1BridgeAddress"); zoraL1BridgeAddress = stdJson.readAddress(_json, "$.zoraL1BridgeAddress"); pgnL1BridgeAddress = stdJson.readAddress(_json, "$.pgnL1BridgeAddress"); orderlyL1BridgeAddress = stdJson.readAddress(_json, "$.orderlyL1BridgeAddress"); @@ -97,6 +99,7 @@ contract PeripheryDeployConfig is Script { opChainAdminWalletDripValue = stdJson.readUint(_json, "$.opChainAdminWalletDripValue"); opChainAdminWalletDripInterval = stdJson.readUint(_json, "$.opChainAdminWalletDripInterval"); largeFaucetsL1BridgeAddresses[0] = opL1BridgeAddress; + largeFaucetsL1BridgeAddresses[1] = baseL1BridgeAddress; smallFaucetsL1BridgeAddresses[0] = zoraL1BridgeAddress; smallFaucetsL1BridgeAddresses[1] = pgnL1BridgeAddress; smallFaucetsL1BridgeAddresses[2] = orderlyL1BridgeAddress; From a0e578856547494d92c79b82e7b243c28841cd49 Mon Sep 17 00:00:00 2001 From: tre Date: Wed, 1 Nov 2023 15:48:40 -0700 Subject: [PATCH 3/3] Add ability to archive previous drip configs --- .../periphery-deploy-config/4460.json | 2 + .../periphery-deploy-config/58008.json | 2 + .../periphery-deploy-config/84532.json | 2 + .../periphery-deploy-config/901.json | 2 + .../periphery-deploy-config/919.json | 2 + .../periphery-deploy-config/999999999.json | 2 + .../optimism-goerli.json | 2 + .../optimism-sepolia.json | 2 + .../periphery-deploy-config/sepolia.json | 4 +- .../scripts/DeployPeriphery.s.sol | 276 ++++++++++-------- .../scripts/PeripheryDeployConfig.s.sol | 4 + 11 files changed, 185 insertions(+), 115 deletions(-) diff --git a/packages/contracts-bedrock/periphery-deploy-config/4460.json b/packages/contracts-bedrock/periphery-deploy-config/4460.json index 3aea969e5dce..baa776ddd80a 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/4460.json +++ b/packages/contracts-bedrock/periphery-deploy-config/4460.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/58008.json b/packages/contracts-bedrock/periphery-deploy-config/58008.json index 3aea969e5dce..baa776ddd80a 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/58008.json +++ b/packages/contracts-bedrock/periphery-deploy-config/58008.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/84532.json b/packages/contracts-bedrock/periphery-deploy-config/84532.json index 3aea969e5dce..baa776ddd80a 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/84532.json +++ b/packages/contracts-bedrock/periphery-deploy-config/84532.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/901.json b/packages/contracts-bedrock/periphery-deploy-config/901.json index 3aea969e5dce..baa776ddd80a 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/901.json +++ b/packages/contracts-bedrock/periphery-deploy-config/901.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/919.json b/packages/contracts-bedrock/periphery-deploy-config/919.json index 3aea969e5dce..baa776ddd80a 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/919.json +++ b/packages/contracts-bedrock/periphery-deploy-config/919.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/999999999.json b/packages/contracts-bedrock/periphery-deploy-config/999999999.json index 3aea969e5dce..baa776ddd80a 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/999999999.json +++ b/packages/contracts-bedrock/periphery-deploy-config/999999999.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json b/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json index 906d5f9990c1..4ba3a39a8d13 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json +++ b/packages/contracts-bedrock/periphery-deploy-config/optimism-goerli.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json b/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json index 3aea969e5dce..baa776ddd80a 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json +++ b/packages/contracts-bedrock/periphery-deploy-config/optimism-sepolia.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": false, + "archivePreviousOpChainFaucetsDrips": false, "dripVersion": 1, + "previousDripVersion": 0, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/periphery-deploy-config/sepolia.json b/packages/contracts-bedrock/periphery-deploy-config/sepolia.json index 1bba77af8b51..d4c80d010480 100644 --- a/packages/contracts-bedrock/periphery-deploy-config/sepolia.json +++ b/packages/contracts-bedrock/periphery-deploy-config/sepolia.json @@ -29,7 +29,9 @@ "modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2", "lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17", "installOpChainFaucetsDrips": true, - "dripVersion": 1, + "archivePreviousOpChainFaucetsDrips": false, + "dripVersion": 2, + "previousDripVersion": 1, "smallOpChainFaucetDripValue": 2000000000000000000, "smallOpChainFaucetDripInterval": 86400, "largeOpChainFaucetDripValue": 34000000000000000000, diff --git a/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol b/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol index aa4f614f8a1c..d0659223cea3 100644 --- a/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol +++ b/packages/contracts-bedrock/scripts/DeployPeriphery.s.sol @@ -51,6 +51,10 @@ contract DeployPeriphery is Deployer { if (cfg.installOpChainFaucetsDrips()) { installOpChainFaucetsDrippieConfigs(); } + + if (cfg.archivePreviousOpChainFaucetsDrips()) { + archivePreviousOpChainFaucetsDrippieConfigs(); + } } /// @notice Deploy all of the proxies @@ -286,46 +290,40 @@ contract DeployPeriphery is Deployer { console.log("OP chain faucet drip configs successfully installed"); } + /// @notice archives the previous OP Chain drip configs. + function archivePreviousOpChainFaucetsDrippieConfigs() public { + uint256 drippieOwnerPrivateKey = vm.envUint("DRIPPIE_OWNER_PRIVATE_KEY"); + vm.startBroadcast(drippieOwnerPrivateKey); + + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + console.log("Archiving OP Chain faucet drips at %s", address(drippie)); + archivePreviousSmallOpChainFaucetsDrips(); + archivePreviousLargeOpChainFaucetsDrips(); + + vm.stopBroadcast(); + + console.log("OP chain faucet drip configs successfully installed"); + } + /// @notice installs drips that send funds to small OP chain faucets on the scheduled interval. function installSmallOpChainFaucetsDrips() public { - Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); address faucetProxy = mustGetAddress("FaucetProxy"); uint256 arrayLength = cfg.getSmallFaucetsL1BridgeAddressesCount(); for (uint256 i = 0; i < arrayLength; i++) { address l1BridgeAddress = cfg.smallFaucetsL1BridgeAddresses(i); - string memory dripNamePrefix = string.concat("faucet-drip-", vm.toString(l1BridgeAddress)); - string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); - string memory dripName = string.concat(dripNamePrefix, versionSuffix); - if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { - console.log("installing %s", dripName); - Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); - actions[0] = Drippie.DripAction({ - target: payable(l1BridgeAddress), - data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", faucetProxy, 200000, ""), - value: cfg.smallOpChainFaucetDripValue() - }); - drippie.create({ - _name: dripName, - _config: Drippie.DripConfig({ - reentrant: false, - interval: cfg.smallOpChainFaucetDripInterval(), - dripcheck: CheckTrue(mustGetAddress("CheckTrue")), - checkparams: abi.encode(""), - actions: actions - }) - }); - console.log("%s installed successfully", dripName); - } else { - console.log("%s already installed.", dripName); - } - - _activateIfPausedDrip(drippie, dripName); + _installDepositEthToDrip( + faucetProxy, + l1BridgeAddress, + cfg.smallOpChainFaucetDripValue(), + cfg.smallOpChainFaucetDripInterval(), + _faucetDripName(l1BridgeAddress, cfg.dripVersion()) + ); } } - /// @notice installs drips that send funds to small OP chain faucets on the scheduled interval. + /// @notice installs drips that send funds to the admin wallets for small OP chain faucets + /// on the scheduled interval. function installSmallOpChainAdminWalletDrips() public { - Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); require( cfg.faucetOnchainAuthModuleAdmin() == cfg.faucetOffchainAuthModuleAdmin(), "installSmallOpChainAdminWalletDrips: Only handles identical admin wallet addresses" @@ -334,39 +332,19 @@ contract DeployPeriphery is Deployer { uint256 arrayLength = cfg.getSmallFaucetsL1BridgeAddressesCount(); for (uint256 i = 0; i < arrayLength; i++) { address l1BridgeAddress = cfg.smallFaucetsL1BridgeAddresses(i); - string memory dripNamePrefix = string.concat("faucet-admin-drip-", vm.toString(l1BridgeAddress)); - string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); - string memory dripName = string.concat(dripNamePrefix, versionSuffix); - if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { - console.log("installing %s", dripName); - Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); - actions[0] = Drippie.DripAction({ - target: payable(l1BridgeAddress), - data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", adminWallet, 200000, ""), - value: cfg.opChainAdminWalletDripValue() - }); - drippie.create({ - _name: dripName, - _config: Drippie.DripConfig({ - reentrant: false, - interval: cfg.opChainAdminWalletDripInterval(), - dripcheck: CheckTrue(mustGetAddress("CheckTrue")), - checkparams: abi.encode(""), - actions: actions - }) - }); - console.log("%s installed successfully", dripName); - } else { - console.log("%s already installed.", dripName); - } - - _activateIfPausedDrip(drippie, dripName); + _installDepositEthToDrip( + adminWallet, + l1BridgeAddress, + cfg.opChainAdminWalletDripValue(), + cfg.opChainAdminWalletDripInterval(), + _adminWalletDripName(l1BridgeAddress, cfg.dripVersion()) + ); } } - /// @notice installs drips that send funds to small OP chain faucets on the scheduled interval. + /// @notice installs drips that send funds to the admin wallets for large OP chain faucets + /// on the scheduled interval. function installLargeOpChainAdminWalletDrips() public { - Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); require( cfg.faucetOnchainAuthModuleAdmin() == cfg.faucetOffchainAuthModuleAdmin(), "installLargeOpChainAdminWalletDrips: Only handles identical admin wallet addresses" @@ -375,70 +353,29 @@ contract DeployPeriphery is Deployer { uint256 arrayLength = cfg.getLargeFaucetsL1BridgeAddressesCount(); for (uint256 i = 0; i < arrayLength; i++) { address l1BridgeAddress = cfg.largeFaucetsL1BridgeAddresses(i); - string memory dripNamePrefix = string.concat("faucet-admin-drip-", vm.toString(l1BridgeAddress)); - string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); - string memory dripName = string.concat(dripNamePrefix, versionSuffix); - if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { - console.log("installing %s", dripName); - Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); - actions[0] = Drippie.DripAction({ - target: payable(l1BridgeAddress), - data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", adminWallet, 200000, ""), - value: cfg.opChainAdminWalletDripValue() - }); - drippie.create({ - _name: dripName, - _config: Drippie.DripConfig({ - reentrant: false, - interval: cfg.opChainAdminWalletDripInterval(), - dripcheck: CheckTrue(mustGetAddress("CheckTrue")), - checkparams: abi.encode(""), - actions: actions - }) - }); - console.log("%s installed successfully", dripName); - } else { - console.log("%s already installed.", dripName); - } - - _activateIfPausedDrip(drippie, dripName); + _installDepositEthToDrip( + adminWallet, + l1BridgeAddress, + cfg.opChainAdminWalletDripValue(), + cfg.opChainAdminWalletDripInterval(), + _adminWalletDripName(l1BridgeAddress, cfg.dripVersion()) + ); } } /// @notice installs drips that send funds to large OP chain faucets on the scheduled interval. function installLargeOpChainFaucetsDrips() public { - Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); address faucetProxy = mustGetAddress("FaucetProxy"); uint256 arrayLength = cfg.getLargeFaucetsL1BridgeAddressesCount(); for (uint256 i = 0; i < arrayLength; i++) { address l1BridgeAddress = cfg.largeFaucetsL1BridgeAddresses(i); - string memory dripNamePrefix = string.concat("faucet-drip-", vm.toString(l1BridgeAddress)); - string memory versionSuffix = string.concat("-", vm.toString(cfg.dripVersion())); - string memory dripName = string.concat(dripNamePrefix, versionSuffix); - if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { - console.log("installing %s", dripName); - Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); - actions[0] = Drippie.DripAction({ - target: payable(l1BridgeAddress), - data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", faucetProxy, 200000, ""), - value: cfg.smallOpChainFaucetDripValue() - }); - drippie.create({ - _name: dripName, - _config: Drippie.DripConfig({ - reentrant: false, - interval: cfg.smallOpChainFaucetDripInterval(), - dripcheck: CheckTrue(mustGetAddress("CheckTrue")), - checkparams: abi.encode(""), - actions: actions - }) - }); - console.log("%s installed successfully", dripName); - } else { - console.log("%s already installed.", dripName); - } - - _activateIfPausedDrip(drippie, dripName); + _installDepositEthToDrip( + faucetProxy, + l1BridgeAddress, + cfg.largeOpChainFaucetDripValue(), + cfg.largeOpChainFaucetDripInterval(), + _faucetDripName(l1BridgeAddress, cfg.dripVersion()) + ); } } @@ -577,12 +514,75 @@ contract DeployPeriphery is Deployer { _activateIfPausedDrip(drippie, dripName); } + function archivePreviousSmallOpChainFaucetsDrips() public { + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + uint256 arrayLength = cfg.getSmallFaucetsL1BridgeAddressesCount(); + for (uint256 i = 0; i < arrayLength; i++) { + address l1BridgeAddress = cfg.smallFaucetsL1BridgeAddresses(i); + _pauseIfActivatedDrip(drippie, _faucetDripName(l1BridgeAddress, cfg.previousDripVersion())); + _pauseIfActivatedDrip(drippie, _adminWalletDripName(l1BridgeAddress, cfg.previousDripVersion())); + _archiveIfPausedDrip(drippie, _faucetDripName(l1BridgeAddress, cfg.previousDripVersion())); + _archiveIfPausedDrip(drippie, _adminWalletDripName(l1BridgeAddress, cfg.previousDripVersion())); + } + } + + function archivePreviousLargeOpChainFaucetsDrips() public { + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + uint256 arrayLength = cfg.getLargeFaucetsL1BridgeAddressesCount(); + for (uint256 i = 0; i < arrayLength; i++) { + address l1BridgeAddress = cfg.largeFaucetsL1BridgeAddresses(i); + _pauseIfActivatedDrip(drippie, _faucetDripName(l1BridgeAddress, cfg.previousDripVersion())); + _pauseIfActivatedDrip(drippie, _adminWalletDripName(l1BridgeAddress, cfg.previousDripVersion())); + _archiveIfPausedDrip(drippie, _faucetDripName(l1BridgeAddress, cfg.previousDripVersion())); + _archiveIfPausedDrip(drippie, _adminWalletDripName(l1BridgeAddress, cfg.previousDripVersion())); + } + } + function _activateIfPausedDrip(Drippie drippie, string memory dripName) internal { + require( + drippie.getDripStatus(dripName) == Drippie.DripStatus.ACTIVE + || drippie.getDripStatus(dripName) == Drippie.DripStatus.PAUSED, + "attempting to activate a drip that is not currently paused or activated" + ); if (drippie.getDripStatus(dripName) == Drippie.DripStatus.PAUSED) { console.log("%s is paused, activating", dripName); drippie.status(dripName, Drippie.DripStatus.ACTIVE); console.log("%s activated", dripName); require(drippie.getDripStatus(dripName) == Drippie.DripStatus.ACTIVE); + } else { + console.log("%s already activated", dripName); + } + } + + function _pauseIfActivatedDrip(Drippie drippie, string memory dripName) internal { + require( + drippie.getDripStatus(dripName) == Drippie.DripStatus.ACTIVE + || drippie.getDripStatus(dripName) == Drippie.DripStatus.PAUSED, + "attempting to pause a drip that is not currently paused or activated" + ); + if (drippie.getDripStatus(dripName) == Drippie.DripStatus.ACTIVE) { + console.log("%s is active, pausing", dripName); + drippie.status(dripName, Drippie.DripStatus.PAUSED); + console.log("%s paused", dripName); + require(drippie.getDripStatus(dripName) == Drippie.DripStatus.PAUSED); + } else { + console.log("%s already paused", dripName); + } + } + + function _archiveIfPausedDrip(Drippie drippie, string memory dripName) internal { + require( + drippie.getDripStatus(dripName) == Drippie.DripStatus.PAUSED + || drippie.getDripStatus(dripName) == Drippie.DripStatus.ARCHIVED, + "attempting to archive a drip that is not currently paused or archived" + ); + if (drippie.getDripStatus(dripName) == Drippie.DripStatus.PAUSED) { + console.log("%s is paused, archiving", dripName); + drippie.status(dripName, Drippie.DripStatus.ARCHIVED); + console.log("%s archived", dripName); + require(drippie.getDripStatus(dripName) == Drippie.DripStatus.ARCHIVED); + } else { + console.log("%s already archived", dripName); } } @@ -692,4 +692,52 @@ contract DeployPeriphery is Deployer { console.log("Faucet Auth Module configs successfully installed"); } + + function _faucetDripName(address _l1Bridge, uint256 version) internal pure returns (string memory) { + string memory dripNamePrefixWithBridgeAddress = string.concat("faucet-drip-", vm.toString(_l1Bridge)); + string memory versionSuffix = string.concat("-", vm.toString(version)); + return string.concat(dripNamePrefixWithBridgeAddress, versionSuffix); + } + + function _adminWalletDripName(address _l1Bridge, uint256 version) internal pure returns (string memory) { + string memory dripNamePrefixWithBridgeAddress = string.concat("faucet-admin-drip-", vm.toString(_l1Bridge)); + string memory versionSuffix = string.concat("-", vm.toString(version)); + return string.concat(dripNamePrefixWithBridgeAddress, versionSuffix); + } + + function _installDepositEthToDrip( + address _depositTo, + address _l1Bridge, + uint256 _dripValue, + uint256 _dripInterval, + string memory dripName + ) + internal + { + Drippie drippie = Drippie(mustGetAddress("FaucetDrippie")); + if (drippie.getDripStatus(dripName) == Drippie.DripStatus.NONE) { + console.log("installing %s", dripName); + Drippie.DripAction[] memory actions = new Drippie.DripAction[](1); + actions[0] = Drippie.DripAction({ + target: payable(_l1Bridge), + data: abi.encodeWithSignature("depositETHTo(address,uint32,bytes)", _depositTo, 200000, ""), + value: _dripValue + }); + drippie.create({ + _name: dripName, + _config: Drippie.DripConfig({ + reentrant: false, + interval: _dripInterval, + dripcheck: CheckTrue(mustGetAddress("CheckTrue")), + checkparams: abi.encode(""), + actions: actions + }) + }); + console.log("%s installed successfully", dripName); + } else { + console.log("%s already installed.", dripName); + } + + _activateIfPausedDrip(drippie, dripName); + } } diff --git a/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol b/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol index 4838a3badaa7..9da41818b385 100644 --- a/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol +++ b/packages/contracts-bedrock/scripts/PeripheryDeployConfig.s.sol @@ -35,6 +35,7 @@ contract PeripheryDeployConfig is Script { uint256 public faucetOffchainAuthModuleTtl; uint256 public faucetOffchainAuthModuleAmount; bool public installOpChainFaucetsDrips; + bool public archivePreviousOpChainFaucetsDrips; uint256 public smallOpChainFaucetDripValue; uint256 public smallOpChainFaucetDripInterval; uint256 public largeOpChainFaucetDripValue; @@ -51,6 +52,7 @@ contract PeripheryDeployConfig is Script { address[5] public smallFaucetsL1BridgeAddresses; address[2] public largeFaucetsL1BridgeAddresses; uint256 public dripVersion; + uint256 public previousDripVersion; constructor(string memory _path) { console.log("PeripheryDeployConfig: reading file %s", _path); @@ -84,6 +86,7 @@ contract PeripheryDeployConfig is Script { faucetOffchainAuthModuleTtl = stdJson.readUint(_json, "$.faucetOffchainAuthModuleTtl"); faucetOffchainAuthModuleAmount = stdJson.readUint(_json, "$.faucetOffchainAuthModuleAmount"); installOpChainFaucetsDrips = stdJson.readBool(_json, "$.installOpChainFaucetsDrips"); + archivePreviousOpChainFaucetsDrips = stdJson.readBool(_json, "$.archivePreviousOpChainFaucetsDrips"); opL1BridgeAddress = stdJson.readAddress(_json, "$.opL1BridgeAddress"); baseL1BridgeAddress = stdJson.readAddress(_json, "$.baseL1BridgeAddress"); zoraL1BridgeAddress = stdJson.readAddress(_json, "$.zoraL1BridgeAddress"); @@ -92,6 +95,7 @@ contract PeripheryDeployConfig is Script { modeL1BridgeAddress = stdJson.readAddress(_json, "$.modeL1BridgeAddress"); lyraL1BridgeAddress = stdJson.readAddress(_json, "$.lyraL1BridgeAddress"); dripVersion = stdJson.readUint(_json, "$.dripVersion"); + previousDripVersion = stdJson.readUint(_json, "$.previousDripVersion"); smallOpChainFaucetDripValue = stdJson.readUint(_json, "$.smallOpChainFaucetDripValue"); smallOpChainFaucetDripInterval = stdJson.readUint(_json, "$.smallOpChainFaucetDripInterval"); largeOpChainFaucetDripValue = stdJson.readUint(_json, "$.largeOpChainFaucetDripValue");