This repository has been archived by the owner on Jun 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a59fb9c
commit 44e4e8e
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/sh | ||
|
||
truffle build | ||
|
||
# dev_utils.go generation | ||
cat build/contracts/DevUtils.json | jq .abi > DevUtils.abi | ||
abigen --abi DevUtils.abi --pkg XXX > dev_utils.go | ||
rm -f DevUtils.abi | ||
|
||
perl -i.tmp -pe 's/package XXX/package wrappers/' dev_utils.go | ||
perl -i.tmp -pe 's/XXXDevUtils/DevUtils/g' dev_utils.go | ||
perl -i.tmp -pe 's/_XXX/f/g' dev_utils.go | ||
perl -i.tmp -pe 's/XXX/DevUtils/g' dev_utils.go | ||
perl -i.tmp -pe 'BEGIN {undef $/;} s/\/\/ LibOrderOrder[^\}]*\}//smg' dev_utils.go | ||
perl -i.tmp -pe 's/LibOrderOrderInfo/OrderInfo/g' dev_utils.go | ||
perl -i.tmp -pe 's/LibZeroExTransactionZeroExTransaction/ZeroExTransaction/g' dev_utils.go | ||
perl -i.tmp -pe 's/LibOrderOrder/Order/g' dev_utils.go | ||
rm -f dev_utils.go.tmp | ||
gofmt -w dev_utils.go | ||
|
||
# exchange.go generation | ||
cat build/contracts/Exchange.json | jq .abi > Exchange.abi | ||
abigen --abi Exchange.abi --pkg XXX > exchange.go | ||
rm -f Exchange.abi | ||
|
||
perl -i.tmp -pe 's/package XXX/package wrappers/' exchange.go | ||
perl -i.tmp -pe 's/XXXExchange/Exchange/g' exchange.go | ||
perl -i.tmp -pe 's/_XXX/f/g' exchange.go | ||
perl -i.tmp -pe 's/XXX/Exchange/g' exchange.go | ||
perl -i.tmp -pe 'BEGIN {undef $/;} s/\/\/ LibOrderOrder[^\}]*\}//smg' exchange.go | ||
perl -i.tmp -pe 's/LibOrderOrderInfo/OrderInfo/g' exchange.go | ||
perl -i.tmp -pe 's/LibZeroExTransactionZeroExTransaction/ZeroExTransaction/g' exchange.go | ||
perl -i.tmp -pe 's/LibOrderOrder/Order/g' exchange.go | ||
rm -f exchange.go.tmp | ||
gofmt -w exchange.go | ||
|
||
# erc20.go generation | ||
cat build/contracts/ERC20Token.json | jq .abi > ERC20Token.abi | ||
abigen --abi ERC20Token.abi --pkg XXX > erc20.go | ||
rm -f ERC20Token.abi | ||
|
||
perl -i.tmp -pe 's/package XXX/package wrappers/' erc20.go | ||
perl -i.tmp -pe 's/XXXERC20/ERC20/g' erc20.go | ||
perl -i.tmp -pe 's/_XXX/f/g' erc20.go | ||
perl -i.tmp -pe 's/XXX/ERC20/g' erc20.go | ||
rm -f erc20.go.tmp | ||
gofmt -w erc20.go | ||
|
||
# weth9.go generation | ||
cat build/contracts/WETH9.json | jq .abi > WETH9.abi | ||
abigen --abi WETH9.abi --pkg XXX > weth9.go | ||
rm -f WETH9.abi | ||
|
||
perl -i.tmp -pe 's/package XXX/package wrappers/' weth9.go | ||
perl -i.tmp -pe 's/XXXWETH9/WETH9/g' weth9.go | ||
perl -i.tmp -pe 's/_XXX/f/g' weth9.go | ||
perl -i.tmp -pe 's/XXX/WETH9/g' weth9.go | ||
rm -f weth9.go.tmp | ||
gofmt -w weth9.go | ||
|
||
echo "All done! Move dev_utils.go, exchange.go, erc20.go, weth9.go into zeroex-go/wrappers/ now.\nmv dev_utils.go exchange.go erc20.go weth9.go ../zeroex-go/wrappers" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"dotenv": "^8.2.0" | ||
}, | ||
"scripts": { | ||
"abigen": "sh ./abigen.sh", | ||
"postinstall": "patch-package" | ||
} | ||
} |