Commit 5c42a3b9 authored by QM's avatar QM

merge hzj/exchange_order_0929

parent e44ba57b
...@@ -19,6 +19,9 @@ chain33EthBridgeTokenAddr="" ...@@ -19,6 +19,9 @@ chain33EthBridgeTokenAddr=""
ethereumBycERC20TokenAddr="" ethereumBycERC20TokenAddr=""
chain33BycBridgeTokenAddr="" chain33BycBridgeTokenAddr=""
ethereumUSDTERC20TokenAddr=""
chain33USDTBridgeTokenAddr=""
chain33YccERC20TokenAddr="" chain33YccERC20TokenAddr=""
ethereumYccBridgeTokenAddr="" ethereumYccBridgeTokenAddr=""
...@@ -332,9 +335,9 @@ function TestETH2Chain33Assets() { ...@@ -332,9 +335,9 @@ function TestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function TestETH2Chain33Ycc() { function TestETH2Chain33Byc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}=========== eth to chain33 在以太坊上锁定 ycc 资产,然后在 chain33 上 burn ===========${NOC}" echo -e "${GRE}=========== eth to chain33 在以太坊上锁定 byc 资产,然后在 chain33 上 burn ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0 # 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}") result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0" cli_ret "${result}" "balance" ".balance" "0"
...@@ -402,6 +405,75 @@ function TestETH2Chain33Ycc() { ...@@ -402,6 +405,75 @@ function TestETH2Chain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function TestETH2Chain33USDT() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}=========== eth to chain33 在以太坊上锁定 USDT 资产,然后在 chain33 上 burn ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 12个 USDT
result=$(${CLIA} ethereum lock -m 12 -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "lock"
# eth 等待 2 个区块
sleep 4
# 查询 ETH 这端 bridgeBank 地址 12 USDT
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "12"
sleep ${maturityDegree}
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})")
# 结果是 12 * le8
is_equal "${result}" "1200000000"
# 原来的数额 0
result=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
echo '#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum'
result=$(${CLIA} chain33 burn -m 5 -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33USDTBridgeTokenAddr}")
cli_ret "${result}" "burn"
sleep ${maturityDegree}
echo "check the balance on chain33"
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})")
# 结果是 12-5 * le8
is_equal "${result}" "700000000"
# 查询 ETH 这端 bridgeBank 地址 7
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "7"
# 更新后的金额 5
result=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "5"
echo '#5.burn USDT from Chain33 USDT(Chain33)-----> Ethereum'
result=$(${CLIA} chain33 burn -m 7 -k "${chain33ReceiverAddrKey}" -r "${ethReceiverAddr1}" -t "${chain33USDTBridgeTokenAddr}")
cli_ret "${result}" "burn"
sleep ${maturityDegree}
echo "check the balance on chain33"
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})")
is_equal "${result}" "0"
# 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
# 更新后的金额 12
result=$(${CLIA} ethereum balance -o "${ethReceiverAddr1}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "12"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# shellcheck disable=SC2120 # shellcheck disable=SC2120
function offline_set_offline_token_Bty() { function offline_set_offline_token_Bty() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
...@@ -455,7 +527,7 @@ function offline_set_offline_token_Eth() { ...@@ -455,7 +527,7 @@ function offline_set_offline_token_Eth() {
} }
# shellcheck disable=SC2120 # shellcheck disable=SC2120
function offline_set_offline_token_EthYcc() { function offline_set_offline_token_EthByc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
local threshold=100 local threshold=100
local percents=40 local percents=40
...@@ -470,6 +542,22 @@ function offline_set_offline_token_EthYcc() { ...@@ -470,6 +542,22 @@ function offline_set_offline_token_EthYcc() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
# shellcheck disable=SC2120
function offline_set_offline_token_EthUSDT() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
local threshold=100
local percents=40
if [[ $# -eq 2 ]]; then
threshold=$1
percents=$2
fi
# shellcheck disable=SC2086
${Boss4xCLI} ethereum offline set_offline_token -s USDT -m ${threshold} -p ${percents} -t "${ethereumUSDTERC20TokenAddr}" -c "${ethBridgeBank}" -d "${ethDeployAddr}"
ethereum_offline_sign_send "set_offline_token.txt"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function offline_transfer_multisign_Bty_test() { function offline_transfer_multisign_Bty_test() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# transfer test # transfer test
...@@ -532,6 +620,12 @@ function initPara() { ...@@ -532,6 +620,12 @@ function initPara() {
coins_cross_transfer "${chain33DeployKey}" "${chain33DeployAddr}" 1000 800 500 coins_cross_transfer "${chain33DeployKey}" "${chain33DeployAddr}" 1000 800 500
coins_cross_transfer "${chain33TestAddrKey1}" "${chain33TestAddr1}" 1000 800 500 coins_cross_transfer "${chain33TestAddrKey1}" "${chain33TestAddr1}" 1000 800 500
coins_cross_transfer "${chain33TestAddrKey2}" "${chain33TestAddr2}" 1000 800 500 coins_cross_transfer "${chain33TestAddrKey2}" "${chain33TestAddr2}" 1000 800 500
# 平行链共识节点增加测试币
${MainCli} send coins transfer -a 1000 -n test -t "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4" -k "${chain33ReceiverAddrKey}"
${MainCli} send coins transfer -a 1000 -n test -t "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR" -k "${chain33ReceiverAddrKey}"
${MainCli} send coins transfer -a 1000 -n test -t "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k" -k "${chain33ReceiverAddrKey}"
${MainCli} send coins transfer -a 1000 -n test -t "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -k "${chain33ReceiverAddrKey}"
} }
# lock bty 判断是否转入多签地址金额是否正确 # lock bty 判断是否转入多签地址金额是否正确
...@@ -602,24 +696,45 @@ function lockEth() { ...@@ -602,24 +696,45 @@ function lockEth() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function lockEthYcc() { function lockEthByc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== ethereum 端 lock ERC20 Byc ======${NOC}"
# echo '2:#配置自动转离线钱包(ycc, 100, 40%)'
offline_set_offline_token_EthByc
# 重启 nonce 会不统一 要重启一下
restart_ebrelayerA
lock_ethereum_byc_multisign 70 70 0
lock_ethereum_byc_multisign 30 60 40
lock_ethereum_byc_multisign 60 72 88
# multisignEthAddr 要有手续费
${CLIA} ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}"
sleep 10
# transfer
offline_transfer_multisign_EthByc
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function lockEthUSDT() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo -e "${GRE}===== ethereum 端 lock ERC20 YCC ======${NOC}" echo -e "${GRE}===== ethereum 端 lock ERC20 USDT ======${NOC}"
# echo '2:#配置自动转离线钱包(ycc, 100, 40%)' # echo '2:#配置自动转离线钱包(ycc, 100, 40%)'
offline_set_offline_token_EthYcc offline_set_offline_token_EthUSDT
# 重启 nonce 会不统一 要重启一下 # 重启 nonce 会不统一 要重启一下
restart_ebrelayerA restart_ebrelayerA
lock_ethereum_ycc_multisign 70 70 0 lock_ethereum_usdt_multisign 70 70 0
lock_ethereum_ycc_multisign 30 60 40 lock_ethereum_usdt_multisign 30 60 40
lock_ethereum_ycc_multisign 60 72 88 lock_ethereum_usdt_multisign 60 72 88
# multisignEthAddr 要有手续费 # multisignEthAddr 要有手续费
${CLIA} ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}" ${CLIA} ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}"
sleep 10 sleep 10
# transfer # transfer
offline_transfer_multisign_EthYcc offline_transfer_multisign_EthUSDT
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
...@@ -701,11 +816,14 @@ function StartDockerRelayerDeploy() { ...@@ -701,11 +816,14 @@ function StartDockerRelayerDeploy() {
offline_create_bridge_token_eth_YCC offline_create_bridge_token_eth_YCC
offline_deploy_erc20_chain33_ZBC offline_deploy_erc20_chain33_ZBC
offline_create_bridge_token_eth_ZBC offline_create_bridge_token_eth_ZBC
offline_deploy_erc20_eth_USDT
offline_create_bridge_token_chain33_USDT
# shellcheck disable=SC2086 # shellcheck disable=SC2086
{ {
docker cp "${chain33EthBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33EthBridgeTokenAddr}.abi docker cp "${chain33EthBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33EthBridgeTokenAddr}.abi
docker cp "${chain33BycBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33BycBridgeTokenAddr}.abi docker cp "${chain33BycBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33BycBridgeTokenAddr}.abi
docker cp "${chain33USDTBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33USDTBridgeTokenAddr}.abi
docker cp "${chain33YccERC20TokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33YccERC20TokenAddr}.abi docker cp "${chain33YccERC20TokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33YccERC20TokenAddr}.abi
docker cp "${ethereumYccBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${ethereumYccBridgeTokenAddr}.abi docker cp "${ethereumYccBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${ethereumYccBridgeTokenAddr}.abi
} }
...@@ -725,8 +843,10 @@ function echo_addrs() { ...@@ -725,8 +843,10 @@ function echo_addrs() {
echo -e "${GRE}chain33BtyERC20TokenAddr: ${chain33BtyERC20TokenAddr} ${NOC}" echo -e "${GRE}chain33BtyERC20TokenAddr: ${chain33BtyERC20TokenAddr} ${NOC}"
echo -e "${GRE}chain33EthBridgeTokenAddr: ${chain33EthBridgeTokenAddr} ${NOC}" echo -e "${GRE}chain33EthBridgeTokenAddr: ${chain33EthBridgeTokenAddr} ${NOC}"
echo -e "${GRE}ethereumBtyBridgeTokenAddr: ${ethereumBtyBridgeTokenAddr} ${NOC}" echo -e "${GRE}ethereumBtyBridgeTokenAddr: ${ethereumBtyBridgeTokenAddr} ${NOC}"
echo -e "${GRE}chain33BycBridgeTokenAddr: ${chain33BycBridgeTokenAddr} ${NOC}"
echo -e "${GRE}ethereumBycERC20TokenAddr: ${ethereumBycERC20TokenAddr} ${NOC}" echo -e "${GRE}ethereumBycERC20TokenAddr: ${ethereumBycERC20TokenAddr} ${NOC}"
echo -e "${GRE}chain33BycBridgeTokenAddr: ${chain33BycBridgeTokenAddr} ${NOC}"
echo -e "${GRE}ethereumUSDTERC20TokenAddr: ${ethereumUSDTERC20TokenAddr} ${NOC}"
echo -e "${GRE}chain33USDTBridgeTokenAddr: ${chain33USDTBridgeTokenAddr} ${NOC}"
echo -e "${GRE}chain33YccERC20TokenAddr: ${chain33YccERC20TokenAddr} ${NOC}" echo -e "${GRE}chain33YccERC20TokenAddr: ${chain33YccERC20TokenAddr} ${NOC}"
echo -e "${GRE}ethereumYccBridgeTokenAddr: ${ethereumYccBridgeTokenAddr} ${NOC}" echo -e "${GRE}ethereumYccBridgeTokenAddr: ${ethereumYccBridgeTokenAddr} ${NOC}"
echo -e "${GRE}chain33ZbcERC20TokenAddr: ${chain33ZbcERC20TokenAddr} ${NOC}" echo -e "${GRE}chain33ZbcERC20TokenAddr: ${chain33ZbcERC20TokenAddr} ${NOC}"
...@@ -786,6 +906,9 @@ function DeployEvmxgo() { ...@@ -786,6 +906,9 @@ function DeployEvmxgo() {
${EvmxgoBoss4xCLI} chain33 offline create_add_lock_list -s BYC -t "${chain33BycBridgeTokenAddr}" -c "${XgoChain33BridgeBank}" -k "${chain33DeployKey}" -f 1 --chainID "${chain33ID}" ${EvmxgoBoss4xCLI} chain33 offline create_add_lock_list -s BYC -t "${chain33BycBridgeTokenAddr}" -c "${XgoChain33BridgeBank}" -k "${chain33DeployKey}" -f 1 --chainID "${chain33ID}"
chain33_offline_send_evm "create_add_lock_list.txt" chain33_offline_send_evm "create_add_lock_list.txt"
${EvmxgoBoss4xCLI} chain33 offline create_add_lock_list -s USDT -t "${chain33USDTBridgeTokenAddr}" -c "${XgoChain33BridgeBank}" -k "${chain33DeployKey}" -f 1 --chainID "${chain33ID}"
chain33_offline_send_evm "create_add_lock_list.txt"
# 重启,需要重新启动relayer,更新nonce # 重启,需要重新启动relayer,更新nonce
restart_ebrelayerA restart_ebrelayerA
} }
...@@ -896,6 +1019,45 @@ function Testethereum2EVMToChain33_byc() { ...@@ -896,6 +1019,45 @@ function Testethereum2EVMToChain33_byc() {
# is_equal "${result}" "500000000" # is_equal "${result}" "500000000"
} }
function Testethereum2EVMToChain33_usdt() {
# 查询 ETH 这端 bridgeBank 地址原来是
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
# cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 12个
result=$(${CLIA} ethereum lock -m 12 -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "lock"
# eth 等待 2 个区块
sleep 4
# 查询 ETH 这端 bridgeBank 地址 12
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
# cli_ret "${result}" "balance" ".balance" "12"
sleep ${maturityDegree}
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33TestAddr1}" -b "balanceOf(${chain33ReceiverAddr})")
# 结果是 7 * le8
# is_equal "${result}" "700000000"
updateConfig "USDT" "${chain33USDTBridgeTokenAddr}"
configbridgevmxgoAddr "${XgoChain33BridgeBank}"
${EvmxgoBoss4xCLI} chain33 offline approve_erc20 -a 330000000000 -s "${XgoChain33BridgeBank}" -c "${chain33USDTBridgeTokenAddr}" -k "${chain33ReceiverAddrKey}" -f 1 --chainID "${chain33ID}"
chain33_offline_send_evm "approve_erc20.txt"
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33ReceiverAddr}" -e "${XgoChain33BridgeBank}" -p "lock(${chain33TestAddr2}, ${chain33USDTBridgeTokenAddr}, 500000000)" --chainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}"
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
# is_equal "${result}" "4200000000"
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${XgoChain33BridgeBank})")
# is_equal "${result}" "500000000"
}
function AllRelayerMainTest() { function AllRelayerMainTest() {
set +e set +e
...@@ -943,32 +1105,29 @@ function AllRelayerMainTest() { ...@@ -943,32 +1105,29 @@ function AllRelayerMainTest() {
TestChain33ToEthAssets TestChain33ToEthAssets
TestETH2Chain33Assets TestETH2Chain33Assets
TestChain33ToEthZBCAssets TestChain33ToEthZBCAssets
TestETH2Chain33Ycc TestETH2Chain33Byc
TestETH2Chain33USDT
Chain33Cli=${Para8901Cli} Chain33Cli=${Para8901Cli}
lockBty lockBty
lockChain33Ycc lockChain33Ycc
lockEth lockEth
lockEthYcc lockEthByc
lockEthUSDT
# 离线多签地址转入阈值设大 # 离线多签地址转入阈值设大
offline_set_offline_token_Bty 100000000000000 10 offline_set_offline_token_Bty 100000000000000 10
offline_set_offline_token_Chain33Ycc 100000000000000 10 offline_set_offline_token_Chain33Ycc 100000000000000 10
offline_set_offline_token_Eth 100000000000000 10 offline_set_offline_token_Eth 100000000000000 10
offline_set_offline_token_EthYcc 100000000000000 10 offline_set_offline_token_EthByc 100000000000000 10
offline_set_offline_token_EthUSDT 100000000000000 10
EvmxgoBoss4xCLI="./evmxgoboss4x --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para." EvmxgoBoss4xCLI="./evmxgoboss4x --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
DeployEvmxgo DeployEvmxgo
TestETH2EVMToChain33 TestETH2EVMToChain33
Testethereum2EVMToChain33_byc
# 平行链共识节点增加测试币 Testethereum2EVMToChain33_usdt
${MainCli} send coins transfer -a 1000 -n test -t "1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4" -k "${chain33ReceiverAddrKey}"
${MainCli} send coins transfer -a 1000 -n test -t "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR" -k "${chain33ReceiverAddrKey}"
${MainCli} send coins transfer -a 1000 -n test -t "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k" -k "${chain33ReceiverAddrKey}"
${MainCli} send coins transfer -a 1000 -n test -t "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" -k "${chain33ReceiverAddrKey}"
echo_addrs echo_addrs
Testethereum2EVMToChain33_byc
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
...@@ -99,7 +99,7 @@ function InitAndOfflineDeploy() { ...@@ -99,7 +99,7 @@ function InitAndOfflineDeploy() {
} }
function offline_deploy_erc20_eth_BYC() { function offline_deploy_erc20_eth_BYC() {
# eth 上 铸币 YCC # eth 上 铸币 BYC
echo -e "${GRE}======= 在 ethereum 上创建 ERC20 BYC ======${NOC}" echo -e "${GRE}======= 在 ethereum 上创建 ERC20 BYC ======${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${Boss4xCLI} ethereum offline create_erc20 -m 33000000000000000000 -s BYC -o "${ethTestAddr1}" -d "${ethDeployAddr}" ${Boss4xCLI} ethereum offline create_erc20 -m 33000000000000000000 -s BYC -o "${ethTestAddr1}" -d "${ethDeployAddr}"
...@@ -114,8 +114,24 @@ function offline_deploy_erc20_eth_BYC() { ...@@ -114,8 +114,24 @@ function offline_deploy_erc20_eth_BYC() {
ethereum_offline_sign_send "create_add_lock_list.txt" ethereum_offline_sign_send "create_add_lock_list.txt"
} }
function offline_deploy_erc20_eth_USDT() {
# eth 上 铸币 USDT
echo -e "${GRE}======= 在 ethereum 上创建 ERC20 USDT ======${NOC}"
# shellcheck disable=SC2154
${Boss4xCLI} ethereum offline create_erc20 -m 33000000000000000000 -s USDT -o "${ethTestAddr1}" -d "${ethDeployAddr}"
${Boss4xCLI} ethereum offline sign -f "deployErc20USDT.txt" -k "${ethDeployKey}"
sleep 10
result=$(${Boss4xCLI} ethereum offline send -f "deploysigntxs.txt")
hash=$(echo "${result}" | jq -r ".[0].TxHash")
check_eth_tx "${hash}"
ethereumUSDTERC20TokenAddr=$(echo "${result}" | jq -r ".[0].ContractAddr")
${Boss4xCLI} ethereum offline create_add_lock_list -s USDT -t "${ethereumUSDTERC20TokenAddr}" -c "${ethBridgeBank}" -d "${ethDeployAddr}"
ethereum_offline_sign_send "create_add_lock_list.txt"
}
function offline_create_bridge_token_chain33_BYC() { function offline_create_bridge_token_chain33_BYC() {
# 在chain33上创建bridgeToken YCC # 在chain33上创建bridgeToken BYC
echo -e "${GRE}======= 在 chain33 上创建 bridgeToken BYC ======${NOC}" echo -e "${GRE}======= 在 chain33 上创建 bridgeToken BYC ======${NOC}"
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${Boss4xCLI} chain33 offline create_bridge_token -c "${chain33BridgeBank}" -s BYC -k "${chain33DeployKey}" --chainID "${chain33ID}" ${Boss4xCLI} chain33 offline create_bridge_token -c "${chain33BridgeBank}" -s BYC -k "${chain33DeployKey}" --chainID "${chain33ID}"
...@@ -131,6 +147,23 @@ function offline_create_bridge_token_chain33_BYC() { ...@@ -131,6 +147,23 @@ function offline_create_bridge_token_chain33_BYC() {
${CLIA} chain33 token set -t "${chain33BycBridgeTokenAddr}" -s BYC ${CLIA} chain33 token set -t "${chain33BycBridgeTokenAddr}" -s BYC
} }
function offline_create_bridge_token_chain33_USDT() {
# 在chain33上创建bridgeToken USDT
echo -e "${GRE}======= 在 chain33 上创建 bridgeToken USDT ======${NOC}"
# shellcheck disable=SC2154
${Boss4xCLI} chain33 offline create_bridge_token -c "${chain33BridgeBank}" -s USDT -k "${chain33DeployKey}" --chainID "${chain33ID}"
chain33_offline_send "create_bridge_token.txt"
chain33USDTBridgeTokenAddr=$(${Chain33Cli} evm query -a "${chain33BridgeBank}" -c "${chain33DeployAddr}" -b "getToken2address(USDT)")
echo "USDT Bridge Token Addr = ${chain33USDTBridgeTokenAddr}"
cp BridgeToken.abi "${chain33USDTBridgeTokenAddr}.abi"
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33USDTBridgeTokenAddr}" -b "symbol()")
is_equal "${result}" "USDT"
${CLIA} chain33 token set -t "${chain33USDTBridgeTokenAddr}" -s USDT
}
function offline_deploy_erc20_chain33_YCC() { function offline_deploy_erc20_chain33_YCC() {
# chain33 token create YCC # chain33 token create YCC
echo -e "${GRE}======= 在 chain33 上创建 ERC20 YCC ======${NOC}" echo -e "${GRE}======= 在 chain33 上创建 ERC20 YCC ======${NOC}"
...@@ -278,7 +311,7 @@ function offline_transfer_multisign_Eth_test() { ...@@ -278,7 +311,7 @@ function offline_transfer_multisign_Eth_test() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function offline_transfer_multisign_EthYcc() { function offline_transfer_multisign_EthByc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# transfer # transfer
${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 8 -r "${ethBridgeBank}" -c "${multisignEthAddr}" -d "${ethTestAddr1}" -t "${ethereumBycERC20TokenAddr}" ${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 8 -r "${ethBridgeBank}" -c "${multisignEthAddr}" -d "${ethTestAddr1}" -t "${ethereumBycERC20TokenAddr}"
...@@ -307,6 +340,35 @@ function offline_transfer_multisign_EthYcc() { ...@@ -307,6 +340,35 @@ function offline_transfer_multisign_EthYcc() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
} }
function offline_transfer_multisign_EthUSDT() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# transfer
${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 8 -r "${ethBridgeBank}" -c "${multisignEthAddr}" -d "${ethTestAddr1}" -t "${ethereumUSDTERC20TokenAddr}"
${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline create_multisign_tx
ethereum_offline_sign_send create_multisign_tx.txt "${ethTestAddrKey1}"
sleep 10
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "80"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "80"
# transfer
# ${CLIA} ethereum multisign transfer -a 10 -r "${ethMultisignA}" -o "${ethValidatorAddrKeyB}" -t "${ethereumUSDTERC20TokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline multisign_transfer_prepare -a 10 -r "${ethMultisignA}" -c "${multisignEthAddr}" -d "${ethTestAddr1}" -t "${ethereumUSDTERC20TokenAddr}"
${Boss4xCLI} ethereum offline sign_multisign_tx -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
${Boss4xCLI} ethereum offline create_multisign_tx
ethereum_offline_sign_send create_multisign_tx.txt "${ethTestAddrKey1}"
sleep 10
result=$(${CLIA} ethereum balance -o "${ethMultisignA}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "10"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "70"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function offline_transfer_multisign_Chain33Ycc_test() { function offline_transfer_multisign_Chain33Ycc_test() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}" echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# transfer test # transfer test
......
...@@ -636,7 +636,7 @@ function lock_eth_multisign() { ...@@ -636,7 +636,7 @@ function lock_eth_multisign() {
} }
# lock ethereum ycc erc20 判断是否转入多签地址金额是否正确 # lock ethereum ycc erc20 判断是否转入多签地址金额是否正确
function lock_ethereum_ycc_multisign() { function lock_ethereum_byc_multisign() {
local lockAmount=$1 local lockAmount=$1
result=$(${CLIA} ethereum lock -m "${lockAmount}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumBycERC20TokenAddr}") result=$(${CLIA} ethereum lock -m "${lockAmount}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "lock" cli_ret "${result}" "lock"
...@@ -656,6 +656,26 @@ function lock_ethereum_ycc_multisign() { ...@@ -656,6 +656,26 @@ function lock_ethereum_ycc_multisign() {
fi fi
} }
function lock_ethereum_usdt_multisign() {
local lockAmount=$1
# shellcheck disable=SC2154
result=$(${CLIA} ethereum lock -m "${lockAmount}" -k "${ethTestAddrKey1}" -r "${chain33ReceiverAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "lock"
if [[ $# -eq 3 ]]; then
local bridgeBankBalance=$2
local multisignBalance=$3
# eth 等待 2 个区块
sleep 4
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "${bridgeBankBalance}"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" -t "${ethereumUSDTERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "${multisignBalance}"
fi
}
# 检查交易是否执行成功 $1:交易hash # 检查交易是否执行成功 $1:交易hash
function check_eth_tx() { function check_eth_tx() {
local tx=${1} local tx=${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