Skip to content

Commit

Permalink
Upgrade ormpipe indexer (#138)
Browse files Browse the repository at this point in the history
* clean old indexer

* airnode dpi

* ormp protocol

* ormp oracle

* ormp relayer

* fix pangolin config
  • Loading branch information
fewensa committed Sep 12, 2023
1 parent b7c52e9 commit 93e7288
Show file tree
Hide file tree
Showing 13 changed files with 226 additions and 190 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ _env.ts
chain.json
chain.ts
build
subgraph.yaml
5 changes: 3 additions & 2 deletions thegraph/ormpipe/abis/OrmpOracle.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[
{
"inputs": [
{ "internalType": "address", "name": "endpoint", "type": "address" }
{ "internalType": "address", "name": "dao", "type": "address" },
{ "internalType": "address", "name": "ormp", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
Expand Down Expand Up @@ -84,7 +85,7 @@
},
{
"inputs": [],
"name": "ENDPOINT",
"name": "PROTOCOL",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
Expand Down
12 changes: 9 additions & 3 deletions thegraph/ormpipe/abis/OrmpRelayer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"inputs": [
{ "internalType": "address", "name": "dao", "type": "address" },
{ "internalType": "address", "name": "endpoint", "type": "address" }
{ "internalType": "address", "name": "ormp", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
Expand All @@ -25,8 +25,14 @@
{
"indexed": false,
"internalType": "bytes",
"name": "parmas",
"name": "params",
"type": "bytes"
},
{
"indexed": false,
"internalType": "bytes32[32]",
"name": "proof",
"type": "bytes32[32]"
}
],
"name": "Assigned",
Expand Down Expand Up @@ -103,7 +109,7 @@
},
{
"inputs": [],
"name": "ENDPOINT",
"name": "PROTOCOL",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
Expand Down
20 changes: 17 additions & 3 deletions thegraph/ormpipe/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@
"address": "0xa681492DBAd5a3999cFCE2d72196d5784dd08D0c"
},
"OrmpOracle": {
"address": "0x00000012f877F68a8D2410b683FDC8214f4b5194"
"address": "0x000000003e2E2C9C8DD469E129E02E1666898E76"
},
"OrmpRelayer": {
"address": "0x000000fbfBc6954C8CBba3130b5Aee7f3Ea5108e"
"address": "0x000000007e24Da6666c773280804d8021E12e13F"
},
"OrmpProtocol": {
"address": "0x00000000fec9f746a2138D9C6f42794236f3aca8"
"address": "0x0000000000BD9dcFDa5C60697039E2b3B28b079b"
}
},
"pangolin": {
"AirnodeDapi": {
"address": "0x770713580e5c618A4D29D7E8c0d7604276B63832"
},
"OrmpOracle": {
"address": "0x000000003e2E2C9C8DD469E129E02E1666898E76"
},
"OrmpRelayer": {
"address": "0x000000007e24Da6666c773280804d8021E12e13F"
},
"OrmpProtocol": {
"address": "0x0000000000BD9dcFDa5C60697039E2b3B28b079b"
}
}
}
122 changes: 62 additions & 60 deletions thegraph/ormpipe/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

type AddBeacon @entity(immutable: true) {
# --- airnode dpi

type AirnodeDapiAddBeacon @entity(immutable: true) {
id: Bytes!
beaconId: Bytes! # bytes32
beacon_airnode: Bytes! # address
Expand All @@ -11,15 +13,15 @@ type AddBeacon @entity(immutable: true) {
transactionHash: Bytes!
}

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

type AirnodeRrpCompleted @entity(immutable: true) {
type AirnodeDapiAirnodeRrpCompleted @entity(immutable: true) {
id: Bytes!
beaconId: Bytes! # bytes32
requestId: Bytes! # bytes32
Expand All @@ -29,7 +31,7 @@ type AirnodeRrpCompleted @entity(immutable: true) {
transactionHash: Bytes!
}

type AirnodeRrpRequested @entity(immutable: true) {
type AirnodeDapiAirnodeRrpRequested @entity(immutable: true) {
id: Bytes!
beaconId: Bytes! # bytes32
requestId: Bytes! # bytes32
Expand All @@ -38,151 +40,151 @@ type AirnodeRrpRequested @entity(immutable: true) {
transactionHash: Bytes!
}

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

## ---
# --- ormp protocol

type OrmpOracleAssigned @entity(immutable: true) {
type OrmpProtocolAppConfigUpdated @entity(immutable: true) {
id: Bytes!
msgHash: Bytes! # bytes32
fee: BigInt! # uint256
ua: Bytes! # address
oracle: Bytes! # address
relayer: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpOracleSetApproved @entity(immutable: true) {
type OrmpProtocolClearFailedMessage @entity(immutable: true) {
id: Bytes!
operator: Bytes! # address
approve: Boolean! # bool
msgHash: Bytes! # bytes32
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpOracleSetDapi @entity(immutable: true) {
type OrmpProtocolMessageAccepted @entity(immutable: true) {
id: Bytes!
chainId: BigInt! # uint256
dapi: Bytes! # address
msgHash: Bytes! # bytes32
root: Bytes! # bytes32
message_channel: Bytes! # address
message_index: BigInt! # uint256
message_fromChainId: BigInt! # uint256
message_from: Bytes! # address
message_toChainId: BigInt! # uint256
message_to: Bytes! # address
message_encoded: Bytes! # bytes
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpOracleSetFee @entity(immutable: true) {
type OrmpProtocolMessageDispatched @entity(immutable: true) {
id: Bytes!
chainId: BigInt! # uint256
fee: BigInt! # uint256
msgHash: Bytes! # bytes32
dispatchResult: Boolean! # bool
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

## ---

type OrmpRelayerAssigned @entity(immutable: true) {
type OrmpProtocolRetryFailedMessage @entity(immutable: true) {
id: Bytes!
msgHash: Bytes! # bytes32
fee: BigInt! # uint256
parmas: Bytes! # bytes
dispatchResult: Boolean! # bool
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpRelayerSetApproved @entity(immutable: true) {
type OrmpProtocolSetDefaultConfig @entity(immutable: true) {
id: Bytes!
operator: Bytes! # address
approve: Boolean! # bool
oracle: Bytes! # address
relayer: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpRelayerSetDstConfig @entity(immutable: true) {
## -- ormp oracle

type OrmpOracleAssigned @entity(immutable: true) {
id: Bytes!
chainId: BigInt! # uint256
baseGas: BigInt! # uint64
gasPerByte: BigInt! # uint64
msgHash: Bytes! # bytes32
fee: BigInt! # uint256
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpRelayerSetDstPrice @entity(immutable: true) {
type OrmpOracleSetApproved @entity(immutable: true) {
id: Bytes!
chainId: BigInt! # uint256
dstPriceRatio: BigInt! # uint128
dstGasPriceInWei: BigInt! # uint128
operator: Bytes! # address
approve: Boolean! # bool
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

## ---

type OrmpProtocolAppConfigUpdated @entity(immutable: true) {
type OrmpOracleSetDapi @entity(immutable: true) {
id: Bytes!
ua: Bytes! # address
oracle: Bytes! # address
relayer: Bytes! # address
chainId: BigInt! # uint256
dapi: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpProtocolClearFailedMessage @entity(immutable: true) {
type OrmpOracleSetFee @entity(immutable: true) {
id: Bytes!
msgHash: Bytes! # bytes32
chainId: BigInt! # uint256
fee: BigInt! # uint256
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpProtocolMessageAccepted @entity(immutable: true) {
## -- ormp relayer
type OrmpRelayerAssigned @entity(immutable: true) {
id: Bytes!
msgHash: Bytes! # bytes32
root: Bytes! # bytes32
message_channel: Bytes! # address
message_index: BigInt! # uint256
message_fromChainId: BigInt! # uint256
message_from: Bytes! # address
message_toChainId: BigInt! # uint256
message_to: Bytes! # address
message_encoded: Bytes! # bytes
fee: BigInt! # uint256
params: Bytes! # bytes
proof: [Bytes!]! # bytes32[32]
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpProtocolMessageDispatched @entity(immutable: true) {
type OrmpRelayerSetApproved @entity(immutable: true) {
id: Bytes!
msgHash: Bytes! # bytes32
dispatchResult: Boolean! # bool
operator: Bytes! # address
approve: Boolean! # bool
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpProtocolRetryFailedMessage @entity(immutable: true) {
type OrmpRelayerSetDstConfig @entity(immutable: true) {
id: Bytes!
msgHash: Bytes! # bytes32
dispatchResult: Boolean! # bool
chainId: BigInt! # uint256
baseGas: BigInt! # uint64
gasPerByte: BigInt! # uint64
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type OrmpProtocolSetDefaultConfig @entity(immutable: true) {
type OrmpRelayerSetDstPrice @entity(immutable: true) {
id: Bytes!
oracle: Bytes! # address
relayer: Bytes! # address
chainId: BigInt! # uint256
dstPriceRatio: BigInt! # uint128
dstGasPriceInWei: BigInt! # uint128
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
Expand Down
20 changes: 10 additions & 10 deletions thegraph/ormpipe/src/airnode-dapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {
RemoveBeacon as RemoveBeaconEvent
} from "../generated/AirnodeDapi/AirnodeDapi"
import {
AddBeacon,
AggregatedMessageRoot,
AirnodeRrpCompleted,
AirnodeRrpRequested,
RemoveBeacon
AirnodeDapiAddBeacon,
AirnodeDapiAggregatedMessageRoot,
AirnodeDapiAirnodeRrpCompleted,
AirnodeDapiAirnodeRrpRequested,
AirnodeDapiRemoveBeacon
} from "../generated/schema"

export function handleAddBeacon(event: AddBeaconEvent): void {
let entity = new AddBeacon(
let entity = new AirnodeDapiAddBeacon(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.beaconId = event.params.beaconId
Expand All @@ -33,7 +33,7 @@ export function handleAddBeacon(event: AddBeaconEvent): void {
export function handleAggregatedMessageRoot(
event: AggregatedMessageRootEvent
): void {
let entity = new AggregatedMessageRoot(
let entity = new AirnodeDapiAggregatedMessageRoot(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.msgRoot = event.params.msgRoot
Expand All @@ -48,7 +48,7 @@ export function handleAggregatedMessageRoot(
export function handleAirnodeRrpCompleted(
event: AirnodeRrpCompletedEvent
): void {
let entity = new AirnodeRrpCompleted(
let entity = new AirnodeDapiAirnodeRrpCompleted(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.beaconId = event.params.beaconId
Expand All @@ -65,7 +65,7 @@ export function handleAirnodeRrpCompleted(
export function handleAirnodeRrpRequested(
event: AirnodeRrpRequestedEvent
): void {
let entity = new AirnodeRrpRequested(
let entity = new AirnodeDapiAirnodeRrpRequested(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.beaconId = event.params.beaconId
Expand All @@ -79,7 +79,7 @@ export function handleAirnodeRrpRequested(
}

export function handleRemoveBeacon(event: RemoveBeaconEvent): void {
let entity = new RemoveBeacon(
let entity = new AirnodeDapiRemoveBeacon(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.beaconId = event.params.beaconId
Expand Down
2 changes: 1 addition & 1 deletion thegraph/ormpipe/src/ormp-oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
SetDapi as SetDapiEvent,
SetFee as SetFeeEvent
} from "../generated/OrmpOracle/OrmpOracle"
import { OrmpOracleAssigned, OrmpOracleSetApproved, OrmpOracleSetDapi, OrmpOracleSetFee } from "../generated/schema"
import {OrmpOracleAssigned, OrmpOracleSetApproved, OrmpOracleSetDapi, OrmpOracleSetFee} from "../generated/schema"

export function handleAssigned(event: AssignedEvent): void {
let entity = new OrmpOracleAssigned(
Expand Down
Loading

0 comments on commit 93e7288

Please sign in to comment.