A blockchain event indexer for the CFG protocol v3 built with Ponder.sh.
This project indexes EVM events from smart contracts in the CFG protocol, maintaining a structured database of pools, share classes, and investment transactions.
- Vault Handlers: Process deposit/withdrawal requests and executions
- MultiShareClass Handlers: Manage share class lifecycle, epoch transitions, and investor orders
- PoolRegistry Handlers: Track pool creation and configuration
- PoolManager Handlers: Handle vault deployment for share classes
The project uses several services to maintain data consistency:
PoolService
: Manages investment poolsShareClassService
: Handles share class configuration and metadataEpochService
: Tracks investment epochsInvestorTransactionService
: Processes user deposits and redemptionsOutstandingOrderService
: Tracks pending investment orders
- Node.js (v22+)
- Ethereum RPC endpoint
# Install dependencies
yarn install --frozen-lockfile
# Create .env file with your configuration
cp .env.example .env.local
# Edit .env with your settings (RPC endpoint and API key)
yarn codegen
- Edit your
chains.ts
file to specify contracts to query - Specify what chain to index in
ponder.config.ts
# Start the development server
yarn dev
# Build for production
yarn build
# Start production server
yarn start
The indexer builds and maintains a structured database with the following primary entities:
- Pools
- ShareClasses
- Epochs
- InvestorTransactions
- OutstandingOrders
Once running, the Ponder indexer provides a GraphQL API for querying indexed data. URL printed on start.
erDiagram
direction LR
Blockchain ||--o{ Pool : ""
Blockchain ||--o{ Vault : ""
Blockchain ||--o{ Asset : ""
Blockchain ||--o{ TokenInstance : ""
Blockchain ||--o{ AssetRegistration : ""
Pool ||--o{ PoolSnapshot : ""
Pool ||--o{ Token : ""
Pool ||--o{ Epoch : ""
Asset }o--|| Blockchain : ""
Asset }o--|| AssetRegistration : ""
TokenInstance }o--|| Blockchain : ""
TokenInstance }o--|| Token : ""
Vault }o--|| Blockchain : ""
Vault }o--|| Token : ""
Vault }o--|| Asset : ""
Vault }o--|| TokenInstance : ""
InvestorTransaction }o--|| Pool : ""
InvestorTransaction }o--|| Epoch : ""
InvestorTransaction }o--|| Token : ""
OutstandingOrder }o--|| Token : ""
Holding }o--|| Token : ""
Holding }o--|| HoldingAccount : ""
HoldingEscrow }o--|| Holding : ""
HoldingEscrow }o--|| Asset : ""
HoldingEscrow }o--|| Escrow : ""
Contributions are welcome! Please feel free to submit a Pull Request.
TBD