Skip to content

Commit d8f0924

Browse files
committed
gasUsed and gasPrice in a Transaction
1 parent 52e385e commit d8f0924

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

schema.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ type Transaction @entity {
129129
id: ID! # txn hash
130130
blockNumber: BigInt!
131131
timestamp: BigInt!
132+
gasUsed: BigInt!
133+
gasPrice: BigInt!
132134
# This is not the reverse of Mint.transaction; it is only used to
133135
# track incomplete mints (similar for burns and swaps)
134136
mints: [Mint]!

src/mappings/core.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export function handleTransfer(event: Transfer): void {
6161
transaction = new Transaction(transactionHash)
6262
transaction.blockNumber = event.block.number
6363
transaction.timestamp = event.block.timestamp
64+
transaction.gasUsed = event.transaction.gasUsed
65+
transaction.gasPrice = event.transaction.gasPrice
6466
transaction.mints = []
6567
transaction.burns = []
6668
transaction.swaps = []
@@ -469,6 +471,8 @@ export function handleSwap(event: Swap): void {
469471
transaction = new Transaction(event.transaction.hash.toHexString())
470472
transaction.blockNumber = event.block.number
471473
transaction.timestamp = event.block.timestamp
474+
transaction.gasUsed = event.transaction.gasUsed
475+
transaction.gasPrice = event.transaction.gasPrice
472476
transaction.mints = []
473477
transaction.swaps = []
474478
transaction.burns = []

0 commit comments

Comments
 (0)