#!/bin/bash # import utilities HERE=$(cd $(dirname $BASH_SOURCE) && pwd) source $HERE/testutil.sh # echo $BOB # cosmos-testd q cosmostest show-auction $(get_last_auction_index) | jq # exit 0 before=$(get_balance $BOB token) cosmos-testd tx cosmostest new-auction asdf asdf 200 token $(now + 100) \ -y --from bob \ | expect_success "New auction is created" get_balance $BOB token | expect_change -200 $before "Change in Bob's balance" cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 100 \ -y --from alice \ | expect_success "New bid is correctly created" cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 90 \ -y --from alice \ | expect_success "Can bid below price ceiling" cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 100 \ -y --from alice \ | expect_fail "Can't create duplicate bids" cosmos-testd tx cosmostest new-bid $(get_next_auction_index) 100 \ -y --from alice \ | expect_fail "Can't create bids for nonexistent auctions" cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 600 \ -y --from alice \ | expect_fail "Can't bid over price ceiling" cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 0 \ -y --from alice \ | expect_fail "Can't bid 0 tokens" cosmos-testd q cosmostest auction-bids $(get_last_auction_index) \ | jq -M ".bids | length" \ | assert_eq 2 "Number of auction bids" before=$(get_balance $BOB token) log_info "Waiting 10s until auction expires..." sleep 10 cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 50 \ -y --from alice \ | expect_fail "Can't add bids after auction expiry" cosmos-testd q cosmostest show-auction $(get_last_auction_index) \ | jq -rM ".auction.best.amount" \ | assert_eq 90 "Remaining vested amount from finalized top bid" get_balance $BOB token | expect_change 110 $before "Change in Bob's balance"