Skip to content

Commit

Permalink
add airnode indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
fewensa committed Aug 22, 2023
1 parent d1beb26 commit 67421de
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 1 deletion.
5 changes: 4 additions & 1 deletion thegraph/ormpipe/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
},
"OrmpChannel": {
"address": "0x12346a7b6aA35A2FD38941485c36A7c84B2936dB"
},
"AirnodeDapi": {
"address": "0xa681492DBAd5a3999cFCE2d72196d5784dd08D0c"
}
}
}
}
46 changes: 46 additions & 0 deletions thegraph/ormpipe/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,49 @@ type MessageDispatched @entity(immutable: true) {
}

## ---
type AddBeacon @entity(immutable: true) {
id: Bytes!
beaconId: Bytes! # bytes32
beacon_airnode: Bytes! # address
beacon_endpointId: Bytes! # bytes32
beacon_sponsor: Bytes! # address
beacon_sponsorWallet: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type AggregatedMessageRoot @entity(immutable: true) {
id: Bytes!
msgRoot: Bytes! # bytes32
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type AirnodeRrpCompleted @entity(immutable: true) {
id: Bytes!
beaconId: Bytes! # bytes32
requestId: Bytes! # bytes32
data: Bytes! # bytes
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type AirnodeRrpRequested @entity(immutable: true) {
id: Bytes!
beaconId: Bytes! # bytes32
requestId: Bytes! # bytes32
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type RemoveBeacon @entity(immutable: true) {
id: Bytes!
beaconId: Bytes! # bytes32
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
32 changes: 32 additions & 0 deletions thegraph/ormpipe/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,35 @@ dataSources:
- event: MessageDispatched(indexed bytes32,bool)
handler: handleMessageDispatched
file: ./src/ormp-channel.ts
- kind: ethereum
name: AirnodeDapi
network: arbitrum-goerli
source:
address: "0xa681492DBAd5a3999cFCE2d72196d5784dd08D0c"
abi: AirnodeDapi
startBlock: 34570517
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- AddBeacon
- AggregatedMessageRoot
- AirnodeRrpCompleted
- AirnodeRrpRequested
- RemoveBeacon
abis:
- name: AirnodeDapi
file: ./abis/AirnodeDapi.json
eventHandlers:
- event: AddBeacon(indexed bytes32,(address,bytes32,address,address))
handler: handleAddBeacon
- event: AggregatedMessageRoot(bytes32)
handler: handleAggregatedMessageRoot
- event: AirnodeRrpCompleted(indexed bytes32,indexed bytes32,bytes)
handler: handleAirnodeRrpCompleted
- event: AirnodeRrpRequested(indexed bytes32,indexed bytes32)
handler: handleAirnodeRrpRequested
- event: RemoveBeacon(indexed bytes32)
handler: handleRemoveBeacon
file: ./src/airnode-dapi.ts
9 changes: 9 additions & 0 deletions thegraph/ormpipe/tests/airnode-dapi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ import {
beforeAll,
afterAll
} from "matchstick-as/assembly/index"
import { Bytes, Address } from "@graphprotocol/graph-ts"
import { AddBeacon } from "../generated/schema"
import { AddBeacon as AddBeaconEvent } from "../generated/AirnodeDapi/AirnodeDapi"
import { handleAddBeacon } from "../src/airnode-dapi"
import { createAddBeaconEvent } from "./airnode-dapi-utils"

// Tests structure (matchstick-as >=0.5.0)
// https://thegraph.com/docs/en/developer/matchstick/#tests-structure-0-5-0

describe("Describe entity assertions", () => {
beforeAll(() => {
let beaconId = Bytes.fromI32(1234567890)
let beacon = "ethereum.Tuple Not implemented"
let newAddBeaconEvent = createAddBeaconEvent(beaconId, beacon)
handleAddBeacon(newAddBeaconEvent)
})

afterAll(() => {
Expand Down

0 comments on commit 67421de

Please sign in to comment.