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 {
* @param _proxyReceiver: The address to receive asset
* @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;
return true;
}
/*
......
......@@ -360,19 +360,20 @@ contract EthereumBank {
)
internal
{
require(proxyReceiver != address(0), "proxy receiver hasn't been set");
// Must be whitelisted bridge token
require(bridgeTokenWhitelist[_bridgeTokenAddress], "Token must be a whitelisted bridge token");
// burn bridge tokens
BridgeToken bridgeTokenInstance = BridgeToken(_bridgeTokenAddress);
bridgeTokenInstance.transferFrom(_from, proxyReceiver, _amount);
DepositBurnWithdrawCount memory withCount = depositBurnWithdrawCounts[_bridgeTokenAddress];
DepositBurnWithdrawCount memory wdCount = depositBurnWithdrawCounts[_bridgeTokenAddress];
require(
withCount.withdrawCount + 1 > withCount.withdrawCount,
"burn nonce is not available"
wdCount.withdrawCount + 1 > wdCount.withdrawCount,
"withdraw nonce is not available"
);
withCount.withdrawCount = withCount.withdrawCount.add(1);
depositBurnWithdrawCounts[_bridgeTokenAddress] = withCount;
wdCount.withdrawCount = wdCount.withdrawCount.add(1);
depositBurnWithdrawCounts[_bridgeTokenAddress] = wdCount;
emit LogEthereumTokenWithdraw(
_bridgeTokenAddress,
......@@ -381,7 +382,7 @@ contract EthereumBank {
_from,
_ethereumReceiver,
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