Skip to content

Commit a329de7

Browse files
committed
feat: add monad indexer targets and unify deploy naming
Align network naming and hosted env vars across the monorepo so Celo and Monad deployments use a consistent model. Simplify indexer deployment to a single network-aware command without bypassing git hooks. Made-with: Cursor
1 parent 7054929 commit a329de7

22 files changed

+247
-195
lines changed

.trunk/trunk.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ actions:
7171
- id: indexer-codegen-pre-push
7272
display_name: Indexer Schema Codegen (pre-push)
7373
description: Validates schema.graphql by running envio codegen — catches duplicate fields, bad types, etc. before CI.
74-
run: pnpm --filter @mento-protocol/indexer-envio codegen --config config.celo.mainnet.yaml
74+
run: pnpm indexer:celo-mainnet:codegen
7575
triggers:
7676
- git_hooks: [pre-push]
7777
enabled:

AGENTS.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ pnpm monorepo with three packages:
1515
pnpm install
1616

1717
# Indexer
18-
pnpm indexer:codegen # Generate types from schema
19-
pnpm indexer:dev # Start indexer (devnet)
20-
pnpm indexer:sepolia:codegen # Generate types (sepolia config)
21-
pnpm indexer:sepolia:dev # Start indexer (sepolia)
18+
pnpm indexer:codegen # Generate types from schema (devnet)
19+
pnpm indexer:dev # Start indexer (devnet)
20+
pnpm indexer:celo-sepolia:codegen # Generate types (Celo Sepolia config)
21+
pnpm indexer:celo-sepolia:dev # Start indexer (Celo Sepolia)
22+
pnpm indexer:celo-mainnet:codegen # Generate types (Celo mainnet)
23+
pnpm indexer:celo-mainnet:dev # Start indexer (Celo mainnet)
24+
pnpm indexer:monad-mainnet:codegen # Generate types (Monad mainnet)
25+
pnpm indexer:monad-mainnet:dev # Start indexer (Monad mainnet)
26+
pnpm indexer:monad-testnet:codegen # Generate types (Monad testnet)
27+
pnpm indexer:monad-testnet:dev # Start indexer (Monad testnet)
2228

2329
# Dashboard
2430
pnpm dashboard:dev # Dev server
@@ -42,7 +48,7 @@ pnpm infra:apply # Apply infrastructure changes
4248

4349
- **Runtime:** Envio HyperIndex (envio@2.32.3)
4450
- **Schema:** `schema.graphql` defines indexed entities (FPMM, Swap, Mint, Burn, etc.)
45-
- **Configs:** `config.celo.devnet.yaml`, `config.celo.mainnet.yaml`, `config.celo.sepolia.yaml`
51+
- **Configs:** `config.celo.devnet.yaml`, `config.celo.mainnet.yaml`, `config.celo.sepolia.yaml`, `config.monad.mainnet.yaml`, `config.monad.testnet.yaml`
4652
- **Handlers:** `src/EventHandlers.ts` — processes blockchain events
4753
- **Contract addresses:** `src/contractAddresses.ts` — resolves addresses from `@mento-protocol/contracts` using the namespace map from `shared-config`
4854
- **ABIs:** `abis/` — FPMMFactory, FPMM, VirtualPoolFactory (indexer-specific); SortedOracles + token ABIs come from `@mento-protocol/contracts`
@@ -56,7 +62,7 @@ pnpm infra:apply # Apply infrastructure changes
5662
- **Charts:** Plotly.js via react-plotly.js
5763
- **Data:** GraphQL queries to Hasura (via graphql-request + SWR)
5864
- **Styling:** Tailwind CSS 4
59-
- **Multi-chain:** Network selector switches between devnet/sepolia/mainnet Hasura endpoints; all networks defined in `src/lib/networks.ts`
65+
- **Multi-chain:** Network selector switches between celo-mainnet, celo-sepolia, monad-mainnet, monad-testnet Hasura endpoints; all networks defined in `src/lib/networks.ts`
6066
- **Contract labels:** `src/lib/networks.ts` derives token symbols and address labels from `@mento-protocol/contracts` (no vendored JSON); the active namespace per chain comes from `shared-config`
6167
- **Address book:** `/address-book` page + inline editing; custom labels stored in Upstash Redis, backed up daily to Vercel Blob; custom labels override/extend the package-derived ones
6268
- **Deployment:** Vercel (`monitoring-dashboard` project); infra managed by Terraform in `terraform/`
@@ -86,6 +92,8 @@ monitoring-monorepo/
8692
│ ├── config.celo.devnet.yaml # Devnet indexer config
8793
│ ├── config.celo.mainnet.yaml # Celo Mainnet config
8894
│ ├── config.celo.sepolia.yaml # Celo Sepolia config
95+
│ ├── config.monad.mainnet.yaml # Monad Mainnet config
96+
│ ├── config.monad.testnet.yaml # Monad Testnet config
8997
│ ├── schema.graphql # Entity definitions
9098
│ ├── src/
9199
│ │ ├── EventHandlers.ts # Event processing logic
@@ -144,7 +152,7 @@ When a new set of contracts has been deployed and a new `@mento-protocol/contrac
144152
### Adding a new contract to index
145153

146154
1. Add ABI to `indexer-envio/abis/`
147-
2. Add contract entry in `config.celo.mainnet.yaml` (and `config.celo.sepolia.yaml` if applicable)
155+
2. Add contract entry in the relevant config(s): `config.celo.mainnet.yaml`, `config.celo.sepolia.yaml`, `config.monad.mainnet.yaml`, `config.monad.testnet.yaml`
148156
3. Add entity to `schema.graphql`
149157
4. Add handler in `src/EventHandlers.ts`
150158
5. Run `pnpm indexer:codegen` to regenerate types

README.md

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Real-time monitoring infrastructure for Mento v3 on-chain pools — an [Envio Hy
66

77
## Packages
88

9-
| Package | Description |
10-
| ----------------------------------- | ------------------------------------------------------------------------------- |
11-
| [`indexer-envio`](./indexer-envio/) | Envio HyperIndex indexer for Celo Mainnet + Sepolia (FPMM pools + VirtualPools) |
12-
| [`ui-dashboard`](./ui-dashboard/) | Next.js 16 + Plotly.js monitoring dashboard with multi-chain network switching |
13-
| [`shared-config`](./shared-config/) | Shared deployment config (chain ID → treb namespace mappings) |
9+
| Package | Description |
10+
| ----------------------------------- | ------------------------------------------------------------------------------ |
11+
| [`indexer-envio`](./indexer-envio/) | Envio HyperIndex indexer for Celo + Monad (FPMM pools + VirtualPools) |
12+
| [`ui-dashboard`](./ui-dashboard/) | Next.js 16 + Plotly.js monitoring dashboard with multi-chain network switching |
13+
| [`shared-config`](./shared-config/) | Shared deployment config (chain ID → treb namespace mappings) |
1414

1515
## Architecture
1616

@@ -51,14 +51,18 @@ The indexer runs on Envio's hosted free tier. Each deploy produces a new GraphQL
5151
pnpm install
5252
```
5353

54-
### Run the Indexer (local — Celo Sepolia)
54+
### Run the Indexer (local)
5555

5656
```bash
57-
# Generate types from schema + config
58-
pnpm indexer:sepolia:codegen
57+
# Celo Sepolia
58+
pnpm indexer:celo-sepolia:codegen && pnpm indexer:celo-sepolia:dev
5959

60-
# Start the indexer (spins up Docker: Postgres + Hasura + indexer)
61-
pnpm indexer:sepolia:dev
60+
# Celo Mainnet
61+
pnpm indexer:celo-mainnet:codegen && pnpm indexer:celo-mainnet:dev
62+
63+
# Monad Testnet / Mainnet
64+
pnpm indexer:monad-testnet:codegen && pnpm indexer:monad-testnet:dev
65+
pnpm indexer:monad-mainnet:codegen && pnpm indexer:monad-mainnet:dev
6266
```
6367

6468
### Run the Dashboard
@@ -85,21 +89,19 @@ Create `indexer-envio/.env` from `indexer-envio/.env.example`:
8589

8690
The dashboard supports multiple network targets via `_<NETWORK>` suffix env vars:
8791

88-
| Variable | Description |
89-
| ------------------------------------------ | ----------------------------------------------- |
90-
| `NEXT_PUBLIC_HASURA_URL_MAINNET_HOSTED` | Hasura/GraphQL endpoint — Celo Mainnet (hosted) |
91-
| `NEXT_PUBLIC_HASURA_SECRET_MAINNET_HOSTED` | Hasura admin secret — Celo Mainnet hosted |
92-
| `NEXT_PUBLIC_HASURA_URL_SEPOLIA_HOSTED` | Hasura/GraphQL endpoint — Celo Sepolia (hosted) |
93-
| `NEXT_PUBLIC_HASURA_SECRET_SEPOLIA_HOSTED` | Hasura admin secret — Celo Sepolia hosted |
94-
| `NEXT_PUBLIC_HASURA_URL_MAINNET` | Hasura endpoint — Celo Mainnet (local) |
95-
| `NEXT_PUBLIC_HASURA_SECRET_MAINNET` | Hasura admin secret — Celo Mainnet (local) |
96-
| `NEXT_PUBLIC_HASURA_URL_SEPOLIA` | Hasura endpoint — Celo Sepolia (local) |
97-
| `NEXT_PUBLIC_HASURA_SECRET_SEPOLIA` | Hasura admin secret — Celo Sepolia (local) |
98-
| `NEXT_PUBLIC_EXPLORER_URL_MAINNET` | Block explorer — Celo Mainnet |
99-
| `NEXT_PUBLIC_EXPLORER_URL_SEPOLIA` | Block explorer — Celo Sepolia |
100-
| `UPSTASH_REDIS_REST_URL` | Address labels storage (Upstash Redis) |
101-
| `UPSTASH_REDIS_REST_TOKEN` | Address labels Redis auth token |
102-
| `BLOB_READ_WRITE_TOKEN` | Vercel Blob token for daily label backups |
92+
| Variable | Description |
93+
| --------------------------------------------- | ------------------------------------------------ |
94+
| `NEXT_PUBLIC_HASURA_URL_CELO_MAINNET_HOSTED` | Hasura/GraphQL endpoint — Celo Mainnet (hosted) |
95+
| `NEXT_PUBLIC_HASURA_URL_MONAD_MAINNET_HOSTED` | Hasura/GraphQL endpoint — Monad Mainnet (hosted) |
96+
| `NEXT_PUBLIC_HASURA_URL_MONAD_TESTNET_HOSTED` | Hasura/GraphQL endpoint — Monad Testnet (hosted) |
97+
| `NEXT_PUBLIC_HASURA_URL_CELO_SEPOLIA_HOSTED` | Hasura/GraphQL endpoint — Celo Sepolia (hosted) |
98+
| `NEXT_PUBLIC_HASURA_URL_CELO_MAINNET` | Hasura endpoint — Celo Mainnet (local) |
99+
| `NEXT_PUBLIC_HASURA_URL_CELO_SEPOLIA` | Hasura endpoint — Celo Sepolia (local) |
100+
| `NEXT_PUBLIC_EXPLORER_URL_CELO_MAINNET` | Block explorer — Celo Mainnet |
101+
| `NEXT_PUBLIC_EXPLORER_URL_CELO_SEPOLIA` | Block explorer — Celo Sepolia |
102+
| `UPSTASH_REDIS_REST_URL` | Address labels storage (Upstash Redis) |
103+
| `UPSTASH_REDIS_REST_TOKEN` | Address labels Redis auth token |
104+
| `BLOB_READ_WRITE_TOKEN` | Vercel Blob token for daily label backups |
103105

104106
Production env vars are managed by Terraform — do not edit them in the Vercel dashboard. See [`terraform/`](./terraform/) and [`docs/deployment.md`](./docs/deployment.md).
105107

@@ -127,20 +129,24 @@ Contract addresses and ABIs are sourced from the published [`@mento-protocol/con
127129

128130
Each network has a dedicated deploy branch Envio watches:
129131

130-
| Network | Deploy Branch |
131-
| ------------ | --------------------- |
132-
| Celo Mainnet | `deploy/celo-mainnet` |
133-
| Celo Sepolia | `deploy/celo-sepolia` |
132+
| Network | Deploy Branch |
133+
| ------------- | ---------------------- |
134+
| Celo Mainnet | `deploy/celo-mainnet` |
135+
| Celo Sepolia | `deploy/celo-sepolia` |
136+
| Monad Mainnet | `deploy/monad-mainnet` |
137+
| Monad Testnet | `deploy/monad-testnet` |
134138

135139
Push to trigger a redeploy:
136140

137141
```bash
138-
pnpm deploy:indexer:mainnet
139-
# or
142+
pnpm deploy:indexer celo-mainnet
143+
# or run without args to be prompted:
144+
pnpm deploy:indexer
145+
# or push directly:
140146
git push origin main:deploy/celo-mainnet
141147
```
142148

143-
> ⚠️ **Sepolia endpoint changes on each Envio redeploy.** After redeploying the Sepolia indexer, update `hasura_url_sepolia_hosted` in `terraform/terraform.tfvars` and run `pnpm infra:apply`.
149+
> ⚠️ **Celo Sepolia endpoint changes on each Envio redeploy.** After redeploying the Celo Sepolia indexer, update `hasura_url_celo_sepolia_hosted` in `terraform/terraform.tfvars` and run `pnpm infra:apply`.
144150
145151
### Dashboard → Vercel
146152

@@ -172,8 +178,9 @@ GitHub Actions runs on every PR:
172178
| Indexer schema | `indexer-envio/schema.graphql` |
173179
| Event handlers | `indexer-envio/src/EventHandlers.ts` |
174180
| Contract address resolution | `indexer-envio/src/contractAddresses.ts` |
175-
| Mainnet config | `indexer-envio/config.celo.mainnet.yaml` |
176-
| Sepolia config | `indexer-envio/config.celo.sepolia.yaml` |
181+
| Celo mainnet config | `indexer-envio/config.celo.mainnet.yaml` |
182+
| Celo Sepolia config | `indexer-envio/config.celo.sepolia.yaml` |
183+
| Monad mainnet/testnet configs | `indexer-envio/config.monad.*.yaml` |
177184
| Dashboard app | `ui-dashboard/src/app/` |
178185
| Address book page | `ui-dashboard/src/app/address-book/page.tsx` |
179186
| Address labels API | `ui-dashboard/src/app/api/address-labels/` |

SPEC.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,14 @@ The dashboard supports multiple network targets via a network switcher. Each net
390390
- A Hasura admin secret
391391
- A block explorer base URL
392392

393-
| Target | Description |
394-
| ---------------- | --------------------------- |
395-
| `MAINNET_HOSTED` | Celo Mainnet (Envio hosted) |
396-
| `SEPOLIA_HOSTED` | Celo Sepolia (Envio hosted) |
397-
| `MAINNET` | Celo Mainnet (local dev) |
398-
| `SEPOLIA` | Celo Sepolia (local dev) |
393+
| Target | Description |
394+
| --------------------- | --------------------------- |
395+
| `CELO_MAINNET_HOSTED` | Celo Mainnet (Envio hosted) |
396+
| `CELO_SEPOLIA_HOSTED` | Celo Sepolia (Envio hosted) |
397+
| `CELO_MAINNET` | Celo Mainnet (local dev) |
398+
| `CELO_SEPOLIA` | Celo Sepolia (local dev) |
399399

400-
The live dashboard (monitoring.mento.org) uses `MAINNET_HOSTED` by default.
400+
The live dashboard (monitoring.mento.org) uses `CELO_MAINNET_HOSTED` by default.
401401

402402
---
403403

@@ -406,7 +406,7 @@ The live dashboard (monitoring.mento.org) uses `MAINNET_HOSTED` by default.
406406
| Limitation | Details |
407407
| ------------------------------------ | ---------------------------------------------------------------------------- |
408408
| Endpoint hash changes on each deploy | Envio free tier generates new URL per deploy; requires Vercel env var update |
409-
| No authentication on dashboard | Google Auth deferred to last; Hasura secret exposed in client bundle |
409+
| No authentication on dashboard | Google Auth deferred; Envio endpoints are public (no admin secret) |
410410
| Cannot run two indexers locally | Port 9898 hardcoded in Envio |
411411
| SortedOracles on Sepolia | Contracts return zero address; oracle indexing mainnet-only |
412412
| Gap-fill not yet implemented | PoolSnapshot charts may show gaps for periods with no activity |

docs/BACKLOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Indexer schema is complete. These are dashboard-only items.
8787

8888
- [x] Monorepo extraction from devnet repo
8989
- [x] CI: ESLint 10 + Vitest (53 tests) + typecheck + Codecov
90-
- [x] `pnpm deploy:indexer:*` scripts
90+
- [x] `pnpm deploy:indexer [network]` (prompts if no network passed)
9191
- [x] `pnpm update-endpoint:mainnet` — Vercel env var update after indexer redeploy
9292
- [x] Discord notification on deploy branch push (`notify-envio-deploy.yml`) — PR #17
9393
- [x] `AGENTS.md` files for indexer + dashboard

docs/PLAN-celo-mainnet-indexer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The existing schema works for v3 FPMM pools. For v2 BiPoolManager:
8888

8989
1. **Test locally:**
9090
```bash
91-
pnpm indexer:mainnet:dev
91+
pnpm indexer:celo-mainnet:dev
9292
```
9393
2. **Deploy to Envio hosted:**
9494
- Create `mento-v3-celo-mainnet` on envio.dev (Philip — manual step)
@@ -102,7 +102,7 @@ The existing schema works for v3 FPMM pools. For v2 BiPoolManager:
102102

103103
1. **Set `ACTIVE_DEPLOYMENT["celo-mainnet"]`** in networks.ts
104104
2. **Add mainnet tokens to contracts.json** (queried on-chain)
105-
3. **Add Vercel env var:** `NEXT_PUBLIC_HASURA_URL_MAINNET_HOSTED`
105+
3. **Add Vercel env var:** `NEXT_PUBLIC_HASURA_URL_CELO_MAINNET_HOSTED`
106106
4. **Set DEFAULT_NETWORK** to `celo-mainnet-hosted`
107107
5. **Verify network switcher** shows mainnet data
108108

@@ -119,7 +119,7 @@ The existing schema works for v3 FPMM pools. For v2 BiPoolManager:
119119
- Plan: Development (Free)
120120
2. **Copy the GraphQL endpoint** from Envio dashboard after deployment
121121

122-
3. **Add Vercel env var:** `NEXT_PUBLIC_HASURA_URL_MAINNET_HOSTED=<endpoint>`
122+
3. **Add Vercel env var:** `NEXT_PUBLIC_HASURA_URL_CELO_MAINNET_HOSTED=<endpoint>`
123123

124124
4. No credentials needed from Philip — Celo mainnet RPC is public (`https://forno.celo.org`), HyperSync is available for chain 42220.
125125

docs/PLAN-oracle-health-state-DOD.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
### Verification
3939

40-
- [ ] Codegen passes for mainnet config (`pnpm indexer:mainnet:codegen`)
40+
- [ ] Codegen passes for mainnet config (`pnpm indexer:celo-mainnet:codegen`)
4141
- [ ] Dashboard builds with zero errors (`pnpm --filter ui-dashboard build`)
4242
- [ ] All existing tests pass + 15 new tests for health status computation (`pnpm --filter ui-dashboard test`)
4343

docs/ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Last updated: 2026-03-05
3939
### Infrastructure / DX
4040

4141
- [x] CI pipeline — ESLint 10 + Vitest (53 tests) + typecheck + Codecov
42-
- [x] `pnpm deploy:indexer:*` scripts
42+
- [x] `pnpm deploy:indexer [network]` (prompts if no network passed)
4343
- [x] `pnpm update-endpoint:mainnet` — updates Vercel env var via API after indexer redeploy
4444
- [x] **Discord notification on deploy branch push** (`notify-envio-deploy.yml`)
4545
- [x] `AGENTS.md` files for indexer + dashboard

0 commit comments

Comments
 (0)