erc20-subgraph/schema.graphql

207 lines
3.4 KiB
GraphQL

#
# Provides information about an Ethereum account
#
type Account @entity {
" Equals to: <accountAddress>"
id: ID!
" Account address "
address: Bytes!
" Token balances that this account holds "
balances: [AccountBalance!]! @derivedFrom(field: "account")
}
#
# Current token balance of a particular Ethereum account
#
type AccountBalance @entity {
" Equals to: <accountAddress>-<tokenAddress>"
id: ID!
" Account address "
account: Account!
" Token address "
token: Token!
" Current account balance "
amount: BigDecimal!
" Block number in which the balance was last modified "
block: BigInt
" Last modified timestamp in seconds "
modified: BigInt
" Hash of the last transaction that modified the balance "
transaction: Bytes
}
#
# Token balance of a particular Ethereum account in a certain timestamp. This entity is used to
# provide information about evolution of account balances
#
type AccountBalanceSnapshot @entity {
" Equals to: <accountAddress>-<tokenAddress>-<timestamp>"
id: ID!
" Account address "
account: Account!
" Token addess "
token: Token!
" Account balance "
amount: BigDecimal!
# TODO: Add description and check if could be non-optional
event: TokenEvent
" Block number "
block: BigInt!
" Timestamp in seconds "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}
#
# Provides information about an ERC20 token
#
type Token @entity {
id: ID!
" Token address "
address: Bytes!
" Number of decimals the token uses "
decimals: Int!
" Human-readable name of the token "
name: String!
" Symbol of the token "
symbol: String!
" Token description "
description: String
" Image URL "
imageUrl: String
" Token flags"
flags: [String!]!
# TODO: Number of token holders
# holderCount: BigInt!
# TODO: Total token supply
# totalSupply: BigDecimal!
# TODO:
# totalMinted: BigDecimal
# TODO:
# totalBurned: BigDecimal
events: [TokenEvent!]! @derivedFrom(field: "token")
}
#
# Token events
#
interface TokenEvent {
id: ID!
token: Token!
amount: BigDecimal!
sender: Bytes!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
type BurnEvent implements TokenEvent @entity {
id: ID!
" Token address "
token: Token!
" Quantity of tokens burned "
amount: BigDecimal!
" Transaction sender address "
sender: Bytes!
" Address of burner account "
burner: Bytes!
" Block number "
block: BigInt!
" Event timestamp "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}
type MintEvent implements TokenEvent @entity {
id: ID!
" Token address "
token: Token!
" Quantity of tokens minted "
amount: BigDecimal!
" Transaction sender address "
sender: Bytes!
" Address of minter account "
minter: Bytes!
" Address of destination account "
destination: Bytes!
" Block number "
block: BigInt!
" Event timestamp "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}
type TransferEvent implements TokenEvent @entity {
id: ID!
" Token address "
token: Token!
" Quantity of tokens transferred "
amount: BigDecimal!
" Transaction sender address "
sender: Bytes!
" Address of source account "
source: Bytes!
" Address of destination account "
destination: Bytes!
" Block number "
block: BigInt!
" Event timestamp "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}