Skip to content

Commit 658d6b1

Browse files
committed
feat: added network configs
1 parent 32c4b5d commit 658d6b1

9 files changed

+335
-27
lines changed

config/arbitrum.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"network": "arbitrum",
3+
"startBlock": 205834,
4+
5+
"darknodeRegistry": "0x0000000000000000000000000000000000000000",
6+
"darknodePayment": "0x0000000000000000000000000000000000000000",
7+
8+
"gatewayRegistry": "0x21C482f153D0317fe85C60bE1F7fa079019fcEbD",
9+
"gatewayRegistryVDot3": "0x0000000000000000000000000000000000000000",
10+
"uniswapFactory": "0x0000000000000000000000000000000000000000",
11+
"weth": "0x0000000000000000000000000000000000000000",
12+
"usd": "0x0000000000000000000000000000000000000000",
13+
14+
"_comment": "// DEPRECATED //",
15+
"btcGateway": "0x0000000000000000000000000000000000000000",
16+
"zecGateway": "0x0000000000000000000000000000000000000000",
17+
"bchGateway": "0x0000000000000000000000000000000000000000",
18+
"btc": "0x0000000000000000000000000000000000000000",
19+
"zec": "0x0000000000000000000000000000000000000000",
20+
"bch": "0x0000000000000000000000000000000000000000"
21+
}

config/avalanche.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"network": "avalanche",
3+
"startBlock": 2177304,
4+
5+
"darknodeRegistry": "0x0000000000000000000000000000000000000000",
6+
"darknodePayment": "0x0000000000000000000000000000000000000000",
7+
8+
"gatewayRegistry": "0x21C482f153D0317fe85C60bE1F7fa079019fcEbD",
9+
"gatewayRegistryVDot3": "0x0000000000000000000000000000000000000000",
10+
"uniswapFactory": "0x0000000000000000000000000000000000000000",
11+
"weth": "0x0000000000000000000000000000000000000000",
12+
"usd": "0x0000000000000000000000000000000000000000",
13+
14+
"_comment": "// DEPRECATED //",
15+
"btcGateway": "0x0000000000000000000000000000000000000000",
16+
"zecGateway": "0x0000000000000000000000000000000000000000",
17+
"bchGateway": "0x0000000000000000000000000000000000000000",
18+
"btc": "0x0000000000000000000000000000000000000000",
19+
"zec": "0x0000000000000000000000000000000000000000",
20+
"bch": "0x0000000000000000000000000000000000000000"
21+
}

config/bsc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"network": "mainnet",
2+
"network": "bsc",
33
"startBlock": 1929336,
44

55
"darknodeRegistry": "0x0000000000000000000000000000000000000000",

config/fantom.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"network": "fantom",
3+
"startBlock": 7496306,
4+
5+
"darknodeRegistry": "0x0000000000000000000000000000000000000000",
6+
"darknodePayment": "0x0000000000000000000000000000000000000000",
7+
8+
"gatewayRegistry": "0x21C482f153D0317fe85C60bE1F7fa079019fcEbD",
9+
"gatewayRegistryVDot3": "0x0000000000000000000000000000000000000000",
10+
"uniswapFactory": "0x0000000000000000000000000000000000000000",
11+
"weth": "0x0000000000000000000000000000000000000000",
12+
"usd": "0x0000000000000000000000000000000000000000",
13+
14+
"_comment": "// DEPRECATED //",
15+
"btcGateway": "0x0000000000000000000000000000000000000000",
16+
"zecGateway": "0x0000000000000000000000000000000000000000",
17+
"bchGateway": "0x0000000000000000000000000000000000000000",
18+
"btc": "0x0000000000000000000000000000000000000000",
19+
"zec": "0x0000000000000000000000000000000000000000",
20+
"bch": "0x0000000000000000000000000000000000000000"
21+
}

config/polygon.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"network": "matic",
3+
"startBlock": 14937138,
4+
5+
"darknodeRegistry": "0x0000000000000000000000000000000000000000",
6+
"darknodePayment": "0x0000000000000000000000000000000000000000",
7+
8+
"gatewayRegistry": "0x21C482f153D0317fe85C60bE1F7fa079019fcEbD",
9+
"gatewayRegistryVDot3": "0x0000000000000000000000000000000000000000",
10+
"uniswapFactory": "0x0000000000000000000000000000000000000000",
11+
"weth": "0x0000000000000000000000000000000000000000",
12+
"usd": "0x0000000000000000000000000000000000000000",
13+
14+
"_comment": "// DEPRECATED //",
15+
"btcGateway": "0x0000000000000000000000000000000000000000",
16+
"zecGateway": "0x0000000000000000000000000000000000000000",
17+
"bchGateway": "0x0000000000000000000000000000000000000000",
18+
"btc": "0x0000000000000000000000000000000000000000",
19+
"zec": "0x0000000000000000000000000000000000000000",
20+
"bch": "0x0000000000000000000000000000000000000000"
21+
}

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
"license": "MIT",
44
"scripts": {
55
"build": "graph build",
6-
"prepare": "mustache ./config/${NETWORK:-testnet}.json subgraph.template.yaml > subgraph.yaml && mustache ./config/${NETWORK:-testnet}.json src/_config.template.yaml > src/_config.ts",
7-
"codegen": "npm run prepare && graph codegen --output-dir ./generated",
8-
"deploy-remote": "npm run codegen && npm run build && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ ${NAME:-null}",
6+
"prepare": "mustache ./config/${NETWORK:=-testnet}.json ${SUBGRAPH_TEMPLATE:=subgraph}.template.yaml > subgraph.yaml && mustache ./config/${NETWORK:=-testnet}.json src/_config.template.yaml > src/_config.ts",
7+
"codegen": "yarn run prepare && graph codegen --output-dir ./generated",
8+
"deploy-remote": "yarn run codegen && yarn run build && graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --deploy-key 5e29ea01508a42d7b517186e8cc830a3 --access-token 5e29ea01508a42d7b517186e8cc830a3 ${NAME:-null}",
99
"create:local": "graph create --node http://localhost:8020/ renproject/renvm",
1010
"create:local-testnet": "graph create --node http://localhost:8020/ renproject/renvm-testnet",
11-
"deploy:local": "npm run codegen && graph deploy --ipfs http://localhost:5001 --node http://localhost:8020/ ${NAME:-renproject/renvm}",
12-
"deploy:mainnet": "NETWORK=mainnet NAME=renproject/renvm npm run deploy-remote",
13-
"deploy:testnet": "NETWORK=testnet NAME=renproject/renvm-testnet npm run deploy-remote",
14-
"deploy:devnet": "NETWORK=devnet NAME=noiach/renvm-devnet npm run deploy-remote",
15-
"deploy:do-0": "npm run codegen && npm run build && graph deploy --ipfs https://api.bscgraph.org/ --node https://api.bscgraph.org/deploy ${NAME}",
16-
"deploy:bsc": "NETWORK=bsc NAME=renproject/renvm yarn deploy:do-0",
17-
"create:bsc": "graph create --node https://api.bscgraph.org/deploy renproject/renvm",
18-
"deploy:do-1": "npm run codegen && npm run build && graph deploy --ipfs http://192.241.156.107:5001 --node http://192.241.156.107:8020 ${NAME}",
19-
"deploy:bsc-testnet": "NETWORK=bsc-testnet NAME=renproject/renvm-testnet yarn deploy:do-1"
11+
"deploy:local": "yarn run codegen && graph deploy --ipfs http://localhost:5001 --node http://localhost:8020/ ${NAME:-renproject/renvm}",
12+
"deploy:mainnet": "SUBGRAPH_TEMPLATE=subgraph-full NETWORK=mainnet NAME=renproject/renvm yarn run deploy-remote",
13+
"deploy:fantom": "NETWORK=fantom NAME=renproject/renvm-fantom yarn run deploy-remote",
14+
"deploy:arbitrum": "NETWORK=arbitrum NAME=renproject/renvm-arbitrum yarn run deploy-remote",
15+
"deploy:avalanche": "NETWORK=avalanche NAME=renproject/renvm-avalanche yarn run deploy-remote",
16+
"deploy:bsc": "NETWORK=bsc NAME=renproject/renvm-binance-smart-chain yarn run deploy-remote",
17+
"deploy:polygon": "NETWORK=polygon NAME=renproject/renvm-polygon yarn run deploy-remote",
18+
"deploy:testnet": "SUBGRAPH_TEMPLATE=subgraph-full NETWORK=testnet NAME=renproject/renvm-testnet yarn run deploy-remote",
19+
"deploy:devnet": "NETWORK=devnet NAME=noiach/renvm-devnet yarn run deploy-remote"
2020
},
2121
"dependencies": {
2222
"@graphprotocol/graph-cli": "^0.19.0",

schema.graphql

+9-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Asset @entity {
2626
priceInUsd: BigDecimal!
2727
}
2828

29+
2930
type ValueWithAsset @entity {
3031
id: ID!
3132
symbol: String!
@@ -89,11 +90,17 @@ type Epoch @entity {
8990
totalRewardShareBCH: BigInt!
9091
}
9192

92-
# Data accumulated and condensed into day stats
93+
"""
94+
The RenVM entity contains all the information about the current state of RenVM's
95+
on-chain information.
96+
"""
9397
type RenVM @entity {
9498
id: ID! # fixed to '1'
95-
# The most recent Ethereum block in which RenVM had activity.
99+
"""
100+
The most recent Ethereum block in which RenVM had activity.
101+
"""
96102
activeBlock: BigInt!
103+
97104
activeTimestamp: BigInt!
98105
previousActiveBlock: BigInt!
99106
previousActiveTimestamp: BigInt!

subgraph-full.template.yaml

+229
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
specVersion: 0.0.2
2+
schema:
3+
file: ./schema.graphql
4+
templates:
5+
- kind: ethereum/contract
6+
name: Gateway
7+
network: {{network}}
8+
source:
9+
abi: Gateway
10+
mapping:
11+
kind: ethereum/events
12+
apiVersion: 0.0.4
13+
language: wasm/assemblyscript
14+
file: ./src/gateways.ts
15+
entities:
16+
- Gateway
17+
abis:
18+
- name: Gateway
19+
file: ./abis/Gateway.json
20+
- name: RenERC20
21+
file: ./abis/RenERC20LogicV1.json
22+
- name: UniswapFactory
23+
file: ./abis/UniswapFactory.json
24+
- name: UniswapExchange
25+
file: ./abis/UniswapExchange.json
26+
- name: DarknodePayment
27+
file: ./abis/DarknodePayment.json
28+
- name: DarknodePaymentStore
29+
file: ./abis/DarknodePaymentStore.json
30+
eventHandlers:
31+
- event: LogMint(indexed address,uint256,indexed uint256,indexed bytes32)
32+
handler: handleLogMint
33+
- event: LogBurn(bytes,uint256,indexed uint256,indexed bytes)
34+
handler: handleLogBurn
35+
dataSources:
36+
- kind: ethereum/contract
37+
name: GatewayRegistry
38+
network: {{network}}
39+
source:
40+
address: "{{gatewayRegistry}}"
41+
abi: GatewayRegistry
42+
startBlock: {{startBlock}}
43+
mapping:
44+
kind: ethereum/events
45+
apiVersion: 0.0.4
46+
language: wasm/assemblyscript
47+
entities:
48+
- RenVM
49+
abis:
50+
- name: GatewayRegistry
51+
file: ./abis/GatewayRegistry.json
52+
- name: Gateway
53+
file: ./abis/Gateway.json
54+
- name: RenERC20
55+
file: ./abis/RenERC20LogicV1.json
56+
eventHandlers:
57+
- event: LogGatewayRegistered(string,indexed string,indexed address,indexed address)
58+
handler: handleLogGatewayRegistered
59+
file: ./src/gatewayRegistry.ts
60+
- kind: ethereum/contract
61+
name: GatewayRegistryVDot3
62+
network: {{network}}
63+
source:
64+
address: "{{gatewayRegistryVDot3}}"
65+
abi: GatewayRegistry
66+
startBlock: {{startBlock}}
67+
mapping:
68+
kind: ethereum/events
69+
apiVersion: 0.0.4
70+
language: wasm/assemblyscript
71+
entities:
72+
- RenVM
73+
abis:
74+
- name: GatewayRegistry
75+
file: ./abis/GatewayRegistry.json
76+
- name: Gateway
77+
file: ./abis/Gateway.json
78+
- name: RenERC20
79+
file: ./abis/RenERC20LogicV1.json
80+
eventHandlers:
81+
- event: LogGatewayRegistered(string,indexed string,indexed address,indexed address)
82+
handler: handleLogGatewayRegistered
83+
file: ./src/gatewayRegistry.ts
84+
- kind: ethereum/contract
85+
name: BTCGateway
86+
network: {{network}}
87+
source:
88+
address: "{{btcGateway}}"
89+
abi: Gateway
90+
startBlock: {{startBlock}}
91+
mapping:
92+
kind: ethereum/events
93+
apiVersion: 0.0.4
94+
language: wasm/assemblyscript
95+
entities:
96+
- LogMint
97+
- LogBurn
98+
- Integrator
99+
- RenVM
100+
abis:
101+
- name: Gateway
102+
file: ./abis/Gateway.json
103+
callHandlers:
104+
- function: mint(bytes32,uint256,bytes32,bytes)
105+
handler: handleMint
106+
- function: burn(bytes,uint256)
107+
handler: handleBurn
108+
file: ./src/btcGateway.ts
109+
- kind: ethereum/contract
110+
name: ZECGateway
111+
network: {{network}}
112+
source:
113+
address: "{{zecGateway}}"
114+
abi: Gateway
115+
startBlock: {{startBlock}}
116+
mapping:
117+
kind: ethereum/events
118+
apiVersion: 0.0.4
119+
language: wasm/assemblyscript
120+
entities:
121+
- LogMint
122+
- LogBurn
123+
- Integrator
124+
- RenVM
125+
abis:
126+
- name: Gateway
127+
file: ./abis/Gateway.json
128+
callHandlers:
129+
- function: mint(bytes32,uint256,bytes32,bytes)
130+
handler: handleMint
131+
- function: burn(bytes,uint256)
132+
handler: handleBurn
133+
file: ./src/zecGateway.ts
134+
- kind: ethereum/contract
135+
name: BCHGateway
136+
network: {{network}}
137+
source:
138+
address: "{{bchGateway}}"
139+
abi: Gateway
140+
startBlock: {{startBlock}}
141+
mapping:
142+
kind: ethereum/events
143+
apiVersion: 0.0.4
144+
language: wasm/assemblyscript
145+
entities:
146+
- LogMint
147+
- LogBurn
148+
- Integrator
149+
- RenVM
150+
abis:
151+
- name: Gateway
152+
file: ./abis/Gateway.json
153+
callHandlers:
154+
- function: mint(bytes32,uint256,bytes32,bytes)
155+
handler: handleMint
156+
- function: burn(bytes,uint256)
157+
handler: handleBurn
158+
file: ./src/bchGateway.ts
159+
- kind: ethereum/contract
160+
name: DarknodeRegistry
161+
network: {{network}}
162+
source:
163+
address: "{{darknodeRegistry}}"
164+
abi: DarknodeRegistry
165+
startBlock: {{startBlock}}
166+
mapping:
167+
kind: ethereum/events
168+
apiVersion: 0.0.4
169+
language: wasm/assemblyscript
170+
entities:
171+
- LogDarknodeRegistered
172+
- LogDarknodeDeregistered
173+
- LogNewEpoch
174+
abis:
175+
- name: DarknodeRegistry
176+
file: ./abis/DarknodeRegistry.json
177+
- name: DarknodePayment
178+
file: ./abis/DarknodePayment.json
179+
- name: Gateway
180+
file: ./abis/Gateway.json
181+
- name: RenERC20
182+
file: ./abis/RenERC20LogicV1.json
183+
- name: UniswapFactory
184+
file: ./abis/UniswapFactory.json
185+
- name: UniswapExchange
186+
file: ./abis/UniswapExchange.json
187+
eventHandlers:
188+
- event: LogDarknodeRegistered(indexed address,indexed address,uint256)
189+
handler: handleLogDarknodeRegistered
190+
- event: LogDarknodeDeregistered(indexed address,indexed address)
191+
handler: handleLogDarknodeDeregistered
192+
- event: LogDarknodeRefunded(indexed address,indexed address,uint256)
193+
handler: handleLogDarknodeRefunded
194+
- event: LogNewEpoch(indexed uint256)
195+
handler: handleLogNewEpoch
196+
file: ./src/darknodeRegistry.ts
197+
- kind: ethereum/contract
198+
name: DarknodePayment
199+
network: {{network}}
200+
source:
201+
address: "{{darknodePayment}}"
202+
abi: DarknodePayment
203+
startBlock: {{startBlock}}
204+
mapping:
205+
kind: ethereum/events
206+
apiVersion: 0.0.4
207+
language: wasm/assemblyscript
208+
entities:
209+
- LogDarknodeWithdrew
210+
abis:
211+
- name: DarknodePayment
212+
file: ./abis/DarknodePayment.json
213+
- name: Gateway
214+
file: ./abis/Gateway.json
215+
- name: RenERC20
216+
file: ./abis/RenERC20LogicV1.json
217+
- name: UniswapFactory
218+
file: ./abis/UniswapFactory.json
219+
- name: UniswapExchange
220+
file: ./abis/UniswapExchange.json
221+
callHandlers:
222+
- function: changeCycle()
223+
handler: handleChangeCycle
224+
eventHandlers:
225+
- event: LogDarknodeClaim(indexed address,uint256)
226+
handler: handleLogDarknodeClaim
227+
- event: LogDarknodeWithdrew(indexed address,indexed address,indexed address,uint256)
228+
handler: handleLogDarknodeWithdrew
229+
file: ./src/darknodePayment.ts

0 commit comments

Comments
 (0)