Include the fields `transaction`, `timestamp` and `block` into TokenEvent interface

This commit is contained in:
Sebastián Galiano 2019-08-07 16:43:15 -03:00
parent cba71d09db
commit 24a131aa65
2 changed files with 17 additions and 13 deletions

View File

@ -76,6 +76,10 @@ interface TokenEvent @entity {
token: Token!
amount: BigDecimal!
sender: Bytes!
block: BigInt!
timestamp: BigInt!
transaction: Bytes!
}
type BurnEvent implements TokenEvent @entity {
@ -96,11 +100,11 @@ type BurnEvent implements TokenEvent @entity {
" Block number "
block: BigInt!
" Transaction hash "
transaction: Bytes!
" Event timestamp "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}
type MintEvent implements TokenEvent @entity {
@ -124,11 +128,11 @@ type MintEvent implements TokenEvent @entity {
" Block number "
block: BigInt!
" Transaction hash "
transaction: Bytes!
" Event timestamp "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}
type TransferEvent implements TokenEvent @entity {
@ -152,9 +156,9 @@ type TransferEvent implements TokenEvent @entity {
" Block number "
block: BigInt!
" Transaction hash "
transaction: Bytes!
" Event timestamp "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}

View File

@ -1,4 +1,4 @@
import { BigInt, BigDecimal, Bytes, EthereumEvent } from '@graphprotocol/graph-ts'
import { BigInt, BigDecimal, Bytes, EthereumEvent, log } from '@graphprotocol/graph-ts'
import { Transfer } from '../../generated/TokenRegistry/templates/StandardToken/ERC20'
import { Burn } from '../../generated/TokenRegistry/templates/BurnableToken/Burnable'
@ -129,8 +129,8 @@ function createBurnEvent(event: EthereumEvent, amount: BigDecimal, burner: Bytes
eventEntity.burner = burner
eventEntity.block = event.block.number
eventEntity.transaction = event.transaction.hash
eventEntity.timestamp = event.block.timestamp
eventEntity.transaction = event.transaction.hash
return eventEntity
}
@ -144,8 +144,8 @@ function createMintEvent(event: EthereumEvent, amount: BigDecimal, destination:
eventEntity.minter = event.transaction.from
eventEntity.block = event.block.number
eventEntity.transaction = event.transaction.hash
eventEntity.timestamp = event.block.timestamp
eventEntity.transaction = event.transaction.hash
return eventEntity
}
@ -164,8 +164,8 @@ function createTransferEvent(
eventEntity.destination = destination
eventEntity.block = event.block.number
eventEntity.transaction = event.transaction.hash
eventEntity.timestamp = event.block.timestamp
eventEntity.transaction = event.transaction.hash
return eventEntity
}