forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
abigen.sh
executable file
·22 lines (17 loc) · 698 Bytes
/
abigen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#/bin/sh
if [ ! -d "../protocol/artifacts" ]; then
echo "ABI not generated in protocol package yet. Please run npm install && npx hardhat compile in ../protocol"
exit 1
fi
paths=("bridge/TokenVault.sol" "bridge/Bridge.sol" "common/ICrossChainSync.sol" "L2/TaikoL2.sol" "L1/TaikoL1.sol")
names=("TokenVault" "Bridge" "ICrossChainSync" "TaikoL2" "TaikoL1")
for (( i = 0; i < ${#paths[@]}; ++i ));
do
jq .abi ../protocol/artifacts/contracts/${paths[i]}/${names[i]}.json > ${names[i]}.json
lower=$(echo "${names[i]}" | tr '[:upper:]' '[:lower:]')
abigen --abi ${names[i]}.json \
--pkg $lower \
--type ${names[i]} \
--out contracts/$lower/${names[i]}.go
done
exit 0