Commit 3b585d22 authored by hezhengjun's avatar hezhengjun

make sure proxyReceiver is needed to be set when do the withdraw

parent a1c96130
...@@ -111,10 +111,9 @@ contract BridgeBank is EthereumBank, Chain33Bank { ...@@ -111,10 +111,9 @@ contract BridgeBank is EthereumBank, Chain33Bank {
* @param _proxyReceiver: The address to receive asset * @param _proxyReceiver: The address to receive asset
* @return: indicate whether set successfully or not * @return: indicate whether set successfully or not
*/ */
function setWithdrawProxy(address payable _proxyReceiver) public onlyOperator returns(bool) function setWithdrawProxy(address payable _proxyReceiver) public onlyOperator
{ {
proxyReceiver = _proxyReceiver; proxyReceiver = _proxyReceiver;
return true;
} }
/* /*
......
...@@ -360,19 +360,20 @@ contract EthereumBank { ...@@ -360,19 +360,20 @@ contract EthereumBank {
) )
internal internal
{ {
require(proxyReceiver != address(0), "proxy receiver hasn't been set");
// Must be whitelisted bridge token // Must be whitelisted bridge token
require(bridgeTokenWhitelist[_bridgeTokenAddress], "Token must be a whitelisted bridge token"); require(bridgeTokenWhitelist[_bridgeTokenAddress], "Token must be a whitelisted bridge token");
// burn bridge tokens // burn bridge tokens
BridgeToken bridgeTokenInstance = BridgeToken(_bridgeTokenAddress); BridgeToken bridgeTokenInstance = BridgeToken(_bridgeTokenAddress);
bridgeTokenInstance.transferFrom(_from, proxyReceiver, _amount); bridgeTokenInstance.transferFrom(_from, proxyReceiver, _amount);
DepositBurnWithdrawCount memory withCount = depositBurnWithdrawCounts[_bridgeTokenAddress]; DepositBurnWithdrawCount memory wdCount = depositBurnWithdrawCounts[_bridgeTokenAddress];
require( require(
withCount.withdrawCount + 1 > withCount.withdrawCount, wdCount.withdrawCount + 1 > wdCount.withdrawCount,
"burn nonce is not available" "withdraw nonce is not available"
); );
withCount.withdrawCount = withCount.withdrawCount.add(1); wdCount.withdrawCount = wdCount.withdrawCount.add(1);
depositBurnWithdrawCounts[_bridgeTokenAddress] = withCount; depositBurnWithdrawCounts[_bridgeTokenAddress] = wdCount;
emit LogEthereumTokenWithdraw( emit LogEthereumTokenWithdraw(
_bridgeTokenAddress, _bridgeTokenAddress,
...@@ -381,7 +382,7 @@ contract EthereumBank { ...@@ -381,7 +382,7 @@ contract EthereumBank {
_from, _from,
_ethereumReceiver, _ethereumReceiver,
proxyReceiver, proxyReceiver,
withCount.withdrawCount wdCount.withdrawCount
); );
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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