mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-04 20:24:25 -08:00
cosmostest -> colinear in dir structure
This commit is contained in:
@@ -4,47 +4,47 @@
|
||||
HERE=$(cd $(dirname $BASH_SOURCE) && pwd)
|
||||
source $HERE/testutil.sh
|
||||
|
||||
cosmos-testd tx cosmostest new-auction asdf asdf 200 token $(now + 3500) \
|
||||
colineard tx colinear new-auction asdf asdf 200 token $(now + 3500) \
|
||||
-y --from bob \
|
||||
| expect_fail "Can't create auction below min lease period"
|
||||
|
||||
cosmos-testd tx cosmostest new-auction asdf asdf 200 token $(now + 8200000) \
|
||||
colineard tx colinear new-auction asdf asdf 200 token $(now + 8200000) \
|
||||
-y --from bob \
|
||||
| expect_fail "Can't create auction above max lease period"
|
||||
|
||||
before=$(get_balance $BOB token)
|
||||
|
||||
cosmos-testd tx cosmostest new-auction asdf asdf 200 token $(now + 3700) \
|
||||
colineard tx colinear new-auction asdf asdf 200 token $(now + 3700) \
|
||||
-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 \
|
||||
colineard tx colinear 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 \
|
||||
colineard tx colinear 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 \
|
||||
colineard tx colinear 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 \
|
||||
colineard tx colinear 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 \
|
||||
colineard tx colinear 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 \
|
||||
colineard tx colinear 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) \
|
||||
colineard q colinear auction-bids $(get_last_auction_index) \
|
||||
| jq -M ".bids | length" \
|
||||
| assert_eq 2 "Number of auction bids"
|
||||
|
||||
@@ -55,11 +55,11 @@ before=$(get_balance $BOB token)
|
||||
log_info "Waiting 12s until auction expires..."
|
||||
sleep 12
|
||||
|
||||
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 50 \
|
||||
colineard tx colinear 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) \
|
||||
colineard q colinear show-auction $(get_last_auction_index) \
|
||||
| jq -rM ".auction.best.amount" \
|
||||
| assert_eq 90 "Remaining vested amount from finalized top bid"
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
# Configuration options that all tests must include
|
||||
set -e
|
||||
cosmos-testd config chain-id cosmostest
|
||||
cosmos-testd config output json
|
||||
cosmos-testd config broadcast-mode block
|
||||
colineard config chain-id colinear
|
||||
colineard config output json
|
||||
colineard config broadcast-mode block
|
||||
|
||||
# Test config addresses (Alice & Bob)
|
||||
accounts=$(curl -s http://localhost:1317/cosmos/auth/v1beta1/accounts | jq -M ".accounts")
|
||||
@@ -44,7 +44,7 @@ function expect_change {
|
||||
function get_balance {
|
||||
local addr=$1
|
||||
local denom=$2
|
||||
cosmos-testd q bank balances $addr \
|
||||
colineard q bank balances $addr \
|
||||
| jq -rM ".balances[] | select(.denom == \"$denom\") | .amount"
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ function get_key {
|
||||
}
|
||||
|
||||
function get_last_auction_index {
|
||||
res=$(cosmos-testd q cosmostest show-next-auction | jq -M ".NextAuction.auctionId | tonumber")
|
||||
res=$(colineard q colinear show-next-auction | jq -M ".NextAuction.auctionId | tonumber")
|
||||
echo "$res-1" | bc
|
||||
}
|
||||
|
||||
function get_next_auction_index {
|
||||
cosmos-testd q cosmostest show-next-auction | jq -M ".NextAuction.auctionId | tonumber"
|
||||
colineard q colinear show-next-auction | jq -M ".NextAuction.auctionId | tonumber"
|
||||
}
|
||||
|
||||
function now {
|
||||
|
||||
Reference in New Issue
Block a user