diff --git a/subgraphs/flow-scheduler/package.json b/subgraphs/flow-scheduler/package.json index e3d970f..98e6dd0 100644 --- a/subgraphs/flow-scheduler/package.json +++ b/subgraphs/flow-scheduler/package.json @@ -1,6 +1,6 @@ { "name": "flow-scheduler-subgraph", - "version": "1.0.0", + "version": "1.0.1", "description": "A subgraph for the flow scheduler contracts", "keywords": [ "subgraph" diff --git a/subgraphs/flow-scheduler/schema.graphql b/subgraphs/flow-scheduler/schema.graphql index 78e68ed..134cd28 100644 --- a/subgraphs/flow-scheduler/schema.graphql +++ b/subgraphs/flow-scheduler/schema.graphql @@ -88,6 +88,7 @@ type CreateFlowExecutedEvent implements Event @entity(immutable: true) { timestamp: BigInt! transactionHash: Bytes! gasPrice: BigInt! + gasUsed: BigInt! # CreateFlowExecutedEvent Specific Properties # superToken: Bytes! @@ -116,6 +117,7 @@ type DeleteFlowExecutedEvent implements Event @entity(immutable: true) { timestamp: BigInt! transactionHash: Bytes! gasPrice: BigInt! + gasUsed: BigInt! # DeleteFlowExecutedEvent Specific Properties # superToken: Bytes! diff --git a/subgraphs/flow-scheduler/src/utils/createCreateFlowExecuted.ts b/subgraphs/flow-scheduler/src/utils/createCreateFlowExecuted.ts index 4dad17d..6977328 100644 --- a/subgraphs/flow-scheduler/src/utils/createCreateFlowExecuted.ts +++ b/subgraphs/flow-scheduler/src/utils/createCreateFlowExecuted.ts @@ -1,3 +1,4 @@ +import { log } from "@graphprotocol/graph-ts"; import { CreateFlowExecuted } from "../types/FlowScheduler/FlowScheduler"; import { CreateFlowExecutedEvent } from "../types/schema"; import { createEventID, setBaseProperties } from "./general"; @@ -24,5 +25,12 @@ export function createCreateFlowExecutedEventEntity( ev.startAmount = event.params.startAmount; ev.userData = event.params.userData; + const receipt = event.receipt; + if (receipt) { + ev.gasUsed = receipt.gasUsed; + } else { + log.critical("receipt MUST NOT be null, set `receipt: true` under `eventHandlers` in the manifest file", []); + } + return ev; } diff --git a/subgraphs/flow-scheduler/src/utils/createDeleteFlowExecuted.ts b/subgraphs/flow-scheduler/src/utils/createDeleteFlowExecuted.ts index 07f4b1b..d4cf4c6 100644 --- a/subgraphs/flow-scheduler/src/utils/createDeleteFlowExecuted.ts +++ b/subgraphs/flow-scheduler/src/utils/createDeleteFlowExecuted.ts @@ -1,3 +1,4 @@ +import { log } from "@graphprotocol/graph-ts"; import { DeleteFlowExecuted } from "../types/FlowScheduler/FlowScheduler"; import { DeleteFlowExecutedEvent } from "../types/schema"; import { createEventID, setBaseProperties } from "./general"; @@ -21,5 +22,12 @@ export function createDeleteFlowExecutedEventEntity( ev.endDate = event.params.endDate; ev.userData = event.params.userData; + const receipt = event.receipt; + if (receipt) { + ev.gasUsed = receipt.gasUsed; + } else { + log.critical("receipt MUST NOT be null, set `receipt: true` under `eventHandlers` in the manifest file", []); + } + return ev; } diff --git a/subgraphs/flow-scheduler/src/utils/general.ts b/subgraphs/flow-scheduler/src/utils/general.ts index 2140605..8d7f202 100644 --- a/subgraphs/flow-scheduler/src/utils/general.ts +++ b/subgraphs/flow-scheduler/src/utils/general.ts @@ -18,7 +18,7 @@ export function setBaseProperties( entity.set("addresses", Value.fromBytesArray(addresses)); entity.set("timestamp", Value.fromBigInt(event.block.timestamp)); entity.set("transactionHash", Value.fromBytes(event.transaction.hash)); - entity.set("gasPrice", Value.fromBigInt(event.block.number)); + entity.set("gasPrice", Value.fromBigInt(event.transaction.gasPrice)); return entity; } diff --git a/subgraphs/flow-scheduler/subgraph.yaml b/subgraphs/flow-scheduler/subgraph.yaml index cb8037f..bfdca6e 100644 --- a/subgraphs/flow-scheduler/subgraph.yaml +++ b/subgraphs/flow-scheduler/subgraph.yaml @@ -28,8 +28,10 @@ dataSources: - event: FlowScheduleCreated(indexed address,indexed address,indexed address,uint32,uint32,int96,uint32,uint256,bytes) handler: handleFlowScheduleCreated - event: FlowScheduleDeleted(indexed address,indexed address,indexed address) - handler: handleFlowScheduleDeleted + handler: handleFlowScheduleDeleted - event: CreateFlowExecuted(indexed address,indexed address,indexed address,uint32,uint32,int96,uint256,bytes) handler: handleCreateFlowExecuted + receipt: true - event: DeleteFlowExecuted(indexed address,indexed address,indexed address,uint32,bytes) - handler: handleDeleteFlowExecuted \ No newline at end of file + handler: handleDeleteFlowExecuted + receipt: true \ No newline at end of file diff --git a/subgraphs/vesting-scheduler/package.json b/subgraphs/vesting-scheduler/package.json index d6d0dd4..990231b 100644 --- a/subgraphs/vesting-scheduler/package.json +++ b/subgraphs/vesting-scheduler/package.json @@ -1,6 +1,6 @@ { "name": "vesting-scheduler-subgraph", - "version": "1.0.0", + "version": "1.0.1", "description": "A subgraph for the vesting scheduler contracts", "keywords": [ "subgraph" diff --git a/subgraphs/vesting-scheduler/schema.graphql b/subgraphs/vesting-scheduler/schema.graphql index b30dbf4..6a8c29d 100644 --- a/subgraphs/vesting-scheduler/schema.graphql +++ b/subgraphs/vesting-scheduler/schema.graphql @@ -38,6 +38,7 @@ type VestingCliffAndFlowExecutedEvent implements Event timestamp: BigInt! transactionHash: Bytes! gasPrice: BigInt! + gasUsed: BigInt! # CreateVestingScheduleEvent Specific Properties # superToken: Bytes! @@ -64,6 +65,7 @@ type VestingEndExecutedEvent implements Event @entity(immutable: true) { timestamp: BigInt! transactionHash: Bytes! gasPrice: BigInt! + gasUsed: BigInt! # VestingEndExecutedEvent Specific Properties # superToken: Bytes! @@ -89,6 +91,7 @@ type VestingEndFailedEvent implements Event @entity(immutable: true) { timestamp: BigInt! transactionHash: Bytes! gasPrice: BigInt! + gasUsed: BigInt! # VestingEndExecutedEvent Specific Properties # superToken: Bytes! diff --git a/subgraphs/vesting-scheduler/src/utils/createVestingCliffAndFlowExecuted.ts b/subgraphs/vesting-scheduler/src/utils/createVestingCliffAndFlowExecuted.ts index 3ff6d3c..0658a0b 100644 --- a/subgraphs/vesting-scheduler/src/utils/createVestingCliffAndFlowExecuted.ts +++ b/subgraphs/vesting-scheduler/src/utils/createVestingCliffAndFlowExecuted.ts @@ -1,3 +1,4 @@ +import { log } from "@graphprotocol/graph-ts"; import { VestingCliffAndFlowExecutedEvent } from "../types/schema"; import { VestingCliffAndFlowExecuted } from "../types/VestingScheduler/VestingScheduler"; import { createEventID, setBaseProperties } from "./general"; @@ -22,5 +23,12 @@ export function createVestingCliffAndFlowExecutedEntity( ev.cliffAmount = event.params.cliffAmount; ev.flowDelayCompensation = event.params.flowDelayCompensation; + const receipt = event.receipt; + if (receipt) { + ev.gasUsed = receipt.gasUsed; + } else { + log.critical("receipt MUST NOT be null, set `receipt: true` under `eventHandlers` in the manifest file", []); + } + return ev; } diff --git a/subgraphs/vesting-scheduler/src/utils/createVestingEndExecuted.ts b/subgraphs/vesting-scheduler/src/utils/createVestingEndExecuted.ts index eee6a7c..2f309ed 100644 --- a/subgraphs/vesting-scheduler/src/utils/createVestingEndExecuted.ts +++ b/subgraphs/vesting-scheduler/src/utils/createVestingEndExecuted.ts @@ -1,3 +1,4 @@ +import { log } from "@graphprotocol/graph-ts"; import { VestingEndExecutedEvent } from "../types/schema"; import { VestingEndExecuted } from "../types/VestingScheduler/VestingScheduler"; import { createEventID, setBaseProperties } from "./general"; @@ -21,5 +22,12 @@ export function createVestingEndExecutedEventEntity( ev.earlyEndCompensation = event.params.earlyEndCompensation; ev.didCompensationFail = event.params.didCompensationFail; + const receipt = event.receipt; + if (receipt) { + ev.gasUsed = receipt.gasUsed; + } else { + log.critical("receipt MUST NOT be null, set `receipt: true` under `eventHandlers` in the manifest file", []); + } + return ev; } diff --git a/subgraphs/vesting-scheduler/src/utils/createVestingEndFailed.ts b/subgraphs/vesting-scheduler/src/utils/createVestingEndFailed.ts index b83b74e..cce2539 100644 --- a/subgraphs/vesting-scheduler/src/utils/createVestingEndFailed.ts +++ b/subgraphs/vesting-scheduler/src/utils/createVestingEndFailed.ts @@ -1,3 +1,4 @@ +import { log } from "@graphprotocol/graph-ts"; import { VestingEndFailedEvent } from "../types/schema"; import { VestingEndFailed } from "../types/VestingScheduler/VestingScheduler"; import { createEventID, setBaseProperties } from "./general"; @@ -17,5 +18,12 @@ export function createVestingEndFailedEventEntity( ev.receiver = event.params.receiver; ev.endDate = event.params.endDate; + const receipt = event.receipt; + if (receipt) { + ev.gasUsed = receipt.gasUsed; + } else { + log.critical("receipt MUST NOT be null, set `receipt: true` under `eventHandlers` in the manifest file", []); + } + return ev; } diff --git a/subgraphs/vesting-scheduler/src/utils/general.ts b/subgraphs/vesting-scheduler/src/utils/general.ts index 5bd2122..8fc9435 100644 --- a/subgraphs/vesting-scheduler/src/utils/general.ts +++ b/subgraphs/vesting-scheduler/src/utils/general.ts @@ -24,7 +24,7 @@ export function setBaseProperties( entity.set("addresses", Value.fromBytesArray(addresses)); entity.set("timestamp", Value.fromBigInt(event.block.timestamp)); entity.set("transactionHash", Value.fromBytes(event.transaction.hash)); - entity.set("gasPrice", Value.fromBigInt(event.block.number)); + entity.set("gasPrice", Value.fromBigInt(event.transaction.gasPrice)); return entity; } diff --git a/subgraphs/vesting-scheduler/subgraph.yaml b/subgraphs/vesting-scheduler/subgraph.yaml index 178ba5e..190bc70 100644 --- a/subgraphs/vesting-scheduler/subgraph.yaml +++ b/subgraphs/vesting-scheduler/subgraph.yaml @@ -29,8 +29,10 @@ dataSources: eventHandlers: - event: VestingCliffAndFlowExecuted(indexed address,indexed address,indexed address,uint32,int96,uint256,uint256) handler: handleVestingCliffAndFlowExecuted + receipt: true - event: VestingEndExecuted(indexed address,indexed address,indexed address,uint32,uint256,bool) handler: handleVestingEndExecuted + receipt: true - event: VestingScheduleCreated(indexed address,indexed address,indexed address,uint32,uint32,int96,uint32,uint256) handler: handleVestingScheduleCreated - event: VestingScheduleDeleted(indexed address,indexed address,indexed address) @@ -39,3 +41,4 @@ dataSources: handler: handleVestingScheduleUpdated - event: VestingEndFailed(indexed address,indexed address,indexed address,uint32) handler: handleVestingEndFailed + receipt: true diff --git a/subgraphs/wrap-scheduler/package.json b/subgraphs/wrap-scheduler/package.json index 044f2a2..a886d65 100644 --- a/subgraphs/wrap-scheduler/package.json +++ b/subgraphs/wrap-scheduler/package.json @@ -1,6 +1,6 @@ { "name": "wrap-scheduler-subgraph", - "version": "1.0.0", + "version": "1.0.1", "description": "A subgraph for the auto-wrap scheduler contracts", "keywords": [ "subgraph" diff --git a/subgraphs/wrap-scheduler/schema.graphql b/subgraphs/wrap-scheduler/schema.graphql index 2051236..51781fb 100644 --- a/subgraphs/wrap-scheduler/schema.graphql +++ b/subgraphs/wrap-scheduler/schema.graphql @@ -100,6 +100,7 @@ type WrapExecutedEvent implements Event @entity(immutable: true) { timestamp: BigInt! transactionHash: Bytes! gasPrice: BigInt! + gasUsed: BigInt! # WrapExecutedEvent Specific Properties # amount: BigInt! diff --git a/subgraphs/wrap-scheduler/src/utils/createWrapExecuted.ts b/subgraphs/wrap-scheduler/src/utils/createWrapExecuted.ts index 87c4345..d6ea336 100644 --- a/subgraphs/wrap-scheduler/src/utils/createWrapExecuted.ts +++ b/subgraphs/wrap-scheduler/src/utils/createWrapExecuted.ts @@ -1,3 +1,4 @@ +import { log } from "@graphprotocol/graph-ts"; import { WrapExecutedEvent } from "../types/schema"; import { WrapExecuted } from "../types/WrapScheduler/WrapManager"; import { createEventID, setBaseProperties } from "./general"; @@ -16,6 +17,13 @@ export function createWrapExecutedEventEntity( ev.wrapScheduleId = event.params.id; ev.amount = event.params.wrapAmount; + const receipt = event.receipt; + if (receipt) { + ev.gasUsed = receipt.gasUsed; + } else { + log.critical("receipt MUST NOT be null, set `receipt: true` under `eventHandlers` in the manifest file", []); + } + return ev; } diff --git a/subgraphs/wrap-scheduler/src/utils/general.ts b/subgraphs/wrap-scheduler/src/utils/general.ts index 5bd2122..8fc9435 100644 --- a/subgraphs/wrap-scheduler/src/utils/general.ts +++ b/subgraphs/wrap-scheduler/src/utils/general.ts @@ -24,7 +24,7 @@ export function setBaseProperties( entity.set("addresses", Value.fromBytesArray(addresses)); entity.set("timestamp", Value.fromBigInt(event.block.timestamp)); entity.set("transactionHash", Value.fromBytes(event.transaction.hash)); - entity.set("gasPrice", Value.fromBigInt(event.block.number)); + entity.set("gasPrice", Value.fromBigInt(event.transaction.gasPrice)); return entity; } diff --git a/subgraphs/wrap-scheduler/subgraph.yaml b/subgraphs/wrap-scheduler/subgraph.yaml index 5eb4ec4..3c06589 100644 --- a/subgraphs/wrap-scheduler/subgraph.yaml +++ b/subgraphs/wrap-scheduler/subgraph.yaml @@ -33,6 +33,7 @@ dataSources: handler: handleWrapScheduleDeleted - event: WrapExecuted(indexed bytes32,uint256) handler: handleWrapExecuted + receipt: true # - event: AddedApprovedStrategy(indexed address) # handler: handleAddedApprovedStrategy # - event: RemovedApprovedStrategy(indexed address)