Skip to content

Commit

Permalink
Merge pull request #59 from maticnetwork/statesync-fix
Browse files Browse the repository at this point in the history
Block-number and logIndex in stateSync events
  • Loading branch information
jdkanani authored Feb 4, 2022
2 parents abf8aa0 + 1cc5ae2 commit a8ff62a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Subgraph for Matic contracts

Please take a look at [Graph protocol](https://github.com/graphprotocol/graph-node) for more information.

## Polygon hosted node endpoints

**Root**
- Mainnet: `https://thegraph.com/hosted-service/subgraph/maticnetwork/mainnet-root-subgraphs`
- Goerli: `https://thegraph.com/hosted-service/subgraph/maticnetwork/mumbai-root-subgraphs`

## For Mumbai hosted node endpoints
- Graph node: `https://mumbai-graph.matic.today`
- GraphQL endpoint: `https://api.mumbai-graph.matic.today/subgraphs/name/<YOUR_GITHUB_USERNAME>/<SUBGRAPH_NAME>/graphql`
Expand Down
2 changes: 1 addition & 1 deletion root/config/goerli.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "goerli",
"subgraphId": "QmPuwKiewn7sczRV6LwGPWuNtDZTscKECz6NB6V1gE57bm",
"graftingStartBlock": 5996697,
"graftingStartBlock": 2815580,
"contracts": {
"rootChain": {
"address": "0x2890bA17EfE978480615e330ecB65333b880928e",
Expand Down
2 changes: 1 addition & 1 deletion root/config/mainnet.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "mainnet",
"subgraphId": "QmQTfDsLaqbT8VzCAE8zLDi4jjzXxDSkgw79r6VeLemv7b",
"graftingStartBlock": 13977920,
"graftingStartBlock": 10167760,
"contracts": {
"rootChain": {
"address": "0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287",
Expand Down
2 changes: 2 additions & 0 deletions root/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ type StateSync @entity {
depositorOrRootToken: String!
depositedTokenOrChildToken: String!
data: String!
logIndex: String!
transactionHash: Bytes!
timestamp: BigInt!
blockNumber: BigInt!
}

type StateRegistration @entity {
Expand Down
2 changes: 2 additions & 0 deletions root/src/mappings/state-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export function handleStateSynced(event: StateSynced): void {

entity.transactionHash = event.transaction.hash
entity.timestamp = event.block.timestamp
entity.blockNumber = event.block.number
entity.logIndex = event.logIndex.toString()

// Attempting to create an instance of `Decoder` smart contract
// to be used for decoding valid state sync data
Expand Down

0 comments on commit a8ff62a

Please sign in to comment.