tests for provider locking requirement

master
michael 2022-09-07 23:49:58 +00:00
parent 5158b96c96
commit faf5c3d89b
1 changed files with 18 additions and 8 deletions

View File

@ -4,21 +4,31 @@
HERE=$(cd $(dirname $BASH_SOURCE) && pwd) HERE=$(cd $(dirname $BASH_SOURCE) && pwd)
source $HERE/testutil.sh source $HERE/testutil.sh
colineard tx colinear new-auction asdf asdf 200 token $(now + 3500) \ 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 new-auction asdf asdf 200 uusdc $(now + 3500) \
-y --from bob \ -y --from bob \
| expect_fail "Can't create auction below min lease period" | expect_fail "Can't create auction below min lease period"
colineard tx colinearcore new-auction asdf asdf 200 usdc $(now + 8200000) \ colineard tx colinearcore new-auction asdf asdf 200 uusdc $(now + 8200000) \
-y --from bob \ -y --from bob \
| expect_fail "Can't create auction above max lease period" | expect_fail "Can't create auction above max lease period"
before=$(get_balance $BOB usdc) before=$(get_balance $BOB uusdc)
colineard tx colinearcore new-auction asdf asdf 200 usdc $(now + 3700) \ colineard tx colinearcore new-auction asdf asdf 200 uusdc $(now + 3700) \
-y --from bob \ -y --from bob \
| expect_success "New auction is created" | expect_success "New auction is created"
get_balance $BOB usdc | expect_change -200 $before "Change in Bob's balance" get_balance $BOB uusdc | expect_change -200 $before "Change in Bob's balance"
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
-y --from alice \
| expect_fail "Can't bid without locking CLR"
colineard tx colinearcore lock-funds 550000000 -y --from alice \
| expect_success "Can lock above the maximum (550 CLR)"
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \ colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
-y --from alice \ -y --from alice \
@ -42,13 +52,13 @@ colineard tx colinearcore new-bid $(get_last_auction_index) 600 \
colineard tx colinearcore new-bid $(get_last_auction_index) 0 \ colineard tx colinearcore new-bid $(get_last_auction_index) 0 \
-y --from alice \ -y --from alice \
| expect_fail "Can't bid 0 usdcs" | expect_fail "Can't bid 0 uusdcs"
colineard q colinearcore auction-bids $(get_last_auction_index) \ colineard q colinearcore auction-bids $(get_last_auction_index) \
| jq -M ".bids | length" \ | jq -M ".bids | length" \
| assert_eq 2 "Number of auction bids" | assert_eq 2 "Number of auction bids"
before=$(get_balance $BOB usdc) before=$(get_balance $BOB uusdc)
# Was experiencing issues with bob's balance not updating, probably # Was experiencing issues with bob's balance not updating, probably
# because we weren't waiting long enough # because we weren't waiting long enough
@ -63,4 +73,4 @@ colineard q colinearcore show-auction $(get_last_auction_index) \
| jq -rM ".auction.best.amount" \ | jq -rM ".auction.best.amount" \
| assert_eq 90 "Remaining vested amount from finalized top bid" | assert_eq 90 "Remaining vested amount from finalized top bid"
get_balance $BOB usdc | expect_change 110 $before "Change in Bob's balance" get_balance $BOB uusdc | expect_change 110 $before "Change in Bob's balance"