Smart Account Reference
Guards
setGuard

setGuard

Set Transaction Guard guard that checks transactions 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 setGuard(address guard) external;
_10
}
_10
_10
contract Example {
_10
function example() ... {
_10
(ISafe safe).setGuard(0x...);
_10
}
_10
}

Parameters

guard

  • Type: address

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


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

Events

ChangedGuard


_10
event ChangedGuard(address guard);

Emitted when a guard is set for the Safe.

Was this page helpful?