Commit 1eae5e9f authored by hezhengjun's avatar hezhengjun

Merge branch 'withdraw_opt_1217' of github.com:zhengjunhe/plugin into withdraw_opt_1217

parents 1394bb36 0e4dfe1a
...@@ -102,7 +102,7 @@ func CreateTxInfoAndWrite(abiData []byte, deployAddr, contract, name, url string ...@@ -102,7 +102,7 @@ func CreateTxInfoAndWrite(abiData []byte, deployAddr, contract, name, url string
if chainEthId == 1337 { if chainEthId == 1337 {
gasLimit = uint64(500 * 10000) gasLimit = uint64(500 * 10000)
} else { } else {
gasLimit, err := client.EstimateGas(context.Background(), msg) gasLimit, err = client.EstimateGas(context.Background(), msg)
if err != nil { if err != nil {
fmt.Println("EstimateGas Err:", err) fmt.Println("EstimateGas Err:", err)
return return
......
...@@ -46,7 +46,7 @@ function TestETH2Chain33Assets_proxy() { ...@@ -46,7 +46,7 @@ function TestETH2Chain33Assets_proxy() {
echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}" echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethBridgeBankBalancebf=$(${CLIA} ethereum balance -o "${ethBridgeBank}" | jq -r ".balance") ethBridgeBankBalancebf=$(${CLIP} ethereum balance -o "${ethBridgeBank}" | jq -r ".balance")
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
...@@ -57,16 +57,16 @@ function TestETH2Chain33Assets_proxy() { ...@@ -57,16 +57,16 @@ function TestETH2Chain33Assets_proxy() {
echo -e "${IYellow} lock ${NOC}" echo -e "${IYellow} lock ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${CLIA} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}") result=$(${CLIP} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 2 个区块 # eth 等待 2 个区块
sleep 4 sleep 4
echo -e "${IYellow} ethBridgeBank lock 后金额 ${NOC}" echo -e "${IYellow} ethBridgeBank lock 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let ethBridgeBankBalanceEnd=${ethBridgeBankBalancebf}+${lockAmount1} let ethBridgeBankBalanceEnd=ethBridgeBankBalancebf+lockAmount1
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
...@@ -77,7 +77,7 @@ function TestETH2Chain33Assets_proxy() { ...@@ -77,7 +77,7 @@ function TestETH2Chain33Assets_proxy() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})") result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33RBalancelock=${lockAmount1}*${le8}+${chain33RBalancebf} let chain33RBalancelock=lockAmount1*le8+chain33RBalancebf
is_equal "${result}" "${chain33RBalancelock}" is_equal "${result}" "${chain33RBalancelock}"
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}"
...@@ -86,21 +86,21 @@ function TestETH2Chain33Assets_proxy() { ...@@ -86,21 +86,21 @@ function TestETH2Chain33Assets_proxy() {
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethT2Balancebf=$(${CLIA} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance") ethT2Balancebf=$(${CLIP} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance")
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethPBalancebf=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance") ethPBalancebf=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance")
echo -e "${IYellow} withdraw ${NOC}" echo -e "${IYellow} withdraw ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${CLIA} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethTestAddr2}" -t "${chain33EthBridgeTokenAddr}") result=$(${CLIP} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethTestAddr2}" -t "${chain33EthBridgeTokenAddr}")
cli_ret "${result}" "withdraw" cli_ret "${result}" "withdraw"
sleep "${maturityDegree}" sleep "${maturityDegree}"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}"
...@@ -110,21 +110,20 @@ function TestETH2Chain33Assets_proxy() { ...@@ -110,21 +110,20 @@ function TestETH2Chain33Assets_proxy() {
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}"
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33Validatorsp})") result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33Validatorsp})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33VspBalancewithdraw=${lockAmount1}*${le8}+${chain33VspBalancebf} let chain33VspBalancewithdraw=lockAmount1*le8+chain33VspBalancebf
is_equal "${result}" "${chain33VspBalancewithdraw}" is_equal "${result}" "${chain33VspBalancewithdraw}"
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance")
# shellcheck disable=SC2219 ethT2BalanceEnd=$(echo "${ethT2Balancebf}+${lockAmount1}-1" | bc)
let ethT2BalanceEnd=${ethT2Balancebf}+${lockAmount1}-1
is_equal "${result}" "${ethT2BalanceEnd}" is_equal "${result}" "${ethT2BalanceEnd}"
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance")
if [[ $(echo "${ethPBalancebf}-${lockAmount1}+1 < $result" | bc) ]]; then if [[ $(echo "${ethPBalancebf}-${lockAmount1}+1 < $result" | bc) == 1 ]]; then
echo -e "${RED}error $ethPBalanceEnd 小于 $result, 应该大于 $ethPBalanceEnd 扣了一点点手续费 ${NOC}" echo -e "${RED}error $ethPBalanceEnd 小于 $result, 应该大于 $ethPBalanceEnd 扣了一点点手续费 ${NOC}"
# exit 1 exit 1
fi fi
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
...@@ -140,7 +139,7 @@ function TestETH2Chain33Assets_proxy_excess() { ...@@ -140,7 +139,7 @@ function TestETH2Chain33Assets_proxy_excess() {
echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}" echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethBridgeBankBalancebf=$(${CLIA} ethereum balance -o "${ethBridgeBank}" | jq -r ".balance") ethBridgeBankBalancebf=$(${CLIP} ethereum balance -o "${ethBridgeBank}" | jq -r ".balance")
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
...@@ -151,16 +150,16 @@ function TestETH2Chain33Assets_proxy_excess() { ...@@ -151,16 +150,16 @@ function TestETH2Chain33Assets_proxy_excess() {
echo -e "${IYellow} lock ${NOC}" echo -e "${IYellow} lock ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${CLIA} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}") result=$(${CLIP} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 2 个区块 # eth 等待 2 个区块
sleep 4 sleep 4
echo -e "${IYellow} ethBridgeBank lock 后金额 ${NOC}" echo -e "${IYellow} ethBridgeBank lock 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let ethBridgeBankBalanceEnd=${ethBridgeBankBalancebf}+${lockAmount1} let ethBridgeBankBalanceEnd=ethBridgeBankBalancebf+lockAmount1
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
...@@ -171,7 +170,7 @@ function TestETH2Chain33Assets_proxy_excess() { ...@@ -171,7 +170,7 @@ function TestETH2Chain33Assets_proxy_excess() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})") result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33RBalancelock=${lockAmount1}*${le8}+${chain33RBalancebf} let chain33RBalancelock=lockAmount1*le8+chain33RBalancebf
is_equal "${result}" "${chain33RBalancelock}" is_equal "${result}" "${chain33RBalancelock}"
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}"
...@@ -180,21 +179,21 @@ function TestETH2Chain33Assets_proxy_excess() { ...@@ -180,21 +179,21 @@ function TestETH2Chain33Assets_proxy_excess() {
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethT2Balancebf=$(${CLIA} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance") ethT2Balancebf=$(${CLIP} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance")
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethPBalancebf=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance") ethPBalancebf=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance")
echo -e "${IYellow} withdraw ${NOC}" echo -e "${IYellow} withdraw ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${CLIA} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethTestAddr2}" -t "${chain33EthBridgeTokenAddr}") result=$(${CLIP} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethTestAddr2}" -t "${chain33EthBridgeTokenAddr}")
cli_ret "${result}" "withdraw" cli_ret "${result}" "withdraw"
sleep "${maturityDegree}" sleep "${maturityDegree}"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}"
...@@ -204,15 +203,15 @@ function TestETH2Chain33Assets_proxy_excess() { ...@@ -204,15 +203,15 @@ function TestETH2Chain33Assets_proxy_excess() {
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}"
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33Validatorsp})") result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33Validatorsp})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33VspBalancewithdraw=${lockAmount1}*${le8}+${chain33VspBalancebf} let chain33VspBalancewithdraw=lockAmount1*le8+chain33VspBalancebf
is_equal "${result}" "${chain33VspBalancewithdraw}" is_equal "${result}" "${chain33VspBalancewithdraw}"
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 超额了金额跟之前一样${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 超额了金额跟之前一样${NOC}"
result=$(${CLIA} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethTestAddr2}" | jq -r ".balance")
is_equal "${result}" "${ethT2Balancebf}" is_equal "${result}" "${ethT2Balancebf}"
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 超额了金额跟之前一样${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 超额了金额跟之前一样${NOC}"
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" | jq -r ".balance")
is_equal "${result}" "${ethPBalancebf}" is_equal "${result}" "${ethPBalancebf}"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
...@@ -227,7 +226,7 @@ function TestETH2Chain33USDT_proxy() { ...@@ -227,7 +226,7 @@ function TestETH2Chain33USDT_proxy() {
echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}" echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethBridgeBankBalancebf=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") ethBridgeBankBalancebf=$(${CLIP} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
...@@ -237,16 +236,16 @@ function TestETH2Chain33USDT_proxy() { ...@@ -237,16 +236,16 @@ function TestETH2Chain33USDT_proxy() {
chain33VspBalancebf=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})") chain33VspBalancebf=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})")
echo -e "${IYellow} ETH 这端 lock $lockAmount1 个 USDT ${NOC}" echo -e "${IYellow} ETH 这端 lock $lockAmount1 个 USDT ${NOC}"
result=$(${CLIA} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumUSDTERC20TokenAddr}") result=$(${CLIP} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 2 个区块 # eth 等待 2 个区块
sleep 4 sleep 4
echo -e "${IYellow} 查询 ETH 这端 ethBridgeBank lock 后金额 ${NOC}" echo -e "${IYellow} 查询 ETH 这端 ethBridgeBank lock 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let ethBridgeBankBalanceEnd=${ethBridgeBankBalancebf}+${lockAmount1} let ethBridgeBankBalanceEnd=ethBridgeBankBalancebf+lockAmount1
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
sleep "${maturityDegree}" sleep "${maturityDegree}"
...@@ -256,7 +255,7 @@ function TestETH2Chain33USDT_proxy() { ...@@ -256,7 +255,7 @@ function TestETH2Chain33USDT_proxy() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})") result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33RBalancelock=${lockAmount1}*${le8}+${chain33RBalancebf} let chain33RBalancelock=lockAmount1*le8+chain33RBalancebf
is_equal "${result}" "${chain33RBalancelock}" is_equal "${result}" "${chain33RBalancelock}"
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}"
...@@ -265,20 +264,20 @@ function TestETH2Chain33USDT_proxy() { ...@@ -265,20 +264,20 @@ function TestETH2Chain33USDT_proxy() {
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethT2Balancebf=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") ethT2Balancebf=$(${CLIP} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethPBalancebf=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") ethPBalancebf=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
echo -e "${IYellow} withdraw ${NOC}" echo -e "${IYellow} withdraw ${NOC}"
result=$(${CLIA} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33USDTBridgeTokenAddr}") result=$(${CLIP} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33USDTBridgeTokenAddr}")
cli_ret "${result}" "withdraw" cli_ret "${result}" "withdraw"
sleep "${maturityDegree}" sleep "${maturityDegree}"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}"
...@@ -288,19 +287,18 @@ function TestETH2Chain33USDT_proxy() { ...@@ -288,19 +287,18 @@ function TestETH2Chain33USDT_proxy() {
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}"
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})") result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33VspBalancewithdraw=${lockAmount1}*${le8}+${chain33VspBalancebf} let chain33VspBalancewithdraw=lockAmount1*le8+chain33VspBalancebf
is_equal "${result}" "${chain33VspBalancewithdraw}" is_equal "${result}" "${chain33VspBalancewithdraw}"
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
# shellcheck disable=SC2219 ethT2BalanceEnd=$(echo "${ethT2Balancebf}+${lockAmount1}-1" | bc)
let ethT2BalanceEnd=${ethT2Balancebf}+${lockAmount1}-1
is_equal "${result}" "${ethT2BalanceEnd}" is_equal "${result}" "${ethT2BalanceEnd}"
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let ethPBalanceEnd=${ethPBalancebf}-${lockAmount1}+1 let ethPBalanceEnd=ethPBalancebf-lockAmount1+1
is_equal "${result}" "${ethPBalanceEnd}" is_equal "${result}" "${ethPBalanceEnd}"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
...@@ -315,7 +313,7 @@ function TestETH2Chain33USDT_proxy_excess() { ...@@ -315,7 +313,7 @@ function TestETH2Chain33USDT_proxy_excess() {
echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}" echo -e "${IYellow} ethBridgeBank 初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethBridgeBankBalancebf=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") ethBridgeBankBalancebf=$(${CLIP} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
...@@ -325,16 +323,16 @@ function TestETH2Chain33USDT_proxy_excess() { ...@@ -325,16 +323,16 @@ function TestETH2Chain33USDT_proxy_excess() {
chain33VspBalancebf=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})") chain33VspBalancebf=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})")
echo -e "${IYellow} ETH 这端 lock $lockAmount1 个 USDT ${NOC}" echo -e "${IYellow} ETH 这端 lock $lockAmount1 个 USDT ${NOC}"
result=$(${CLIA} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumUSDTERC20TokenAddr}") result=$(${CLIP} ethereum lock -m "${lockAmount1}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
# eth 等待 2 个区块 # eth 等待 2 个区块
sleep 4 sleep 4
echo -e "${IYellow} 查询 ETH 这端 ethBridgeBank lock 后金额 ${NOC}" echo -e "${IYellow} 查询 ETH 这端 ethBridgeBank lock 后金额 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let ethBridgeBankBalanceEnd=${ethBridgeBankBalancebf}+${lockAmount1} let ethBridgeBankBalanceEnd=ethBridgeBankBalancebf+lockAmount1
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
sleep "${maturityDegree}" sleep "${maturityDegree}"
...@@ -344,7 +342,7 @@ function TestETH2Chain33USDT_proxy_excess() { ...@@ -344,7 +342,7 @@ function TestETH2Chain33USDT_proxy_excess() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})") result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33RBalancelock=${lockAmount1}*${le8}+${chain33RBalancebf} let chain33RBalancelock=lockAmount1*le8+chain33RBalancebf
is_equal "${result}" "${chain33RBalancelock}" is_equal "${result}" "${chain33RBalancelock}"
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 lock 后金额 ${NOC}"
...@@ -353,20 +351,20 @@ function TestETH2Chain33USDT_proxy_excess() { ...@@ -353,20 +351,20 @@ function TestETH2Chain33USDT_proxy_excess() {
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethT2Balancebf=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") ethT2Balancebf=$(${CLIP} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址初始金额 ${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
ethPBalancebf=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") ethPBalancebf=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
echo -e "${IYellow} withdraw ${NOC}" echo -e "${IYellow} withdraw ${NOC}"
result=$(${CLIA} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33USDTBridgeTokenAddr}") result=$(${CLIP} chain33 withdraw -m "${lockAmount1}" -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33USDTBridgeTokenAddr}")
cli_ret "${result}" "withdraw" cli_ret "${result}" "withdraw"
sleep "${maturityDegree}" sleep "${maturityDegree}"
# 查询 ETH 这端 bridgeBank 地址 0 # 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}") result=$(${CLIP} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}" cli_ret "${result}" "balance" ".balance" "${ethBridgeBankBalanceEnd}"
echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33ReceiverAddr chain33 端 lock 后接收地址 withdraw 后金额 ${NOC}"
...@@ -376,15 +374,15 @@ function TestETH2Chain33USDT_proxy_excess() { ...@@ -376,15 +374,15 @@ function TestETH2Chain33USDT_proxy_excess() {
echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}" echo -e "${IYellow} chain33Validatorsp chain33 代理地址 withdraw 后金额 ${NOC}"
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})") result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33Validatorsp})")
# shellcheck disable=SC2219 # shellcheck disable=SC2219
let chain33VspBalancewithdraw=${lockAmount1}*${le8}+${chain33VspBalancebf} let chain33VspBalancewithdraw=lockAmount1*le8+chain33VspBalancebf
is_equal "${result}" "${chain33VspBalancewithdraw}" is_equal "${result}" "${chain33VspBalancewithdraw}"
echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 超额了金额跟之前一样 ${NOC}" echo -e "${IYellow} ethTestAddr2 ethereum withdraw 接收地址 withdraw 后金额 超额了金额跟之前一样 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
is_equal "${result}" "${ethT2Balancebf}" is_equal "${result}" "${ethT2Balancebf}"
echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 超额了金额跟之前一样 ${NOC}" echo -e "${IYellow} ethValidatorAddrp ethereum 代理地址 withdraw 后金额 超额了金额跟之前一样 ${NOC}"
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance") result=$(${CLIP} ethereum balance -o "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" | jq -r ".balance")
is_equal "${result}" "${ethPBalancebf}" is_equal "${result}" "${ethPBalancebf}"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
...@@ -399,7 +397,7 @@ function TestRelayerProxy() { ...@@ -399,7 +397,7 @@ function TestRelayerProxy() {
TestETH2Chain33Assets_proxy_excess 100 TestETH2Chain33Assets_proxy_excess 100
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${CLIA} ethereum token token_transfer -k "${ethTestAddrKey1}" -m 500 -r "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}" ${CLIP} ethereum token token_transfer -k "${ethTestAddrKey1}" -m 500 -r "${ethValidatorAddrp}" -t "${ethereumUSDTERC20TokenAddr}"
TestETH2Chain33USDT_proxy 20 TestETH2Chain33USDT_proxy 20
TestETH2Chain33USDT_proxy 40 TestETH2Chain33USDT_proxy 40
TestETH2Chain33USDT_proxy_excess 100 TestETH2Chain33USDT_proxy_excess 100
......
...@@ -66,7 +66,8 @@ function kill_ebrelayerD() { ...@@ -66,7 +66,8 @@ function kill_ebrelayerD() {
function start_ebrelayerC() { function start_ebrelayerC() {
nohup ./relayer_C/ebrelayer ./relayer_C/relayer.toml >./relayer_C/cross2eth_C.log 2>&1 & nohup ./relayer_C/ebrelayer ./relayer_C/relayer.toml >./relayer_C/cross2eth_C.log 2>&1 &
sleep 2 sleep 2
${CLIC} unlock -p ${validatorPwd} # shellcheck disable=SC2154
${CLIC} unlock -p "${validatorPwd}"
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -76,7 +77,7 @@ function start_ebrelayerC() { ...@@ -76,7 +77,7 @@ function start_ebrelayerC() {
function start_ebrelayerD() { function start_ebrelayerD() {
nohup ./relayer_D/ebrelayer ./relayer_D/relayer.toml >./relayer_D/cross2eth_D.log 2>&1 & nohup ./relayer_D/ebrelayer ./relayer_D/relayer.toml >./relayer_D/cross2eth_D.log 2>&1 &
sleep 2 sleep 2
${CLID} unlock -p ${validatorPwd} ${CLID} unlock -p "${validatorPwd}"
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ${Chain33Cli} send coins transfer -a 1 -n note -t 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
sleep ${maturityDegree} sleep ${maturityDegree}
...@@ -86,10 +87,10 @@ function start_ebrelayerD() { ...@@ -86,10 +87,10 @@ function start_ebrelayerD() {
function InitAndDeploy() { function InitAndDeploy() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} set_pwd -p ${validatorPwd}) result=$(${CLIA} set_pwd -p "${validatorPwd}")
cli_ret "${result}" "set_pwd" cli_ret "${result}" "set_pwd"
result=$(${CLIA} unlock -p ${validatorPwd}) result=$(${CLIA} unlock -p "${validatorPwd}")
cli_ret "${result}" "unlock" cli_ret "${result}" "unlock"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
...@@ -287,10 +288,10 @@ function updata_toml_start_BCD() { ...@@ -287,10 +288,10 @@ function updata_toml_start_BCD() {
sleep 2 sleep 2
CLI="./ebcli_$name" CLI="./ebcli_$name"
result=$(${CLI} set_pwd -p ${validatorPwd}) result=$(${CLI} set_pwd -p "${validatorPwd}")
cli_ret "${result}" "set_pwd" cli_ret "${result}" "set_pwd"
result=$(${CLI} unlock -p ${validatorPwd}) result=$(${CLI} unlock -p "${validatorPwd}")
cli_ret "${result}" "unlock" cli_ret "${result}" "unlock"
eval chain33ValidatorKey=\$chain33ValidatorKey${name} eval chain33ValidatorKey=\$chain33ValidatorKey${name}
...@@ -358,7 +359,7 @@ function StartRelayerAndDeploy() { ...@@ -358,7 +359,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer ebrelayer kill_ebrelayer ebrelayer
start_ebrelayerA start_ebrelayerA
result=$(${CLIA} unlock -p ${validatorPwd}) result=$(${CLIA} unlock -p "${validatorPwd}")
cli_ret "${result}" "unlock" cli_ret "${result}" "unlock"
# start ebrelayer B C D # start ebrelayer B C D
...@@ -526,7 +527,7 @@ function StartOneRelayer() { ...@@ -526,7 +527,7 @@ function StartOneRelayer() {
kill_ebrelayer ebrelayer kill_ebrelayer ebrelayer
start_ebrelayerA start_ebrelayerA
result=$(${CLIA} unlock -p ${validatorPwd}) result=$(${CLIA} unlock -p "${validatorPwd}")
cli_ret "${result}" "unlock" cli_ret "${result}" "unlock"
# 设置 token 地址 # 设置 token 地址
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
package types package types
import ( import (
reflect "reflect"
sync "sync"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
) )
const ( const (
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
package types package types
import ( import (
reflect "reflect"
sync "sync"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
) )
const ( const (
......
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