# Event Bot Monitoring

### What is Event Bot Monitoring?

> An event refers to an event in a smart contract, triggered when a certain transaction occurs. Users can track these events to trace transactions.

Event Monitoring listens for specific behaviors on-chain by monitoring events emitted by smart contracts.

### Typical Scenarios for Event Bot Monitoring

1. Defi Liquidity Event Monitoring
   1. Defi liquidity exceeds a set threshold.
   2. Defi liquidity falls below a set threshold.
2. NFT Mint Event Monitoring
   1. A specific NFT starts minting.
3. Token Mint Event Monitoring
   1. Large token unlock monitoring.
4. Others, etc.

#### Supported Data Sources

| Data Source   | Type     | Stability |
| ------------- | -------- | --------- |
| Ethereum      | on chain | Very High |
| BSC           | on chain | High      |
| Avalanche     | on chain | High      |
| Polygon Pos   | on chain | High      |
| Arbitrum      | on chain | High      |
| Optimism      | on chain | High      |
| Polygon zkEVM | on chain | High      |
| ZkSync Era    | on chain | High      |
| Base          | on chain | High      |
| Scroll        | on chain | High      |
| Manta         | on chain | High      |
| ZKFair        | on chain | High      |
| Blast         | on chain | High      |
| Linea         | on chain | High      |
| B2            | on chain | High      |
| Merlin        | on chain | High      |

### How to Configure Event Bot Monitoring?

After logging in to the ChainBot platform, select "Create Bot" in the upper right corner -> "Event Monitor".

<figure><img src="/files/tMjjjX333g3cDM5xbGXS" alt=""><figcaption><p>Chosen Event Monitor</p></figcaption></figure>

⚠️ Note

When a specific Event is selected, Conditions will automatically parse the fields contained in that Event, limited to the Event's fields. Therefore, Event and Conditions have a corresponding relationship.

#### Info Description

| Field Name | Description                                | Required |
| ---------- | ------------------------------------------ | -------- |
| Name       | Monitoring Bot Name                        | Yes      |
| Chain      | Selected Chain                             | Yes      |
| Contract   | Selected Contract                          | Yes      |
| Event      | Selected Event                             | Yes      |
| Tags       | Bot monitoring tags, beneficial for search | Yes      |

#### Conditions Description

Conditions in Event Monitoring dynamically change based on the selected Event.

For example, when monitoring the Approval event in the USDT contract, as the parameters of Event Approval(owner: address, spender: address, value: uint256) are three, the available fields in conditions are also three, namely owner, spender, value. Configure your parameters based on your conditions to achieve your purpose.

#### Template Variables Description

| Variable            | Description                               | Example                 |
| ------------------- | ----------------------------------------- | ----------------------- |
| $alert.time         | Block in which the event occurred         | 16073651                |
| $tx.hash            | Transaction hash generating the event     | transaction hash        |
| $event.contract     | Contract address where the event occurred | 16073651                |
| $event.params.{abc} | Key fields parsed from the event          | $event.params.tokens    |
| $chain.explore      | Current chain explorer prefix             | <https://etherscan.io/> |

#### Default Notification Template

```
[ {$bot.name} ]
Contract: {$event.contract}
Time: {$alert.time}
Explore: {$chain.explore}/tx/{$tx.hash}
```

[Learn about alarm notification templates?](https://github.com/ChainbotAI/doc-en/blob/master/advanced-features/alarm-notification-template/README.md)

#### Notification Message Example

> \[ CRV Liquidation Call Monitor ]\
> Contract: 0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\
> Amount: 187743.2161384799 CRV\
> Time: 2022-11-23T02:09:23+08:00\
> Explore: <https://etherscan.io/tx/0x47ffc7939cf8deed6a28357934f98402892b370ac2d3be0c6576f733f6d97b1e>\
> Created By [ChainBot.io](http://chainbot.io/)

#### Event Bot Monitoring Case Study

[Event Bot Example](/bot-case/event-bot-demo.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chainbot.io/basic-usage/bots/event-bot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
