Smart Account Reference
Guards
setModuleGuard

setModuleGuard

Set a Module Guard that checks transactions initiated by the module before execution.

⚠️

This action can only be done via a Safe transaction.

🚨

Since a guard has the full power to block Safe transaction executions, a broken guard can cause a denial of service for the Safe. Make sure to carefully audit the guard code, and design recovery mechanisms.

Usage


_10
interface ISafe {
_10
function setModuleGuard(address moduleGuard) external;
_10
}
_10
_10
contract Example {
_10
function example() ... {
_10
(ISafe safe).setModuleGuard(0x...);
_10
}
_10
}

Parameters

moduleGuard

  • Type: address

The address of the Module Guard to be used, or address(0) to disable the Module Guard.


_10
(ISafe safe).setModuleGuard(
_10
0x...
_10
);

Events

ChangedModuleGuard


_10
event ChangedModuleGuard(address moduleGuard);

Emitted when a Module Guard is set for the Safe.

Was this page helpful?