-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgen.sh
executable file
·48 lines (41 loc) · 1.03 KB
/
gen.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
#!/usr/bin/env bash
set -e
# Default values
FHE_OPS_DEST="../precompiles"
OUTPUT="chains/arbitrum"
GEN_FHEOPS="false"
NITRO_OVERRIDE="false"
# Parse flags
while getopts "d:o:g:n:" opt; do
case $opt in
d) FHE_OPS_DEST=$OPTARG ;;
o) OUTPUT=$OPTARG ;;
g) GEN_FHEOPS=$OPTARG ;;
n) NITRO_OVERRIDE=$OPTARG ;;
\?) echo "Invalid option -$OPTARG" >&2
exit 1
;;
esac
done
# Set FHE_OPS_DEST to "nitro-overrides/precompiles" if the nitro override flag is true
# Rest of the script remains the same
go run gen.go 1
if [ ! -e precompiles/contracts ]; then
mkdir precompiles/contracts
fi
cp FheOs_gen.sol precompiles/contracts/FheOs.sol
mv FheOs_gen.sol solidity/FheOS.sol
cd precompiles
rm -rf artifacts
pnpm build
rm -r ./contracts/
cd ../
go run gen.go 2 $OUTPUT
if [ "$NITRO_OVERRIDE" = "true" ]; then
cp FheOps_gen.go "nitro-overrides/precompiles/FheOps.go"
fi
if [ "${GEN_FHEOPS}" = "true" ]; then
echo "Generating FheOps.go... in $FHE_OPS_DEST"
cp FheOps_gen.go "$FHE_OPS_DEST"/FheOps.go
fi
rm *_gen*