Subgraph

Subgraph for OnVault

Overview

A Subgraph for the USDAO Borrowing Protocol provides a powerful querying layer that enables developers to index and query on-chain data in real time. It simplifies interaction with the protocol by offering GraphQL APIs that return structured data about Vaults, collateral flows, liquidations, and system statistics.

Subgraph Structure

The USDAO subgraph consists of the following core entities and mappings that reflect the underlying smart contracts:

Core Entities

  1. Vault: Represents an individual collateralized debt position (CDP) within the USDAO Borrowing Protocol.

    • id: Unique identifier (Ethereum address).

    • owner: Ethereum address of the Vault owner.

    • collateral: Amount of RP locked in the Vault.

    • debt: Amount of USDAO debt associated with the Vault.

    • collateralizationRatio: The current collateral-to-debt ratio.

    • status: Active or closed.

  2. Liquidation: Records information about liquidated Vaults.

    • id: Unique identifier.

    • vault: Reference to the liquidated Vault.

    • collateralLiquidated: Amount of collateral liquidated.

    • debtLiquidated: Amount of debt liquidated.

    • liquidator: Address that executed the liquidation.

  3. SystemStats: Tracks global system statistics.

    • totalCollateral: Total RP collateral across all active Vaults.

    • totalDebt: Total USDAO debt across all active Vaults.

    • totalLiquidations: Number of liquidations executed.

    • totalVaults: Total number of Vaults created.

  4. Transaction: Represents a user interaction with the protocol.

    • id: Unique transaction hash.

    • vault: Vault involved in the transaction.

    • action: The type of action (openVault, adjustVault, liquidate, repayUSDAO, etc.).

    • timestamp: Timestamp of the transaction.

Last updated