Skip to main content

Protocol Statistics

Query aggregate statistics for the entire Intuition protocol.

Query Structure​

query GetProtocolStats {
stats {
id
total_atoms
total_triples
total_positions
total_signals
total_accounts
total_fees
contract_balance
created_at
updated_at
}
}

Response Fields​

FieldTypeDescription
idStringStats record ID
total_atomsIntTotal atoms created
total_triplesIntTotal triples created
total_positionsIntTotal active positions
total_signalsIntTotal signals (deposits + redemptions)
total_accountsIntUnique accounts that have interacted
total_feesStringTotal protocol fees in wei
contract_balanceStringCurrent contract balance in wei
updated_atDateTimeLast update timestamp

Expected Response​

{
"data": {
"stats": [
{
"id": "1",
"total_atoms": 15420,
"total_triples": 42350,
"total_positions": 8750,
"total_signals": 25000,
"total_accounts": 3200,
"total_fees": "1500000000000000000",
"contract_balance": "500000000000000000000",
"updated_at": "2024-01-15T10:30:00Z"
}
]
}
}

Interactive Example​

Query

query GetProtocolStats {
  stats {
    total_atoms
    total_triples
    total_positions
    total_accounts
    total_fees
    contract_balance
    updated_at
  }
}

Variables

Click "Run Query" to execute the GraphQL query and see results

Use Cases​

Dashboard Overview​

Display protocol metrics on a dashboard:

async function getProtocolOverview() {
const query = `
query GetProtocolOverview {
stats {
total_atoms
total_triples
total_positions
total_accounts
total_fees
contract_balance
}
}
`

const data = await client.request(query)
const stats = data.stats[0]

return {
atoms: stats.total_atoms,
triples: stats.total_triples,
positions: stats.total_positions,
users: stats.total_accounts,
tvl: formatEther(stats.contract_balance),
fees: formatEther(stats.total_fees)
}
}

React Stats Component​

function ProtocolStats() {
const { data, loading } = useQuery(GET_PROTOCOL_STATS)

if (loading) return <Spinner />

const stats = data?.stats?.[0]

return (
<div className="stats-grid">
<StatCard
title="Total Atoms"
value={stats.total_atoms.toLocaleString()}
/>
<StatCard
title="Total Triples"
value={stats.total_triples.toLocaleString()}
/>
<StatCard
title="Active Positions"
value={stats.total_positions.toLocaleString()}
/>
<StatCard
title="Unique Users"
value={stats.total_accounts.toLocaleString()}
/>
<StatCard
title="Total Value Locked"
value={`${formatEther(stats.contract_balance)} ETH`}
/>
<StatCard
title="Protocol Fees"
value={`${formatEther(stats.total_fees)} ETH`}
/>
</div>
)
}

Best Practices​

  1. Cache results - Stats update periodically, not in real-time
  2. Format large numbers - Use locale formatting for readability
  3. Convert wei - Display ETH values instead of wei
  4. Show update time - Indicate when stats were last refreshed