Onyx Protocol
  • 📖Onyx Documentation
  • ☕Getting Started
    • 🔬Networks
    • 📒Protocol Math
      • oToken and Underlying Decimals
      • Interpreting Exchange Rates
      • Calculating Accrued Interest
      • Calculating the APY Using Rate Per Block
    • 💹Gas Costs
  • 🧑‍💻OTokens
    • Mint
    • Redeem
    • Redeem Underlying
    • Borrow
    • Repay Borrow
    • Repay Borrow Behalf
    • Transfer
    • Liquidate Borrow
    • Key Events
    • Error Codes
    • Failure Info
    • Exchange Rate
    • Get Cash
    • Total Borrow
    • Borrow Balance
    • Borrow Rate
    • Total Supply
    • Underlying Balance
    • Supply Rate
    • Total Reserves
    • Reserve Factor
  • ⚙️Comptroller
    • Enter Markets
    • Exit Market
    • Get Assets In
    • Collateral Factor
    • Get Account Liquidity
    • Close Factor
    • Liquidation Incentive
    • Key Events
    • Error Codes
    • Failure Info
    • XCN Distribution Speeds
    • Claim XCN
    • Market Metadata
  • 👨‍👩‍👦Governance
    • Governor Alpha
    • Quorum Votes
    • Proposal Threshold
    • Proposal Max Operations
    • Voting Delay
    • Voting Period
    • Propose
    • Queue
    • Execute
    • Cancel
    • Get Actions
    • Get Receipt
    • State
    • Cast Vote
    • Cast Vote By Signature
    • Timelock
    • Pause Guardian
  • 🔡API
    • Basic API
      • GET: /otoken
      • GET: /market_history/graph
      • GET: /user/history
      • GET: /get_liquidators
      • GET: /get_liquidator:account
      • GET: /get_liquidator_detail:account
      • GET: /liquidator
    • GraphQL API
      • oTokens Subgraph
      • History Subgraph
      • Governance Subgraph
    • Governance API
      • GET: /proposal
      • GET: /proposal/:proposalId
      • GET: /voter/:proposalId
      • GET: /voter/accounts
      • GET: /voter/history/:address
    • Shared Data Types
  • 📖Onyx.js
    • Onyx Constructor
    • API Methods
      • Account
      • oToken
      • Market History
      • Governance
    • oToken Methods
      • Supply
      • Redeem
      • Borrow
      • Repay Borrow
    • XCN Methods
      • To Checksum Address
      • Get XCN Balance
      • Get XCN Accrued
      • Claim XCN
      • Delegate
      • Delegate By Sig
      • Create Delegate Signature
    • Comptroller Methods
      • Enter Markets
      • Exit Market
    • Ethereum Methods
      • Read
      • Trx
      • Get Balance
    • Governance Methods
      • Cast Vote
      • Cast Vote By Sig
      • Create Vote Signature
    • Price Feed Methods
      • Get Price
    • Utility Methods
      • Get Address
      • Get ABI
      • Get Network Name With Chain ID
  • 🔒Security
    • Bug Bounty Program
  • 📄Terms of Service
Powered by GitBook
On this page
  1. API
  2. GraphQL API

History Subgraph

Subgraph of protocol history (borrows, repays, mints, liquidations, votes, etc.)

History action

HistoryItem schema:

type HistoryItem @entity(immutable: true) {
  id: Bytes!
  type: HistoryItemType!
  to: Bytes! # address
  from: Bytes! # address
  amount: BigInt!
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

enum HistoryItemType {
  stake
  transfer
  supply
  withdraw
  claim
  propose
  vote
  approval
  redeem
  borrow
  repayBorrow
  liquidateBorrow
  reservesAdded
  reservesReduced
}
Field
Type
Description

id

Bytes! (required string)

Unique history item id

type

HistoryItemType! (required string)

Type of history item, all types described in HistoryItemType enum

to

Bytes! (required string)

Transaction to property address, may be contract or user address in case of transfer

from

Bytes! (required string)

Transaction from property address

amount

BigInt! (required string)

Amount of operation from event (borrow amount, repay amount, etc.)

blockNumber

BigInt! (required string)

Number of the block when history item was created

blockTimestamp

BigInt! (required string)

Timestamp of the block when history item was created

transactionHash

Bytes! (required string)

Hash of the transaction with event of history item creation

Example of HistoryItem querying:

{
  historyItems(first: 5) {
    id
    type
    to
    from
    amount
    blockNumber
    blockTimestamp
    transactionHash
  }
}
PreviousoTokens SubgraphNextGovernance Subgraph

Last updated 1 year ago

🔡