Commit d940ed32 authored by QM's avatar QM

add ethereum withdraw show

parent a17f0485
...@@ -25,7 +25,7 @@ func ShowStaticsFlags(cmd *cobra.Command) { ...@@ -25,7 +25,7 @@ func ShowStaticsFlags(cmd *cobra.Command) {
cmd.Flags().StringP("symbol", "s", "", "token symbol(optional)") cmd.Flags().StringP("symbol", "s", "", "token symbol(optional)")
cmd.Flags().Int32P("from", "f", 0, "source chain, 0=ethereum, and 1=chain33") cmd.Flags().Int32P("from", "f", 0, "source chain, 0=ethereum, and 1=chain33")
_ = cmd.MarkFlagRequired("from") _ = cmd.MarkFlagRequired("from")
cmd.Flags().Int32P("operation", "o", 0, "operation type, 1=burn, and 2=lock") cmd.Flags().Int32P("operation", "o", 0, "operation type, 1=burn, 2=lock, 3=withdraw")
_ = cmd.MarkFlagRequired("operation") _ = cmd.MarkFlagRequired("operation")
cmd.Flags().Int32P("status", "u", 0, "show with specified status, default to show all, 1=pending, 2=successful, 3=failed") cmd.Flags().Int32P("status", "u", 0, "show with specified status, default to show all, 1=pending, 2=successful, 3=failed")
cmd.Flags().Int32P("count", "n", 0, "count to show, default to show all") cmd.Flags().Int32P("count", "n", 0, "count to show, default to show all")
......
...@@ -168,6 +168,7 @@ func StartEthereumRelayer(startPara *EthereumStartPara) *Relayer4Ethereum { ...@@ -168,6 +168,7 @@ func StartEthereumRelayer(startPara *EthereumStartPara) *Relayer4Ethereum {
data := chain33Types.Encode(statics) data := chain33Types.Encode(statics)
_ = ethRelayer.setLastestStatics(int32(events.ClaimTypeLock), 0, data) _ = ethRelayer.setLastestStatics(int32(events.ClaimTypeLock), 0, data)
_ = ethRelayer.setLastestStatics(int32(events.ClaimTypeBurn), 0, data) _ = ethRelayer.setLastestStatics(int32(events.ClaimTypeBurn), 0, data)
_ = ethRelayer.setLastestStatics(int32(events.ClaimTypeWithdraw), 0, data)
} }
go ethRelayer.proc() go ethRelayer.proc()
...@@ -685,6 +686,37 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33 ...@@ -685,6 +686,37 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
withdrawTx.Status = int32(ethtxs.WDPending) withdrawTx.Status = int32(ethtxs.WDPending)
withdrawTx.StatusDescription = ethtxs.WDPending.String() withdrawTx.StatusDescription = ethtxs.WDPending.String()
withdrawTx.TxHashOnEthereum = signedTx.Hash().String() withdrawTx.TxHashOnEthereum = signedTx.Hash().String()
txIndex := atomic.AddInt64(&ethRelayer.totalTxRelayFromChain33, 1)
operationType := chain33Msg.ClaimType.String()
statics := &ebTypes.Chain33ToEthereumStatics{
EthTxstatus: ebTypes.Tx_Status_Pending,
Chain33Txhash: common.Bytes2Hex(chain33Msg.TxHash),
EthereumTxhash: withdrawTx.TxHashOnEthereum,
BurnLock: int32(chain33Msg.ClaimType),
Chain33Sender: chain33Msg.Chain33Sender.String(),
EthereumReceiver: chain33Msg.EthereumReceiver.String(),
Symbol: chain33Msg.Symbol,
Amount: chain33Msg.Amount.String(),
Nonce: chain33Msg.Nonce,
TxIndex: txIndex,
OperationType: operationType,
}
data := chain33Types.Encode(statics)
if err = ethRelayer.setLastestStatics(int32(chain33Msg.ClaimType), txIndex, data); nil != err {
relayerLog.Error("handleLogLockBurn", "Failed to RelayLockToChain33 due to:", err.Error())
return
}
relayerLog.Info("RelayOracleClaimToEthereum::successful",
"txIndex", txIndex,
"Chain33Txhash", statics.Chain33Txhash,
"EthereumTxhash", statics.EthereumTxhash,
"type", operationType,
"Symbol", chain33Msg.Symbol,
"Amount", chain33Msg.Amount,
"EthereumReceiver", statics.EthereumReceiver,
"Chain33Sender", statics.Chain33Sender)
return return
} }
...@@ -1289,6 +1321,7 @@ func (ethRelayer *Relayer4Ethereum) ShowStatics(request *ebTypes.TokenStaticsReq ...@@ -1289,6 +1321,7 @@ func (ethRelayer *Relayer4Ethereum) ShowStatics(request *ebTypes.TokenStaticsReq
func (ethRelayer *Relayer4Ethereum) updateTxStatus() { func (ethRelayer *Relayer4Ethereum) updateTxStatus() {
ethRelayer.updateSingleTxStatus(events.ClaimTypeBurn) ethRelayer.updateSingleTxStatus(events.ClaimTypeBurn)
ethRelayer.updateSingleTxStatus(events.ClaimTypeLock) ethRelayer.updateSingleTxStatus(events.ClaimTypeLock)
ethRelayer.updateSingleTxStatus(events.ClaimTypeWithdraw)
} }
func (ethRelayer *Relayer4Ethereum) updateSingleTxStatus(claimType events.ClaimType) { func (ethRelayer *Relayer4Ethereum) updateSingleTxStatus(claimType events.ClaimType) {
......
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