Commit 03bd5115 authored by QM's avatar QM Committed by vipwzw

delete relayer token set

parent 1968509c
......@@ -738,9 +738,8 @@ function lockEthUSDT() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function StartDockerRelayerDeploy() {
function up_relayer_toml() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 修改 relayer.toml 配置文件 pushName 字段
pushNameChange "./relayer.toml"
# 修改 relayer.toml 配置文件 initPowers
......@@ -776,6 +775,15 @@ function StartDockerRelayerDeploy() {
local line=$(delete_line_show "./relayer.toml" "EthMaturityDegree=10")
sed -i ''"${line}"' a EthMaturityDegree=1' "./relayer.toml"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function StartDockerRelayerDeploy() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 修改 relayer.toml
up_relayer_toml
# 启动 ebrelayer
start_docker_ebrelayerA
......@@ -1063,16 +1071,14 @@ function Testethereum2EVMToChain33_usdt() {
# is_equal "${result}" "500000000"
}
function AllRelayerMainTest() {
set +e
docker_chain33_ip=$(get_docker_addr "${dockerNamePrefix}_chain33_1")
MainCli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8801"
Para8801Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
Para8901Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
function get_cli() {
# shellcheck disable=SC2034
{
docker_chain33_ip=$(get_docker_addr "${dockerNamePrefix}_chain33_1")
MainCli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8801"
Para8801Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
Para8901Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
CLIA="docker exec ${dockerNamePrefix}_ebrelayera_1 /root/ebcli_A"
CLIB="docker exec ${dockerNamePrefix}_ebrelayerb_1 /root/ebcli_A"
CLIC="docker exec ${dockerNamePrefix}_ebrelayerc_1 /root/ebcli_A"
......@@ -1080,31 +1086,12 @@ function AllRelayerMainTest() {
docker_ganachetest_ip=$(get_docker_addr "${dockerNamePrefix}_ganachetest_1")
Boss4xCLI="docker exec ${dockerNamePrefix}_ebrelayera_1 /root/boss4x --rpc_laddr http://${docker_chain33_ip}:8901 --rpc_laddr_ethereum http://${docker_ganachetest_ip}:8545 --paraName user.p.para."
echo "${Boss4xCLI}"
EvmxgoBoss4xCLI="./evmxgoboss4x --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
}
}
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
if [[ ${1} != "" ]]; then
maturityDegree=${1}
echo -e "${GRE}maturityDegree is ${maturityDegree} ${NOC}"
fi
# shellcheck disable=SC2120
if [[ $# -ge 2 ]]; then
chain33ID="${2}"
fi
# init
Chain33Cli=${MainCli}
InitChain33Validator
# para add
initPara
Chain33Cli=${Para8901Cli}
StartDockerRelayerDeploy
function test_all() {
# test
Chain33Cli=${Para8901Cli}
TestChain33ToEthAssets
......@@ -1127,11 +1114,38 @@ function AllRelayerMainTest() {
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."
DeployEvmxgo
TestETH2EVMToChain33
Testethereum2EVMToChain33_byc
Testethereum2EVMToChain33_usdt
}
function AllRelayerMainTest() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
set +e
get_cli
if [[ ${1} != "" ]]; then
maturityDegree=${1}
echo -e "${GRE}maturityDegree is ${maturityDegree} ${NOC}"
fi
# shellcheck disable=SC2120
if [[ $# -ge 2 ]]; then
chain33ID="${2}"
fi
# init
Chain33Cli=${MainCli}
InitChain33Validator
# para add
initPara
Chain33Cli=${Para8901Cli}
StartDockerRelayerDeploy
test_all
echo_addrs
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
......
......@@ -160,8 +160,6 @@ function offline_create_bridge_token_chain33_BYC() {
result=$(${Chain33Cli} evm query -a "${chain33BycBridgeTokenAddr}" -c "${chain33BycBridgeTokenAddr}" -b "symbol()")
is_equal "${result}" "BYC"
${CLIA} chain33 token set -t "${chain33BycBridgeTokenAddr}" -s BYC
}
function offline_create_bridge_token_chain33_USDT() {
......@@ -177,8 +175,6 @@ function offline_create_bridge_token_chain33_USDT() {
result=$(${Chain33Cli} evm query -a "${chain33USDTBridgeTokenAddr}" -c "${chain33USDTBridgeTokenAddr}" -b "symbol()")
is_equal "${result}" "USDT"
${CLIA} chain33 token set -t "${chain33USDTBridgeTokenAddr}" -s USDT
}
function offline_create_bridge_token_chain33_BUSD() {
......@@ -194,8 +190,6 @@ function offline_create_bridge_token_chain33_BUSD() {
result=$(${Chain33Cli} evm query -a "${chain33BUSDBridgeTokenAddr}" -c "${chain33BUSDBridgeTokenAddr}" -b "symbol()")
is_equal "${result}" "BUSD"
${CLIA} chain33 token set -t "${chain33BUSDBridgeTokenAddr}" -s BUSD
}
function offline_deploy_erc20_chain33_YCC() {
......@@ -245,7 +239,6 @@ function offline_create_bridge_token_eth_BTY() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumBtyBridgeTokenAddr=$(${CLIA} ethereum receipt -s "${hash}" | jq -r .logs[0].address)
${CLIA} ethereum token set -t "${ethereumBtyBridgeTokenAddr}" -s BTY
}
function offline_create_bridge_token_chain33_ETH() {
......@@ -261,8 +254,6 @@ function offline_create_bridge_token_chain33_ETH() {
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33EthBridgeTokenAddr}" -b "symbol()")
is_equal "${result}" "${symbolName}"
${CLIA} chain33 token set -t "${chain33EthBridgeTokenAddr}" -s "${symbolName}"
}
function offline_create_bridge_token_eth_YCC() {
......@@ -272,7 +263,6 @@ function offline_create_bridge_token_eth_YCC() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumYccBridgeTokenAddr=$(${CLIA} ethereum receipt -s "${hash}" | jq -r .logs[0].address)
${CLIA} ethereum token set -t "${ethereumYccBridgeTokenAddr}" -s YCC
cp BridgeToken.abi "${ethereumYccBridgeTokenAddr}.abi"
}
......@@ -283,7 +273,6 @@ function offline_create_bridge_token_eth_ZBC() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumZbcBridgeTokenAddr=$(${CLIA} ethereum receipt -s "${hash}" | jq -r .logs[0].address)
${CLIA} ethereum token set -t "${ethereumZbcBridgeTokenAddr}" -s ZBC
cp BridgeToken.abi "${ethereumZbcBridgeTokenAddr}.abi"
}
......
......@@ -621,7 +621,7 @@ function lockEthYcc() {
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function StartDockerRelayerDeploy() {
function up_relayer_toml() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 修改 relayer.toml 配置文件 pushName 字段
......@@ -659,6 +659,15 @@ function StartDockerRelayerDeploy() {
local line=$(delete_line_show "./relayer.toml" "EthMaturityDegree=10")
sed -i ''"${line}"' a EthMaturityDegree=1' "./relayer.toml"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
function StartDockerRelayerDeploy() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 修改 relayer.toml 配置文件
up_relayer_toml
# 启动 ebrelayer
start_docker_ebrelayerA
......@@ -755,15 +764,15 @@ function echo_addrs() {
echo -e "${GRE}chain33TestAddrKey1: ${chain33TestAddrKey1} ${NOC}"
}
function AllRelayerMainTest() {
set +e
docker_chain33_ip=$(get_docker_addr "${dockerNamePrefix}_chain33_1")
MainCli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8801"
Para8801Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
Para8901Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
function get_cli() {
# shellcheck disable=SC2034
{
docker_chain33_ip=$(get_docker_addr "${dockerNamePrefix}_chain33_1")
MainCli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8801"
Para8801Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
Para8901Cli="./chain33-cli --rpc_laddr http://${docker_chain33_ip}:8901 --paraName user.p.para."
CLIA="docker exec ${dockerNamePrefix}_ebrelayera_1 /root/ebcli_A"
CLIB="docker exec ${dockerNamePrefix}_ebrelayerb_1 /root/ebcli_A"
CLIC="docker exec ${dockerNamePrefix}_ebrelayerc_1 /root/ebcli_A"
......@@ -774,8 +783,34 @@ function AllRelayerMainTest() {
echo "${Boss4xCLI}"
}
}
function test_all() {
# test
Chain33Cli=${Para8901Cli}
TestChain33ToEthAssets
TestETH2Chain33Assets
TestChain33ToEthZBCAssets
TestETH2Chain33Ycc
Chain33Cli=${Para8901Cli}
lockBty
lockChain33Ycc
lockEth
lockEthYcc
# 离线多签地址转入阈值设大
offline_set_offline_token_Bty 100000000000000 10
offline_set_offline_token_Chain33Ycc 100000000000000 10
offline_set_offline_token_Eth 100000000000000 10
offline_set_offline_token_EthYcc 100000000000000 10
}
function AllRelayerMainTest() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
set +e
get_cli
if [[ ${1} != "" ]]; then
maturityDegree=${1}
......@@ -796,24 +831,7 @@ function AllRelayerMainTest() {
Chain33Cli=${Para8901Cli}
StartDockerRelayerDeploy
# test
Chain33Cli=${Para8901Cli}
TestChain33ToEthAssets
TestETH2Chain33Assets
TestChain33ToEthZBCAssets
TestETH2Chain33Ycc
Chain33Cli=${Para8901Cli}
lockBty
lockChain33Ycc
lockEth
lockEthYcc
# 离线多签地址转入阈值设大
offline_set_offline_token_Bty 100000000000000 10
offline_set_offline_token_Chain33Ycc 100000000000000 10
offline_set_offline_token_Eth 100000000000000 10
offline_set_offline_token_EthYcc 100000000000000 10
test_all
echo_addrs
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
......
......@@ -451,7 +451,6 @@ function offline_create_bridge_token_eth_BTY() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumBtyBridgeTokenAddr=$(./ebcli_A ethereum receipt -s "${hash}" | jq -r .logs[0].address)
./ebcli_A ethereum token set -t "${ethereumBtyBridgeTokenAddr}" -s BTY
}
function offline_create_bridge_token_chain33_ETH() {
......@@ -477,7 +476,6 @@ function offline_create_bridge_token_eth_YCC() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumYccBridgeTokenAddr=$(./ebcli_A ethereum receipt -s "${hash}" | jq -r .logs[0].address)
./ebcli_A ethereum token set -t "${ethereumYccBridgeTokenAddr}" -s YCC
cp BridgeToken.abi "${ethereumYccBridgeTokenAddr}.abi"
}
......@@ -488,7 +486,6 @@ function offline_create_bridge_token_eth_ZBC() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumZbcBridgeTokenAddr=$(./ebcli_A ethereum receipt -s "${hash}" | jq -r .logs[0].address)
./ebcli_A ethereum token set -t "${ethereumZbcBridgeTokenAddr}" -s ZBC
cp BridgeToken.abi "${ethereumZbcBridgeTokenAddr}.abi"
}
......
......@@ -127,8 +127,6 @@ function offline_create_bridge_token_chain33_BYC() {
result=$(${Chain33Cli} evm query -a "${chain33BycBridgeTokenAddr}" -c "${chain33BycBridgeTokenAddr}" -b "symbol()")
is_equal "${result}" "BYC"
${CLIA} chain33 token set -t "${chain33BycBridgeTokenAddr}" -s BYC
}
function offline_deploy_erc20_chain33_YCC() {
......@@ -178,7 +176,6 @@ function offline_create_bridge_token_eth_BTY() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumBtyBridgeTokenAddr=$(${CLIA} ethereum receipt -s "${hash}" | jq -r .logs[0].address)
${CLIA} ethereum token set -t "${ethereumBtyBridgeTokenAddr}" -s BTY
}
function offline_create_bridge_token_chain33_ETH() {
......@@ -193,8 +190,6 @@ function offline_create_bridge_token_chain33_ETH() {
result=$(${Chain33Cli} evm query -a "${chain33EthBridgeTokenAddr}" -c "${chain33EthBridgeTokenAddr}" -b "symbol()")
is_equal "${result}" "ETH"
${CLIA} chain33 token set -t "${chain33EthBridgeTokenAddr}" -s ETH
}
function offline_create_bridge_token_eth_YCC() {
......@@ -204,7 +199,6 @@ function offline_create_bridge_token_eth_YCC() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumYccBridgeTokenAddr=$(${CLIA} ethereum receipt -s "${hash}" | jq -r .logs[0].address)
${CLIA} ethereum token set -t "${ethereumYccBridgeTokenAddr}" -s YCC
cp BridgeToken.abi "${ethereumYccBridgeTokenAddr}.abi"
}
......@@ -215,7 +209,6 @@ function offline_create_bridge_token_eth_ZBC() {
ethereum_offline_sign_send "create_bridge_token.txt"
ethereumZbcBridgeTokenAddr=$(${CLIA} ethereum receipt -s "${hash}" | jq -r .logs[0].address)
${CLIA} ethereum token set -t "${ethereumZbcBridgeTokenAddr}" -s ZBC
cp BridgeToken.abi "${ethereumZbcBridgeTokenAddr}.abi"
}
......
......@@ -40,11 +40,10 @@ func Chain33RelayerCmd() *cobra.Command {
func TokenAddressCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "token",
Short: "show or set token address and it's corresponding symbol",
Short: "show token address and it's corresponding symbol",
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(
SetTokenAddressCmd(),
ShowTokenAddressCmd(),
CreateERC20Cmd(),
)
......@@ -91,39 +90,6 @@ func CreateERC20(cmd *cobra.Command, args []string) {
ctx.Run()
}
func SetTokenAddressCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "set",
Short: "set token address and it's corresponding symbol",
Run: SetTokenAddress,
}
SetTokenFlags(cmd)
return cmd
}
//SetTokenFlags ...
func SetTokenFlags(cmd *cobra.Command) {
cmd.Flags().StringP("token", "t", "", "token address")
_ = cmd.MarkFlagRequired("token")
cmd.Flags().StringP("symbol", "s", "", "token symbol")
_ = cmd.MarkFlagRequired("symbol")
}
func SetTokenAddress(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
symbol, _ := cmd.Flags().GetString("symbol")
token, _ := cmd.Flags().GetString("token")
var res rpctypes.Reply
para := ebTypes.TokenAddress{
Symbol: symbol,
Address: token,
ChainName: ebTypes.Chain33BlockChainName,
}
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.SetTokenAddress", para, &res)
ctx.Run()
}
func ShowTokenAddressCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "show",
......
......@@ -60,12 +60,11 @@ func EthereumRelayerCmd() *cobra.Command {
func TokenCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "token",
Short: "create bridgeToken, ERC20 Token, show or set token address and it's corresponding symbol",
Short: "create bridgeToken, ERC20 Token, show token address and it's corresponding symbol",
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(
CreateBridgeTokenCmd(),
SetTokenAddress4EthCmd(),
ShowTokenAddress4EthCmd(),
AddToken2LockListCmd(),
ShowTokenAddress4LockEthCmd(),
......@@ -74,31 +73,6 @@ func TokenCmd() *cobra.Command {
return cmd
}
func SetTokenAddress4EthCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "set",
Short: "set token address and it's corresponding symbol",
Run: SetTokenAddress4Eth,
}
SetTokenFlags(cmd)
return cmd
}
func SetTokenAddress4Eth(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
symbol, _ := cmd.Flags().GetString("symbol")
token, _ := cmd.Flags().GetString("token")
var res rpctypes.Reply
para := ebTypes.TokenAddress{
Symbol: symbol,
Address: token,
ChainName: ebTypes.EthereumBlockChainName,
}
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.SetTokenAddress", para, &res)
ctx.Run()
}
func ShowTokenAddress4EthCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "show",
......
......@@ -786,33 +786,6 @@ func (manager *Manager) ShowBridgeRegistryAddr4chain33(para interface{}, result
return nil
}
//SetTokenAddress ...
func (manager *Manager) SetTokenAddress(token2set relayerTypes.TokenAddress, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
if err := manager.checkPermission(); nil != err {
return err
}
if relayerTypes.EthereumBlockChainName == token2set.ChainName {
err := manager.ethRelayer.SetTokenAddress(token2set)
if nil != err {
return err
}
} else {
err := manager.chain33Relayer.SetTokenAddress(token2set)
if nil != err {
return err
}
}
*result = rpctypes.Reply{
IsOk: true,
Msg: "",
}
return nil
}
//ShowTokenAddress ...
func (manager *Manager) ShowTokenAddress(token2show relayerTypes.TokenAddress, result *interface{}) error {
manager.mtx.Lock()
......
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