Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions contracts/scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,28 @@ function get_address {

function remove_contract_code {
local code_hash=$(cat "$CONTRACTS_PATH"/addresses.json | jq --raw-output ".$1")
local tmp_output_file="tmp_remove_contract_code"
set +e
docker rm -f remove_contract_code
timeout -k 1m 1m bash -c "docker run --network host -e RUST_LOG=info \"${CLIAIN_IMAGE}\" --seed \"$AUTHORITY_SEED\" --node \"$NODE\" contract-remove-code --code-hash $code_hash 2>&1 | tee $tmp_output_file"
grep -q "CodeNotFound\|Received ContractCodeRemoved" $tmp_output_file
if [ $? -ne 0 ]; then
echo "** Exiting with error code 1. Process has been killed after 1m and 'CodeNotFound' error has not been found in the output"
exit 1

if [ "None" == "$(docker run --network host -e RUST_LOG=info "$CLIAIN_IMAGE" --seed "$AUTHORITY_SEED" --node "$NODE" contract-owner-info --code-hash "$code_hash")" ]; then
echo "Contract code does not exist on chain."
else
echo "** Ignoring 'CodeNotFound' error or 'Received ContractCodeRemoved' message"
echo "Contract code exists, removing"

local tmp_output_file="tmp_remove_contract_code"
set +e
docker rm -f remove_contract_code
timeout -k 1m 1m bash -c "docker run --network host -e RUST_LOG=info \"${CLIAIN_IMAGE}\" --seed \"$AUTHORITY_SEED\" --node \"$NODE\" contract-remove-code --code-hash $code_hash 2>&1 | tee $tmp_output_file"
grep -q "CodeNotFound\|Received ContractCodeRemoved" $tmp_output_file
if [ $? -ne 0 ]; then
echo "** Exiting with error code 1. Process has been killed after 1m and 'CodeNotFound' error has not been found in the output"
exit 1
else
echo "** Ignoring 'CodeNotFound' error or 'Received ContractCodeRemoved' message"
fi
rm -f $tmp_output_file
set -e


fi
rm -f $tmp_output_file
set -e
}

# --- GLOBAL CONSTANTS
Expand Down
1 change: 1 addition & 0 deletions contracts/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,6 @@ jq -n --arg early_bird_special "$EARLY_BIRD_SPECIAL" \

end=`date +%s.%N`
echo "Time elapsed: $( echo "$end - $start" | bc -l )"
cat addresses.json

exit $?