secured-finance-watcher-ts/subgraph-build/schema.graphql

159 lines
3.0 KiB
GraphQL
Raw Permalink Normal View History

2024-05-21 12:04:28 +00:00
type Transaction @entity {
id: ID!
currency: Bytes!
maturity: BigInt!
side: Int!
executionPrice: BigInt!
user: User!
executionType: TransactionExecutionType!
futureValue: BigInt!
amount: BigInt!
feeInFV: BigInt!
averagePrice: BigDecimal!
lendingMarket: LendingMarket!
order: Order!
createdAt: BigInt!
blockNumber: BigInt!
txHash: Bytes!
}
type Order @entity {
id: ID!
orderId: BigInt!
user: User!
currency: Bytes!
side: Int!
maturity: BigInt!
inputUnitPrice: BigInt!
inputAmount: BigInt!
filledAmount: BigInt!
status: OrderStatus!
statusUpdatedAt: BigInt!
lendingMarket: LendingMarket!
isPreOrder: Boolean!
type: OrderType!
transactions: [Transaction!]! @derivedFrom(field: "order")
isCircuitBreakerTriggered: Boolean!
createdAt: BigInt!
blockNumber: BigInt!
txHash: Bytes!
}
type LendingMarket @entity {
id: ID!
currency: Bytes!
maturity: BigInt!
isActive: Boolean!
transactions: [Transaction!]! @derivedFrom(field: "lendingMarket")
orders: [Order!]! @derivedFrom(field: "lendingMarket")
volume: BigInt!
dailyVolume: [DailyVolume!]! @derivedFrom(field: "lendingMarket")
openingUnitPrice: BigInt!
lastLendUnitPrice: BigInt!
lastBorrowUnitPrice: BigInt!
offsetAmount: BigInt!
}
enum TransactionExecutionType {
Maker
Taker
}
enum OrderType {
Market
Limit
Unwind
}
enum OrderStatus {
Open
PartiallyFilled
Filled
Killed
Cancelled
}
type User @entity {
id: ID! # wallet address
createdAt: BigInt!
transactionCount: BigInt!
transactions: [Transaction!]! @derivedFrom(field: "user")
orderCount: BigInt!
orders: [Order!]! @derivedFrom(field: "user")
liquidationCount: BigInt!
liquidations: [Liquidation!]! @derivedFrom(field: "user")
transferCount: BigInt!
transfers: [Transfer!]! @derivedFrom(field: "user")
deposits: [Deposit!]! @derivedFrom(field: "user")
}
type DailyVolume @entity {
id: ID! # currency-maturity-date(yyyy-mm-dd)
currency: Bytes!
maturity: BigInt!
day: String! # dd-mm-yyyy
volume: BigInt!
timestamp: BigInt!
lendingMarket: LendingMarket!
}
type Protocol @entity {
id: ID! # 1
totalUsers: BigInt!
}
type Liquidation @entity {
id: ID!
collateralCurrency: Bytes!
debtCurrency: Bytes!
debtMaturity: BigInt!
debtAmount: BigInt!
user: User!
timestamp: BigInt!
blockNumber: BigInt!
txHash: Bytes!
}
enum TransferType {
Deposit
Withdraw
}
type Transfer @entity {
id: ID!
user: User!
currency: Bytes!
amount: BigInt!
transferType: TransferType!
timestamp: BigInt!
blockNumber: BigInt!
txHash: Bytes!
}
type Deposit @entity {
id: ID!
user: User!
currency: Bytes!
amount: BigInt!
}
type TransactionCandleStick @entity {
id: ID! # A composite ID, e.g., "currency-maturity-interval-epochTime"
interval: BigInt! # interval in seconds
currency: Bytes!
maturity: BigInt!
timestamp: BigInt! # The start time of the interval
open: BigInt!
close: BigInt!
high: BigInt!
low: BigInt!
average: BigDecimal!
volume: BigInt!
volumeInFV: BigInt!
lendingMarket: LendingMarket!
}