# 消息模版变量汇总表

### 所有 Monitor 通用变量：

* $bot
* $alert

### Address Monitor:

* $bot
* $alert
* $chain
* $block
* $tx
* $intent

### Event Monitor:

* $bot
* $alert
* $chain
* $block
* $tx
* $event
* $params

### Block Monitor:

* $bot
* $alert
* $chain
* $block

### Arweave Monitor:

* $bot
* $alert
* $chain
* $block
* $tx

### NFT Monitor:

* $bot
* $alert
* $block
* $nft

### DEX Monitor:

* $bot
* $alert
* $dex

### Value Monitor:

* $bot
* $alert
* $value

### Snapshot Monitor:

* $bot
* $alert
* $Snapshot

## 变量详细说明

### $bot

| param     | type   | comment   |
| --------- | ------ | --------- |
| $bot.name | string | 此 Bot 的名称 |
| $bot.url  | string | 此 Bot 的链接 |

### $alert

| param            | type   | comment              |
| ---------------- | ------ | -------------------- |
| $alert.time      | string | alert 触发的时间，按照用户所在时区 |
| $alert.timestamp | uint64 | 时间戳                  |

### $chain

| param           | type   | comment                   |
| --------------- | ------ | ------------------------- |
| $chain.type     | string | ethereum                  |
| $chain.chainId  | uint64 | chain\_id                 |
| $chain.symbol   | string | 链 native token 的 symbol   |
| $chain.decimals | int    | 链 native token 的 decimals |
| $chain.explore  | string | 区块浏览器链接                   |

### $block

| param                 | type    | comment                    |
| --------------------- | ------- | -------------------------- |
| $block.hash           | string  | 区块 hash                    |
| $block.height         | uint64  | 区块高度                       |
| $block.minter         | string  | 区块挖掘者 address              |
| $block.baseFeePerGas  | float64 | 该 block 的 basefee, 单位 gwei |
| $block.gasUsedPercent | float64 | 该 block 的 gas 使用的百分比       |

### $tx

| param     | type   | comment         |
| --------- | ------ | --------------- |
| $tx.hash  | string | 交易 hash         |
| $tx.nonce | string | 交易 nonce        |
| $tx.from  | string | from address    |
| $tx.to    | string | to address      |
| $tx.value | string | tx value        |
| $tx.gas   | string | tx 花费的 gas 数量   |
| $tx.input | string | tx 的 input data |
| …         |        |                 |

### $event

| param           | type   | comment    |
| --------------- | ------ | ---------- |
| $event.contract | string | 触发事件的合约地址  |
| $event.params   | object | 解析后的事件参数对象 |

### $params

$params 是 $event.params 的别名，用于直接访问事件参数。具体的参数名称取决于监控的智能合约事件的 ABI 定义。

**常见 Event 参数示例：**

对于 ERC20 Token 的 Transfer 事件：

* $params.from - 转账发送者地址
* $params.to - 转账接收者地址
* $params.value - 转账金额

对于 Uniswap 的 Swap 事件：

* $params.sender - 交换发起者
* $params.recipient - 交换接收者
* $params.amount0In - 输入代币 0 的数量
* $params.amount1In - 输入代币 1 的数量
* $params.amount0Out - 输出代币 0 的数量
* $params.amount1Out - 输出代币 1 的数量

**使用示例：**

```
🎯 事件监控触发！
合约地址: $event.contract
交易哈希: $tx.hash
发送者: $tx.from

--- ERC20 Transfer 事件 ---
从: $params.from
到: $params.to
金额: $params.value

--- Uniswap Swap 事件 ---
交换者: $params.sender
接收者: $params.recipient
输入金额0: $params.amount0In
输入金额1: $params.amount1In
输出金额0: $params.amount0Out
输出金额1: $params.amount1Out

区块链浏览器: $chain.explore/tx/$tx.hash
Bot详情: $bot.url
```

### $nft

| param     | type   | comment         |
| --------- | ------ | --------------- |
| $tx.hash  | string | 交易 hash         |
| $tx.nonce | string | 交易 nonce        |
| $tx.from  | string | from address    |
| $tx.to    | string | to address      |
| $tx.value | string | tx value        |
| $tx.gas   | string | tx 花费的 gas 数量   |
| $tx.input | string | tx 的 input data |
| …         |        |                 |

### $dex

| param                    | type    | comment            |
| ------------------------ | ------- | ------------------ |
| $dex.name                | string  | dex name           |
| $dex.address             | string  | dex swap 合约地址      |
| $dex.tokenBase.symbol    | string  | tokenBase symbol   |
| $dex.tokenBase.address   | string  | tokenBase address  |
| $dex.tokenBase.decimals  | int     | tokenBase 精度       |
| $dex.tokenBase.amount    | decimal | tokenBase 数量       |
| $dex.tokenBase.balance   | decimal | tokenBase 流动性      |
| $dex.tokenQuote.symbol   | string  | tokenQuote symbol  |
| $dex.tokenQuote.address  | string  | tokenQuote address |
| $dex.tokenQuote.decimals | int     | tokenQuote 精度      |
| $dex.tokenQuote.amount   | decimal | tokenQuote 数量      |
| $dex.tokenQuote.balance  | decimal | tokenQuote 流动性     |
| $dex.value               | decimal | token 数量           |
| $dex.USDValue            | decimal | token usd 价值       |
| $dex.price               | decimal | 价格                 |
| $dex.priceUSD            | decimal | usd 本位价格           |
| $dex.action              | string  | 动作                 |
| $dex.tokenIn.symbol      | string  | tokenIn symbol     |
| $dex.tokenIn.address     | string  | tokenIn address    |
| $dex.tokenIn.decimals    | int     | tokenIn 精度         |
| $dex.tokenIn.amount      | decimal | tokenIn 数量         |
| $dex.tokenOut.symbol     | string  | tokenOut symbol    |
| $dex.tokenOut.address    | string  | tokenOut address   |
| $dex.tokenOut.decimals   | int     | tokenOut 精度        |
| $dex.tokenOut.amount     | decimal | tokenOut 数量        |
| $dex.direction           | 📈 📉   | 上涨 /下跌             |
| $dex.changed.duration    | string  | 变动时间区间             |
| $dex.changed.rate        | decimal | 变动速率               |
| $dex.changed.direction   | 📈 📉   | 上涨 /下跌             |

### $snapshot

| param                     | type   | comment       |
| ------------------------- | ------ | ------------- |
| $snapshot.event           | string | 回调事件          |
| $snapshot.time            | string | 时间            |
| $snapshot.proposal.id     | string | id            |
| $snapshot.proposal.title  | string | 标题            |
| $snapshot.proposal.author | string | 作者            |
| $snapshot.proposal.state  | string | 状态            |
| $snapshot.proposal.event  | string | 事件            |
| $snapshot.proposal.space  | string | space         |
| $snapshot.proposal.link   | string | 链接            |
| $snapshot.proposal.body   | string | 内容            |
| $snapshot.proposal.start  | string | 开始时间          |
| $snapshot.proposal.end    | string | 结束时间          |
| $snapshot.space.id        | string | space id      |
| $snapshot.space.name      | string | space 名字      |
| $snapshot.space.about     | string | space 介绍      |
| $snapshot.space.network   | string | space network |
| $snapshot.space.symbol    | string | space 符号      |

### $value

| param             | type   | comment                                                                 |
| ----------------- | ------ | ----------------------------------------------------------------------- |
| $value.values     | map    | formater 后的数值，为动态解析，比如 $value.values.balance, $value.values\["outpu0"]  |
| $value.condition  | string | 所有 condition 内容转为字符串                                                    |
| $value.conditions | map    | bot 配置的 condition 转为 map,key 为 condition 第一个字段， value 为 condition 转为字符串 |

### $intent

| param                                 | type   | comment |
| ------------------------------------- | ------ | ------- |
| $intent.swap\_intents                 | array  | 交换意图数组  |
| $intent.swap\_intents\[].sender       | string | 发送者地址   |
| $intent.swap\_intents\[].swap\_type   | string | 交换类型    |
| $intent.swap\_intents\[].buy\_token   | string | 购买代币地址  |
| $intent.swap\_intents\[].buy\_amount  | string | 购买代币数量  |
| $intent.swap\_intents\[].sell\_token  | string | 出售代币地址  |
| $intent.swap\_intents\[].sell\_amount | string | 出售代币数量  |

**使用示例：**

```
发送者: {$intent.swap_intents[0].sender}
购买代币: {$intent.swap_intents[0].buy_token}
购买数量: {$intent.swap_intents[0].buy_amount}
出售代币: {$intent.swap_intents[0].sell_token}
出售数量: {$intent.swap_intents[0].sell_amount}
交换类型: {$intent.swap_intents[0].swap_type}
```


---

# 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/zh/advanced-features/alarm-notification-template/message-template.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.
