# Value Bot Monitoring

### What is Value Bot Monitoring?

Value Bot Monitoring is a type of monitoring designed for numerical changes. Its main function is to monitor the value changes of a certain object, and when the value change reaches a preset threshold, an alert will be triggered.

### Typical Scenarios for Value Bot Monitoring

1. Monitoring Token balance changes
2. Monitoring the percentage change of Curve stablecoins

#### 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 Value Bot Monitoring?

After logging into the ChainBot platform, top right corner "Create Bot" -> "Value Monitor".

<figure><img src="/files/CD3ActsH4Ywc7Ef7MlQZ" alt=""><figcaption><p>Create a Value Bot</p></figcaption></figure>

**Info Description**

<table><thead><tr><th width="183.33333333333331">Field Name</th><th width="280">Description</th><th>Required</th></tr></thead><tbody><tr><td>Name</td><td>Bot Monitoring Name</td><td>Yes</td></tr><tr><td>Chain</td><td>Selected Chain</td><td>Yes</td></tr><tr><td>Contract</td><td>Selected Smart Contract Address</td><td>Yes</td></tr><tr><td>Function</td><td>Selected Smart Contract Method</td><td>Yes</td></tr><tr><td>Interval</td><td>Data point interval, fetching data from the configured data source at each interval</td><td>Yes</td></tr><tr><td>Baseline Trigger</td><td>If this item is selected, the trigger condition is taken as the baseline. Once the value reaches the baseline, it will not be repeatedly triggered. It will only trigger again if it leaves and re-enters the baseline.</td><td>Yes</td></tr><tr><td>Fields</td><td>Numeric fields to be processed</td><td>Yes</td></tr><tr><td>Tags</td><td>Bot Monitoring tags for easy search</td><td>Yes</td></tr></tbody></table>

#### Fields Description

> Comprises multiple Field fields, each Field is an object containing field and formater types. The formater is a piece of js code; the user needs to define the code to format the final value.

#### Built-in Functions

<table><thead><tr><th width="305">Function Name</th><th>Description</th></tr></thead><tbody><tr><td>tokenPrice(symbol)</td><td>Gets the USD-based price of the token, such as tokenPrice('weth')</td></tr><tr><td>bot(botId)</td><td>References the content of a specific Bot, such as bot('1')</td></tr><tr><td>add(x,y)</td><td>x+y</td></tr><tr><td>sub(x,y)</td><td>x-y</td></tr><tr><td>mul(x,y)</td><td>x*y</td></tr><tr><td>div(x,y)</td><td>x/y &#x26;&#x26; y != 0</td></tr><tr><td>pow(x,y)</td><td>x^y</td></tr></tbody></table>

#### Supported USD-based Tokens

> Automatically gets the USD-based price of tokens. The data source comes from the highest liquidity trading pairs on the chain, with more tokens to be supported in the future.

| Token  | Pool                                                                                      |
| ------ | ----------------------------------------------------------------------------------------- |
| WBTC   | [WBTC/BUSD](https://bscscan.com/address/0xF45cd219aEF8618A92BAa7aD848364a158a24F33)       |
| WETH   | [WETH/USDT](https://etherscan.io/address/0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852)      |
| WBNB   | [WBNB/BUSD](https://bscscan.com/address/0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16)       |
| WMATIC | [WMATIC/USDC](https://polygonscan.com/address/0x6e7a5FAFcec6BB1e78bAE2A1F0B612012BF14827) |
| WAVAX  | [WAVAX/USDC](https://snowtrace.io/address/0xf4003F4efBE8691B60249E6afbD307aBE7758adb)     |
| WFTM   | [WFTM/USDC](https://ftmscan.com/address/0x2b4c76d0dc16be1c31d4c1dc53bf9b45987fc75c)       |
| CAKE   | [CAKE/USDC](https://bscscan.com/address/0xa39af17ce4a8eb807e076805da1e2b8ea7d0755b)       |

**Conditions Description**

The field parsing in conditions is dynamic and will change with the content configured in Fields. The Key of the Condition is the content of the Field, and both are consistent. The value in the condition is the threshold set by the user. When comparing values, the system uses the value formatted by the Field formater and compares it with the value in the condition. Therefore, users need to be aware of unit conversions when configuring.

**Template Variables Description**

| $subscription.name | Subscription Name, usually the same as the Bot Monitoring Name |
| ------------------ | -------------------------------------------------------------- |
| $block.height      | Block Height                                                   |
| $value.{}          | Formatted value, dynamically parsed, e.g., $value.balance      |
| $condition         | All condition content is converted to a string                 |
| $alert.time        | Block Time                                                     |

#### Default Alert Template

```
[{$bot.name}]
Block: {$block.height}
Values:{$value.values.ltv}
Condition: {$value.condition}
Time: {$alert.time}
```

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

#### Notification Message Example

> \[ENS Governance ETH Balance > 35000 ETH]
>
> Block: 16046035
>
> Balance: 35335.915888
>
> Condition: (5m) balance last > 35000
>
> Time: 2022-11-25T17:14:30+08:00
>
> Created By [ChainBot.io](https://www.chainbot.io)

#### Value Bot Monitoring Examples

[Value Bot Example](/bot-case/value-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/value-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.
