Commit 920b82f5 authored by hezhengjun's avatar hezhengjun

support burn back to different simlar ethereum blockchain platform token

parent 61ca50d4
...@@ -407,7 +407,7 @@ func (chain33Relayer *Relayer4Chain33) relayLockBurnToChain33(claim *ebTypes.Eth ...@@ -407,7 +407,7 @@ func (chain33Relayer *Relayer4Chain33) relayLockBurnToChain33(claim *ebTypes.Eth
} }
//因为发行的合约的精度为8,所以需要缩小,在进行burn的时候,再进行倍乘,在函数ParseBurnLock4chain33进行 //因为发行的合约的精度为8,所以需要缩小,在进行burn的时候,再进行倍乘,在函数ParseBurnLock4chain33进行
if ebTypes.SYMBOL_ETH == claim.Symbol { if 18 == claim.Decimal {
bigAmount.Div(bigAmount, big.NewInt(int64(1e10))) bigAmount.Div(bigAmount, big.NewInt(int64(1e10)))
claim.Amount = bigAmount.String() claim.Amount = bigAmount.String()
} }
......
...@@ -514,6 +514,9 @@ func (ethRelayer *Relayer4Ethereum) handleChain33Msg(chain33Msg *events.Chain33M ...@@ -514,6 +514,9 @@ func (ethRelayer *Relayer4Ethereum) handleChain33Msg(chain33Msg *events.Chain33M
} }
tokenAddr = common.HexToAddress(addr) tokenAddr = common.HexToAddress(addr)
} }
if ebTypes.EthNilAddr == tokenAddr.String() {
prophecyClaim.Amount = prophecyClaim.Amount.Mul(prophecyClaim.Amount, big.NewInt(int64(1e10)))
}
} }
// Relay the Chain33Msg to the Ethereum network // Relay the Chain33Msg to the Ethereum network
......
...@@ -10,12 +10,9 @@ package ethtxs ...@@ -10,12 +10,9 @@ package ethtxs
// -------------------------------------------------------- // --------------------------------------------------------
import ( import (
"strings"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/relayer/events" "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/relayer/events"
ebrelayerTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types" ebrelayerTypes "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/types"
"github.com/ethereum/go-ethereum/common"
) )
// LogLockToEthBridgeClaim : parses and packages a LockEvent struct with a validator address in an EthBridgeClaim msg // LogLockToEthBridgeClaim : parses and packages a LockEvent struct with a validator address in an EthBridgeClaim msg
...@@ -24,11 +21,6 @@ func LogLockToEthBridgeClaim(event *events.LockEvent, ethereumChainID int64, bri ...@@ -24,11 +21,6 @@ func LogLockToEthBridgeClaim(event *events.LockEvent, ethereumChainID int64, bri
if 0 == len(recipient) { if 0 == len(recipient) {
return nil, ebrelayerTypes.ErrEmptyAddress return nil, ebrelayerTypes.ErrEmptyAddress
} }
// Symbol formatted to lowercase
symbol := strings.ToLower(event.Symbol)
if symbol == "eth" && event.Token != common.HexToAddress("0x0000000000000000000000000000000000000000") {
return nil, ebrelayerTypes.ErrAddress4Eth
}
chain33Receiver := new(address.Address) chain33Receiver := new(address.Address)
chain33Receiver.SetBytes(recipient) chain33Receiver.SetBytes(recipient)
......
...@@ -132,9 +132,6 @@ func ParseBurnLock4chain33(evmEventType Chain33EvmEvent, data []byte, bridgeBank ...@@ -132,9 +132,6 @@ func ParseBurnLock4chain33(evmEventType Chain33EvmEvent, data []byte, bridgeBank
TxHash: chain33TxHash, TxHash: chain33TxHash,
Nonce: burnEvent.Nonce.Int64(), Nonce: burnEvent.Nonce.Int64(),
} }
if ebrelayerTypes.SYMBOL_ETH == burnEvent.Symbol {
chain33Msg.Amount = chain33Msg.Amount.Mul(chain33Msg.Amount, big.NewInt(int64(1e10)))
}
return chain33Msg, nil return chain33Msg, nil
} }
......
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