Commit a1c96130 authored by hezhengjun's avatar hezhengjun

add permission process for token withdraw

parent 832075c0
......@@ -1204,16 +1204,20 @@ func addCfgWithdrawFlags(cmd *cobra.Command) {
_ = cmd.MarkFlagRequired("symbol")
cmd.Flags().Int64P("fee", "f", 0, "fee amount")
_ = cmd.MarkFlagRequired("fee")
cmd.Flags().Int64P("amount", "a", 0, "accumulative amount allowed to be withdrew per day")
_ = cmd.MarkFlagRequired("amount")
}
func CfgWithdraw(cmd *cobra.Command, _ []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
symbol, _ := cmd.Flags().GetString("symbol")
fee, _ := cmd.Flags().GetInt64("fee")
amount, _ := cmd.Flags().GetInt64("amount")
req := &ebTypes.CfgWithdrawReq{
Symbol: symbol,
FeeAmount: fee,
Symbol: symbol,
FeeAmount: fee,
AmountPerDay: amount,
}
var res rpctypes.Reply
......
......@@ -247,12 +247,32 @@ message ResendChain33EventReq {
}
message CfgWithdrawReq {
string symbol = 1;
int64 feeAmount = 2;
string symbol = 1;
int64 feeAmount = 2;
int64 amountPerDay = 3;
}
message withdrawPara {
int64 fee = 1;
int64 amountPerDay = 2;
}
message WithdrawSymbol2Para {
map<string, withdrawPara> symbol2Para = 1;
}
message WithdrawSymbol2Fee {
map<string, int64> symbol2Fee = 1;
message WithdrawTx {
string chain33Sender = 1;
string ethereumReceiver = 2;
string symbol = 4;
int64 amount = 5;
int64 nonce = 6;
string txHashOnChain33 = 7;
string txHashOnEthereum = 8;
int32 year = 9;
int32 month = 10;
int32 day = 11;
string status = 12;
}
......
......@@ -20,6 +20,8 @@ import (
"sync/atomic"
"time"
chain33EvmCommon "github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
dbm "github.com/33cn/chain33/common/db"
......@@ -75,7 +77,7 @@ type Relayer4Ethereum struct {
symbol2Addr map[string]common.Address
symbol2LockAddr map[string]ebTypes.TokenAddress
mulSignAddr string
withdrawFee map[string]int64
withdrawFee map[string]*ebTypes.WithdrawPara
}
var (
......@@ -463,7 +465,6 @@ func (ethRelayer *Relayer4Ethereum) proc() {
var timer *time.Ticker
ctx := context.Background()
continueFailCount := int32(0)
for range ethRelayer.unlockchan {
relayerLog.Info("Received ethRelayer.unlockchan")
ethRelayer.rwLock.RLock()
......@@ -485,7 +486,7 @@ latter:
for {
select {
case <-timer.C:
ethRelayer.procNewHeight(ctx, &continueFailCount)
ethRelayer.procNewHeight(ctx)
case err := <-ethRelayer.bridgeBankSub.Err():
relayerLog.Error("proc", "bridgeBankSub err", err.Error())
ethRelayer.subscribeEvent()
......@@ -508,7 +509,39 @@ func (ethRelayer *Relayer4Ethereum) handleChain33Msg(chain33Msg *events.Chain33M
return
}
type WithdrawTx struct {
Chain33Sender chain33EvmCommon.Address
EthereumReceiver common.Address
TokenContractAddress chain33EvmCommon.Address
Symbol string
Amount *big.Int
TxHash []byte
Nonce int64
year int
month int
day int
}
func (ethRelayer *Relayer4Ethereum) checkPermissionWithinOneDay(withdrawTx *ebTypes.WithdrawTx) (bool, error) {
totalAlready, err := ethRelayer.getWithdrawsWithinSameDay(withdrawTx)
if nil != err {
relayerLog.Error("checkPermissionWithinOneDay", "Failed to getWithdrawsWithinSameDay due to", err.Error())
return false, errors.New("ErrGetWithdrawsWithinSameDay")
}
withdrawPara, ok := ethRelayer.withdrawFee[withdrawTx.Symbol]
if !ok {
relayerLog.Error("checkPermissionWithinOneDay", "No withdraw parameter configured for symbol ", withdrawTx.Symbol)
return false, errors.New("ErrNoWithdrawParaCfged")
}
if totalAlready+withdrawTx.Amount > withdrawPara.AmountPerDay {
relayerLog.Error("checkPermissionWithinOneDay", "No withdraw parameter configured for symbol ", withdrawTx.Symbol)
return false, errors.New("ErrWithdrawAmountTooBig")
}
return true, nil
}
func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33Msg) {
//只有通过代理人登录的中继器,才处理提币事件
if !ethRelayer.processWithDraw {
relayerLog.Info("handleLogWithdraw", "Needn't process withdraw for this relay validator", ethRelayer.ethSender)
return
......@@ -521,6 +554,29 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
return
}
now := time.Now()
year, month, day := now.Date()
withdrawTx := &ebTypes.WithdrawTx{
Chain33Sender: chain33Msg.Chain33Sender.String(),
EthereumReceiver: chain33Msg.EthereumReceiver.String(),
Symbol: chain33Msg.Symbol,
Amount: chain33Msg.Amount.Int64(),
TxHashOnChain33: common.Bytes2Hex(chain33Msg.TxHash),
Nonce: chain33Msg.Nonce,
Year: int32(year),
Month: int32(month),
Day: int32(day),
}
if ok, err := ethRelayer.checkPermissionWithinOneDay(withdrawTx); !ok {
withdrawTx.Status = err.Error()
err := ethRelayer.setWithdraw(withdrawTx)
if nil != err {
relayerLog.Error("handleLogWithdraw", "Failed to setWithdraw due to:", err.Error())
}
return
}
tokenAddr := common.HexToAddress(withdrawFromChain33TokenInfo.Address)
//从chain33进行withdraw回来的token需要根据精度进行相应的缩放
if 8 != withdrawFromChain33TokenInfo.Decimal {
......@@ -546,9 +602,19 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
"Receiver on Ethereum", chain33Msg.EthereumReceiver.String())
//TODO:此处需要完成在以太坊发送以太或者ERC20数字资产的操作
withdrawTx.Status = "Withdraw Tx has been sent to Ethereum"
err := ethRelayer.setWithdraw(withdrawTx)
if nil != err {
relayerLog.Error("handleLogWithdraw", "Failed to setWithdraw due to:", err.Error())
}
return
}
func (ethRelayer *Relayer4Ethereum) handleLogLockBurn(chain33Msg *events.Chain33Msg) {
//对于通过代理人登录的中继器,不处理lock和burn事件
if ethRelayer.processWithDraw {
relayerLog.Info("handleLogWithdraw", "Needn't process lock and burn for this withdraw process specified validator", ethRelayer.ethSender)
return
}
relayerLog.Info("handleLogLockBurn", "Received chain33Msg", chain33Msg, "tx hash string", common.Bytes2Hex(chain33Msg.TxHash))
// Parse the Chain33Msg into a ProphecyClaim for relay to Ethereum
......@@ -648,30 +714,33 @@ func (ethRelayer *Relayer4Ethereum) handleLogLockBurn(chain33Msg *events.Chain33
"Chain33Sender", statics.Chain33Sender)
}
func (ethRelayer *Relayer4Ethereum) procNewHeight(ctx context.Context, continueFailCount *int32) {
func (ethRelayer *Relayer4Ethereum) getCurrentHeight(ctx context.Context) (uint64, error) {
head, err := ethRelayer.clientSpec.HeaderByNumber(ctx, nil)
if nil != err {
*continueFailCount++
if *continueFailCount >= 5 {
ethRelayer.clientSpec, err = ethtxs.SetupWebsocketEthClient(ethRelayer.providerHttp)
if err != nil {
relayerLog.Error("SetupWebsocketEthClient", "err", err)
return
}
if nil == err {
return head.Number.Uint64(), nil
}
}
//retry
head, err = ethRelayer.clientSpec.HeaderByNumber(ctx, nil)
//TODO: 需要在下面添加报警处理
for {
time.Sleep(5 * time.Second)
ethRelayer.clientSpec, err = ethtxs.SetupWebsocketEthClient(ethRelayer.providerHttp)
if err != nil {
relayerLog.Error("Failed to get ethereum height", "provider", ethRelayer.provider,
"continueFailCount", continueFailCount, "err", err.Error())
return
relayerLog.Error("getCurrentHeight", "Failed to SetupWebsocketEthClient due to:", err.Error())
continue
}
head, err := ethRelayer.clientSpec.HeaderByNumber(ctx, nil)
if nil != err {
relayerLog.Error("getCurrentHeight", "Failed to HeaderByNumber due to:", err.Error())
continue
}
return head.Number.Uint64(), nil
}
}
func (ethRelayer *Relayer4Ethereum) procNewHeight(ctx context.Context) {
currentHeight, _ := ethRelayer.getCurrentHeight(ctx)
ethRelayer.updateTxStatus()
*continueFailCount = 0
currentHeight := head.Number.Uint64()
//currentHeight := head.Number.Uint64()
relayerLog.Info("procNewHeight", "currentHeight", currentHeight, "ethRelayer.eventLogIndex.Height", ethRelayer.eventLogIndex.Height, "uint64(ethRelayer.maturityDegree)", uint64(ethRelayer.maturityDegree))
//一次最大只获取10个logEvent进行处理
......@@ -795,12 +864,8 @@ func (ethRelayer *Relayer4Ethereum) filterLogEvents() {
height4BridgeBankLogAt = deployHeight
}
header, err := ethRelayer.clientSpec.HeaderByNumber(context.Background(), nil)
if err != nil {
errinfo := fmt.Sprintf("Failed to get HeaderByNumbers due to:%s", err.Error())
panic(errinfo)
}
curHeight := int64(header.Number.Uint64())
curHeightUint64, _ := ethRelayer.getCurrentHeight(context.Background())
curHeight := int64(curHeightUint64)
relayerLog.Info("filterLogEvents", "curHeight:", curHeight)
bridgeBankSig := make(map[string]bool)
......@@ -1133,9 +1198,13 @@ func (ethRelayer *Relayer4Ethereum) SetMultiSignAddr(address string) {
ethRelayer.setMultiSignAddress(address)
}
func (ethRelayer *Relayer4Ethereum) CfgWithdraw(symbol string, feeAmount int64) error {
func (ethRelayer *Relayer4Ethereum) CfgWithdraw(symbol string, feeAmount, amountPerDay int64) error {
withdrawPara := &ebTypes.WithdrawPara{
Fee: feeAmount,
AmountPerDay: amountPerDay,
}
ethRelayer.rwLock.Lock()
ethRelayer.withdrawFee[symbol] = feeAmount
ethRelayer.withdrawFee[symbol] = withdrawPara
ethRelayer.rwLock.Unlock()
return ethRelayer.setWithdrawFee(ethRelayer.withdrawFee)
......
......@@ -27,7 +27,8 @@ var (
ethLockTxUpdateTxIndex = []byte("eth-ethLockTxUpdateTxIndex")
ethBurnTxUpdateTxIndex = []byte("eth-ethBurnTxUpdateTxIndex")
multiSignAddressPrefix = []byte("eth-multiSignAddress")
withdrawFeeKey = []byte("eth-withdrawFee")
withdrawParaKey = []byte("eth-withdrawPara")
withdrawTokenPrefix = []byte("eth-withdrawTokenPrefix")
)
func ethTokenSymbol2AddrKey(symbol string) []byte {
......@@ -385,27 +386,74 @@ func (ethRelayer *Relayer4Ethereum) getMultiSignAddress() string {
return string(bytes)
}
func (ethRelayer *Relayer4Ethereum) setWithdrawFee(symbol2Fee map[string]int64) error {
withdrawSymbol2Fee := &ebTypes.WithdrawSymbol2Fee{
Symbol2Fee: symbol2Fee,
func (ethRelayer *Relayer4Ethereum) setWithdrawFee(symbol2Para map[string]*ebTypes.WithdrawPara) error {
withdrawSymbol2Fee := &ebTypes.WithdrawSymbol2Para{
Symbol2Para: symbol2Para,
}
bytes := chain33Types.Encode(withdrawSymbol2Fee)
return ethRelayer.db.Set(withdrawFeeKey, bytes)
return ethRelayer.db.Set(withdrawParaKey, bytes)
}
func (ethRelayer *Relayer4Ethereum) restoreWithdrawFee() map[string]int64 {
bytes, _ := ethRelayer.db.Get(withdrawFeeKey)
func (ethRelayer *Relayer4Ethereum) restoreWithdrawFee() map[string]*ebTypes.WithdrawPara {
bytes, _ := ethRelayer.db.Get(withdrawParaKey)
if 0 == len(bytes) {
result := make(map[string]int64)
result := make(map[string]*ebTypes.WithdrawPara)
return result
}
var withdrawSymbol2Fee ebTypes.WithdrawSymbol2Fee
if err := chain33Types.Decode(bytes, &withdrawSymbol2Fee); nil != err {
result := make(map[string]int64)
var withdrawSymbol2Para ebTypes.WithdrawSymbol2Para
if err := chain33Types.Decode(bytes, &withdrawSymbol2Para); nil != err {
result := make(map[string]*ebTypes.WithdrawPara)
return result
}
return withdrawSymbol2Fee.Symbol2Fee
return withdrawSymbol2Para.Symbol2Para
}
func calcWithdrawKey(chain33Sender, symbol string, year, month, day int, nonce int64) []byte {
return []byte(fmt.Sprintf("%s-%s-%s-%d-%d-%d-%d", withdrawTokenPrefix, chain33Sender, symbol, year, month, day, nonce))
}
func calcWithdrawKeyPrefix(chain33Sender, symbol string, year, month, day int) []byte {
return []byte(fmt.Sprintf("%s-%s-%s-%d-%d-%d", withdrawTokenPrefix, chain33Sender, symbol, year, month, day))
}
func (ethRelayer *Relayer4Ethereum) setWithdraw(withdrawTx *ebTypes.WithdrawTx) error {
chain33Sender := withdrawTx.Chain33Sender
symbol := withdrawTx.Symbol
year := withdrawTx.Year
month := withdrawTx.Month
day := withdrawTx.Day
key := calcWithdrawKey(chain33Sender, symbol, int(year), int(month), int(day), withdrawTx.Nonce)
bytes := chain33Types.Encode(withdrawTx)
return ethRelayer.db.Set(key, bytes)
}
func (ethRelayer *Relayer4Ethereum) getWithdrawsWithinSameDay(withdrawTx *ebTypes.WithdrawTx) (int64, error) {
chain33Sender := withdrawTx.Chain33Sender
symbol := withdrawTx.Symbol
year := withdrawTx.Year
month := withdrawTx.Month
day := withdrawTx.Day
prefix := calcWithdrawKeyPrefix(chain33Sender, symbol, int(year), int(month), int(day))
helper := dbm.NewListHelper(ethRelayer.db)
datas := helper.List(prefix, nil, 100, dbm.ListASC)
if nil == datas {
return 0, nil
}
withdrawTotal := int64(0)
for _, data := range datas {
var info ebTypes.WithdrawTx
err := chain33Types.Decode(data, &info)
if nil != err {
return 0, err
}
withdrawTotal += info.Amount
}
return withdrawTotal, nil
}
......@@ -1109,7 +1109,7 @@ func (manager *Manager) CfgWithdraw(cfgWithdrawReq *relayerTypes.CfgWithdrawReq,
if err := manager.checkPermission(); nil != err {
return err
}
err := manager.ethRelayer.CfgWithdraw(cfgWithdrawReq.Symbol, cfgWithdrawReq.FeeAmount)
err := manager.ethRelayer.CfgWithdraw(cfgWithdrawReq.Symbol, cfgWithdrawReq.FeeAmount, cfgWithdrawReq.AmountPerDay)
resultCfg := true
if err != nil {
resultCfg = false
......
......@@ -2436,8 +2436,9 @@ type CfgWithdrawReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
FeeAmount int64 `protobuf:"varint,2,opt,name=feeAmount,proto3" json:"feeAmount,omitempty"`
Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
FeeAmount int64 `protobuf:"varint,2,opt,name=feeAmount,proto3" json:"feeAmount,omitempty"`
AmountPerDay int64 `protobuf:"varint,3,opt,name=amountPerDay,proto3" json:"amountPerDay,omitempty"`
}
func (x *CfgWithdrawReq) Reset() {
......@@ -2486,16 +2487,24 @@ func (x *CfgWithdrawReq) GetFeeAmount() int64 {
return 0
}
type WithdrawSymbol2Fee struct {
func (x *CfgWithdrawReq) GetAmountPerDay() int64 {
if x != nil {
return x.AmountPerDay
}
return 0
}
type WithdrawPara struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Symbol2Fee map[string]int64 `protobuf:"bytes,1,rep,name=symbol2Fee,proto3" json:"symbol2Fee,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
Fee int64 `protobuf:"varint,1,opt,name=fee,proto3" json:"fee,omitempty"`
AmountPerDay int64 `protobuf:"varint,2,opt,name=amountPerDay,proto3" json:"amountPerDay,omitempty"`
}
func (x *WithdrawSymbol2Fee) Reset() {
*x = WithdrawSymbol2Fee{}
func (x *WithdrawPara) Reset() {
*x = WithdrawPara{}
if protoimpl.UnsafeEnabled {
mi := &file_relayer_proto_msgTypes[37]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -2503,13 +2512,13 @@ func (x *WithdrawSymbol2Fee) Reset() {
}
}
func (x *WithdrawSymbol2Fee) String() string {
func (x *WithdrawPara) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WithdrawSymbol2Fee) ProtoMessage() {}
func (*WithdrawPara) ProtoMessage() {}
func (x *WithdrawSymbol2Fee) ProtoReflect() protoreflect.Message {
func (x *WithdrawPara) ProtoReflect() protoreflect.Message {
mi := &file_relayer_proto_msgTypes[37]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
......@@ -2521,18 +2530,199 @@ func (x *WithdrawSymbol2Fee) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use WithdrawSymbol2Fee.ProtoReflect.Descriptor instead.
func (*WithdrawSymbol2Fee) Descriptor() ([]byte, []int) {
// Deprecated: Use WithdrawPara.ProtoReflect.Descriptor instead.
func (*WithdrawPara) Descriptor() ([]byte, []int) {
return file_relayer_proto_rawDescGZIP(), []int{37}
}
func (x *WithdrawSymbol2Fee) GetSymbol2Fee() map[string]int64 {
func (x *WithdrawPara) GetFee() int64 {
if x != nil {
return x.Fee
}
return 0
}
func (x *WithdrawPara) GetAmountPerDay() int64 {
if x != nil {
return x.AmountPerDay
}
return 0
}
type WithdrawSymbol2Para struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Symbol2Para map[string]*WithdrawPara `protobuf:"bytes,1,rep,name=symbol2Para,proto3" json:"symbol2Para,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *WithdrawSymbol2Para) Reset() {
*x = WithdrawSymbol2Para{}
if protoimpl.UnsafeEnabled {
mi := &file_relayer_proto_msgTypes[38]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WithdrawSymbol2Para) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WithdrawSymbol2Para) ProtoMessage() {}
func (x *WithdrawSymbol2Para) ProtoReflect() protoreflect.Message {
mi := &file_relayer_proto_msgTypes[38]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WithdrawSymbol2Para.ProtoReflect.Descriptor instead.
func (*WithdrawSymbol2Para) Descriptor() ([]byte, []int) {
return file_relayer_proto_rawDescGZIP(), []int{38}
}
func (x *WithdrawSymbol2Para) GetSymbol2Para() map[string]*WithdrawPara {
if x != nil {
return x.Symbol2Fee
return x.Symbol2Para
}
return nil
}
type WithdrawTx struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Chain33Sender string `protobuf:"bytes,1,opt,name=chain33Sender,proto3" json:"chain33Sender,omitempty"`
EthereumReceiver string `protobuf:"bytes,2,opt,name=ethereumReceiver,proto3" json:"ethereumReceiver,omitempty"`
Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"`
Amount int64 `protobuf:"varint,5,opt,name=amount,proto3" json:"amount,omitempty"`
Nonce int64 `protobuf:"varint,6,opt,name=nonce,proto3" json:"nonce,omitempty"`
TxHashOnChain33 string `protobuf:"bytes,7,opt,name=txHashOnChain33,proto3" json:"txHashOnChain33,omitempty"`
TxHashOnEthereum string `protobuf:"bytes,8,opt,name=txHashOnEthereum,proto3" json:"txHashOnEthereum,omitempty"`
Year int32 `protobuf:"varint,9,opt,name=year,proto3" json:"year,omitempty"`
Month int32 `protobuf:"varint,10,opt,name=month,proto3" json:"month,omitempty"`
Day int32 `protobuf:"varint,11,opt,name=day,proto3" json:"day,omitempty"`
Status string `protobuf:"bytes,12,opt,name=status,proto3" json:"status,omitempty"`
}
func (x *WithdrawTx) Reset() {
*x = WithdrawTx{}
if protoimpl.UnsafeEnabled {
mi := &file_relayer_proto_msgTypes[39]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WithdrawTx) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WithdrawTx) ProtoMessage() {}
func (x *WithdrawTx) ProtoReflect() protoreflect.Message {
mi := &file_relayer_proto_msgTypes[39]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WithdrawTx.ProtoReflect.Descriptor instead.
func (*WithdrawTx) Descriptor() ([]byte, []int) {
return file_relayer_proto_rawDescGZIP(), []int{39}
}
func (x *WithdrawTx) GetChain33Sender() string {
if x != nil {
return x.Chain33Sender
}
return ""
}
func (x *WithdrawTx) GetEthereumReceiver() string {
if x != nil {
return x.EthereumReceiver
}
return ""
}
func (x *WithdrawTx) GetSymbol() string {
if x != nil {
return x.Symbol
}
return ""
}
func (x *WithdrawTx) GetAmount() int64 {
if x != nil {
return x.Amount
}
return 0
}
func (x *WithdrawTx) GetNonce() int64 {
if x != nil {
return x.Nonce
}
return 0
}
func (x *WithdrawTx) GetTxHashOnChain33() string {
if x != nil {
return x.TxHashOnChain33
}
return ""
}
func (x *WithdrawTx) GetTxHashOnEthereum() string {
if x != nil {
return x.TxHashOnEthereum
}
return ""
}
func (x *WithdrawTx) GetYear() int32 {
if x != nil {
return x.Year
}
return 0
}
func (x *WithdrawTx) GetMonth() int32 {
if x != nil {
return x.Month
}
return 0
}
func (x *WithdrawTx) GetDay() int32 {
if x != nil {
return x.Day
}
return 0
}
func (x *WithdrawTx) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
var File_relayer_proto protoreflect.FileDescriptor
var file_relayer_proto_rawDesc = []byte{
......@@ -2810,22 +3000,52 @@ var file_relayer_proto_rawDesc = []byte{
0x72, 0x22, 0x2f, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x65, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e,
0x33, 0x33, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65,
0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67,
0x68, 0x74, 0x22, 0x46, 0x0a, 0x0e, 0x43, 0x66, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61,
0x68, 0x74, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x66, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61,
0x77, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x1c, 0x0a, 0x09,
0x66, 0x65, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x09, 0x66, 0x65, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x12, 0x57,
0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x46, 0x65,
0x65, 0x12, 0x49, 0x0a, 0x0a, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x46, 0x65, 0x65, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x69,
0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x46, 0x65, 0x65,
0x2e, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x46, 0x65, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x0a, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x46, 0x65, 0x65, 0x1a, 0x3d, 0x0a, 0x0f,
0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x46, 0x65, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x09, 0x66, 0x65, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x6d,
0x6f, 0x75, 0x6e, 0x74, 0x50, 0x65, 0x72, 0x44, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0c, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x65, 0x72, 0x44, 0x61, 0x79, 0x22, 0x44,
0x0a, 0x0c, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x50, 0x61, 0x72, 0x61, 0x12, 0x10,
0x0a, 0x03, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x66, 0x65, 0x65,
0x12, 0x22, 0x0a, 0x0c, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x65, 0x72, 0x44, 0x61, 0x79,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x65,
0x72, 0x44, 0x61, 0x79, 0x22, 0xb9, 0x01, 0x0a, 0x13, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61,
0x77, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x50, 0x61, 0x72, 0x61, 0x12, 0x4d, 0x0a, 0x0b,
0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x50, 0x61, 0x72, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72,
0x61, 0x77, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x50, 0x61, 0x72, 0x61, 0x2e, 0x53, 0x79,
0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x50, 0x61, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b,
0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x50, 0x61, 0x72, 0x61, 0x1a, 0x53, 0x0a, 0x10, 0x53,
0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x32, 0x50, 0x61, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e,
0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x79, 0x12, 0x29, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61,
0x77, 0x50, 0x61, 0x72, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x22, 0xce, 0x02, 0x0a, 0x0a, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x78, 0x12,
0x24, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x53,
0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x10, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
0x6d, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x10, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03,
0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x74, 0x78, 0x48, 0x61, 0x73,
0x68, 0x4f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0f, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x4f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x33,
0x33, 0x12, 0x2a, 0x0a, 0x10, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x4f, 0x6e, 0x45, 0x74, 0x68,
0x65, 0x72, 0x65, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x78, 0x48,
0x61, 0x73, 0x68, 0x4f, 0x6e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x12, 0x12, 0x0a,
0x04, 0x79, 0x65, 0x61, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x79, 0x65, 0x61,
0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x0b,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
......@@ -2840,7 +3060,7 @@ func file_relayer_proto_rawDescGZIP() []byte {
return file_relayer_proto_rawDescData
}
var file_relayer_proto_msgTypes = make([]protoimpl.MessageInfo, 39)
var file_relayer_proto_msgTypes = make([]protoimpl.MessageInfo, 41)
var file_relayer_proto_goTypes = []interface{}{
(*Account4Relayer)(nil), // 0: types.Account4Relayer
(*ValidatorAddr4EthRelayer)(nil), // 1: types.ValidatorAddr4EthRelayer
......@@ -2879,19 +3099,22 @@ var file_relayer_proto_goTypes = []interface{}{
(*BalanceLockedReq)(nil), // 34: types.BalanceLockedReq
(*ResendChain33EventReq)(nil), // 35: types.ResendChain33EventReq
(*CfgWithdrawReq)(nil), // 36: types.CfgWithdrawReq
(*WithdrawSymbol2Fee)(nil), // 37: types.WithdrawSymbol2Fee
nil, // 38: types.WithdrawSymbol2Fee.Symbol2FeeEntry
(*WithdrawPara)(nil), // 37: types.withdrawPara
(*WithdrawSymbol2Para)(nil), // 38: types.WithdrawSymbol2Para
(*WithdrawTx)(nil), // 39: types.WithdrawTx
nil, // 40: types.WithdrawSymbol2Para.Symbol2ParaEntry
}
var file_relayer_proto_depIdxs = []int32{
25, // 0: types.TokenAddressArray.tokenAddress:type_name -> types.TokenAddress
24, // 1: types.TokenStaticsResponse.e2Cstatics:type_name -> types.Ethereum2Chain33Statics
23, // 2: types.TokenStaticsResponse.c2Estatics:type_name -> types.Chain33ToEthereumStatics
38, // 3: types.WithdrawSymbol2Fee.symbol2Fee:type_name -> types.WithdrawSymbol2Fee.Symbol2FeeEntry
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
40, // 3: types.WithdrawSymbol2Para.symbol2Para:type_name -> types.WithdrawSymbol2Para.Symbol2ParaEntry
37, // 4: types.WithdrawSymbol2Para.Symbol2ParaEntry.value:type_name -> types.withdrawPara
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_relayer_proto_init() }
......@@ -3345,7 +3568,31 @@ func file_relayer_proto_init() {
}
}
file_relayer_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WithdrawSymbol2Fee); i {
switch v := v.(*WithdrawPara); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_relayer_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WithdrawSymbol2Para); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_relayer_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WithdrawTx); i {
case 0:
return &v.state
case 1:
......@@ -3363,7 +3610,7 @@ func file_relayer_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_relayer_proto_rawDesc,
NumEnums: 0,
NumMessages: 39,
NumMessages: 41,
NumExtensions: 0,
NumServices: 0,
},
......
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