2017-08-19 11:11:46 +00:00
|
|
|
#!/bin/bash -eu
|
|
|
|
|
2018-05-02 00:26:45 +00:00
|
|
|
function print_dependency_message
|
|
|
|
{
|
|
|
|
echo "error: " $1 "must already be installed!"
|
|
|
|
}
|
|
|
|
|
|
|
|
SOLC=$(which solc) || print_dependency_message "solc"
|
|
|
|
|
|
|
|
WEB3J=$(which web3j) || print_dependency_message "web3"
|
2017-08-19 11:11:46 +00:00
|
|
|
|
2017-11-10 10:22:58 +00:00
|
|
|
rm -f resources/contracts/*.{abi,bin}
|
|
|
|
|
2017-08-19 11:11:46 +00:00
|
|
|
# compile contracts
|
2018-05-02 00:26:45 +00:00
|
|
|
for f in {TokenReg,MultiSigTokenWallet*}.sol; do
|
2017-08-20 08:45:43 +00:00
|
|
|
$SOLC $f --overwrite --bin --abi --optimize -o resources/contracts
|
2017-08-19 11:11:46 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# generate java classes
|
|
|
|
for f in resources/contracts/*.bin; do
|
|
|
|
abi=$(echo $f|sed s/\.bin/.abi/)
|
2017-08-21 20:41:54 +00:00
|
|
|
$WEB3J solidity generate $f $abi -o src/java -p commiteth.eth.contracts
|
2017-08-19 11:11:46 +00:00
|
|
|
done
|