> For the complete documentation index, see [llms.txt](https://docs.ironblocks.com/firewall/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ironblocks.com/firewall/smart-contracts/firewallconsumer.sol.md).

# FirewallConsumer.sol

A parent contract *(i.e. you inherit from this contract)* which enables your smart contracts to become a [Firewall Consumer](/firewall/glossary.md#firewall-consumer).

> *For usage example, please see our* [*Using Function Modifiers*](/firewall/quick-start/using-function-modifiers.md) *guide.*

## Properties

<table><thead><tr><th width="187">Name</th><th width="148.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>firewallAdmin</code></td><td><code>address</code></td><td>the address of the <a href="/firewall/glossary.md#firewall-admin">Firewall Admin</a> that manages this <a href="/firewall/glossary.md#firewall-consumer">Firewall Consumer</a></td></tr></tbody></table>

## Modifiers

### onlyFirewallAdmin()

Only allows the modified function to run if it was called by the [Firewall Admin](/firewall/glossary.md#firewall-admin) *(see* [*`setFirewallAdmin()`*](/firewall/smart-contracts/firewallconsumer.sol.md#setfirewalladmin)*)* .

### firewallProtected()

Protects the modified function, so that any calls to it would go through the [Firewall](/firewall/glossary.md#firewall)'s [Pre Execution](/firewall/glossary.md#pre-execution) and [Post Execution](/firewall/glossary.md#post-execution) hooks.

### firewallProtectedCustom(bytes memory data)

For cases where you want to use policies that provide advanced inspections based on custom data you pass to it, which may differ from `msg.data`. All calls to modified functions will go through [Firewall](/firewall/glossary.md#firewall)'s [Pre Execution](/firewall/glossary.md#pre-execution) and [Post Execution](/firewall/glossary.md#post-execution) hooks.

### firewallProtectedSigHash(bytes4 selector)

Designed for policies that track and protect calls to internal functions, use this modifier by passing in the function's signature hash.All calls to the modified function will go through the [Firewall](/firewall/glossary.md#firewall)'s [Pre Execution](/firewall/glossary.md#pre-execution) and [Post Execution](/firewall/glossary.md#post-execution) hooks.

### invariantProtected()

Coupled with our [Private Invariants Policy](/firewall/policies/custom-protector.md), this modifier will allow the policy to check for changes in the state of internal data that is controlled / updated when the modified function is called. Any calls to the modified function will go through the [Firewall](/firewall/glossary.md#firewall)'s [Pre Execution](/firewall/glossary.md#pre-execution) and [Post Execution](/firewall/glossary.md#post-execution) hooks.

## Methods

### setFirewall()

#### `function setFirewall(address _firewall)`

Callable only by the [Firewall Admin](/firewall/glossary.md#firewall-admin), changes the address of the [Firewall](/firewall/glossary.md#firewall) that will be used by this [Firewall Consumer](/firewall/glossary.md#firewall-consumer).

| Parameter Name | Type      | Description                                                |
| -------------- | --------- | ---------------------------------------------------------- |
| `_firewall`    | `address` | the new [Firewall](/firewall/glossary.md#firewall) address |

### setFirewallAdmin()

#### `function setFirewallAdmin(address _firewallAdmin)`

Callable only by the [Firewall Admin](/firewall/glossary.md#firewall-admin), it changes the address of the [Firewall Admin](/firewall/glossary.md#firewall-admin) who manages the [Firewall](/firewall/glossary.md#firewall).

| Parameters Name  | Type      | Description                                                            |
| ---------------- | --------- | ---------------------------------------------------------------------- |
| `_firewallAdmin` | `address` | the new [Firewall Admin](/firewall/glossary.md#firewall-admin) address |

## Source Code

On our GitLab repository: [FirewallConsumer.sol](https://github.com/ironblocks/onchain-firewall/blob/main/packages/onchain-firewall/contracts/FirewallConsumer.sol)
