# # Main entities # type Account @entity { id: ID! address: Bytes! } type AccountBalance @entity { id: ID! account: Account! token: Token! amount: BigDecimal! } # This entity is used to provide information about evolution of account balances type AccountBalanceLog @entity { id: ID! account: Account! token: Token! amount: BigDecimal! event: TokenEvent block: BigInt! transaction: Bytes! timestamp: BigInt! } 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") } # # Events # interface TokenEvent @entity { 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! }