Files
smom-dbis-138/services/token-aggregation/QUICK_START.md
defiQUG 76aa419320 feat: bridges, PMM, flash workflow, token-aggregation, and deployment docs
- CCIP/trustless bridge contracts, GRU tokens, DEX/PMM tests, reserve vault.
- Token-aggregation service routes, planner, chain config, relay env templates.
- Config snapshots and multi-chain deployment markdown updates.
- gitignore services/btc-intake/dist/ (tsc output); do not track dist.

Run forge build && forge test before deploy (large solc graph).

Made-with: Cursor
2026-04-07 23:40:52 -07:00

118 lines
2.4 KiB
Markdown

# Quick Start Guide
## Prerequisites
1. Node.js 20+
2. PostgreSQL 14+ with TimescaleDB extension
3. Access to RPC endpoints for ChainID 138 and 651940
## Quick Setup (5 minutes)
### 1. Install Dependencies
```bash
cd smom-dbis-138/services/token-aggregation
npm install
```
### 2. Configure Environment
```bash
cp .env.example .env
# Edit .env with your values
```
Minimum required in `.env`:
```bash
DATABASE_URL=postgresql://user:password@localhost:5432/explorer_db
CHAIN_138_RPC_URL=http://192.168.11.221:8545
CHAIN_651940_RPC_URL=https://mainnet-rpc.alltra.global
```
Use `https://rpc-http-pub.d-bis.org` only for external/public-only deployments. Do not point explorer/read services at the operator core RPC `http://192.168.11.211:8545`.
### 3. Run Database Migration
```bash
# Navigate to explorer backend and run migration
cd ../../explorer-monorepo/backend
# Run migration 0011_token_aggregation_schema.up.sql
```
### 4. Build and Start
```bash
cd ../../smom-dbis-138/services/token-aggregation
npm run build
npm start
```
### 5. Verify
```bash
# Health check
curl http://localhost:3000/health
# Test API
curl http://localhost:3000/api/v1/chains
```
## Docker Quick Start
```bash
# Build and run
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down
```
## Development Mode
```bash
npm run dev
```
## API Examples
### Get token details
```bash
curl "http://localhost:3000/api/v1/tokens/0x93E66202A11B1772E55407B32B44e5Cd8eda7f22?chainId=138"
```
### Get token pools
```bash
curl "http://localhost:3000/api/v1/tokens/0x93E66202A11B1772E55407B32B44e5Cd8eda7f22/pools?chainId=138"
```
### Get OHLCV data
```bash
curl "http://localhost:3000/api/v1/tokens/0x93E66202A11B1772E55407B32B44e5Cd8eda7f22/ohlcv?chainId=138&interval=1h"
```
### Search tokens
```bash
curl "http://localhost:3000/api/v1/search?q=USDT&chainId=138"
```
## Troubleshooting
### Database Connection Issues
- Verify `DATABASE_URL` is correct
- Ensure PostgreSQL is running
- Check TimescaleDB extension is enabled
### RPC Connection Issues
- Test RPC endpoints manually
- Verify RPC URLs in `.env`
### Indexing Not Working
- Check logs for errors
- Verify DEX factory addresses are configured
- Ensure RPC endpoints have required APIs enabled
## Next Steps
1. Configure DEX factory addresses for your chains
2. (Optional) Add external API keys for enrichment
3. Monitor indexing progress in logs
4. Integrate with your frontend/explorer