Schema Reference

PostgreSQL with Prisma ORM. Seven tables covering transactions, token transfers, wallet positions, protocol metrics, and caching layers.

Source: prisma/schema.prisma

Core Tables

Transaction

The primary table storing all decoded transactions across protocols.

model Transaction {
  id             Int      @id @default(autoincrement())
  txHash         String   @unique @map("tx_hash")
  blockNumber    BigInt   @map("block_number")
  blockTimestamp  DateTime @map("block_timestamp")
  fromAddress    String   @map("from_address")
  toAddress      String?  @map("to_address")
  valueWei       Decimal  @map("value_wei")
  gasUsed        BigInt   @map("gas_used")
  gasPrice       Decimal  @map("gas_price")
  status         Boolean
  protocol       String   // alluria, eloqura, oeconomia, artivya, iridescia
  actionType     String   @map("action_type")   // Human-readable label
  functionName   String?  @map("function_name")  // Raw ABI function name
  decodedData    Json?    @map("decoded_data")   // { args, events }
  tokenTransfers TokenTransfer[]
}

Indexes: txHash, fromAddress, toAddress, protocol, blockTimestamp DESC, (protocol, blockTimestamp DESC)

TokenTransfer

ERC-20 token transfers extracted from transaction receipt logs.

Indexes: fromAddress, toAddress, tokenSymbol, tokenAddress

Supporting Tables

WalletPosition

Cross-protocol wallet positions (vaults, LP positions, stakes).

ProtocolMetrics

Aggregated metrics over time (TVL, daily volume, unique users).

TokenMetadataCache

Cached token symbol/name/decimals/logo from Alchemy (one-time fetch per token).

TokenBalances

Per-wallet token balances updated by webhook Transfer events.

IndexedBlocks

Sync progress tracking: prevents reprocessing blocks.

Common Queries

circle-exclamation

Last updated