forked from kernelwhisperer/protofun-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (55 loc) · 2.1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
ENDPOINT ?= mainnet.eth.streamingfast.io:443
POSTGRESQL_DSN ?= psql://daniel:toor@localhost:5432/protofun?sslmode=disable
START_BLOCK ?= 12965000
STOP_BLOCK ?= +1
# START_BLOCK ?= 12964995
# STOP_BLOCK ?= 12965005
IPFS_ENDPOINT ?= http://127.0.0.1:5001
GRAPH_NODE_ENDPOINT ?= http://127.0.0.1:8020
GRAPHMAN_CONFIG ?= ../graph-node-dev/config/graphman.toml
.PHONY: codegen
codegen:
substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google"
.PHONY: build
build:
cargo build --target wasm32-unknown-unknown --release
.PHONY: package
package: build
substreams pack -o protofun.spkg ./substreams.yaml
.PHONY: stream
stream: build
substreams run -e $(ENDPOINT) substreams.yaml map_block --start-block $(START_BLOCK) --stop-block $(STOP_BLOCK)
.PHONY: gui
gui: build
substreams gui -e $(ENDPOINT) substreams.yaml map_block --start-block $(START_BLOCK) --stop-block $(STOP_BLOCK)
.PHONY: build-db
build-db:
docker compose up --detach
.PHONY: remove-db
remove-db:
docker compose down
docker volume rm protofun_pgdata
.PHONY: sync-db
sync-db: package
substreams-sink-postgres run $(POSTGRESQL_DSN) $(ENDPOINT) "protofun.spkg" db_out $(START_BLOCK):$(STOP_BLOCK)
# substreams-sink-postgres run $(POSTGRESQL_DSN) $(ENDPOINT) "protofun.spkg" db_out
.PHONY: stream-graph
stream-graph: build
substreams run -e $(ENDPOINT) substreams.yaml graph_out --start-block $(START_BLOCK) --stop-block $(STOP_BLOCK)
.PHONY: gui-graph
gui-graph: build
substreams gui -e $(ENDPOINT) substreams.yaml graph_out --start-block $(START_BLOCK) --stop-block $(STOP_BLOCK)
.PHONE: start-graph-node
start-graph-node:
SUBSTREAMS_ENDPOINT=https://$(ENDPOINT) ./graph-node/up.sh
.PHONY: remove-graph-node
remove-graph-node:
./graph-node/down.sh
.PHONE: deploy-graph
deploy-graph: package
graph build --ipfs $(IPFS_ENDPOINT) subgraph.yaml
graph create protofun_block_meta --node $(GRAPH_NODE_ENDPOINT)
graph deploy --node $(GRAPH_NODE_ENDPOINT) --ipfs $(IPFS_ENDPOINT) --version-label v0.2.2 protofun_block_meta subgraph.yaml
.PHONE: undeploy-graph
undeploy-graph:
docker exec graph-node graphman drop --force protofun_block_meta