Fixes in eden watcher after comparing with generated watcher (#96)

This commit is contained in:
nikugogoi 2021-12-24 11:30:51 +05:30 committed by nabarun
parent e883463aa6
commit 7a4d0b6bb4
8 changed files with 205 additions and 23 deletions

View File

@ -31,7 +31,6 @@
"@apollo/client": "^3.3.19",
"@ethersproject/providers": "5.3.0",
"@ipld/dag-cbor": "^6.0.12",
"@vulcanize/cache": "^0.1.0",
"@vulcanize/ipld-eth-client": "^0.1.0",
"@vulcanize/solidity-mapper": "^0.1.0",
"@vulcanize/util": "^0.1.0",
@ -43,10 +42,7 @@
"express": "^4.17.1",
"graphql": "^15.5.0",
"graphql-import-node": "^0.0.4",
"ipfs-http-client": "^53.0.1",
"json-bigint": "^1.0.0",
"lodash": "^4.17.21",
"multiformats": "^9.4.8",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.32",
"yargs": "^17.0.1",

View File

@ -95,7 +95,7 @@ GQL console: http://localhost:{{port}}/graphql
* `starting-block`: Starting block for the contract (default: `1`).
Examples:
Watch a contract with its address and checkpointing on:
```bash
@ -115,7 +115,7 @@ GQL console: http://localhost:{{port}}/graphql
```
* `start-block`: Block number to start filling from.
* `end-block`: Block number till which to fill.
* `end-block`: Block number till which to fill.
* To create a checkpoint for a contract:
@ -139,7 +139,7 @@ GQL console: http://localhost:{{port}}/graphql
```bash
yarn reset job-queue --block-number <previous-block-number>
```
* `block-number`: Block number to which to reset the watcher.
* To export and import the watcher state:
@ -157,7 +157,7 @@ GQL console: http://localhost:{{port}}/graphql
```bash
yarn job-runner
```
* Import watcher state:
```bash
@ -165,7 +165,7 @@ GQL console: http://localhost:{{port}}/graphql
```
* `import-file`: Path of JSON file from which to import the watcher data.
* Run fill:
```bash

View File

@ -59,14 +59,12 @@
* Generating state:
* Edit the custom hook function `createInitialCheckpoint` (triggered on watch-contract, checkpoint: `true`) in [hooks.ts](./src/hooks.ts) to save an initial checkpoint `IPLDBlock` using the `Indexer` object.
* Edit the custom hook function `createInitialState` (triggered if the watcher passes the start block, checkpoint: `true`) in [hooks.ts](./src/hooks.ts) to save an initial state `IPLDBlock` using the `Indexer` object.
* Edit the custom hook function `createStateDiff` (triggered on a block) in [hooks.ts](./src/hooks.ts) to save the state in a `diff` `IPLDBlock` using the `Indexer` object. The default state (if exists) is updated.
* Edit the custom hook function `createStateCheckpoint` (triggered just before default and CLI checkpoint) in [hooks.ts](./src/hooks.ts) to save the state in a `checkpoint` `IPLDBlock` using the `Indexer` object.
* The existing example hooks in [hooks.ts](./src/hooks.ts) are for an `ERC20` contract.
## Run
* Run the watcher:
@ -97,7 +95,7 @@ GQL console: http://localhost:3012/graphql
* `starting-block`: Starting block for the contract (default: `1`).
Examples:
Watch a contract with its address and checkpointing on:
```bash
@ -117,7 +115,7 @@ GQL console: http://localhost:3012/graphql
```
* `start-block`: Block number to start filling from.
* `end-block`: Block number till which to fill.
* `end-block`: Block number till which to fill.
* To create a checkpoint for a contract:
@ -141,7 +139,7 @@ GQL console: http://localhost:3012/graphql
```bash
yarn reset job-queue --block-number <previous-block-number>
```
* `block-number`: Block number to which to reset the watcher.
* To export and import the watcher state:
@ -159,7 +157,7 @@ GQL console: http://localhost:3012/graphql
```bash
yarn job-runner
```
* Import watcher state:
```bash
@ -167,7 +165,7 @@ GQL console: http://localhost:3012/graphql
```
* `import-file`: Path of JSON file from which to import the watcher data.
* Run fill:
```bash

View File

@ -31,7 +31,6 @@
"@apollo/client": "^3.3.19",
"@ethersproject/providers": "5.3.0",
"@ipld/dag-cbor": "^6.0.12",
"@vulcanize/cache": "^0.1.0",
"@vulcanize/ipld-eth-client": "^0.1.0",
"@vulcanize/solidity-mapper": "^0.1.0",
"@vulcanize/util": "^0.1.0",
@ -43,10 +42,7 @@
"express": "^4.17.1",
"graphql": "^15.5.0",
"graphql-import-node": "^0.0.4",
"ipfs-http-client": "^53.0.1",
"json-bigint": "^1.0.0",
"lodash": "^4.17.21",
"multiformats": "^9.4.8",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.32",
"yargs": "^17.0.1",

View File

@ -67,6 +67,70 @@ query events($blockHash: String!, $contractAddress: String!, $name: String){
withdrawer
withdrawalAmount
}
... on ApprovalForAllEvent {
owner
operator
approved
}
... on BlockProducerAddedEvent {
producer
}
... on BlockProducerRemovedEvent {
producer
}
... on BlockProducerRewardCollectorChangedEvent {
producer
collector
}
... on RewardScheduleChangedEvent {
dummy
}
... on ClaimedEvent {
index
totalEarned
account
claimed
}
... on SlashedEvent {
account
slashed
}
... on MerkleRootUpdatedEvent {
merkleRoot
distributionNumber
metadataURI
}
... on AccountUpdatedEvent {
account
totalClaimed
totalSlashed
}
... on PermanentURIEvent {
value
id
}
... on GovernanceChangedEvent {
from
to
}
... on UpdateThresholdChangedEvent {
updateThreshold
}
... on RoleAdminChangedEvent {
role
previousAdminRole
newAdminRole
}
... on RoleGrantedEvent {
role
account
sender
}
... on RoleRevokedEvent {
role
account
sender
}
}
proof{
data

View File

@ -67,6 +67,70 @@ query eventsInRange($fromBlockNumber: Int!, $toBlockNumber: Int!){
withdrawer
withdrawalAmount
}
... on ApprovalForAllEvent {
owner
operator
approved
}
... on BlockProducerAddedEvent {
producer
}
... on BlockProducerRemovedEvent {
producer
}
... on BlockProducerRewardCollectorChangedEvent {
producer
collector
}
... on RewardScheduleChangedEvent {
dummy
}
... on ClaimedEvent {
index
totalEarned
account
claimed
}
... on SlashedEvent {
account
slashed
}
... on MerkleRootUpdatedEvent {
merkleRoot
distributionNumber
metadataURI
}
... on AccountUpdatedEvent {
account
totalClaimed
totalSlashed
}
... on PermanentURIEvent {
value
id
}
... on GovernanceChangedEvent {
from
to
}
... on UpdateThresholdChangedEvent {
updateThreshold
}
... on RoleAdminChangedEvent {
role
previousAdminRole
newAdminRole
}
... on RoleGrantedEvent {
role
account
sender
}
... on RoleRevokedEvent {
role
account
sender
}
}
proof{
data

View File

@ -67,6 +67,70 @@ subscription onEvent{
withdrawer
withdrawalAmount
}
... on ApprovalForAllEvent {
owner
operator
approved
}
... on BlockProducerAddedEvent {
producer
}
... on BlockProducerRemovedEvent {
producer
}
... on BlockProducerRewardCollectorChangedEvent {
producer
collector
}
... on RewardScheduleChangedEvent {
dummy
}
... on ClaimedEvent {
index
totalEarned
account
claimed
}
... on SlashedEvent {
account
slashed
}
... on MerkleRootUpdatedEvent {
merkleRoot
distributionNumber
metadataURI
}
... on AccountUpdatedEvent {
account
totalClaimed
totalSlashed
}
... on PermanentURIEvent {
value
id
}
... on GovernanceChangedEvent {
from
to
}
... on UpdateThresholdChangedEvent {
updateThreshold
}
... on RoleAdminChangedEvent {
role
previousAdminRole
newAdminRole
}
... on RoleGrantedEvent {
role
account
sender
}
... on RoleRevokedEvent {
role
account
sender
}
}
proof{
data

View File

@ -92,8 +92,8 @@ type SlotClaimedEvent {
slot: Int!
owner: String!
delegate: String!
newBidAmount: Int!
oldBidAmount: Int!
newBidAmount: BigInt!
oldBidAmount: BigInt!
taxNumerator: Int!
taxDenominator: Int!
}