Skip to content

Commit

Permalink
Handle event skipped in code generation (#2)
Browse files Browse the repository at this point in the history
* Add schema for the skipped event

* Add GQL queries for the skipped event

* Suffix struct types in events to resolve GQL type conflicts
  • Loading branch information
prathamesh0 authored May 11, 2023
1 parent 6c66262 commit 0d92a84
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 1 deletion.
28 changes: 28 additions & 0 deletions src/gql/queries/events.gql
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,34 @@ query events($blockHash: String!, $contractAddress: String!, $name: String){
provider
taskSpecHash
}
... on LogTaskSubmittedEvent {
taskReceiptId
taskReceiptHash
taskReceipt{
id
userProxy
index
tasks {
conditions {
inst
data
}
actions {
addr
data
operation
dataFlow
value
termsOkCheck
}
selfProviderGasLimit
selfProviderGasPriceCeil
}
expiryDate
cycleId
submissionsLeft
}
}
... on OwnershipTransferredEvent {
previousOwner
newOwner
Expand Down
28 changes: 28 additions & 0 deletions src/gql/queries/eventsInRange.gql
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,34 @@ query eventsInRange($fromBlockNumber: Int!, $toBlockNumber: Int!){
provider
taskSpecHash
}
... on LogTaskSubmittedEvent {
taskReceiptId
taskReceiptHash
taskReceipt{
id
userProxy
index
tasks {
conditions {
inst
data
}
actions {
addr
data
operation
dataFlow
value
termsOkCheck
}
selfProviderGasLimit
selfProviderGasPriceCeil
}
expiryDate
cycleId
submissionsLeft
}
}
... on OwnershipTransferredEvent {
previousOwner
newOwner
Expand Down
28 changes: 28 additions & 0 deletions src/gql/subscriptions/onEvent.gql
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,34 @@ subscription onEvent{
provider
taskSpecHash
}
... on LogTaskSubmittedEvent {
taskReceiptId
taskReceiptHash
taskReceipt{
id
userProxy
index
tasks {
conditions {
inst
data
}
actions {
addr
data
operation
dataFlow
value
termsOkCheck
}
selfProviderGasLimit
selfProviderGasPriceCeil
}
expiryDate
cycleId
submissionsLeft
}
}
... on OwnershipTransferredEvent {
previousOwner
newOwner
Expand Down
45 changes: 44 additions & 1 deletion src/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type ResultEvent {
proof: Proof
}

union Event = LogCanExecFailedEvent | LogExecRevertedEvent | LogExecSuccessEvent | LogExecutorAssignedExecutorEvent | LogExecutorBalanceWithdrawnEvent | LogExecutorStakedEvent | LogExecutorSuccessShareSetEvent | LogExecutorUnstakedEvent | LogFundsProvidedEvent | LogFundsUnprovidedEvent | LogGelatoGasPriceOracleSetEvent | LogGelatoMaxGasSetEvent | LogInternalGasRequirementSetEvent | LogMinExecutorStakeSetEvent | LogOracleRequestDataSetEvent | LogProviderAssignedExecutorEvent | LogProviderModuleAddedEvent | LogProviderModuleRemovedEvent | LogSysAdminFundsWithdrawnEvent | LogSysAdminSuccessShareSetEvent | LogTaskCancelledEvent | LogTaskSpecGasPriceCeilSetEvent | LogTaskSpecProvidedEvent | LogTaskSpecUnprovidedEvent | OwnershipTransferredEvent
union Event = LogCanExecFailedEvent | LogExecRevertedEvent | LogExecSuccessEvent | LogExecutorAssignedExecutorEvent | LogExecutorBalanceWithdrawnEvent | LogExecutorStakedEvent | LogExecutorSuccessShareSetEvent | LogExecutorUnstakedEvent | LogFundsProvidedEvent | LogFundsUnprovidedEvent | LogGelatoGasPriceOracleSetEvent | LogGelatoMaxGasSetEvent | LogInternalGasRequirementSetEvent | LogMinExecutorStakeSetEvent | LogOracleRequestDataSetEvent | LogProviderAssignedExecutorEvent | LogProviderModuleAddedEvent | LogProviderModuleRemovedEvent | LogSysAdminFundsWithdrawnEvent | LogSysAdminSuccessShareSetEvent | LogTaskCancelledEvent | LogTaskSpecGasPriceCeilSetEvent | LogTaskSpecProvidedEvent | LogTaskSpecUnprovidedEvent | LogTaskSubmittedEvent | OwnershipTransferredEvent

type LogCanExecFailedEvent {
executor: String!
Expand Down Expand Up @@ -174,6 +174,49 @@ type LogTaskSpecUnprovidedEvent {
taskSpecHash: String!
}

type LogTaskSubmittedEvent {
taskReceiptId: BigInt!
taskReceiptHash: String!
taskReceipt: TaskReceipt_!
}

type TaskReceipt_ {
id: BigInt!
userProxy: String!
provider: Provider_!
index: BigInt!
tasks: [Task_!]
expiryDate: BigInt!
cycleId: BigInt!
submissionsLeft: BigInt!
}

type Provider_ {
addr: String!
module: String!
}

type Task_ {
conditions: [Condition_!]
actions: [Action_!]
selfProviderGasLimit: BigInt!
selfProviderGasPriceCeil: BigInt!
}

type Condition_ {
inst: String!
data: String!
}

type Action_ {
addr: String!
data: String!
operation: BigInt!
dataFlow: BigInt!
value: BigInt!
termsOkCheck: Boolean!
}

type OwnershipTransferredEvent {
previousOwner: String!
newOwner: String!
Expand Down

0 comments on commit 0d92a84

Please sign in to comment.