Commit 5cc71170 authored by hezhengjun's avatar hezhengjun

only bridge token could be locked and tranfer to contract:evmxgo

parent adff0614
...@@ -82,6 +82,17 @@ contract BridgeBank is GoAssetBank, EvmAssetBank { ...@@ -82,6 +82,17 @@ contract BridgeBank is GoAssetBank, EvmAssetBank {
); );
_; _;
} }
/*
* @dev: Modifier to make sure this symbol not created now
*/
modifier onlyBridgeToken(address _token)
{
require(
(address(0) == _token) && (msg.value == 0),
"Only bridge token could be locked and tranfer to contract:evmxgo"
);
_;
}
/* /*
* @dev: Fallback function allows operator to send funds to the bank directly * @dev: Fallback function allows operator to send funds to the bank directly
...@@ -219,25 +230,10 @@ contract BridgeBank is GoAssetBank, EvmAssetBank { ...@@ -219,25 +230,10 @@ contract BridgeBank is GoAssetBank, EvmAssetBank {
) )
public public
availableNonce() availableNonce()
onlyBridgeToken(_token)
payable payable
{ {
string memory symbol; string memory symbol;
// Chain33 deposit
if (msg.value > 0) {
require(
_token == address(0),
"BTY deposits require the 'token' address to be the null address"
);
require(
msg.value == _amount,
"The transactions value must be equal the specified amount(BTY decimal is 8)"
);
// Set the the symbol to BTY
symbol = "BTY";
// ERC20 deposit
} else {
require( require(
BridgeToken(_token).transferFrom(msg.sender, address(this), _amount), BridgeToken(_token).transferFrom(msg.sender, address(this), _amount),
"Contract token allowances insufficient to complete this lock request" "Contract token allowances insufficient to complete this lock request"
...@@ -248,7 +244,6 @@ contract BridgeBank is GoAssetBank, EvmAssetBank { ...@@ -248,7 +244,6 @@ contract BridgeBank is GoAssetBank, EvmAssetBank {
tokenAllow2Lock[keccak256(abi.encodePacked(symbol))] == _token, tokenAllow2Lock[keccak256(abi.encodePacked(symbol))] == _token,
'The token is not allowed to be locked from Chain33.' 'The token is not allowed to be locked from Chain33.'
); );
}
lockFunds( lockFunds(
msg.sender, msg.sender,
......
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