-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-go-payments.sh
executable file
·54 lines (41 loc) · 1.9 KB
/
build-go-payments.sh
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
#!/bin/bash
set -Eeuo pipefail
if [ -z "${1-}" ]; then
echo "Usage: $0 SOLC_0_8_13_DIR"
exit 1
fi
solc_0_8_13_dir=$(realpath "$1")
# check solc
"$solc_0_8_13_dir/solc" --version | grep "Version: 0.8.13+"
# build abigen
(
echo "#### building abigen command"
cd cmds
go build -o ../abigen ./abigen
cd ..
)
(
base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "BASE_DIR $base_dir"
# recent contracts require solc 0.8.13
(
hash -d solc 2>/dev/null || : # clear cache for solc location
# shellcheck disable=SC2030
PATH="$solc_0_8_13_dir:$PATH"
export PATH
payments_out_dir="${base_dir}/dist/payments"
payments_sol_file="${base_dir}/src/payments/ERC20Payments.sol"
payments_abigen_dir="${base_dir}/contracts-go/payments"
elv_token_out_dir="${base_dir}/dist/token"
elv_token_sol_file="${base_dir}/src/tradable/ElvToken.sol"
elv_token_abigen_dir="${base_dir}/contracts-go/token"
solc @openzeppelin/=lib/openzeppelin-contracts/ ${payments_sol_file} --abi --hashes --optimize -o ${payments_out_dir} --overwrite
solc @openzeppelin/=lib/openzeppelin-contracts/ ${payments_sol_file} --bin --optimize -o ${payments_out_dir} --overwrite
solc @openzeppelin/=lib/openzeppelin-contracts/ ${elv_token_sol_file} --abi --hashes --optimize -o ${elv_token_out_dir} --overwrite
solc @openzeppelin/=lib/openzeppelin-contracts/ ${elv_token_sol_file} --bin --optimize -o ${elv_token_out_dir} --overwrite
echo "#### generating latest src/payments/ERC20Payments.sol"
./abigen --abi "${payments_out_dir}/ERC20Payments.abi" --bin "${payments_out_dir}/ERC20Payments.bin" --pkg payments --out "${payments_abigen_dir}/erc20_payments.go"
echo "#### generating latest src/tradable/Elvtoken.sol"
./abigen --abi "${elv_token_out_dir}/ElvToken.abi" --bin "${elv_token_out_dir}/ElvToken.bin" --pkg token --out "${elv_token_abigen_dir}/elv_token.go"
)
)