Skip to content

Commit 6ca8e96

Browse files
committed
gasUsed and gasPrice in a Transaction
1 parent 9692685 commit 6ca8e96

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
@@ -57,6 +57,8 @@ export function handleTransfer(event: Transfer): void {
5757
transaction = new Transaction(transactionHash)
5858
transaction.blockNumber = event.block.number
5959
transaction.timestamp = event.block.timestamp
60+
transaction.gasUsed = event.transaction.gasUsed
61+
transaction.gasPrice = event.transaction.gasPrice
6062
transaction.mints = []
6163
transaction.burns = []
6264
transaction.swaps = []
@@ -465,6 +467,8 @@ export function handleSwap(event: Swap): void {
465467
transaction = new Transaction(event.transaction.hash.toHexString())
466468
transaction.blockNumber = event.block.number
467469
transaction.timestamp = event.block.timestamp
470+
transaction.gasUsed = event.transaction.gasUsed
471+
transaction.gasPrice = event.transaction.gasPrice
468472
transaction.mints = []
469473
transaction.swaps = []
470474
transaction.burns = []

0 commit comments

Comments
 (0)