> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cow.bleu.builders/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter Policy Configuration

> Control which programmatic orders are processed by the Watch Tower

# Filter Policy Configuration

Control which programmatic orders are processed by the Watch Tower.

The filter policy allows you to manage which programmatic orders are processed, ignored, or dropped by the Watch Tower. Each network has its own filter policy configuration.

## Filter policy structure

The filter policy is configured within each network's configuration:

```json theme={null}
{
  "networks": [
    {
      "name": "mainnet",
      "rpc": "https://mainnet.infura.io/v3/YOUR_API_KEY",
      "deploymentBlock": 17883049,
      "filterPolicy": {
        "defaultAction": "ACCEPT",
        "conditionalOrderIds": {},
        "transactions": {},
        "handlers": {},
        "owners": {}
      }
    }
  ]
}
```

## Filter actions

Three actions are available for filtering:

* **ACCEPT** - Process the programmatic order normally
* **DROP** - Ignore the programmatic order completely
* **SKIP** - Skip processing this time, but may process in the future

## Default action

The `defaultAction` field defines the behavior when no specific filter rules match.

```json theme={null}
"filterPolicy": {
  "defaultAction": "ACCEPT"
}
```

```json theme={null}
"filterPolicy": {
  "defaultAction": "DROP"
}
```

<Info>
  Most configurations should use `"defaultAction": "ACCEPT"` and explicitly drop unwanted orders.
</Info>

## Filtering by programmatic order IDs

Filter specific programmatic orders by their ID (hash):

```json theme={null}
"filterPolicy": {
  "defaultAction": "ACCEPT",
  "conditionalOrderIds": {
    "0x5b3cdb6ffa3c95507cbfc459162609007865c2e87340312d3cd469c4ffbfae81": "DROP"
  }
}
```

This drops the specific programmatic order with the given ID while accepting all others.

## Filtering by transactions

Filter programmatic orders created in specific transactions:

```json theme={null}
"filterPolicy": {
  "defaultAction": "ACCEPT",
  "transactions": {
    "0x33ef06af308d1e4f94dd61fa8df43fe52b67e8a485f4e4fff75235080e663bfa": "DROP"
  }
}
```

All programmatic orders created in the specified transaction will be dropped.

## Filtering by handlers

Filter programmatic orders by their handler contract address:

```json theme={null}
"filterPolicy": {
  "defaultAction": "ACCEPT",
  "handlers": {
    "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "DROP"
  }
}
```

Handler filtering is useful for disabling specific order types or problematic implementations.

## Filtering by owners

Filter programmatic orders by the owner (Safe) address:

```json theme={null}
"filterPolicy": {
  "defaultAction": "ACCEPT",
  "owners": {
    "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "DROP"
  }
}
```

All programmatic orders from the specified owner address will be dropped.

## Filter evaluation order

When a programmatic order is evaluated, the watch-tower checks filters in this order:

1. **Programmatic order ID** - Most specific
2. **Transaction hash**
3. **Owner address**
4. **Handler address**
5. **Default action** - Fallback if no rules match

The first matching rule determines the action taken.

## Complete example

```json theme={null}
"filterPolicy": {
  "defaultAction": "ACCEPT",
  "conditionalOrderIds": {
    "0x5b3cdb6ffa3c95507cbfc459162609007865c2e87340312d3cd469c4ffbfae81": "DROP"
  },
  "transactions": {
    "0x33ef06af308d1e4f94dd61fa8df43fe52b67e8a485f4e4fff75235080e663bfa": "DROP"
  },
  "handlers": {
    "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "DROP"
  },
  "owners": {
    "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "DROP"
  }
}
```

### Allowlist mode

```json theme={null}
"filterPolicy": {
  "defaultAction": "DROP",
  "owners": {
    "0x1234567890123456789012345678901234567890": "ACCEPT",
    "0x0987654321098765432109876543210987654321": "ACCEPT"
  }
}
```

### Accept all

```json theme={null}
"filterPolicy": {
  "defaultAction": "ACCEPT"
}
```

## Multi-network example

Different networks can have different filter policies:

```json theme={null}
{
  "networks": [
    {
      "name": "mainnet",
      "rpc": "https://mainnet.infura.io/v3/YOUR_API_KEY",
      "deploymentBlock": 17883049,
      "filterPolicy": {
        "defaultAction": "ACCEPT",
        "handlers": {
          "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "DROP"
        }
      }
    },
    {
      "name": "sepolia",
      "rpc": "https://sepolia.drpc.org",
      "deploymentBlock": 8468184,
      "filterPolicy": {
        "defaultAction": "ACCEPT"
      }
    }
  ]
}
```
