Skip to content

Subgraph Data Integrity Reference

0xdavinchee edited this page Jun 27, 2022 · 1 revision

Summary

Below are the invariants we are validating in our Subgraph Data Integrity scripts.

Account Integrity Tests

  • A.0: Balance data matching: Real Time Balance (availableBalance + deposit + owedDeposit) === Subgraph Calculated Balance
  • A.1: CFA on-chain data matching subgraph data
    • A.1.a: Flow data matching => { timestamp, flowRate }
    • A.1.b: Net flow
  • A.2: IDA on-chain data matching subgraph data
    • A.2.a: Index data matching => { exist, indexValue, totalUnitsApproved, totalUnitsPending }
    • A.2.b: Subscription data matching => { exist, approved, units, pendingDistribution }

Global Integrity Tests

  • G.0: Total supply should match super token assets under management
    • AUM: underlyingToken.balanceOf(superToken address)
  • G.1: Sum of all RTB <= SuperToken total supply
  • G.2: CFA total net flow === zero
  • G.3: IDA total subscriber units === total index units
  • G.4: CFA/IDA on-chain events matching subgraph events
  • G.5: Subgraph Token Total Supply === On-chain Token Total Supply
Clone this wiki locally