diff --git a/thegraph/ormpipe/abis/OrmpEndpoint.json b/thegraph/ormpipe/abis/OrmpProtocol.json similarity index 100% rename from thegraph/ormpipe/abis/OrmpEndpoint.json rename to thegraph/ormpipe/abis/OrmpProtocol.json diff --git a/thegraph/ormpipe/networks.json b/thegraph/ormpipe/networks.json index 91d6c9b..ff757e7 100644 --- a/thegraph/ormpipe/networks.json +++ b/thegraph/ormpipe/networks.json @@ -3,14 +3,14 @@ "AirnodeDapi": { "address": "0xa681492DBAd5a3999cFCE2d72196d5784dd08D0c" }, - "OrmpEndpoint": { - "address": "0x00000000fec9f746a2138D9C6f42794236f3aca8" - }, "OrmpOracle": { "address": "0x00000012f877F68a8D2410b683FDC8214f4b5194" }, "OrmpRelayer": { "address": "0x000000fbfBc6954C8CBba3130b5Aee7f3Ea5108e" + }, + "OrmpProtocol": { + "address": "0x00000000fec9f746a2138D9C6f42794236f3aca8" } } -} \ No newline at end of file +} diff --git a/thegraph/ormpipe/schema.graphql b/thegraph/ormpipe/schema.graphql index f713629..750cd94 100644 --- a/thegraph/ormpipe/schema.graphql +++ b/thegraph/ormpipe/schema.graphql @@ -48,141 +48,141 @@ type RemoveBeacon @entity(immutable: true) { ## --- -type OrmpEndpointAppConfigUpdated @entity(immutable: true) { +type OrmpOracleAssigned @entity(immutable: true) { id: Bytes! - ua: Bytes! # address - oracle: Bytes! # address - relayer: Bytes! # address + msgHash: Bytes! # bytes32 + fee: BigInt! # uint256 blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpEndpointClearFailedMessage @entity(immutable: true) { +type OrmpOracleSetApproved @entity(immutable: true) { id: Bytes! - msgHash: Bytes! # bytes32 + operator: Bytes! # address + approve: Boolean! # bool blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpEndpointMessageAccepted @entity(immutable: true) { +type OrmpOracleSetDapi @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 + chainId: BigInt! # uint256 + dapi: Bytes! # address blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpEndpointMessageDispatched @entity(immutable: true) { +type OrmpOracleSetFee @entity(immutable: true) { id: Bytes! - msgHash: Bytes! # bytes32 - dispatchResult: Boolean! # bool + chainId: BigInt! # uint256 + fee: BigInt! # uint256 blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpEndpointRetryFailedMessage @entity(immutable: true) { +## --- + +type OrmpRelayerAssigned @entity(immutable: true) { id: Bytes! msgHash: Bytes! # bytes32 - dispatchResult: Boolean! # bool + fee: BigInt! # uint256 + parmas: Bytes! # bytes blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpEndpointSetDefaultConfig @entity(immutable: true) { +type OrmpRelayerSetApproved @entity(immutable: true) { id: Bytes! - oracle: Bytes! # address - relayer: Bytes! # address + operator: Bytes! # address + approve: Boolean! # bool blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -## --- - -type OrmpOracleAssigned @entity(immutable: true) { +type OrmpRelayerSetDstConfig @entity(immutable: true) { id: Bytes! - msgHash: Bytes! # bytes32 - fee: BigInt! # uint256 + chainId: BigInt! # uint256 + baseGas: BigInt! # uint64 + gasPerByte: BigInt! # uint64 blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpOracleSetApproved @entity(immutable: true) { +type OrmpRelayerSetDstPrice @entity(immutable: true) { id: Bytes! - operator: Bytes! # address - approve: Boolean! # bool + chainId: BigInt! # uint256 + dstPriceRatio: BigInt! # uint128 + dstGasPriceInWei: BigInt! # uint128 blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpOracleSetDapi @entity(immutable: true) { +## --- + +type OrmpProtocolAppConfigUpdated @entity(immutable: true) { id: Bytes! - chainId: BigInt! # uint256 - dapi: Bytes! # address + ua: Bytes! # address + oracle: Bytes! # address + relayer: Bytes! # address blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpOracleSetFee @entity(immutable: true) { +type OrmpProtocolClearFailedMessage @entity(immutable: true) { id: Bytes! - chainId: BigInt! # uint256 - fee: BigInt! # uint256 + msgHash: Bytes! # bytes32 blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -## --- - -type OrmpRelayerAssigned @entity(immutable: true) { +type OrmpProtocolMessageAccepted @entity(immutable: true) { id: Bytes! msgHash: Bytes! # bytes32 - fee: BigInt! # uint256 - parmas: Bytes! # bytes + 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 OrmpRelayerSetApproved @entity(immutable: true) { +type OrmpProtocolMessageDispatched @entity(immutable: true) { id: Bytes! - operator: Bytes! # address - approve: Boolean! # bool + msgHash: Bytes! # bytes32 + dispatchResult: Boolean! # bool blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpRelayerSetDstConfig @entity(immutable: true) { +type OrmpProtocolRetryFailedMessage @entity(immutable: true) { id: Bytes! - chainId: BigInt! # uint256 - baseGas: BigInt! # uint64 - gasPerByte: BigInt! # uint64 + msgHash: Bytes! # bytes32 + dispatchResult: Boolean! # bool blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! } -type OrmpRelayerSetDstPrice @entity(immutable: true) { +type OrmpProtocolSetDefaultConfig @entity(immutable: true) { id: Bytes! - chainId: BigInt! # uint256 - dstPriceRatio: BigInt! # uint128 - dstGasPriceInWei: BigInt! # uint128 + oracle: Bytes! # address + relayer: Bytes! # address blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! diff --git a/thegraph/ormpipe/src/ormp-endpoint.ts b/thegraph/ormpipe/src/ormp-protocol.ts similarity index 84% rename from thegraph/ormpipe/src/ormp-endpoint.ts rename to thegraph/ormpipe/src/ormp-protocol.ts index 4d26e7e..46e4ee5 100644 --- a/thegraph/ormpipe/src/ormp-endpoint.ts +++ b/thegraph/ormpipe/src/ormp-protocol.ts @@ -5,18 +5,18 @@ import { MessageDispatched as MessageDispatchedEvent, RetryFailedMessage as RetryFailedMessageEvent, SetDefaultConfig as SetDefaultConfigEvent -} from "../generated/OrmpEndpoint/OrmpEndpoint" +} from "../generated/OrmpProtocol/OrmpProtocol" import { - OrmpEndpointAppConfigUpdated, - OrmpEndpointClearFailedMessage, - OrmpEndpointMessageAccepted, - OrmpEndpointMessageDispatched, - OrmpEndpointRetryFailedMessage, - OrmpEndpointSetDefaultConfig + OrmpProtocolAppConfigUpdated, + OrmpProtocolClearFailedMessage, + OrmpProtocolMessageAccepted, + OrmpProtocolMessageDispatched, + OrmpProtocolRetryFailedMessage, + OrmpProtocolSetDefaultConfig } from "../generated/schema" export function handleAppConfigUpdated(event: AppConfigUpdatedEvent): void { - let entity = new OrmpEndpointAppConfigUpdated( + let entity = new OrmpProtocolAppConfigUpdated( event.transaction.hash.concatI32(event.logIndex.toI32()) ) entity.ua = event.params.ua @@ -31,7 +31,7 @@ export function handleAppConfigUpdated(event: AppConfigUpdatedEvent): void { } export function handleClearFailedMessage(event: ClearFailedMessageEvent): void { - let entity = new OrmpEndpointClearFailedMessage( + let entity = new OrmpProtocolClearFailedMessage( event.transaction.hash.concatI32(event.logIndex.toI32()) ) entity.msgHash = event.params.msgHash @@ -44,7 +44,7 @@ export function handleClearFailedMessage(event: ClearFailedMessageEvent): void { } export function handleMessageAccepted(event: MessageAcceptedEvent): void { - let entity = new OrmpEndpointMessageAccepted( + let entity = new OrmpProtocolMessageAccepted( event.transaction.hash.concatI32(event.logIndex.toI32()) ) entity.msgHash = event.params.msgHash @@ -65,7 +65,7 @@ export function handleMessageAccepted(event: MessageAcceptedEvent): void { } export function handleMessageDispatched(event: MessageDispatchedEvent): void { - let entity = new OrmpEndpointMessageDispatched( + let entity = new OrmpProtocolMessageDispatched( event.transaction.hash.concatI32(event.logIndex.toI32()) ) entity.msgHash = event.params.msgHash @@ -79,7 +79,7 @@ export function handleMessageDispatched(event: MessageDispatchedEvent): void { } export function handleRetryFailedMessage(event: RetryFailedMessageEvent): void { - let entity = new OrmpEndpointRetryFailedMessage( + let entity = new OrmpProtocolRetryFailedMessage( event.transaction.hash.concatI32(event.logIndex.toI32()) ) entity.msgHash = event.params.msgHash @@ -93,7 +93,7 @@ export function handleRetryFailedMessage(event: RetryFailedMessageEvent): void { } export function handleSetDefaultConfig(event: SetDefaultConfigEvent): void { - let entity = new OrmpEndpointSetDefaultConfig( + let entity = new OrmpProtocolSetDefaultConfig( event.transaction.hash.concatI32(event.logIndex.toI32()) ) entity.oracle = event.params.oracle diff --git a/thegraph/ormpipe/subgraph.yaml b/thegraph/ormpipe/subgraph.yaml index 60c9366..edc5012 100644 --- a/thegraph/ormpipe/subgraph.yaml +++ b/thegraph/ormpipe/subgraph.yaml @@ -34,42 +34,6 @@ dataSources: - event: RemoveBeacon(indexed bytes32) handler: handleRemoveBeacon file: ./src/airnode-dapi.ts - - kind: ethereum - name: OrmpEndpoint - network: arbitrum-goerli - source: - address: "0x00000000fec9f746a2138D9C6f42794236f3aca8" - abi: OrmpEndpoint - startBlock: 35033761 - mapping: - kind: ethereum/events - apiVersion: 0.0.7 - language: wasm/assemblyscript - entities: - - AppConfigUpdated - - ClearFailedMessage - - OrmpEndpointMessageAccepted - - OrmpEndpointMessageDispatched - - RetryFailedMessage - - SetDefaultConfig - abis: - - name: OrmpEndpoint - file: ./abis/OrmpEndpoint.json - eventHandlers: - - event: AppConfigUpdated(indexed address,address,address) - handler: handleAppConfigUpdated - - event: ClearFailedMessage(indexed bytes32) - handler: handleClearFailedMessage - - event: MessageAccepted(indexed - bytes32,bytes32,(address,uint256,uint256,address,uint256,address,bytes)) - handler: handleMessageAccepted - - event: MessageDispatched(indexed bytes32,bool) - handler: handleMessageDispatched - - event: RetryFailedMessage(indexed bytes32,bool) - handler: handleRetryFailedMessage - - event: SetDefaultConfig(address,address) - handler: handleSetDefaultConfig - file: ./src/ormp-endpoint.ts - kind: ethereum name: OrmpOracle network: arbitrum-goerli @@ -128,3 +92,39 @@ dataSources: - event: SetDstPrice(indexed uint256,uint128,uint128) handler: handleSetDstPrice file: ./src/ormp-relayer.ts + - kind: ethereum + name: OrmpProtocol + network: arbitrum-goerli + source: + address: "0x00000000fec9f746a2138D9C6f42794236f3aca8" + abi: OrmpProtocol + startBlock: 35033761 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - OrmpProtocolAppConfigUpdated + - OrmpProtocolClearFailedMessage + - MessageAccepted + - MessageDispatched + - OrmpProtocolRetryFailedMessage + - OrmpProtocolSetDefaultConfig + abis: + - name: OrmpProtocol + file: ./abis/OrmpProtocol.json + eventHandlers: + - event: AppConfigUpdated(indexed address,address,address) + handler: handleAppConfigUpdated + - event: ClearFailedMessage(indexed bytes32) + handler: handleClearFailedMessage + - event: MessageAccepted(indexed + bytes32,bytes32,(address,uint256,uint256,address,uint256,address,bytes)) + handler: handleMessageAccepted + - event: MessageDispatched(indexed bytes32,bool) + handler: handleMessageDispatched + - event: RetryFailedMessage(indexed bytes32,bool) + handler: handleRetryFailedMessage + - event: SetDefaultConfig(address,address) + handler: handleSetDefaultConfig + file: ./src/ormp-protocol.ts diff --git a/thegraph/ormpipe/tests/ormp-endpoint-utils.ts b/thegraph/ormpipe/tests/ormp-protocol-utils.ts similarity index 98% rename from thegraph/ormpipe/tests/ormp-endpoint-utils.ts rename to thegraph/ormpipe/tests/ormp-protocol-utils.ts index e244807..1296885 100644 --- a/thegraph/ormpipe/tests/ormp-endpoint-utils.ts +++ b/thegraph/ormpipe/tests/ormp-protocol-utils.ts @@ -7,7 +7,7 @@ import { MessageDispatched, RetryFailedMessage, SetDefaultConfig -} from "../generated/OrmpEndpoint/OrmpEndpoint" +} from "../generated/OrmpProtocol/OrmpProtocol" export function createAppConfigUpdatedEvent( ua: Address, diff --git a/thegraph/ormpipe/tests/ormp-endpoint.test.ts b/thegraph/ormpipe/tests/ormp-protocol.test.ts similarity index 89% rename from thegraph/ormpipe/tests/ormp-endpoint.test.ts rename to thegraph/ormpipe/tests/ormp-protocol.test.ts index 2bd08e8..f579a50 100644 --- a/thegraph/ormpipe/tests/ormp-endpoint.test.ts +++ b/thegraph/ormpipe/tests/ormp-protocol.test.ts @@ -7,10 +7,10 @@ import { afterAll } from "matchstick-as/assembly/index" import { Address, Bytes } from "@graphprotocol/graph-ts" -import { AppConfigUpdated } from "../generated/schema" -import { AppConfigUpdated as AppConfigUpdatedEvent } from "../generated/OrmpEndpoint/OrmpEndpoint" -import { handleAppConfigUpdated } from "../src/ormp-endpoint" -import { createAppConfigUpdatedEvent } from "./ormp-endpoint-utils" +import { OrmpProtocolAppConfigUpdated } from "../generated/schema" +import { AppConfigUpdated as AppConfigUpdatedEvent } from "../generated/OrmpProtocol/OrmpProtocol" +import { handleAppConfigUpdated } from "../src/ormp-protocol" +import { createAppConfigUpdatedEvent } from "./ormp-protocol-utils" // Tests structure (matchstick-as >=0.5.0) // https://thegraph.com/docs/en/developer/matchstick/#tests-structure-0-5-0