Skip to main content
Coming Soon: The Developers section is under active development. Documentation will be available soon.

Overview

The Centuari Subgraph indexes on-chain data for efficient querying via GraphQL.

Endpoints

NetworkURL
Arbitrum Onehttps://api.thegraph.com/subgraphs/name/centuari/centuari-arbitrum
Arbitrum Sepoliahttps://api.thegraph.com/subgraphs/name/centuari/centuari-sepolia

Example Queries

Get Market Rates

query GetRates {
  markets(first: 10, orderBy: totalVolume, orderDirection: desc) {
    id
    asset {
      symbol
      decimals
    }
    maturity
    lendRate
    borrowRate
    totalLent
    totalBorrowed
  }
}

Get User Positions

query GetUserPositions($user: String!) {
  positions(where: { user: $user }) {
    id
    type
    asset {
      symbol
    }
    amount
    rate
    maturity
    status
    createdAt
    matchedAt
  }
}

Get Order Book

query GetOrderBook($asset: String!, $maturity: BigInt!) {
  lendOrders(
    where: { asset: $asset, maturity: $maturity, status: Open }
    orderBy: rate
    orderDirection: asc
  ) {
    id
    amount
    rate
    maker
  }
  borrowOrders(
    where: { asset: $asset, maturity: $maturity, status: Open }
    orderBy: rate
    orderDirection: desc
  ) {
    id
    amount
    rate
    maker
  }
}

Get Protocol Stats

query GetProtocolStats {
  protocol(id: "centuari") {
    totalValueLocked
    totalVolume
    totalUsers
    totalPositions
  }
}

Entities

Position

type Position @entity {
  id: ID!
  user: User!
  type: PositionType!
  asset: Asset!
  amount: BigInt!
  rate: BigInt!
  maturity: BigInt!
  status: PositionStatus!
  cbt: CBT
  createdAt: BigInt!
  matchedAt: BigInt
  maturedAt: BigInt
}

Market

type Market @entity {
  id: ID!
  asset: Asset!
  maturity: BigInt!
  lendRate: BigInt!
  borrowRate: BigInt!
  totalLent: BigInt!
  totalBorrowed: BigInt!
  openLendOrders: BigInt!
  openBorrowOrders: BigInt!
}

Vault

type Vault @entity {
  id: ID!
  name: String!
  asset: Asset!
  curator: Bytes!
  totalAssets: BigInt!
  sharePrice: BigInt!
  managementFee: BigInt!
  performanceFee: BigInt!
}

SDK Integration

import { Centuari } from '@centuari/sdk';

const client = new Centuari({ chainId: 42161 });

// Uses subgraph internally
const positions = await client.getPositions({ user: '0x...' });
const rates = await client.getRates();

Self-Hosting

Deploy your own subgraph:
git clone https://github.com/centuari-labs/subgraph
cd subgraph
npm install
npm run deploy