setModuleGuard method

  1. @override
Future<SafeContractEncodedCall> setModuleGuard(
  1. ETHAddress moduleGuard
)
override

"stateMutability": "nonpayable", Sets the module guard (moduleGuard) for the Safe. Make sure you trust the module guard before setting it.

Notes:

  • The module guard performs checks on transactions initiated by modules, both before and after execution.
  • This action can only be performed through a Safe transaction.
  • ⚠️ IMPORTANT — SECURITY RISK: Since a module guard can block any Safe transaction initiated via a module, a faulty or malicious module guard can cause a denial of service (DoS) for all Safe modules. Carefully audit the module guard’s code and design recovery mechanisms.

Parameters:

  • moduleGuard: Address of the module guard contract to use, or the zero address (0x0) to disable the module guard.

Implementation

@override
Future<SafeContractEncodedCall> setModuleGuard(ETHAddress moduleGuard) async {
  final params = [moduleGuard];
  return encodeTransactionCall(
    functionName: SafeContractFunction.setModuleGuard,
    params: params,
  );
}