# `setGuard`

Set Transaction Guard `guard` that checks transactions before execution.

<Callout type='warning'>
  This action can only be done via a Safe transaction.
</Callout>
<Callout type='error' emoji='🚨'>
  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.
</Callout>

## Usage


<Tabs items={['example.sol']}>
  <Tabs.Tab>
    ```solidity
    interface ISafe {
        function setGuard(address guard) external;
    }

    contract Example {
        function example() ... {
            (ISafe safe).setGuard(0x...);
        }
    }
    ```
  </Tabs.Tab>
</Tabs>

## Parameters

### `guard`

- **Type:** `address`

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

```solidity focus=2
(ISafe safe).setGuard(
    0x...
);
```

## Events

### `ChangedGuard`

```solidity
event ChangedGuard(address guard);
```

Emitted when a guard is set for the Safe.
