2017-08-28 20:34:36 +04:00
|
|
|
#! /usr/bin/env bash
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2017-08-28 20:34:36 +04:00
|
|
|
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
|
2017-12-06 22:51:57 +04:00
|
|
|
source $test_dir/lib/test_lib.inc.sh "$@"
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-08-28 20:34:36 +04:00
|
|
|
start_node 1
|
2017-08-09 18:09:41 +04:00
|
|
|
activate_alpha
|
|
|
|
|
2017-11-19 18:07:59 +04:00
|
|
|
sleep 2
|
|
|
|
$client bake for bootstrap1 -max-priority 512
|
|
|
|
|
2017-08-28 20:34:36 +04:00
|
|
|
key1=foo
|
|
|
|
key2=bar
|
2017-08-09 18:09:41 +04:00
|
|
|
|
2017-08-28 20:34:36 +04:00
|
|
|
$client gen keys $key1
|
|
|
|
$client gen keys $key2
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-08-28 20:34:36 +04:00
|
|
|
$client list known identities
|
2017-11-29 21:06:17 +04:00
|
|
|
$client get balance for bootstrap1
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-29 21:06:17 +04:00
|
|
|
$client transfer 1,000 from bootstrap1 to $key1
|
|
|
|
$client transfer 2,000 from bootstrap1 to $key2
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-29 21:06:17 +04:00
|
|
|
$client get balance for $key1 | assert "1,000 ꜩ"
|
|
|
|
$client get balance for $key2 | assert "2,000 ꜩ"
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-29 21:06:17 +04:00
|
|
|
$client transfer 1,000 from $key2 to $key1
|
2017-08-28 20:34:36 +04:00
|
|
|
|
2017-11-29 21:06:17 +04:00
|
|
|
$client get balance for $key1 | assert "2,000 ꜩ"
|
2017-08-28 20:34:36 +04:00
|
|
|
$client get balance for $key2 | assert "999.95 ꜩ"
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
# Should fail
|
2017-08-28 20:34:36 +04:00
|
|
|
# $client transfer 999.95 from $key2 to $key1
|
|
|
|
|
|
|
|
# wait for the delay between two block
|
|
|
|
sleep 1
|
|
|
|
|
2017-11-20 06:37:06 +04:00
|
|
|
$client bake for bootstrap1 -max-priority 512
|
2017-08-28 20:34:36 +04:00
|
|
|
|
|
|
|
$client remember program noop file:contracts/noop.tz
|
|
|
|
$client typecheck program noop
|
|
|
|
$client originate contract noop \
|
2017-11-29 21:06:17 +04:00
|
|
|
for $key1 transferring 1,000 from bootstrap1 \
|
2017-08-28 20:34:36 +04:00
|
|
|
running noop
|
|
|
|
$client transfer 10 from bootstrap1 to noop -arg "Unit"
|
|
|
|
|
|
|
|
$client originate contract hardlimit \
|
2017-11-29 21:06:17 +04:00
|
|
|
for $key1 transferring 1,000 from bootstrap1 \
|
2017-08-28 20:34:36 +04:00
|
|
|
running file:contracts/hardlimit.tz -init "3"
|
|
|
|
$client transfer 10 from bootstrap1 to hardlimit -arg "Unit"
|
|
|
|
$client transfer 10 from bootstrap1 to hardlimit -arg "Unit"
|
|
|
|
# $client transfer 10 from bootstrap1 to hardlimit -arg "unit" # should fail
|
|
|
|
|
|
|
|
$client originate free account free_account for $key1
|
|
|
|
$client get delegate for free_account
|
|
|
|
$client set delegate for free_account to $key2
|
|
|
|
$client get delegate for free_account
|
|
|
|
|
2017-11-29 21:06:17 +04:00
|
|
|
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
|
|
|
|
$client transfer 400,000 from bootstrap5 to bootstrap1 -fee 0
|
|
|
|
$client transfer 400,000 from bootstrap1 to bootstrap5 -fee 0
|
|
|
|
$client get balance for bootstrap5 | assert "4,000,000 ꜩ"
|
2017-08-22 11:27:06 +04:00
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
echo
|
|
|
|
echo End of test
|
|
|
|
echo
|
2017-08-28 20:34:36 +04:00
|
|
|
|
|
|
|
show_logs="no"
|