Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/indexer-envio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@ jobs:
- name: Validate all Envio configs (codegen)
if: steps.changes.outputs.indexer == 'true'
# Run codegen against every config file to catch schema/config drift early.
# Celo mainnet is run last (its output is used by typecheck + tests below).
# Monad configs are validated for syntax/schema correctness even with empty
# address arrays — this catches drift before deploy time.
# config.multichain.mainnet.yaml is run last — its output is used by
# typecheck + tests below.
run: |
pnpm --filter @mento-protocol/indexer-envio codegen --config config.monad.testnet.yaml
pnpm --filter @mento-protocol/indexer-envio codegen --config config.monad.mainnet.yaml
pnpm --filter @mento-protocol/indexer-envio codegen --config config.celo.sepolia.yaml
pnpm --filter @mento-protocol/indexer-envio codegen --config config.celo.mainnet.yaml
pnpm --filter @mento-protocol/indexer-envio codegen --config config.multichain.testnet.yaml
pnpm --filter @mento-protocol/indexer-envio codegen --config config.multichain.mainnet.yaml
- name: Link generated package
if: steps.changes.outputs.indexer == 'true'
# pnpm install runs before generated/ exists, so the workspace symlink for
Expand Down
30 changes: 11 additions & 19 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@ pnpm monorepo with three packages:
pnpm install

# Indexer
pnpm indexer:codegen # Generate types from schema (devnet)
pnpm indexer:dev # Start indexer (devnet)
pnpm indexer:celo-sepolia:codegen # Generate types (Celo Sepolia config)
pnpm indexer:celo-sepolia:dev # Start indexer (Celo Sepolia)
pnpm indexer:celo-mainnet:codegen # Generate types (Celo mainnet)
pnpm indexer:celo-mainnet:dev # Start indexer (Celo mainnet)
pnpm indexer:monad-mainnet:codegen # Generate types (Monad mainnet)
pnpm indexer:monad-mainnet:dev # Start indexer (Monad mainnet)
pnpm indexer:monad-testnet:codegen # Generate types (Monad testnet)
pnpm indexer:monad-testnet:dev # Start indexer (Monad testnet)
pnpm indexer:codegen # Generate types from schema (multichain mainnet)
pnpm indexer:dev # Start indexer (multichain mainnet: Celo + Monad)
pnpm indexer:testnet:codegen # Generate types (multichain testnet: Celo Sepolia + Monad testnet)
pnpm indexer:testnet:dev # Start indexer (multichain testnet)

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

- **Runtime:** Envio HyperIndex (envio@2.32.3)
- **Schema:** `schema.graphql` defines indexed entities (FPMM, Swap, Mint, Burn, etc.)
- **Configs:** `config.celo.devnet.yaml`, `config.celo.mainnet.yaml`, `config.celo.sepolia.yaml`, `config.monad.mainnet.yaml`, `config.monad.testnet.yaml`
- **Configs:** `config.multichain.mainnet.yaml` (default), `config.multichain.testnet.yaml`
- **Handlers:** `src/EventHandlers.ts` is the Envio entry point (all `config.*.yaml` files reference it). It imports handler modules from `src/handlers/` and re-exports test utilities. Handler logic lives in `src/handlers/fpmm.ts`, `src/handlers/sortedOracles.ts`, `src/handlers/virtualPool.ts`, `src/handlers/feeToken.ts`. Shared logic: `src/rpc.ts` (RPC + caches), `src/pool.ts` (upsert), `src/priceDifference.ts`, `src/tradingLimits.ts`, `src/feeToken.ts`, `src/abis.ts`, `src/helpers.ts`.
- **Contract addresses:** `src/contractAddresses.ts` — resolves addresses from `@mento-protocol/contracts` using the namespace map from `shared-config`
- **ABIs:** `abis/` — FPMMFactory, FPMM, VirtualPoolFactory (indexer-specific); SortedOracles + token ABIs come from `@mento-protocol/contracts`
Expand Down Expand Up @@ -89,11 +83,9 @@ monitoring-monorepo/
│ ├── package.json
│ └── deployment-namespaces.json # ← edit this when promoting a new deployment
├── indexer-envio/
│ ├── config.celo.devnet.yaml # Devnet indexer config
│ ├── config.celo.mainnet.yaml # Celo Mainnet config
│ ├── config.celo.sepolia.yaml # Celo Sepolia config
│ ├── config.monad.mainnet.yaml # Monad Mainnet config
│ ├── config.monad.testnet.yaml # Monad Testnet config
│ ├── config.multichain.mainnet.yaml # Mainnet indexer config (Celo + Monad) — DEFAULT
│ ├── config.multichain.testnet.yaml # Testnet multichain config

│ ├── schema.graphql # Entity definitions
│ ├── src/
│ │ ├── EventHandlers.ts # Envio entry point (imports handlers, re-exports for tests)
Expand Down Expand Up @@ -170,7 +162,7 @@ This installs deps and runs Envio codegen (required for `indexer-envio` TypeScri
pnpm --filter @mento-protocol/ui-dashboard typecheck
pnpm --filter @mento-protocol/indexer-envio typecheck
pnpm --filter @mento-protocol/indexer-envio test
pnpm indexer:celo-mainnet:codegen # Validates Envio can parse handler entry point + module imports
pnpm indexer:codegen # Validates Envio can parse handler entry point + module imports
pnpm --filter @mento-protocol/ui-dashboard test:coverage
```

Expand All @@ -182,7 +174,7 @@ pnpm --filter @mento-protocol/ui-dashboard test:coverage

### EventHandlers.ts must remain the handler entry point

Every `config.*.yaml` specifies `handler: src/EventHandlers.ts`. Envio expects all handler registrations (e.g. `FPMM.Swap.handler(...)`) to be reachable from this file at module load time. The actual logic lives in `src/handlers/*.ts` — these are imported as side effects from `EventHandlers.ts`. If you add a new handler file, you **must** add a corresponding `import "./handlers/yourFile"` in `EventHandlers.ts` and then re-run `pnpm indexer:celo-mainnet:codegen` to verify Envio picks it up.
Every `config.*.yaml` specifies `handler: src/EventHandlers.ts`. Envio expects all handler registrations (e.g. `FPMM.Swap.handler(...)`) to be reachable from this file at module load time. The actual logic lives in `src/handlers/*.ts` — these are imported as side effects from `EventHandlers.ts`. If you add a new handler file, you **must** add a corresponding `import "./handlers/yourFile"` in `EventHandlers.ts` and then re-run `pnpm indexer:codegen` to verify Envio picks it up.

## Common Tasks

Expand All @@ -198,7 +190,7 @@ When a new set of contracts has been deployed and a new `@mento-protocol/contrac
### Adding a new contract to index

1. Add ABI to `indexer-envio/abis/`
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`
2. Add contract entry in the relevant config(s): `config.multichain.mainnet.yaml`, `config.multichain.testnet.yaml`
3. Add entity to `schema.graphql`
4. Add handler in the appropriate `src/handlers/*.ts` file (or create a new one and import it from `src/EventHandlers.ts`)
5. Run `pnpm indexer:codegen` to regenerate types
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,11 @@ pnpm install
### Run the Indexer (local)

```bash
# Multichain (Celo + Monad mainnet) — default
# Multichain mainnet (Celo + Monad) — default
pnpm indexer:codegen && pnpm indexer:dev

# Celo Sepolia (testnet)
pnpm indexer:celo-sepolia:codegen && pnpm indexer:celo-sepolia:dev

# Monad Testnet
pnpm indexer:monad-testnet:codegen && pnpm indexer:monad-testnet:dev
# Multichain testnet (Celo Sepolia + Monad testnet)
pnpm indexer:testnet:codegen && pnpm indexer:testnet:dev
```

### Run the Dashboard
Expand Down
28 changes: 28 additions & 0 deletions bootstrap-worktree.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# bootstrap-worktree.sh — monitoring-monorepo
# Run after worktree creation to get a fully working environment.
set -euo pipefail
cd "$(dirname "$0")"

echo "📦 Installing dependencies..."
pnpm install --frozen-lockfile

echo "🔧 Running indexer codegen (multichain mainnet)..."
pnpm indexer:codegen

echo "✅ Verifying typecheck..."
pnpm --filter @mento-protocol/ui-dashboard typecheck
pnpm --filter @mento-protocol/indexer-envio typecheck

echo "🧪 Running tests..."
pnpm --filter @mento-protocol/ui-dashboard test
pnpm --filter @mento-protocol/indexer-envio test

echo ""
echo "🚀 monitoring-monorepo is ready to code"
echo ""
echo "Key commands:"
echo " pnpm dashboard:dev — start dashboard dev server"
echo " pnpm dashboard:build — production build"
echo " pnpm indexer:codegen — regenerate indexer types"
echo " ./tools/trunk check --all — lint everything"
12 changes: 5 additions & 7 deletions indexer-envio/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

## What This Is

Envio HyperIndex indexer for Mento v3 FPMM (Fixed Product Market Maker) pools on Celo.
Envio HyperIndex indexer for Mento v3 FPMM (Fixed Product Market Maker) pools on Celo + Monad (multichain).

## Key Files

- `config.celo.devnet.yaml` — Devnet indexer config (contract addresses, events, RPC)
- `config.celo.mainnet.yaml` — Celo Mainnet config
- `config.celo.sepolia.yaml` — Celo Sepolia testnet config
- `config.monad.mainnet.yaml` — Monad Mainnet config
- `config.monad.testnet.yaml` — Monad Testnet config
- `config.multichain.mainnet.yaml` — **Default** mainnet config (Celo + Monad)
- `config.multichain.testnet.yaml` — Testnet multichain config

- `schema.graphql` — Entity definitions (FPMM, Swap, Mint, Burn, UpdateReserves, Rebalanced)
- `src/EventHandlers.ts` — Event processing logic
- `src/contractAddresses.ts` — Contract address resolution from `@mento-protocol/contracts`; also exports `CONTRACT_NAMESPACE_BY_CHAIN` (backed by `config/deployment-namespaces.json`)
Expand Down Expand Up @@ -59,4 +57,4 @@ Copy `.env.example` → `.env` and set:

Do **not** set the generic `ENVIO_RPC_URL` in multichain mode — it would route all chains to the same endpoint and produce incorrect RPC reads for chain-specific calls.

Default (multichain Celo + Monad mainnet): `pnpm indexer:codegen && pnpm indexer:dev`. For Celo Sepolia testnet: `pnpm indexer:celo-sepolia:dev`. For Monad Testnet: `pnpm indexer:monad-testnet:dev`.
Mainnet (Celo + Monad): `pnpm indexer:codegen && pnpm indexer:dev`. Testnet (Celo Sepolia + Monad Testnet): `pnpm indexer:testnet:dev`.
10 changes: 4 additions & 6 deletions indexer-envio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ GraphQL endpoint: `http://localhost:8080/v1/graphql`
### Available Commands (from repo root)

```bash
pnpm indexer:codegen # Generate types (multichain — Celo + Monad mainnet)
pnpm indexer:dev # Start local multichain indexer
pnpm indexer:celo-sepolia:codegen # Generate types for Celo Sepolia testnet
pnpm indexer:celo-sepolia:dev # Start local Celo Sepolia indexer
pnpm indexer:monad-testnet:codegen # Generate types for Monad Testnet
pnpm indexer:monad-testnet:dev # Start local Monad Testnet indexer
pnpm indexer:codegen # Generate types (multichain mainnet — Celo + Monad)
pnpm indexer:dev # Start local multichain mainnet indexer
pnpm indexer:testnet:codegen # Generate types (multichain testnet — Celo Sepolia + Monad testnet)
pnpm indexer:testnet:dev # Start local multichain testnet indexer
pnpm deploy:indexer # Push to envio branch → triggers hosted reindex
```

Expand Down
51 changes: 0 additions & 51 deletions indexer-envio/config.celo.devnet.yaml

This file was deleted.

93 changes: 0 additions & 93 deletions indexer-envio/config.celo.mainnet.yaml

This file was deleted.

Loading
Loading