@@ -12,7 +12,6 @@ import { pascalCaseToSnakeCase } from "./utils/stringOps";
1212
1313const SAFE_SMART_ACCOUNT_IMPL_NAME = "SafeSmartAccountImplementation" ;
1414const OWNER_SAFE_SMART_ACCOUNT_PROXY_NAME = "OwnerSafeSmartAccountProxy" ;
15- const PAUSER_SAFE_SMART_ACCOUNT_PROXY_NAME = "PauserSafeSmartAccountProxy" ;
1615
1716async function getSortedSignatures ( signers : Wallet [ ] , transactionHash : string ) : Promise < string > {
1817 const bytesDataHash = getBytes ( transactionHash ) ;
@@ -185,30 +184,6 @@ task("task:deployOwnerSafeSmartAccountProxy", "Deploys the OwnerSafeSmartAccount
185184 ) ;
186185 } ) ;
187186
188- task ( "task:deployPauserSafeSmartAccountProxy" , "Deploys the PauserSafeSmartAccountProxy contract" )
189- . addParam ( "owners" , "List of addresses that control the PauserSafeSmartAccount." , undefined , types . json )
190- . addParam (
191- "threshold" ,
192- "Number of required confirmations for a PauserSafeSmartAccount transaction." ,
193- undefined ,
194- types . int ,
195- )
196- . addOptionalParam (
197- "useInternalSafeImplAddress" ,
198- "If Safe implementation address from the /addresses directory should be used" ,
199- false ,
200- types . boolean ,
201- )
202- . setAction ( async function ( { owners, threshold, useInternalSafeImplAddress } , hre ) {
203- await deploySafeSmartAccountProxy (
204- PAUSER_SAFE_SMART_ACCOUNT_PROXY_NAME ,
205- owners ,
206- threshold ,
207- useInternalSafeImplAddress ,
208- hre ,
209- ) ;
210- } ) ;
211-
212187task (
213188 "task:transferGatewayOwnership" ,
214189 `Transfers ownership of the GatewayConfig contract to the ${ OWNER_SAFE_SMART_ACCOUNT_PROXY_NAME } .` ,
@@ -360,112 +335,3 @@ task(
360335 `Ownership of Gateway at address ${ gatewayConfigContractAddress } successfully accepted by the ${ OWNER_SAFE_SMART_ACCOUNT_PROXY_NAME } at address: ${ ownerSafeSmartAccountAddress } ` ,
361336 ) ;
362337 } ) ;
363-
364- task (
365- "task:updateGatewayPauser" ,
366- `Updates the pauser of the GatewayConfig contract to the ${ PAUSER_SAFE_SMART_ACCOUNT_PROXY_NAME } .` ,
367- )
368- . addParam (
369- "ownerPrivateKeys" ,
370- `List of private keys of the owners of the ${ OWNER_SAFE_SMART_ACCOUNT_PROXY_NAME } .` ,
371- undefined ,
372- types . json ,
373- )
374- . addOptionalParam (
375- "useInternalProxyAddress" ,
376- "If proxy address from the /addresses directory should be used." ,
377- false ,
378- types . boolean ,
379- )
380- . setAction ( async function ( { ownerPrivateKeys, useInternalProxyAddress } , { ethers, run } ) {
381- // Compile contracts from external dependencies (e.g., Safe Smart Account).
382- // These are temporarily stored by `hardhat-dependency-compiler`.
383- // See the `dependencyCompiler` field in `hardhat.config.ts` for configuration details.
384- await run ( "compile:specific" , { contract : "hardhat-dependency-compiler" } ) ;
385-
386- // Get the signers' wallets.
387- const signers : Wallet [ ] = ownerPrivateKeys . map ( ( ownerPrivateKey : string ) =>
388- new Wallet ( ownerPrivateKey ) . connect ( ethers . provider ) ,
389- ) ;
390-
391- if ( useInternalProxyAddress ) {
392- const gatewayEnvFilePath = path . join ( ADDRESSES_DIR , `.env.gateway` ) ;
393- if ( ! fs . existsSync ( gatewayEnvFilePath ) ) {
394- throw new Error ( `Environment file not found: ${ gatewayEnvFilePath } ` ) ;
395- }
396-
397- const safeSmartAccountsEnvFilePath = path . join ( ADDRESSES_DIR , ".env.safe_smart_accounts" ) ;
398- if ( ! fs . existsSync ( safeSmartAccountsEnvFilePath ) ) {
399- throw new Error ( `Environment file not found: ${ safeSmartAccountsEnvFilePath } ` ) ;
400- }
401-
402- dotenv . config ( {
403- path : [ gatewayEnvFilePath , safeSmartAccountsEnvFilePath ] ,
404- override : true ,
405- } ) ;
406- }
407-
408- // Get the GatewayConfig contract.
409- const gatewayConfigSnakeCase = pascalCaseToSnakeCase ( "GatewayConfig" ) ;
410- const gatewayConfigAddressEnvVarName = `${ gatewayConfigSnakeCase . toUpperCase ( ) } _ADDRESS` ;
411- const gatewayConfigContractAddress = getRequiredEnvVar ( gatewayConfigAddressEnvVarName ) ;
412- const gatewayConfigContract = await ethers . getContractAt ( "GatewayConfig" , gatewayConfigContractAddress ) ;
413-
414- // Get the OwnerSafeSmartAccountProxy contract.
415- const ownerSafeSmartAccountSnakeCase = pascalCaseToSnakeCase ( OWNER_SAFE_SMART_ACCOUNT_PROXY_NAME ) ;
416- const ownerSafeSmartAccountAddressEnvVarName = `${ ownerSafeSmartAccountSnakeCase . toUpperCase ( ) } _ADDRESS` ;
417- const ownerSafeSmartAccountAddress = getRequiredEnvVar ( ownerSafeSmartAccountAddressEnvVarName ) ;
418- const ownerSafeSmartAccount = await ethers . getContractAt ( "Safe" , ownerSafeSmartAccountAddress ) ;
419-
420- // Get the PauserSafeSmartAccountProxy address.
421- const pauserSafeSmartAccountSnakeCase = pascalCaseToSnakeCase ( PAUSER_SAFE_SMART_ACCOUNT_PROXY_NAME ) ;
422- const pauserSafeSmartAccountAddressEnvVarName = `${ pauserSafeSmartAccountSnakeCase . toUpperCase ( ) } _ADDRESS` ;
423- const pauserSafeSmartAccountAddress = getRequiredEnvVar ( pauserSafeSmartAccountAddressEnvVarName ) ;
424-
425- // Prepare the Safe transaction to update the pauser.
426- const value = 0 ; // Ether value.
427- const data = gatewayConfigContract . interface . encodeFunctionData ( "updatePauser" , [ pauserSafeSmartAccountAddress ] ) ; // Data payload for the transaction.
428- const operation = OperationType . Call ; // Operation type.
429- const safeTxGas = 0 ; // Gas that should be used for the safe transaction.
430- const baseGas = 0 ; // Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
431- const gasPrice = 0 ; // Maximum gas price that should be used for this transaction.
432- const gasToken = ethers . ZeroAddress ; // Token address (or 0 if ETH) that is used for the payment.
433- const refundReceiver = ethers . ZeroAddress ; // Address of receiver of gas payment (or 0 if tx.origin).
434- const nonce = await ownerSafeSmartAccount . nonce ( ) ;
435-
436- // Get the transaction hash for the Safe transaction.
437- const transactionHash = await ownerSafeSmartAccount . getTransactionHash (
438- gatewayConfigContractAddress ,
439- value ,
440- data ,
441- operation ,
442- safeTxGas ,
443- baseGas ,
444- gasPrice ,
445- gasToken ,
446- refundReceiver ,
447- nonce ,
448- ) ;
449-
450- // Gnosis Safe requires signatures to be provided in ascending order of the signer addresses
451- // for security and efficiency reasons. See https://docs.safe.global/advanced/smart-account-signatures.
452- const signatures = await getSortedSignatures ( signers , transactionHash ) ;
453-
454- // Execute the Safe transaction to update the pauser.
455- const execTransactionResponse = await ownerSafeSmartAccount . execTransaction (
456- gatewayConfigContractAddress ,
457- value ,
458- data ,
459- operation ,
460- safeTxGas ,
461- baseGas ,
462- gasPrice ,
463- gasToken ,
464- refundReceiver ,
465- signatures ,
466- ) ;
467- await execTransactionResponse . wait ( ) ;
468- console . log (
469- `Pauser of Gateway at address ${ gatewayConfigContractAddress } successfully updated to address: ${ pauserSafeSmartAccountAddress } ` ,
470- ) ;
471- } ) ;
0 commit comments