import { Contract , ContractFactory } from "ethers" ; import { ethers } from "hardhat" ; import { proposerRole , executerRole , cancelerRole } from '../test/constants' ; async function main ( ) { if ( ! process . env . DEPLOYER_WALLET_PRIVATE_KEY ) { return console . log ( "Please set your DEPLOYER_WALLET_PRIVATE_KEY in a .env file" ) ; } const [ deployer ] = await ethers . getSigners ( ) ; console . log ( "Deploying contracts with the account:" , deployer . address ) ; console . log ( "Account balance:" , ( await deployer . getBalance ( ) ) . toString ( ) ) ; const Registry = await ethers . getContractFactory ( "Registry" ) ; const registry = await Registry . deploy ( ) ; await registry . deployed ( ) ; const Factory = await ethers . getContractFactory ( "SafeGuardFactory" ) ; const factory = await Factory . deploy ( registry . address ) ; await factory . deployed ( ) ; const oneDayTimelock = 86400 ; const safeGuardDescription = "Sample SafeGuard" ; console . log ( "Registry and Factory mainnet addresses deployed to: " , { registry : registry . address , factory : factory . address , } ) ; const res = await factory . connect ( deployer ) . createSafeGuard ( oneDayTimelock , safeGuardDescription , process . env . METAMASK_ADDRESS , [ proposerRole , executerRole , cancelerRole ] , [ process . env . METAMASK_ADDRESS , process . env . METAMASK_ADDRESS , process . env . METAMASK_ADDRESS , ] , { gasLimit : 4000000 } ) ; await res . wait ( ) ; } main ( ) . then ( ( ) => process . exit ( 0 ) ) . catch ( ( error ) => { console . error ( error ) ; process . exit ( 1 ) ; } ) ;