Commit 3eec054c authored by hezhengjun's avatar hezhengjun

support to config platform token symbol

parent 3afbe34a
...@@ -21,6 +21,8 @@ contract BridgeBank is Chain33Bank, EthereumBank { ...@@ -21,6 +21,8 @@ contract BridgeBank is Chain33Bank, EthereumBank {
address public operator; address public operator;
Oracle public oracle; Oracle public oracle;
Chain33Bridge public chain33Bridge; Chain33Bridge public chain33Bridge;
string public platformTokenSymbol;
bool public hasSetPlatformTokenSymbol;
/* /*
* @dev: Constructor, sets operator * @dev: Constructor, sets operator
...@@ -193,12 +195,25 @@ contract BridgeBank is Chain33Bank, EthereumBank { ...@@ -193,12 +195,25 @@ contract BridgeBank is Chain33Bank, EthereumBank {
if (address(0) != _token) { if (address(0) != _token) {
require(keccak256(bytes(BridgeToken(_token).symbol())) == keccak256(bytes(_symbol)), "token address and symbol is not consistent"); require(keccak256(bytes(BridgeToken(_token).symbol())) == keccak256(bytes(_symbol)), "token address and symbol is not consistent");
} else { } else {
require(keccak256(bytes("ETH")) == keccak256(bytes(_symbol)), "token address and symbol is not consistent"); require(true == hasSetPlatformTokenSymbol, "The platform Token Symbol has not been configured");
require(keccak256(bytes(platformTokenSymbol)) == keccak256(bytes(_symbol)), "token address and symbol is not consistent");
} }
configOfflineSave4Lock(_token, _symbol, _threshold, _percents); configOfflineSave4Lock(_token, _symbol, _threshold, _percents);
} }
/* /*
* @dev: configplatformTokenSymbol used to config platform token symbol,and just could be configured once
*
* @param _symbol:token symbol,just used for double check that token address and symbol is consistent
*/
function configplatformTokenSymbol(string memory _symbol) public onlyOperator
{
require(false == hasSetPlatformTokenSymbol, "The platform Token Symbol has been configured");
platformTokenSymbol = _symbol;
hasSetPlatformTokenSymbol = true;
}
/*
* @dev: configOfflineSaveAccount used to config offline account to receive token * @dev: configOfflineSaveAccount used to config offline account to receive token
* when the balance of locked token reaches threshold * when the balance of locked token reaches threshold
* *
...@@ -237,9 +252,9 @@ contract BridgeBank is Chain33Bank, EthereumBank { ...@@ -237,9 +252,9 @@ contract BridgeBank is Chain33Bank, EthereumBank {
msg.value == _amount, msg.value == _amount,
"The transactions value must be equal the specified amount (in wei)" "The transactions value must be equal the specified amount (in wei)"
); );
require(true == hasSetPlatformTokenSymbol, "The platform Token Symbol has not been configured");
// Set the the symbol to ETH // Set the the symbol to ETH
symbol = "ETH"; symbol = platformTokenSymbol;
// ERC20 deposit // ERC20 deposit
} else { } else {
require( require(
......
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