Manages expansion of tokens, pools, chains, networks, and DEXes across the codebase. Use when adding new tokens, protocols, chains, networks, or updating existing DeFi registry data. Triggers on add token, new coin, add protocol, new DEX, add chain, new network, add RPC, update address.
Manages expansion of tokens, pools, chains, networks, and DEXes across the codebase.
Determine if adding token, protocol, chain, or network.
Use the appropriate checklist for the registry type.
Ensure ALL required files are updated together.
Run validation commands to verify consistency.
| File | Purpose | Format |
|---|---|---|
client/src/constants/protocols.ts | Frontend token list | TOKENS[chainId] array |
rust-core/crates/core/src/tokens.rs | Rust core tokens | TOKENS LazyLock HashMap |
server/src/services/wallet.ts | Wallet service tokens | COMMON_TOKENS + TOKEN_SYMBOLS |
shared/schema.ts | Shared decimals map | TOKEN_DECIMALS record |
| File | Purpose |
|---|---|
client/src/constants/protocols.ts | PROTOCOLS array |
server/src/services/arbitrage.ts | DEXES array for scanning |
server/src/services/price-oracle.ts | Price oracle adapters |
| File | Purpose |
|---|---|
client/src/constants/protocols.ts | CHAINS array + ChainId type |
rust-core/crates/core/src/lib.rs | ChainId enum |
server/src/config/env.ts | RPC URLs per chain |
shared/schema.ts | ChainId type |
server/src/db/schema.ts | adminChains table (Admin UI) |
| File | Purpose |
|---|---|
server/src/config/env.ts | Primary RPC URLs, WebSocket endpoints |
server/src/db/schema.ts | adminChains table with rpcUrl, explorerUrl |
rust-core/crates/core/src/lib.rs | Network constants, block times |
server/src/services/trade-executor.ts | Chain-specific gas settings |
| Table | Purpose |
|---|---|
adminTokens | Dynamic token registry via Admin UI |
adminProtocols | Dynamic protocol/DEX registry via Admin UI |
adminChains | Dynamic chain/network config via Admin UI |
strategies | Trading strategy configurations |
[ ] 1. Verify token address on block explorer (checksum format)
[ ] 2. Confirm decimals (CRITICAL: USDC/USDT=6, WBTC=8, most=18)
[ ] 3. Update client/src/constants/protocols.ts - TOKENS[chainId]
[ ] 4. Update rust-core/crates/core/src/tokens.rs - chain_tokens.insert()
[ ] 5. Update server/src/services/wallet.ts - COMMON_TOKENS[chainId]
[ ] 6. Update server/src/services/wallet.ts - TOKEN_SYMBOLS (lowercase)
[ ] 7. Update shared/schema.ts - TOKEN_DECIMALS (if not standard 18)
[ ] 8. Run: grep -r "TOKEN_ADDRESS_HERE" to find any hardcoded refs
// Frontend (protocols.ts)
{
address: '0x...', // Checksum address
symbol: 'TOKEN',
name: 'Token Name',
decimals: 18,
chains: ['ethereum'],
}
// Rust (tokens.rs)
tokens.insert("TOKEN", Token::new(
"0x...".parse().unwrap(),
"TOKEN", "Token Name", 18, ChainId::Ethereum
));
// Wallet service (wallet.ts) - COMMON_TOKENS
'0x...', // TOKEN
// Wallet service (wallet.ts) - TOKEN_SYMBOLS
'0x...lowercase': 'TOKEN',
[ ] 1. Add to client/src/constants/protocols.ts - PROTOCOLS array
[ ] 2. Add router address to shared/schema.ts - PROTOCOL_ADDRESSES
[ ] 3. Add to server/src/services/arbitrage.ts - DEXES (if scannable)
[ ] 4. Create adapter in server/src/services/price-oracle.ts (if needed)
[ ] 5. Update validation.ts if protocol needs specific validation
[ ] 1. Add ChainId to shared/schema.ts
[ ] 2. Add ChainId enum variant to rust-core/crates/core/src/lib.rs
[ ] 3. Add to client/src/constants/protocols.ts - CHAINS array
[ ] 4. Add RPC URL to server/src/config/env.ts
[ ] 5. Add chain config to server/src/services/trade-executor.ts
[ ] 6. Add tokens for new chain in all token files
[ ] 7. Add protocol addresses for new chain
[ ] 8. (Optional) Add to adminChains via Admin UI for dynamic config
[ ] 1. Obtain reliable RPC endpoint (Alchemy, Infura, QuickNode, or self-hosted)
[ ] 2. Add environment variable to server/src/config/env.ts
- HTTP RPC: {CHAIN}_RPC_URL
- WebSocket: {CHAIN}_WS_URL (if needed for subscriptions)
[ ] 3. Configure rate limits and fallback RPCs if available
[ ] 4. Add network parameters to rust-core/crates/core/src/lib.rs:
- Block time (for timing estimates)
- Gas token decimals
- EIP-1559 support flag
[ ] 5. Configure gas settings in server/src/services/trade-executor.ts:
- Base fee multiplier
- Priority fee defaults
- Gas limit overrides
[ ] 6. Add explorer URL for transaction links
[ ] 7. Test connectivity: curl -X POST {RPC_URL} -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
[ ] 8. Add to Admin UI via /admin -> Chains tab for dynamic updates
// Environment (.env)
ETHEREUM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
ETHEREUM_WS_URL=wss://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
ARBITRUM_RPC_URL=https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY
// server/src/config/env.ts