-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerator-universal-verifier
executable file
·55 lines (42 loc) · 1.45 KB
/
generator-universal-verifier
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
#!/bin/bash
# Colors
green='\033[0;32m'
red='\033[0;31m'
nocolor='\033[0m'
set -e
SOURCE_ABI_PATH=$PWD/contracts/artifacts/contracts/verifiers/UniversalVerifier.sol
# Check if `contracts` repository exists
if [ ! -d "contracts" ]; then
echo -e "${red}Contracts directory does not exist.${nocolor}"
exit 1
fi
# Check if jq exists
which jq 1>/dev/null || exit 1
pushd $PWD/contracts > /dev/null
# Print warning if current branch is not up to date with the remote branch. Only for master branch.
current_branch=$(git branch --show-current)
if [ "$current_branch" == "master" ]; then
git fetch
if git status -uno | grep "Your branch is up to date" > /dev/null ; then
echo -e \
"${green}Your branch '$current_branch' is up to date with the remote branch.${nocolor}"
else
echo -e \
"${red}Your branch '$current_branch' is not up to date with the remote branch.\n\
Please sync your branch with the remote branch.${nocolor}"
fi
fi
npm i
npm run compile
popd > /dev/null
touch $PWD/abi.json $PWD/bytecode $PWD/universal-verifier/v1/go/abi/abi.go
cat $SOURCE_ABI_PATH/UniversalVerifier.json | jq .abi > $PWD/abi.json
cat $SOURCE_ABI_PATH/UniversalVerifier.json | jq .bytecode > $PWD/bytecode
docker run \
-v $PWD/abi.json:/abi.json:ro \
-v $PWD/bytecode:/bytecode:ro \
-v $PWD/universal-verifier/v1/go/abi/abi.go:/abi.go \
--rm --name ethereum-node \
ethereum/client-go:alltools-v1.14.12 \
abigen --abi=/abi.json --pkg=abi \
--out=abi.go --type="UniversalVerifier"