vesting tests + use larger amounts for tokens
previously the total token amounts were too small to detect balance changes after a small 5-20 second delaymaster
parent
0e39e78a0f
commit
06d3b5862c
|
@ -9,23 +9,23 @@ source $HERE/testutil.sh
|
||||||
colineard tx colinearcore unlock-all-funds -y --from alice \
|
colineard tx colinearcore unlock-all-funds -y --from alice \
|
||||||
| swallow "Unlock all funds before proceeding"
|
| swallow "Unlock all funds before proceeding"
|
||||||
|
|
||||||
colineard tx colinearcore new-auction asdf asdf 200 uusdc $(now + 3500) \
|
colineard tx colinearcore new-auction asdf asdf 2000 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 uusdc $(now + 8200000) \
|
colineard tx colinearcore new-auction asdf asdf 2000 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 uusdc)
|
before=$(get_balance $BOB uusdc)
|
||||||
|
|
||||||
colineard tx colinearcore new-auction asdf asdf 200 uusdc $(now + 3700) \
|
colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 3700) \
|
||||||
-y --from bob \
|
-y --from bob \
|
||||||
| expect_success "New auction is created"
|
| expect_success "New auction is created"
|
||||||
|
|
||||||
get_balance $BOB uusdc | expect_change -200 $before "Change in Bob's balance"
|
get_balance $BOB uusdc | expect_change -2000 $before "Change in Bob's balance"
|
||||||
|
|
||||||
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
|
colineard tx colinearcore new-bid $(get_last_auction_index) 1900 \
|
||||||
-y --from alice \
|
-y --from alice \
|
||||||
| expect_fail "Can't bid without locking CLR"
|
| expect_fail "Can't bid without locking CLR"
|
||||||
|
|
||||||
|
@ -35,29 +35,29 @@ colineard tx colinearcore lock-funds 550000000 -y --from alice \
|
||||||
colineard tx colinearcore lock-funds 500000000 -y --from alice \
|
colineard tx colinearcore lock-funds 500000000 -y --from alice \
|
||||||
| expect_success "Lock funds before bidding"
|
| expect_success "Lock funds before bidding"
|
||||||
|
|
||||||
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
|
colineard tx colinearcore new-bid $(get_last_auction_index) 2000 \
|
||||||
-y --from alice \
|
-y --from alice \
|
||||||
| expect_success "New bid is correctly created"
|
| expect_success "New bid is correctly created"
|
||||||
|
|
||||||
colineard tx colinearcore new-bid $(get_last_auction_index) 90 \
|
colineard tx colinearcore new-bid $(get_last_auction_index) 1900 \
|
||||||
-y --from alice \
|
-y --from alice \
|
||||||
| expect_success "Can bid below price ceiling"
|
| expect_success "Can bid below price ceiling"
|
||||||
|
|
||||||
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
|
colineard tx colinearcore new-bid $(get_last_auction_index) 1900 \
|
||||||
-y --from alice \
|
-y --from alice \
|
||||||
| expect_fail "Can't create duplicate bids"
|
| expect_fail "Can't create duplicate bids"
|
||||||
|
|
||||||
colineard tx colinearcore new-bid $(get_next_auction_index) 100 \
|
colineard tx colinearcore new-bid $(get_next_auction_index) 1800 \
|
||||||
-y --from alice \
|
-y --from alice \
|
||||||
| expect_fail "Can't create bids for nonexistent auctions"
|
| expect_fail "Can't create bids for nonexistent auctions"
|
||||||
|
|
||||||
colineard tx colinearcore new-bid $(get_last_auction_index) 600 \
|
colineard tx colinearcore new-bid $(get_last_auction_index) 6000 \
|
||||||
-y --from alice \
|
-y --from alice \
|
||||||
| expect_fail "Can't bid over price ceiling"
|
| expect_fail "Can't bid over price ceiling"
|
||||||
|
|
||||||
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 uusdcs"
|
| expect_fail "Can't bid 0 tokens"
|
||||||
|
|
||||||
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" \
|
||||||
|
@ -66,21 +66,36 @@ colineard q colinearcore auction-bids $(get_last_auction_index) \
|
||||||
before=$(get_balance $BOB uusdc)
|
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; block times are not *exactly* 1s in testing, maybe?
|
||||||
wait=12
|
wait=12
|
||||||
log_info "Waiting $wait s until auction expires..."
|
log_info "Waiting $wait s until auction expires..."
|
||||||
sleep $wait
|
sleep $wait
|
||||||
|
|
||||||
colineard tx colinearcore new-bid $(get_last_auction_index) 50 \
|
colineard tx colinearcore new-bid $(get_last_auction_index) 1500 \
|
||||||
-y --from alice \
|
-y --from alice \
|
||||||
| expect_fail "Can't add bids after auction expiry"
|
| expect_fail "Can't add bids after auction expiry"
|
||||||
|
|
||||||
colineard q colinearcore show-auction $(get_last_auction_index) \
|
colineard q colinearcore show-auction $(get_last_auction_index) \
|
||||||
| jq -rM ".auction.best.amount" \
|
| jq -rM ".auction.best.amount" \
|
||||||
| assert_eq 90 "Finalized top bid amount"
|
| assert_eq 1900 "Finalized top bid amount"
|
||||||
|
|
||||||
colineard q colinearcore show-auction $(get_last_auction_index) \
|
colineard q colinearcore show-auction $(get_last_auction_index) \
|
||||||
| jq -rM ".auction.remaining" \
|
| jq -rM ".auction.remaining" \
|
||||||
| assert_eq 90 "Remaining vested amount"
|
| assert_eq 1900 "Remaining vested amount"
|
||||||
|
|
||||||
get_balance $BOB uusdc | expect_change 110 $before "Change in Bob's balance"
|
get_balance $BOB uusdc | expect_change 100 $before "Change in Bob's balance (from paid remainder)"
|
||||||
|
|
||||||
|
# --- Test vesting payout after some wait time ---
|
||||||
|
|
||||||
|
before=$(get_balance $ALICE uusdc)
|
||||||
|
|
||||||
|
wait=5
|
||||||
|
log_info "Waiting $wait s for vested funds to accumulate..."
|
||||||
|
sleep $wait
|
||||||
|
|
||||||
|
colineard tx colinearcore claim-funds $(get_last_auction_index) \
|
||||||
|
-y --from alice \
|
||||||
|
| expect_success "Top bidder can claim vested funds"
|
||||||
|
|
||||||
|
get_balance $ALICE uusdc \
|
||||||
|
| expect_increase $before "Alice's balance"
|
||||||
|
|
|
@ -56,7 +56,7 @@ function expect_increase {
|
||||||
echo $desc correctly increased
|
echo $desc correctly increased
|
||||||
else
|
else
|
||||||
log_fail
|
log_fail
|
||||||
echo $desc did not increase ($out should be greater than $comp)
|
echo $desc did not increase, $out should be greater than $comp
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ function expect_decrease {
|
||||||
echo $desc correctly decreased
|
echo $desc correctly decreased
|
||||||
else
|
else
|
||||||
log_fail
|
log_fail
|
||||||
echo $desc did not decrease ($out should be less than than $comp)
|
echo $desc did not decrease, $out should be less than than $comp
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue