2022-09-02 13:48:12 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# import utilities
|
|
|
|
HERE=$(cd $(dirname $BASH_SOURCE) && pwd)
|
|
|
|
source $HERE/testutil.sh
|
|
|
|
|
2022-09-04 17:10:42 -07:00
|
|
|
before=$(get_balance $BOB token)
|
|
|
|
|
2022-09-03 17:59:37 -07:00
|
|
|
cosmos-testd tx cosmostest new-auction asdf asdf 500 token $(now + 100) \
|
2022-09-03 17:41:27 -07:00
|
|
|
-y --from bob \
|
2022-09-04 17:10:42 -07:00
|
|
|
| expect_success "New auction is created"
|
|
|
|
|
|
|
|
# sleep 1
|
|
|
|
get_balance $BOB token | expect_change -500 $before "Change in Bob's balance"
|
2022-09-03 17:41:27 -07:00
|
|
|
|
|
|
|
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 100 \
|
|
|
|
-y --from alice \
|
|
|
|
| expect_success "New bid is correctly created"
|
|
|
|
|
2022-09-03 17:59:37 -07:00
|
|
|
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 90 \
|
|
|
|
-y --from alice \
|
|
|
|
| expect_success "Can bid below price ceiling"
|
|
|
|
|
2022-09-03 17:41:27 -07:00
|
|
|
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 \
|
2022-09-03 00:41:54 -07:00
|
|
|
-y --from alice \
|
|
|
|
| expect_fail "Can't create bids for nonexistent auctions"
|
2022-09-02 13:48:12 -07:00
|
|
|
|
2022-09-03 17:41:27 -07:00
|
|
|
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 600 \
|
|
|
|
-y --from alice \
|
|
|
|
| expect_fail "Can't bid over price ceiling"
|
2022-09-02 13:48:12 -07:00
|
|
|
|
2022-09-03 17:41:27 -07:00
|
|
|
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 0 \
|
|
|
|
-y --from alice \
|
|
|
|
| expect_fail "Can't bid 0 tokens"
|
|
|
|
|
2022-09-03 17:59:37 -07:00
|
|
|
cosmos-testd q cosmostest auction-bids $(get_last_auction_index) \
|
|
|
|
| jq -M ".bids | length" \
|
|
|
|
| assert_eq 2 "Number of auction bids"
|
|
|
|
|
2022-09-04 17:10:42 -07:00
|
|
|
log_info "Waiting 10s until auction expires..."
|
2022-09-03 17:41:27 -07:00
|
|
|
sleep 10
|
|
|
|
|
2022-09-03 17:59:37 -07:00
|
|
|
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 50 \
|
2022-09-03 17:41:27 -07:00
|
|
|
-y --from alice \
|
|
|
|
| expect_fail "Can't add bids after auction expiry"
|