Skip to content

Commit

Permalink
tests: Generate add/reclaim escrow transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Jun 24, 2021
1 parent 1789b52 commit 7028ce0
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,44 @@ gen_burn() {
--genesis.file "${TEST_BASE_DIR}/net-runner/network/genesis.json"
}

# Helper function that generates an add escrow transaction.
gen_add_escrow() {
local tx=$1
local amount=$2
local dst=$3
${OASIS_NODE} stake account gen_escrow \
--assume_yes \
--stake.amount $amount \
--stake.escrow.account $dst \
--transaction.file "$tx" \
--transaction.nonce ${NONCE} \
--transaction.fee.amount 1 \
--transaction.fee.gas 10000 \
--debug.dont_blame_oasis \
--debug.test_entity \
--debug.allow_test_keys \
--genesis.file "${TEST_BASE_DIR}/net-runner/network/genesis.json"
}

# Helper function that generates a reclaim escrow transaction.
gen_reclaim_escrow() {
local tx=$1
local amount=$2
local src=$3
${OASIS_NODE} stake account gen_reclaim_escrow \
--assume_yes \
--stake.shares $amount \
--stake.escrow.account $src \
--transaction.file "$tx" \
--transaction.nonce ${NONCE} \
--transaction.fee.amount 1 \
--transaction.fee.gas 10000 \
--debug.dont_blame_oasis \
--debug.test_entity \
--debug.allow_test_keys \
--genesis.file "${TEST_BASE_DIR}/net-runner/network/genesis.json"
}

printf "${GRN}### Waiting for the validator to register...${OFF}\n"
${OASIS_NODE} debug control wait-nodes \
--address ${OASIS_NODE_GRPC_ADDR} \
Expand Down Expand Up @@ -155,6 +193,14 @@ printf "${GRN}### Transferring tokens (3)...${OFF}\n"
gen_transfer "${TEST_BASE_DIR}/tx3.json" 456 "${DST}"
submit_tx "${TEST_BASE_DIR}/tx3.json"

printf "${GRN}### Escrowing tokens...${OFF}\n"
gen_add_escrow "${TEST_BASE_DIR}/tx4.json" 100 "${DST}"
submit_tx "${TEST_BASE_DIR}/tx4.json"

printf "${GRN}### Reclaiming escrowed tokens...${OFF}\n"
gen_reclaim_escrow "${TEST_BASE_DIR}/tx5.json" 100 "${DST}"
submit_tx "${TEST_BASE_DIR}/tx5.json"

advance_epoch 4
wait_for_nodes

Expand Down

0 comments on commit 7028ce0

Please sign in to comment.