Commit 7b6d3277 authored by hezhengjun's avatar hezhengjun

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

parents b290939c 2cefc412
......@@ -115,6 +115,10 @@ function base_init() {
#autonomy
sed -i $sedfix 's/^useBalance=.*/useBalance=true/g' chain33.toml
sed -i $sedfix 's/^total="16htvcBNS.*/total="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx"/g' chain33.toml
if [ "$DAPP" == "x2Ethereum" ]; then
sed -i $sedfix 's/^enableReduceLocaldb=.*/enableReduceLocaldb=false/g' chain33.toml
fi
}
function start() {
......
package chain33
import (
"context"
"encoding/hex"
"flag"
"fmt"
"os"
"os/signal"
"sync"
"sync/atomic"
"syscall"
"testing"
"time"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/ethcontract/generated"
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/ethcontract/test/setup"
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/ethtxs"
syncTx "github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/relayer/chain33/transceiver/sync"
ebTypes "github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/types"
relayerTypes "github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/types"
tml "github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/suite"
// 需要显示引用系统插件,以加载系统内置合约
"github.com/33cn/chain33/client/mocks"
_ "github.com/33cn/chain33/system"
"github.com/stretchr/testify/mock"
)
var (
configPath = flag.String("f", "./../../relayer.toml", "configfile")
chainTestCfg = types.NewChain33Config(types.GetDefaultCfgstring())
privateKeyStr = "0x3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
accountAddr = "0x92c8b16afd6d423652559c6e266cbe1c29bfd84f"
passphrase = "123456hzj"
test = "0ac3050aa3020a0a7832657468657265756d126d60671a690a2a3078303030303030303030303030303030303030303030303030303030303030303030303030303030301a2a307830633035626135633233306664616135303362353337303261663139363265303864306336306266220831303030303030302a0365746838121a6e080112210320bbac09528e19c55b0f89cb37ab265e7e856b1a8c388780322dbbfd194b52ba1a473045022100c403d9a6e531292336b44d52e4f4dbb9b8ab1e16335383954583728b909478da022031d8a29efcbcea8df648c4054f3c09ab1ab7a330797cf79fd891a3d9336922e920a08d0628e0f193f60530a1d7ad93e5ebc28e253a22314c7538586d537459765777664e716951336e4e4b33345239466648346b5270425612ce0208021a5e0802125a0a2b10c0d59294bb192222313271796f6361794e46374c7636433971573461767873324537553431664b536676122b10a0c88c94bb192222313271796f6361794e46374c7636433971573461767873324537553431664b5366761a55080f12510a291080ade2042222313271796f6361794e46374c7636433971573461767873324537553431664b53667612242222313271796f6361794e46374c7636433971573461767873324537553431664b5366761a92010867128d010a2a3078303030303030303030303030303030303030303030303030303030303030303030303030303030301222313271796f6361794e46374c7636433971573461767873324537553431664b5366761a2a307830633035626135633233306664616135303362353337303261663139363265303864306336306266220831303030303030302a03657468301220c4092a207a38e1da7de4444f2d34c7488293f3a2e01ce2561e720e9bbef355e83755ad833220e68d8418f69d5f18278a53dca53b101f26f76883337a60a5754d5f6d94e42e3c400148c409"
)
type suiteChain33Relayer struct {
suite.Suite
chain33Relayer *Relayer4Chain33
sim *backends.SimulatedBackend
x2EthContracts *ethtxs.X2EthContracts
x2EthDeployInfo *ethtxs.X2EthDeployInfo
para *ethtxs.DeployPara
}
func TestRunSuiteX2Ethereum(t *testing.T) {
log := new(suiteChain33Relayer)
suite.Run(t, log)
}
func (r *suiteChain33Relayer) SetupSuite() {
r.deployContracts()
r.chain33Relayer = r.newChain33Relayer()
}
func (r *suiteChain33Relayer) Test_1_ImportPrivateKey() {
addr, err := r.chain33Relayer.ImportPrivateKey(passphrase, privateKeyStr)
r.NoError(err)
r.Equal(addr, accountAddr)
time.Sleep(50 * time.Millisecond)
addr, err = r.chain33Relayer.GetAccountAddr()
r.NoError(err)
r.Equal(addr, accountAddr)
key, _, _ := r.chain33Relayer.GetAccount("123")
r.NotEqual(key, privateKeyStr)
key, _, _ = r.chain33Relayer.GetAccount(passphrase)
r.Equal(key, privateKeyStr)
}
func (r *suiteChain33Relayer) Test_2_HandleRequest() {
body, err := hex.DecodeString(test)
r.NoError(err)
r.chain33Relayer.statusCheckedIndex = 1220
err = syncTx.HandleRequest(body)
r.NoError(err)
//time.Sleep(50 * time.Second)
time.Sleep(50 * time.Millisecond)
}
func (r *suiteChain33Relayer) Test_3_QueryTxhashRelay2Eth() {
ret := r.chain33Relayer.QueryTxhashRelay2Eth()
r.NotEmpty(ret)
}
func (r *suiteChain33Relayer) Test_4_StoreAccountWithNewPassphase() {
err := r.chain33Relayer.StoreAccountWithNewPassphase(passphrase, passphrase)
r.NoError(err)
}
func (r *suiteChain33Relayer) Test_5_getEthTxhash() {
txIndex := atomic.LoadInt64(&r.chain33Relayer.totalTx4Chain33ToEth)
hash, err := r.chain33Relayer.getEthTxhash(txIndex)
r.NoError(err)
r.Equal(hash.String(), "0x6fa087c7a2a8a4421f6e269fbc6c0838e99fa59d5760155a71cd7eb1c01aafad")
}
func (r *suiteChain33Relayer) Test_7_RestorePrivateKeys() {
//err := r.chain33Relayer.RestorePrivateKeys("123") // 不会报错
//r.Error(err)
go func() {
time.Sleep(1 * time.Millisecond)
<-r.chain33Relayer.unlock
}()
err := r.chain33Relayer.RestorePrivateKeys(passphrase)
r.NoError(err)
}
func (r *suiteChain33Relayer) newChain33Relayer() *Relayer4Chain33 {
cfg := initCfg(*configPath)
cfg.SyncTxConfig.Chain33Host = "http://127.0.0.1:8801"
cfg.BridgeRegistry = r.x2EthDeployInfo.BridgeRegistry.Address.String()
cfg.SyncTxConfig.PushBind = "127.0.0.1:60000"
cfg.SyncTxConfig.FetchHeightPeriodMs = 50
cfg.SyncTxConfig.Dbdriver = "memdb"
db := dbm.NewDB("relayer_db_service", cfg.SyncTxConfig.Dbdriver, cfg.SyncTxConfig.DbPath, cfg.SyncTxConfig.DbCache)
ctx, cancel := context.WithCancel(context.Background())
relayer := &Relayer4Chain33{
rpcLaddr: cfg.SyncTxConfig.Chain33Host,
fetchHeightPeriodMs: cfg.SyncTxConfig.FetchHeightPeriodMs,
unlock: make(chan int),
db: db,
ctx: ctx,
}
err := relayer.setStatusCheckedIndex(1)
r.NoError(err)
relayer.ethBackend = r.sim
relayer.bridgeRegistryAddr = r.para.Deployer
relayer.totalTx4Chain33ToEth = relayer.getTotalTxAmount2Eth()
relayer.statusCheckedIndex = relayer.getStatusCheckedIndex()
r.Equal(relayer.statusCheckedIndex, int64(1))
syncCfg := &ebTypes.SyncTxReceiptConfig{
Chain33Host: cfg.SyncTxConfig.Chain33Host,
PushHost: cfg.SyncTxConfig.PushHost,
PushName: cfg.SyncTxConfig.PushName,
PushBind: cfg.SyncTxConfig.PushBind,
StartSyncHeight: cfg.SyncTxConfig.StartSyncHeight,
StartSyncSequence: cfg.SyncTxConfig.StartSyncSequence,
StartSyncHash: cfg.SyncTxConfig.StartSyncHash,
}
_ = syncCfg
go r.syncProc(syncCfg)
var wg sync.WaitGroup
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGTERM)
go func() {
<-ch
cancel()
wg.Wait()
os.Exit(0)
}()
return relayer
}
func (r *suiteChain33Relayer) deployContracts() {
ctx := context.Background()
var backend bind.ContractBackend
backend, r.para = setup.PrepareTestEnvironment()
r.sim = backend.(*backends.SimulatedBackend)
balance, _ := r.sim.BalanceAt(ctx, r.para.Deployer, nil)
fmt.Println("deployer addr,", r.para.Deployer.String(), "balance =", balance.String())
/////////////////////////EstimateGas///////////////////////////
callMsg := ethereum.CallMsg{
From: r.para.Deployer,
Data: common.FromHex(generated.BridgeBankBin),
}
gas, err := r.sim.EstimateGas(ctx, callMsg)
r.NoError(err)
fmt.Printf("\nThe estimated gas=%d\n", gas)
////////////////////////////////////////////////////
r.x2EthContracts, r.x2EthDeployInfo, err = ethtxs.DeployAndInit(backend, r.para)
r.NoError(err)
r.sim.Commit()
}
func (r *suiteChain33Relayer) syncProc(syncCfg *ebTypes.SyncTxReceiptConfig) {
var ret = types.ReplySubTxReceipt{IsOk: true}
var he = types.Header{Height: 10000}
mockapi := &mocks.QueueProtocolAPI{}
// 这里对需要mock的方法打桩,Close是必须的,其它方法根据需要
mockapi.On("Close").Return()
mockapi.On("AddSubscribeTxReceipt", mock.Anything).Return(&ret, nil)
mockapi.On("GetLastHeader", mock.Anything).Return(&he, nil)
mockapi.On("GetConfig", mock.Anything).Return(chainTestCfg, nil)
mock33 := testnode.New("", mockapi)
defer mock33.Close()
rpcCfg := mock33.GetCfg().RPC
// 这里必须设置监听端口,默认的是无效值
rpcCfg.JrpcBindAddr = "127.0.0.1:8801"
mock33.GetRPC().Listen()
fmt.Println("Pls unlock or import private key for Chain33 relayer")
<-r.chain33Relayer.unlock
fmt.Println("Chain33 relayer starts to run...")
r.chain33Relayer.syncTxReceipts = syncTx.StartSyncTxReceipt(syncCfg, r.chain33Relayer.db)
r.chain33Relayer.lastHeight4Tx = r.chain33Relayer.loadLastSyncHeight()
r.chain33Relayer.oracleInstance = r.x2EthContracts.Oracle
timer := time.NewTicker(time.Duration(r.chain33Relayer.fetchHeightPeriodMs) * time.Millisecond)
for {
select {
case <-timer.C:
height := r.chain33Relayer.getCurrentHeight()
relayerLog.Debug("syncProc", "getCurrentHeight", height)
r.chain33Relayer.onNewHeightProc(height)
case <-r.chain33Relayer.ctx.Done():
timer.Stop()
return
}
}
}
func initCfg(path string) *relayerTypes.RelayerConfig {
var cfg relayerTypes.RelayerConfig
if _, err := tml.DecodeFile(path, &cfg); err != nil {
fmt.Println(err)
os.Exit(-1)
}
return &cfg
}
package sync
func HandleRequest(body []byte) error {
return handleRequest(body)
}
package ethereum
import (
"context"
"flag"
"fmt"
"math/big"
"os"
"testing"
"time"
dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/ethcontract/generated"
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/ethcontract/test/setup"
"github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/ethtxs"
relayerTypes "github.com/33cn/plugin/plugin/dapp/x2Ethereum/ebrelayer/types"
tml "github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/suite"
)
var (
configPath = flag.String("f", "./../../relayer.toml", "configfile")
ethPrivateKeyStr = "0x3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethAccountAddr = "0x92C8b16aFD6d423652559C6E266cBE1c29Bfd84f"
chain33PrivateKeyStr = "0xd627968e445f2a41c92173225791bae1ba42126ae96c32f28f97ff8f226e5c68"
chain33AccountAddr = "1GTxrmuWiXavhcvsaH5w9whgVxUrWsUMdV"
passphrase = "123456hzj"
)
type suiteEthRelayer struct {
suite.Suite
ethRelayer *Relayer4Ethereum
sim *backends.SimulatedBackend
x2EthContracts *ethtxs.X2EthContracts
x2EthDeployInfo *ethtxs.X2EthDeployInfo
para *ethtxs.DeployPara
}
func TestRunSuiteX2Ethereum(t *testing.T) {
log := new(suiteEthRelayer)
suite.Run(t, log)
}
func (r *suiteEthRelayer) SetupSuite() {
r.deployContracts()
r.ethRelayer = r.newEthRelayer()
}
func (r *suiteEthRelayer) Test_1_ImportPrivateKey() {
validators, err := r.ethRelayer.GetValidatorAddr()
r.Error(err)
r.Empty(validators)
//a, b, c := r.ethRelayer.NewAccount("123")
//fmt.Println("++++++++++", a, b, c)
err = r.ethRelayer.ImportChain33PrivateKey(passphrase, chain33PrivateKeyStr)
r.NoError(err)
privateKey, addr, err := r.ethRelayer.GetAccount("123")
r.NoError(err)
r.NotEqual(privateKey, ethPrivateKeyStr)
privateKey, addr, err = r.ethRelayer.GetAccount(passphrase)
r.NoError(err)
r.Equal(privateKey, ethPrivateKeyStr)
r.Equal(addr, ethAccountAddr)
validators, err = r.ethRelayer.GetValidatorAddr()
r.NoError(err)
//r.Equal(validators.EthValidator, ethAccountAddr)
r.Equal(validators.Chain33Validator, chain33AccountAddr)
}
func (r *suiteEthRelayer) Test_2_RestorePrivateKeys() {
// 错误的密码 也不报错
err := r.ethRelayer.RestorePrivateKeys(passphrase)
r.NoError(err)
//err = r.ethRelayer.StoreAccountWithNewPassphase(passphrase, passphrase)
//r.NoError(err)
}
func (r *suiteEthRelayer) Test_Relayer4Ethereum_GetAccount() {
}
//func (r *suiteEthRelayer) TestRelayer4Ethereum_ApproveAllowance(t *testing.T) {
// r.ethRelayer.ApproveAllowance()
//}
//
//func TestEthRelayerNewRelayerManager(t *testing.T) {
// ctx := context.Background()
// println("TEST:BridgeToken creation (Chain33 assets)")
// //1st部署相关合约
// backend, para := setup.PrepareTestEnv()
// sim := backend.(*backends.SimulatedBackend)
//
// balance, _ := sim.BalanceAt(ctx, para.Deployer, nil)
// fmt.Println("deployer addr,", para.Deployer.String(), "balance =", balance.String())
//
// /////////////////////////EstimateGas///////////////////////////
// callMsg := ethereum.CallMsg{
// From: para.Deployer,
// Data: common.FromHex(generated.BridgeBankBin),
// }
//
// gas, err := sim.EstimateGas(ctx, callMsg)
// if nil != err {
// panic("failed to estimate gas due to:" + err.Error())
// }
// fmt.Printf("\nThe estimated gas=%d", gas)
// ////////////////////////////////////////////////////
//
// x2EthContracts, x2EthDeployInfo, err := ethtxs.DeployAndInit(backend, para)
// if nil != err {
// t.Fatalf("DeployAndInit failed due to:%s", err.Error())
// }
// sim.Commit()
// fmt.Println("x2EthDeployInfo.BridgeBank.Address is:", x2EthDeployInfo.BridgeBank.Address.String(), x2EthContracts.BridgeBank)
// fmt.Println("x2EthDeployInfo.BridgeRegistry.Address is:", x2EthDeployInfo.BridgeRegistry.Address.String())
// ///////////////////////
//
// //defer func() {
// fmt.Println("defer remove datadir")
// err4 := os.RemoveAll("./datadir")
// if err4 != nil {
// fmt.Println(err4)
// }
// //}()
//
// var ret = types.ReplySubTxReceipt{IsOk: true}
// var he = types.Header{Height: 10000}
//
// mockapi := &mocks.QueueProtocolAPI{}
// // 这里对需要mock的方法打桩,Close是必须的,其它方法根据需要
// mockapi.On("Close").Return()
// mockapi.On("AddSubscribeTxReceipt", mock.Anything).Return(&ret, nil)
// mockapi.On("GetLastHeader", mock.Anything).Return(&he, nil)
// mockapi.On("GetConfig", mock.Anything).Return(chainTestCfg, nil)
//
// mock33 := testnode.New("", mockapi)
// defer mock33.Close()
// rpcCfg := mock33.GetCfg().RPC
// // 这里必须设置监听端口,默认的是无效值
// rpcCfg.JrpcBindAddr = "127.0.0.1:8801"
// mock33.GetRPC().Listen()
//
// if *configPath == "" {
// *configPath = "./../relayer.toml"
// }
// cfg := initCfg(*configPath)
// db := dbm.NewDB("relayer_db_service", cfg.SyncTxConfig.Dbdriver, cfg.SyncTxConfig.DbPath, cfg.SyncTxConfig.DbCache)
// cfg.SyncTxConfig.Chain33Host = "http://127.0.0.1:8801"
// cfg.SyncTxConfig.PushBind = "127.0.0.1:20000"
// cfg.SyncTxConfig.FetchHeightPeriodMs = 50
// cfg.BridgeRegistry = "" //x2EthDeployInfo.BridgeRegistry.Address.String()
//
// //cfg.EthProvider = "http://127.0.0.1:1080/"
// //_, err = ethtxs.SetupWebsocketEthClient(cfg.EthProvider)
// //assert.NoError(t, err)
// //return
//
// ctx, cancel := context.WithCancel(context.Background())
//
// chain33RelayerService := ethRelayer.StartChain33Relayer(ctx, cfg.SyncTxConfig, cfg.BridgeRegistry, cfg.EthProvider, db)
// ethRelayerService := ethRelayer.StartEthereumRelayer(cfg.SyncTxConfig.Chain33Host, db, cfg.EthProvider, cfg.BridgeRegistry, cfg.Deploy, cfg.EthMaturityDegree, cfg.EthBlockFetchPeriod)
// //ethRelayer.SetClient(ethRelayerService, sim)
// relayerManager := NewRelayerManager(chain33RelayerService, ethRelayerService, db)
//
// var result interface{}
//
// setPasswdReq := relayerTypes.ReqChangePasswd{
// OldPassphase: "kk",
// NewPassphase: "123456hzj",
// }
//
// err = relayerManager.SetPassphase(setPasswdReq, &result)
// //assert.NoError(t, err)
//
// err = relayerManager.Unlock("123456hzj", &result)
// assert.NoError(t, err)
// fmt.Println(result)
//
// err = relayerManager.ImportChain33PrivateKey4EthRelayer("0xd627968e445f2a41c92173225791bae1ba42126ae96c32f28f97ff8f226e5c68", &result)
// assert.NoError(t, err)
//
// time.Sleep(1 * time.Second)
// ethRelayer.Setx2EthContractsDeployInfo(ethRelayerService, x2EthContracts, x2EthDeployInfo)
// fmt.Println("***************")
// // do something
// {
// bridgeBankBalance, err := sim.BalanceAt(ctx, x2EthDeployInfo.BridgeBank.Address, nil)
// require.Nil(t, err)
// t.Logf("origin eth bridgeBankBalance is:%d", bridgeBankBalance.Int64())
//
// userOneAuth, err := ethtxs.PrepareAuth(backend, para.ValidatorPriKey[0], para.InitValidators[0])
// require.Nil(t, err)
// ethAmount := big.NewInt(50)
// userOneAuth.Value = ethAmount
//
// fmt.Println("origin eth bridgeBankBalance is:", bridgeBankBalance.Int64())
// //lock 50 eth
// chain33Sender := []byte("14KEKbYtKKQm4wMthSK9J4La4nAiidGozt")
// _, err = x2EthContracts.BridgeBank.Lock(userOneAuth, chain33Sender, common.Address{}, ethAmount)
// require.Nil(t, err)
// sim.Commit()
//
// bridgeBankBalance, err = sim.BalanceAt(ctx, x2EthDeployInfo.BridgeBank.Address, nil)
// require.Nil(t, err)
// require.Equal(t, bridgeBankBalance.Int64(), ethAmount.Int64())
// t.Logf("eth bridgeBankBalance changes to:%d", bridgeBankBalance.Int64())
// fmt.Println("eth bridgeBankBalance is:", bridgeBankBalance.Int64())
// }
//
// time.Sleep(5000 * time.Second)
//
// //os.Exit(0)
//
// var wg sync.WaitGroup
//
// ch := make(chan os.Signal, 1)
// signal.Notify(ch, syscall.SIGTERM)
// go func() {
// <-ch
// cancel()
// wg.Wait()
// os.Exit(0)
// }()
//}
func (r *suiteEthRelayer) newEthRelayer() *Relayer4Ethereum {
cfg := initCfg(*configPath)
cfg.SyncTxConfig.Chain33Host = "http://127.0.0.1:8801"
cfg.BridgeRegistry = r.x2EthDeployInfo.BridgeRegistry.Address.String()
cfg.SyncTxConfig.PushBind = "127.0.0.1:60000"
cfg.SyncTxConfig.FetchHeightPeriodMs = 50
cfg.SyncTxConfig.Dbdriver = "memdb"
db := dbm.NewDB("relayer_db_service", cfg.SyncTxConfig.Dbdriver, cfg.SyncTxConfig.DbPath, cfg.SyncTxConfig.DbCache)
relayer := &Relayer4Ethereum{
provider: cfg.EthProvider,
db: db,
unlockchan: make(chan int, 2),
rpcURL2Chain33: cfg.SyncTxConfig.Chain33Host,
bridgeRegistryAddr: r.x2EthDeployInfo.BridgeRegistry.Address,
deployInfo: cfg.Deploy,
maturityDegree: cfg.EthMaturityDegree,
fetchHeightPeriodMs: cfg.EthBlockFetchPeriod,
}
registrAddrInDB, err := relayer.getBridgeRegistryAddr()
//如果输入的registry地址非空,且和数据库保存地址不一致,则直接使用输入注册地址
if cfg.BridgeRegistry != "" && nil == err && registrAddrInDB != cfg.BridgeRegistry {
relayerLog.Error("StartEthereumRelayer", "BridgeRegistry is setted already with value", registrAddrInDB,
"but now setting to", cfg.BridgeRegistry)
_ = relayer.setBridgeRegistryAddr(cfg.BridgeRegistry)
} else if cfg.BridgeRegistry == "" && registrAddrInDB != "" {
//输入地址为空,且数据库中保存地址不为空,则直接使用数据库中的地址
relayer.bridgeRegistryAddr = common.HexToAddress(registrAddrInDB)
}
relayer.eventLogIndex = relayer.getLastBridgeBankProcessedHeight()
relayer.initBridgeBankTx()
go r.proc()
//var wg sync.WaitGroup
//ch := make(chan os.Signal, 1)
//signal.Notify(ch, syscall.SIGTERM)
//go func() {
// <-ch
// cancel()
// wg.Wait()
// os.Exit(0)
//}()
return relayer
}
func (r *suiteEthRelayer) proc() {
r.ethRelayer.backend = r.sim
r.ethRelayer.clientChainID = new(big.Int)
//等待用户导入
relayerLog.Info("Please unlock or import private key for Ethereum relayer")
nilAddr := common.Address{}
if nilAddr != r.ethRelayer.bridgeRegistryAddr {
r.ethRelayer.x2EthContracts = r.x2EthContracts
r.ethRelayer.x2EthDeployInfo = r.x2EthDeployInfo
relayerLog.Info("^-^ ^-^ Succeed to recover corresponding solidity contract handler")
if nil != r.ethRelayer.recoverDeployPara() {
panic("Failed to recoverDeployPara")
}
r.ethRelayer.unlockchan <- start
}
ctx := context.Background()
var timer *time.Ticker
//var err error
continueFailCount := int32(0)
for range r.ethRelayer.unlockchan {
relayerLog.Info("Received ethRelayer.unlockchan")
if nil != r.ethRelayer.privateKey4Chain33 && nilAddr != r.ethRelayer.bridgeRegistryAddr {
relayerLog.Info("Ethereum relayer starts to run...")
r.ethRelayer.prePareSubscribeEvent()
//向bridgeBank订阅事件
r.ethRelayer.subscribeEvent()
//r.ethRelayer.filterLogEvents()
relayerLog.Info("Ethereum relayer starts to process online log event...")
timer = time.NewTicker(time.Duration(r.ethRelayer.fetchHeightPeriodMs) * time.Millisecond)
goto latter
}
}
latter:
for {
select {
case <-timer.C:
r.ethRelayer.procNewHeight(ctx, &continueFailCount)
case err := <-r.ethRelayer.bridgeBankSub.Err():
panic("bridgeBankSub" + err.Error())
case vLog := <-r.ethRelayer.bridgeBankLog:
r.ethRelayer.storeBridgeBankLogs(vLog, true)
}
}
}
func (r *suiteEthRelayer) deployContracts() {
ctx := context.Background()
var backend bind.ContractBackend
backend, r.para = setup.PrepareTestEnvironment()
r.sim = backend.(*backends.SimulatedBackend)
balance, _ := r.sim.BalanceAt(ctx, r.para.Deployer, nil)
fmt.Println("deployer addr,", r.para.Deployer.String(), "balance =", balance.String())
/////////////////////////EstimateGas///////////////////////////
callMsg := ethereum.CallMsg{
From: r.para.Deployer,
Data: common.FromHex(generated.BridgeBankBin),
}
gas, err := r.sim.EstimateGas(ctx, callMsg)
r.NoError(err)
fmt.Printf("\nThe estimated gas=%d\n", gas)
////////////////////////////////////////////////////
r.x2EthContracts, r.x2EthDeployInfo, err = ethtxs.DeployAndInit(backend, r.para)
r.NoError(err)
r.sim.Commit()
}
func initCfg(path string) *relayerTypes.RelayerConfig {
var cfg relayerTypes.RelayerConfig
if _, err := tml.DecodeFile(path, &cfg); err != nil {
fmt.Println(err)
os.Exit(-1)
}
return &cfg
}
#!/bin/sh
#!/usr/bin/env bash
# 官方ci集成脚本
strpwd=$(pwd)
strcmd=${strpwd##*dapp/}
......@@ -11,9 +12,13 @@ FLAG=$2
# shellcheck disable=SC2086,1072
go build -i ${FLAG} -v -o "${OUT_DIR}/ebrelayer" "${SRC_EBRELAYER}"
# shellcheck disable=SC2086,1072
go build -i ${FLAG} -v -o "${OUT_DIR}/ebcli_A" "${SRC_EBCLI}"
# shellcheck disable=SC2086,1072
go build -i ${FLAG} -v -o "${OUT_DIR}/ebcli_B" -ldflags "-X ${SRC_EBCLI}/buildflags.RPCAddr=http://localhost:9902" "${SRC_EBCLI}"
# shellcheck disable=SC2086,1072
go build -i ${FLAG} -v -o "${OUT_DIR}/ebcli_C" -ldflags "-X ${SRC_EBCLI}/buildflags.RPCAddr=http://localhost:9903" "${SRC_EBCLI}"
# shellcheck disable=SC2086,1072
go build -i ${FLAG} -v -o "${OUT_DIR}/ebcli_D" -ldflags "-X ${SRC_EBCLI}/buildflags.RPCAddr=http://localhost:9904" "${SRC_EBCLI}"
cp ../ebrelayer/relayer.toml "${OUT_DIR}/relayer.toml"
......
......@@ -14,14 +14,11 @@ CLIC="./ebcli_C"
CLID="./ebcli_D"
chain33SenderAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
ethValidatorAddrKeyA="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethValidatorAddrKeyB="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
ethValidatorAddrKeyC="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
ethValidatorAddrKeyD="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
# 新增地址 chain33 需要导入地址 转入 10 bty当收费费
chain33Validator1="1GTxrmuWiXavhcvsaH5w9whgVxUrWsUMdV"
chain33Validator2="155ooMPBTF8QQsGAknkK7ei5D78rwDEFe6"
......@@ -31,11 +28,11 @@ chain33ValidatorKey1="0xd627968e445f2a41c92173225791bae1ba42126ae96c32f28f97ff8f
chain33ValidatorKey2="0x9d539bc5fd084eb7fe86ad631dba9aa086dba38418725c38d9751459f567da66"
chain33ValidatorKey3="0x0a6671f101e30a2cc2d79d77436b62cdf2664ed33eb631a9c9e3f3dd348a23be"
chain33ValidatorKey4="0x3818b257b05ee75b6e43ee0e3cfc2d8502342cf67caed533e3756966690b62a5"
ethReceiverAddr1="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethReceiverAddrKey1="355b876d7cbcb930d5dfab767f66336ce327e082cbaa1877210c1bae89b1df71"
ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2="9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
maturityDegree=10
tokenAddrBty=""
......@@ -93,7 +90,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer "./A/ebrelayer"
# 修改 relayer.toml 配置文件
updata_relayer_toml_ropston ${BridgeRegistry} ${maturityDegree} "./A/relayer.toml"
updata_relayer_toml_ropston "${BridgeRegistry}" ${maturityDegree} "./A/relayer.toml"
updata_all_relayer_toml2
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
......@@ -128,7 +125,7 @@ function InitChain33Vilators() {
# query Validators
totalPower=$(${Chain33Cli} send x2ethereum query totalpower -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower | sed 's/\"//g')
check_number 100 ${totalPower}
check_number 100 "${totalPower}"
# cions 转帐到 x2ethereum 合约地址
hash=$(${Chain33Cli} send coins send_exec -e x2ethereum -a 200 -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
......@@ -183,15 +180,6 @@ function EthImportKey() {
result=$(${CLID} relayer ethereum import_chain33privatekey -k "${chain33ValidatorKey4}")
cli_ret "${result}" "import_chain33privatekey"
result=$(${CLIA} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyA}")
cli_ret "${result}" "import_ethprivatekey"
result=$(${CLIB} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyB}")
cli_ret "${result}" "import_ethprivatekeyB"
result=$(${CLIC} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyC}")
cli_ret "${result}" "import_ethprivatekeyC"
result=$(${CLID} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyD}")
cli_ret "${result}" "import_ethprivatekeyD"
result=$(${CLIA} relayer chain33 import_privatekey -k "${ethValidatorAddrKeyA}")
cli_ret "${result}" "A relayer chain33 import_privatekey"
result=$(${CLIB} relayer chain33 import_privatekey -k "${ethValidatorAddrKeyB}")
......@@ -217,7 +205,7 @@ function TestChain33ToEthAssets() {
cli_ret "${result}" "balance" ".balance" "0"
# chain33 lock bty
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t "${tokenSymbol}" -r ${ethReceiverAddr1} -q ${tokenAddrBty} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t "${tokenSymbol}" -r ${ethReceiverAddr1} -q "${tokenAddrBty}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
block_wait "${Chain33Cli}" $((maturityDegree + 3))
check_tx "${Chain33Cli}" "${hash}"
......@@ -286,7 +274,7 @@ function TestETH2Chain33Assets() {
cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}")
cli_ret "${result}" "balance" ".balance" $(echo "${balance}+0.1" | bc)
cli_ret "${result}" "balance" ".balance" "$(echo "${balance}+0.1" | bc)"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
......@@ -331,7 +319,7 @@ function TestETH2Chain33Erc20() {
balance_ret "${result}" "100"
# chain33 burn 100
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33Validator1}")
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33Validator1}")
block_wait "${Chain33Cli}" $((maturityDegree + 3))
check_tx "${Chain33Cli}" "${hash}"
......@@ -368,7 +356,7 @@ function TestChain33ToEthAssetsKill() {
kill_ebrelayerD
# chain33 lock bty
hash=$(${Chain33Cli} send x2ethereum lock -a 1.41 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddrBty} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${Chain33Cli} send x2ethereum lock -a 1.41 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddrBty}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
block_wait "${Chain33Cli}" $((maturityDegree + 3))
check_tx "${Chain33Cli}" "${hash}"
......@@ -423,7 +411,7 @@ function TestETH2Chain33AssetsKill() {
cli_ret "${result}" "lock"
result=$(${CLIA} relayer ethereum balance -o "${bridgeBankAddr}")
cli_ret "${result}" "balance" ".balance" $(echo "${balance}+0.133" | bc)
cli_ret "${result}" "balance" ".balance" "$(echo "${balance}+0.133" | bc)"
# eth 等待 10 个区块
eth_block_wait $((maturityDegree + 3)) https://ropsten-rpc.linkpool.io/
......@@ -459,7 +447,7 @@ function TestETH2Chain33AssetsKill() {
start_ebrelayerD
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}")
cli_ret "${result}" "balance" ".balance" $(echo "${balance}+0.133" | bc)
cli_ret "${result}" "balance" ".balance" "$(echo "${balance}+0.133" | bc)"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
......@@ -515,7 +503,7 @@ function TestETH2Chain33Erc20Kill() {
kill_ebrelayerD
# chain33 burn 100
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33Validator1}")
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33Validator1}")
block_wait "${Chain33Cli}" $((maturityDegree + 3))
check_tx "${Chain33Cli}" "${hash}"
......
......@@ -11,21 +11,16 @@ CLIB="./ebcli_B"
CLIC="./ebcli_C"
CLID="./ebcli_D"
#docker_chain33_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' build_chain33_1)
#Chain33Cli="$GOPATH/src/github.com/33cn/plugin/build/chain33-cli --rpc_laddr http://${docker_chain33_ip}:8801"
docker_chain33_ip=""
Chain33Cli=""
Chain33Cli="docker exec ${NODE3} /root/chain33-cli"
chain33SenderAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
ethValidatorAddrKeyA="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethValidatorAddrKeyB="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
ethValidatorAddrKeyC="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
ethValidatorAddrKeyD="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
# 新增地址 chain33 需要导入地址 转入 10 bty当收费费
chain33Validator1="1GTxrmuWiXavhcvsaH5w9whgVxUrWsUMdV"
chain33Validator2="155ooMPBTF8QQsGAknkK7ei5D78rwDEFe6"
......@@ -35,11 +30,11 @@ chain33ValidatorKey1="0xd627968e445f2a41c92173225791bae1ba42126ae96c32f28f97ff8f
chain33ValidatorKey2="0x9d539bc5fd084eb7fe86ad631dba9aa086dba38418725c38d9751459f567da66"
chain33ValidatorKey3="0x0a6671f101e30a2cc2d79d77436b62cdf2664ed33eb631a9c9e3f3dd348a23be"
chain33ValidatorKey4="0x3818b257b05ee75b6e43ee0e3cfc2d8502342cf67caed533e3756966690b62a5"
ethReceiverAddr1="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethReceiverAddrKey1="355b876d7cbcb930d5dfab767f66336ce327e082cbaa1877210c1bae89b1df71"
ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2="9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
maturityDegree=10
tokenAddrBty=""
tokenAddr=""
......@@ -54,20 +49,20 @@ function start_ebrelayerC() {
start_ebrelayer "./C/ebrelayer" "./C/ebrelayer.log"
${CLIC} relayer unlock -p 123456hzj
sleep 5
eth_block_wait 1
sleep 1
eth_block_wait $((maturityDegree + 2))
sleep 10
}
function start_ebrelayerD() {
start_ebrelayer "./D/ebrelayer" "./D/ebrelayer.log"
${CLID} relayer unlock -p 123456hzj
sleep 5
eth_block_wait 1
sleep 1
eth_block_wait $((maturityDegree + 2))
sleep 10
}
function InitAndDeploy() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLIA} relayer set_pwd -p 123456hzj)
cli_ret "${result}" "set_pwd"
result=$(${CLIA} relayer unlock -p 123456hzj)
......@@ -83,12 +78,12 @@ function EthImportKey() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 重启 ebrelayer 并解锁
for name in A B C D; do
start_ebrelayer "./"$name"/ebrelayer" "./"$name"/ebrelayer.log"
start_ebrelayer "./$name/ebrelayer" "./$name/ebrelayer.log"
# 导入测试地址私钥
CLI="./ebcli_$name"
result=$(${CLI} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLI} relayer set_pwd -p 123456hzj)
result=$(${CLI} relayer unlock -p 123456hzj)
cli_ret "${result}" "unlock"
......@@ -103,15 +98,6 @@ function EthImportKey() {
result=$(${CLID} relayer ethereum import_chain33privatekey -k "${chain33ValidatorKey4}")
cli_ret "${result}" "import_chain33privatekey"
result=$(${CLIA} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyA}")
cli_ret "${result}" "import_ethprivatekey"
result=$(${CLIB} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyB}")
cli_ret "${result}" "import_ethprivatekeyB"
result=$(${CLIC} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyC}")
cli_ret "${result}" "import_ethprivatekeyC"
result=$(${CLID} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyD}")
cli_ret "${result}" "import_ethprivatekeyD"
result=$(${CLIA} relayer chain33 import_privatekey -k "${ethValidatorAddrKeyA}")
cli_ret "${result}" "A relayer chain33 import_privatekey"
result=$(${CLIB} relayer chain33 import_privatekey -k "${ethValidatorAddrKeyB}")
......@@ -150,7 +136,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer "./A/ebrelayer"
# 修改 relayer.toml 配置文件
updata_relayer_toml ${BridgeRegistry} ${maturityDegree} "./A/relayer.toml"
updata_relayer_toml "${BridgeRegistry}" ${maturityDegree} "./A/relayer.toml"
updata_all_relayer_toml2
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
......@@ -185,7 +171,7 @@ function InitChain33Vilators() {
# query Validators
totalPower=$(${Chain33Cli} send x2ethereum query totalpower -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower | sed 's/\"//g')
check_number 100 ${totalPower}
check_number 100 "${totalPower}"
# cions 转帐到 x2ethereum 合约地址
hash=$(${Chain33Cli} send coins send_exec -e x2ethereum -a 200 -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
......@@ -228,7 +214,7 @@ function TestChain33ToEthAssets() {
cli_ret "${result}" "balance" ".balance" "0"
# chain33 lock bty
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t coins.bty -r ${ethReceiverAddr1} -q ${tokenAddrBty} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t coins.bty -r ${ethReceiverAddr1} -q "${tokenAddrBty}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -297,7 +283,7 @@ function TestETH2Chain33Assets() {
cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}")
cli_ret "${result}" "balance" ".balance" $(echo "${balance}+0.1" | bc)
cli_ret "${result}" "balance" ".balance" "$(echo "${balance}+0.1" | bc)"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
......@@ -341,7 +327,7 @@ function TestETH2Chain33Erc20() {
balance_ret "${result}" "100"
# chain33 burn 100
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33Validator1}")
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33Validator1}")
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -368,32 +354,32 @@ function TestChain33ToEthAssetsKill() {
tokenAddrBty=$(cli_ret "${result}" "token4chain33" ".addr")
fi
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr1}" -t "coins.bty")
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr1}" -t "${tokenAddrBty}")
cli_ret "${result}" "balance" ".balance" "0"
kill_ebrelayerC
kill_ebrelayerD
# chain33 lock bty
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t bty -r ${ethReceiverAddr2} -q ${tokenAddrBty} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t coins.bty -r ${ethReceiverAddr2} -q "${tokenAddrBty}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
eth_block_wait $((maturityDegree + 2))
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}" -t "coins.bty")
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}" -t "${tokenAddrBty}")
cli_ret "${result}" "balance" ".balance" "0"
start_ebrelayerC
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}" -t "coins.bty")
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}" -t "${tokenAddrBty}")
cli_ret "${result}" "balance" ".balance" "5"
# eth burn
result=$(${CLIA} relayer ethereum burn -m 5 -k "${ethReceiverAddrKey2}" -r "${chain33Validator1}" -t "${tokenAddrBty}")
cli_ret "${result}" "burn"
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}" -t "coins.bty")
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}" -t "${tokenAddrBty}")
cli_ret "${result}" "balance" ".balance" "0"
# eth 等待 10 个区块
......@@ -466,7 +452,7 @@ function TestETH2Chain33AssetsKill() {
start_ebrelayerD
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}")
cli_ret "${result}" "balance" ".balance" $(echo "${balance}+0.1" | bc)
cli_ret "${result}" "balance" ".balance" "$(echo "${balance}+0.1" | bc)"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
......@@ -522,7 +508,7 @@ function TestETH2Chain33Erc20Kill() {
kill_ebrelayerD
# chain33 burn 100
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33Validator1}")
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33Validator1}")
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -532,6 +518,7 @@ function TestETH2Chain33Erc20Kill() {
eth_block_wait 2
start_ebrelayerC
start_ebrelayerD
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}" -t "${tokenAddr}")
cli_ret "${result}" "balance" ".balance" "100"
......
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
# shellcheck disable=SC2178
set -x
source "./publicTest.sh"
......@@ -9,8 +12,6 @@ Chain33_CLI=""
Ethsender="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethSender0PrivateKey="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
privateKeys[0]="8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
privateKeys[1]="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
privateKeys[2]="1385016736f7379884763f4a39811d1391fa156a7ca017be6afffa52bb327695"
......@@ -28,6 +29,8 @@ ethAddress[5]="0xA4Ea64a583F6e51C3799335b28a8F0529570A635"
ethAddress[6]="0x0C05bA5c230fDaA503b53702aF1962e08D0C60BF"
maturityDegree=10
tokenAddr=""
tokenAddrBty=""
loop_send_lock_eth() {
#while 遍历数组
......@@ -39,7 +42,8 @@ loop_send_lock_eth() {
while [[ i -lt ${#privateKeys[@]} ]]; do
preEthBalance[$i]=$(curl -ksd '{"jsonrpc":"2.0","method":"eth_getBalance","params":["'${ethAddress[i]}'", "latest"],"id":1}' http://localhost:7545 | jq -r ".result")
ethTxHash=$(${CLIA} relayer ethereum lock-async -m 1 -k "${privateKeys[i]}" -r 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
echo ${i} "lock-async tx hash:" ${ethTxHash}
echo ${i} "lock-async tx hash:" "${ethTxHash}"
# shellcheck disable=SC2219
let i++
done
......@@ -49,11 +53,12 @@ loop_send_lock_eth() {
while [[ i -lt ${#privateKeys[@]} ]]; do
nowEthBalance=$(curl -ksd '{"jsonrpc":"2.0","method":"eth_getBalance","params":["'${ethAddress[i]}'", "latest"],"id":1}' http://localhost:7545 | jq -r ".result")
res=$((preEthBalance[i] - nowEthBalance))
echo ${i} "preBalance" ${preEthBalance[i]} "nowBalance" ${nowEthBalance} "diff" ${res}
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
if [[ $res -le 100000000000000000 ]]; then
echo -e "${RED}error number, expect greater than 100000000000000000, get ${res}${NOC}"
exit 1
fi
# shellcheck disable=SC2219
let i++
done
......@@ -72,7 +77,8 @@ loop_send_burn_eth() {
while [[ i -lt ${#privateKeys[@]} ]]; do
preEthBalance[$i]=$(curl -ksd '{"jsonrpc":"2.0","method":"eth_getBalance","params":["'${ethAddress[i]}'", "latest"],"id":1}' http://localhost:7545 | jq -r ".result")
ethTxHash=$(${Chain33_CLI} send x2ethereum burn -a 1 -r ${ethAddress[i]} -t eth -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
echo ${i} "burn chain33 tx hash:" ${ethTxHash}
echo ${i} "burn chain33 tx hash:" "${ethTxHash}"
# shellcheck disable=SC2219
let i++
done
......@@ -82,11 +88,12 @@ loop_send_burn_eth() {
while [[ i -lt ${#privateKeys[@]} ]]; do
nowEthBalance=$(curl -ksd '{"jsonrpc":"2.0","method":"eth_getBalance","params":["'${ethAddress[i]}'", "latest"],"id":1}' http://localhost:7545 | jq -r ".result")
res=$((nowEthBalance - preEthBalance[i]))
echo ${i} "preBalance" ${preEthBalance[i]} "nowBalance" ${nowEthBalance} "diff" ${res}
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
if [[ $res -gt 1000000000000000000 ]]; then
echo -e "${RED}error number, expect greater than 1000000000000000000, get ${res}${NOC}"
exit 1
fi
# shellcheck disable=SC2219
let i++
done
nowChain33Balance=$(${Chain33_CLI} x2ethereum balance -s 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -t eth | jq ".res" | jq ".[]" | jq ".balance" | sed 's/\"//g')
......@@ -106,7 +113,8 @@ loop_send_lock_bty() {
while [[ i -lt ${#privateKeys[@]} ]]; do
preEthBalance[$i]=$(${CLIA} relayer ethereum balance -o "${ethAddress[i]}" -t "${tokenAddrBty}" | jq -r ".balance")
ethTxHash=$(${Chain33_CLI} send x2ethereum lock -q "${tokenAddrBty}" -a 1 -r ${ethAddress[i]} -t coins.bty -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
echo ${i} "lock chain33 tx hash:" ${ethTxHash}
echo ${i} "lock chain33 tx hash:" "${ethTxHash}"
# shellcheck disable=SC2219
let i++
done
......@@ -116,8 +124,9 @@ loop_send_lock_bty() {
while [[ i -lt ${#privateKeys[@]} ]]; do
nowEthBalance=$(${CLIA} relayer ethereum balance -o "${ethAddress[i]}" -t "${tokenAddrBty}" | jq -r ".balance")
res=$((nowEthBalance - preEthBalance[i]))
echo ${i} "preBalance" ${preEthBalance[i]} "nowBalance" ${nowEthBalance} "diff" ${res}
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
check_number "${res}" 1
# shellcheck disable=SC2219
let i++
done
nowChain33Balance=$(${Chain33_CLI} account balance -a 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -e x2ethereum | jq -r ".balance" | sed 's/\"//g')
......@@ -139,7 +148,8 @@ loop_send_burn_bty() {
preEthBalance[$i]=$(${CLIA} relayer ethereum balance -o "${ethAddress[i]}" -t "${tokenAddrBty}" | jq -r ".balance")
approveTxHash=$(${CLIA} relayer ethereum approve -m 1 -k "${privateKeys[i]}" -t "${tokenAddrBty}")
ethTxHash=$(${CLIA} relayer ethereum burn-async -m 1 -k "${privateKeys[i]}" -r 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -t "${tokenAddrBty}")
echo ${i} "burn-async tx hash:" ${ethTxHash}
echo ${i} "burn-async tx hash:" "${ethTxHash}"
# shellcheck disable=SC2219
let i++
done
......@@ -149,8 +159,9 @@ loop_send_burn_bty() {
while [[ i -lt ${#privateKeys[@]} ]]; do
nowEthBalance=$(${CLIA} relayer ethereum balance -o "${ethAddress[i]}" -t "${tokenAddrBty}" | jq -r ".balance")
res=$((preEthBalance[i] - nowEthBalance))
echo ${i} "preBalance" ${preEthBalance[i]} "nowBalance" ${nowEthBalance} "diff" ${res}
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
check_number "${res}" 1
# shellcheck disable=SC2219
let i++
done
nowChain33Balance=$(${Chain33_CLI} account balance -a 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -e x2ethereum | jq -r ".balance" | sed 's/\"//g')
......@@ -170,11 +181,12 @@ loop_send_lock_erc20() {
preEthBalance=$(${CLIA} relayer ethereum balance -o "${Ethsender}" -t "${tokenAddr}" | jq -r ".balance")
approveTxHash=$(${CLIA} relayer ethereum approve -m 10 -k "${privateKeys[5]}" -t "${tokenAddr}")
echo ${i} "lock-async erc20 approve tx hash:" ${approveTxHash}
echo ${i} "lock-async erc20 approve tx hash:" "${approveTxHash}"
while [[ i -lt ${#privateKeys[@]} ]]; do
ethTxHash=$(${CLIA} relayer ethereum lock-async -m 1 -k "${privateKeys[5]}" -r 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -t "${tokenAddr}")
echo ${i} "lock-async erc20 tx hash:" ${ethTxHash}
echo ${i} "lock-async erc20 tx hash:" "${ethTxHash}"
# shellcheck disable=SC2219
let i++
done
......@@ -182,7 +194,7 @@ loop_send_lock_erc20() {
nowEthBalance=$(${CLIA} relayer ethereum balance -o "${Ethsender}" -t "${tokenAddr}" | jq -r ".balance")
res=$((preEthBalance - nowEthBalance))
echo ${i} "preBalance" ${preEthBalance} "nowBalance" ${nowEthBalance} "diff" ${res}
echo ${i} "preBalance" "${preEthBalance}" "nowBalance" "${nowEthBalance}" "diff" ${res}
check_number "${diff}" 7
nowChain33Balance=$(${Chain33_CLI} x2ethereum balance -s 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -t testc | jq ".res" | jq ".[]" | jq ".balance" | sed 's/\"//g')
......@@ -202,7 +214,8 @@ loop_send_burn_erc20() {
while [[ i -lt ${#privateKeys[@]} ]]; do
preEthBalance[i]=$(${CLIA} relayer ethereum balance -o "${ethAddress[i]}" -t "${tokenAddr}" | jq -r ".balance")
ethTxHash=$(${Chain33_CLI} send x2ethereum burn -a 1 -r ${ethAddress[i]} -t testc -q "${tokenAddr}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
echo ${i} "burn chain33 tx hash:" ${ethTxHash}
echo ${i} "burn chain33 tx hash:" "${ethTxHash}"
# shellcheck disable=SC2219
let i++
done
......@@ -212,8 +225,9 @@ loop_send_burn_erc20() {
while [[ i -lt ${#privateKeys[@]} ]]; do
nowEthBalance=$(${CLIA} relayer ethereum balance -o "${ethAddress[i]}" -t "${tokenAddr}" | jq -r ".balance")
res=$((nowEthBalance - preEthBalance[i]))
echo ${i} "preBalance" ${preEthBalance[i]} "nowBalance" ${nowEthBalance} "diff" ${res}
echo ${i} "preBalance" "${preEthBalance[i]}" "nowBalance" "${nowEthBalance}" "diff" ${res}
check_number "${res}" 1
# shellcheck disable=SC2219
let i++
done
......
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
source "./allRelayerTest.sh"
source "./perf_test.sh"
......
......@@ -21,7 +21,6 @@ func Chain33RelayerCmd() *cobra.Command {
ImportPrivateKeyCmd(),
ShowValidatorAddrCmd(),
ShowTxsHashCmd(),
ShowChain33RelayerStatusCmd(),
)
return cmd
......@@ -94,20 +93,3 @@ func showChain33Relayer2EthTxs(cmd *cobra.Command, args []string) {
fmt.Println(hash)
}
}
func ShowChain33RelayerStatusCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "status",
Short: "show chain33-relayer status",
Run: showChain33RelayerStatus,
}
return cmd
}
func showChain33RelayerStatus(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
var res ebTypes.RelayerRunStatus
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.ShowChain33RelayerStatus", nil, &res)
ctx.Run()
}
......@@ -20,6 +20,7 @@ func RelayerCmd() *cobra.Command {
cmd.AddCommand(
SetPwdCmd(),
ChangePwdCmd(),
LockCmd(),
UnlockCmd(),
Chain33RelayerCmd(),
......@@ -41,6 +42,33 @@ func SetPwdCmd() *cobra.Command {
}
func addSetPwdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("password", "p", "", "password,[8-30]letter and digit")
cmd.MarkFlagRequired("password")
}
func setPwd(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
newPwd, _ := cmd.Flags().GetString("password")
params := relayerTypes.ReqSetPasswd{
Passphase: newPwd,
}
var res rpctypes.Reply
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.SetPassphase", params, &res)
ctx.Run()
}
// ChangePwdCmd set password
func ChangePwdCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "change_pwd",
Short: "Change password",
Run: changePwd,
}
addChangePwdFlags(cmd)
return cmd
}
func addChangePwdFlags(cmd *cobra.Command) {
cmd.Flags().StringP("old", "o", "", "old password")
cmd.MarkFlagRequired("old")
......@@ -48,16 +76,16 @@ func addSetPwdFlags(cmd *cobra.Command) {
cmd.MarkFlagRequired("new")
}
func setPwd(cmd *cobra.Command, args []string) {
func changePwd(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
oldPwd, _ := cmd.Flags().GetString("old")
newPwd, _ := cmd.Flags().GetString("new")
params := relayerTypes.ReqSetPasswd{
params := relayerTypes.ReqChangePasswd{
OldPassphase: oldPwd,
NewPassphase: newPwd,
}
var res rpctypes.Reply
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.SetPassphase", params, &res)
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.ChangePassphase", params, &res)
ctx.Run()
}
......
......@@ -23,12 +23,10 @@ func EthereumRelayerCmd() *cobra.Command {
cmd.AddCommand(
ImportChain33PrivateKeyCmd(),
ImportEthValidatorPrivateKeyCmd(),
GenEthPrivateKeyCmd(),
ShowValidatorsAddrCmd(),
ShowChain33TxsHashCmd(),
ShowEthereumTxsHashCmd(),
ShowEthRelayerStatusCmd(),
IsValidatorActiveCmd(),
ShowOperatorCmd(),
DeployContrctsCmd(),
......@@ -36,7 +34,6 @@ func EthereumRelayerCmd() *cobra.Command {
//////auxiliary///////
CreateBridgeTokenCmd(),
CreateEthereumTokenCmd(),
MakeNewProphecyClaimCmd(),
GetBalanceCmd(),
IsProphecyPendingCmd(),
MintErc20Cmd(),
......@@ -80,26 +77,6 @@ func importChain33Privatekey(cmd *cobra.Command, args []string) {
ctx.Run()
}
func ImportEthValidatorPrivateKeyCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "import_ethprivatekey",
Short: "import ethereum's validator private key ",
Run: importEthValidtorPrivatekey,
}
addImportPrivateKeyFlags(cmd)
return cmd
}
func importEthValidtorPrivatekey(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
privateKey, _ := cmd.Flags().GetString("key")
params := privateKey
var res rpctypes.Reply
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.ImportEthValidatorPrivateKey", params, &res)
ctx.Run()
}
func GenEthPrivateKeyCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create_eth_key",
......@@ -181,23 +158,6 @@ func showEthTxs(cmd *cobra.Command, args []string) {
}
}
func ShowEthRelayerStatusCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "status",
Short: "show ethereum-relayer status",
Run: showEthRelayerStatus,
}
return cmd
}
func showEthRelayerStatus(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
var res ebTypes.RelayerRunStatus
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.ShowEthRelayerStatus", nil, &res)
ctx.Run()
}
func IsValidatorActiveCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "active",
......@@ -607,70 +567,6 @@ func ShowBridgeRegistryAddr(cmd *cobra.Command, args []string) {
ctx.Run()
}
func MakeNewProphecyClaimCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "prophecy",
Short: "Make New Prophecy Claim",
Run: MakeNewProphecyClaim,
}
MakeNewProphecyClaimFlags(cmd)
return cmd
}
func MakeNewProphecyClaimFlags(cmd *cobra.Command) {
cmd.Flags().Uint32P("claim", "c", uint32(1), "claim type, 1 denote burn, and 2 denotes lock")
_ = cmd.MarkFlagRequired("claim")
cmd.Flags().StringP("chain33Sender", "a", "", "Chain33Sender")
_ = cmd.MarkFlagRequired("chain33Sender")
cmd.Flags().StringP("token", "t", "", "token address,optional, nil for ETH")
cmd.Flags().StringP("symbol", "s", "", "token symbol")
_ = cmd.MarkFlagRequired("symbol")
cmd.Flags().StringP("ethReceiver", "r", "", "eth Receiver")
_ = cmd.MarkFlagRequired("ethReceiver")
cmd.Flags().Float64P("amount", "m", 0, "amount")
_ = cmd.MarkFlagRequired("amount")
cmd.Flags().StringP("hash", "i", "", "chain33 tx hash")
_ = cmd.MarkFlagRequired("hash")
}
func MakeNewProphecyClaim(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
claimType, _ := cmd.Flags().GetUint32("claim")
if claimType != uint32(1) && claimType != uint32(2) {
fmt.Println("Wrong claim type")
return
}
chain33Sender, _ := cmd.Flags().GetString("chain33Sender")
tokenAddr, _ := cmd.Flags().GetString("token")
symbol, _ := cmd.Flags().GetString("symbol")
ethReceiver, _ := cmd.Flags().GetString("ethReceiver")
amount, _ := cmd.Flags().GetFloat64("amount")
txhash, _ := cmd.Flags().GetString("hash")
nodeAddr, _ := cmd.Flags().GetString("node_addr")
d, err := utils.GetDecimalsFromNode(tokenAddr, nodeAddr)
if err != nil {
fmt.Println("get decimals error")
return
}
realAmount := types.ToWei(amount, d)
para := ebTypes.NewProphecyClaim{
ClaimType: claimType,
Chain33Sender: chain33Sender,
TokenAddr: tokenAddr,
Symbol: symbol,
EthReceiver: ethReceiver,
Amount: realAmount.String(),
TxHash: txhash,
}
var res rpctypes.Reply
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.MakeNewProphecyClaim", para, &res)
ctx.Run()
}
func GetBalanceCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "balance",
......
......@@ -53,3 +53,57 @@ func PrepareTestEnv() (bind.ContractBackend, *ethtxs.DeployPara) {
return sim, para
}
func PrepareTestEnvironment() (bind.ContractBackend, *ethtxs.DeployPara) {
var deployerPrivateKey = "8656d2bc732a8a816a461ba5e2d8aac7c7f85c26a813df30d5327210465eb230"
var ethValidatorAddrKeyA = "3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
var ethValidatorAddrKeyB = "a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
var ethValidatorAddrKeyC = "bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
var ethValidatorAddrKeyD = "c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
genesiskey, _ := crypto.HexToECDSA(deployerPrivateKey)
alloc := make(core.GenesisAlloc)
genesisAddr := crypto.PubkeyToAddress(genesiskey.PublicKey)
genesisAccount := core.GenesisAccount{
Balance: big.NewInt(10000000000 * 10000),
PrivateKey: crypto.FromECDSA(genesiskey),
}
alloc[genesisAddr] = genesisAccount
ethValidatorAddrKey := make([]string, 0)
ethValidatorAddrKey = append(ethValidatorAddrKey, ethValidatorAddrKeyA)
ethValidatorAddrKey = append(ethValidatorAddrKey, ethValidatorAddrKeyB)
ethValidatorAddrKey = append(ethValidatorAddrKey, ethValidatorAddrKeyC)
ethValidatorAddrKey = append(ethValidatorAddrKey, ethValidatorAddrKeyD)
var InitValidators []common.Address
var ValidatorPriKey []*ecdsa.PrivateKey
for _, v := range ethValidatorAddrKey {
key, _ := crypto.HexToECDSA(v)
addr := crypto.PubkeyToAddress(key.PublicKey)
InitValidators = append(InitValidators, addr)
ValidatorPriKey = append(ValidatorPriKey, key)
account := core.GenesisAccount{
Balance: big.NewInt(100000000 * 100),
PrivateKey: crypto.FromECDSA(key),
}
alloc[addr] = account
}
gasLimit := uint64(100000000)
sim := backends.NewSimulatedBackend(alloc, gasLimit)
InitPowers := []*big.Int{big.NewInt(80), big.NewInt(10), big.NewInt(10), big.NewInt(10)}
para := &ethtxs.DeployPara{
DeployPrivateKey: genesiskey,
Deployer: genesisAddr,
Operator: genesisAddr,
InitValidators: InitValidators,
ValidatorPriKey: ValidatorPriKey,
InitPowers: InitPowers,
}
return sim, para
}
......@@ -2,7 +2,6 @@ package ethtxs
import (
"context"
"crypto/ecdsa"
"errors"
"math/big"
......@@ -442,42 +441,3 @@ func LockEthErc20AssetAsync(ownerPrivateKeyStr, tokenAddrStr, chain33Receiver st
}
return tx.Hash().String(), nil
}
/////////////////NewProphecyClaim////////////////
func MakeNewProphecyClaim(newProphecyClaimPara *NewProphecyClaimPara, backend bind.ContractBackend, privateKey *ecdsa.PrivateKey, transactor common.Address, x2EthContracts *X2EthContracts) (string, error) {
var prepareDone bool
authVali, err := PrepareAuth(backend, privateKey, transactor)
if nil != err {
return "", err
}
prepareDone = true
defer func() {
if err != nil && prepareDone {
_, _ = revokeNonce(transactor)
}
}()
amount := newProphecyClaimPara.Amount
ethReceiver := newProphecyClaimPara.EthReceiver
// Generate rawHash using ProphecyClaim data
claimID := crypto.Keccak256Hash(newProphecyClaimPara.Txhash, newProphecyClaimPara.Chain33Sender, newProphecyClaimPara.EthReceiver.Bytes(), newProphecyClaimPara.TokenAddr.Bytes(), amount.Bytes())
// Sign the hash using the active validator's private key
signature, err := SignClaim4Eth(claimID, privateKey)
if nil != err {
return "", err
}
tx, err := x2EthContracts.Oracle.NewOracleClaim(authVali, newProphecyClaimPara.ClaimType, newProphecyClaimPara.Chain33Sender, ethReceiver, newProphecyClaimPara.TokenAddr, newProphecyClaimPara.Symbol, amount, claimID, signature)
if nil != err {
return "", err
}
err = waitEthTxFinished(backend.(*ethclient.Client), tx.Hash(), "MakeNewProphecyClaim")
if nil != err {
return "", err
}
return tx.Hash().String(), nil
}
......@@ -165,9 +165,9 @@ func DeployAndInit(backend bind.ContractBackend, para *DeployPara) (*X2EthContra
/////////////////////////////////////
sim, isSim := backend.(*backends.SimulatedBackend)
if isSim {
fmt.Print("Use the simulator")
fmt.Println("Use the simulator")
} else {
fmt.Print("Use the actual Ethereum")
fmt.Println("Use the actual Ethereum")
}
x2EthContracts.Valset, deployInfo.Valset, err = DeployValset(backend, para.DeployPrivateKey, para.Deployer, para.Operator, para.InitValidators, para.InitPowers)
......
......@@ -7,8 +7,6 @@ import (
"math/big"
"sync"
"time"
ebrelayerTypes "github.com/33cn/plugin/plugin/dapp/x2ethereum/ebrelayer/types"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
......@@ -65,19 +63,6 @@ func prefixMessage(message common.Hash, key *ecdsa.PrivateKey) ([]byte, []byte)
return sig, prefixed
}
// LoadSender : uses the validator's private key to load the validator's address
func LoadSender(privateKey *ecdsa.PrivateKey) (address common.Address, err error) {
// Parse public key
publicKey := privateKey.Public()
publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)
if !ok {
return common.Address{}, ebrelayerTypes.ErrPublicKeyType
}
fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)
return fromAddress, nil
}
func getNonce(sender common.Address, backend bind.ContractBackend) (*big.Int, error) {
if nonceMutex, exist := addr2Nonce[sender]; exist {
nonceMutex.rw.Lock()
......
......@@ -75,7 +75,7 @@ func (chain33Relayer *Relayer4Chain33) StoreAccountWithNewPassphase(newPassphras
accountInfo, err := chain33Relayer.db.Get(chain33AccountKey)
if nil != err {
relayerLog.Info("StoreAccountWithNewPassphase", "pls check account is created already, err", err)
return nil
return err
}
ethAccount := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, ethAccount); nil != err {
......@@ -114,7 +114,6 @@ func (chain33Relayer *Relayer4Chain33) RestorePrivateKeys(passphrase string) err
return nil
}
func (chain33Relayer *Relayer4Chain33) UpdatePrivateKey(Passphrase, privateKey string) error {
return nil
}
//func (chain33Relayer *Relayer4Chain33) UpdatePrivateKey(Passphrase, privateKey string) error {
// return nil
//}
......@@ -39,7 +39,7 @@ type Relayer4Chain33 struct {
db dbm.DB
lastHeight4Tx int64 //等待被处理的具有相应的交易回执的高度
matDegree int32 //成熟度 heightSync2App matDegress height
passphase string
//passphase string
privateKey4Ethereum *ecdsa.PrivateKey
ethSender ethCommon.Address
bridgeRegistryAddr ethCommon.Address
......@@ -49,7 +49,6 @@ type Relayer4Chain33 struct {
ctx context.Context
rwLock sync.RWMutex
unlock chan int
status int32
}
// StartChain33Relayer : initializes a relayer which witnesses events on the chain33 network and relays them to Ethereum
......@@ -85,32 +84,11 @@ func StartChain33Relayer(ctx context.Context, syncTxConfig *ebTypes.SyncTxConfig
return relayer
}
func (chain33Relayer *Relayer4Chain33) SetPassphase(passphase string) {
chain33Relayer.rwLock.Lock()
chain33Relayer.passphase = passphase
chain33Relayer.rwLock.Unlock()
}
func (chain33Relayer *Relayer4Chain33) QueryTxhashRelay2Eth() ebTypes.Txhashes {
txhashs := utils.QueryTxhashes([]byte(chain33ToEthBurnLockTxHashPrefix), chain33Relayer.db)
return ebTypes.Txhashes{Txhash: txhashs}
}
func (chain33Relayer *Relayer4Chain33) GetRunningStatus() (relayerRunStatus *ebTypes.RelayerRunStatus) {
relayerRunStatus = &ebTypes.RelayerRunStatus{}
chain33Relayer.rwLock.RLock()
relayerRunStatus.Status = chain33Relayer.status
chain33Relayer.rwLock.RUnlock()
if relayerRunStatus.Status == ebTypes.StatusPending {
if nil == chain33Relayer.privateKey4Ethereum {
relayerRunStatus.Details = "Ethereum's private key not imported"
}
return
}
relayerRunStatus.Details = "Running"
return
}
func (chain33Relayer *Relayer4Chain33) syncProc(syncCfg *ebTypes.SyncTxReceiptConfig) {
_, _ = fmt.Fprintln(os.Stdout, "Pls unlock or import private key for Chain33 relayer")
<-chain33Relayer.unlock
......
......@@ -23,7 +23,6 @@ import (
)
var (
ethAccountKey = []byte("EthAccount4EthRelayer")
chain33AccountKey = []byte("Chain33Account4EthRelayer")
start = int(1)
)
......@@ -38,42 +37,31 @@ type Key struct {
}
func (ethRelayer *Relayer4Ethereum) NewAccount(passphrase string) (privateKeystr, addr string, err error) {
var privateKey *ecdsa.PrivateKey
privateKey, privateKeystr, addr, err = newKeyAndStore(ethRelayer.db, crand.Reader, passphrase)
_, privateKeystr, addr, err = newKeyAndStore(ethRelayer.db, crand.Reader, passphrase)
if err != nil {
return "", "", err
}
ethRelayer.SetPrivateKey4Ethereum(privateKey)
return
}
func (ethRelayer *Relayer4Ethereum) GetAccount(passphrase string) (privateKey, addr string, err error) {
accountInfo, err := ethRelayer.db.Get(ethAccountKey)
accountInfo, err := ethRelayer.db.Get(chain33AccountKey)
if nil != err {
return "", "", err
}
ethAccount := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, ethAccount); nil != err {
Chain33Account := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, Chain33Account); nil != err {
return "", "", err
}
decryptered := wcom.CBCDecrypterPrivkey([]byte(passphrase), ethAccount.Privkey)
decryptered := wcom.CBCDecrypterPrivkey([]byte(passphrase), Chain33Account.Privkey)
privateKey = chain33Common.ToHex(decryptered)
addr = ethAccount.Addr
addr = Chain33Account.Addr
return
}
func (ethRelayer *Relayer4Ethereum) GetValidatorAddr() (validators x2ethTypes.ValidatorAddr4EthRelayer, err error) {
var ethAccountAddr string
var chain33AccountAddr string
accountInfo, err := ethRelayer.db.Get(ethAccountKey)
if nil == err {
ethAccount := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, ethAccount); nil == err {
ethAccountAddr = ethAccount.Addr
}
}
accountInfo, err = ethRelayer.db.Get(chain33AccountKey)
accountInfo, err := ethRelayer.db.Get(chain33AccountKey)
if nil == err {
ethAccount := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, ethAccount); nil == err {
......@@ -81,40 +69,22 @@ func (ethRelayer *Relayer4Ethereum) GetValidatorAddr() (validators x2ethTypes.Va
}
}
if 0 == len(chain33AccountAddr) && 0 == len(ethAccountAddr) {
if 0 == len(chain33AccountAddr) {
return x2ethTypes.ValidatorAddr4EthRelayer{}, x2ethTypes.ErrNoValidatorConfigured
}
validators = x2ethTypes.ValidatorAddr4EthRelayer{
EthValidator: ethAccountAddr,
Chain33Validator: chain33AccountAddr,
}
return
}
func (ethRelayer *Relayer4Ethereum) RestorePrivateKeys(passPhase string) (err error) {
accountInfo, err := ethRelayer.db.Get(ethAccountKey)
accountInfo, err := ethRelayer.db.Get(chain33AccountKey)
if nil == err {
ethAccount := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, ethAccount); nil == err {
decryptered := wcom.CBCDecrypterPrivkey([]byte(passPhase), ethAccount.Privkey)
privateKey, err := crypto.ToECDSA(decryptered)
if nil != err {
errInfo := fmt.Sprintf("Failed to ToECDSA due to:%s", err.Error())
relayerLog.Info("RestorePrivateKeys", "Failed to ToECDSA:", err.Error())
return errors.New(errInfo)
}
ethRelayer.rwLock.Lock()
ethRelayer.privateKey4Ethereum = privateKey
ethRelayer.rwLock.Unlock()
}
}
accountInfo, err = ethRelayer.db.Get(chain33AccountKey)
if nil == err {
ethAccount := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, ethAccount); nil == err {
decryptered := wcom.CBCDecrypterPrivkey([]byte(passPhase), ethAccount.Privkey)
Chain33Account := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, Chain33Account); nil == err {
decryptered := wcom.CBCDecrypterPrivkey([]byte(passPhase), Chain33Account.Privkey)
var driver secp256k1.Driver
priKey, err := driver.PrivKeyFromBytes(decryptered)
if nil != err {
......@@ -128,7 +98,7 @@ func (ethRelayer *Relayer4Ethereum) RestorePrivateKeys(passPhase string) (err er
}
}
if ethRelayer.privateKey4Ethereum != nil && nil != ethRelayer.privateKey4Chain33 {
if nil != ethRelayer.privateKey4Chain33 {
ethRelayer.unlockchan <- start
}
......@@ -136,20 +106,20 @@ func (ethRelayer *Relayer4Ethereum) RestorePrivateKeys(passPhase string) (err er
}
func (ethRelayer *Relayer4Ethereum) StoreAccountWithNewPassphase(newPassphrase, oldPassphrase string) error {
accountInfo, err := ethRelayer.db.Get(ethAccountKey)
accountInfo, err := ethRelayer.db.Get(chain33AccountKey)
if nil != err {
relayerLog.Info("StoreAccountWithNewPassphase", "pls check account is created already, err", err)
return nil
return err
}
ethAccount := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, ethAccount); nil != err {
Chain33Account := &x2ethTypes.Account4Relayer{}
if err := chain33Types.Decode(accountInfo, Chain33Account); nil != err {
return err
}
decryptered := wcom.CBCDecrypterPrivkey([]byte(oldPassphrase), ethAccount.Privkey)
decryptered := wcom.CBCDecrypterPrivkey([]byte(oldPassphrase), Chain33Account.Privkey)
encryptered := wcom.CBCEncrypterPrivkey([]byte(newPassphrase), decryptered)
ethAccount.Privkey = encryptered
encodedInfo := chain33Types.Encode(ethAccount)
return ethRelayer.db.SetSync(ethAccountKey, encodedInfo)
Chain33Account.Privkey = encryptered
encodedInfo := chain33Types.Encode(Chain33Account)
return ethRelayer.db.SetSync(chain33AccountKey, encodedInfo)
}
func (ethRelayer *Relayer4Ethereum) ImportChain33PrivateKey(passphrase, privateKeyStr string) error {
......@@ -164,9 +134,7 @@ func (ethRelayer *Relayer4Ethereum) ImportChain33PrivateKey(passphrase, privateK
}
ethRelayer.privateKey4Chain33 = priKey
if nil != ethRelayer.privateKey4Ethereum {
ethRelayer.unlockchan <- start
}
addr, err := pubKeyToAddress4Bty(priKey.PubKey().Bytes())
if nil != err {
return err
......@@ -181,33 +149,6 @@ func (ethRelayer *Relayer4Ethereum) ImportChain33PrivateKey(passphrase, privateK
return ethRelayer.db.SetSync(chain33AccountKey, encodedInfo)
}
func (ethRelayer *Relayer4Ethereum) ImportEthValidatorPrivateKey(passphrase, privateKeyStr string) error {
privateKeySli, err := chain33Common.FromHex(privateKeyStr)
if nil != err {
return err
}
privateKeyECDSA, err := crypto.ToECDSA(privateKeySli)
if nil != err {
errInfo := fmt.Sprintf("Failed to ToECDSA due to:%s", err.Error())
relayerLog.Info("RestorePrivateKeys", "Failed to ToECDSA:", err.Error())
return errors.New(errInfo)
}
ethRelayer.rwLock.Lock()
ethRelayer.privateKey4Ethereum = privateKeyECDSA
ethRelayer.rwLock.Unlock()
if nil != ethRelayer.privateKey4Chain33 {
ethRelayer.unlockchan <- start
}
Encryptered := wcom.CBCEncrypterPrivkey([]byte(passphrase), privateKeySli)
ethAccount := &x2ethTypes.Account4Relayer{
Privkey: Encryptered,
Addr: crypto.PubkeyToAddress(privateKeyECDSA.PublicKey).String(),
}
encodedInfo := chain33Types.Encode(ethAccount)
return ethRelayer.db.SetSync(ethAccountKey, encodedInfo)
}
//checksum: first four bytes of double-SHA256.
func checksum(input []byte) (cksum [4]byte) {
h := sha256.New()
......@@ -266,8 +207,7 @@ func newKeyAndStore(db dbm.DB, rand io.Reader, passphrase string) (privateKey *e
Privkey: Encryptered,
Addr: key.Address.Hex(),
}
encodedInfo := chain33Types.Encode(ethAccount)
_ = db.SetSync(ethAccountKey, encodedInfo)
_ = db
privateKeyStr = chain33Common.ToHex(privateKeyBytes)
addr = ethAccount.Addr
......
......@@ -42,12 +42,9 @@ type Relayer4Ethereum struct {
provider string
clientChainID *big.Int
bridgeRegistryAddr common.Address
//validatorName string
db dbm.DB
//passphase string
rwLock sync.RWMutex
privateKey4Chain33 chain33Crypto.PrivKey
privateKey4Ethereum *ecdsa.PrivateKey
ethValidator common.Address
totalTx4Eth2Chain33 int64
totalTx4Chain33ToEth int64
......@@ -56,7 +53,6 @@ type Relayer4Ethereum struct {
maturityDegree int32
fetchHeightPeriodMs int32
eventLogIndex ebTypes.EventLogIndex
status int32
backend bind.ContractBackend
bridgeBankAddr common.Address
bridgeBankSub ethereum.Subscription
......@@ -88,7 +84,6 @@ func StartEthereumRelayer(rpcURL2Chain33 string, db dbm.DB, provider, registryAd
db: db,
unlockchan: make(chan int, 2),
rpcURL2Chain33: rpcURL2Chain33,
status: ebTypes.StatusPending,
bridgeRegistryAddr: common.HexToAddress(registryAddress),
deployInfo: deploy,
maturityDegree: degree,
......@@ -112,34 +107,6 @@ func StartEthereumRelayer(rpcURL2Chain33 string, db dbm.DB, provider, registryAd
return relayer
}
func (ethRelayer *Relayer4Ethereum) SetPrivateKey4Ethereum(privateKey4Ethereum *ecdsa.PrivateKey) {
ethRelayer.rwLock.Lock()
defer ethRelayer.rwLock.Unlock()
ethRelayer.privateKey4Ethereum = privateKey4Ethereum
if ethRelayer.privateKey4Chain33 != nil {
ethRelayer.unlockchan <- start
}
}
func (ethRelayer *Relayer4Ethereum) GetRunningStatus() (relayerRunStatus *ebTypes.RelayerRunStatus) {
relayerRunStatus = &ebTypes.RelayerRunStatus{}
ethRelayer.rwLock.RLock()
relayerRunStatus.Status = ethRelayer.status
ethRelayer.rwLock.RUnlock()
if relayerRunStatus.Status == ebTypes.StatusPending {
if nil == ethRelayer.privateKey4Ethereum {
relayerRunStatus.Details = "Ethereum's private key not imported"
}
if nil == ethRelayer.privateKey4Chain33 {
relayerRunStatus.Details += "\nChain33's private key not imported"
}
return
}
relayerRunStatus.Details = "Running"
return
}
func (ethRelayer *Relayer4Ethereum) recoverDeployPara() (err error) {
if nil == ethRelayer.deployInfo {
return nil
......@@ -162,24 +129,24 @@ func (ethRelayer *Relayer4Ethereum) recoverDeployPara() (err error) {
func (ethRelayer *Relayer4Ethereum) DeployContrcts() (bridgeRegistry string, err error) {
bridgeRegistry = ""
if nil == ethRelayer.deployInfo {
return bridgeRegistry, errors.New("No deploy info configured yet")
return bridgeRegistry, errors.New("no deploy info configured yet")
}
deployPrivateKey, err := crypto.ToECDSA(common.FromHex(ethRelayer.deployInfo.DeployerPrivateKey))
if nil != err {
return bridgeRegistry, err
}
if len(ethRelayer.deployInfo.ValidatorsAddr) != len(ethRelayer.deployInfo.InitPowers) {
return bridgeRegistry, errors.New("Not same number for validator address and power")
return bridgeRegistry, errors.New("not same number for validator address and power")
}
if len(ethRelayer.deployInfo.ValidatorsAddr) < 3 {
return bridgeRegistry, errors.New("The number of validator must be not less than 3")
return bridgeRegistry, errors.New("the number of validator must be not less than 3")
}
nilAddr := common.Address{}
//已经设置了注册合约地址,说明已经部署了相关的合约,不再重复部署
if ethRelayer.bridgeRegistryAddr != nilAddr {
return bridgeRegistry, errors.New("Contract deployed already")
return bridgeRegistry, errors.New("contract deployed already")
}
var validators []common.Address
......@@ -232,7 +199,7 @@ func (ethRelayer *Relayer4Ethereum) GetBalance(tokenAddr, owner string) (string,
func (ethRelayer *Relayer4Ethereum) ShowBridgeBankAddr() (string, error) {
if nil == ethRelayer.x2EthDeployInfo {
return "", errors.New("The relayer is not started yes")
return "", errors.New("the relayer is not started yes")
}
return ethRelayer.x2EthDeployInfo.BridgeBank.Address.String(), nil
......@@ -240,7 +207,7 @@ func (ethRelayer *Relayer4Ethereum) ShowBridgeBankAddr() (string, error) {
func (ethRelayer *Relayer4Ethereum) ShowBridgeRegistryAddr() (string, error) {
if nil == ethRelayer.x2EthDeployInfo {
return "", errors.New("The relayer is not started yes")
return "", errors.New("the relayer is not started yes")
}
return ethRelayer.x2EthDeployInfo.BridgeRegistry.Address.String(), nil
......@@ -262,10 +229,6 @@ func (ethRelayer *Relayer4Ethereum) IsProphecyPending(claimID [32]byte) (bool, e
return ethtxs.IsProphecyPending(claimID, ethRelayer.ethValidator, ethRelayer.x2EthContracts.Chain33Bridge)
}
func (ethRelayer *Relayer4Ethereum) MakeNewProphecyClaim(newProphecyClaimPara *ethtxs.NewProphecyClaimPara) (string, error) {
return ethtxs.MakeNewProphecyClaim(newProphecyClaimPara, ethRelayer.backend, ethRelayer.privateKey4Ethereum, ethRelayer.ethValidator, ethRelayer.x2EthContracts)
}
func (ethRelayer *Relayer4Ethereum) CreateBridgeToken(symbol string) (string, error) {
return ethtxs.CreateBridgeToken(symbol, ethRelayer.backend, ethRelayer.operatorInfo, ethRelayer.x2EthDeployInfo, ethRelayer.x2EthContracts)
}
......@@ -370,12 +333,7 @@ func (ethRelayer *Relayer4Ethereum) proc() {
continueFailCount := int32(0)
for range ethRelayer.unlockchan {
relayerLog.Info("Received ethRelayer.unlockchan")
if nil != ethRelayer.privateKey4Ethereum && nil != ethRelayer.privateKey4Chain33 && nilAddr != ethRelayer.bridgeRegistryAddr {
ethRelayer.ethValidator, err = ethtxs.LoadSender(ethRelayer.privateKey4Ethereum)
if nil != err {
errinfo := fmt.Sprintf("Failed to load validator for ethereum due to:%s", err.Error())
panic(errinfo)
}
if nil != ethRelayer.privateKey4Chain33 && nilAddr != ethRelayer.bridgeRegistryAddr {
relayerLog.Info("Ethereum relayer starts to run...")
ethRelayer.prePareSubscribeEvent()
//向bridgeBank订阅事件
......@@ -592,14 +550,14 @@ func (ethRelayer *Relayer4Ethereum) filterLogEventsProc(logchan chan<- types.Log
relayerLog.Info(title, "received logs with number", len(logs),
"start height", query.FromBlock.String(), "stop height", query.ToBlock.String())
for _, log := range logs {
relayerLog.Info(title, "received log with topics", log.Topics[0].Hex(), "BlockNumber", log.BlockNumber)
if _, exist := eventSig[log.Topics[0].Hex()]; !exist {
for _, logv := range logs {
relayerLog.Info(title, "received log with topics", logv.Topics[0].Hex(), "BlockNumber", logv.BlockNumber)
if _, exist := eventSig[logv.Topics[0].Hex()]; !exist {
continue
}
logchan <- log
relayerLog.Info(title, "get unprocessed log with topic:", log.Topics[0].String(),
"BlockNumber", log.BlockNumber)
logchan <- logv
relayerLog.Info(title, "get unprocessed log with topic:", logv.Topics[0].String(),
"BlockNumber", logv.BlockNumber)
}
if query.ToBlock.Int64() == curHeight {
......
......@@ -3,7 +3,6 @@ package relayer
import (
"errors"
"fmt"
"math/big"
"strconv"
"sync"
"sync/atomic"
......@@ -12,13 +11,11 @@ import (
"github.com/33cn/chain33/common/log/log15"
rpctypes "github.com/33cn/chain33/rpc/types"
chain33Types "github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/x2ethereum/ebrelayer/ethtxs"
"github.com/33cn/plugin/plugin/dapp/x2ethereum/ebrelayer/relayer/chain33"
"github.com/33cn/plugin/plugin/dapp/x2ethereum/ebrelayer/relayer/ethereum"
relayerTypes "github.com/33cn/plugin/plugin/dapp/x2ethereum/ebrelayer/types"
"github.com/33cn/plugin/plugin/dapp/x2ethereum/ebrelayer/utils"
"github.com/33cn/plugin/plugin/dapp/x2ethereum/types"
"github.com/ethereum/go-ethereum/common"
lru "github.com/hashicorp/golang-lru"
)
......@@ -66,6 +63,52 @@ func NewRelayerManager(chain33Relayer *chain33.Relayer4Chain33, ethRelayer *ethe
func (manager *Manager) SetPassphase(setPasswdReq relayerTypes.ReqSetPasswd, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
// 第一次设置密码的时候才使用 后面用 ChangePasswd
if EncryptEnable == manager.encryptFlag {
return errors.New("passphase alreade exists")
}
// 密码合法性校验
if !utils.IsValidPassWord(setPasswdReq.Passphase) {
return chain33Types.ErrInvalidPassWord
}
//使用密码生成passwdhash用于下次密码的验证
newBatch := manager.store.NewBatch(true)
err := manager.store.SetPasswordHash(setPasswdReq.Passphase, newBatch)
if err != nil {
mlog.Error("SetPassphase", "SetPasswordHash err", err)
return err
}
//设置钱包加密标志位
err = manager.store.SetEncryptionFlag(newBatch)
if err != nil {
mlog.Error("SetPassphase", "SetEncryptionFlag err", err)
return err
}
err = newBatch.Write()
if err != nil {
mlog.Error("ProcWalletSetPasswd newBatch.Write", "err", err)
return err
}
manager.passphase = setPasswdReq.Passphase
atomic.StoreInt64(&manager.encryptFlag, EncryptEnable)
*result = rpctypes.Reply{
IsOk: true,
Msg: "Succeed to set passphase",
}
return nil
}
func (manager *Manager) ChangePassphase(setPasswdReq relayerTypes.ReqChangePasswd, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
if setPasswdReq.OldPassphase == setPasswdReq.NewPassphase {
return errors.New("the old password is the same as the new one")
}
// 新密码合法性校验
if !utils.IsValidPassWord(setPasswdReq.NewPassphase) {
return chain33Types.ErrInvalidPassWord
......@@ -80,16 +123,16 @@ func (manager *Manager) SetPassphase(setPasswdReq relayerTypes.ReqSetPasswd, res
}()
// 钱包已经加密需要验证oldpass的正确性
if len(manager.passphase) == 0 && manager.encryptFlag == 1 {
if len(manager.passphase) == 0 && manager.encryptFlag == EncryptEnable {
isok := manager.store.VerifyPasswordHash(setPasswdReq.OldPassphase)
if !isok {
mlog.Error("SetPassphase Verify Oldpasswd fail!")
mlog.Error("ChangePassphase Verify Oldpasswd fail!")
return chain33Types.ErrVerifyOldpasswdFail
}
}
if len(manager.passphase) != 0 && setPasswdReq.OldPassphase != manager.passphase {
mlog.Error("SetPassphase Oldpass err!")
mlog.Error("ChangePassphase Oldpass err!")
return chain33Types.ErrVerifyOldpasswdFail
}
......@@ -97,25 +140,25 @@ func (manager *Manager) SetPassphase(setPasswdReq relayerTypes.ReqSetPasswd, res
newBatch := manager.store.NewBatch(true)
err := manager.store.SetPasswordHash(setPasswdReq.NewPassphase, newBatch)
if err != nil {
mlog.Error("SetPassphase", "SetPasswordHash err", err)
mlog.Error("ChangePassphase", "SetPasswordHash err", err)
return err
}
//设置钱包加密标志位
err = manager.store.SetEncryptionFlag(newBatch)
if err != nil {
mlog.Error("SetPassphase", "SetEncryptionFlag err", err)
mlog.Error("ChangePassphase", "SetEncryptionFlag err", err)
return err
}
err = manager.ethRelayer.StoreAccountWithNewPassphase(setPasswdReq.NewPassphase, setPasswdReq.OldPassphase)
if err != nil {
mlog.Error("SetPassphase", "StoreAccountWithNewPassphase err", err)
mlog.Error("ChangePassphase", "StoreAccountWithNewPassphase err", err)
return err
}
err = manager.chain33Relayer.StoreAccountWithNewPassphase(setPasswdReq.NewPassphase, setPasswdReq.OldPassphase)
if err != nil {
mlog.Error("SetPassphase", "StoreAccountWithNewPassphase err", err)
mlog.Error("ChangePassphase", "StoreAccountWithNewPassphase err", err)
return err
}
......@@ -129,7 +172,7 @@ func (manager *Manager) SetPassphase(setPasswdReq relayerTypes.ReqSetPasswd, res
*result = rpctypes.Reply{
IsOk: true,
Msg: "Succeed to set passphase",
Msg: "Succeed to change passphase",
}
return nil
}
......@@ -239,23 +282,6 @@ func (manager *Manager) ImportChain33PrivateKey4EthRelayer(privateKey string, re
return nil
}
//为ethrelayer导入chain33私钥,为向chain33发送交易时进行签名使用
func (manager *Manager) ImportEthValidatorPrivateKey(privateKey string, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
if err := manager.checkPermission(); nil != err {
return err
}
if err := manager.ethRelayer.ImportEthValidatorPrivateKey(manager.passphase, privateKey); nil != err {
return err
}
*result = rpctypes.Reply{
IsOk: true,
Msg: "Succeed to import ethereum private key for validator",
}
return nil
}
//显示在chain33中以验证人validator身份进行登录的地址
func (manager *Manager) ShowChain33RelayerValidator(param interface{}, result *interface{}) error {
manager.mtx.Lock()
......@@ -459,38 +485,6 @@ func (manager *Manager) LockEthErc20Asset(lockEthErc20Asset relayerTypes.LockEth
return nil
}
func (manager *Manager) MakeNewProphecyClaim(newProphecyClaim relayerTypes.NewProphecyClaim, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
if err := manager.checkPermission(); nil != err {
return err
}
var tokenAddress common.Address
if "" != newProphecyClaim.TokenAddr {
tokenAddress = common.HexToAddress(newProphecyClaim.TokenAddr)
}
bn := big.NewInt(1)
bn, _ = bn.SetString(types.TrimZeroAndDot(newProphecyClaim.Amount), 10)
newProphecyClaimPara := &ethtxs.NewProphecyClaimPara{
ClaimType: uint8(newProphecyClaim.ClaimType),
Chain33Sender: []byte(newProphecyClaim.Chain33Sender),
TokenAddr: tokenAddress,
EthReceiver: common.HexToAddress(newProphecyClaim.EthReceiver),
Symbol: newProphecyClaim.Symbol,
Amount: bn,
Txhash: common.FromHex(newProphecyClaim.TxHash),
}
txhash, err := manager.ethRelayer.MakeNewProphecyClaim(newProphecyClaimPara)
if nil != err {
return err
}
*result = rpctypes.Reply{
IsOk: true,
Msg: fmt.Sprintf("Tx:%s", txhash),
}
return nil
}
func (manager *Manager) IsProphecyPending(claimID [32]byte, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
......@@ -637,20 +631,6 @@ func (manager *Manager) checkPermission() error {
return nil
}
func (manager *Manager) ShowEthRelayerStatus(param interface{}, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
*result = manager.ethRelayer.GetRunningStatus()
return nil
}
func (manager *Manager) ShowChain33RelayerStatus(param interface{}, result *interface{}) error {
manager.mtx.Lock()
defer manager.mtx.Unlock()
*result = manager.chain33Relayer.GetRunningStatus()
return nil
}
func (manager *Manager) ShowEthRelayer2EthTxs(param interface{}, result *interface{}) error {
*result = manager.ethRelayer.QueryTxhashRelay2Eth()
return nil
......
// Code generated by protoc-gen-go. DO NOT EDIT.
// Code generated by protoc-gen-go.
// source: config.proto
// DO NOT EDIT!
/*
Package types is a generated protocol buffer package.
It is generated from these files:
config.proto
relayer.proto
It has these top-level messages:
SyncTxConfig
Log
RelayerConfig
SyncTxReceiptConfig
Deploy
*/
package types
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
)
import proto "github.com/golang/protobuf/proto"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type SyncTxConfig struct {
Chain33Host string `protobuf:"bytes,1,opt,name=chain33host,proto3" json:"chain33host,omitempty"`
PushHost string `protobuf:"bytes,2,opt,name=pushHost,proto3" json:"pushHost,omitempty"`
PushName string `protobuf:"bytes,3,opt,name=pushName,proto3" json:"pushName,omitempty"`
PushBind string `protobuf:"bytes,4,opt,name=pushBind,proto3" json:"pushBind,omitempty"`
MaturityDegree int32 `protobuf:"varint,5,opt,name=maturityDegree,proto3" json:"maturityDegree,omitempty"`
Dbdriver string `protobuf:"bytes,6,opt,name=dbdriver,proto3" json:"dbdriver,omitempty"`
DbPath string `protobuf:"bytes,7,opt,name=dbPath,proto3" json:"dbPath,omitempty"`
DbCache int32 `protobuf:"varint,8,opt,name=dbCache,proto3" json:"dbCache,omitempty"`
FetchHeightPeriodMs int64 `protobuf:"varint,9,opt,name=fetchHeightPeriodMs,proto3" json:"fetchHeightPeriodMs,omitempty"`
StartSyncHeight int64 `protobuf:"varint,10,opt,name=startSyncHeight,proto3" json:"startSyncHeight,omitempty"`
StartSyncSequence int64 `protobuf:"varint,11,opt,name=startSyncSequence,proto3" json:"startSyncSequence,omitempty"`
StartSyncHash string `protobuf:"bytes,12,opt,name=startSyncHash,proto3" json:"startSyncHash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Chain33Host string `protobuf:"bytes,1,opt,name=chain33host" json:"chain33host,omitempty"`
PushHost string `protobuf:"bytes,2,opt,name=pushHost" json:"pushHost,omitempty"`
PushName string `protobuf:"bytes,3,opt,name=pushName" json:"pushName,omitempty"`
PushBind string `protobuf:"bytes,4,opt,name=pushBind" json:"pushBind,omitempty"`
MaturityDegree int32 `protobuf:"varint,5,opt,name=maturityDegree" json:"maturityDegree,omitempty"`
Dbdriver string `protobuf:"bytes,6,opt,name=dbdriver" json:"dbdriver,omitempty"`
DbPath string `protobuf:"bytes,7,opt,name=dbPath" json:"dbPath,omitempty"`
DbCache int32 `protobuf:"varint,8,opt,name=dbCache" json:"dbCache,omitempty"`
FetchHeightPeriodMs int64 `protobuf:"varint,9,opt,name=fetchHeightPeriodMs" json:"fetchHeightPeriodMs,omitempty"`
StartSyncHeight int64 `protobuf:"varint,10,opt,name=startSyncHeight" json:"startSyncHeight,omitempty"`
StartSyncSequence int64 `protobuf:"varint,11,opt,name=startSyncSequence" json:"startSyncSequence,omitempty"`
StartSyncHash string `protobuf:"bytes,12,opt,name=startSyncHash" json:"startSyncHash,omitempty"`
}
func (m *SyncTxConfig) Reset() { *m = SyncTxConfig{} }
func (m *SyncTxConfig) String() string { return proto.CompactTextString(m) }
func (*SyncTxConfig) ProtoMessage() {}
func (*SyncTxConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_3eaf2c85e69e9ea4, []int{0}
}
func (m *SyncTxConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SyncTxConfig.Unmarshal(m, b)
}
func (m *SyncTxConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SyncTxConfig.Marshal(b, m, deterministic)
}
func (m *SyncTxConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncTxConfig.Merge(m, src)
}
func (m *SyncTxConfig) XXX_Size() int {
return xxx_messageInfo_SyncTxConfig.Size(m)
}
func (m *SyncTxConfig) XXX_DiscardUnknown() {
xxx_messageInfo_SyncTxConfig.DiscardUnknown(m)
}
var xxx_messageInfo_SyncTxConfig proto.InternalMessageInfo
func (m *SyncTxConfig) GetChain33Host() string {
if m != nil {
return m.Chain33Host
}
return ""
}
func (m *SyncTxConfig) GetPushHost() string {
if m != nil {
return m.PushHost
}
return ""
}
func (m *SyncTxConfig) GetPushName() string {
if m != nil {
return m.PushName
}
return ""
}
func (m *SyncTxConfig) GetPushBind() string {
if m != nil {
return m.PushBind
}
return ""
}
func (m *SyncTxConfig) GetMaturityDegree() int32 {
if m != nil {
return m.MaturityDegree
}
return 0
}
func (m *SyncTxConfig) GetDbdriver() string {
if m != nil {
return m.Dbdriver
}
return ""
}
func (m *SyncTxConfig) GetDbPath() string {
if m != nil {
return m.DbPath
}
return ""
}
func (m *SyncTxConfig) GetDbCache() int32 {
if m != nil {
return m.DbCache
}
return 0
}
func (m *SyncTxConfig) GetFetchHeightPeriodMs() int64 {
if m != nil {
return m.FetchHeightPeriodMs
}
return 0
}
func (m *SyncTxConfig) GetStartSyncHeight() int64 {
if m != nil {
return m.StartSyncHeight
}
return 0
}
func (m *SyncTxConfig) GetStartSyncSequence() int64 {
if m != nil {
return m.StartSyncSequence
}
return 0
}
func (m *SyncTxConfig) GetStartSyncHash() string {
if m != nil {
return m.StartSyncHash
}
return ""
}
type Log struct {
Loglevel string `protobuf:"bytes,1,opt,name=loglevel,proto3" json:"loglevel,omitempty"`
LogConsoleLevel string `protobuf:"bytes,2,opt,name=logConsoleLevel,proto3" json:"logConsoleLevel,omitempty"`
LogFile string `protobuf:"bytes,3,opt,name=logFile,proto3" json:"logFile,omitempty"`
MaxFileSize uint32 `protobuf:"varint,4,opt,name=maxFileSize,proto3" json:"maxFileSize,omitempty"`
MaxBackups uint32 `protobuf:"varint,5,opt,name=maxBackups,proto3" json:"maxBackups,omitempty"`
MaxAge uint32 `protobuf:"varint,6,opt,name=maxAge,proto3" json:"maxAge,omitempty"`
LocalTime bool `protobuf:"varint,7,opt,name=localTime,proto3" json:"localTime,omitempty"`
Compress bool `protobuf:"varint,8,opt,name=compress,proto3" json:"compress,omitempty"`
CallerFile bool `protobuf:"varint,9,opt,name=callerFile,proto3" json:"callerFile,omitempty"`
CallerFunction bool `protobuf:"varint,10,opt,name=callerFunction,proto3" json:"callerFunction,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Loglevel string `protobuf:"bytes,1,opt,name=loglevel" json:"loglevel,omitempty"`
LogConsoleLevel string `protobuf:"bytes,2,opt,name=logConsoleLevel" json:"logConsoleLevel,omitempty"`
LogFile string `protobuf:"bytes,3,opt,name=logFile" json:"logFile,omitempty"`
MaxFileSize uint32 `protobuf:"varint,4,opt,name=maxFileSize" json:"maxFileSize,omitempty"`
MaxBackups uint32 `protobuf:"varint,5,opt,name=maxBackups" json:"maxBackups,omitempty"`
MaxAge uint32 `protobuf:"varint,6,opt,name=maxAge" json:"maxAge,omitempty"`
LocalTime bool `protobuf:"varint,7,opt,name=localTime" json:"localTime,omitempty"`
Compress bool `protobuf:"varint,8,opt,name=compress" json:"compress,omitempty"`
CallerFile bool `protobuf:"varint,9,opt,name=callerFile" json:"callerFile,omitempty"`
CallerFunction bool `protobuf:"varint,10,opt,name=callerFunction" json:"callerFunction,omitempty"`
}
func (m *Log) Reset() { *m = Log{} }
func (m *Log) String() string { return proto.CompactTextString(m) }
func (*Log) ProtoMessage() {}
func (*Log) Descriptor() ([]byte, []int) {
return fileDescriptor_3eaf2c85e69e9ea4, []int{1}
}
func (m *Log) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Log.Unmarshal(m, b)
}
func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Log.Marshal(b, m, deterministic)
}
func (m *Log) XXX_Merge(src proto.Message) {
xxx_messageInfo_Log.Merge(m, src)
}
func (m *Log) XXX_Size() int {
return xxx_messageInfo_Log.Size(m)
}
func (m *Log) XXX_DiscardUnknown() {
xxx_messageInfo_Log.DiscardUnknown(m)
}
var xxx_messageInfo_Log proto.InternalMessageInfo
func (m *Log) GetLoglevel() string {
if m != nil {
return m.Loglevel
}
return ""
}
func (m *Log) GetLogConsoleLevel() string {
if m != nil {
return m.LogConsoleLevel
}
return ""
}
func (m *Log) GetLogFile() string {
if m != nil {
return m.LogFile
}
return ""
}
func (m *Log) GetMaxFileSize() uint32 {
if m != nil {
return m.MaxFileSize
}
return 0
}
func (m *Log) GetMaxBackups() uint32 {
if m != nil {
return m.MaxBackups
}
return 0
}
func (m *Log) GetMaxAge() uint32 {
if m != nil {
return m.MaxAge
}
return 0
}
func (m *Log) GetLocalTime() bool {
if m != nil {
return m.LocalTime
}
return false
}
func (m *Log) GetCompress() bool {
if m != nil {
return m.Compress
}
return false
}
func (m *Log) GetCallerFile() bool {
if m != nil {
return m.CallerFile
}
return false
}
func (m *Log) GetCallerFunction() bool {
if m != nil {
return m.CallerFunction
}
return false
}
type RelayerConfig struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
SyncTxConfig *SyncTxConfig `protobuf:"bytes,2,opt,name=syncTxConfig,proto3" json:"syncTxConfig,omitempty"`
Log *Log `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
JrpcBindAddr string `protobuf:"bytes,4,opt,name=jrpcBindAddr,proto3" json:"jrpcBindAddr,omitempty"`
EthProvider string `protobuf:"bytes,5,opt,name=ethProvider,proto3" json:"ethProvider,omitempty"`
BridgeRegistry string `protobuf:"bytes,6,opt,name=bridgeRegistry,proto3" json:"bridgeRegistry,omitempty"`
Deploy *Deploy `protobuf:"bytes,7,opt,name=deploy,proto3" json:"deploy,omitempty"`
EthMaturityDegree int32 `protobuf:"varint,8,opt,name=ethMaturityDegree,proto3" json:"ethMaturityDegree,omitempty"`
EthBlockFetchPeriod int32 `protobuf:"varint,9,opt,name=ethBlockFetchPeriod,proto3" json:"ethBlockFetchPeriod,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"`
SyncTxConfig *SyncTxConfig `protobuf:"bytes,2,opt,name=syncTxConfig" json:"syncTxConfig,omitempty"`
Log *Log `protobuf:"bytes,3,opt,name=log" json:"log,omitempty"`
JrpcBindAddr string `protobuf:"bytes,4,opt,name=jrpcBindAddr" json:"jrpcBindAddr,omitempty"`
EthProvider string `protobuf:"bytes,5,opt,name=ethProvider" json:"ethProvider,omitempty"`
BridgeRegistry string `protobuf:"bytes,6,opt,name=bridgeRegistry" json:"bridgeRegistry,omitempty"`
Deploy *Deploy `protobuf:"bytes,7,opt,name=deploy" json:"deploy,omitempty"`
EthMaturityDegree int32 `protobuf:"varint,8,opt,name=ethMaturityDegree" json:"ethMaturityDegree,omitempty"`
EthBlockFetchPeriod int32 `protobuf:"varint,9,opt,name=ethBlockFetchPeriod" json:"ethBlockFetchPeriod,omitempty"`
}
func (m *RelayerConfig) Reset() { *m = RelayerConfig{} }
func (m *RelayerConfig) String() string { return proto.CompactTextString(m) }
func (*RelayerConfig) ProtoMessage() {}
func (*RelayerConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_3eaf2c85e69e9ea4, []int{2}
}
func (m *RelayerConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RelayerConfig.Unmarshal(m, b)
}
func (m *RelayerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RelayerConfig.Marshal(b, m, deterministic)
}
func (m *RelayerConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_RelayerConfig.Merge(m, src)
}
func (m *RelayerConfig) XXX_Size() int {
return xxx_messageInfo_RelayerConfig.Size(m)
}
func (m *RelayerConfig) XXX_DiscardUnknown() {
xxx_messageInfo_RelayerConfig.DiscardUnknown(m)
}
var xxx_messageInfo_RelayerConfig proto.InternalMessageInfo
func (m *RelayerConfig) GetTitle() string {
if m != nil {
return m.Title
}
return ""
}
func (m *RelayerConfig) GetSyncTxConfig() *SyncTxConfig {
if m != nil {
......@@ -320,27 +89,6 @@ func (m *RelayerConfig) GetLog() *Log {
return nil
}
func (m *RelayerConfig) GetJrpcBindAddr() string {
if m != nil {
return m.JrpcBindAddr
}
return ""
}
func (m *RelayerConfig) GetEthProvider() string {
if m != nil {
return m.EthProvider
}
return ""
}
func (m *RelayerConfig) GetBridgeRegistry() string {
if m != nil {
return m.BridgeRegistry
}
return ""
}
func (m *RelayerConfig) GetDeploy() *Deploy {
if m != nil {
return m.Deploy
......@@ -348,229 +96,34 @@ func (m *RelayerConfig) GetDeploy() *Deploy {
return nil
}
func (m *RelayerConfig) GetEthMaturityDegree() int32 {
if m != nil {
return m.EthMaturityDegree
}
return 0
}
func (m *RelayerConfig) GetEthBlockFetchPeriod() int32 {
if m != nil {
return m.EthBlockFetchPeriod
}
return 0
}
type SyncTxReceiptConfig struct {
Chain33Host string `protobuf:"bytes,1,opt,name=chain33host,proto3" json:"chain33host,omitempty"`
PushHost string `protobuf:"bytes,2,opt,name=pushHost,proto3" json:"pushHost,omitempty"`
PushName string `protobuf:"bytes,3,opt,name=pushName,proto3" json:"pushName,omitempty"`
PushBind string `protobuf:"bytes,4,opt,name=pushBind,proto3" json:"pushBind,omitempty"`
StartSyncHeight int64 `protobuf:"varint,5,opt,name=startSyncHeight,proto3" json:"startSyncHeight,omitempty"`
StartSyncSequence int64 `protobuf:"varint,6,opt,name=startSyncSequence,proto3" json:"startSyncSequence,omitempty"`
StartSyncHash string `protobuf:"bytes,7,opt,name=startSyncHash,proto3" json:"startSyncHash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Chain33Host string `protobuf:"bytes,1,opt,name=chain33host" json:"chain33host,omitempty"`
PushHost string `protobuf:"bytes,2,opt,name=pushHost" json:"pushHost,omitempty"`
PushName string `protobuf:"bytes,3,opt,name=pushName" json:"pushName,omitempty"`
PushBind string `protobuf:"bytes,4,opt,name=pushBind" json:"pushBind,omitempty"`
StartSyncHeight int64 `protobuf:"varint,5,opt,name=startSyncHeight" json:"startSyncHeight,omitempty"`
StartSyncSequence int64 `protobuf:"varint,6,opt,name=startSyncSequence" json:"startSyncSequence,omitempty"`
StartSyncHash string `protobuf:"bytes,7,opt,name=startSyncHash" json:"startSyncHash,omitempty"`
}
func (m *SyncTxReceiptConfig) Reset() { *m = SyncTxReceiptConfig{} }
func (m *SyncTxReceiptConfig) String() string { return proto.CompactTextString(m) }
func (*SyncTxReceiptConfig) ProtoMessage() {}
func (*SyncTxReceiptConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_3eaf2c85e69e9ea4, []int{3}
}
func (m *SyncTxReceiptConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SyncTxReceiptConfig.Unmarshal(m, b)
}
func (m *SyncTxReceiptConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SyncTxReceiptConfig.Marshal(b, m, deterministic)
}
func (m *SyncTxReceiptConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncTxReceiptConfig.Merge(m, src)
}
func (m *SyncTxReceiptConfig) XXX_Size() int {
return xxx_messageInfo_SyncTxReceiptConfig.Size(m)
}
func (m *SyncTxReceiptConfig) XXX_DiscardUnknown() {
xxx_messageInfo_SyncTxReceiptConfig.DiscardUnknown(m)
}
var xxx_messageInfo_SyncTxReceiptConfig proto.InternalMessageInfo
func (m *SyncTxReceiptConfig) GetChain33Host() string {
if m != nil {
return m.Chain33Host
}
return ""
}
func (m *SyncTxReceiptConfig) GetPushHost() string {
if m != nil {
return m.PushHost
}
return ""
}
func (m *SyncTxReceiptConfig) GetPushName() string {
if m != nil {
return m.PushName
}
return ""
}
func (m *SyncTxReceiptConfig) GetPushBind() string {
if m != nil {
return m.PushBind
}
return ""
}
func (m *SyncTxReceiptConfig) GetStartSyncHeight() int64 {
if m != nil {
return m.StartSyncHeight
}
return 0
}
func (m *SyncTxReceiptConfig) GetStartSyncSequence() int64 {
if m != nil {
return m.StartSyncSequence
}
return 0
}
func (m *SyncTxReceiptConfig) GetStartSyncHash() string {
if m != nil {
return m.StartSyncHash
}
return ""
}
type Deploy struct {
//操作管理员地址
OperatorAddr string `protobuf:"bytes,1,opt,name=operatorAddr,proto3" json:"operatorAddr,omitempty"`
//合约部署人员私钥,用于部署合约时签名使用
DeployerPrivateKey string `protobuf:"bytes,2,opt,name=deployerPrivateKey,proto3" json:"deployerPrivateKey,omitempty"`
//验证人地址
ValidatorsAddr []string `protobuf:"bytes,3,rep,name=validatorsAddr,proto3" json:"validatorsAddr,omitempty"`
//验证人权重
InitPowers []int64 `protobuf:"varint,4,rep,packed,name=initPowers,proto3" json:"initPowers,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
// 操作管理员地址
OperatorAddr string `protobuf:"bytes,1,opt,name=operatorAddr" json:"operatorAddr,omitempty"`
// 合约部署人员私钥,用于部署合约时签名使用
DeployerPrivateKey string `protobuf:"bytes,2,opt,name=deployerPrivateKey" json:"deployerPrivateKey,omitempty"`
// 验证人地址
ValidatorsAddr []string `protobuf:"bytes,3,rep,name=validatorsAddr" json:"validatorsAddr,omitempty"`
// 验证人权重
InitPowers []int64 `protobuf:"varint,4,rep,name=initPowers" json:"initPowers,omitempty"`
}
func (m *Deploy) Reset() { *m = Deploy{} }
func (m *Deploy) String() string { return proto.CompactTextString(m) }
func (*Deploy) ProtoMessage() {}
func (*Deploy) Descriptor() ([]byte, []int) {
return fileDescriptor_3eaf2c85e69e9ea4, []int{4}
}
func (m *Deploy) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Deploy.Unmarshal(m, b)
}
func (m *Deploy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Deploy.Marshal(b, m, deterministic)
}
func (m *Deploy) XXX_Merge(src proto.Message) {
xxx_messageInfo_Deploy.Merge(m, src)
}
func (m *Deploy) XXX_Size() int {
return xxx_messageInfo_Deploy.Size(m)
}
func (m *Deploy) XXX_DiscardUnknown() {
xxx_messageInfo_Deploy.DiscardUnknown(m)
}
var xxx_messageInfo_Deploy proto.InternalMessageInfo
func (m *Deploy) GetOperatorAddr() string {
if m != nil {
return m.OperatorAddr
}
return ""
}
func (m *Deploy) GetDeployerPrivateKey() string {
if m != nil {
return m.DeployerPrivateKey
}
return ""
}
func (m *Deploy) GetValidatorsAddr() []string {
if m != nil {
return m.ValidatorsAddr
}
return nil
}
func (m *Deploy) GetInitPowers() []int64 {
if m != nil {
return m.InitPowers
}
return nil
}
func init() {
proto.RegisterType((*SyncTxConfig)(nil), "types.SyncTxConfig")
proto.RegisterType((*Log)(nil), "types.Log")
proto.RegisterType((*RelayerConfig)(nil), "types.RelayerConfig")
proto.RegisterType((*SyncTxReceiptConfig)(nil), "types.SyncTxReceiptConfig")
proto.RegisterType((*Deploy)(nil), "types.Deploy")
}
func init() {
proto.RegisterFile("config.proto", fileDescriptor_3eaf2c85e69e9ea4)
}
var fileDescriptor_3eaf2c85e69e9ea4 = []byte{
// 680 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xcd, 0x6e, 0x1a, 0x3b,
0x18, 0x15, 0x4c, 0x20, 0x60, 0xe0, 0x5e, 0x5d, 0xe7, 0xaa, 0x1a, 0x55, 0x51, 0x85, 0x50, 0x5b,
0xb1, 0xa8, 0x50, 0x95, 0x2c, 0xba, 0xce, 0x8f, 0xa2, 0x48, 0x4d, 0x2a, 0xe4, 0xe4, 0x05, 0x8c,
0xe7, 0xcb, 0x8c, 0x1b, 0xcf, 0x78, 0x6a, 0x1b, 0xca, 0xf4, 0x0d, 0xfa, 0x1e, 0x5d, 0xf5, 0x2d,
0xfa, 0x48, 0x7d, 0x83, 0xca, 0xdf, 0x0c, 0x30, 0x10, 0x16, 0xed, 0xaa, 0x3b, 0xce, 0x39, 0xd6,
0x87, 0x7d, 0xce, 0x77, 0x80, 0xf4, 0x85, 0xce, 0x1e, 0x64, 0x3c, 0xc9, 0x8d, 0x76, 0x9a, 0xb6,
0x5c, 0x91, 0x83, 0x1d, 0x7d, 0x0f, 0x48, 0xff, 0xae, 0xc8, 0xc4, 0xfd, 0xf2, 0x02, 0x55, 0x3a,
0x24, 0x3d, 0x91, 0x70, 0x99, 0x9d, 0x9e, 0x26, 0xda, 0xba, 0xb0, 0x31, 0x6c, 0x8c, 0xbb, 0xac,
0x4e, 0xd1, 0xe7, 0xa4, 0x93, 0xcf, 0x6d, 0x72, 0xed, 0xe5, 0x26, 0xca, 0x6b, 0xbc, 0xd2, 0x3e,
0xf0, 0x14, 0xc2, 0x60, 0xa3, 0x79, 0xbc, 0xd2, 0xce, 0x65, 0x16, 0x85, 0x07, 0x1b, 0xcd, 0x63,
0xfa, 0x9a, 0xfc, 0x93, 0x72, 0x37, 0x37, 0xd2, 0x15, 0x97, 0x10, 0x1b, 0x80, 0xb0, 0x35, 0x6c,
0x8c, 0x5b, 0x6c, 0x87, 0xf5, 0x33, 0xa2, 0x59, 0x64, 0xe4, 0x02, 0x4c, 0xd8, 0x2e, 0x67, 0xac,
0x30, 0x7d, 0x46, 0xda, 0xd1, 0x6c, 0xca, 0x5d, 0x12, 0x1e, 0xa2, 0x52, 0x21, 0x1a, 0x92, 0xc3,
0x68, 0x76, 0xc1, 0x45, 0x02, 0x61, 0x07, 0x87, 0xae, 0x20, 0x7d, 0x4b, 0x8e, 0x1e, 0xc0, 0x89,
0xe4, 0x1a, 0x64, 0x9c, 0xb8, 0x29, 0x18, 0xa9, 0xa3, 0x5b, 0x1b, 0x76, 0x87, 0x8d, 0x71, 0xc0,
0xf6, 0x49, 0x74, 0x4c, 0xfe, 0xb5, 0x8e, 0x1b, 0xe7, 0x2d, 0x2b, 0xa5, 0x90, 0xe0, 0xe9, 0x5d,
0x9a, 0xbe, 0x21, 0xff, 0xad, 0xa9, 0x3b, 0xf8, 0x34, 0x87, 0x4c, 0x40, 0xd8, 0xc3, 0xb3, 0x4f,
0x05, 0xfa, 0x92, 0x0c, 0x36, 0x03, 0xb8, 0x4d, 0xc2, 0x3e, 0x3e, 0x61, 0x9b, 0x1c, 0xfd, 0x68,
0x92, 0xe0, 0x46, 0xc7, 0xde, 0x05, 0xa5, 0x63, 0x05, 0x0b, 0x50, 0x55, 0x40, 0x6b, 0xec, 0x6f,
0xa8, 0x74, 0x7c, 0xa1, 0x33, 0xab, 0x15, 0xdc, 0xe0, 0x91, 0x32, 0xa4, 0x5d, 0xda, 0xfb, 0xa2,
0x74, 0x7c, 0x25, 0xd5, 0x2a, 0xaa, 0x15, 0xf4, 0x3b, 0x90, 0xf2, 0xa5, 0xff, 0x78, 0x27, 0xbf,
0x00, 0x86, 0x35, 0x60, 0x75, 0x8a, 0xbe, 0x20, 0x24, 0xe5, 0xcb, 0x73, 0x2e, 0x1e, 0xe7, 0xb9,
0xc5, 0xac, 0x06, 0xac, 0xc6, 0xf8, 0x2c, 0x52, 0xbe, 0x3c, 0x8b, 0x01, 0x53, 0x1a, 0xb0, 0x0a,
0xd1, 0x63, 0xd2, 0x55, 0x5a, 0x70, 0x75, 0x2f, 0x53, 0xc0, 0x98, 0x3a, 0x6c, 0x43, 0xf8, 0x77,
0x09, 0x9d, 0xe6, 0x06, 0xac, 0xc5, 0xa8, 0x3a, 0x6c, 0x8d, 0xfd, 0x37, 0x0a, 0xae, 0x14, 0x18,
0xbc, 0x70, 0x17, 0xd5, 0x1a, 0xe3, 0x37, 0xa8, 0x42, 0xf3, 0x4c, 0x38, 0xa9, 0x33, 0x0c, 0xa6,
0xc3, 0x76, 0xd8, 0xd1, 0xcf, 0x26, 0x19, 0x30, 0x50, 0xbc, 0x00, 0x53, 0x6d, 0xfc, 0xff, 0xa4,
0xe5, 0xa4, 0x53, 0x50, 0x59, 0x59, 0x02, 0xfa, 0x8e, 0xf4, 0x6d, 0xad, 0x17, 0x68, 0x62, 0xef,
0xe4, 0x68, 0x82, 0xb5, 0x99, 0xd4, 0x2b, 0xc3, 0xb6, 0x0e, 0xd2, 0x63, 0x12, 0x28, 0x1d, 0xa3,
0xa5, 0xbd, 0x13, 0x52, 0x9d, 0xbf, 0xd1, 0x31, 0xf3, 0x34, 0x1d, 0x91, 0xfe, 0x47, 0x93, 0x0b,
0xbf, 0xf4, 0x67, 0x51, 0x64, 0xaa, 0x22, 0x6c, 0x71, 0xde, 0x7e, 0x70, 0xc9, 0xd4, 0xe8, 0x85,
0x8c, 0xc0, 0xa0, 0xbb, 0x5d, 0x56, 0xa7, 0xfc, 0x63, 0x67, 0x46, 0x46, 0x31, 0x30, 0x88, 0xa5,
0x75, 0xa6, 0xa8, 0xca, 0xb0, 0xc3, 0xd2, 0x57, 0xa4, 0x1d, 0x41, 0xae, 0x74, 0x81, 0x5e, 0xf7,
0x4e, 0x06, 0xd5, 0x75, 0x2e, 0x91, 0x64, 0x95, 0xe8, 0x77, 0x15, 0x5c, 0x72, 0xbb, 0x5d, 0xc0,
0xb2, 0x2b, 0x4f, 0x05, 0xdf, 0x1a, 0x70, 0xc9, 0xb9, 0xd2, 0xe2, 0xf1, 0xca, 0x57, 0xa4, 0x2c,
0x07, 0x46, 0xd2, 0x62, 0xfb, 0xa4, 0xd1, 0xd7, 0x26, 0x39, 0x2a, 0x1d, 0x63, 0x20, 0x40, 0xe6,
0xee, 0xaf, 0xfe, 0xd6, 0xec, 0xe9, 0x70, 0xeb, 0x0f, 0x3a, 0xdc, 0xfe, 0xed, 0x0e, 0x1f, 0xee,
0xeb, 0xf0, 0xb7, 0x06, 0x69, 0x97, 0xf6, 0xfb, 0x5d, 0xd0, 0x39, 0x18, 0xee, 0xb4, 0xc1, 0x5d,
0x28, 0xdf, 0xbf, 0xc5, 0xd1, 0x09, 0xa1, 0x65, 0x48, 0x60, 0xa6, 0x46, 0x2e, 0xb8, 0x83, 0xf7,
0x50, 0x54, 0x56, 0xec, 0x51, 0xfc, 0x66, 0x2c, 0xb8, 0x92, 0x91, 0x1f, 0x60, 0x71, 0x6a, 0x30,
0x0c, 0xfc, 0x66, 0x6c, 0xb3, 0xbe, 0x4e, 0x32, 0x93, 0x6e, 0xaa, 0x3f, 0x83, 0xb1, 0xe1, 0xc1,
0x30, 0x18, 0x07, 0xac, 0xc6, 0xcc, 0xda, 0xf8, 0x2f, 0x71, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff,
0x09, 0xa3, 0xd6, 0xaa, 0x35, 0x06, 0x00, 0x00,
}
......@@ -11,19 +11,22 @@ message Account4Relayer {
}
message ValidatorAddr4EthRelayer {
string ethValidator = 1;
string chain33Validator = 2;
string chain33Validator = 1;
}
message Txhashes {
repeated string txhash = 1;
}
message ReqSetPasswd {
message ReqChangePasswd {
string oldPassphase = 1;
string newPassphase = 2;
}
message ReqSetPasswd {
string Passphase = 1;
}
message Account4Show {
string privkey = 1;
string addr = 2;
......
// Code generated by protoc-gen-go. DO NOT EDIT.
// Code generated by protoc-gen-go.
// source: relayer.proto
// DO NOT EDIT!
package types
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
)
import proto "github.com/golang/protobuf/proto"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
//以太坊账户信息
// 以太坊账户信息
// privkey : 账户地址对应的私钥
// addr :账户地址
type Account4Relayer struct {
Privkey []byte `protobuf:"bytes,1,opt,name=privkey,proto3" json:"privkey,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Addr string `protobuf:"bytes,2,opt,name=addr" json:"addr,omitempty"`
}
func (m *Account4Relayer) Reset() { *m = Account4Relayer{} }
func (m *Account4Relayer) String() string { return proto.CompactTextString(m) }
func (*Account4Relayer) ProtoMessage() {}
func (*Account4Relayer) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{0}
}
func (m *Account4Relayer) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Account4Relayer.Unmarshal(m, b)
}
func (m *Account4Relayer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Account4Relayer.Marshal(b, m, deterministic)
}
func (m *Account4Relayer) XXX_Merge(src proto.Message) {
xxx_messageInfo_Account4Relayer.Merge(m, src)
}
func (m *Account4Relayer) XXX_Size() int {
return xxx_messageInfo_Account4Relayer.Size(m)
}
func (m *Account4Relayer) XXX_DiscardUnknown() {
xxx_messageInfo_Account4Relayer.DiscardUnknown(m)
}
var xxx_messageInfo_Account4Relayer proto.InternalMessageInfo
func (m *Account4Relayer) GetPrivkey() []byte {
if m != nil {
return m.Privkey
}
return nil
}
func (m *Account4Relayer) GetAddr() string {
if m != nil {
return m.Addr
}
return ""
}
type ValidatorAddr4EthRelayer struct {
EthValidator string `protobuf:"bytes,1,opt,name=ethValidator,proto3" json:"ethValidator,omitempty"`
Chain33Validator string `protobuf:"bytes,2,opt,name=chain33Validator,proto3" json:"chain33Validator,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Chain33Validator string `protobuf:"bytes,1,opt,name=chain33Validator" json:"chain33Validator,omitempty"`
}
func (m *ValidatorAddr4EthRelayer) Reset() { *m = ValidatorAddr4EthRelayer{} }
func (m *ValidatorAddr4EthRelayer) String() string { return proto.CompactTextString(m) }
func (*ValidatorAddr4EthRelayer) ProtoMessage() {}
func (*ValidatorAddr4EthRelayer) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{1}
}
func (m *ValidatorAddr4EthRelayer) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ValidatorAddr4EthRelayer.Unmarshal(m, b)
}
func (m *ValidatorAddr4EthRelayer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ValidatorAddr4EthRelayer.Marshal(b, m, deterministic)
}
func (m *ValidatorAddr4EthRelayer) XXX_Merge(src proto.Message) {
xxx_messageInfo_ValidatorAddr4EthRelayer.Merge(m, src)
}
func (m *ValidatorAddr4EthRelayer) XXX_Size() int {
return xxx_messageInfo_ValidatorAddr4EthRelayer.Size(m)
}
func (m *ValidatorAddr4EthRelayer) XXX_DiscardUnknown() {
xxx_messageInfo_ValidatorAddr4EthRelayer.DiscardUnknown(m)
}
var xxx_messageInfo_ValidatorAddr4EthRelayer proto.InternalMessageInfo
func (m *ValidatorAddr4EthRelayer) GetEthValidator() string {
if m != nil {
return m.EthValidator
}
return ""
}
func (m *ValidatorAddr4EthRelayer) GetChain33Validator() string {
if m != nil {
return m.Chain33Validator
}
return ""
}
type Txhashes struct {
Txhash []string `protobuf:"bytes,1,rep,name=txhash,proto3" json:"txhash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Txhash []string `protobuf:"bytes,1,rep,name=txhash" json:"txhash,omitempty"`
}
func (m *Txhashes) Reset() { *m = Txhashes{} }
func (m *Txhashes) String() string { return proto.CompactTextString(m) }
func (*Txhashes) ProtoMessage() {}
func (*Txhashes) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{2}
}
func (m *Txhashes) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Txhashes.Unmarshal(m, b)
}
func (m *Txhashes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Txhashes.Marshal(b, m, deterministic)
}
func (m *Txhashes) XXX_Merge(src proto.Message) {
xxx_messageInfo_Txhashes.Merge(m, src)
type ReqChangePasswd struct {
OldPassphase string `protobuf:"bytes,1,opt,name=oldPassphase" json:"oldPassphase,omitempty"`
NewPassphase string `protobuf:"bytes,2,opt,name=newPassphase" json:"newPassphase,omitempty"`
}
func (m *Txhashes) XXX_Size() int {
return xxx_messageInfo_Txhashes.Size(m)
}
func (m *Txhashes) XXX_DiscardUnknown() {
xxx_messageInfo_Txhashes.DiscardUnknown(m)
}
var xxx_messageInfo_Txhashes proto.InternalMessageInfo
func (m *Txhashes) GetTxhash() []string {
if m != nil {
return m.Txhash
}
return nil
}
func (m *ReqChangePasswd) Reset() { *m = ReqChangePasswd{} }
func (m *ReqChangePasswd) String() string { return proto.CompactTextString(m) }
func (*ReqChangePasswd) ProtoMessage() {}
type ReqSetPasswd struct {
OldPassphase string `protobuf:"bytes,1,opt,name=oldPassphase,proto3" json:"oldPassphase,omitempty"`
NewPassphase string `protobuf:"bytes,2,opt,name=newPassphase,proto3" json:"newPassphase,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Passphase string `protobuf:"bytes,1,opt" json:"Passphase,omitempty"`
}
func (m *ReqSetPasswd) Reset() { *m = ReqSetPasswd{} }
func (m *ReqSetPasswd) String() string { return proto.CompactTextString(m) }
func (*ReqSetPasswd) ProtoMessage() {}
func (*ReqSetPasswd) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{3}
}
func (m *ReqSetPasswd) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqSetPasswd.Unmarshal(m, b)
}
func (m *ReqSetPasswd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqSetPasswd.Marshal(b, m, deterministic)
}
func (m *ReqSetPasswd) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqSetPasswd.Merge(m, src)
}
func (m *ReqSetPasswd) XXX_Size() int {
return xxx_messageInfo_ReqSetPasswd.Size(m)
}
func (m *ReqSetPasswd) XXX_DiscardUnknown() {
xxx_messageInfo_ReqSetPasswd.DiscardUnknown(m)
}
var xxx_messageInfo_ReqSetPasswd proto.InternalMessageInfo
func (m *ReqSetPasswd) GetOldPassphase() string {
if m != nil {
return m.OldPassphase
}
return ""
}
func (m *ReqSetPasswd) GetNewPassphase() string {
if m != nil {
return m.NewPassphase
}
return ""
}
type Account4Show struct {
Privkey string `protobuf:"bytes,1,opt,name=privkey,proto3" json:"privkey,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Privkey string `protobuf:"bytes,1,opt,name=privkey" json:"privkey,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr" json:"addr,omitempty"`
}
func (m *Account4Show) Reset() { *m = Account4Show{} }
func (m *Account4Show) String() string { return proto.CompactTextString(m) }
func (*Account4Show) ProtoMessage() {}
func (*Account4Show) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{4}
}
func (m *Account4Show) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Account4Show.Unmarshal(m, b)
}
func (m *Account4Show) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Account4Show.Marshal(b, m, deterministic)
}
func (m *Account4Show) XXX_Merge(src proto.Message) {
xxx_messageInfo_Account4Show.Merge(m, src)
}
func (m *Account4Show) XXX_Size() int {
return xxx_messageInfo_Account4Show.Size(m)
}
func (m *Account4Show) XXX_DiscardUnknown() {
xxx_messageInfo_Account4Show.DiscardUnknown(m)
}
var xxx_messageInfo_Account4Show proto.InternalMessageInfo
func (m *Account4Show) GetPrivkey() string {
if m != nil {
return m.Privkey
}
return ""
}
func (m *Account4Show) GetAddr() string {
if m != nil {
return m.Addr
}
return ""
}
type AssetType struct {
Chain string `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"`
IssueContract string `protobuf:"bytes,2,opt,name=issueContract,proto3" json:"issueContract,omitempty"`
Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Chain string `protobuf:"bytes,1,opt,name=chain" json:"chain,omitempty"`
IssueContract string `protobuf:"bytes,2,opt,name=issueContract" json:"issueContract,omitempty"`
Symbol string `protobuf:"bytes,3,opt,name=symbol" json:"symbol,omitempty"`
}
func (m *AssetType) Reset() { *m = AssetType{} }
func (m *AssetType) String() string { return proto.CompactTextString(m) }
func (*AssetType) ProtoMessage() {}
func (*AssetType) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{5}
}
func (m *AssetType) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AssetType.Unmarshal(m, b)
}
func (m *AssetType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AssetType.Marshal(b, m, deterministic)
}
func (m *AssetType) XXX_Merge(src proto.Message) {
xxx_messageInfo_AssetType.Merge(m, src)
}
func (m *AssetType) XXX_Size() int {
return xxx_messageInfo_AssetType.Size(m)
}
func (m *AssetType) XXX_DiscardUnknown() {
xxx_messageInfo_AssetType.DiscardUnknown(m)
}
var xxx_messageInfo_AssetType proto.InternalMessageInfo
func (m *AssetType) GetChain() string {
if m != nil {
return m.Chain
}
return ""
}
func (m *AssetType) GetIssueContract() string {
if m != nil {
return m.IssueContract
}
return ""
}
func (m *AssetType) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
type EthBridgeClaim struct {
EthereumChainID int64 `protobuf:"varint,1,opt,name=ethereumChainID,proto3" json:"ethereumChainID,omitempty"`
BridgeBrankAddr string `protobuf:"bytes,2,opt,name=bridgeBrankAddr,proto3" json:"bridgeBrankAddr,omitempty"`
Nonce int64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
TokenAddr string `protobuf:"bytes,4,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
Symbol string `protobuf:"bytes,5,opt,name=symbol,proto3" json:"symbol,omitempty"`
EthereumSender string `protobuf:"bytes,6,opt,name=ethereumSender,proto3" json:"ethereumSender,omitempty"`
Chain33Receiver string `protobuf:"bytes,7,opt,name=chain33Receiver,proto3" json:"chain33Receiver,omitempty"`
Amount string `protobuf:"bytes,9,opt,name=amount,proto3" json:"amount,omitempty"`
ClaimType int32 `protobuf:"varint,10,opt,name=claimType,proto3" json:"claimType,omitempty"`
ChainName string `protobuf:"bytes,11,opt,name=chainName,proto3" json:"chainName,omitempty"`
Decimal int64 `protobuf:"varint,12,opt,name=decimal,proto3" json:"decimal,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
EthereumChainID int64 `protobuf:"varint,1,opt,name=ethereumChainID" json:"ethereumChainID,omitempty"`
BridgeBrankAddr string `protobuf:"bytes,2,opt,name=bridgeBrankAddr" json:"bridgeBrankAddr,omitempty"`
Nonce int64 `protobuf:"varint,3,opt,name=nonce" json:"nonce,omitempty"`
TokenAddr string `protobuf:"bytes,4,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
Symbol string `protobuf:"bytes,5,opt,name=symbol" json:"symbol,omitempty"`
EthereumSender string `protobuf:"bytes,6,opt,name=ethereumSender" json:"ethereumSender,omitempty"`
Chain33Receiver string `protobuf:"bytes,7,opt,name=chain33Receiver" json:"chain33Receiver,omitempty"`
Amount string `protobuf:"bytes,9,opt,name=amount" json:"amount,omitempty"`
ClaimType int32 `protobuf:"varint,10,opt,name=claimType" json:"claimType,omitempty"`
ChainName string `protobuf:"bytes,11,opt,name=chainName" json:"chainName,omitempty"`
Decimal int64 `protobuf:"varint,12,opt,name=decimal" json:"decimal,omitempty"`
}
func (m *EthBridgeClaim) Reset() { *m = EthBridgeClaim{} }
func (m *EthBridgeClaim) String() string { return proto.CompactTextString(m) }
func (*EthBridgeClaim) ProtoMessage() {}
func (*EthBridgeClaim) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{6}
}
func (m *EthBridgeClaim) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EthBridgeClaim.Unmarshal(m, b)
}
func (m *EthBridgeClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EthBridgeClaim.Marshal(b, m, deterministic)
}
func (m *EthBridgeClaim) XXX_Merge(src proto.Message) {
xxx_messageInfo_EthBridgeClaim.Merge(m, src)
}
func (m *EthBridgeClaim) XXX_Size() int {
return xxx_messageInfo_EthBridgeClaim.Size(m)
}
func (m *EthBridgeClaim) XXX_DiscardUnknown() {
xxx_messageInfo_EthBridgeClaim.DiscardUnknown(m)
}
var xxx_messageInfo_EthBridgeClaim proto.InternalMessageInfo
func (m *EthBridgeClaim) GetEthereumChainID() int64 {
if m != nil {
return m.EthereumChainID
}
return 0
}
func (m *EthBridgeClaim) GetBridgeBrankAddr() string {
if m != nil {
return m.BridgeBrankAddr
}
return ""
}
func (m *EthBridgeClaim) GetNonce() int64 {
if m != nil {
return m.Nonce
}
return 0
}
func (m *EthBridgeClaim) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
func (m *EthBridgeClaim) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
func (m *EthBridgeClaim) GetEthereumSender() string {
if m != nil {
return m.EthereumSender
}
return ""
}
func (m *EthBridgeClaim) GetChain33Receiver() string {
if m != nil {
return m.Chain33Receiver
}
return ""
}
func (m *EthBridgeClaim) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
func (m *EthBridgeClaim) GetClaimType() int32 {
if m != nil {
return m.ClaimType
}
return 0
}
func (m *EthBridgeClaim) GetChainName() string {
if m != nil {
return m.ChainName
}
return ""
}
func (m *EthBridgeClaim) GetDecimal() int64 {
if m != nil {
return m.Decimal
}
return 0
}
type ImportKeyReq struct {
PrivateKey string `protobuf:"bytes,1,opt,name=privateKey,proto3" json:"privateKey,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
PrivateKey string `protobuf:"bytes,1,opt,name=privateKey" json:"privateKey,omitempty"`
}
func (m *ImportKeyReq) Reset() { *m = ImportKeyReq{} }
func (m *ImportKeyReq) String() string { return proto.CompactTextString(m) }
func (*ImportKeyReq) ProtoMessage() {}
func (*ImportKeyReq) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{7}
}
func (m *ImportKeyReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ImportKeyReq.Unmarshal(m, b)
}
func (m *ImportKeyReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ImportKeyReq.Marshal(b, m, deterministic)
}
func (m *ImportKeyReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_ImportKeyReq.Merge(m, src)
}
func (m *ImportKeyReq) XXX_Size() int {
return xxx_messageInfo_ImportKeyReq.Size(m)
}
func (m *ImportKeyReq) XXX_DiscardUnknown() {
xxx_messageInfo_ImportKeyReq.DiscardUnknown(m)
}
var xxx_messageInfo_ImportKeyReq proto.InternalMessageInfo
func (m *ImportKeyReq) GetPrivateKey() string {
if m != nil {
return m.PrivateKey
}
return ""
}
type RelayerRunStatus struct {
Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
Details string `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Status int32 `protobuf:"varint,1,opt,name=status" json:"status,omitempty"`
Details string `protobuf:"bytes,2,opt,name=details" json:"details,omitempty"`
}
func (m *RelayerRunStatus) Reset() { *m = RelayerRunStatus{} }
func (m *RelayerRunStatus) String() string { return proto.CompactTextString(m) }
func (*RelayerRunStatus) ProtoMessage() {}
func (*RelayerRunStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{8}
}
func (m *RelayerRunStatus) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RelayerRunStatus.Unmarshal(m, b)
}
func (m *RelayerRunStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RelayerRunStatus.Marshal(b, m, deterministic)
}
func (m *RelayerRunStatus) XXX_Merge(src proto.Message) {
xxx_messageInfo_RelayerRunStatus.Merge(m, src)
}
func (m *RelayerRunStatus) XXX_Size() int {
return xxx_messageInfo_RelayerRunStatus.Size(m)
}
func (m *RelayerRunStatus) XXX_DiscardUnknown() {
xxx_messageInfo_RelayerRunStatus.DiscardUnknown(m)
}
var xxx_messageInfo_RelayerRunStatus proto.InternalMessageInfo
func (m *RelayerRunStatus) GetStatus() int32 {
if m != nil {
return m.Status
}
return 0
}
func (m *RelayerRunStatus) GetDetails() string {
if m != nil {
return m.Details
}
return ""
}
type NewProphecyClaim struct {
ClaimType uint32 `protobuf:"varint,1,opt,name=claimType,proto3" json:"claimType,omitempty"`
Chain33Sender string `protobuf:"bytes,2,opt,name=chain33Sender,proto3" json:"chain33Sender,omitempty"`
TokenAddr string `protobuf:"bytes,3,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"`
EthReceiver string `protobuf:"bytes,5,opt,name=ethReceiver,proto3" json:"ethReceiver,omitempty"`
Amount string `protobuf:"bytes,6,opt,name=amount,proto3" json:"amount,omitempty"`
TxHash string `protobuf:"bytes,7,opt,name=txHash,proto3" json:"txHash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
ClaimType uint32 `protobuf:"varint,1,opt,name=claimType" json:"claimType,omitempty"`
Chain33Sender string `protobuf:"bytes,2,opt,name=chain33Sender" json:"chain33Sender,omitempty"`
TokenAddr string `protobuf:"bytes,3,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
Symbol string `protobuf:"bytes,4,opt,name=symbol" json:"symbol,omitempty"`
EthReceiver string `protobuf:"bytes,5,opt,name=ethReceiver" json:"ethReceiver,omitempty"`
Amount string `protobuf:"bytes,6,opt,name=amount" json:"amount,omitempty"`
TxHash string `protobuf:"bytes,7,opt,name=txHash" json:"txHash,omitempty"`
}
func (m *NewProphecyClaim) Reset() { *m = NewProphecyClaim{} }
func (m *NewProphecyClaim) String() string { return proto.CompactTextString(m) }
func (*NewProphecyClaim) ProtoMessage() {}
func (*NewProphecyClaim) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{9}
}
func (m *NewProphecyClaim) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NewProphecyClaim.Unmarshal(m, b)
}
func (m *NewProphecyClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_NewProphecyClaim.Marshal(b, m, deterministic)
}
func (m *NewProphecyClaim) XXX_Merge(src proto.Message) {
xxx_messageInfo_NewProphecyClaim.Merge(m, src)
}
func (m *NewProphecyClaim) XXX_Size() int {
return xxx_messageInfo_NewProphecyClaim.Size(m)
}
func (m *NewProphecyClaim) XXX_DiscardUnknown() {
xxx_messageInfo_NewProphecyClaim.DiscardUnknown(m)
}
var xxx_messageInfo_NewProphecyClaim proto.InternalMessageInfo
func (m *NewProphecyClaim) GetClaimType() uint32 {
if m != nil {
return m.ClaimType
}
return 0
}
func (m *NewProphecyClaim) GetChain33Sender() string {
if m != nil {
return m.Chain33Sender
}
return ""
}
func (m *NewProphecyClaim) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
func (m *NewProphecyClaim) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
func (m *NewProphecyClaim) GetEthReceiver() string {
if m != nil {
return m.EthReceiver
}
return ""
}
func (m *NewProphecyClaim) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
func (m *NewProphecyClaim) GetTxHash() string {
if m != nil {
return m.TxHash
}
return ""
}
type BalanceAddr struct {
Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BalanceAddr) Reset() { *m = BalanceAddr{} }
func (m *BalanceAddr) String() string { return proto.CompactTextString(m) }
func (*BalanceAddr) ProtoMessage() {}
func (*BalanceAddr) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{10}
}
func (m *BalanceAddr) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BalanceAddr.Unmarshal(m, b)
}
func (m *BalanceAddr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BalanceAddr.Marshal(b, m, deterministic)
}
func (m *BalanceAddr) XXX_Merge(src proto.Message) {
xxx_messageInfo_BalanceAddr.Merge(m, src)
}
func (m *BalanceAddr) XXX_Size() int {
return xxx_messageInfo_BalanceAddr.Size(m)
}
func (m *BalanceAddr) XXX_DiscardUnknown() {
xxx_messageInfo_BalanceAddr.DiscardUnknown(m)
}
var xxx_messageInfo_BalanceAddr proto.InternalMessageInfo
func (m *BalanceAddr) GetOwner() string {
if m != nil {
return m.Owner
}
return ""
}
func (m *BalanceAddr) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
type MintToken struct {
Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MintToken) Reset() { *m = MintToken{} }
func (m *MintToken) String() string { return proto.CompactTextString(m) }
func (*MintToken) ProtoMessage() {}
func (*MintToken) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{11}
}
func (m *MintToken) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MintToken.Unmarshal(m, b)
}
func (m *MintToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MintToken.Marshal(b, m, deterministic)
}
func (m *MintToken) XXX_Merge(src proto.Message) {
xxx_messageInfo_MintToken.Merge(m, src)
}
func (m *MintToken) XXX_Size() int {
return xxx_messageInfo_MintToken.Size(m)
}
func (m *MintToken) XXX_DiscardUnknown() {
xxx_messageInfo_MintToken.DiscardUnknown(m)
}
var xxx_messageInfo_MintToken proto.InternalMessageInfo
func (m *MintToken) GetOwner() string {
if m != nil {
return m.Owner
}
return ""
}
func (m *MintToken) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
func (m *MintToken) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
type ApproveAllowance struct {
OwnerKey string `protobuf:"bytes,1,opt,name=ownerKey,proto3" json:"ownerKey,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ApproveAllowance) Reset() { *m = ApproveAllowance{} }
func (m *ApproveAllowance) String() string { return proto.CompactTextString(m) }
func (*ApproveAllowance) ProtoMessage() {}
func (*ApproveAllowance) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{12}
}
func (m *ApproveAllowance) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ApproveAllowance.Unmarshal(m, b)
}
func (m *ApproveAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ApproveAllowance.Marshal(b, m, deterministic)
}
func (m *ApproveAllowance) XXX_Merge(src proto.Message) {
xxx_messageInfo_ApproveAllowance.Merge(m, src)
}
func (m *ApproveAllowance) XXX_Size() int {
return xxx_messageInfo_ApproveAllowance.Size(m)
}
func (m *ApproveAllowance) XXX_DiscardUnknown() {
xxx_messageInfo_ApproveAllowance.DiscardUnknown(m)
}
var xxx_messageInfo_ApproveAllowance proto.InternalMessageInfo
func (m *ApproveAllowance) GetOwnerKey() string {
if m != nil {
return m.OwnerKey
}
return ""
}
func (m *ApproveAllowance) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
func (m *ApproveAllowance) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
type LockEthErc20 struct {
OwnerKey string `protobuf:"bytes,1,opt,name=ownerKey,proto3" json:"ownerKey,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
//将lock住的资产跨链转移到chain33的该账户名下
Chain33Receiver string `protobuf:"bytes,4,opt,name=chain33Receiver,proto3" json:"chain33Receiver,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LockEthErc20) Reset() { *m = LockEthErc20{} }
func (m *LockEthErc20) String() string { return proto.CompactTextString(m) }
func (*LockEthErc20) ProtoMessage() {}
func (*LockEthErc20) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{13}
}
func (m *LockEthErc20) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LockEthErc20.Unmarshal(m, b)
}
func (m *LockEthErc20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LockEthErc20.Marshal(b, m, deterministic)
}
func (m *LockEthErc20) XXX_Merge(src proto.Message) {
xxx_messageInfo_LockEthErc20.Merge(m, src)
}
func (m *LockEthErc20) XXX_Size() int {
return xxx_messageInfo_LockEthErc20.Size(m)
}
func (m *LockEthErc20) XXX_DiscardUnknown() {
xxx_messageInfo_LockEthErc20.DiscardUnknown(m)
Owner string `protobuf:"bytes,1,opt,name=owner" json:"owner,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
}
var xxx_messageInfo_LockEthErc20 proto.InternalMessageInfo
func (m *BalanceAddr) Reset() { *m = BalanceAddr{} }
func (m *BalanceAddr) String() string { return proto.CompactTextString(m) }
func (*BalanceAddr) ProtoMessage() {}
func (m *LockEthErc20) GetOwnerKey() string {
if m != nil {
return m.OwnerKey
}
return ""
type MintToken struct {
Owner string `protobuf:"bytes,1,opt,name=owner" json:"owner,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount" json:"amount,omitempty"`
}
func (m *LockEthErc20) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
func (m *MintToken) Reset() { *m = MintToken{} }
func (m *MintToken) String() string { return proto.CompactTextString(m) }
func (*MintToken) ProtoMessage() {}
func (m *LockEthErc20) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
type ApproveAllowance struct {
OwnerKey string `protobuf:"bytes,1,opt,name=ownerKey" json:"ownerKey,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount" json:"amount,omitempty"`
}
func (m *LockEthErc20) GetChain33Receiver() string {
if m != nil {
return m.Chain33Receiver
}
return ""
func (m *ApproveAllowance) Reset() { *m = ApproveAllowance{} }
func (m *ApproveAllowance) String() string { return proto.CompactTextString(m) }
func (*ApproveAllowance) ProtoMessage() {}
type LockEthErc20 struct {
OwnerKey string `protobuf:"bytes,1,opt,name=ownerKey" json:"ownerKey,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount" json:"amount,omitempty"`
// 将lock住的资产跨链转移到chain33的该账户名下
Chain33Receiver string `protobuf:"bytes,4,opt,name=chain33Receiver" json:"chain33Receiver,omitempty"`
}
func (m *LockEthErc20) Reset() { *m = LockEthErc20{} }
func (m *LockEthErc20) String() string { return proto.CompactTextString(m) }
func (*LockEthErc20) ProtoMessage() {}
type ReplyAddr struct {
IsOK bool `protobuf:"varint,1,opt,name=isOK,proto3" json:"isOK,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
IsOK bool `protobuf:"varint,1,opt,name=isOK" json:"isOK,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr" json:"addr,omitempty"`
}
func (m *ReplyAddr) Reset() { *m = ReplyAddr{} }
func (m *ReplyAddr) String() string { return proto.CompactTextString(m) }
func (*ReplyAddr) ProtoMessage() {}
func (*ReplyAddr) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{14}
}
func (m *ReplyAddr) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyAddr.Unmarshal(m, b)
}
func (m *ReplyAddr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyAddr.Marshal(b, m, deterministic)
}
func (m *ReplyAddr) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyAddr.Merge(m, src)
}
func (m *ReplyAddr) XXX_Size() int {
return xxx_messageInfo_ReplyAddr.Size(m)
}
func (m *ReplyAddr) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyAddr.DiscardUnknown(m)
}
var xxx_messageInfo_ReplyAddr proto.InternalMessageInfo
func (m *ReplyAddr) GetIsOK() bool {
if m != nil {
return m.IsOK
}
return false
}
func (m *ReplyAddr) GetAddr() string {
if m != nil {
return m.Addr
}
return ""
}
type ReplyBalance struct {
IsOK bool `protobuf:"varint,1,opt,name=isOK,proto3" json:"isOK,omitempty"`
Balance string `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
IsOK bool `protobuf:"varint,1,opt,name=isOK" json:"isOK,omitempty"`
Balance string `protobuf:"bytes,2,opt,name=balance" json:"balance,omitempty"`
}
func (m *ReplyBalance) Reset() { *m = ReplyBalance{} }
func (m *ReplyBalance) String() string { return proto.CompactTextString(m) }
func (*ReplyBalance) ProtoMessage() {}
func (*ReplyBalance) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{15}
}
func (m *ReplyBalance) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyBalance.Unmarshal(m, b)
}
func (m *ReplyBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyBalance.Marshal(b, m, deterministic)
}
func (m *ReplyBalance) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyBalance.Merge(m, src)
}
func (m *ReplyBalance) XXX_Size() int {
return xxx_messageInfo_ReplyBalance.Size(m)
}
func (m *ReplyBalance) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyBalance.DiscardUnknown(m)
}
var xxx_messageInfo_ReplyBalance proto.InternalMessageInfo
func (m *ReplyBalance) GetIsOK() bool {
if m != nil {
return m.IsOK
}
return false
}
func (m *ReplyBalance) GetBalance() string {
if m != nil {
return m.Balance
}
return ""
}
type Burn struct {
OwnerKey string `protobuf:"bytes,1,opt,name=ownerKey,proto3" json:"ownerKey,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
Chain33Receiver string `protobuf:"bytes,4,opt,name=chain33Receiver,proto3" json:"chain33Receiver,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
OwnerKey string `protobuf:"bytes,1,opt,name=ownerKey" json:"ownerKey,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
Amount string `protobuf:"bytes,3,opt,name=amount" json:"amount,omitempty"`
Chain33Receiver string `protobuf:"bytes,4,opt,name=chain33Receiver" json:"chain33Receiver,omitempty"`
}
func (m *Burn) Reset() { *m = Burn{} }
func (m *Burn) String() string { return proto.CompactTextString(m) }
func (*Burn) ProtoMessage() {}
func (*Burn) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{16}
}
func (m *Burn) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Burn.Unmarshal(m, b)
}
func (m *Burn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Burn.Marshal(b, m, deterministic)
}
func (m *Burn) XXX_Merge(src proto.Message) {
xxx_messageInfo_Burn.Merge(m, src)
}
func (m *Burn) XXX_Size() int {
return xxx_messageInfo_Burn.Size(m)
}
func (m *Burn) XXX_DiscardUnknown() {
xxx_messageInfo_Burn.DiscardUnknown(m)
}
var xxx_messageInfo_Burn proto.InternalMessageInfo
func (m *Burn) GetOwnerKey() string {
if m != nil {
return m.OwnerKey
}
return ""
}
func (m *Burn) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
func (m *Burn) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
func (m *Burn) GetChain33Receiver() string {
if m != nil {
return m.Chain33Receiver
}
return ""
}
type StaticsRequest struct {
Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Owner string `protobuf:"bytes,1,opt,name=owner" json:"owner,omitempty"`
TokenAddr string `protobuf:"bytes,2,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
}
func (m *StaticsRequest) Reset() { *m = StaticsRequest{} }
func (m *StaticsRequest) String() string { return proto.CompactTextString(m) }
func (*StaticsRequest) ProtoMessage() {}
func (*StaticsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{17}
}
func (m *StaticsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsRequest.Unmarshal(m, b)
}
func (m *StaticsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsRequest.Marshal(b, m, deterministic)
}
func (m *StaticsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsRequest.Merge(m, src)
}
func (m *StaticsRequest) XXX_Size() int {
return xxx_messageInfo_StaticsRequest.Size(m)
}
func (m *StaticsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsRequest proto.InternalMessageInfo
func (m *StaticsRequest) GetOwner() string {
if m != nil {
return m.Owner
}
return ""
}
func (m *StaticsRequest) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
type StaticsAll struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StaticsAll) Reset() { *m = StaticsAll{} }
func (m *StaticsAll) String() string { return proto.CompactTextString(m) }
func (*StaticsAll) ProtoMessage() {}
func (*StaticsAll) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{18}
}
func (m *StaticsAll) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsAll.Unmarshal(m, b)
}
func (m *StaticsAll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsAll.Marshal(b, m, deterministic)
}
func (m *StaticsAll) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsAll.Merge(m, src)
}
func (m *StaticsAll) XXX_Size() int {
return xxx_messageInfo_StaticsAll.Size(m)
}
func (m *StaticsAll) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsAll.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsAll proto.InternalMessageInfo
type StaticsSingle struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StaticsSingle) Reset() { *m = StaticsSingle{} }
func (m *StaticsSingle) String() string { return proto.CompactTextString(m) }
func (*StaticsSingle) ProtoMessage() {}
func (*StaticsSingle) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{19}
}
func (m *StaticsSingle) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsSingle.Unmarshal(m, b)
}
func (m *StaticsSingle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsSingle.Marshal(b, m, deterministic)
}
func (m *StaticsSingle) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsSingle.Merge(m, src)
}
func (m *StaticsSingle) XXX_Size() int {
return xxx_messageInfo_StaticsSingle.Size(m)
}
func (m *StaticsSingle) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsSingle.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsSingle proto.InternalMessageInfo
type StaticsLockResponse struct {
All *StaticsLock `protobuf:"bytes,1,opt,name=all,proto3" json:"all,omitempty"`
Single *StaticsLockSingle `protobuf:"bytes,2,opt,name=single,proto3" json:"single,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
All *StaticsLock `protobuf:"bytes,1,opt,name=all" json:"all,omitempty"`
Single *StaticsLockSingle `protobuf:"bytes,2,opt,name=single" json:"single,omitempty"`
}
func (m *StaticsLockResponse) Reset() { *m = StaticsLockResponse{} }
func (m *StaticsLockResponse) String() string { return proto.CompactTextString(m) }
func (*StaticsLockResponse) ProtoMessage() {}
func (*StaticsLockResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{20}
}
func (m *StaticsLockResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsLockResponse.Unmarshal(m, b)
}
func (m *StaticsLockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsLockResponse.Marshal(b, m, deterministic)
}
func (m *StaticsLockResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsLockResponse.Merge(m, src)
}
func (m *StaticsLockResponse) XXX_Size() int {
return xxx_messageInfo_StaticsLockResponse.Size(m)
}
func (m *StaticsLockResponse) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsLockResponse.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsLockResponse proto.InternalMessageInfo
func (m *StaticsLockResponse) GetAll() *StaticsLock {
if m != nil {
......@@ -1133,495 +239,81 @@ func (m *StaticsLockResponse) GetSingle() *StaticsLockSingle {
}
type StaticsResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StaticsResponse) Reset() { *m = StaticsResponse{} }
func (m *StaticsResponse) String() string { return proto.CompactTextString(m) }
func (*StaticsResponse) ProtoMessage() {}
func (*StaticsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{21}
}
func (m *StaticsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsResponse.Unmarshal(m, b)
}
func (m *StaticsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsResponse.Marshal(b, m, deterministic)
}
func (m *StaticsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsResponse.Merge(m, src)
}
func (m *StaticsResponse) XXX_Size() int {
return xxx_messageInfo_StaticsResponse.Size(m)
}
func (m *StaticsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsResponse proto.InternalMessageInfo
type StaticsLock struct {
Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Balance string `protobuf:"bytes,1,opt,name=balance" json:"balance,omitempty"`
}
func (m *StaticsLock) Reset() { *m = StaticsLock{} }
func (m *StaticsLock) String() string { return proto.CompactTextString(m) }
func (*StaticsLock) ProtoMessage() {}
func (*StaticsLock) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{22}
}
func (m *StaticsLock) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsLock.Unmarshal(m, b)
}
func (m *StaticsLock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsLock.Marshal(b, m, deterministic)
}
func (m *StaticsLock) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsLock.Merge(m, src)
}
func (m *StaticsLock) XXX_Size() int {
return xxx_messageInfo_StaticsLock.Size(m)
}
func (m *StaticsLock) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsLock.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsLock proto.InternalMessageInfo
func (m *StaticsLock) GetBalance() string {
if m != nil {
return m.Balance
}
return ""
}
type StaticsDeposit struct {
Supply string `protobuf:"bytes,1,opt,name=supply,proto3" json:"supply,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Supply string `protobuf:"bytes,1,opt,name=supply" json:"supply,omitempty"`
}
func (m *StaticsDeposit) Reset() { *m = StaticsDeposit{} }
func (m *StaticsDeposit) String() string { return proto.CompactTextString(m) }
func (*StaticsDeposit) ProtoMessage() {}
func (*StaticsDeposit) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{23}
}
func (m *StaticsDeposit) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsDeposit.Unmarshal(m, b)
}
func (m *StaticsDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsDeposit.Marshal(b, m, deterministic)
}
func (m *StaticsDeposit) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsDeposit.Merge(m, src)
}
func (m *StaticsDeposit) XXX_Size() int {
return xxx_messageInfo_StaticsDeposit.Size(m)
}
func (m *StaticsDeposit) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsDeposit.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsDeposit proto.InternalMessageInfo
func (m *StaticsDeposit) GetSupply() string {
if m != nil {
return m.Supply
}
return ""
}
type StaticsLockSingle struct {
TotalLockedAccumated int64 `protobuf:"varint,1,opt,name=totalLockedAccumated,proto3" json:"totalLockedAccumated,omitempty"`
Locked []int64 `protobuf:"varint,2,rep,packed,name=locked,proto3" json:"locked,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
TotalLockedAccumated int64 `protobuf:"varint,1,opt,name=totalLockedAccumated" json:"totalLockedAccumated,omitempty"`
Locked []int64 `protobuf:"varint,2,rep,name=locked" json:"locked,omitempty"`
}
func (m *StaticsLockSingle) Reset() { *m = StaticsLockSingle{} }
func (m *StaticsLockSingle) String() string { return proto.CompactTextString(m) }
func (*StaticsLockSingle) ProtoMessage() {}
func (*StaticsLockSingle) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{24}
}
func (m *StaticsLockSingle) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StaticsLockSingle.Unmarshal(m, b)
}
func (m *StaticsLockSingle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StaticsLockSingle.Marshal(b, m, deterministic)
}
func (m *StaticsLockSingle) XXX_Merge(src proto.Message) {
xxx_messageInfo_StaticsLockSingle.Merge(m, src)
}
func (m *StaticsLockSingle) XXX_Size() int {
return xxx_messageInfo_StaticsLockSingle.Size(m)
}
func (m *StaticsLockSingle) XXX_DiscardUnknown() {
xxx_messageInfo_StaticsLockSingle.DiscardUnknown(m)
}
var xxx_messageInfo_StaticsLockSingle proto.InternalMessageInfo
func (m *StaticsLockSingle) GetTotalLockedAccumated() int64 {
if m != nil {
return m.TotalLockedAccumated
}
return 0
}
func (m *StaticsLockSingle) GetLocked() []int64 {
if m != nil {
return m.Locked
}
return nil
}
type TransferToken struct {
TokenAddr string `protobuf:"bytes,1,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
FromKey string `protobuf:"bytes,2,opt,name=fromKey,proto3" json:"fromKey,omitempty"`
ToAddr string `protobuf:"bytes,3,opt,name=toAddr,proto3" json:"toAddr,omitempty"`
Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
TokenAddr string `protobuf:"bytes,1,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
FromKey string `protobuf:"bytes,2,opt,name=fromKey" json:"fromKey,omitempty"`
ToAddr string `protobuf:"bytes,3,opt,name=toAddr" json:"toAddr,omitempty"`
Amount string `protobuf:"bytes,4,opt,name=amount" json:"amount,omitempty"`
}
func (m *TransferToken) Reset() { *m = TransferToken{} }
func (m *TransferToken) String() string { return proto.CompactTextString(m) }
func (*TransferToken) ProtoMessage() {}
func (*TransferToken) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{25}
}
func (m *TransferToken) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TransferToken.Unmarshal(m, b)
}
func (m *TransferToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TransferToken.Marshal(b, m, deterministic)
}
func (m *TransferToken) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransferToken.Merge(m, src)
}
func (m *TransferToken) XXX_Size() int {
return xxx_messageInfo_TransferToken.Size(m)
}
func (m *TransferToken) XXX_DiscardUnknown() {
xxx_messageInfo_TransferToken.DiscardUnknown(m)
}
var xxx_messageInfo_TransferToken proto.InternalMessageInfo
func (m *TransferToken) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
func (m *TransferToken) GetFromKey() string {
if m != nil {
return m.FromKey
}
return ""
}
func (m *TransferToken) GetToAddr() string {
if m != nil {
return m.ToAddr
}
return ""
}
func (m *TransferToken) GetAmount() string {
if m != nil {
return m.Amount
}
return ""
}
type Uint64 struct {
Data uint64 `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Data uint64 `protobuf:"varint,1,opt,name=data" json:"data,omitempty"`
}
func (m *Uint64) Reset() { *m = Uint64{} }
func (m *Uint64) String() string { return proto.CompactTextString(m) }
func (*Uint64) ProtoMessage() {}
func (*Uint64) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{26}
}
func (m *Uint64) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Uint64.Unmarshal(m, b)
}
func (m *Uint64) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Uint64.Marshal(b, m, deterministic)
}
func (m *Uint64) XXX_Merge(src proto.Message) {
xxx_messageInfo_Uint64.Merge(m, src)
}
func (m *Uint64) XXX_Size() int {
return xxx_messageInfo_Uint64.Size(m)
}
func (m *Uint64) XXX_DiscardUnknown() {
xxx_messageInfo_Uint64.DiscardUnknown(m)
}
var xxx_messageInfo_Uint64 proto.InternalMessageInfo
func (m *Uint64) GetData() uint64 {
if m != nil {
return m.Data
}
return 0
}
type TokenStatics struct {
TokenAddr string `protobuf:"bytes,1,opt,name=tokenAddr,proto3" json:"tokenAddr,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
TokenAddr string `protobuf:"bytes,1,opt,name=tokenAddr" json:"tokenAddr,omitempty"`
}
func (m *TokenStatics) Reset() { *m = TokenStatics{} }
func (m *TokenStatics) String() string { return proto.CompactTextString(m) }
func (*TokenStatics) ProtoMessage() {}
func (*TokenStatics) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{27}
}
func (m *TokenStatics) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TokenStatics.Unmarshal(m, b)
}
func (m *TokenStatics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TokenStatics.Marshal(b, m, deterministic)
}
func (m *TokenStatics) XXX_Merge(src proto.Message) {
xxx_messageInfo_TokenStatics.Merge(m, src)
}
func (m *TokenStatics) XXX_Size() int {
return xxx_messageInfo_TokenStatics.Size(m)
}
func (m *TokenStatics) XXX_DiscardUnknown() {
xxx_messageInfo_TokenStatics.DiscardUnknown(m)
}
var xxx_messageInfo_TokenStatics proto.InternalMessageInfo
func (m *TokenStatics) GetTokenAddr() string {
if m != nil {
return m.TokenAddr
}
return ""
}
type EventLogIndex struct {
Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Height uint64 `protobuf:"varint,1,opt,name=height" json:"height,omitempty"`
Index uint32 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"`
}
func (m *EventLogIndex) Reset() { *m = EventLogIndex{} }
func (m *EventLogIndex) String() string { return proto.CompactTextString(m) }
func (*EventLogIndex) ProtoMessage() {}
func (*EventLogIndex) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{28}
}
func (m *EventLogIndex) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EventLogIndex.Unmarshal(m, b)
}
func (m *EventLogIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EventLogIndex.Marshal(b, m, deterministic)
}
func (m *EventLogIndex) XXX_Merge(src proto.Message) {
xxx_messageInfo_EventLogIndex.Merge(m, src)
}
func (m *EventLogIndex) XXX_Size() int {
return xxx_messageInfo_EventLogIndex.Size(m)
}
func (m *EventLogIndex) XXX_DiscardUnknown() {
xxx_messageInfo_EventLogIndex.DiscardUnknown(m)
}
var xxx_messageInfo_EventLogIndex proto.InternalMessageInfo
func (m *EventLogIndex) GetHeight() uint64 {
if m != nil {
return m.Height
}
return 0
}
func (m *EventLogIndex) GetIndex() uint32 {
if m != nil {
return m.Index
}
return 0
}
type EthTxStatus struct {
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
Txhash string `protobuf:"bytes,2,opt,name=txhash,proto3" json:"txhash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Status string `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"`
Txhash string `protobuf:"bytes,2,opt,name=txhash" json:"txhash,omitempty"`
}
func (m *EthTxStatus) Reset() { *m = EthTxStatus{} }
func (m *EthTxStatus) String() string { return proto.CompactTextString(m) }
func (*EthTxStatus) ProtoMessage() {}
func (*EthTxStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_202a89775a80bd4c, []int{29}
}
func (m *EthTxStatus) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EthTxStatus.Unmarshal(m, b)
}
func (m *EthTxStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EthTxStatus.Marshal(b, m, deterministic)
}
func (m *EthTxStatus) XXX_Merge(src proto.Message) {
xxx_messageInfo_EthTxStatus.Merge(m, src)
}
func (m *EthTxStatus) XXX_Size() int {
return xxx_messageInfo_EthTxStatus.Size(m)
}
func (m *EthTxStatus) XXX_DiscardUnknown() {
xxx_messageInfo_EthTxStatus.DiscardUnknown(m)
}
var xxx_messageInfo_EthTxStatus proto.InternalMessageInfo
func (m *EthTxStatus) GetStatus() string {
if m != nil {
return m.Status
}
return ""
}
func (m *EthTxStatus) GetTxhash() string {
if m != nil {
return m.Txhash
}
return ""
}
func init() {
proto.RegisterType((*Account4Relayer)(nil), "types.Account4Relayer")
proto.RegisterType((*ValidatorAddr4EthRelayer)(nil), "types.ValidatorAddr4EthRelayer")
proto.RegisterType((*Txhashes)(nil), "types.Txhashes")
proto.RegisterType((*ReqSetPasswd)(nil), "types.ReqSetPasswd")
proto.RegisterType((*Account4Show)(nil), "types.Account4Show")
proto.RegisterType((*AssetType)(nil), "types.assetType")
proto.RegisterType((*EthBridgeClaim)(nil), "types.EthBridgeClaim")
proto.RegisterType((*ImportKeyReq)(nil), "types.ImportKeyReq")
proto.RegisterType((*RelayerRunStatus)(nil), "types.RelayerRunStatus")
proto.RegisterType((*NewProphecyClaim)(nil), "types.NewProphecyClaim")
proto.RegisterType((*BalanceAddr)(nil), "types.BalanceAddr")
proto.RegisterType((*MintToken)(nil), "types.MintToken")
proto.RegisterType((*ApproveAllowance)(nil), "types.ApproveAllowance")
proto.RegisterType((*LockEthErc20)(nil), "types.LockEthErc20")
proto.RegisterType((*ReplyAddr)(nil), "types.ReplyAddr")
proto.RegisterType((*ReplyBalance)(nil), "types.ReplyBalance")
proto.RegisterType((*Burn)(nil), "types.Burn")
proto.RegisterType((*StaticsRequest)(nil), "types.StaticsRequest")
proto.RegisterType((*StaticsAll)(nil), "types.StaticsAll")
proto.RegisterType((*StaticsSingle)(nil), "types.StaticsSingle")
proto.RegisterType((*StaticsLockResponse)(nil), "types.StaticsLockResponse")
proto.RegisterType((*StaticsResponse)(nil), "types.StaticsResponse")
proto.RegisterType((*StaticsLock)(nil), "types.StaticsLock")
proto.RegisterType((*StaticsDeposit)(nil), "types.StaticsDeposit")
proto.RegisterType((*StaticsLockSingle)(nil), "types.StaticsLockSingle")
proto.RegisterType((*TransferToken)(nil), "types.TransferToken")
proto.RegisterType((*Uint64)(nil), "types.Uint64")
proto.RegisterType((*TokenStatics)(nil), "types.TokenStatics")
proto.RegisterType((*EventLogIndex)(nil), "types.EventLogIndex")
proto.RegisterType((*EthTxStatus)(nil), "types.EthTxStatus")
}
func init() {
proto.RegisterFile("relayer.proto", fileDescriptor_202a89775a80bd4c)
}
var fileDescriptor_202a89775a80bd4c = []byte{
// 983 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x5d, 0x6b, 0x23, 0x37,
0x14, 0xc5, 0xb1, 0xe3, 0xc4, 0xd7, 0x76, 0x92, 0x9d, 0x2e, 0x65, 0x28, 0x4b, 0x31, 0x62, 0x69,
0x4d, 0x29, 0x61, 0x49, 0x42, 0x9f, 0x76, 0x29, 0x4e, 0x62, 0x68, 0xc8, 0x76, 0xbb, 0x28, 0xee,
0xf6, 0x71, 0x51, 0x66, 0xee, 0x66, 0xa6, 0x91, 0xa5, 0x89, 0x24, 0xc7, 0xf1, 0x6b, 0x1f, 0xfb,
0x23, 0xfb, 0x1b, 0xfa, 0x13, 0x8a, 0x3e, 0xc6, 0x9e, 0x71, 0xdc, 0x7d, 0x08, 0x85, 0xbe, 0xcd,
0x39, 0x92, 0xee, 0x3d, 0xd2, 0xb9, 0x57, 0x1a, 0xe8, 0x2b, 0xe4, 0x6c, 0x81, 0xea, 0xb0, 0x50,
0xd2, 0xc8, 0x68, 0xdb, 0x2c, 0x0a, 0xd4, 0xe4, 0x47, 0xd8, 0x1f, 0x25, 0x89, 0x9c, 0x09, 0x73,
0x42, 0xfd, 0x78, 0x14, 0xc3, 0x4e, 0xa1, 0xf2, 0xfb, 0x5b, 0x5c, 0xc4, 0x8d, 0x41, 0x63, 0xd8,
0xa3, 0x25, 0x8c, 0x22, 0x68, 0xb1, 0x34, 0x55, 0xf1, 0xd6, 0xa0, 0x31, 0xec, 0x50, 0xf7, 0x4d,
0x7e, 0x87, 0xf8, 0x03, 0xe3, 0x79, 0xca, 0x8c, 0x54, 0xa3, 0x34, 0x55, 0x27, 0x63, 0x93, 0x95,
0x91, 0x08, 0xf4, 0xd0, 0x64, 0xcb, 0x61, 0x17, 0xae, 0x43, 0x6b, 0x5c, 0xf4, 0x1d, 0x1c, 0x24,
0x19, 0xcb, 0xc5, 0xf1, 0xf1, 0x6a, 0x9e, 0x8f, 0xff, 0x88, 0x27, 0x04, 0x76, 0x27, 0x0f, 0x19,
0xd3, 0x19, 0xea, 0xe8, 0x4b, 0x68, 0x1b, 0xf7, 0x1d, 0x37, 0x06, 0xcd, 0x61, 0x87, 0x06, 0x44,
0x3e, 0x40, 0x8f, 0xe2, 0xdd, 0x15, 0x9a, 0xf7, 0x4c, 0xeb, 0x79, 0x6a, 0x35, 0x48, 0x9e, 0x5a,
0x50, 0x64, 0x4c, 0x63, 0xa9, 0xa1, 0xca, 0xd9, 0x39, 0x02, 0xe7, 0xab, 0x39, 0x3e, 0x7f, 0x8d,
0x23, 0xaf, 0xa1, 0x57, 0x1e, 0xd4, 0x55, 0x26, 0xe7, 0xeb, 0xa7, 0xd4, 0xf9, 0xfc, 0x29, 0x7d,
0x84, 0x0e, 0xd3, 0x1a, 0xcd, 0x64, 0x51, 0x60, 0xf4, 0x1c, 0xb6, 0xdd, 0xd6, 0xc2, 0x42, 0x0f,
0xa2, 0x97, 0xd0, 0xcf, 0xb5, 0x9e, 0xe1, 0x99, 0x14, 0x46, 0xb1, 0xc4, 0x84, 0xf5, 0x75, 0xd2,
0x6e, 0x5b, 0x2f, 0xa6, 0xd7, 0x92, 0xc7, 0x4d, 0x37, 0x1c, 0x10, 0xf9, 0x7b, 0x0b, 0xf6, 0xc6,
0x26, 0x3b, 0x55, 0x79, 0x7a, 0x83, 0x67, 0x9c, 0xe5, 0xd3, 0x68, 0x08, 0xfb, 0x68, 0x32, 0x54,
0x38, 0x9b, 0x9e, 0xd9, 0x0c, 0x17, 0xe7, 0x2e, 0x61, 0x93, 0xae, 0xd3, 0x76, 0xe6, 0xb5, 0x5b,
0x78, 0xaa, 0x98, 0xb8, 0x1d, 0xad, 0xc4, 0xaf, 0xd3, 0x56, 0xba, 0x90, 0x22, 0x41, 0x97, 0xbd,
0x49, 0x3d, 0x88, 0x5e, 0x40, 0xc7, 0xc8, 0x5b, 0x14, 0x6e, 0x65, 0xcb, 0xad, 0x5c, 0x11, 0x15,
0xc9, 0xdb, 0x55, 0xc9, 0xd1, 0x37, 0xb0, 0x57, 0x0a, 0xb9, 0x42, 0x91, 0xa2, 0x8a, 0xdb, 0x6e,
0x7c, 0x8d, 0xb5, 0xea, 0x42, 0x25, 0x50, 0x4c, 0x30, 0xbf, 0x47, 0x15, 0xef, 0x78, 0x75, 0x6b,
0xb4, 0xcd, 0xc4, 0xa6, 0xd6, 0xa2, 0xb8, 0xe3, 0x33, 0x79, 0x64, 0xf5, 0x25, 0xf6, 0x48, 0xec,
0xe9, 0xc7, 0x30, 0x68, 0x0c, 0xb7, 0xe9, 0x8a, 0x70, 0xa3, 0x36, 0xd0, 0x3b, 0x36, 0xc5, 0xb8,
0xeb, 0xd5, 0x2f, 0x09, 0xeb, 0x73, 0x8a, 0x49, 0x3e, 0x65, 0x3c, 0xee, 0xb9, 0x3d, 0x97, 0x90,
0x1c, 0x42, 0xef, 0x62, 0x5a, 0x48, 0x65, 0x2e, 0x71, 0x41, 0xf1, 0x2e, 0xfa, 0x1a, 0xc0, 0x96,
0x00, 0x33, 0x78, 0xb9, 0x2c, 0x8a, 0x0a, 0x43, 0xce, 0xe1, 0x20, 0x34, 0x06, 0x9d, 0x89, 0x2b,
0xc3, 0xcc, 0xcc, 0x55, 0xb1, 0x76, 0x5f, 0x6e, 0xfe, 0x36, 0x0d, 0xc8, 0x67, 0x35, 0x2c, 0xe7,
0x3a, 0x38, 0x51, 0x42, 0xf2, 0x57, 0x03, 0x0e, 0xde, 0xe1, 0xfc, 0xbd, 0x92, 0x45, 0x86, 0xc9,
0xc2, 0x5b, 0x5d, 0xdb, 0xa0, 0x8d, 0xd4, 0xaf, 0x6e, 0xf0, 0x25, 0xf4, 0xc3, 0x49, 0x85, 0x73,
0x0e, 0x95, 0x55, 0x23, 0xeb, 0x26, 0x36, 0xff, 0xdd, 0xc4, 0x56, 0xcd, 0xc4, 0x01, 0x74, 0xd1,
0x36, 0x7c, 0x30, 0xc6, 0x3b, 0x5c, 0xa5, 0x2a, 0xa6, 0xb4, 0x6b, 0xa6, 0xb8, 0x06, 0xfe, 0xc9,
0x36, 0xb0, 0x77, 0x33, 0x20, 0x32, 0x82, 0xee, 0x29, 0xe3, 0x4c, 0x24, 0x58, 0x56, 0x9c, 0x9c,
0x0b, 0x2c, 0x2f, 0x0f, 0x0f, 0xea, 0x62, 0xb7, 0xd6, 0xc4, 0x92, 0xdf, 0xa0, 0xf3, 0x73, 0x2e,
0xcc, 0xc4, 0x12, 0x4f, 0x09, 0x50, 0xd1, 0xdc, 0xac, 0x6a, 0x26, 0x29, 0x1c, 0x8c, 0x8a, 0x42,
0xc9, 0x7b, 0x1c, 0x71, 0x2e, 0xe7, 0x56, 0x64, 0xf4, 0x15, 0xec, 0xba, 0x90, 0x2b, 0xd3, 0x97,
0xf8, 0x89, 0x59, 0xfe, 0x6c, 0x40, 0xef, 0xad, 0x4c, 0x6e, 0xc7, 0x26, 0x1b, 0xab, 0xe4, 0xe8,
0xd5, 0x7f, 0x9f, 0x62, 0x53, 0x4f, 0xb5, 0x36, 0xf6, 0x14, 0x39, 0x86, 0x0e, 0xc5, 0x82, 0x2f,
0x5c, 0xb8, 0x08, 0x5a, 0xb9, 0xfe, 0xe5, 0xd2, 0x89, 0xd8, 0xa5, 0xee, 0x7b, 0xe3, 0x75, 0xf7,
0xda, 0x5e, 0xc2, 0x05, 0x5f, 0x04, 0x23, 0x37, 0xae, 0x8b, 0x61, 0xe7, 0xda, 0x0f, 0x97, 0x25,
0x1e, 0x20, 0xf9, 0xa3, 0x01, 0xad, 0xd3, 0x99, 0x12, 0xff, 0xeb, 0xbe, 0xcf, 0x61, 0xcf, 0xf6,
0x68, 0x9e, 0x68, 0x8a, 0x77, 0x33, 0xd4, 0xe6, 0x49, 0x95, 0xd8, 0x03, 0x08, 0x51, 0x46, 0x9c,
0x93, 0x7d, 0xe8, 0x07, 0x74, 0x95, 0x8b, 0x1b, 0x8e, 0x64, 0x0a, 0x5f, 0x04, 0xc2, 0xfa, 0x4d,
0x51, 0x17, 0x52, 0x68, 0xdb, 0xb0, 0x4d, 0xc6, 0xb9, 0xcb, 0xd3, 0x3d, 0x8a, 0x0e, 0xdd, 0x4b,
0x7d, 0x58, 0x9d, 0x68, 0x87, 0xa3, 0x57, 0xd0, 0xd6, 0x2e, 0x8c, 0x4b, 0xdb, 0x3d, 0x8a, 0x1f,
0x4f, 0xf4, 0x69, 0x68, 0x98, 0x47, 0x9e, 0xc1, 0xfe, 0x72, 0x4f, 0x3e, 0x15, 0xf9, 0x16, 0xba,
0x95, 0xf9, 0x55, 0x53, 0x1a, 0x75, 0x53, 0x86, 0xcb, 0xf3, 0x38, 0xc7, 0x42, 0xea, 0xdc, 0x3f,
0x45, 0xb3, 0xa2, 0xe0, 0xa5, 0x37, 0x01, 0x91, 0x8f, 0xf0, 0xec, 0x91, 0x84, 0xe8, 0x08, 0x9e,
0x1b, 0x69, 0x18, 0xb7, 0x14, 0xa6, 0xa3, 0x24, 0x99, 0x4d, 0x99, 0xc1, 0x34, 0xbc, 0x48, 0x1b,
0xc7, 0x6c, 0x02, 0xee, 0xa8, 0x78, 0x6b, 0xd0, 0x1c, 0x36, 0x69, 0x40, 0x64, 0x0e, 0xfd, 0x89,
0x62, 0x42, 0x7f, 0x42, 0xe5, 0x5b, 0xbc, 0xe6, 0x41, 0x63, 0xbd, 0x16, 0x62, 0xd8, 0xf9, 0xa4,
0xe4, 0xd4, 0x16, 0x51, 0x28, 0xb4, 0x00, 0xdd, 0x15, 0x24, 0x2b, 0xf7, 0x5d, 0x40, 0x95, 0xea,
0x69, 0xd5, 0x1a, 0xf3, 0x05, 0xb4, 0x7f, 0xcd, 0x85, 0xf9, 0xe1, 0xc4, 0x16, 0x74, 0xca, 0x0c,
0x73, 0xc9, 0x5a, 0xd4, 0x7d, 0x93, 0xef, 0xa1, 0xe7, 0xe4, 0x84, 0xcd, 0x7f, 0x5e, 0x15, 0x79,
0x03, 0xfd, 0xf1, 0x3d, 0x0a, 0xf3, 0x56, 0xde, 0x5c, 0x88, 0x14, 0x1f, 0x6c, 0xd2, 0x0c, 0xf3,
0x9b, 0xcc, 0x84, 0xa0, 0x01, 0xd9, 0xb2, 0xcb, 0xed, 0x04, 0x27, 0xbe, 0x4f, 0x3d, 0x20, 0x6f,
0xa0, 0x3b, 0x36, 0xd9, 0xe4, 0x61, 0xe3, 0x3b, 0xd2, 0x59, 0xbe, 0x23, 0xab, 0xbf, 0xa4, 0xad,
0xf2, 0x92, 0xb5, 0xe8, 0xba, 0xed, 0x7e, 0x02, 0x8f, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x93,
0x4d, 0xd2, 0x14, 0x15, 0x0a, 0x00, 0x00,
}
......@@ -17,14 +17,11 @@ docker_chain33_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPA
Chain33Cli="$GOPATH/src/github.com/33cn/plugin/build/chain33-cli --rpc_laddr http://${docker_chain33_ip}:8801"
chain33SenderAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
# validatorsAddr=["0x92c8b16afd6d423652559c6e266cbe1c29bfd84f", "0x0df9a824699bc5878232c9e612fe1a5346a5a368", "0xcb074cb21cdddf3ce9c3c0a7ac4497d633c9d9f1", "0xd9dab021e74ecf475788ed7b61356056b2095830"]
ethValidatorAddrKeyA="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethValidatorAddrKeyB="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
ethValidatorAddrKeyC="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
ethValidatorAddrKeyD="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
# 新增地址 chain33 需要导入地址 转入 10 bty当收费费
chain33Validator1="1GTxrmuWiXavhcvsaH5w9whgVxUrWsUMdV"
chain33Validator2="155ooMPBTF8QQsGAknkK7ei5D78rwDEFe6"
......@@ -34,16 +31,16 @@ chain33ValidatorKey1="0xd627968e445f2a41c92173225791bae1ba42126ae96c32f28f97ff8f
chain33ValidatorKey2="0x9d539bc5fd084eb7fe86ad631dba9aa086dba38418725c38d9751459f567da66"
chain33ValidatorKey3="0x0a6671f101e30a2cc2d79d77436b62cdf2664ed33eb631a9c9e3f3dd348a23be"
chain33ValidatorKey4="0x3818b257b05ee75b6e43ee0e3cfc2d8502342cf67caed533e3756966690b62a5"
ethReceiverAddr1="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethReceiverAddrKey1="355b876d7cbcb930d5dfab767f66336ce327e082cbaa1877210c1bae89b1df71"
ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2="9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
maturityDegree=10
function InitAndDeploy() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLIA} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLIA} relayer set_pwd -p 123456hzj)
cli_ret "${result}" "set_pwd"
result=$(${CLIA} relayer unlock -p 123456hzj)
......@@ -59,12 +56,12 @@ function EthImportKey() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 重启 ebrelayer 并解锁
for name in A B C D; do
start_ebrelayer "../build/"$name"/ebrelayer" "../build/"$name"/ebrelayer.log"
start_ebrelayer "../build/$name/ebrelayer" "../build/$name/ebrelayer.log"
# 导入测试地址私钥
CLI="../build/ebcli_$name"
result=$(${CLI} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLI} relayer set_pwd -p 123456hzj)
#cli_ret "${result}" "set_pwd"
result=$(${CLI} relayer unlock -p 123456hzj)
......@@ -80,15 +77,6 @@ function EthImportKey() {
result=$(${CLID} relayer ethereum import_chain33privatekey -k "${chain33ValidatorKey4}")
cli_ret "${result}" "import_chain33privatekey"
result=$(${CLIA} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyA}")
cli_ret "${result}" "import_ethprivatekey"
result=$(${CLIB} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyB}")
cli_ret "${result}" "import_ethprivatekeyB"
result=$(${CLIC} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyC}")
cli_ret "${result}" "import_ethprivatekeyC"
result=$(${CLID} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyD}")
cli_ret "${result}" "import_ethprivatekeyD"
result=$(${CLIA} relayer chain33 import_privatekey -k "${ethValidatorAddrKeyA}")
cli_ret "${result}" "A relayer chain33 import_privatekey"
result=$(${CLIB} relayer chain33 import_privatekey -k "${ethValidatorAddrKeyB}")
......@@ -129,7 +117,7 @@ function StartRelayerAndDeploy() {
kill_ebrelayer "../build/A/ebrelayer"
# 修改 relayer.toml 配置文件
updata_relayer_toml ${BridgeRegistry} ${maturityDegree} "../build/A/relayer.toml"
updata_relayer_toml "${BridgeRegistry}" ${maturityDegree} "../build/A/relayer.toml"
updata_all_relayer_toml
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
......@@ -164,7 +152,7 @@ function InitChain33Vilators() {
# query Validators
totalPower=$(${Chain33Cli} send x2ethereum query totalpower -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower | sed 's/\"//g')
check_number 100 ${totalPower}
check_number 100 "${totalPower}"
# cions 转帐到 x2ethereum 合约地址
hash=$(${Chain33Cli} send coins send_exec -e x2ethereum -a 200 -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
......@@ -207,7 +195,7 @@ function TestChain33ToEthAssets() {
cli_ret "${result}" "balance" ".balance" "0"
# chain33 lock bty
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t coins.bty -r ${ethReceiverAddr1} -q ${tokenAddr} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t coins.bty -r ${ethReceiverAddr1} -q "${tokenAddr}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -276,7 +264,7 @@ function TestETH2Chain33Assets() {
cli_ret "${result}" "balance" ".balance" "0"
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}")
cli_ret "${result}" "balance" ".balance" $(echo "${balance}+10" | bc)
cli_ret "${result}" "balance" ".balance" "$(echo "${balance}+10" | bc)"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
......@@ -320,7 +308,7 @@ function TestETH2Chain33Erc20() {
balance_ret "${result}" "100"
# chain33 burn 100
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33Validator1}")
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33Validator1}")
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -354,7 +342,7 @@ function TestChain33ToEthAssetsKill() {
kill_ebrelayerD
# chain33 lock bty
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t bty -r ${ethReceiverAddr2} -q ${tokenAddrBty} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t bty -r ${ethReceiverAddr2} -q "${tokenAddrBty}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -445,7 +433,7 @@ function TestETH2Chain33AssetsKill() {
start_ebrelayerD
result=$(${CLIA} relayer ethereum balance -o "${ethReceiverAddr2}")
cli_ret "${result}" "balance" ".balance" $(echo "${balance}+0.1" | bc)
cli_ret "${result}" "balance" ".balance" "$(echo "${balance}+0.1" | bc)"
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
......@@ -501,7 +489,7 @@ function TestETH2Chain33Erc20Kill() {
kill_ebrelayerD
# chain33 burn 100
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33Validator1}")
hash=$(${Chain33Cli} send x2ethereum burn -a 100 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33Validator1}")
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set -x
# 只启动 eth 这一端的测试
# 只启动一个 relayer 第一个地址权重设置超过2/3
......@@ -9,18 +11,11 @@ CLI="../build/ebcli_A"
chain33SenderAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
# 0x92C8b16aFD6d423652559C6E266cBE1c29Bfd84f
ethValidatorAddrKey="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethReceiverAddr1="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethReceiverAddrKey1="355b876d7cbcb930d5dfab767f66336ce327e082cbaa1877210c1bae89b1df71"
ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2="9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
ethReceiverAddr3="0x1919203bA8b325278d28Fb8fFeac49F2CD881A4e"
#ethReceiverAddrKey3="62ca4122aac0e6f35bed02fc15c7ddbdaa07f2f2a1821c8b8210b891051e3ee9"
prophecyTx0="0x112260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
prophecyTx1="0x222260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
......@@ -31,9 +26,9 @@ prophecyTx5="0x662260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
prophecyTx6="0x772260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
InitAndDeploy() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLI} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLI} relayer set_pwd -p 123456hzj)
cli_ret "${result}" "set_pwd"
result=$(${CLI} relayer unlock -p 123456hzj)
......@@ -45,17 +40,14 @@ InitAndDeploy() {
result=$(${CLI} relayer ethereum import_chain33privatekey -k "${chain33SenderAddrKey}")
cli_ret "${result}" "import_chain33privatekey"
result=$(${CLI} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKey}")
cli_ret "${result}" "import_ethprivatekey"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# eth to chain33
# 在以太坊上锁定资产,然后在 chain33 上铸币,针对 erc20 资产
# 以太坊 brun 资产,balance 对比是否正确
TestETH2Chain33Erc20() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
${CLI} relayer unlock -p 123456hzj
# token4erc20 在 chain33 上先有 token,同时 mint
......@@ -116,11 +108,11 @@ TestETH2Chain33Erc20() {
result=$(${CLI} relayer ethereum balance -o "${bridgeBankAddr}" -t "${tokenSymbol}")
cli_ret "${result}" "balance" ".balance" "0"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
TestETH2Chain33Erc20_err() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
${CLI} relayer unlock -p 123456hzj
# token4erc20 在 chain33 上先有 token,同时 mint
......@@ -187,13 +179,13 @@ TestETH2Chain33Erc20_err() {
result=$(${CLI} relayer ethereum balance -o "${bridgeBankAddr}" -t "${tokenSymbol}")
cli_ret "${result}" "balance" ".balance" "300"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# eth to chain33
# 在以太坊上锁定资产,然后在 chain33 上铸币,针对 eth 资产
TestETH2Chain33Assets() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
${CLI} relayer unlock -p 123456hzj
result=$(${CLI} relayer ethereum bridgeBankAddr)
......@@ -273,14 +265,14 @@ TestETH2Chain33Assets() {
result=$(${CLI} relayer ethereum balance -o "${bridgeBankAddr}")
cli_ret "${result}" "balance" ".balance" "0"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# chain33 to eth
# 在 chain33 上锁定资产,然后在以太坊上铸币
# chain33 brun 资产,balance 对比是否正确
TestChain33ToEthAssets() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLI} relayer unlock -p 123456hzj)
# token4chain33 在 以太坊 上先有 bty
result=$(${CLI} relayer ethereum token4chain33 -s coins.bty)
......@@ -334,7 +326,7 @@ TestChain33ToEthAssets() {
result=$(${CLI} relayer ethereum burn -m 10 -k "${ethReceiverAddrKey1}" -r "${chain33SenderAddr}" -t "${tokenAddr}")
cli_ret_err "${result}"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
main() {
......
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
set -x
# 只启动 eth 这一端的测试
......@@ -6,9 +8,6 @@ set -x
source "./publicTest.sh"
CLIA="../build/ebcli_A"
CLIB="../build/ebcli_B"
CLIC="../build/ebcli_C"
CLID="../build/ebcli_D"
tokenAddr=""
chain33SenderAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
......@@ -20,7 +19,7 @@ prophecyTx0="0x772260c98aec81b3e235af47c355db720f60e751cce100fed6f334e1b1530bde"
# 初始化部署合约
InitAndDeploy() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 创建文件夹及拷贝
rm -rf '../build/A' '../build/B' '../build/C' '../build/D'
mkdir '../build/A' '../build/B' '../build/C' '../build/D'
......@@ -28,7 +27,7 @@ InitAndDeploy() {
cp '../build/ebrelayer' '../build/A/ebrelayer'
start_ebrelayer "./../build/A/ebrelayer" "./../build/A/ebrelayer.log"
result=$(${CLIA} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLIA} relayer set_pwd -p 123456hzj)
cli_ret "${result}" "set_pwd"
result=$(${CLIA} relayer unlock -p 123456hzj)
......@@ -36,52 +35,47 @@ InitAndDeploy() {
result=$(${CLIA} relayer ethereum deploy)
cli_ret "${result}" "deploy"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# 初始化 B C D 文件夹下的文容
function InitConfigFile() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# 获取 BridgeRegistry 地址
result=$(${CLIA} relayer ethereum bridgeRegistry)
BridgeRegistry=$(cli_ret "${result}" "bridgeRegistry" ".addr")
port=9901
for name in B C D; do
file="../build/"$name"/relayer.toml"
file="../build/$name/relayer.toml"
cp '../build/relayer.toml' "${file}"
cp '../build/ebrelayer' "../build/"$name"/ebrelayer"
cp '../build/ebrelayer' "../build/$name/ebrelayer"
# 删除配置文件中不需要的字段
for deleteName in "BridgeRegistry" "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers" "deployerPrivateKey" "\[deploy\]"; do
for deleteName in "BridgeRegistry" "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers" "deployerPrivateKey" "deploy"; do
delete_line "${file}" "${deleteName}"
done
# 在第 5 行后面 新增合约地址
sed -i '5 a BridgeRegistry="'${BridgeRegistry}'"' "${file}"
sed -i '5 a BridgeRegistry="'"${BridgeRegistry}"'"' "${file}"
# 替换端口
port=$((port + 1))
sed -i 's/localhost:9901/localhost:'${port}'/g' "${file}"
done
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# 启动 B C D 的 ebrelayer 服务,导入私钥
function ImportCBDKey() {
echo "=========== $FUNCNAME begin ==========="
local ethValidatorAddrKeyA="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
local ethValidatorAddrKeyB="a5f3063552f4483cfc20ac4f40f45b798791379862219de9e915c64722c1d400"
local ethValidatorAddrKeyC="bbf5e65539e9af0eb0cfac30bad475111054b09c11d668fc0731d54ea777471e"
local ethValidatorAddrKeyD="c9fa31d7984edf81b8ef3b40c761f1847f6fcd5711ab2462da97dc458f1f896b"
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
for name in B C D; do
start_ebrelayer "./../build/"$name"/ebrelayer" "./../build/"$name"/ebrelayer.log"
start_ebrelayer "./../build/$name/ebrelayer" "./../build/$name/ebrelayer.log"
# 导入测试地址私钥
CLI="../build/ebcli_$name"
result=$(${CLI} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLI} relayer set_pwd -p 123456hzj)
cli_ret "${result}" "set_pwd"
result=$(${CLI} relayer unlock -p 123456hzj)
......@@ -93,24 +87,12 @@ function ImportCBDKey() {
result=$(${CLIA} relayer ethereum import_chain33privatekey -k "${chain33SenderAddrKey}")
cli_ret "${result}" "import_chain33privatekey"
result=$(${CLIA} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyA}")
cli_ret "${result}" "import_ethprivatekey"
result=$(${CLIB} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyB}")
cli_ret "${result}" "import_ethprivatekeyB"
result=$(${CLIC} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyC}")
cli_ret "${result}" "import_ethprivatekeyC"
result=$(${CLID} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKeyD}")
cli_ret "${result}" "import_ethprivatekeyD"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
# chain33 到 eth,chian33 lock 100,必须 A B C D 中有三个都lock,才能成功
TestChain33ToEth() {
echo "=========== $FUNCNAME begin ==========="
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
# token4chain33 在 以太坊 上先有 bty
result=$(${CLIA} relayer ethereum token4chain33 -s coins.bty)
tokenAddr=$(cli_ret "${result}" "token4chain33" ".addr")
......@@ -147,7 +129,7 @@ TestChain33ToEth() {
result=$(${CLIA} relayer ethereum burn -m 90 -k "${ethReceiverAddrKey1}" -r "${chain33SenderAddr}" -t "${tokenAddr}")
cli_ret "${result}" "burn"
echo "=========== $FUNCNAME end ==========="
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
}
main() {
......
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
# shellcheck disable=SC2155
set -x
set -e
......@@ -39,7 +40,7 @@ function cli_ret() {
msg=$(echo "${1}" | jq -r "${jqMsg}")
if [[ $# -eq 4 ]]; then
if [ $(echo "$msg < $4" | bc) -eq 1 ] || [ $(echo "$msg > $4" | bc) -eq 1 ]; then
if [ "$(echo "$msg < $4" | bc)" -eq 1 ] || [ "$(echo "$msg > $4" | bc)" -eq 1 ]; then
echo -e "${RED}The balance is not correct${NOC}"
exit 1
fi
......@@ -58,7 +59,7 @@ function balance_ret() {
fi
local balance=$(echo "${1}" | jq -r ".balance")
if [ $(echo "$balance < $2" | bc) -eq 1 ] || [ $(echo "$balance > $2" | bc) -eq 1 ]; then
if [ "$(echo "$balance < $2" | bc)" -eq 1 ] || [ "$(echo "$balance > $2" | bc)" -eq 1 ]; then
echo -e "${RED}The balance is not correct${NOC}"
exit 1
fi
......@@ -115,6 +116,7 @@ function start_ebrelayer() {
nohup "${1}" >"${2}" 2>&1 &
sleep 2
# shellcheck disable=SC2009
pid=$(ps -ef | grep "${1}" | grep -v 'grep' | awk '{print $2}')
local count=0
while [ "${pid}" == "" ]; do
......@@ -127,6 +129,7 @@ function start_ebrelayer() {
exit 1
fi
# shellcheck disable=SC2009
pid=$(ps -ef | grep "${1}" | grep -v 'grep' | awk '{print $2}')
done
}
......@@ -162,7 +165,7 @@ function start_ebrelayer_and_setpwd_unlock() {
local CLI="./ebcli_$1"
local count=0
while true; do
result=$(${CLI} relayer set_pwd -n 123456hzj -o kk | jq -r .isOK)
result=$(${CLI} relayer set_pwd -p 123456hzj | jq -r .isOK)
if [[ ${result} == "true" ]]; then
break
fi
......@@ -195,6 +198,7 @@ function start_ebrelayer_and_setpwd_unlock() {
# 杀死进程ebrelayer 进程 $1进程名称
function kill_ebrelayer() {
# shellcheck disable=SC2009
pid=$(ps -ef | grep "${1}" | grep -v 'grep' | awk '{print $2}')
if [ "${pid}" == "" ]; then
echo "not find ${1} pid"
......@@ -202,6 +206,7 @@ function kill_ebrelayer() {
fi
kill "${pid}"
# shellcheck disable=SC2009
pid=$(ps -ef | grep "${1}" | grep -v 'grep' | awk '{print $2}')
if [ "${pid}" != "" ]; then
echo "kill ${1} failed"
......@@ -255,7 +260,7 @@ function check_tx() {
local count=0
while true; do
ty=$(${CLI} tx query -s ${2} | jq .receipt.ty)
ty=$(${CLI} tx query -s "${2}" | jq .receipt.ty)
if [[ ${ty} != "" ]]; then
break
fi
......@@ -271,7 +276,7 @@ function check_tx() {
set -x
ty=$(${CLI} tx query -s ${2} | jq .receipt.ty)
ty=$(${CLI} tx query -s "${2}" | jq .receipt.ty)
if [[ ${ty} != 2 ]]; then
echo -e "${RED}check tx error, hash is ${2}${NOC}"
exit 1
......@@ -283,7 +288,7 @@ function check_number() {
echo -e "${RED}wrong check number parameters${NOC}"
exit 1
fi
if [[ ${1} != ${2} ]]; then
if [[ ${1} != "${2}" ]]; then
echo -e "${RED}error number, expect ${1}, get ${2}${NOC}"
exit 1
fi
......@@ -296,8 +301,8 @@ function check_addr() {
exit 1
fi
addr=$(echo ${1} | jq -r ".acc.addr")
if [[ ${addr} != ${2} ]]; then
addr=$(echo "${1}" | jq -r ".acc.addr")
if [[ ${addr} != "${2}" ]]; then
echo -e "${RED}error addr, expect ${1}, get ${2}${NOC}"
exit 1
fi
......@@ -331,18 +336,18 @@ function updata_relayer_toml() {
exit 1
fi
local line=$(delete_line_show ${file} "chain33Host")
local line=$(delete_line_show "${file}" "chain33Host")
# 在第 line 行后面 新增合约地址
sed -i ''${line}' a chain33Host="http://'${chain33Host}':8801"' "${file}"
sed -i ''"${line}"' a chain33Host="http://'"${chain33Host}"':8801"' "${file}"
line=$(delete_line_show ${file} "pushHost")
sed -i ''${line}' a pushHost="http://'${pushHost}':20000"' "${file}"
line=$(delete_line_show "${file}" "pushHost")
sed -i ''"${line}"' a pushHost="http://'"${pushHost}"':20000"' "${file}"
line=$(delete_line_show ${file} "BridgeRegistry")
sed -i ''${line}' a BridgeRegistry="'${BridgeRegistry}'"' "${file}"
line=$(delete_line_show "${file}" "BridgeRegistry")
sed -i ''"${line}"' a BridgeRegistry="'"${BridgeRegistry}"'"' "${file}"
sed -i 's/EthMaturityDegree=10/'EthMaturityDegree=${maturityDegree}'/g' "${file}"
sed -i 's/maturityDegree=10/'maturityDegree=${maturityDegree}'/g' "${file}"
sed -i 's/EthMaturityDegree=10/'EthMaturityDegree="${maturityDegree}"'/g' "${file}"
sed -i 's/maturityDegree=10/'maturityDegree="${maturityDegree}"'/g' "${file}"
#sed -i 's/#BridgeRegistry=\"0x40BFE5eD039A9a2Eb42ece2E2CA431bFa7Cf4c42\"/BridgeRegistry=\"'${BridgeRegistry}'\"/g' "../build/relayer.toml"
#sed -i 's/192.168.64.2/'${chain33Host}'/g' "../build/relayer.toml"
......@@ -358,18 +363,18 @@ function updata_relayer_toml_ropston() {
local chain33Host=127.0.0.1
local pushHost=127.0.0.1
local line=$(delete_line_show ${file} "chain33Host")
local line=$(delete_line_show "${file}" "chain33Host")
# 在第 line 行后面 新增合约地址
sed -i ''${line}' a chain33Host="http://'${chain33Host}':8801"' "${file}"
sed -i ''"${line}"' a chain33Host="http://'${chain33Host}':8801"' "${file}"
line=$(delete_line_show ${file} "pushHost")
sed -i ''${line}' a pushHost="http://'${pushHost}':20000"' "${file}"
line=$(delete_line_show "${file}" "pushHost")
sed -i ''"${line}"' a pushHost="http://'${pushHost}':20000"' "${file}"
line=$(delete_line_show ${file} "BridgeRegistry")
sed -i ''${line}' a BridgeRegistry="'${BridgeRegistry}'"' "${file}"
line=$(delete_line_show "${file}" "BridgeRegistry")
sed -i ''"${line}"' a BridgeRegistry="'"${BridgeRegistry}"'"' "${file}"
sed -i 's/EthMaturityDegree=10/'EthMaturityDegree=${maturityDegree}'/g' "${file}"
sed -i 's/maturityDegree=10/'maturityDegree=${maturityDegree}'/g' "${file}"
sed -i 's/EthMaturityDegree=10/'EthMaturityDegree="${maturityDegree}"'/g' "${file}"
sed -i 's/maturityDegree=10/'maturityDegree="${maturityDegree}"'/g' "${file}"
#sed -i 's/#BridgeRegistry=\"0x40BFE5eD039A9a2Eb42ece2E2CA431bFa7Cf4c42\"/BridgeRegistry=\"'${BridgeRegistry}'\"/g' "../build/relayer.toml"
#sed -i 's/192.168.64.2/'${chain33Host}'/g' "../build/relayer.toml"
......@@ -383,12 +388,12 @@ function updata_all_relayer_toml() {
# local dockername=30
for name in B C D; do
local file="../build/"$name"/relayer.toml"
local file="../build/$name/relayer.toml"
cp '../build/A/relayer.toml' "${file}"
cp '../build/ebrelayer' "../build/"$name"/ebrelayer"
cp '../build/ebrelayer' "../build/$name/ebrelayer"
# 删除配置文件中不需要的字段
for deleteName in "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers" "deployerPrivateKey" "\[deploy\]"; do
for deleteName in "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers" "deployerPrivateKey" "deploy"; do
delete_line "${file}" "${deleteName}"
done
......@@ -421,12 +426,12 @@ function updata_all_relayer_toml2() {
# local dockername=30
for name in B C D; do
local file="./"$name"/relayer.toml"
local file="./$name/relayer.toml"
cp './A/relayer.toml' "${file}"
cp './ebrelayer' "./"$name"/ebrelayer"
cp './ebrelayer' "./$name/ebrelayer"
# 删除配置文件中不需要的字段
for deleteName in "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers" "deployerPrivateKey" "\[deploy\]"; do
for deleteName in "deployerPrivateKey" "operatorAddr" "validatorsAddr" "initPowers" "deployerPrivateKey" "deploy"; do
delete_line "${file}" "${deleteName}"
done
......@@ -512,7 +517,7 @@ function eth_block_wait() {
if [ "${url}" == "" ]; then
cur_height=$(curl -ksd '{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}' http://localhost:7545 | jq -r ".result")
else
cur_height=$(curl -H "Content-Type: application/json" -X POST --data '{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}' ${url} | jq -r ".result")
cur_height=$(curl -H "Content-Type: application/json" -X POST --data '{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}' "${url}" | jq -r ".result")
fi
local expect=$((cur_height + ${1} + 1))
......@@ -521,7 +526,7 @@ function eth_block_wait() {
if [ "${url}" == "" ]; then
new_height=$(curl -ksd '{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}' http://localhost:7545 | jq -r ".result")
else
new_height=$(curl -H "Content-Type: application/json" -X POST --data '{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}' ${url} | jq -r ".result")
new_height=$(curl -H "Content-Type: application/json" -X POST --data '{"id":1,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}' "${url}" | jq -r ".result")
fi
if [[ ${new_height} -ge ${expect} ]]; then
......
......@@ -16,26 +16,20 @@ tokenAddr=""
BridgeRegistry=""
chain33SenderAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33SenderAddrKey="CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
ethValidatorAddrKey="3fa21584ae2e4fd74db9b58e2386f5481607dfa4d7ba0617aaa7858e5025dc1e"
ethReceiverAddr1="0xa4ea64a583f6e51c3799335b28a8f0529570a635"
ethReceiverAddrKey1="355b876d7cbcb930d5dfab767f66336ce327e082cbaa1877210c1bae89b1df71"
ethReceiverAddr2="0x0c05ba5c230fdaa503b53702af1962e08d0c60bf"
ethReceiverAddrKey2="9dc6df3a8ab139a54d8a984f54958ae0661f880229bf3bdbb886b87d58b56a08"
ethReceiverAddr3="0x1919203bA8b325278d28Fb8fFeac49F2CD881A4e"
ethReceiverAddrKey3="62ca4122aac0e6f35bed02fc15c7ddbdaa07f2f2a1821c8b8210b891051e3ee9"
chain33Validator1="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
chain33Validator2="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" #0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01
chain33Validator3="1BqP2vHkYNjSgdnTqm7pGbnphLhtEhuJFi"
BtyReceiever="1BqP2vHkYNjSgdnTqm7pGbnphLhtEhuJFi"
ETHContractAddr="0x0000000000000000000000000000000000000000"
maturityDegree=10
function InitAndDeploy() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLI} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLI} relayer set_pwd -p 123456hzj)
cli_ret "${result}" "set_pwd"
result=$(${CLI} relayer unlock -p 123456hzj)
......@@ -49,16 +43,13 @@ function InitAndDeploy() {
function EthImportKey() {
echo -e "${GRE}=========== $FUNCNAME begin ===========${NOC}"
result=$(${CLI} relayer set_pwd -n 123456hzj -o kk)
result=$(${CLI} relayer set_pwd -p 123456hzj)
result=$(${CLI} relayer unlock -p 123456hzj)
result=$(${CLI} relayer ethereum import_chain33privatekey -k "${chain33SenderAddrKey}")
cli_ret "${result}" "import_chain33privatekey"
result=$(${CLI} relayer ethereum import_ethprivatekey -k "${ethValidatorAddrKey}")
cli_ret "${result}" "import_ethprivatekey"
result=$(${CLI} relayer chain33 import_privatekey -k "${ethValidatorAddrKey}")
cli_ret "${result}" "import_ethprivatekey"
......@@ -89,12 +80,12 @@ function StartRelayerAndDeploy() {
kill_ebrelayer "../build/ebrelayer"
# 修改 relayer.toml 配置文件
updata_relayer_toml ${BridgeRegistry} ${maturityDegree} "../build/relayer.toml"
updata_relayer_toml "${BridgeRegistry}" ${maturityDegree} "../build/relayer.toml"
# 重启 ebrelayer 并解锁
start_ebrelayer "../build/ebrelayer" "../build/ebrelayer.log"
${CLI} relayer set_pwd -n 123456hzj -o kk
${CLI} relayer set_pwd -p 123456hzj
${CLI} relayer unlock -p 123456hzj
echo -e "${GRE}=========== $FUNCNAME end ===========${NOC}"
......@@ -130,10 +121,10 @@ function InitChain33Vilators() {
# query Validators
totalPower=$(${Chain33Cli} send x2ethereum query validators -v ${chain33Validator1} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower | sed 's/\"//g')
check_number 87 ${totalPower}
check_number 87 "${totalPower}"
totalPower=$(${Chain33Cli} send x2ethereum query totalpower -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv | jq .totalPower | sed 's/\"//g')
check_number 100 ${totalPower}
check_number 100 "${totalPower}"
# cions 转帐到 x2ethereum 合约地址
hash=$(${Chain33Cli} send coins send_exec -e x2ethereum -a 200 -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
......@@ -161,7 +152,7 @@ function TestChain33ToEthAssets() {
cli_ret "${result}" "balance" ".balance" "0"
# chain33 lock bty
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t coins.bty -r ${ethReceiverAddr1} -q ${tokenAddr} -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
hash=$(${Chain33Cli} send x2ethereum lock -a 5 -t coins.bty -r ${ethReceiverAddr1} -q "${tokenAddr}" -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv)
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -323,7 +314,7 @@ function TestETH2Chain33Erc20() {
balance_ret "${result}" "100"
# chain33 burn 40
hash=$(${Chain33Cli} send x2ethereum burn -a 40 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33SenderAddr}")
hash=$(${Chain33Cli} send x2ethereum burn -a 40 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33SenderAddr}")
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......@@ -339,7 +330,7 @@ function TestETH2Chain33Erc20() {
cli_ret "${result}" "balance" ".balance" "60"
# burn 60
hash=$(${Chain33Cli} send x2ethereum burn -a 60 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q ${tokenAddr} -k "${chain33SenderAddr}")
hash=$(${Chain33Cli} send x2ethereum burn -a 60 -t "${tokenSymbol}" -r ${ethReceiverAddr2} -q "${tokenAddr}" -k "${chain33SenderAddr}")
block_wait "${Chain33Cli}" $((maturityDegree + 2))
check_tx "${Chain33Cli}" "${hash}"
......
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