fix ceiling remainder payout + implied auction completion status

This commit is contained in:
2022-09-05 21:18:04 +00:00
parent 6c4ad8c55d
commit cf3b28217b
7 changed files with 61 additions and 105 deletions

View File

@@ -4,14 +4,17 @@
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 500 token $(now + 100) \
cosmos-testd tx cosmostest new-auction asdf asdf 200 token $(now + 100) \
-y --from bob \
| expect_success "New auction is created"
# sleep 1
get_balance $BOB token | expect_change -500 $before "Change in Bob's balance"
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 \
@@ -41,9 +44,17 @@ 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"

View File

@@ -122,19 +122,19 @@ function expect_fail {
}
function log_info {
printf "[ INFO ]\t$1\n"
printf "[ INFO ] $1\n"
}
function log_test {
printf "$(fmt_cyan '[ TEST ]')\t\t$1\n"
printf "$(fmt_cyan '[ TEST ]') $1\n"
}
function log_ok {
printf "$(fmt_green '[ OK ]')\t"
printf "$(fmt_green '[ OK ]') "
}
function log_fail {
printf "$(fmt_red '[ FAIL ]')\t"
printf "$(fmt_red '[ FAIL ]') "
}
function fmt_red {