gpu-compute-chain/tests/test_locking_funds.sh

42 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Tests the behavior of provider CLR locking
# import utilities
HERE=$(cd $(dirname $BASH_SOURCE) && pwd)
source $HERE/testutil.sh
# We swallow this because with a fresh chain state there is nothing
# locked to begin with
colineard tx colinearcore unlock-all-funds -y --from alice \
| swallow "Unlock all funds before proceeding"
colineard tx colinearcore lock-funds 400000000 -y --from alice \
| expect_fail "Can't lock any amount below the minimum required (400 CLR)"
colineard tx colinearcore lock-funds 500000000 -y --from alice \
| expect_success "Can lock at the min amount of CLR required"
colineard tx colinearcore lock-funds 100000000 -y --from alice \
| expect_success "Can lock over the min amount of CLR required"
before=$(colineard q colinearcore locked-funds $ALICE \
| jq -rM ".amount")
colineard tx colinearcore unlock-funds 150000000 -y --from alice \
| expect_success "Unlock 150 CLR"
colineard q colinearcore locked-funds $ALICE \
| jq -rM ".amount" \
| expect_change -150000000 $before "New locked balance (reflecting unlock)"
before=$(colineard q colinearcore locked-funds $ALICE \
| jq -rM ".amount")
colineard tx colinearcore unlock-all-funds -y --from alice \
| expect_success "Unlock all remaining funds"
colineard q colinearcore locked-funds $ALICE \
| jq -rM ".amount" \
| expect_change -450000000 $before "New locked balance (reflecting unlock)"