Skip to content

Commit

Permalink
Initialize subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfior committed Sep 19, 2024
1 parent 8b4e5a4 commit f481b28
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,14 @@ Before working with graphs, you need to run `forge build` in the root directory.
The sequence of commands is `codegen -> build -> test -> deploy`.

(On MacOS Sonoma, running the tests in the docker mode is required: https://github.com/LimeChain/matchstick/issues/421)


#####
# next steps graph
Next steps:

1. Run `graph auth` to authenticate with your deploy key.

2. Type `cd omen-agentresultmapping` to enter the subgraph.

3. Run `yarn deploy` to deploy the subgraph.
6 changes: 3 additions & 3 deletions graphs/omen-agentresultmapping/networks.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"http://localhost:8545": {
"Contract": {
"address": "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9",
"https://gnosis-rpc.publicnode.com": {
"OmenAgentResultMapping": {
"address": "0xbe1F6944496923683ca849fc0cC93fD10523cB83",
"startBlock": 0
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PredictionAdded as PredictionAddedEvent } from "../generated/Contract/Contract"
import { PredictionAdded as PredictionAddedEvent } from "../generated/OmenAgentResultMapping/OmenAgentResultMapping"
import { PredictionAdded } from "../generated/schema"

export function handlePredictionAdded(event: PredictionAddedEvent): void {
Expand Down
14 changes: 7 additions & 7 deletions graphs/omen-agentresultmapping/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ schema:
file: ./schema.graphql
dataSources:
- kind: ethereum
name: Contract
network: http://localhost:8545
name: OmenAgentResultMapping
network: https://gnosis-rpc.publicnode.com
source:
address: "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9"
abi: Contract
address: "0xbe1F6944496923683ca849fc0cC93fD10523cB83"
abi: OmenAgentResultMapping
startBlock: 0
mapping:
kind: ethereum/events
Expand All @@ -18,9 +18,9 @@ dataSources:
entities:
- PredictionAdded
abis:
- name: Contract
file: ./abis/Contract.json
- name: OmenAgentResultMapping
file: ./abis/OmenAgentResultMapping.json
eventHandlers:
- event: PredictionAdded(indexed address,uint16,indexed address,bytes32,bytes32)
handler: handlePredictionAdded
file: ./src/contract.ts
file: ./src/omen-agent-result-mapping.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { newMockEvent } from "matchstick-as"
import { ethereum, Address, Bytes } from "@graphprotocol/graph-ts"
import { PredictionAdded } from "../generated/Contract/Contract"
import { PredictionAdded } from "../generated/OmenAgentResultMapping/OmenAgentResultMapping"

export function createPredictionAddedEvent(
marketAddress: Address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
} from "matchstick-as/assembly/index"
import { Address, Bytes } from "@graphprotocol/graph-ts"
import { PredictionAdded } from "../generated/schema"
import { PredictionAdded as PredictionAddedEvent } from "../generated/Contract/Contract"
import { handlePredictionAdded } from "../src/contract"
import { createPredictionAddedEvent } from "./contract-utils"
import { PredictionAdded as PredictionAddedEvent } from "../generated/OmenAgentResultMapping/OmenAgentResultMapping"
import { handlePredictionAdded } from "../src/omen-agent-result-mapping"
import { createPredictionAddedEvent } from "./omen-agent-result-mapping-utils"

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

0 comments on commit f481b28

Please sign in to comment.