From 8ca6a664e3ca5a44921829a2694ccde9d09a8237 Mon Sep 17 00:00:00 2001 From: sandybradley Date: Wed, 4 Oct 2023 20:11:54 +0200 Subject: [PATCH] feat: auth-manager-deployer --- nix/shell.nix | 26 ++++++++++++++++++++++++++ script/AuthManager.s.sol | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 script/AuthManager.s.sol diff --git a/nix/shell.nix b/nix/shell.nix index 07a3bd1..77520a3 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -81,6 +81,32 @@ --rpc-url $RPC_GOERLI $@ ''; } + { + category = "deployments"; + name = "deploy-auth-manager"; + help = "Deploy the AuthManager"; + command = '' + forge script $PRJ_ROOT/script/AuthManager.s.sol:AuthManagerDeployScript \ + --chain-id 1 \ + --rpc-url $RPC_MAINNET \ + --broadcast \ + --private-key $PRIVATE_KEY \ + --verify \ + --etherscan-api-key $ETHERSCAN_API_KEY \ + -vvvvv + ''; + } + { + category = "deployments"; + name = "deploy-auth-manager-test"; + help = "Deploy the AuthManager test"; + command = '' + forge script $PRJ_ROOT/script/AuthManager.s.sol:AuthManagerDeployScript \ + --chain-id 1 \ + --fork-url $RPC_MAINNET \ + -vvvvv + ''; + } { category = "deployments"; name = "deploy-arbitrum"; diff --git a/script/AuthManager.s.sol b/script/AuthManager.s.sol new file mode 100644 index 0000000..3ed7831 --- /dev/null +++ b/script/AuthManager.s.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.19; + +import "forge-std/Script.sol"; +import { IAuth } from "src/interfaces/IAuth.sol"; +import { AuthManager } from "src/libraries/AuthManager.sol"; + +contract AuthManagerDeployScript is Script { + function run() public { + address safe = 0x617c8dE5BdE54ffbb8d92716CC947858cA38f582; + address authority = safe; + address mevEth = 0x24Ae2dA0f361AA4BE46b48EB19C91e02c5e4f27E; + address initialShareVault = safe; + address initialStakingModule = 0xc5920c99d09E5444C079C01F06763b5d6AB09CbB; + + vm.startBroadcast(); + // deploy AuthManager + AuthManager authManager = new AuthManager(authority, mevEth, initialShareVault, initialStakingModule); + // set AuthManager as admin + IAuth(mevEth).addAdmin(address(authManager)); + IAuth(initialStakingModule).addAdmin(address(authManager)); + + vm.stopBroadcast(); + } +}