forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
94 lines (77 loc) · 2.09 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
SHELL := /usr/bin/env bash
pkg := bindings
pkg-preview := bindingspreview
monorepo-base := $(shell dirname $(realpath .))
contracts-dir := $(monorepo-base)/packages/contracts-bedrock
contracts-list := ./artifacts.json
contracts-list-preview := ./artifacts-preview.json
log-level := info
ETHERSCAN_APIKEY_ETH ?=
ETHERSCAN_APIKEY_OP ?=
RPC_URL_ETH ?=
RPC_URL_OP ?=
all: version mkdir bindings
version:
forge --version
abigen --version
compile:
cd $(contracts-dir) && \
forge clean && \
pnpm build
bindings: bindgen-local bindgen-preview
bindings-build: bindgen-generate-local bindgen-generate-preview
bindgen: compile bindgen-generate-all
bindgen-generate-all:
go run ./cmd/ \
generate \
--metadata-out ./$(pkg) \
--bindings-package $(pkg) \
--contracts-list $(contracts-list) \
--log.level $(log-level) \
all \
--forge-artifacts $(contracts-dir)/forge-artifacts \
--etherscan.apikey.eth $(ETHERSCAN_APIKEY_ETH) \
--etherscan.apikey.op $(ETHERSCAN_APIKEY_OP) \
--rpc.url.eth $(RPC_URL_ETH) \
--rpc.url.op $(RPC_URL_OP)
bindgen-local: compile bindgen-generate-local
bindgen-generate-local:
go run ./cmd/ \
generate \
--metadata-out ./$(pkg) \
--bindings-package $(pkg) \
--contracts-list $(contracts-list) \
--log.level $(log-level) \
local \
--forge-artifacts $(contracts-dir)/forge-artifacts
bindgen-preview: compile bindgen-generate-preview
bindgen-generate-preview:
go run ./cmd \
generate \
--metadata-out ./$(pkg-preview) \
--bindings-package $(pkg-preview) \
--contracts-list $(contracts-list-preview) \
--log.level $(log-level) \
local \
--forge-artifacts $(contracts-dir)/forge-artifacts
bindgen-remote:
go run ./cmd/ \
generate \
--metadata-out ./$(pkg) \
--bindings-package $(pkg) \
--contracts-list $(contracts-list) \
--log.level $(log-level) \
remote \
--etherscan.apikey.eth $(ETHERSCAN_APIKEY_ETH) \
--etherscan.apikey.op $(ETHERSCAN_APIKEY_OP) \
--rpc.url.eth $(RPC_URL_ETH) \
--rpc.url.op $(RPC_URL_OP)
mkdir:
mkdir -p $(pkg)
clean-contracts:
cd $(contracts-dir) && \
pnpm clean
clean:
rm -rf $(pkg)
test:
go test ./...