2017-08-19 14:11:46 +03:00
|
|
|
#!/bin/bash -eu
|
|
|
|
|
2018-05-01 20:26:45 -04: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 14:11:46 +03:00
|
|
|
|
2017-11-10 12:22:58 +02:00
|
|
|
rm -f resources/contracts/*.{abi,bin}
|
|
|
|
|
2017-08-19 14:11:46 +03:00
|
|
|
# compile contracts
|
2018-05-01 20:26:45 -04:00
|
|
|
for f in {TokenReg,MultiSigTokenWallet*}.sol; do
|
2017-08-20 11:45:43 +03:00
|
|
|
$SOLC $f --overwrite --bin --abi --optimize -o resources/contracts
|
2017-08-19 14:11:46 +03:00
|
|
|
done
|
|
|
|
|
|
|
|
# generate java classes
|
|
|
|
for f in resources/contracts/*.bin; do
|
|
|
|
abi=$(echo $f|sed s/\.bin/.abi/)
|
2017-08-21 23:41:54 +03:00
|
|
|
$WEB3J solidity generate $f $abi -o src/java -p commiteth.eth.contracts
|
2017-08-19 14:11:46 +03:00
|
|
|
done
|