Mercury Documentation
  • Get Started with Mercury
    • Pricing
    • Endpoints
    • Authentication
  • The Definitive Guide to Understanding The Mercury's Stack Vision
  • Retroshades
    • Introduction to Retroshades
    • Get Started
      • Importing the Retroshades SDK
      • Writing and Emitting Retroshades
      • Deploying to Mercury Retroshades
      • Querying Retroshades
  • Zephyr: Full Customization
    • Introduction
    • General concepts
      • Zephyr Programs
      • Accessing the Ledger: Contract Entries
      • Accessing the Ledger Meta: Contract Events
      • Database Interactions
      • Create Custom Callable APIs: Serverless Functions
      • Catchups
      • Using Soroban inside Zephyr
    • Quickstart
    • Learn
      • Introduction to Mercury's Cloud and the Zephyr Stack
      • Get Started: Set Up and Manage the Project
        • Create the Project
        • Writing the Program
        • Local Testing
        • Deploy
        • Data catchups/backfill
        • Monitor Execution
        • Querying
      • Database Interactions
        • Zephyr.toml: Define the Tables Structure
        • Understanding Database Interactions
        • Database Operations
      • Accessing the Ledger
      • Accessing Ledger Transition: Soroban Events
      • Working with Contract Custom Types
      • Working with Soroban SDK Types
      • Web Requests, Automation and Alerts.
      • Zephyr.toml Extensions: Indexes And Dashboard
      • Reading From Indexes/External Tables
      • Custom APIs - Serverless Functions
        • General Concepts
        • Custom RPC-alike Endpoints
        • Querying APIs for Composable Data
      • Data Catchups/Backfill
      • Custom Dashboards
        • Creating the Dashboard
        • Plotting: Simple
        • Complex Plotting
    • Support
  • Mercury "Classic"
    • Subscriptions
      • API Definition
    • Queries
      • Contract Events
      • Contract Data Entry Updates
      • Stellar Operations, Balances, and Account Objects
  • TUTORIALS
    • Zephyr
      • Self-hosting Zephyr
      • No-RPC Dapp
      • Indexing a DeFi liquidity pool (Blend)
      • Building a Secure DeFi Real-Time Bot Through Smart Accounts
      • Monitoring Large Deposits with Zephyr and Sending Web Alerts
    • Mercury Classic
      • Index and query contract events
Powered by GitBook
On this page
  • Declaring an Index
  • Declaring the Dashboard
  1. Zephyr: Full Customization
  2. Learn

Zephyr.toml Extensions: Indexes And Dashboard

Learn how to declare zephyr.toml extension to publish indexes and dashboards to the community.

PreviousWeb Requests, Automation and Alerts.NextReading From Indexes/External Tables

Last updated 8 months ago

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: .

  • For 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

https://main.mercurydata.app/indexes
https://main.mercurydata.app/dashboards