# `setModuleGuard`

Set a Module Guard that checks transactions initiated by the module 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 setModuleGuard(address moduleGuard) external;
    }

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


## Parameters

### `moduleGuard`

- **Type:** `address`

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

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

## Events

### `ChangedModuleGuard`

```solidity
event ChangedModuleGuard(address moduleGuard);
```

Emitted when a Module Guard is set for the Safe.
