-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
66 lines (47 loc) · 1.89 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
installSolc = ""
installProtoc = ""
installGeth = ""
ifeq ($(shell go env GOOS),darwin)
installSolc = brew update && brew tap ethereum/ethereum && brew install solidity
installProtoc = brew install protobuf
installGeth = brew install ethereum
endif
ifeq ($(shell go env GOOS),linux)
installSolc = sudo add-apt-repository -y ppa:ethereum/ethereum && sudo apt update && sudo apt install -y solc
installProtoc = sudo apt install -y protobuf-compiler
installGeth = sudo apt-get install ethereum
endif
all: InstallSolc InstallProtoc GraphQLDeps GraphQLCodegen InstallDeps BuildABIGEN GetContract Compile BuildABI BuildBinary
contract: GetContract Compile BuildABI
build: BuildBinary
docker: BuildBinary DockerBuild
graphql: GraphQLDeps GraphQLCodegen
InstallDeps:
go get && pnpm install
InstallProtoc:
$(installProtoc)
InstallSolc:
$(installSolc)
BuildABIGEN:
$(installGeth)
GetContract:
curl -L "https://raw.githubusercontent.com/ClickPop/aww-rats-client/main/smart-contracts/src/contracts/Rat.sol" -o Rat.sol \
&& curl -L "https://raw.githubusercontent.com/ClickPop/aww-rats-client/main/smart-contracts/src/contracts/Closet.sol" -o Closet.sol
Compile:
solc @openzeppelin/=$(shell pwd)/node_modules/@openzeppelin/ --optimize --abi --bin ./Rat.sol -o build --overwrite \
&& solc @openzeppelin/=$(shell pwd)/node_modules/@openzeppelin/ --optimize --abi --bin ./Closet.sol -o build --overwrite
BuildABI:
abigen --abi=./build/Rat.abi --bin=./build/Rat.bin --pkg=rat --out=./rat/rat.go \
&& abigen --abi=./build/Closet.abi --bin=./build/Closet.bin --pkg=closet --out=./closet/closet.go
BuildBinary:
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build -o exec/caching-service -a
DockerBuild:
docker build -t aww-rats-caching-service . --platform linux/amd64
GraphQLDeps:
go get -u -d github.com/Yamashou/[email protected] \
&& go install github.com/Yamashou/[email protected]
GraphQLCodegen:
gqlgenc