From 7f0433bd33208f4639bc16b934edb69f6be15569 Mon Sep 17 00:00:00 2001 From: Theo Date: Sun, 28 May 2023 11:15:07 +0300 Subject: [PATCH] Create deploy script --- .gitignore | 2 +- script/DeployScript.sol | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 script/DeployScript.sol diff --git a/.gitignore b/.gitignore index 018f8ed..d120098 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ out/ node_modules/ # Ignores development broadcast logs -!/broadcast +/broadcast /broadcast/*/31337/ /broadcast/**/dry-run/ diff --git a/script/DeployScript.sol b/script/DeployScript.sol new file mode 100644 index 0000000..62f0eb0 --- /dev/null +++ b/script/DeployScript.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.12; + +import "@forge-std/Script.sol"; + +import { RelayerRegistry } from "@root/v4-patch/RelayerRegistry.sol"; +import { TornadoStakingRewards } from "@root/v4-patch/TornadoStakingRewards.sol"; +import { AdminUpgradeableProxy } from "@root/v4-patch/AdminUpgradeableProxy.sol"; +import { PatchProposal } from "@root/v4-patch/PatchProposal.sol"; +import { Parameters } from "@proprietary/Parameters.sol"; + +contract DeployScript is Script, Parameters { + function run() external { + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + vm.startBroadcast(deployerPrivateKey); + + TornadoStakingRewards governanceStakingImplementation = + new TornadoStakingRewards(_governanceAddress, _tokenAddress, _relayerRegistryAddress); + + // We don't need initialization parameters to deploy Governance Staking Proxy contract + bytes memory empty; + AdminUpgradeableProxy governanceStakingProxy = + new AdminUpgradeableProxy(address(governanceStakingImplementation), _governanceAddress, empty); + + // Deploy new relayer registry implementation after staking, because we need refer to staking proxy in registry contract + RelayerRegistry relayerRegistryImplementation = + new RelayerRegistry(_tokenAddress, _governanceAddress, _ensAddress, address(governanceStakingProxy), _feeManagerAddress); + + PatchProposal patchProposal = + new PatchProposal(address(governanceStakingProxy), address(relayerRegistryImplementation)); + + vm.stopBroadcast(); + } +}