Skip to content

Commit

Permalink
Add staging environment for the subgraph, add inactiveShares (#126)
Browse files Browse the repository at this point in the history
* Add staging environment for the subgraph, add inactiveShares to Stake entity

* Fix production subgraph deployment
  • Loading branch information
ivandiazwm authored Sep 26, 2022
1 parent 3fdecbf commit c21e283
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 117 deletions.
1 change: 0 additions & 1 deletion subgraph/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
generated
old_subgraph
node_modules
networks.json
schema.graphql
.bin
tests/.bin
38 changes: 38 additions & 0 deletions subgraph/networks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"matic": {
"ScannerRegistry": {
"address": "0xbF2920129f83d75DeC95D97A879942cCe3DcD387",
"startBlock": 20187154
},
"AgentRegistry": {
"address": "0x61447385B019187daa48e91c55c02AF1F1f3F863",
"startBlock": 20187154
},
"Dispatcher": {
"address": "0xd46832F3f8EA8bDEFe5316696c0364F01b31a573",
"startBlock": 20187154
},
"FortaStaking": {
"address": "0xd2863157539b1D11F39ce23fC4834B62082F6874",
"startBlock": 20187154
}
},
"mumbai": {
"ScannerRegistry": {
"address": "0xa30c3951f85941bfe474620dA25DEb90283C99D7",
"startBlock": 21300000
},
"AgentRegistry": {
"address": "0x5Cf7008aC441Ec1797fAfA4EE132eA4277E9239B",
"startBlock": 21300000
},
"Dispatcher": {
"address": "0x634C83F3213CcfC895A4e6A2c137b2B572fa64ad",
"startBlock": 21300000
},
"FortaStaking": {
"address": "0x8a5EEfA2BAb332DD7666d885e9C9d2775221EB1c",
"startBlock": 21300000
}
}
}
17 changes: 11 additions & 6 deletions subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
"license": "UNLICENSED",
"scripts": {
"prepare:schema": "concat -o schema.graphql src/schema.gql node_modules/@amxx/graphprotocol-utils/generated/schema.graphql",
"prepare:codegen": "graph codegen subgraph.yaml",
"prepare:compile": "graph build subgraph.yaml",
"prepare:codegen": "graph codegen subgraph.yaml --network matic",
"prepare:compile": "graph build subgraph.yaml --network matic",
"prepare-dev:schema": "concat -o schema.graphql src/schema.gql node_modules/@amxx/graphprotocol-utils/generated/schema.graphql",
"prepare-dev:codegen": "graph codegen subgraph.yaml --network mumbai",
"prepare-dev:compile": "graph build subgraph.yaml --network mumbai",
"prepare": "yarn prepare:schema && yarn prepare:codegen && yarn prepare:compile",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ TDrachev/forta-subgraph",
"create-local": "graph create --node http://localhost:8020/ TDrachev/forta-subgraph",
"remove-local": "graph remove --node http://localhost:8020/ TDrachev/forta-subgraph",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 TDrachev/forta-subgraph"
"prepare-dev": "yarn prepare-dev:schema && yarn prepare-dev:codegen && yarn prepare-dev:compile",
"deploy-dev": "graph deploy --network mumbai --node https://api.thegraph.com/deploy/ ivandiazwm/forta-network-dev",
"deploy": "graph deploy --network matic --node https://api.thegraph.com/deploy/ forta-network/forta-network",
"create-local": "graph create --node http://localhost:8020/ forta-network/forta-network",
"remove-local": "graph remove --node http://localhost:8020/ forta-network/forta-network",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 forta-network/forta-network"
},
"dependencies": {
"@amxx/graphprotocol-utils": "^1.1.0-alpha.0",
Expand Down
5 changes: 5 additions & 0 deletions subgraph/src/datasources/FortaStaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ function updateStake(
_subject,
_staker
);
stake.inactiveShares = fortaStaking.inactiveSharesOf(
_subjectType,
_subject,
_staker
);
subject.save();
stake.save();
staker.save();
Expand Down
1 change: 1 addition & 0 deletions subgraph/src/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ type Stake @entity {
staker: Staker!
isActive: Boolean
shares: BigInt
inactiveShares: BigInt
stakeDepositedEvents: [StakeDepositEvent!] @derivedFrom(field: "stake")
}

Expand Down
106 changes: 0 additions & 106 deletions subgraph/subgraph.dev.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dataSources:
name: ScannerRegistry
network: matic
source:
address: "0xbF2920129f83d75DeC95D97A879942cCe3DcD387"
abi: ScannerRegistry
address: "0xbF2920129f83d75DeC95D97A879942cCe3DcD387"
startBlock: 20187154
mapping:
kind: ethereum/events
Expand All @@ -33,8 +33,8 @@ dataSources:
name: AgentRegistry
network: matic
source:
address: "0x61447385B019187daa48e91c55c02AF1F1f3F863"
abi: AgentRegistry
address: "0x61447385B019187daa48e91c55c02AF1F1f3F863"
startBlock: 20187154
mapping:
kind: ethereum/events
Expand All @@ -57,8 +57,8 @@ dataSources:
name: Dispatcher
network: matic
source:
address: "0xd46832F3f8EA8bDEFe5316696c0364F01b31a573"
abi: Dispatcher
address: "0xd46832F3f8EA8bDEFe5316696c0364F01b31a573"
startBlock: 20187154
mapping:
kind: ethereum/events
Expand All @@ -78,8 +78,8 @@ dataSources:
name: FortaStaking
network: matic
source:
address: "0xd2863157539b1D11F39ce23fC4834B62082F6874"
abi: FortaStaking
address: "0xd2863157539b1D11F39ce23fC4834B62082F6874"
startBlock: 20187154
mapping:
kind: ethereum/events
Expand Down

0 comments on commit c21e283

Please sign in to comment.