Commit 63d58991 authored by QM's avatar QM Committed by vipwzw

delete shell

parent a9fa9d1f
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set -x
set +e
source "./publicTest.sh"
source "./relayerPublic.sh"
# ETH 部署合约者的私钥 用于部署合约时签名使用
#ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a"
ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
ethSendAddress=0x495953A743ef169EC5D4aC7b5F786BF2Bd56aFd5
ethSendPrivateKeys=0x2809477ede1261da21270096776ba7dc68b89c9df5f029965eaa5fe7f0b80697
# validatorsAddr=["0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
#ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
# chain33 部署合约者的私钥 用于部署合约时签名使用
chain33DeployAddr="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ"
#chain33DeployKey="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
chain33ReceiverAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
chain33ReceiverAddrKey="4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01"
#maturityDegree=10
Chain33Cli="../../chain33-cli"
chain33BridgeBank=""
#ethBridgeBank=""
chain33BtyERC20TokenAddr="1111111111111111111114oLvT2"
chain33EthBridgeTokenAddr=""
ethereumBtyBridgeTokenAddr=""
chain33BycBridgeTokenAddr=""
ethereumBycERC20TokenAddr=""
CLIA="./ebcli_A"
chain33ID=0
# chain33 lock BTY, eth burn BTY
function LockTestChain33ToEthAssets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# chain33 lock bty
hash=$(${Chain33Cli} send evm call -f 1 -a 1 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethSendAddress}, ${chain33BtyERC20TokenAddr}, 100000000)" --khainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# chain33 lock BTY, eth burn BTY
function BurnTestChain33ToEthAssets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# eth burn
result=$(${CLIA} ethereum burn -m 1 -k "${ethSendPrivateKeys}" -r "${chain33DeployAddr}" -t "${ethereumBtyBridgeTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# eth to chain33 在以太坊上锁定 ETH 资产,然后在 chain33 上 burn
function LockTestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# ETH 这端 lock 11个
result=$(${CLIA} ethereum lock -m 2 -k "${ethSendPrivateKeys}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# eth to chain33 在以太坊上锁定 ETH 资产,然后在 chain33 上 burn
function BurnTestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} chain33 burn -m 2 -k "${chain33ReceiverAddrKey}" -r "${ethSendAddress}" -t "${chain33EthBridgeTokenAddr}")
cli_ret "${result}" "burn"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function LockTestETH2Chain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# ETH 这端 lock 3个 BYC
result=$(${CLIA} ethereum lock -m 3 -k "${ethSendPrivateKeys}" -r "${chain33ReceiverAddr}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "lock"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function BurnTestETH2Chain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
echo '#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum'
result=$(${CLIA} chain33 burn -m 3 -k "${chain33ReceiverAddrKey}" -r "${ethSendAddress}" -t "${chain33BycBridgeTokenAddr}")
cli_ret "${result}" "burn"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function mainTest() {
StartChain33
start_trufflesuite
AllRelayerStart
${CLIA} ethereum token token_transfer -k "${ethDeployKey}" -m 10000 -r "${ethSendAddress}" -t "${ethereumBycERC20TokenAddr}"
for ((i = 0; i < 10; i++)); do
LockTestChain33ToEthAssets
LockTestETH2Chain33Assets
LockTestETH2Chain33Ycc
sleep 1
done
while true; do
LockTestChain33ToEthAssets
LockTestETH2Chain33Assets
LockTestETH2Chain33Ycc
eth_block_wait 2
BurnTestChain33ToEthAssets
BurnTestETH2Chain33Assets
BurnTestETH2Chain33Ycc
eth_block_wait 10
done
}
mainTest
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set -x
set +e
source "./publicTest.sh"
source "./relayerPublic.sh"
# ETH 部署合约者的私钥 用于部署合约时签名使用
ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a"
ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
# chain33 部署合约者的私钥 用于部署合约时签名使用
chain33DeployAddr="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ"
#chain33DeployKey="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
#maturityDegree=10
Chain33Cli="../../chain33-cli"
chain33BridgeBank=""
ethBridgeBank=""
chain33BtyERC20TokenAddr="1111111111111111111114oLvT2"
#chain33EthBridgeTokenAddr=""
#ethereumBtyBridgeTokenAddr=""
#chain33BycBridgeTokenAddr=""
ethereumBycERC20TokenAddr=""
multisignChain33Addr=""
multisignEthAddr=""
ethereumYccBridgeTokenAddr=""
chain33YccERC20TokenAddr=""
CLIA="./ebcli_A"
chain33ID=0
chain33BridgeBank=16A3uxgPqCv5pVkKqtdVnv2As6DbfRVZRH
multisignChain33Addr=1b193HbfvVUunUL2DVXrqt9jnbAWwLjcT
function lockBty() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(bty, 100, 50%)'
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e ${chain33BridgeBank} -p "configLockedTokenOfflineSave(${chain33BtyERC20TokenAddr},BTY,10000000000,50)" --khainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}"
result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
# balance_ret "${result}" "0"
result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "0"
for ((i = 0; i < 1000; i++)); do
echo "${i}"
lock_bty_multisign 1
sleep 1
done
result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
# balance_ret "${result}" "50"
result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "950"
# # transfer test
# hash=$(${CLIA} chain33 multisign transfer -a 100 -r "${chain33BridgeBank}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
# check_tx "${Chain33Cli}" "${hash}"
# sleep 2
# result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "997.5000"
# result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
# balance_ret "${result}" "632.5000"
#
# hash=$(${CLIA} chain33 multisign transfer -a 100 -r "${chain33MultisignA}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
# check_tx "${Chain33Cli}" "${hash}"
# sleep 2
# result=$(${Chain33Cli} account balance -a "${multisignChain33Addr}" -e evm)
# balance_ret "${result}" "897.5000"
# result=$(${Chain33Cli} account balance -a "${chain33MultisignA}" -e evm)
# balance_ret "${result}" "100.0000"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function lockChain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(YCC, 100, 60%)'
hash=$(${Chain33Cli} send evm call -f 1 -k "${chain33DeployAddr}" -e ${chain33BridgeBank} -p "configLockedTokenOfflineSave(${chain33YccERC20TokenAddr},YCC,10000000000,60)" --chainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}"
lock_chain33_ycc_multisign 30 30 0
lock_chain33_ycc_multisign 70 40 60
lock_chain33_ycc_multisign 260 120 240
lock_chain33_ycc_multisign 10 52 318
# transfer test
# shellcheck disable=SC2154
hash=$(${CLIA} chain33 multisign transfer -a 10 -r "${chain33BridgeBank}" -t "${chain33YccERC20TokenAddr}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
check_tx "${Chain33Cli}" "${hash}"
sleep 2
result=$(${Chain33Cli} evm query -a "${chain33YccERC20TokenAddr}" -c "${chain33BridgeBank}" -b "balanceOf(${chain33BridgeBank})")
is_equal "${result}" "6200000000"
result=$(${Chain33Cli} evm query -a "${chain33YccERC20TokenAddr}" -c "${multisignChain33Addr}" -b "balanceOf(${multisignChain33Addr})")
is_equal "${result}" "30800000000"
# shellcheck disable=SC2154
hash=$(${CLIA} chain33 multisign transfer -a 5 -r "${chain33MultisignA}" -t "${chain33YccERC20TokenAddr}" -k "${chain33MultisignKeyA},${chain33MultisignKeyB},${chain33MultisignKeyC},${chain33MultisignKeyD}" | jq -r ".msg")
check_tx "${Chain33Cli}" "${hash}"
sleep 2
result=$(${Chain33Cli} evm query -a "${chain33YccERC20TokenAddr}" -c "${chain33MultisignA}" -b "balanceOf(${chain33MultisignA})")
is_equal "${result}" "500000000"
result=$(${Chain33Cli} evm query -a "${chain33YccERC20TokenAddr}" -c "${multisignChain33Addr}" -b "balanceOf(${multisignChain33Addr})")
is_equal "${result}" "30300000000"
# 判断 ETH 这端是否金额一致
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumYccBridgeTokenAddr}")
cli_ret "${result}" "balance" ".balance" "370"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function lockEth() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(eth, 20, 50%)'
result=$(${CLIA} ethereum multisign set_offline_token -s ETH -m 20)
cli_ret "${result}" "set_offline_token -s ETH -m 20"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
cli_ret "${result}" "balance" ".balance" "0"
lock_eth_multisign 19 19 0
lock_eth_multisign 1 10 10
lock_eth_multisign 16 13 23
# transfer
# shellcheck disable=SC2154
${CLIA} ethereum multisign transfer -a 3 -r "${ethBridgeBank}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
sleep 2
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "16"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
cli_ret "${result}" "balance" ".balance" "20"
# transfer
# shellcheck disable=SC2154
${CLIA} ethereum multisign transfer -a 5 -r "${ethMultisignA}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
sleep 2
result=$(${CLIA} ethereum balance -o "${ethMultisignA}")
cli_ret "${result}" "balance" ".balance" "105"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}")
cli_ret "${result}" "balance" ".balance" "15"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function lockEthYcc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# echo '2:#配置自动转离线钱包(ycc, 100, 40%)'
result=$(${CLIA} ethereum multisign set_offline_token -s BYC -m 100 -p 40 -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "set_offline_token -s YCC -m 100"
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
lock_ethereum_ycc_multisign 70 70 0
lock_ethereum_ycc_multisign 30 60 40
lock_ethereum_ycc_multisign 60 72 88
# transfer
# multisignEthAddr 要有手续费
./ebcli_A ethereum transfer -k "${ethDeployKey}" -m 10 -r "${multisignEthAddr}"
# transfer
${CLIA} ethereum multisign transfer -a 8 -r "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
sleep 2
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "80"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "80"
# transfer
${CLIA} ethereum multisign transfer -a 10 -r "${ethMultisignA}" -t "${ethereumBycERC20TokenAddr}" -k "${ethMultisignKeyA},${ethMultisignKeyB},${ethMultisignKeyC},${ethMultisignKeyD}"
sleep 2
result=$(${CLIA} ethereum balance -o "${ethMultisignA}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "10"
result=$(${CLIA} ethereum balance -o "${multisignEthAddr}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "70"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# shellcheck disable=SC2120
function mainTest() {
if [[ $# -ge 1 && ${1} != "" ]]; then
chain33ID="${1}"
fi
StartChain33
start_trufflesuite
AllRelayerStart
deployMultisign
lockBty
# lockChain33Ycc
# lockEth
# lockEthYcc
}
mainTest "${1}"
#lockBty
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set -x
set +e
source "./publicTest.sh"
source "./relayerPublic.sh"
# chain33 部署合约者的私钥 用于部署合约时签名使用
chain33DeployAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
#chain33DeployKey="0xcc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
# ETH 部署合约者的私钥 用于部署合约时签名使用
ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a"
ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
# validatorsAddr=["0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
#ethValidatorAddrA="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a"
ethValidatorAddrKeyA="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
chain33ReceiverAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
chain33ReceiverAddrKey="4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01"
ethValidatorAddrB="0x0df9a824699bc5878232c9e612fe1a5346a5a368"
#ethValidatorAddrKeyB="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
maturityDegree=10
Chain33Cli="../../chain33-cli"
CLIA="./ebcli_A"
chain33ID=0
#BridgeRegistryOnChain33=""
chain33BridgeBank=""
#BridgeRegistryOnEth=""
ethBridgeBank=""
chain33BtyERC20TokenAddr="1111111111111111111114oLvT2"
chain33EthBridgeTokenAddr=""
ethereumBtyBridgeTokenAddr=""
chain33BycBridgeTokenAddr=""
ethereumBycERC20TokenAddr=""
# chain33 lock BTY, eth burn BTY
function TestChain33ToEthAssets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumBtyBridgeTokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
# 原来的地址金额
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# balance=$(cli_ret "${result}" "balance" ".balance")
# chain33 lock bty
hash=$(${Chain33Cli} send evm call -f 1 -a 5 -k "${chain33DeployAddr}" -e "${chain33BridgeBank}" -p "lock(${ethDeployAddr}, ${chain33BtyERC20TokenAddr}, 500000000)" --khainID "${chain33ID}")
check_tx "${Chain33Cli}" "${hash}"
# 原来的地址金额 减少了 5
result=$(${Chain33Cli} account balance -a "${chain33DeployAddr}" -e evm)
# cli_ret "${result}" "balance" ".balance" "$(echo "${balance}-5" | bc)"
#balance_ret "${result}" "195.0000"
# chain33BridgeBank 是否增加了 5
result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
balance_ret "${result}" "5.0000"
eth_block_wait 2
# eth 这端 金额是否增加了 5
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumBtyBridgeTokenAddr}")
cli_ret "${result}" "balance" ".balance" "5"
# eth burn
result=$(${CLIA} ethereum burn -m 3 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBtyBridgeTokenAddr}") #--node_addr https://ropsten.infura.io/v3/9e83f296716142ffbaeaafc05790f26c)
cli_ret "${result}" "burn"
eth_block_wait 2
# eth 这端 金额是否减少了 3
result=$(${CLIA} ethereum balance -o "${ethDeployAddr}" -t "${ethereumBtyBridgeTokenAddr}")
cli_ret "${result}" "balance" ".balance" "2"
sleep ${maturityDegree}
# 接收的地址金额 变成了 3
result=$(${Chain33Cli} account balance -a "${chain33ReceiverAddr}" -e evm)
balance_ret "${result}" "3.0000"
# chain33BridgeBank 是否减少了 3
result=$(${Chain33Cli} account balance -a "${chain33BridgeBank}" -e evm)
balance_ret "${result}" "2.0000"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# eth to chain33 在以太坊上锁定 ETH 资产,然后在 chain33 上 burn
function TestETH2Chain33Assets() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 11个
result=$(${CLIA} ethereum lock -m 11 -k "${ethValidatorAddrKeyA}" -r "${chain33ReceiverAddr}")
cli_ret "${result}" "lock"
# eth 等待 10 个区块
eth_block_wait 2
# 查询 ETH 这端 bridgeBank 地址 11
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "11"
sleep ${maturityDegree}
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
# 结果是 11 * le8
is_equal "${result}" "1100000000"
# 原来的数额
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrB}")
cli_ret "${result}" "balance" ".balance" "100"
echo '#5.burn ETH from Chain33 ETH(Chain33)-----> Ethereum'
${CLIA} chain33 burn -m 5 -k "${chain33ReceiverAddrKey}" -r "${ethValidatorAddrB}" -t "${chain33EthBridgeTokenAddr}"
sleep ${maturityDegree}
echo "check the balance on chain33"
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
# 结果是 11-5 * le8
is_equal "${result}" "600000000"
# 查询 ETH 这端 bridgeBank 地址 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}")
cli_ret "${result}" "balance" ".balance" "6"
# 比之前多 5
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrB}")
cli_ret "${result}" "balance" ".balance" "105"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function TestETH2Chain33Ycc() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 查询 ETH 这端 bridgeBank 地址原来是 0
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
# ETH 这端 lock 7个 YCC
result=$(${CLIA} ethereum lock -m 7 -k "${ethDeployKey}" -r "${chain33ReceiverAddr}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "lock"
# eth 等待 10 个区块
eth_block_wait 2
# 查询 ETH 这端 bridgeBank 地址 7 YCC
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "7"
sleep ${maturityDegree}
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result=$(${Chain33Cli} evm query -a "${chain33BycBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
# 结果是 7 * le8
is_equal "${result}" "700000000"
# 原来的数额 0
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrB}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "0"
echo '#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum'
${CLIA} chain33 burn -m 5 -k "${chain33ReceiverAddrKey}" -r "${ethValidatorAddrB}" -t "${chain33BycBridgeTokenAddr}"
sleep ${maturityDegree}
echo "check the balance on chain33"
result=$(${Chain33Cli} evm query -a "${chain33BycBridgeTokenAddr}" -c "${chain33DeployAddr}" -b "balanceOf(${chain33ReceiverAddr})")
# 结果是 7-5 * le8
is_equal "${result}" "200000000"
# 查询 ETH 这端 bridgeBank 地址 2
result=$(${CLIA} ethereum balance -o "${ethBridgeBank}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "2"
# 更新后的金额 5
result=$(${CLIA} ethereum balance -o "${ethValidatorAddrB}" -t "${ethereumBycERC20TokenAddr}")
cli_ret "${result}" "balance" ".balance" "5"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# shellcheck disable=SC2120
function mainTest() {
if [[ $# -ge 1 && ${1} != "" ]]; then
chain33ID="${1}"
fi
StartChain33
start_trufflesuite
StartOneRelayer
TestChain33ToEthAssets
TestETH2Chain33Assets
TestETH2Chain33Ycc
}
mainTest "${1}"
Title="local"
TestNet=true
CoinSymbol="bty"
TxHeight=true
ChainID=33
# crypto模块配置
[crypto]
enableTypes=[] #设置启用的加密插件名称,不配置启用所有
[crypto.enableHeight] #配置已启用插件的启用高度,不配置采用默认高度0, 负数表示不启用
secp256k1=0
[crypto.sub.secp256k1] #支持插件子配置
[log]
# 日志级别,支持debug(dbug)/info/warn/error(eror)/crit
loglevel = "debug"
logConsoleLevel = "info"
# 日志文件名,可带目录,所有生成的日志文件都放到此目录下
logFile = "logs/chain33.log"
# 单个日志文件的最大值(单位:兆)
maxFileSize = 20
# 最多保存的历史日志文件个数
maxBackups = 20
# 最多保存的历史日志消息(单位:天)
maxAge = 28
# 日志文件名是否使用本地事件(否则使用UTC时间)
localTime = true
# 历史日志文件是否压缩(压缩格式为gz)
compress = false
# 是否打印调用源文件和行号
callerFile = true
# 是否打印调用方法
callerFunction = true
[blockchain]
defCacheSize=128
maxFetchBlockNum=128
timeoutSeconds=5
batchBlockNum=128
driver="leveldb"
dbPath="datadir"
dbCache=64
isStrongConsistency=true
singleMode=true
batchsync=false
isRecordBlockSequence=true
isParaChain=false
enableTxQuickIndex=true
# 使能精简localdb
enableReduceLocaldb=false
# 关闭分片存储,默认false为开启分片存储;平行链不需要分片需要修改此默认参数为true
disableShard=false
# 分片存储中每个大块包含的区块数
chunkblockNum=1000
# 使能从P2pStore中获取数据
enableFetchP2pstore=false
# 使能假设已删除已归档数据后,获取数据情况
enableIfDelLocalChunk=false
# 开启推送功能
enablePushSubscribe=true
[p2p]
types=[ "dht"]
enable=true
driver="leveldb"
dbPath="datadir/addrbook"
dbCache=4
grpcLogFile="grpc33.log"
[p2p.sub.dht]
port=13803
[rpc]
jrpcBindAddr="localhost:8801"
grpcBindAddr="localhost:8802"
whitelist=["127.0.0.1"]
jrpcFuncWhitelist=["*"]
grpcFuncWhitelist=["*"]
enableTLS=false
certFile="cert.pem"
keyFile="key.pem"
[mempool]
name="timeline"
poolCacheSize=10240
# 最小得交易手续费率,这个没有默认值,必填,一般是0.001 coins
minTxFeeRate=100000
# 最大的交易手续费率, 0.1 coins
maxTxFeeRate=10000000
# 单笔交易最大的手续费, 10 coins
maxTxFee=1000000000
maxTxNumPerAccount=100
isLevelFee=false
[mempool.sub.timeline]
poolCacheSize=10240
[mempool.sub.score]
poolCacheSize=10240
timeParam=1 #时间占价格比例
priceConstant=1544 #手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
pricePower=1 #常量比例
[mempool.sub.price]
poolCacheSize=10240
[consensus]
name="solo"
minerstart=true
genesisBlockTime=1514533394
genesis="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
minerExecs=["ticket", "autonomy"]
[mver.consensus]
fundKeyAddr = "1BQXS6TxaYYG5mADaWij4AxhZZUTpw95a5"
powLimitBits = "0x1f00ffff"
maxTxNumber = 1600 #160
[mver.consensus.ForkChainParamV1]
maxTxNumber = 10000
[mver.consensus.ForkChainParamV2]
powLimitBits = "0x1f2fffff"
[mver.consensus.ForkTicketFundAddrV1]
fundKeyAddr = "1Ji3W12KGScCM7C2p8bg635sNkayDM8MGY"
[mver.consensus.ticket]
coinReward = 18
coinDevFund = 12
ticketPrice = 10000
retargetAdjustmentFactor = 4
futureBlockTime = 16
ticketFrozenTime = 5 #5s only for test
ticketWithdrawTime = 10 #10s only for test
ticketMinerWaitTime = 2 #2s only for test
targetTimespan = 2304
targetTimePerBlock = 16
[mver.consensus.ticket.ForkChainParamV1]
targetTimespan = 288 #only for test
targetTimePerBlock = 2
[consensus.sub.solo]
genesis="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
genesisBlockTime=1514533394
hotkeyAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
waitTxMs=10
[consensus.sub.ticket]
genesisBlockTime=1514533394
[[consensus.sub.ticket.genesis]]
minerAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
returnAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
count=10000
[[consensus.sub.ticket.genesis]]
minerAddr="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
returnAddr="1EbDHAXpoiewjPLX9uqoz38HsKqMXayZrF"
count=10000
[[consensus.sub.ticket.genesis]]
minerAddr="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
returnAddr="1KcCVZLSQYRUwE5EXTsAoQs9LuJW6xwfQa"
count=10000
[store]
name="mavl"
driver="leveldb"
dbPath="datadir/mavltree"
dbCache=128
[store.sub.mavl]
enableMavlPrefix=false
enableMVCC=false
enableMavlPrune=false
pruneHeight=10000
# 是否使能mavl数据载入内存
enableMemTree=false
# 是否使能mavl叶子节点数据载入内存
enableMemVal=false
# 缓存close ticket数目,该缓存越大同步速度越快,最大设置到1500000
tkCloseCacheLen=100000
[wallet]
minFee=1000000
driver="leveldb"
dbPath="datadir/wallet"
dbCache=16
signType="secp256k1"
coinType="bty"
[wallet.sub.ticket]
minerwhitelist=["*"]
[exec]
enableStat=false
enableMVCC=false
[exec.sub.token]
saveTokenTxList=true
tokenApprs = [
"1Bsg9j6gW83sShoee1fZAt9TkUjcrCgA9S",
"1Q8hGLfoGe63efeWa8fJ4Pnukhkngt6poK",
"1LY8GFia5EiyoTodMLfkB5PHNNpXRqxhyB",
"1GCzJDS6HbgTQ2emade7mEJGGWFfA15pS9",
"1JYB8sxi4He5pZWHCd3Zi2nypQ4JMB6AxN",
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv",
]
[exec.sub.relay]
genesis="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
[exec.sub.cert]
# 是否启用证书验证和签名
enable=false
# 加密文件路径
cryptoPath="authdir/crypto"
# 带证书签名类型,支持"auth_ecdsa", "auth_sm2"
signType="auth_ecdsa"
[exec.sub.manage]
superManager=[
"1Bsg9j6gW83sShoee1fZAt9TkUjcrCgA9S",
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv",
"1Q8hGLfoGe63efeWa8fJ4Pnukhkngt6poK"
]
[exec.sub.autonomy]
total="16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
useBalance=false
[health]
listenAddr="localhost:8805"
checkInterval=1
unSyncMaxTimes=2
[metrics]
#是否使能发送metrics数据的发送
enableMetrics=false
#数据保存模式
dataEmitMode="influxdb"
[metrics.sub.influxdb]
#以纳秒为单位的发送间隔
duration=1000000000
url="http://influxdb:8086"
database="chain33metrics"
username=""
password=""
namespace=""
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set -x
set +e
# 只测试 lock 操作,不测试 burn
source "./publicTest.sh"
source "./relayerPublic.sh"
source "./multisignPublicTest.sh"
## ETH 部署合约者的私钥 用于部署合约时签名使用
#ethDeployAddr="0x8afdadfc88a1087c9a1d6c0f5dd04634b87f303a"
#ethDeployKey="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
#
## chain33 部署合约者的私钥 用于部署合约时签名使用
#chain33DeployAddr="1N6HstkyLFS8QCeVfdvYxx1xoryXoJtvvZ"
#
#Chain33Cli="../../chain33-cli"
#chain33BridgeBank=""
#ethBridgeBank=""
#chain33BtyERC20TokenAddr="1111111111111111111114oLvT2"
#ethereumBycERC20TokenAddr=""
#multisignChain33Addr=""
#multisignEthAddr=""
#ethereumYccBridgeTokenAddr=""
#chain33YccERC20TokenAddr=""
#
#CLIA="./ebcli_A"
chain33ID=0
function mainTest() {
if [[ $# -ge 1 && ${1} != "" ]]; then
# shellcheck disable=SC2034
chain33ID="${1}"
fi
StartChain33
start_trufflesuite
AllRelayerStart
deployMultisign
lockBty
lockChain33Ycc
lockEth
lockEthYcc
}
mainTest "${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