Commit 4419d882 authored by pengjun's avatar pengjun

#484 rpc_test

parent bccbf066
...@@ -317,4 +317,4 @@ function main() { ...@@ -317,4 +317,4 @@ function main() {
fi fi
} }
main "$1" chain33_debug_function main "$1"
...@@ -8,12 +8,6 @@ GAME_ID="" ...@@ -8,12 +8,6 @@ GAME_ID=""
PASSWD="ABCD" PASSWD="ABCD"
HASH_VALUE=$(echo -n "ABCD1" | sha256sum | awk '{print $1}') HASH_VALUE=$(echo -n "ABCD1" | sha256sum | awk '{print $1}')
ACCOUNT_A="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
PRIVA_A="56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138"
ACCOUNT_B="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
PRIVA_B="2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989"
EXECTOR="" EXECTOR=""
# shellcheck source=/dev/null # shellcheck source=/dev/null
...@@ -142,9 +136,43 @@ function init() { ...@@ -142,9 +136,43 @@ function init() {
fi fi
echo "gameAddr=${game_addr}" echo "gameAddr=${game_addr}"
chain33_SendToAddress "${ACCOUNT_B}" "$game_addr" 5000000000 "${MAIN_HTTP}" #main chain import pri key
#16Z3haNPQd9wrnFDw19rtpbgnN2xynNT9f
chain33_ImportPrivkey "0xfa21dc33a6144c546537580d28d894355d1e9af7292be175808b0f5737c30849" "16Z3haNPQd9wrnFDw19rtpbgnN2xynNT9f" "game1" "${main_ip}"
#16GXRfd9xj3XYMDti4y4ht7uzwoh55gZEc
chain33_ImportPrivkey "0x213286d352b01fd740b6eaeb78a4fd316d743dd51d2f12c6789977430a41e0c7" "16GXRfd9xj3XYMDti4y4ht7uzwoh55gZEc" "game2" "$main_ip"
local ACCOUNT_A="16Z3haNPQd9wrnFDw19rtpbgnN2xynNT9f"
local ACCOUNT_B="16GXRfd9xj3XYMDti4y4ht7uzwoh55gZEc"
if [ "$ispara" == false ]; then
chain33_applyCoins "$ACCOUNT_A" 12000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_A}" "$main_ip"
chain33_applyCoins "$ACCOUNT_B" 12000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_B}" "$main_ip"
else
# tx fee
chain33_applyCoins "$ACCOUNT_A" 1000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_A}" "$main_ip"
chain33_applyCoins "$ACCOUNT_B" 1000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_B}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0xfa21dc33a6144c546537580d28d894355d1e9af7292be175808b0f5737c30849" "16Z3haNPQd9wrnFDw19rtpbgnN2xynNT9f" "game1" "$para_ip"
chain33_ImportPrivkey "0x213286d352b01fd740b6eaeb78a4fd316d743dd51d2f12c6789977430a41e0c7" "16GXRfd9xj3XYMDti4y4ht7uzwoh55gZEc" "game2" "$para_ip"
chain33_applyCoins "$ACCOUNT_A" 12000000000 "${para_ip}"
chain33_QueryBalance "${ACCOUNT_A}" "$para_ip"
chain33_applyCoins "$ACCOUNT_B" 12000000000 "${para_ip}"
chain33_QueryBalance "${ACCOUNT_B}" "$para_ip"
fi
chain33_SendToAddress "${ACCOUNT_B}" "$game_addr" 5000000000 "${MAIN_HTTP}"
chain33_QueryExecBalance "${ACCOUNT_B}" "game" "$MAIN_HTTP"
chain33_SendToAddress "${ACCOUNT_A}" "$game_addr" 5000000000 "${MAIN_HTTP}" chain33_SendToAddress "${ACCOUNT_A}" "$game_addr" 5000000000 "${MAIN_HTTP}"
chain33_QueryExecBalance "${ACCOUNT_A}" "game" "$MAIN_HTTP"
chain33_BlockWait 1 "$MAIN_HTTP" chain33_BlockWait 1 "$MAIN_HTTP"
} }
...@@ -197,4 +225,4 @@ function main() { ...@@ -197,4 +225,4 @@ function main() {
fi fi
} }
main "$1" chain33_debug_function main "$1"
...@@ -11,8 +11,8 @@ source ../dapp-test-common.sh ...@@ -11,8 +11,8 @@ source ../dapp-test-common.sh
MAIN_HTTP="" MAIN_HTTP=""
CASE_ERR="" CASE_ERR=""
guess_admin_addr=12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv guess_admin_addr=12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
guess_user1_addr=1PUiGcbsccfxW3zuvHXZBJfznziph5miAo guess_user1_addr=1NrfEBfdFJUUqgbw5ZbHXhdew6NNQumYhM
guess_user2_addr=1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX guess_user2_addr=17tRkBrccmFiVcLPXgEceRxDzJ2WaDZumN
guess_addr="" guess_addr=""
guess_exec="" guess_exec=""
...@@ -134,14 +134,45 @@ init() { ...@@ -134,14 +134,45 @@ init() {
guess_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"guess"}]}' ${MAIN_HTTP} | jq -r ".result") guess_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"guess"}]}' ${MAIN_HTTP} | jq -r ".result")
guess_exec="guess" guess_exec="guess"
fi fi
echo "guess_addr=$guess_addr" echo "guess_addr=$guess_addr"
local from="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo" #main chain import pri key
chain33_SendToAddress "$from" "$guess_addr" 10000000000 ${MAIN_HTTP} #1NrfEBfdFJUUqgbw5ZbHXhdew6NNQumYhM
chain33_ImportPrivkey "0xc889d2958843fc96d4bd3f578173137d37230e580d65e9074545c61e7e9c1932" "1NrfEBfdFJUUqgbw5ZbHXhdew6NNQumYhM" "guess1" "${main_ip}"
#17tRkBrccmFiVcLPXgEceRxDzJ2WaDZumN
chain33_ImportPrivkey "0xf10c79470dc74c229c4ee73b05d14c58322b771a6c749d27824f6a59bb6c2d73" "17tRkBrccmFiVcLPXgEceRxDzJ2WaDZumN" "guess2" "$main_ip"
local guess1="1NrfEBfdFJUUqgbw5ZbHXhdew6NNQumYhM"
local guess2="17tRkBrccmFiVcLPXgEceRxDzJ2WaDZumN"
if [ "$ispara" == false ]; then
chain33_applyCoins "$guess1" 12000000000 "${main_ip}"
chain33_QueryBalance "${guess1}" "$main_ip"
chain33_applyCoins "$guess2" 12000000000 "${main_ip}"
chain33_QueryBalance "${guess2}" "$main_ip"
else
# tx fee
chain33_applyCoins "$guess1" 1000000000 "${main_ip}"
chain33_QueryBalance "${guess1}" "$main_ip"
chain33_applyCoins "$guess2" 1000000000 "${main_ip}"
chain33_QueryBalance "${guess2}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0xc889d2958843fc96d4bd3f578173137d37230e580d65e9074545c61e7e9c1932" "1NrfEBfdFJUUqgbw5ZbHXhdew6NNQumYhM" "guess1" "$para_ip"
chain33_ImportPrivkey "0xf10c79470dc74c229c4ee73b05d14c58322b771a6c749d27824f6a59bb6c2d73" "17tRkBrccmFiVcLPXgEceRxDzJ2WaDZumN" "guess2" "$para_ip"
chain33_applyCoins "$guess1" 12000000000 "${para_ip}"
chain33_QueryBalance "${guess1}" "$para_ip"
chain33_applyCoins "$guess2" 12000000000 "${para_ip}"
chain33_QueryBalance "${guess2}" "$para_ip"
fi
from="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX" chain33_SendToAddress "$guess1" "$guess_addr" 10000000000 ${MAIN_HTTP}
chain33_SendToAddress "$from" "$guess_addr" 10000000000 ${MAIN_HTTP} chain33_QueryExecBalance "${guess1}" "guess" "$MAIN_HTTP"
chain33_SendToAddress "$guess2" "$guess_addr" 10000000000 ${MAIN_HTTP}
chain33_QueryExecBalance "${guess2}" "guess" "$MAIN_HTTP"
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
} }
...@@ -149,8 +180,8 @@ init() { ...@@ -149,8 +180,8 @@ init() {
function run_test() { function run_test() {
#导入地址私钥 #导入地址私钥
chain33_ImportPrivkey "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" "1PUiGcbsccfxW3zuvHXZBJfznziph5miAo" "user1" "$MAIN_HTTP" chain33_ImportPrivkey "0xc889d2958843fc96d4bd3f578173137d37230e580d65e9074545c61e7e9c1932" "1NrfEBfdFJUUqgbw5ZbHXhdew6NNQumYhM" "user1" "$MAIN_HTTP"
chain33_ImportPrivkey "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" "1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX" "user2" "$MAIN_HTTP" chain33_ImportPrivkey "0xf10c79470dc74c229c4ee73b05d14c58322b771a6c749d27824f6a59bb6c2d73" "17tRkBrccmFiVcLPXgEceRxDzJ2WaDZumN" "user2" "$MAIN_HTTP"
chain33_ImportPrivkey "4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01" "12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" "admin" "$MAIN_HTTP" chain33_ImportPrivkey "4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01" "12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" "admin" "$MAIN_HTTP"
chain33_QueryBalance "${guess_admin_addr}" "$MAIN_HTTP" chain33_QueryBalance "${guess_admin_addr}" "$MAIN_HTTP"
...@@ -167,13 +198,13 @@ function run_test() { ...@@ -167,13 +198,13 @@ function run_test() {
guess_QueryGameByID "$eventId" 11 guess_QueryGameByID "$eventId" 11
#用户1下注 #用户1下注
guess_game_bet "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" "A" guess_game_bet "0xc889d2958843fc96d4bd3f578173137d37230e580d65e9074545c61e7e9c1932" "A"
#查询游戏状态 #查询游戏状态
guess_QueryGameByID "$eventId" 12 guess_QueryGameByID "$eventId" 12
#用户2下注 #用户2下注
guess_game_bet "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" "B" guess_game_bet "0xf10c79470dc74c229c4ee73b05d14c58322b771a6c749d27824f6a59bb6c2d73" "B"
#查询游戏状态 #查询游戏状态
guess_QueryGameByID "$eventId" 12 guess_QueryGameByID "$eventId" 12
...@@ -233,13 +264,13 @@ function run_test() { ...@@ -233,13 +264,13 @@ function run_test() {
guess_QueryGameByID "$eventId" 11 guess_QueryGameByID "$eventId" 11
#用户1下注 #用户1下注
guess_game_bet "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" "A" guess_game_bet "0xc889d2958843fc96d4bd3f578173137d37230e580d65e9074545c61e7e9c1932" "A"
#查询游戏状态 #查询游戏状态
guess_QueryGameByID "$eventId" 12 guess_QueryGameByID "$eventId" 12
#用户2下注 #用户2下注
guess_game_bet "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" "B" guess_game_bet "0xf10c79470dc74c229c4ee73b05d14c58322b771a6c749d27824f6a59bb6c2d73" "B"
#查询游戏状态 #查询游戏状态
guess_QueryGameByID "$eventId" 12 guess_QueryGameByID "$eventId" 12
...@@ -258,13 +289,13 @@ function run_test() { ...@@ -258,13 +289,13 @@ function run_test() {
guess_QueryGameByID "$eventId" 11 guess_QueryGameByID "$eventId" 11
#用户1下注 #用户1下注
guess_game_bet "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" "A" guess_game_bet "0xc889d2958843fc96d4bd3f578173137d37230e580d65e9074545c61e7e9c1932" "A"
#查询游戏状态 #查询游戏状态
guess_QueryGameByID "$eventId" 12 guess_QueryGameByID "$eventId" 12
#用户2下注 #用户2下注
guess_game_bet "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" "B" guess_game_bet "0xf10c79470dc74c229c4ee73b05d14c58322b771a6c749d27824f6a59bb6c2d73" "B"
#查询游戏状态 #查询游戏状态
guess_QueryGameByID "$eventId" 12 guess_QueryGameByID "$eventId" 12
...@@ -304,4 +335,4 @@ function main() { ...@@ -304,4 +335,4 @@ function main() {
echo "=========== # guess rpc test end=============" echo "=========== # guess rpc test end============="
} }
main "$1" chain33_debug_function main "$1"
...@@ -5,8 +5,8 @@ set -o pipefail ...@@ -5,8 +5,8 @@ set -o pipefail
MAIN_HTTP="" MAIN_HTTP=""
addr_A=1PUiGcbsccfxW3zuvHXZBJfznziph5miAo addr_A=19vpbRuz2XtKopQS2ruiVuVZeRdLd5n4t3
addr_B=1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX addr_B=1FcofeCgU1KYbB8dSa7cV2wjAF2RpMuUQD
# shellcheck source=/dev/null # shellcheck source=/dev/null
source ../dapp-test-common.sh source ../dapp-test-common.sh
...@@ -24,7 +24,7 @@ hashlock_lock() { ...@@ -24,7 +24,7 @@ hashlock_lock() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0x1089b7f980fc467f029b7ae301249b36e3b582c911b1af1a24616c83b3563dcb" ${MAIN_HTTP}
#echo "txHash ${txhash}" #echo "txHash ${txhash}"
echo "========== # hashlock lock tx end ==========" echo "========== # hashlock lock tx end =========="
...@@ -44,7 +44,7 @@ hashlock_send() { ...@@ -44,7 +44,7 @@ hashlock_send() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0xb76a398c3901dfe5c7335525da88fda4df24c11ad11af4332f00c0953cc2910f" ${MAIN_HTTP}
#echo "txHash ${txhash}" #echo "txHash ${txhash}"
echo "========== # hashlock send tx end ==========" echo "========== # hashlock send tx end =========="
...@@ -63,7 +63,7 @@ hashlock_unlock() { ...@@ -63,7 +63,7 @@ hashlock_unlock() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0x1089b7f980fc467f029b7ae301249b36e3b582c911b1af1a24616c83b3563dcb" ${MAIN_HTTP}
#echo "txHash ${txhash}" #echo "txHash ${txhash}"
echo "========== # hashlock unlock tx end ==========" echo "========== # hashlock unlock tx end =========="
...@@ -79,11 +79,44 @@ init() { ...@@ -79,11 +79,44 @@ init() {
hashlock_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"hashlock"}]}' ${MAIN_HTTP} | jq -r ".result") hashlock_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"hashlock"}]}' ${MAIN_HTTP} | jq -r ".result")
fi fi
local from="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo" #main chain import pri key
chain33_SendToAddress "$from" "$hashlock_addr" 10000000000 ${MAIN_HTTP} #19vpbRuz2XtKopQS2ruiVuVZeRdLd5n4t3
chain33_ImportPrivkey "0x1089b7f980fc467f029b7ae301249b36e3b582c911b1af1a24616c83b3563dcb" "19vpbRuz2XtKopQS2ruiVuVZeRdLd5n4t3" "hashlock1" "${main_ip}"
#1FcofeCgU1KYbB8dSa7cV2wjAF2RpMuUQD
chain33_ImportPrivkey "0xb76a398c3901dfe5c7335525da88fda4df24c11ad11af4332f00c0953cc2910f" "1FcofeCgU1KYbB8dSa7cV2wjAF2RpMuUQD" "hashlock2" "$main_ip"
local hashlock1="19vpbRuz2XtKopQS2ruiVuVZeRdLd5n4t3"
local hashlock2="1FcofeCgU1KYbB8dSa7cV2wjAF2RpMuUQD"
if [ "$ispara" == false ]; then
chain33_applyCoins "$hashlock1" 12000000000 "${main_ip}"
chain33_QueryBalance "${hashlock1}" "$main_ip"
chain33_applyCoins "$hashlock2" 12000000000 "${main_ip}"
chain33_QueryBalance "${hashlock2}" "$main_ip"
else
# tx fee
chain33_applyCoins "$hashlock1" 1000000000 "${main_ip}"
chain33_QueryBalance "${hashlock1}" "$main_ip"
chain33_applyCoins "$hashlock2" 1000000000 "${main_ip}"
chain33_QueryBalance "${hashlock2}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0x1089b7f980fc467f029b7ae301249b36e3b582c911b1af1a24616c83b3563dcb" "19vpbRuz2XtKopQS2ruiVuVZeRdLd5n4t3" "hashlock1" "$para_ip"
chain33_ImportPrivkey "0xb76a398c3901dfe5c7335525da88fda4df24c11ad11af4332f00c0953cc2910f" "1FcofeCgU1KYbB8dSa7cV2wjAF2RpMuUQD" "hashlock2" "$para_ip"
chain33_applyCoins "$hashlock1" 12000000000 "${para_ip}"
chain33_QueryBalance "${hashlock1}" "$para_ip"
chain33_applyCoins "$hashlock2" 12000000000 "${para_ip}"
chain33_QueryBalance "${hashlock2}" "$para_ip"
fi
chain33_SendToAddress "$hashlock1" "$hashlock_addr" 10000000000 ${MAIN_HTTP}
chain33_QueryExecBalance "${hashlock1}" "hashlock" "$MAIN_HTTP"
chain33_SendToAddress "$hashlock2" "$hashlock_addr" 10000000000 ${MAIN_HTTP}
chain33_QueryExecBalance "${hashlock2}" "hashlock" "$MAIN_HTTP"
from="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
chain33_SendToAddress "$from" "$hashlock_addr" 10000000000 ${MAIN_HTTP}
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
} }
...@@ -121,4 +154,4 @@ function main() { ...@@ -121,4 +154,4 @@ function main() {
fi fi
} }
main "$1" chain33_debug_function main "$1"
...@@ -35,6 +35,39 @@ init() { ...@@ -35,6 +35,39 @@ init() {
chain33_SignRawTx "${lottery_addCreator_unsignedTx}" "${lottery_creator_priv}" ${MAIN_HTTP} chain33_SignRawTx "${lottery_addCreator_unsignedTx}" "${lottery_creator_priv}" ${MAIN_HTTP}
fi fi
echo "lottExecAddr=$lottExecAddr" echo "lottExecAddr=$lottExecAddr"
#main chain import pri key
#1FLh9wBS2rat1mUS4G95hRpJt6yHYy5nHF
chain33_ImportPrivkey "0x8223b757a5d0f91b12e7af3b9666ca33be47fe63e1502987b0537089aaf90bc1" "1FLh9wBS2rat1mUS4G95hRpJt6yHYy5nHF" "lottery1" "${main_ip}"
#1UWE6NfXPR7eNAjYgT4HMERp7cMMi486E
chain33_ImportPrivkey "0xbfccb96690e0a1f89748b321f85b03e14bda0cb3d5d19f255ff0b9b0ffb624b3" "1UWE6NfXPR7eNAjYgT4HMERp7cMMi486E" "lottery2" "$main_ip"
local ACCOUNT_A="1FLh9wBS2rat1mUS4G95hRpJt6yHYy5nHF"
local ACCOUNT_B="1UWE6NfXPR7eNAjYgT4HMERp7cMMi486E"
if [ "$ispara" == false ]; then
chain33_applyCoins "$ACCOUNT_A" 12000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_A}" "$main_ip"
chain33_applyCoins "$ACCOUNT_B" 12000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_B}" "$main_ip"
else
# tx fee
chain33_applyCoins "$ACCOUNT_A" 1000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_A}" "$main_ip"
chain33_applyCoins "$ACCOUNT_B" 1000000000 "${main_ip}"
chain33_QueryBalance "${ACCOUNT_B}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0x8223b757a5d0f91b12e7af3b9666ca33be47fe63e1502987b0537089aaf90bc1" "1FLh9wBS2rat1mUS4G95hRpJt6yHYy5nHF" "lottery1" "$para_ip"
chain33_ImportPrivkey "0xbfccb96690e0a1f89748b321f85b03e14bda0cb3d5d19f255ff0b9b0ffb624b3" "1UWE6NfXPR7eNAjYgT4HMERp7cMMi486E" "lottery2" "$para_ip"
chain33_applyCoins "$ACCOUNT_A" 12000000000 "${para_ip}"
chain33_QueryBalance "${ACCOUNT_A}" "$para_ip"
chain33_applyCoins "$ACCOUNT_B" 12000000000 "${para_ip}"
chain33_QueryBalance "${ACCOUNT_B}" "$para_ip"
fi
} }
lottery_LotteryCreate() { lottery_LotteryCreate() {
...@@ -252,10 +285,10 @@ lottery_GetLotteryRoundGainInfo() { ...@@ -252,10 +285,10 @@ lottery_GetLotteryRoundGainInfo() {
function run_testcases() { function run_testcases() {
#账户地址 #账户地址
gameAddr1="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo" gameAddr1="1FLh9wBS2rat1mUS4G95hRpJt6yHYy5nHF"
gamePriv1="0x56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" gamePriv1="0x8223b757a5d0f91b12e7af3b9666ca33be47fe63e1502987b0537089aaf90bc1"
gameAddr2="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX" gameAddr2="1UWE6NfXPR7eNAjYgT4HMERp7cMMi486E"
gamePriv2="0x2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" gamePriv2="0xbfccb96690e0a1f89748b321f85b03e14bda0cb3d5d19f255ff0b9b0ffb624b3"
set -x set -x
#给游戏合约中转帐 #给游戏合约中转帐
...@@ -322,4 +355,4 @@ function main() { ...@@ -322,4 +355,4 @@ function main() {
echo "=========== # lottery rpc test end=============" echo "=========== # lottery rpc test end============="
} }
main "$1" chain33_debug_function main "$1"
...@@ -19,7 +19,7 @@ pokerbull_PlayRawTx() { ...@@ -19,7 +19,7 @@ pokerbull_PlayRawTx() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0x0316d5e33e7bce2455413156cb95209f8c641af352ee5d648c647f24383e4d94" ${MAIN_HTTP}
echo "========== # pokerbull play tx end ==========" echo "========== # pokerbull play tx end =========="
chain33_BlockWait 1 ${MAIN_HTTP} chain33_BlockWait 1 ${MAIN_HTTP}
...@@ -35,7 +35,7 @@ pokerbull_QuitRawTx() { ...@@ -35,7 +35,7 @@ pokerbull_QuitRawTx() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0x0316d5e33e7bce2455413156cb95209f8c641af352ee5d648c647f24383e4d94" ${MAIN_HTTP}
echo "========== # pokerbull quit tx end ==========" echo "========== # pokerbull quit tx end =========="
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
...@@ -51,7 +51,7 @@ pokerbull_ContinueRawTx() { ...@@ -51,7 +51,7 @@ pokerbull_ContinueRawTx() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0xa26038cbdd9e6fbfb85f2c3d032254755e75252b9edccbecc16d9ba117d96705" ${MAIN_HTTP}
echo "========== # pokerbull continue tx end ==========" echo "========== # pokerbull continue tx end =========="
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
...@@ -67,7 +67,7 @@ pokerbull_StartRawTx() { ...@@ -67,7 +67,7 @@ pokerbull_StartRawTx() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0x0316d5e33e7bce2455413156cb95209f8c641af352ee5d648c647f24383e4d94" ${MAIN_HTTP}
GAME_ID=$RAW_TX_HASH GAME_ID=$RAW_TX_HASH
echo "========== # pokerbull start tx end ==========" echo "========== # pokerbull start tx end =========="
...@@ -84,7 +84,7 @@ pokerbull_QueryResult() { ...@@ -84,7 +84,7 @@ pokerbull_QueryResult() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
data=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByAddr","payload":{"addr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}}]}' ${MAIN_HTTP} | jq -r ".result") data=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByAddr","payload":{"addr":"14VkqML8YTRK4o15Cf97CQhpbnRUa6sJY4"}}]}' ${MAIN_HTTP} | jq -r ".result")
[ "$data" != null ] [ "$data" != null ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
...@@ -103,11 +103,44 @@ init() { ...@@ -103,11 +103,44 @@ init() {
pokerbull_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"pokerbull"}]}' ${MAIN_HTTP} | jq -r ".result") pokerbull_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"pokerbull"}]}' ${MAIN_HTTP} | jq -r ".result")
fi fi
local from="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo" #main chain import pri key
chain33_SendToAddress "$from" "$pokerbull_addr" 10000000000 ${MAIN_HTTP} #14VkqML8YTRK4o15Cf97CQhpbnRUa6sJY4
chain33_ImportPrivkey "0x0316d5e33e7bce2455413156cb95209f8c641af352ee5d648c647f24383e4d94" "14VkqML8YTRK4o15Cf97CQhpbnRUa6sJY4" "pokerbull1" "${main_ip}"
#1MuVM87DLigWhJxLJKvghTa1po4ZdWtDv1
chain33_ImportPrivkey "0xa26038cbdd9e6fbfb85f2c3d032254755e75252b9edccbecc16d9ba117d96705" "1MuVM87DLigWhJxLJKvghTa1po4ZdWtDv1" "pokerbull2" "$main_ip"
local pokerbull1="14VkqML8YTRK4o15Cf97CQhpbnRUa6sJY4"
local pokerbull2="1MuVM87DLigWhJxLJKvghTa1po4ZdWtDv1"
if [ "$ispara" == false ]; then
chain33_applyCoins "$pokerbull1" 12000000000 "${main_ip}"
chain33_QueryBalance "${pokerbull1}" "$main_ip"
chain33_applyCoins "$pokerbull2" 12000000000 "${main_ip}"
chain33_QueryBalance "${pokerbull2}" "$main_ip"
else
# tx fee
chain33_applyCoins "$pokerbull1" 1000000000 "${main_ip}"
chain33_QueryBalance "${pokerbull1}" "$main_ip"
chain33_applyCoins "$pokerbull2" 1000000000 "${main_ip}"
chain33_QueryBalance "${pokerbull2}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0x0316d5e33e7bce2455413156cb95209f8c641af352ee5d648c647f24383e4d94" "14VkqML8YTRK4o15Cf97CQhpbnRUa6sJY4" "pokerbull1" "$para_ip"
chain33_ImportPrivkey "0xa26038cbdd9e6fbfb85f2c3d032254755e75252b9edccbecc16d9ba117d96705" "1MuVM87DLigWhJxLJKvghTa1po4ZdWtDv1" "pokerbull2" "$para_ip"
chain33_applyCoins "$pokerbull1" 12000000000 "${para_ip}"
chain33_QueryBalance "${pokerbull1}" "$para_ip"
chain33_applyCoins "$pokerbull2" 12000000000 "${para_ip}"
chain33_QueryBalance "${pokerbull2}" "$para_ip"
fi
chain33_SendToAddress "$pokerbull1" "$pokerbull_addr" 10000000000 ${MAIN_HTTP}
chain33_QueryExecBalance "${pokerbull1}" "pokerbull" "$MAIN_HTTP"
chain33_SendToAddress "$pokerbull2" "$pokerbull_addr" 10000000000 ${MAIN_HTTP}
chain33_QueryExecBalance "${pokerbull2}" "pokerbull" "$MAIN_HTTP"
from="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
chain33_SendToAddress "$from" "$pokerbull_addr" 10000000000 ${MAIN_HTTP}
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
} }
...@@ -140,4 +173,4 @@ function main() { ...@@ -140,4 +173,4 @@ function main() {
fi fi
} }
main "$1" chain33_debug_function main "$1"
...@@ -11,7 +11,7 @@ source ../dapp-test-common.sh ...@@ -11,7 +11,7 @@ source ../dapp-test-common.sh
retrieve_Backup() { retrieve_Backup() {
echo "========== # retrieve backup begin ==========" echo "========== # retrieve backup begin =========="
local req='"method":"retrieve.CreateRawRetrieveBackupTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo","delayPeriod": 61}]' local req='"method":"retrieve.CreateRawRetrieveBackupTx","params":[{"backupAddr":"13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx","defaultAddr":"1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL","delayPeriod": 61}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result") tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]' local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
...@@ -21,7 +21,7 @@ retrieve_Backup() { ...@@ -21,7 +21,7 @@ retrieve_Backup() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0x3665fa66d1a17d2fc319a45250c8c8b9302ae0c393c2e39f2ef3b2f6bc40a42d" ${MAIN_HTTP}
echo "========== # retrieve backup end ==========" echo "========== # retrieve backup end =========="
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
...@@ -30,7 +30,7 @@ retrieve_Backup() { ...@@ -30,7 +30,7 @@ retrieve_Backup() {
retrieve_Prepare() { retrieve_Prepare() {
echo "========== # retrieve prepare begin ==========" echo "========== # retrieve prepare begin =========="
local req='"method":"retrieve.CreateRawRetrievePrepareTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}]' local req='"method":"retrieve.CreateRawRetrievePrepareTx","params":[{"backupAddr":"13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx","defaultAddr":"1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL"}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result") tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]' local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
...@@ -40,7 +40,7 @@ retrieve_Prepare() { ...@@ -40,7 +40,7 @@ retrieve_Prepare() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0xed8a078ee44eac473bd1d5c971e231c255badf7f0c2fbdbe31ef34669c441d6f" ${MAIN_HTTP}
echo "========== # retrieve prepare end ==========" echo "========== # retrieve prepare end =========="
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
...@@ -49,7 +49,7 @@ retrieve_Prepare() { ...@@ -49,7 +49,7 @@ retrieve_Prepare() {
retrieve_Perform() { retrieve_Perform() {
echo "========== # retrieve perform begin ==========" echo "========== # retrieve perform begin =========="
local req='"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}]' local req='"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx","defaultAddr":"1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL"}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result") tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]' local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
...@@ -59,7 +59,7 @@ retrieve_Perform() { ...@@ -59,7 +59,7 @@ retrieve_Perform() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0xed8a078ee44eac473bd1d5c971e231c255badf7f0c2fbdbe31ef34669c441d6f" ${MAIN_HTTP}
echo "========== # retrieve perform end ==========" echo "========== # retrieve perform end =========="
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
...@@ -68,7 +68,7 @@ retrieve_Perform() { ...@@ -68,7 +68,7 @@ retrieve_Perform() {
retrieve_Cancel() { retrieve_Cancel() {
echo "========== # retrieve cancel begin ==========" echo "========== # retrieve cancel begin =========="
local req='"method":"retrieve.CreateRawRetrieveCancelTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}]' local req='"method":"retrieve.CreateRawRetrieveCancelTx","params":[{"backupAddr":"13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx","defaultAddr":"1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL"}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result") tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]' local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
...@@ -78,7 +78,7 @@ retrieve_Cancel() { ...@@ -78,7 +78,7 @@ retrieve_Cancel() {
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP} chain33_SignRawTx "$tx" "0x3665fa66d1a17d2fc319a45250c8c8b9302ae0c393c2e39f2ef3b2f6bc40a42d" ${MAIN_HTTP}
echo "========== # retrieve cancel end ==========" echo "========== # retrieve cancel end =========="
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
...@@ -89,7 +89,7 @@ retrieve_QueryResult() { ...@@ -89,7 +89,7 @@ retrieve_QueryResult() {
local status=$1 local status=$1
local req='"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX", "defaultAddress":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}}]' local req='"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx", "defaultAddress":"1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL"}}]'
data=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result") data=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
ok=$(jq '(.status == '"$status"')' <<<"$data") ok=$(jq '(.status == '"$status"')' <<<"$data")
...@@ -107,11 +107,44 @@ init() { ...@@ -107,11 +107,44 @@ init() {
retrieve_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"retrieve"}]}' ${MAIN_HTTP} | jq -r ".result") retrieve_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"retrieve"}]}' ${MAIN_HTTP} | jq -r ".result")
fi fi
local from="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo" #main chain import pri key
chain33_SendToAddress "$from" "$retrieve_addr" 1000000000 ${MAIN_HTTP} #1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL
chain33_ImportPrivkey "0x0316d5e33e7bce2455413156cb95209f8c641af352ee5d648c647f24383e4d94" "1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL" "retrieve1" "${main_ip}"
#13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx
chain33_ImportPrivkey "0xed8a078ee44eac473bd1d5c971e231c255badf7f0c2fbdbe31ef34669c441d6f" "13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx" "retrieve2" "$main_ip"
local retrieve1="1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL"
local retrieve2="13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx"
if [ "$ispara" == false ]; then
chain33_applyCoins "$retrieve1" 12000000000 "${main_ip}"
chain33_QueryBalance "${retrieve1}" "$main_ip"
chain33_applyCoins "$retrieve2" 12000000000 "${main_ip}"
chain33_QueryBalance "${retrieve2}" "$main_ip"
else
# tx fee
chain33_applyCoins "$retrieve1" 1000000000 "${main_ip}"
chain33_QueryBalance "${retrieve1}" "$main_ip"
chain33_applyCoins "$retrieve2" 1000000000 "${main_ip}"
chain33_QueryBalance "${retrieve2}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0x0316d5e33e7bce2455413156cb95209f8c641af352ee5d648c647f24383e4d94" "1PdaXiQU994gzh4RcjLir2AbyqcQ3TwnBL" "retrieve1" "$para_ip"
chain33_ImportPrivkey "0xed8a078ee44eac473bd1d5c971e231c255badf7f0c2fbdbe31ef34669c441d6f" "13t1hnMNHqQ5K4QPeqq5xmdg2kTbDPtrgx" "retrieve2" "$para_ip"
chain33_applyCoins "$retrieve1" 12000000000 "${para_ip}"
chain33_QueryBalance "${retrieve1}" "$para_ip"
chain33_applyCoins "$retrieve2" 12000000000 "${para_ip}"
chain33_QueryBalance "${retrieve2}" "$para_ip"
fi
chain33_SendToAddress "$retrieve1" "$retrieve_addr" 1000000000 ${MAIN_HTTP}
chain33_QueryExecBalance "${retrieve1}" "retrieve" "$MAIN_HTTP"
chain33_SendToAddress "$retrieve2" "$retrieve_addr" 1000000000 ${MAIN_HTTP}
chain33_QueryExecBalance "${retrieve2}" "retrieve" "$MAIN_HTTP"
from="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
chain33_SendToAddress "$from" "$retrieve_addr" 1000000000 ${MAIN_HTTP}
chain33_BlockWait 1 "${MAIN_HTTP}" chain33_BlockWait 1 "${MAIN_HTTP}"
} }
...@@ -152,4 +185,4 @@ function main() { ...@@ -152,4 +185,4 @@ function main() {
fi fi
} }
main "$1" chain33_debug_function main "$1"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
MAIN_HTTP="" MAIN_HTTP=""
CASE_ERR="" CASE_ERR=""
tokenAddr="1Q8hGLfoGe63efeWa8fJ4Pnukhkngt6poK" tokenAddr="1Q8hGLfoGe63efeWa8fJ4Pnukhkngt6poK"
recvAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" recvAddr="1CLrYLNhHfCfMUV7mtdqhbMSF6vGmtTvzq"
superManager="0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc" superManager="0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc"
tokenSymbol="ABCDE" tokenSymbol="ABCDE"
token_addr="" token_addr=""
...@@ -115,6 +115,26 @@ function init() { ...@@ -115,6 +115,26 @@ function init() {
echo "ipara=$ispara" echo "ipara=$ispara"
chain33_ImportPrivkey "${MAIN_HTTP}" "${superManager}" "${tokenAddr}" chain33_ImportPrivkey "${MAIN_HTTP}" "${superManager}" "${tokenAddr}"
#main chain import pri key
#1CLrYLNhHfCfMUV7mtdqhbMSF6vGmtTvzq
chain33_ImportPrivkey "0x882c963ce2afbedc2353cb417492aa9e889becd878a10f2529fc9e6c3b756128" "1CLrYLNhHfCfMUV7mtdqhbMSF6vGmtTvzq" "token1" "${main_ip}"
local token1="1CLrYLNhHfCfMUV7mtdqhbMSF6vGmtTvzq"
if [ "$ispara" == false ]; then
chain33_applyCoins "$token1" 12000000000 "${main_ip}"
chain33_QueryBalance "${token1}" "$main_ip"
else
# tx fee
chain33_applyCoins "$token1" 1000000000 "${main_ip}"
chain33_QueryBalance "${token1}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0x882c963ce2afbedc2353cb417492aa9e889becd878a10f2529fc9e6c3b756128" "1CLrYLNhHfCfMUV7mtdqhbMSF6vGmtTvzq" "token1" "$para_ip"
chain33_applyCoins "$token1" 12000000000 "${para_ip}"
chain33_QueryBalance "${token1}" "$para_ip"
fi
if [ "$ispara" == true ]; then if [ "$ispara" == true ]; then
execName="user.p.para.token" execName="user.p.para.token"
token_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.token"}]}' ${MAIN_HTTP} | jq -r ".result") token_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.token"}]}' ${MAIN_HTTP} | jq -r ".result")
...@@ -124,8 +144,7 @@ function init() { ...@@ -124,8 +144,7 @@ function init() {
block_wait 2 block_wait 2
else else
token_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"token"}]}' ${MAIN_HTTP} | jq -r ".result") token_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"token"}]}' ${MAIN_HTTP} | jq -r ".result")
from="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" Chain33_SendToAddress "$recvAddr" "$tokenAddr" 10000000000
Chain33_SendToAddress "$from" "$tokenAddr" 10000000000
block_wait 2 block_wait 2
Chain33_SendToAddress "$tokenAddr" "$token_addr" 1000000000 Chain33_SendToAddress "$tokenAddr" "$token_addr" 1000000000
block_wait 2 block_wait 2
...@@ -375,4 +394,4 @@ function main() { ...@@ -375,4 +394,4 @@ function main() {
fi fi
} }
main "$1" chain33_debug_function main "$1"
...@@ -7,8 +7,8 @@ source ../dapp-test-common.sh ...@@ -7,8 +7,8 @@ source ../dapp-test-common.sh
MAIN_HTTP="" MAIN_HTTP=""
CASE_ERR="" CASE_ERR=""
trade_addr="" trade_addr=""
tradeAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" tradeAddr="1CvLe1qNaC7tCf5xmfAqJ9UJkMhtmhUKNg"
tradeBuyerAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" tradeBuyerAddr="1MbEtj189WoUGgLvX5vNosBVB4xmL3dAyJ"
tokenSymbol="TOKEN" tokenSymbol="TOKEN"
#color #color
...@@ -23,7 +23,7 @@ function updateConfig() { ...@@ -23,7 +23,7 @@ function updateConfig() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "update config queryExecRes" "$?" echo_rst "update config queryExecRes" "$?"
...@@ -36,7 +36,7 @@ function token_preCreate() { ...@@ -36,7 +36,7 @@ function token_preCreate() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "token preCreate queryExecRes" "$?" echo_rst "token preCreate queryExecRes" "$?"
...@@ -49,7 +49,7 @@ function token_finish() { ...@@ -49,7 +49,7 @@ function token_finish() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "token finish queryExecRes" "$?" echo_rst "token finish queryExecRes" "$?"
...@@ -81,7 +81,7 @@ function token_transfer() { ...@@ -81,7 +81,7 @@ function token_transfer() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "token transfer queryExecRes" "$?" echo_rst "token transfer queryExecRes" "$?"
...@@ -108,7 +108,7 @@ function trade_createSellTx() { ...@@ -108,7 +108,7 @@ function trade_createSellTx() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "trade createSellTx queryExecRes" "$?" echo_rst "trade createSellTx queryExecRes" "$?"
...@@ -132,7 +132,7 @@ function trade_createBuyTx() { ...@@ -132,7 +132,7 @@ function trade_createBuyTx() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0xCC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xfac83e59be12fb5cf21821c78e6f44d370b0b0a2c67902452d47a572d3c24d14" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "trade createBuyTx queryExecRes" "$?" echo_rst "trade createBuyTx queryExecRes" "$?"
...@@ -200,7 +200,7 @@ function trade_buyLimit() { ...@@ -200,7 +200,7 @@ function trade_buyLimit() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xfac83e59be12fb5cf21821c78e6f44d370b0b0a2c67902452d47a572d3c24d14" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "trade buyLimit queryExecRes" "$?" echo_rst "trade buyLimit queryExecRes" "$?"
...@@ -227,7 +227,7 @@ function trade_revokeBuy() { ...@@ -227,7 +227,7 @@ function trade_revokeBuy() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "trade revokeBuy queryExecRes" "$?" echo_rst "trade revokeBuy queryExecRes" "$?"
...@@ -240,7 +240,7 @@ function trade_revoke() { ...@@ -240,7 +240,7 @@ function trade_revoke() {
return return
fi fi
chain33_SignRawTx "${unsignedTx}" "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" "${MAIN_HTTP}" chain33_SignRawTx "${unsignedTx}" "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "${MAIN_HTTP}"
queryTransaction ".error | not" "true" queryTransaction ".error | not" "true"
echo_rst "trade revoke queryExecRes" "$?" echo_rst "trade revoke queryExecRes" "$?"
...@@ -278,9 +278,38 @@ function init() { ...@@ -278,9 +278,38 @@ function init() {
token_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"'"${tokenExecName}"'"}]}' ${MAIN_HTTP} | jq -r ".result") token_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"'"${tokenExecName}"'"}]}' ${MAIN_HTTP} | jq -r ".result")
fi fi
chain33_SendToAddress "$tradeAddr" "$tradeBuyerAddr" 10000000000 "${MAIN_HTTP}" #main chain import pri key
#1CvLe1qNaC7tCf5xmfAqJ9UJkMhtmhUKNg
chain33_ImportPrivkey "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "1CvLe1qNaC7tCf5xmfAqJ9UJkMhtmhUKNg" "trade1" "${main_ip}"
#1MbEtj189WoUGgLvX5vNosBVB4xmL3dAyJ
chain33_ImportPrivkey "0xfac83e59be12fb5cf21821c78e6f44d370b0b0a2c67902452d47a572d3c24d14" "1MbEtj189WoUGgLvX5vNosBVB4xmL3dAyJ" "trade2" "$main_ip"
if [ "$ispara" == false ]; then
chain33_applyCoins "$tradeAddr" 12000000000 "${main_ip}"
chain33_QueryBalance "${tradeAddr}" "$main_ip"
chain33_applyCoins "$tradeBuyerAddr" 12000000000 "${main_ip}"
chain33_QueryBalance "${tradeBuyerAddr}" "$main_ip"
else
# tx fee
chain33_applyCoins "$tradeAddr" 1000000000 "${main_ip}"
chain33_QueryBalance "${tradeAddr}" "$main_ip"
chain33_applyCoins "$tradeBuyerAddr" 1000000000 "${main_ip}"
chain33_QueryBalance "${tradeBuyerAddr}" "$main_ip"
local para_ip="${MAIN_HTTP}"
#para chain import pri key
chain33_ImportPrivkey "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42" "1CvLe1qNaC7tCf5xmfAqJ9UJkMhtmhUKNg" "trade1" "$para_ip"
chain33_ImportPrivkey "0xfac83e59be12fb5cf21821c78e6f44d370b0b0a2c67902452d47a572d3c24d14" "1MbEtj189WoUGgLvX5vNosBVB4xmL3dAyJ" "trade2" "$para_ip"
chain33_applyCoins "$tradeAddr" 12000000000 "${para_ip}"
chain33_QueryBalance "${tradeAddr}" "$para_ip"
chain33_applyCoins "$tradeBuyerAddr" 12000000000 "${para_ip}"
chain33_QueryBalance "${tradeBuyerAddr}" "$para_ip"
fi
chain33_SendToAddress "$tradeAddr" "$trade_addr" 10000000000 "${MAIN_HTTP}" chain33_SendToAddress "$tradeAddr" "$trade_addr" 10000000000 "${MAIN_HTTP}"
chain33_SendToAddress "$tradeAddr" "$token_addr" 10000000000 "${MAIN_HTTP}" chain33_SendToAddress "$tradeAddr" "$token_addr" 1000000000 "${MAIN_HTTP}"
chain33_BlockWait 2 "${MAIN_HTTP}" chain33_BlockWait 2 "${MAIN_HTTP}"
chain33_SendToAddress "$tradeBuyerAddr" "$trade_addr" 10000000000 "${MAIN_HTTP}" chain33_SendToAddress "$tradeBuyerAddr" "$trade_addr" 10000000000 "${MAIN_HTTP}"
chain33_BlockWait 2 "${MAIN_HTTP}" chain33_BlockWait 2 "${MAIN_HTTP}"
...@@ -292,8 +321,8 @@ function init() { ...@@ -292,8 +321,8 @@ function init() {
token_finish token_finish
token_balance token_balance
token_transfer "${tradeBuyerAddr}" token_transfer "${tradeBuyerAddr}"
token_sendExec "0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01" token_sendExec "0xaeef1ad76d43a2056d0dcb57d5bf1ba96471550614ab9e7f611ef9c5ca403f42"
token_sendExec "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944 " token_sendExec "0xfac83e59be12fb5cf21821c78e6f44d370b0b0a2c67902452d47a572d3c24d14 "
} }
function run_test() { function run_test() {
...@@ -332,4 +361,4 @@ function main() { ...@@ -332,4 +361,4 @@ function main() {
fi fi
} }
main "$1" chain33_debug_function main "$1"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment