Zephyr.toml Extensions: Indexes And Dashboard
Learn how to declare zephyr.toml extension to publish indexes and dashboards to the community.
The new Mercury-CLI kit supports zephyr.toml extensions that declare any existing indexes and the dashboard for your Mercury program.
Declaring indexes and dashboards allows you to get them listed on the Mercury community explorer:
For indexes: https://main.mercurydata.app/indexes.
For dashboards: https://main.mercurydata.app/dashboards.
Declaring an Index
An index is actually any deployed table that contains live information about a certain segment of network data. If you want to make your table an index that is publicly accessible by other indexers or dashboards, you'll need to declare it in the zephyr.toml
settings.
Below is an example of a declared index:
[[indexes]]
name = "clateral"
title = "Blend ecosystem collateral indexes"
description = """
Index of the whole Blend ecosystem historical collateral actions (deposit,
withdraw) as well as total supply by action.
"""
instructions = """
Import the collateral table as follows in your Mercury program:
```rust
#[derive(DatabaseDerive, Clone)]
#[with_name("clateral")]
#[external("2")]
pub struct Collateral {
pub id: i64,
pub timestamp: u64,
pub ledger: u32,
pub pool: String,
pub asset: String,
pub clateral: i128,
pub delta: i128,
pub source: String,
}
```
"""
tags = ["blend", "defi", "collateral", "lending", "deposit"]
[[indexes]]
name = "borrowed"
title = "Blend ecosystem borrows indexes"
description = """
Index of the whole Blend ecosystem historical borrow actions (borrow,
repay) as well as total supply by action.
"""
instructions = """
Import the borrow table as follows in your Mercury program:
```rust
#[derive(DatabaseDerive, Clone)]
#[with_name("borrowed")]
#[external("2")]
pub struct Borrowed {
pub id: i64,
pub timestamp: u64,
pub ledger: u32,
pub pool: String,
pub asset: String,
pub borrowed: i128,
pub delta: i128,
pub source: String,
}
```
"""
tags = ["blend", "defi", "borrow"]
Declaring the Dashboard
If your program is externing the dashboard
function and you want to make it discoverable to the Mercury community, you need to declare the dashboard in the zephyr.toml
configuration as follows:
[dashboard]
title = "Blend ecosystem dashboard"
description = """
Tracks historical actions, volumes and supply evolution of all assets
and all pools in the Blend ecosystem.
"""
tags = ["blend", "defi", "lending", "borrowing"]
For more information about creating dashboards, check out Custom Dashboards
Last updated