-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (68 loc) · 1.75 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
.PHONY: all
all: compile bindings
.PHONY: compile
compile:
# compile vendor management contract
solc \
--optimize \
--optimize-runs 200 \
--bin \
--abi \
--overwrite \
-o bin/vendorManagement \
contracts/VendorManagement.sol
# compile vendor factory
solc \
--optimize \
--optimize-runs 200 \
--bin \
--abi \
--overwrite \
-o bin/vendorFactory \
contracts/VendorFactory.sol
# compile vending machine
solc \
--optimize \
--optimize-runs 200 \
--bin \
--abi \
--overwrite \
-o bin/vendingMachine \
contracts/VendingMachine.sol
.PHONY: bindings
bindings:
# build bindings for vendor management
abigen \
--abi bin/vendorManagement/VendorManagement.abi \
--bin bin/vendorManagement/VendorManagement.bin \
--pkg vendormanagement \
--out bindings/vendorManagement/bindings.go
# build bindings for vendor factory
abigen \
--abi bin/vendorFactory/VendorFactory.abi \
--bin bin/vendorFactory/VendorFactory.bin \
--pkg vendorfactory \
--out bindings/vendorFactory/bindings.go
# build bindings for vending machine
abigen \
--abi bin/vendingMachine/VendingMachine.abi \
--bin bin/vendingMachine/VendingMachine.bin \
--pkg vendingmachine \
--out bindings/vendingMachine/bindings.go
# run standard go tooling for better readability
.PHONY: tidy
tidy: imports fmt
go vet ./...
golint ./...
# automatically add missing imports
.PHONY: imports
imports:
find . -type f -name '*.go' -exec goimports -w {} \;
# format code and simplify if possible
.PHONY: fmt
fmt:
find . -type f -name '*.go' -exec gofmt -s -w {} \;
.PHONY: interfaces
interfaces:
# uncomment to regenerate, this will wipe some nice settings
# /home/solidity/.npm-global/bin/abi2solidity --input bin/vendorManagement/VendorManagement.abi --output contracts/Interfaces/VendorManagementI.sol