Contract Address Details

0x9dc7C8579431fb670f4bfBE7cd1391AE8d98c308

Contract Name
HomeMultiAMBErc20ToErc677
Creator
0xb7a42b–a2a5c7 at 0xd2ee27–82eb47
Balance
0 ELA
Tokens
Fetching tokens...
Transactions
Transfers
Gas Used
Last Balance Update
27817554
Contract name:
HomeMultiAMBErc20ToErc677




Optimization enabled
true
Compiler version
v0.4.24+commit.e67f0147




Optimization runs
200
EVM Version
default




Verified at
2023-12-26 10:50:01.502552Z

Contract source code

// File: contracts/interfaces/IAMB.sol
pragma solidity 0.4.24;
interface IAMB {
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view returns (bytes32);
function messageId() external view returns (bytes32);
function messageSourceChainId() external view returns (bytes32);
function messageCallStatus(bytes32 _messageId) external view returns (bool);
function failedMessageDataHash(bytes32 _messageId) external view returns (bytes32);
function failedMessageReceiver(bytes32 _messageId) external view returns (address);
function failedMessageSender(bytes32 _messageId) external view returns (address);
function requireToPassMessage(address _contract, bytes _data, uint256 _gas) external returns (bytes32);
function sourceChainId() external view returns (uint256);
function destinationChainId() external view returns (uint256);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: contracts/interfaces/ERC677.sol
pragma solidity 0.4.24;
contract ERC677 is ERC20 {
event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
function transferAndCall(address, uint256, bytes) external returns (bool);
function increaseAllowance(address spender, uint256 addedValue) public returns (bool);
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool);
}
contract LegacyERC20 {
function transfer(address _spender, uint256 _value) public; // returns (bool);
function transferFrom(address _owner, address _spender, uint256 _value) public; // returns (bool);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: contracts/upgradeability/EternalStorage.sol
pragma solidity 0.4.24;
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract.
*/
contract EternalStorage {
mapping(bytes32 => uint256) internal uintStorage;
mapping(bytes32 => string) internal stringStorage;
mapping(bytes32 => address) internal addressStorage;
mapping(bytes32 => bytes) internal bytesStorage;
mapping(bytes32 => bool) internal boolStorage;
mapping(bytes32 => int256) internal intStorage;
}
// File: contracts/interfaces/IUpgradeabilityOwnerStorage.sol
pragma solidity 0.4.24;
interface IUpgradeabilityOwnerStorage {
function upgradeabilityOwner() external view returns (address);
}
// File: contracts/upgradeable_contracts/Ownable.sol
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev This contract has an owner address providing basic authorization control
*/
contract Ownable is EternalStorage {
bytes4 internal constant UPGRADEABILITY_OWNER = 0x6fde8202; // upgradeabilityOwner()
/**
* @dev Event to show ownership has been transferred
* @param previousOwner representing the address of the previous owner
* @param newOwner representing the address of the new owner
*/
event OwnershipTransferred(address previousOwner, address newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner());
/* solcov ignore next */
_;
}
/**
* @dev Throws if called by any account other than contract itself or owner.
*/
modifier onlyRelevantSender() {
// proxy owner if used through proxy, address(0) otherwise
require(
!address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy
msg.sender == IUpgradeabilityOwnerStorage(this).upgradeabilityOwner() || // covers usage through regular proxy calls
msg.sender == address(this) // covers calls through upgradeAndCall proxy method
);
/* solcov ignore next */
_;
}
bytes32 internal constant OWNER = 0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0; // keccak256(abi.encodePacked("owner"))
/**
* @dev Tells the address of the owner
* @return the address of the owner
*/
function owner() public view returns (address) {
return addressStorage[OWNER];
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner the address to transfer ownership to.
*/
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0));
setOwner(newOwner);
}
/**
* @dev Sets a new owner address
*/
function setOwner(address newOwner) internal {
emit OwnershipTransferred(owner(), newOwner);
addressStorage[OWNER] = newOwner;
}
}
// File: contracts/upgradeable_contracts/multi_amb_erc20_to_erc677/BasicMultiTokenBridge.sol
pragma solidity 0.4.24;
contract BasicMultiTokenBridge is EternalStorage, Ownable {
using SafeMath for uint256;
// token == 0x00..00 represents default limits (assuming decimals == 18) for all newly created tokens
event DailyLimitChanged(address indexed token, uint256 newLimit);
event ExecutionDailyLimitChanged(address indexed token, uint256 newLimit);
/**
* @dev Checks if specified token was already bridged at least once.
* @param _token address of the token contract.
* @return true, if token address is address(0) or token was already bridged.
*/
function isTokenRegistered(address _token) public view returns (bool) {
return minPerTx(_token) > 0;
}
/**
* @dev Retrieves the total spent amount for particular token during specific day.
* @param _token address of the token contract.
* @param _day day number for which spent amount if requested.
* @return amount of tokens sent through the bridge to the other side.
*/
function totalSpentPerDay(address _token, uint256 _day) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _token, _day))];
}
/**
* @dev Retrieves the total executed amount for particular token during specific day.
* @param _token address of the token contract.
* @param _day day number for which spent amount if requested.
* @return amount of tokens received from the bridge from the other side.
*/
function totalExecutedPerDay(address _token, uint256 _day) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("totalExecutedPerDay", _token, _day))];
}
/**
* @dev Retrieves current daily limit for a particular token contract.
* @param _token address of the token contract.
* @return daily limit on tokens that can be sent through the bridge per day.
*/
function dailyLimit(address _token) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))];
}
/**
* @dev Retrieves current execution daily limit for a particular token contract.
* @param _token address of the token contract.
* @return daily limit on tokens that can be received from the bridge on the other side per day.
*/
function executionDailyLimit(address _token) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))];
}
/**
* @dev Retrieves current maximum amount of tokens per one transfer for a particular token contract.
* @param _token address of the token contract.
* @return maximum amount on tokens that can be sent through the bridge in one transfer.
*/
function maxPerTx(address _token) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))];
}
/**
* @dev Retrieves current maximum execution amount of tokens per one transfer for a particular token contract.
* @param _token address of the token contract.
* @return maximum amount on tokens that can received from the bridge on the other side in one transaction.
*/
function executionMaxPerTx(address _token) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))];
}
/**
* @dev Retrieves current minimum amount of tokens per one transfer for a particular token contract.
* @param _token address of the token contract.
* @return minimum amount on tokens that can be sent through the bridge in one transfer.
*/
function minPerTx(address _token) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("minPerTx", _token))];
}
/**
* @dev Checks that bridged amount of tokens conforms to the configured limits.
* @param _token address of the token contract.
* @param _amount amount of bridge tokens.
* @return true, if specified amount can be bridged.
*/
function withinLimit(address _token, uint256 _amount) public view returns (bool) {
uint256 nextLimit = totalSpentPerDay(_token, getCurrentDay()).add(_amount);
return
dailyLimit(address(0)) > 0 &&
dailyLimit(_token) >= nextLimit &&
_amount <= maxPerTx(_token) &&
_amount >= minPerTx(_token);
}
/**
* @dev Checks that bridged amount of tokens conforms to the configured execution limits.
* @param _token address of the token contract.
* @param _amount amount of bridge tokens.
* @return true, if specified amount can be processed and executed.
*/
function withinExecutionLimit(address _token, uint256 _amount) public view returns (bool) {
uint256 nextLimit = totalExecutedPerDay(_token, getCurrentDay()).add(_amount);
return
executionDailyLimit(address(0)) > 0 &&
executionDailyLimit(_token) >= nextLimit &&
_amount <= executionMaxPerTx(_token);
}
/**
* @dev Returns current day number.
* @return day number.
*/
function getCurrentDay() public view returns (uint256) {
// solhint-disable-next-line not-rely-on-time
return now / 1 days;
}
/**
* @dev Updates daily limit for the particular token. Only owner can call this method.
* @param _token address of the token contract, or address(0) for configuring the efault limit.
* @param _dailyLimit daily allowed amount of bridged tokens, should be greater than maxPerTx.
* 0 value is also allowed, will stop the bridge operations in outgoing direction.
*/
function setDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner {
require(isTokenRegistered(_token));
require(_dailyLimit > maxPerTx(_token) || _dailyLimit == 0);
uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))] = _dailyLimit;
emit DailyLimitChanged(_token, _dailyLimit);
}
/**
* @dev Updates execution daily limit for the particular token. Only owner can call this method.
* @param _token address of the token contract, or address(0) for configuring the default limit.
* @param _dailyLimit daily allowed amount of executed tokens, should be greater than executionMaxPerTx.
* 0 value is also allowed, will stop the bridge operations in incoming direction.
*/
function setExecutionDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner {
require(isTokenRegistered(_token));
require(_dailyLimit > executionMaxPerTx(_token) || _dailyLimit == 0);
uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _dailyLimit;
emit ExecutionDailyLimitChanged(_token, _dailyLimit);
}
/**
* @dev Updates execution maximum per transaction for the particular token. Only owner can call this method.
* @param _token address of the token contract, or address(0) for configuring the default limit.
* @param _maxPerTx maximum amount of executed tokens per one transaction, should be less than executionDailyLimit.
* 0 value is also allowed, will stop the bridge operations in incoming direction.
*/
function setExecutionMaxPerTx(address _token, uint256 _maxPerTx) external onlyOwner {
require(isTokenRegistered(_token));
require(_maxPerTx == 0 || (_maxPerTx > 0 && _maxPerTx < executionDailyLimit(_token)));
uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))] = _maxPerTx;
}
/**
* @dev Updates maximum per transaction for the particular token. Only owner can call this method.
* @param _token address of the token contract, or address(0) for configuring the default limit.
* @param _maxPerTx maximum amount of tokens per one transaction, should be less than dailyLimit, greater than minPerTx.
* 0 value is also allowed, will stop the bridge operations in outgoing direction.
*/
function setMaxPerTx(address _token, uint256 _maxPerTx) external onlyOwner {
require(isTokenRegistered(_token));
require(_maxPerTx == 0 || (_maxPerTx > minPerTx(_token) && _maxPerTx < dailyLimit(_token)));
uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))] = _maxPerTx;
}
/**
* @dev Updates minumum per transaction for the particular token. Only owner can call this method.
* @param _token address of the token contract, or address(0) for configuring the default limit.
* @param _minPerTx minumum amount of tokens per one transaction, should be less than maxPerTx and dailyLimit.
*/
function setMinPerTx(address _token, uint256 _minPerTx) external onlyOwner {
require(isTokenRegistered(_token));
require(_minPerTx > 0 && _minPerTx < dailyLimit(_token) && _minPerTx < maxPerTx(_token));
uintStorage[keccak256(abi.encodePacked("minPerTx", _token))] = _minPerTx;
}
/**
* @dev Retrieves maximum available bridge amount per one transaction taking into account maxPerTx() and dailyLimit() parameters.
* @param _token address of the token contract, or address(0) for the default limit.
* @return minimum of maxPerTx parameter and remaining daily quota.
*/
function maxAvailablePerTx(address _token) public view returns (uint256) {
uint256 _maxPerTx = maxPerTx(_token);
uint256 _dailyLimit = dailyLimit(_token);
uint256 _spent = totalSpentPerDay(_token, getCurrentDay());
uint256 _remainingOutOfDaily = _dailyLimit > _spent ? _dailyLimit - _spent : 0;
return _maxPerTx < _remainingOutOfDaily ? _maxPerTx : _remainingOutOfDaily;
}
/**
* @dev Internal function for adding spent amount for some token.
* @param _token address of the token contract.
* @param _day day number, when tokens are processed.
* @param _value amount of bridge tokens.
*/
function addTotalSpentPerDay(address _token, uint256 _day, uint256 _value) internal {
uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _token, _day))] = totalSpentPerDay(_token, _day).add(
_value
);
}
/**
* @dev Internal function for adding execcuted amount for some token.
* @param _token address of the token contract.
* @param _day day number, when tokens are processed.
* @param _value amount of bridge tokens.
*/
function addTotalExecutedPerDay(address _token, uint256 _day, uint256 _value) internal {
uintStorage[keccak256(abi.encodePacked("totalExecutedPerDay", _token, _day))] = totalExecutedPerDay(
_token,
_day
)
.add(_value);
}
/**
* @dev Internal function for initializing limits for some token.
* @param _token address of the token contract.
* @param _limits [ 0 = dailyLimit, 1 = maxPerTx, 2 = minPerTx ].
*/
function _setLimits(address _token, uint256[3] _limits) internal {
require(
_limits[2] > 0 && // minPerTx > 0
_limits[1] > _limits[2] && // maxPerTx > minPerTx
_limits[0] > _limits[1] // dailyLimit > maxPerTx
);
uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))] = _limits[0];
uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))] = _limits[1];
uintStorage[keccak256(abi.encodePacked("minPerTx", _token))] = _limits[2];
emit DailyLimitChanged(_token, _limits[0]);
}
/**
* @dev Internal function for initializing execution limits for some token.
* @param _token address of the token contract.
* @param _limits [ 0 = executionDailyLimit, 1 = executionMaxPerTx ].
*/
function _setExecutionLimits(address _token, uint256[2] _limits) internal {
require(_limits[1] < _limits[0]); // foreignMaxPerTx < foreignDailyLimit
uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _limits[0];
uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))] = _limits[1];
emit ExecutionDailyLimitChanged(_token, _limits[0]);
}
/**
* @dev Internal function for initializing limits for some token relative to its decimals parameter.
* @param _token address of the token contract.
* @param _decimals token decimals parameter.
*/
function _initializeTokenBridgeLimits(address _token, uint256 _decimals) internal {
uint256 factor;
if (_decimals < 18) {
factor = 10**(18 - _decimals);
uint256 _minPerTx = minPerTx(address(0)).div(factor);
uint256 _maxPerTx = maxPerTx(address(0)).div(factor);
uint256 _dailyLimit = dailyLimit(address(0)).div(factor);
uint256 _executionMaxPerTx = executionMaxPerTx(address(0)).div(factor);
uint256 _executionDailyLimit = executionDailyLimit(address(0)).div(factor);
// such situation can happen when calculated limits relative to the token decimals are too low
// e.g. minPerTx(address(0)) == 10 ** 14, _decimals == 3. _minPerTx happens to be 0, which is not allowed.
// in this case, limits are raised to the default values
if (_minPerTx == 0) {
_minPerTx = 1;
if (_maxPerTx <= _minPerTx) {
_maxPerTx = 100;
_executionMaxPerTx = 100;
if (_dailyLimit <= _maxPerTx || _executionDailyLimit <= _executionMaxPerTx) {
_dailyLimit = 10000;
_executionDailyLimit = 10000;
}
}
}
_setLimits(_token, [_dailyLimit, _maxPerTx, _minPerTx]);
_setExecutionLimits(_token, [_executionDailyLimit, _executionMaxPerTx]);
} else {
factor = 10**(_decimals - 18);
_setLimits(
_token,
[dailyLimit(address(0)).mul(factor), maxPerTx(address(0)).mul(factor), minPerTx(address(0)).mul(factor)]
);
_setExecutionLimits(
_token,
[executionDailyLimit(address(0)).mul(factor), executionMaxPerTx(address(0)).mul(factor)]
);
}
}
}
// File: contracts/interfaces/IBlocklist.sol
pragma solidity 0.4.24;
interface IBlocklist {
function isBlocked(address _account) external view returns (bool);
function blockERC20(address _token, address _account, uint256 _value, bytes32 _messageId) external;
function blockNative(address _account, bytes32 _messageId) external payable;
function checkAndBlockERC20(address _from, address _recipient,
address _token, uint256 _value, bytes32 _messageId) public returns (bool blocked);
}
// File: contracts/libraries/Bytes.sol
pragma solidity 0.4.24;
/**
* @title Bytes
* @dev Helper methods to transform bytes to other solidity types.
*/
library Bytes {
/**
* @dev Converts bytes array to bytes32.
* Truncates bytes array if its size is more than 32 bytes.
* NOTE: This function does not perform any checks on the received parameter.
* Make sure that the _bytes argument has a correct length, not less than 32 bytes.
* A case when _bytes has length less than 32 will lead to the undefined behaviour,
* since assembly will read data from memory that is not related to the _bytes argument.
* @param _bytes to be converted to bytes32 type
* @return bytes32 type of the firsts 32 bytes array in parameter.
*/
function bytesToBytes32(bytes _bytes) internal pure returns (bytes32 result) {
assembly {
result := mload(add(_bytes, 32))
}
}
/**
* @dev Truncate bytes array if its size is more than 20 bytes.
* NOTE: Similar to the bytesToBytes32 function, make sure that _bytes is not shorter than 20 bytes.
* @param _bytes to be converted to address type
* @return address included in the firsts 20 bytes of the bytes array in parameter.
*/
function bytesToAddress(bytes _bytes) internal pure returns (address addr) {
assembly {
addr := mload(add(_bytes, 20))
}
}
}
// File: openzeppelin-solidity/contracts/AddressUtils.sol
pragma solidity ^0.4.24;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param _addr address to check
* @return whether the target address is a contract
*/
function isContract(address _addr) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(_addr) }
return size > 0;
}
}
// File: contracts/upgradeable_contracts/BasicAMBMediator.sol
pragma solidity 0.4.24;
/**
* @title BasicAMBMediator
* @dev Basic storage and methods needed by mediators to interact with AMB bridge.
*/
contract BasicAMBMediator is Ownable {
bytes32 internal constant BRIDGE_CONTRACT = 0x811bbb11e8899da471f0e69a3ed55090fc90215227fc5fb1cb0d6e962ea7b74f; // keccak256(abi.encodePacked("bridgeContract"))
bytes32 internal constant MEDIATOR_CONTRACT = 0x98aa806e31e94a687a31c65769cb99670064dd7f5a87526da075c5fb4eab9880; // keccak256(abi.encodePacked("mediatorContract"))
bytes32 internal constant REQUEST_GAS_LIMIT = 0x2dfd6c9f781bb6bbb5369c114e949b69ebb440ef3d4dd6b2836225eb1dc3a2be; // keccak256(abi.encodePacked("requestGasLimit"))
bytes32 internal constant BLOCKLIST_CONTRACT = 0x9ba5a09a13321d5fc0d3150bbf4489a02b9b881bf70e2fc6639c91e8c5ce714c; // keccak256(abi.encodePacked("blocklistContract"))
/**
* @dev Throws if caller on the other side is not an associated mediator.
*/
modifier onlyMediator {
require(msg.sender == address(bridgeContract()));
require(messageSender() == mediatorContractOnOtherSide());
_;
}
/**
* @dev Sets the AMB bridge contract address. Only the owner can call this method.
* @param _bridgeContract the address of the bridge contract.
*/
function setBridgeContract(address _bridgeContract) external onlyOwner {
_setBridgeContract(_bridgeContract);
}
function setBlocklistContract(address _blocklistContract) external onlyOwner {
_setBlocklistContract(_blocklistContract);
}
/**
* @dev Sets the mediator contract address from the other network. Only the owner can call this method.
* @param _mediatorContract the address of the mediator contract.
*/
function setMediatorContractOnOtherSide(address _mediatorContract) external onlyOwner {
_setMediatorContractOnOtherSide(_mediatorContract);
}
/**
* @dev Sets the gas limit to be used in the message execution by the AMB bridge on the other network.
* This value can't exceed the parameter maxGasPerTx defined on the AMB bridge.
* Only the owner can call this method.
* @param _requestGasLimit the gas limit for the message execution.
*/
function setRequestGasLimit(uint256 _requestGasLimit) external onlyOwner {
_setRequestGasLimit(_requestGasLimit);
}
/**
* @dev Get the AMB interface for the bridge contract address
* @return AMB interface for the bridge contract address
*/
function bridgeContract() public view returns (IAMB) {
return IAMB(addressStorage[BRIDGE_CONTRACT]);
}
function blocklistContract() public view returns (IBlocklist) {
return IBlocklist(addressStorage[BLOCKLIST_CONTRACT]);
}
/**
* @dev Tells the mediator contract address from the other network.
* @return the address of the mediator contract.
*/
function mediatorContractOnOtherSide() public view returns (address) {
return addressStorage[MEDIATOR_CONTRACT];
}
/**
* @dev Tells the gas limit to be used in the message execution by the AMB bridge on the other network.
* @return the gas limit for the message execution.
*/
function requestGasLimit() public view returns (uint256) {
return uintStorage[REQUEST_GAS_LIMIT];
}
/**
* @dev Stores a valid AMB bridge contract address.
* @param _bridgeContract the address of the bridge contract.
*/
function _setBridgeContract(address _bridgeContract) internal {
require(AddressUtils.isContract(_bridgeContract));
addressStorage[BRIDGE_CONTRACT] = _bridgeContract;
}
/**
* @dev Stores the mediator contract address from the other network.
* @param _mediatorContract the address of the mediator contract.
*/
function _setMediatorContractOnOtherSide(address _mediatorContract) internal {
addressStorage[MEDIATOR_CONTRACT] = _mediatorContract;
}
/**
* @dev Stores the gas limit to be used in the message execution by the AMB bridge on the other network.
* @param _requestGasLimit the gas limit for the message execution.
*/
function _setRequestGasLimit(uint256 _requestGasLimit) internal {
require(_requestGasLimit <= maxGasPerTx());
uintStorage[REQUEST_GAS_LIMIT] = _requestGasLimit;
}
function _setBlocklistContract(address _blocklistContract) internal {
require(AddressUtils.isContract(_blocklistContract));
addressStorage[BLOCKLIST_CONTRACT] = _blocklistContract;
}
/**
* @dev Tells the address that generated the message on the other network that is currently being executed by
* the AMB bridge.
* @return the address of the message sender.
*/
function messageSender() internal view returns (address) {
return bridgeContract().messageSender();
}
/**
* @dev Tells the id of the message originated on the other network.
* @return the id of the message originated on the other network.
*/
function messageId() internal view returns (bytes32) {
return bridgeContract().messageId();
}
/**
* @dev Tells the maximum gas limit that a message can use on its execution by the AMB bridge on the other network.
* @return the maximum gas limit value.
*/
function maxGasPerTx() internal view returns (uint256) {
return bridgeContract().maxGasPerTx();
}
}
// File: contracts/upgradeable_contracts/ChooseReceiverHelper.sol
pragma solidity 0.4.24;
contract ChooseReceiverHelper {
/**
* @dev Helper function for alternative receiver feature. Chooses the actual receiver out of sender and passed data.
* @param _from address of tokens sender.
* @param _data passed data in the transfer message.
* @return address of the receiver on the other side.
*/
function chooseReceiver(address _from, bytes _data) internal view returns (address recipient) {
recipient = _from;
if (_data.length > 0) {
require(_data.length == 20);
recipient = Bytes.bytesToAddress(_data);
require(recipient != address(0));
require(recipient != bridgeContractOnOtherSide());
}
}
/* solcov ignore next */
function bridgeContractOnOtherSide() internal view returns (address);
}
// File: contracts/upgradeable_contracts/TransferInfoStorage.sol
pragma solidity 0.4.24;
contract TransferInfoStorage is EternalStorage {
/**
* @dev Stores the value of a message sent to the AMB bridge.
* @param _messageId of the message sent to the bridge.
* @param _value amount of tokens bridged.
*/
function setMessageValue(bytes32 _messageId, uint256 _value) internal {
uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))] = _value;
}
/**
* @dev Tells the amount of tokens of a message sent to the AMB bridge.
* @return value representing amount of tokens.
*/
function messageValue(bytes32 _messageId) internal view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))];
}
/**
* @dev Stores the receiver of a message sent to the AMB bridge.
* @param _messageId of the message sent to the bridge.
* @param _recipient receiver of the tokens bridged.
*/
function setMessageRecipient(bytes32 _messageId, address _recipient) internal {
addressStorage[keccak256(abi.encodePacked("messageRecipient", _messageId))] = _recipient;
}
/**
* @dev Tells the receiver of a message sent to the AMB bridge.
* @return address of the receiver.
*/
function messageRecipient(bytes32 _messageId) internal view returns (address) {
return addressStorage[keccak256(abi.encodePacked("messageRecipient", _messageId))];
}
/**
* @dev Sets that the message sent to the AMB bridge has been fixed.
* @param _messageId of the message sent to the bridge.
*/
function setMessageFixed(bytes32 _messageId) internal {
boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))] = true;
}
/**
* @dev Tells if a message sent to the AMB bridge has been fixed.
* @return bool indicating the status of the message.
*/
function messageFixed(bytes32 _messageId) public view returns (bool) {
return boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))];
}
}
// File: contracts/upgradeable_contracts/multi_amb_erc20_to_erc677/MultiTokenBridgeMediator.sol
pragma solidity 0.4.24;
/**
* @title MultiTokenBridgeMediator
* @dev Common mediator functionality to handle operations related to multi-token bridge messages sent to AMB bridge.
*/
contract MultiTokenBridgeMediator is
BasicAMBMediator,
BasicMultiTokenBridge,
TransferInfoStorage,
ChooseReceiverHelper
{
event FailedMessageFixed(bytes32 indexed messageId, address token, address recipient, uint256 value);
event TokensBridged(address indexed token, address indexed recipient, uint256 value, bytes32 indexed messageId);
/**
* @dev Stores the bridged token of a message sent to the AMB bridge.
* @param _messageId of the message sent to the bridge.
* @param _token bridged token address.
*/
function setMessageToken(bytes32 _messageId, address _token) internal {
addressStorage[keccak256(abi.encodePacked("messageToken", _messageId))] = _token;
}
/**
* @dev Tells the bridged token address of a message sent to the AMB bridge.
* @return address of a token contract.
*/
function messageToken(bytes32 _messageId) internal view returns (address) {
return addressStorage[keccak256(abi.encodePacked("messageToken", _messageId))];
}
/**
* @dev Handles the bridged tokens. Checks that the value is inside the execution limits and invokes the method
* to execute the Mint or Unlock accordingly.
* @param _token bridged ERC20/ERC677 token
* @param _recipient address that will receive the tokens
* @param _value amount of tokens to be received
*/
function _handleBridgedTokens(ERC677 _token, address _recipient, uint256 _value) internal {
if (withinExecutionLimit(_token, _value)) {
addTotalExecutedPerDay(_token, getCurrentDay(), _value);
executeActionOnBridgedTokens(_token, _recipient, _value);
} else {
executeActionOnBridgedTokensOutOfLimit(_token, _recipient, _value);
}
}
/**
* @dev Method to be called when a bridged message execution failed. It will generate a new message requesting to
* fix/roll back the transferred assets on the other network.
* @param _messageId id of the message which execution failed.
*/
function requestFailedMessageFix(bytes32 _messageId) external {
require(!bridgeContract().messageCallStatus(_messageId));
require(bridgeContract().failedMessageReceiver(_messageId) == address(this));
require(bridgeContract().failedMessageSender(_messageId) == mediatorContractOnOtherSide());
bytes4 methodSelector = this.fixFailedMessage.selector;
bytes memory data = abi.encodeWithSelector(methodSelector, _messageId);
bridgeContract().requireToPassMessage(mediatorContractOnOtherSide(), data, requestGasLimit());
}
/**
* @dev Handles the request to fix transferred assets which bridged message execution failed on the other network.
* It uses the information stored by passMessage method when the assets were initially transferred
* @param _messageId id of the message which execution failed on the other network.
*/
function fixFailedMessage(bytes32 _messageId) public onlyMediator {
require(!messageFixed(_messageId));
address token = messageToken(_messageId);
address recipient = messageRecipient(_messageId);
uint256 value = messageValue(_messageId);
setMessageFixed(_messageId);
executeActionOnFixedTokens(token, recipient, value);
emit FailedMessageFixed(_messageId, token, recipient, value);
}
/**
* @dev Execute the action to be performed when the bridge tokens are out of execution limits.
*/
function executeActionOnBridgedTokensOutOfLimit(address, address, uint256) internal {
revert();
}
/* solcov ignore next */
function executeActionOnBridgedTokens(address _token, address _recipient, uint256 _value) internal;
/* solcov ignore next */
function executeActionOnFixedTokens(address _token, address _recipient, uint256 _value) internal;
}
// File: contracts/upgradeable_contracts/Initializable.sol
pragma solidity 0.4.24;
contract Initializable is EternalStorage {
bytes32 internal constant INITIALIZED = 0x0a6f646cd611241d8073675e00d1a1ff700fbf1b53fcf473de56d1e6e4b714ba; // keccak256(abi.encodePacked("isInitialized"))
function setInitialize() internal {
boolStorage[INITIALIZED] = true;
}
function isInitialized() public view returns (bool) {
return boolStorage[INITIALIZED];
}
}
// File: contracts/upgradeable_contracts/ReentrancyGuard.sol
pragma solidity 0.4.24;
contract ReentrancyGuard is EternalStorage {
bytes32 internal constant LOCK = 0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92; // keccak256(abi.encodePacked("lock"))
function lock() internal returns (bool) {
return boolStorage[LOCK];
}
function setLock(bool _lock) internal {
boolStorage[LOCK] = _lock;
}
}
// File: contracts/upgradeable_contracts/Upgradeable.sol
pragma solidity 0.4.24;
contract Upgradeable {
// Avoid using onlyUpgradeabilityOwner name to prevent issues with implementation from proxy contract
modifier onlyIfUpgradeabilityOwner() {
require(msg.sender == IUpgradeabilityOwnerStorage(this).upgradeabilityOwner());
/* solcov ignore next */
_;
}
}
// File: contracts/upgradeable_contracts/Sacrifice.sol
pragma solidity 0.4.24;
contract Sacrifice {
constructor(address _recipient) public payable {
selfdestruct(_recipient);
}
}
// File: contracts/libraries/Address.sol
pragma solidity 0.4.24;
/**
* @title Address
* @dev Helper methods for Address type.
*/
library Address {
/**
* @dev Try to send native tokens to the address. If it fails, it will force the transfer by creating a selfdestruct contract
* @param _receiver address that will receive the native tokens
* @param _value the amount of native tokens to send
*/
function safeSendValue(address _receiver, uint256 _value) internal {
if (!_receiver.send(_value)) {
(new Sacrifice).value(_value)(_receiver);
}
}
}
// File: contracts/upgradeable_contracts/Claimable.sol
pragma solidity 0.4.24;
contract Claimable {
bytes4 internal constant TRANSFER = 0xa9059cbb; // transfer(address,uint256)
modifier validAddress(address _to) {
require(_to != address(0));
/* solcov ignore next */
_;
}
function claimValues(address _token, address _to) internal {
if (_token == address(0)) {
claimNativeCoins(_to);
} else {
claimErc20Tokens(_token, _to);
}
}
function claimNativeCoins(address _to) internal {
uint256 value = address(this).balance;
Address.safeSendValue(_to, value);
}
function claimErc20Tokens(address _token, address _to) internal {
ERC20Basic token = ERC20Basic(_token);
uint256 balance = token.balanceOf(this);
safeTransfer(_token, _to, balance);
}
function safeTransfer(address _token, address _to, uint256 _value) internal {
bytes memory returnData;
bool returnDataResult;
bytes memory callData = abi.encodeWithSelector(TRANSFER, _to, _value);
assembly {
let result := call(gas, _token, 0x0, add(callData, 0x20), mload(callData), 0, 32)
returnData := mload(0)
returnDataResult := mload(0)
switch result
case 0 {
revert(0, 0)
}
}
// Return data is optional
if (returnData.length > 0) {
require(returnDataResult);
}
}
}
// File: contracts/upgradeable_contracts/VersionableBridge.sol
pragma solidity 0.4.24;
contract VersionableBridge {
function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
return (5, 1, 0);
}
/* solcov ignore next */
function getBridgeMode() external pure returns (bytes4);
}
// File: contracts/upgradeable_contracts/multi_amb_erc20_to_erc677/BasicMultiAMBErc20ToErc677.sol
pragma solidity 0.4.24;
/**
* @title BasicMultiAMBErc20ToErc677
* @dev Common functionality for multi-erc20-to-erc677 mediator intended to work on top of AMB bridge.
*/
contract BasicMultiAMBErc20ToErc677 is
Initializable,
ReentrancyGuard,
Upgradeable,
Claimable,
VersionableBridge,
MultiTokenBridgeMediator
{
/**
* @dev Tells the address of the mediator contract on the other side, used by chooseReceiver method
* to avoid sending the native tokens to that address.
* @return address of the mediator contract con the other side
*/
function bridgeContractOnOtherSide() internal view returns (address) {
return mediatorContractOnOtherSide();
}
/**
* @dev Initiate the bridge operation for some amount of tokens from msg.sender.
* The user should first call Approve method of the ERC677 token.
* @param token bridged token contract address.
* @param _receiver address that will receive the native tokens on the other network.
* @param _value amount of tokens to be transferred to the other network.
*/
function relayTokens(ERC677 token, address _receiver, uint256 _value) external {
_relayTokens(token, _receiver, _value);
}
/**
* @dev Initiate the bridge operation for some amount of tokens from msg.sender to msg.sender on the other side.
* The user should first call Approve method of the ERC677 token.
* @param token bridged token contract address.
* @param _value amount of tokens to be transferred to the other network.
*/
function relayTokens(ERC677 token, uint256 _value) external {
_relayTokens(token, msg.sender, _value);
}
/**
* @dev Tells the bridge interface version that this contract supports.
* @return major value of the version
* @return minor value of the version
* @return patch value of the version
*/
function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
return (1, 1, 1);
}
/**
* @dev Tells the bridge mode that this contract supports.
* @return _data 4 bytes representing the bridge mode
*/
function getBridgeMode() external pure returns (bytes4 _data) {
return 0xb1516c26; // bytes4(keccak256(abi.encodePacked("multi-erc-to-erc-amb")))
}
/**
* @dev Claims stucked tokens. Only unsupported tokens can be claimed.
* When dealing with already supported tokens, fixMediatorBalance can be used instead.
* @param _token address of claimed token, address(0) for native
* @param _to address of tokens receiver
*/
function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner validAddress(_to) {
require(_token == address(0) || !isTokenRegistered(_token)); // native coins or token not registered
claimValues(_token, _to);
}
/* solcov ignore next */
function onTokenTransfer(address _from, uint256 _value, bytes _data) public returns (bool);
/* solcov ignore next */
function _relayTokens(ERC677 token, address _receiver, uint256 _value) internal;
/* solcov ignore next */
function bridgeSpecificActionsOnTokenTransfer(ERC677 _token, address _from, uint256 _value, bytes _data) internal;
}
// File: contracts/upgradeability/Proxy.sol
pragma solidity 0.4.24;
/**
* @title Proxy
* @dev Gives the possibility to delegate any call to a foreign implementation.
*/
contract Proxy {
/**
* @dev Tells the address of the implementation where every call will be delegated.
* @return address of the implementation to which it will be delegated
*/
/* solcov ignore next */
function implementation() public view returns (address);
/**
* @dev Fallback function allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
function() public payable {
// solhint-disable-previous-line no-complex-fallback
address _impl = implementation();
require(_impl != address(0));
assembly {
/*
0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40)
loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty
memory. It's needed because we're going to write the return data of delegatecall to the
free memory slot.
*/
let ptr := mload(0x40)
/*
`calldatacopy` is copy calldatasize bytes from calldata
First argument is the destination to which data is copied(ptr)
Second argument specifies the start position of the copied data.
Since calldata is sort of its own unique location in memory,
0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata.
That's always going to be the zeroth byte of the function selector.
Third argument, calldatasize, specifies how much data will be copied.
calldata is naturally calldatasize bytes long (same thing as msg.data.length)
*/
calldatacopy(ptr, 0, calldatasize)
/*
delegatecall params explained:
gas: the amount of gas to provide for the call. `gas` is an Opcode that gives
us the amount of gas still available to execution
_impl: address of the contract to delegate to
ptr: to pass copied data
calldatasize: loads the size of `bytes memory data`, same as msg.data.length
0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic,
these are set to 0, 0 so the output data will not be written to memory. The output
data will be read using `returndatasize` and `returdatacopy` instead.
result: This will be 0 if the call fails and 1 if it succeeds
*/
let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
/*
*/
/*
ptr current points to the value stored at 0x40,
because we assigned it like ptr := mload(0x40).
Because we use 0x40 as a free memory pointer,
we want to make sure that the next time we want to allocate memory,
we aren't overwriting anything important.
So, by adding ptr and returndatasize,
we get a memory location beyond the end of the data we will be copying to ptr.
We place this in at 0x40, and any reads from 0x40 will now read from free memory
*/
mstore(0x40, add(ptr, returndatasize))
/*
`returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the
slot it will copy to, 0 means copy from the beginning of the return data, and size is
the amount of data to copy.
`returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall
*/
returndatacopy(ptr, 0, returndatasize)
/*
if `result` is 0, revert.
if `result` is 1, return `size` amount of data from `ptr`. This is the data that was
copied to `ptr` from the delegatecall return data
*/
switch result
case 0 {
revert(ptr, returndatasize)
}
default {
return(ptr, returndatasize)
}
}
}
}
// File: contracts/upgradeable_contracts/multi_amb_erc20_to_erc677/TokenProxy.sol
pragma solidity 0.4.24;
interface IPermittableTokenVersion {
function version() external pure returns (string);
}
/**
* @title TokenProxy
* @dev Helps to reduces the size of the deployed bytecode for automatically created tokens, by using a proxy contract.
*/
contract TokenProxy is Proxy {
// storage layout is copied from PermittableToken.sol
string internal name;
string internal symbol;
uint8 internal decimals;
mapping(address => uint256) internal balances;
uint256 internal totalSupply;
mapping(address => mapping(address => uint256)) internal allowed;
address internal owner;
bool internal mintingFinished;
address internal bridgeContractAddr;
// string public constant version = "1";
bytes32 internal DOMAIN_SEPARATOR;
// bytes32 public constant PERMIT_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb;
mapping(address => uint256) internal nonces;
mapping(address => mapping(address => uint256)) internal expirations;
/**
* @dev Creates a non-upgradeable token proxy for PermitableToken.sol, initializes its eternalStorage.
* @param _tokenImage address of the token image used for mirroring all functions.
* @param _name token name.
* @param _symbol token symbol.
* @param _decimals token decimals.
* @param _chainId chain id for current network.
*/
constructor(address _tokenImage, string memory _name, string memory _symbol, uint8 _decimals, uint256 _chainId)
public
{
string memory version = IPermittableTokenVersion(_tokenImage).version();
assembly {
// EIP 1967
// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
sstore(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, _tokenImage)
}
name = _name;
symbol = _symbol;
decimals = _decimals;
owner = msg.sender; // msg.sender == HomeMultiAMBErc20ToErc677 mediator
bridgeContractAddr = msg.sender;
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(_name)),
keccak256(bytes(version)),
_chainId,
address(this)
)
);
}
/**
* @dev Retrieves the implementation contract address, mirrored token image.
* @return token image address.
*/
function implementation() public view returns (address impl) {
assembly {
impl := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
}
}
}
// File: contracts/upgradeable_contracts/BaseRewardAddressList.sol
pragma solidity 0.4.24;
/**
* @title BaseRewardAddressList
* @dev Implements the logic to store, add and remove reward account addresses. Works as a linked list.
*/
contract BaseRewardAddressList is EternalStorage {
using SafeMath for uint256;
address public constant F_ADDR = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;
uint256 internal constant MAX_REWARD_ADDRESSES = 50;
bytes32 internal constant REWARD_ADDRESS_COUNT = 0xabc77c82721ced73eef2645facebe8c30249e6ac372cce6eb9d1fed31bd6648f; // keccak256(abi.encodePacked("rewardAddressCount"))
event RewardAddressAdded(address indexed addr);
event RewardAddressRemoved(address indexed addr);
/**
* @dev Retrieves all registered reward accounts.
* @return address list of the registered reward receivers.
*/
function rewardAddressList() external view returns (address[]) {
address[] memory list = new address[](rewardAddressCount());
uint256 counter = 0;
address nextAddr = getNextRewardAddress(F_ADDR);
while (nextAddr != F_ADDR) {
require(nextAddr != address(0));
list[counter] = nextAddr;
nextAddr = getNextRewardAddress(nextAddr);
counter++;
}
return list;
}
/**
* @dev Retrieves amount of registered reward accounts.
* @return length of reward addresses list.
*/
function rewardAddressCount() public view returns (uint256) {
return uintStorage[REWARD_ADDRESS_COUNT];
}
/**
* @dev Checks if specified address is included into the registered rewards receivers list.
* @param _addr address to verify.
* @return true, if specified address is associated with one of the registered reward accounts.
*/
function isRewardAddress(address _addr) public view returns (bool) {
return _addr != F_ADDR && getNextRewardAddress(_addr) != address(0);
}
/**
* @dev Retrieves next reward address in the linked list, or F_ADDR if given address is the last one.
* @param _address address of some reward account.
* @return address of the next reward receiver.
*/
function getNextRewardAddress(address _address) public view returns (address) {
return addressStorage[keccak256(abi.encodePacked("rewardAddressList", _address))];
}
/**
* @dev Internal function for adding a new reward address to the linked list.
* @param _addr new reward account.
*/
function _addRewardAddress(address _addr) internal {
require(_addr != address(0) && _addr != F_ADDR);
require(!isRewardAddress(_addr));
address nextAddr = getNextRewardAddress(F_ADDR);
require(nextAddr != address(0));
_setNextRewardAddress(_addr, nextAddr);
_setNextRewardAddress(F_ADDR, _addr);
_setRewardAddressCount(rewardAddressCount().add(1));
}
/**
* @dev Internal function for removing existing reward address from the linked list.
* @param _addr old reward account which should be removed.
*/
function _removeRewardAddress(address _addr) internal {
require(isRewardAddress(_addr));
address nextAddr = getNextRewardAddress(_addr);
address index = F_ADDR;
address next = getNextRewardAddress(index);
while (next != _addr) {
require(next != address(0));
index = next;
next = getNextRewardAddress(index);
require(next != F_ADDR);
}
_setNextRewardAddress(index, nextAddr);
delete addressStorage[keccak256(abi.encodePacked("rewardAddressList", _addr))];
_setRewardAddressCount(rewardAddressCount().sub(1));
}
/**
* @dev Internal function for initializing linked list with the array of the initial reward addresses.
* @param _rewardAddresses initial reward addresses list, should be non-empty.
*/
function _setRewardAddressList(address[] _rewardAddresses) internal {
require(_rewardAddresses.length > 0);
_setNextRewardAddress(F_ADDR, _rewardAddresses[0]);
for (uint256 i = 0; i < _rewardAddresses.length; i++) {
require(_rewardAddresses[i] != address(0) && _rewardAddresses[i] != F_ADDR);
require(!isRewardAddress(_rewardAddresses[i]));
if (i == _rewardAddresses.length - 1) {
_setNextRewardAddress(_rewardAddresses[i], F_ADDR);
} else {
_setNextRewardAddress(_rewardAddresses[i], _rewardAddresses[i + 1]);
}
emit RewardAddressAdded(_rewardAddresses[i]);
}
_setRewardAddressCount(_rewardAddresses.length);
}
/**
* @dev Internal function for updating the length of the reward accounts list.
* @param _rewardAddressCount new linked list length.
*/
function _setRewardAddressCount(uint256 _rewardAddressCount) internal {
require(_rewardAddressCount <= MAX_REWARD_ADDRESSES);
uintStorage[REWARD_ADDRESS_COUNT] = _rewardAddressCount;
}
/**
* @dev Internal function for updating the pointer to the next reward receiver.
* @param _prevAddr address of some reward receiver.
* @param _addr address of the next receiver to which _prevAddr should point to.
*/
function _setNextRewardAddress(address _prevAddr, address _addr) internal {
addressStorage[keccak256(abi.encodePacked("rewardAddressList", _prevAddr))] = _addr;
}
}
// File: contracts/interfaces/IBurnableMintableERC677Token.sol
pragma solidity 0.4.24;
contract IBurnableMintableERC677Token is ERC677 {
function mint(address _to, uint256 _amount) public returns (bool);
function burn(uint256 _value) public;
function claimTokens(address _token, address _to) public;
}
// File: contracts/upgradeable_contracts/multi_amb_erc20_to_erc677/HomeFeeManagerMultiAMBErc20ToErc677.sol
pragma solidity 0.4.24;
/**
* @title HomeFeeManagerMultiAMBErc20ToErc677
* @dev Implements the logic to distribute fees from the multi erc20 to erc677 mediator contract operations.
* The fees are distributed in the form of native tokens to the list of reward accounts.
*/
contract HomeFeeManagerMultiAMBErc20ToErc677 is BaseRewardAddressList, Ownable, BasicMultiTokenBridge {
using SafeMath for uint256;
event FeeUpdated(bytes32 feeType, address indexed token, uint256 fee);
event FeeDistributed(uint256 fee, address indexed token, bytes32 indexed messageId);
// This is not a real fee value but a relative value used to calculate the fee percentage
uint256 internal constant MAX_FEE = 1 ether;
bytes32 public constant HOME_TO_FOREIGN_FEE = 0x741ede137d0537e88e0ea0ff25b1f22d837903dbbee8980b4a06e8523247ee26; // keccak256(abi.encodePacked("homeToForeignFee"))
bytes32 public constant FOREIGN_TO_HOME_FEE = 0x03be2b2875cb41e0e77355e802a16769bb8dfcf825061cde185c73bf94f12625; // keccak256(abi.encodePacked("foreignToHomeFee"))
/**
* @dev Throws if given fee percentage is >= 100%.
*/
modifier validFee(uint256 _fee) {
require(_fee < MAX_FEE);
/* solcov ignore next */
_;
}
/**
* @dev Throws if given fee type is unknown.
*/
modifier validFeeType(bytes32 _feeType) {
require(_feeType == HOME_TO_FOREIGN_FEE || _feeType == FOREIGN_TO_HOME_FEE);
/* solcov ignore next */
_;
}
/**
* @dev Adds a new reward address to the list, which will receive fees collected from the bridge operations.
* Only the owner can call this method.
* @param _addr new reward account.
*/
function addRewardAddress(address _addr) external onlyOwner {
_addRewardAddress(_addr);
}
/**
* @dev Removes a reward address from the rewards list.
* Only the owner can call this method.
* @param _addr old reward account, that should be removed.
*/
function removeRewardAddress(address _addr) external onlyOwner {
_removeRewardAddress(_addr);
}
/**
* @dev Updates the value for the particular fee type.
* Only the owner can call this method.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _fee new fee value, in percentage (1 ether == 10**18 == 100%).
*/
function setFee(bytes32 _feeType, address _token, uint256 _fee) external onlyOwner {
_setFee(_feeType, _token, _fee);
}
/**
* @dev Retrieves the value for the particular fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @return fee value associated with the requested fee type.
*/
function getFee(bytes32 _feeType, address _token) public view validFeeType(_feeType) returns (uint256) {
return uintStorage[keccak256(abi.encodePacked(_feeType, _token))];
}
/**
* @dev Calculates the amount of fee to pay for the value of the particular fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _value bridged value, for which fee should be evaluated.
* @return amount of fee to be subtracted from the transferred value.
*/
function calculateFee(bytes32 _feeType, address _token, uint256 _value) public view returns (uint256) {
uint256 _fee = getFee(_feeType, _token);
return _value.mul(_fee).div(MAX_FEE);
}
/**
* @dev Internal function for updating the fee value for the given fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _fee new fee value, in percentage (1 ether == 10**18 == 100%).
*/
function _setFee(bytes32 _feeType, address _token, uint256 _fee) internal validFeeType(_feeType) validFee(_fee) {
require(isTokenRegistered(_token));
uintStorage[keccak256(abi.encodePacked(_feeType, _token))] = _fee;
emit FeeUpdated(_feeType, _token, _fee);
}
/**
* @dev Calculates a random number based on the block number.
* @param _count the max value for the random number.
* @return a number between 0 and _count.
*/
function random(uint256 _count) internal view returns (uint256) {
return uint256(blockhash(block.number.sub(1))) % _count;
}
/**
* @dev Calculates and distributes the amount of fee proportionally between registered reward addresses.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _value bridged value, for which fee should be evaluated.
* @return total amount of fee subtracted from the transferred value and distributed between the reward accounts.
*/
function _distributeFee(bytes32 _feeType, address _token, uint256 _value) internal returns (uint256) {
uint256 numOfAccounts = rewardAddressCount();
uint256 _fee = calculateFee(_feeType, _token, _value);
if (numOfAccounts == 0 || _fee == 0) {
return 0;
}
uint256 feePerAccount = _fee.div(numOfAccounts);
uint256 randomAccountIndex;
uint256 diff = _fee.sub(feePerAccount.mul(numOfAccounts));
if (diff > 0) {
randomAccountIndex = random(numOfAccounts);
}
address nextAddr = getNextRewardAddress(F_ADDR);
require(nextAddr != F_ADDR && nextAddr != address(0));
uint256 i = 0;
while (nextAddr != F_ADDR) {
uint256 feeToDistribute = feePerAccount;
if (diff > 0 && randomAccountIndex == i) {
feeToDistribute = feeToDistribute.add(diff);
}
if (_feeType == HOME_TO_FOREIGN_FEE) {
ERC677(_token).transfer(nextAddr, feeToDistribute);
} else {
IBurnableMintableERC677Token(_token).mint(nextAddr, feeToDistribute);
}
nextAddr = getNextRewardAddress(nextAddr);
require(nextAddr != address(0));
i = i + 1;
}
return _fee;
}
}
// File: contracts/upgradeable_contracts/multi_amb_erc20_to_erc677/HomeMultiAMBErc20ToErc677.sol
pragma solidity 0.4.24;
/**
* @title HomeMultiAMBErc20ToErc677
* @dev Home side implementation for multi-erc20-to-erc677 mediator intended to work on top of AMB bridge.
* It is designed to be used as an implementation contract of EternalStorageProxy contract.
*/
contract HomeMultiAMBErc20ToErc677 is BasicMultiAMBErc20ToErc677, HomeFeeManagerMultiAMBErc20ToErc677 {
bytes32 internal constant TOKEN_IMAGE_CONTRACT = 0x20b8ca26cc94f39fab299954184cf3a9bd04f69543e4f454fab299f015b8130f; // keccak256(abi.encodePacked("tokenImageContract"))
event NewTokenRegistered(address indexed foreignToken, address indexed homeToken);
/**
* @dev Stores the initial parameters of the mediator.
* @param _bridgeContract the address of the AMB bridge contract.
* @param _mediatorContract the address of the mediator contract on the other network.
* @param _dailyLimitMaxPerTxMinPerTxArray array with limit values for the assets to be bridged to the other network.
* [ 0 = dailyLimit, 1 = maxPerTx, 2 = minPerTx ]
* @param _executionDailyLimitExecutionMaxPerTxArray array with limit values for the assets bridged from the other network.
* [ 0 = executionDailyLimit, 1 = executionMaxPerTx ]
* @param _requestGasLimit the gas limit for the message execution.
* @param _owner address of the owner of the mediator contract.
* @param _tokenImage address of the PermittableToken contract that will be used for deploying of new tokens.
* @param _rewardAddreses list of reward addresses, between whom fees will be distributed.
* @param _fees array with initial fees for both bridge firections.
* [ 0 = homeToForeignFee, 1 = foreignToHomeFee ]
*/
function initialize(
address _bridgeContract,
address _mediatorContract,
uint256[3] _dailyLimitMaxPerTxMinPerTxArray, // [ 0 = _dailyLimit, 1 = _maxPerTx, 2 = _minPerTx ]
uint256[2] _executionDailyLimitExecutionMaxPerTxArray, // [ 0 = _executionDailyLimit, 1 = _executionMaxPerTx ]
uint256 _requestGasLimit,
address _owner,
address _tokenImage,
address[] _rewardAddreses,
uint256[2] _fees // [ 0 = homeToForeignFee, 1 = foreignToHomeFee ]
) external onlyRelevantSender returns (bool) {
require(!isInitialized());
require(_owner != address(0));
_setBridgeContract(_bridgeContract);
_setMediatorContractOnOtherSide(_mediatorContract);
_setLimits(address(0), _dailyLimitMaxPerTxMinPerTxArray);
_setExecutionLimits(address(0), _executionDailyLimitExecutionMaxPerTxArray);
_setRequestGasLimit(_requestGasLimit);
setOwner(_owner);
_setTokenImage(_tokenImage);
if (_rewardAddreses.length > 0) {
_setRewardAddressList(_rewardAddreses);
}
_setFee(HOME_TO_FOREIGN_FEE, address(0), _fees[0]);
_setFee(FOREIGN_TO_HOME_FEE, address(0), _fees[1]);
setInitialize();
return isInitialized();
}
/**
* @dev Updates an address of the token image contract used for proxifying newly created tokens.
* @param _tokenImage address of PermittableToken contract.
*/
function setTokenImage(address _tokenImage) external onlyOwner {
_setTokenImage(_tokenImage);
}
/**
* @dev Retrieves address of the token image contract.
* @return address of block reward contract.
*/
function tokenImage() public view returns (address) {
return addressStorage[TOKEN_IMAGE_CONTRACT];
}
/**
* @dev Handles the bridged tokens for the first time, includes deployment of new TokenProxy contract.
* Checks that the value is inside the execution limits and invokes the method
* to execute the Mint or Unlock accordingly.
* @param _token address of the bridged ERC20/ERC677 token on the foreign side.
* @param _name name of the bridged token, "x" will be appended, if empty, symbol will be used instead.
* @param _symbol symbol of the bridged token, "x" will be appended, if empty, name will be used instead.
* @param _decimals decimals of the bridge foreign token.
* @param _recipient address that will receive the tokens.
* @param _value amount of tokens to be received.
*/
function deployAndHandleBridgedTokens(
address _token,
string _name,
string _symbol,
uint8 _decimals,
address _recipient,
uint256 _value
) external onlyMediator {
string memory name = _name;
string memory symbol = _symbol;
if (bytes(name).length == 0) {
name = symbol;
} else if (bytes(symbol).length == 0) {
symbol = name;
}
name = string(abi.encodePacked(name, " on ESC"));
symbol = string(abi.encodePacked("bnb", symbol));
address homeToken = new TokenProxy(tokenImage(), name, symbol, _decimals, bridgeContract().sourceChainId());
_setTokenAddressPair(_token, homeToken);
_initializeTokenBridgeLimits(homeToken, _decimals);
_setFee(HOME_TO_FOREIGN_FEE, homeToken, getFee(HOME_TO_FOREIGN_FEE, address(0)));
_setFee(FOREIGN_TO_HOME_FEE, homeToken, getFee(FOREIGN_TO_HOME_FEE, address(0)));
_handleBridgedTokens(ERC677(homeToken), _recipient, _value);
emit NewTokenRegistered(_token, homeToken);
}
/**
* @dev Handles the bridged tokens. Checks that the value is inside the execution limits and invokes the method
* to execute the Mint or Unlock accordingly.
* @param _token bridged ERC20 token.
* @param _recipient address that will receive the tokens.
* @param _value amount of tokens to be received.
*/
function handleBridgedTokens(ERC677 _token, address _recipient, uint256 _value) external onlyMediator {
ERC677 homeToken = ERC677(homeTokenAddress(_token));
require(isTokenRegistered(homeToken));
_handleBridgedTokens(homeToken, _recipient, _value);
}
/**
* @dev ERC677 transfer callback function.
* @param _from address of tokens sender.
* @param _value amount of transferred tokens.
* @param _data additional transfer data, can be used for passing alternative receiver address.
*/
function onTokenTransfer(address _from, uint256 _value, bytes _data) public returns (bool) {
// if onTokenTransfer is called as a part of call to _relayTokens, this callback does nothing
if (!lock()) {
ERC677 token = ERC677(msg.sender);
// if msg.sender if not a valid token contract, this check will fail, since limits are zeros
// so the following check is not needed
// require(isTokenRegistered(token));
require(withinLimit(token, _value));
addTotalSpentPerDay(token, getCurrentDay(), _value);
bridgeSpecificActionsOnTokenTransfer(token, _from, _value, _data);
}
return true;
}
/**
* @dev Validates that the token amount is inside the limits, calls transferFrom to transfer the tokens to the contract
* and invokes the method to burn/lock the tokens and unlock/mint the tokens on the other network.
* The user should first call Approve method of the ERC677 token.
* @param token bridge token contract address.
* @param _receiver address that will receive the native tokens on the other network.
* @param _value amount of tokens to be transferred to the other network.
*/
function _relayTokens(ERC677 token, address _receiver, uint256 _value) internal {
// This lock is to prevent calling passMessage twice if a ERC677 token is used.
// When transferFrom is called, after the transfer, the ERC677 token will call onTokenTransfer from this contract
// which will call passMessage.
require(!lock());
address to = address(this);
// if msg.sender if not a valid token contract, this check will fail, since limits are zeros
// so the following check is not needed
// require(isTokenRegistered(token));
require(withinLimit(token, _value));
addTotalSpentPerDay(token, getCurrentDay(), _value);
setLock(true);
token.transferFrom(msg.sender, to, _value);
setLock(false);
bridgeSpecificActionsOnTokenTransfer(token, msg.sender, _value, abi.encodePacked(_receiver));
}
/**
* @dev Executes action on the request to deposit tokens relayed from the other network
* @param _recipient address of tokens receiver
* @param _value amount of bridged tokens
*/
function executeActionOnBridgedTokens(address _token, address _recipient, uint256 _value) internal {
bytes32 _messageId = messageId();
uint256 valueToMint = _value;
// check recipient is blocked
IBlocklist blocklist = blocklistContract();
if (blocklist != address(0) && blocklist.isBlocked(_recipient)) {
setLock(true);
IBurnableMintableERC677Token(_token).mint(address(this), valueToMint);
setLock(false);
IBurnableMintableERC677Token(_token).approve(address(blocklist), valueToMint);
blocklist.blockERC20(_token, _recipient, valueToMint, _messageId);
return;
}
uint256 fee = _distributeFee(FOREIGN_TO_HOME_FEE, _token, valueToMint);
if (fee > 0) {
emit FeeDistributed(fee, _token, _messageId);
valueToMint = valueToMint.sub(fee);
}
IBurnableMintableERC677Token(_token).mint(_recipient, valueToMint);
emit TokensBridged(_token, _recipient, valueToMint, _messageId);
}
/**
* @dev Mints back the amount of tokens that were bridged to the other network but failed.
* @param _token address that bridged token contract.
* @param _recipient address that will receive the tokens.
* @param _value amount of tokens to be received.
*/
function executeActionOnFixedTokens(address _token, address _recipient, uint256 _value) internal {
// check recipient is blocked
// IBlocklist blocklist = blocklistContract();
// if (blocklist != address(0) && blocklist.isBlocked(_recipient)) {
// setLock(true);
// IBurnableMintableERC677Token(_token).mint(address(this), _value);
// setLock(false);
// IBurnableMintableERC677Token(_token).approve(address(blocklist), _value);
// blocklist.blockERC20(_token, _recipient, _value, messageId());
// return;
// }
IBurnableMintableERC677Token(_token).mint(_recipient, _value);
}
/**
* @dev Retrieves address of the home bridged token contract associated with a specific foreign token contract.
* @param _foreignToken address of the created home token contract.
* @return address of the home token contract.
*/
function homeTokenAddress(address _foreignToken) public view returns (address) {
return addressStorage[keccak256(abi.encodePacked("homeTokenAddress", _foreignToken))];
}
/**
* @dev Retrieves address of the foreign bridged token contract associated with a specific home token contract.
* @param _homeToken address of the created home token contract.
* @return address of the foreign token contract.
*/
function foreignTokenAddress(address _homeToken) public view returns (address) {
return addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", _homeToken))];
}
/**
* @dev Internal function for updating an address of the token image contract.
* @param _foreignToken address of bridged foreign token contract.
* @param _foreignToken address of created home token contract.
*/
function _setTokenAddressPair(address _foreignToken, address _homeToken) internal {
addressStorage[keccak256(abi.encodePacked("homeTokenAddress", _foreignToken))] = _homeToken;
addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", _homeToken))] = _foreignToken;
}
/**
* @dev Internal function for updating an address of the token image contract.
* @param _tokenImage address of deployed PermittableToken contract.
*/
function _setTokenImage(address _tokenImage) internal {
require(AddressUtils.isContract(_tokenImage));
addressStorage[TOKEN_IMAGE_CONTRACT] = _tokenImage;
}
/**
* @dev Executes action on withdrawal of bridged tokens
* @param _token address of token contract
* @param _from address of tokens sender
* @param _value requsted amount of bridged tokens
* @param _data alternative receiver, if specified
*/
function bridgeSpecificActionsOnTokenTransfer(ERC677 _token, address _from, uint256 _value, bytes _data) internal {
if (!lock()) {
bytes32 _messageId = messageId();
uint256 valueToBridge = _value;
address _receiver = chooseReceiver(_from, _data);
// check sender and receiver is blocked
IBlocklist blocklist = blocklistContract();
if (blocklist != address(0)) {
_token.approve(address(blocklist), valueToBridge);
if (blocklist.checkAndBlockERC20(_from, _receiver, _token, valueToBridge, 0)) {
return;
}
_token.approve(address(blocklist), 0);
}
uint256 fee = _distributeFee(HOME_TO_FOREIGN_FEE, _token, valueToBridge);
if (fee > 0) {
emit FeeDistributed(fee, _token, _messageId);
valueToBridge = valueToBridge.sub(fee);
}
IBurnableMintableERC677Token(_token).burn(valueToBridge);
passMessage(_token, _from, _receiver, valueToBridge);
}
}
/**
* @dev Call AMB bridge to require the invocation of handleBridgedTokens method of the mediator on the other network.
* Store information related to the bridged tokens in case the message execution fails on the other network
* and the action needs to be fixed/rolled back.
* @param _token bridged ERC20 token
* @param _from address of sender, if bridge operation fails, tokens will be returned to this address
* @param _receiver address of receiver on the other side, will eventually receive bridged tokens
* @param _value bridged amount of tokens
*/
function passMessage(ERC677 _token, address _from, address _receiver, uint256 _value) internal {
bytes4 methodSelector = this.handleBridgedTokens.selector;
address foreignToken = foreignTokenAddress(_token);
bytes memory data = abi.encodeWithSelector(methodSelector, foreignToken, _receiver, _value);
bytes32 _messageId = bridgeContract().requireToPassMessage(
mediatorContractOnOtherSide(),
data,
requestGasLimit()
);
setMessageToken(_messageId, _token);
setMessageValue(_messageId, _value);
setMessageRecipient(_messageId, _from);
}
}

Contract ABI

[{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"relayTokens","inputs":[{"type":"address","name":"token"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setExecutionMaxPerTx","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_maxPerTx"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"maxPerTx","inputs":[{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"isRewardAddress","inputs":[{"type":"address","name":"_addr"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"fixFailedMessage","inputs":[{"type":"bytes32","name":"_messageId"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setBridgeContract","inputs":[{"type":"address","name":"_bridgeContract"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"withinLimit","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_amount"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeRewardAddress","inputs":[{"type":"address","name":"_addr"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"handleBridgedTokens","inputs":[{"type":"address","name":"_token"},{"type":"address","name":"_recipient"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"blocklistContract","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"executionMaxPerTx","inputs":[{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTokenImage","inputs":[{"type":"address","name":"_tokenImage"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"isTokenRegistered","inputs":[{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setDailyLimit","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_dailyLimit"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"deployAndHandleBridgedTokens","inputs":[{"type":"address","name":"_token"},{"type":"string","name":"_name"},{"type":"string","name":"_symbol"},{"type":"uint8","name":"_decimals"},{"type":"address","name":"_recipient"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"isInitialized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"withinExecutionLimit","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_amount"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"getCurrentDay","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"executionDailyLimit","inputs":[{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"bytes4","name":"_data"}],"name":"getBridgeMode","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"foreignTokenAddress","inputs":[{"type":"address","name":"_homeToken"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setFee","inputs":[{"type":"bytes32","name":"_feeType"},{"type":"address","name":"_token"},{"type":"uint256","name":"_fee"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"messageFixed","inputs":[{"type":"bytes32","name":"_messageId"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"getFee","inputs":[{"type":"bytes32","name":"_feeType"},{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"claimTokens","inputs":[{"type":"address","name":"_token"},{"type":"address","name":"_to"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"getNextRewardAddress","inputs":[{"type":"address","name":"_address"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setMediatorContractOnOtherSide","inputs":[{"type":"address","name":"_mediatorContract"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"calculateFee","inputs":[{"type":"bytes32","name":"_feeType"},{"type":"address","name":"_token"},{"type":"uint256","name":"_value"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"rewardAddressCount","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"maxAvailablePerTx","inputs":[{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setExecutionDailyLimit","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_dailyLimit"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"mediatorContractOnOtherSide","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"requestFailedMessageFix","inputs":[{"type":"bytes32","name":"_messageId"}],"constant":false},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"uint64","name":"major"},{"type":"uint64","name":"minor"},{"type":"uint64","name":"patch"}],"name":"getBridgeInterfacesVersion","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setBlocklistContract","inputs":[{"type":"address","name":"_blocklistContract"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"minPerTx","inputs":[{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":""}],"name":"onTokenTransfer","inputs":[{"type":"address","name":"_from"},{"type":"uint256","name":"_value"},{"type":"bytes","name":"_data"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"totalSpentPerDay","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_day"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"relayTokens","inputs":[{"type":"address","name":"token"},{"type":"address","name":"_receiver"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addRewardAddress","inputs":[{"type":"address","name":"_addr"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"requestGasLimit","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"tokenImage","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"F_ADDR","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"bridgeContract","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setMaxPerTx","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_maxPerTx"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"homeTokenAddress","inputs":[{"type":"address","name":"_foreignToken"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":""}],"name":"rewardAddressList","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setMinPerTx","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_minPerTx"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":""}],"name":"initialize","inputs":[{"type":"address","name":"_bridgeContract"},{"type":"address","name":"_mediatorContract"},{"type":"uint256[3]","name":"_dailyLimitMaxPerTxMinPerTxArray"},{"type":"uint256[2]","name":"_executionDailyLimitExecutionMaxPerTxArray"},{"type":"uint256","name":"_requestGasLimit"},{"type":"address","name":"_owner"},{"type":"address","name":"_tokenImage"},{"type":"address[]","name":"_rewardAddreses"},{"type":"uint256[2]","name":"_fees"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"totalExecutedPerDay","inputs":[{"type":"address","name":"_token"},{"type":"uint256","name":"_day"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setRequestGasLimit","inputs":[{"type":"uint256","name":"_requestGasLimit"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":""}],"name":"FOREIGN_TO_HOME_FEE","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"dailyLimit","inputs":[{"type":"address","name":"_token"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bytes32","name":""}],"name":"HOME_TO_FOREIGN_FEE","inputs":[],"constant":true},{"type":"event","name":"NewTokenRegistered","inputs":[{"type":"address","name":"foreignToken","indexed":true},{"type":"address","name":"homeToken","indexed":true}],"anonymous":false},{"type":"event","name":"FeeUpdated","inputs":[{"type":"bytes32","name":"feeType","indexed":false},{"type":"address","name":"token","indexed":true},{"type":"uint256","name":"fee","indexed":false}],"anonymous":false},{"type":"event","name":"FeeDistributed","inputs":[{"type":"uint256","name":"fee","indexed":false},{"type":"address","name":"token","indexed":true},{"type":"bytes32","name":"messageId","indexed":true}],"anonymous":false},{"type":"event","name":"FailedMessageFixed","inputs":[{"type":"bytes32","name":"messageId","indexed":true},{"type":"address","name":"token","indexed":false},{"type":"address","name":"recipient","indexed":false},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"event","name":"TokensBridged","inputs":[{"type":"address","name":"token","indexed":true},{"type":"address","name":"recipient","indexed":true},{"type":"uint256","name":"value","indexed":false},{"type":"bytes32","name":"messageId","indexed":true}],"anonymous":false},{"type":"event","name":"DailyLimitChanged","inputs":[{"type":"address","name":"token","indexed":true},{"type":"uint256","name":"newLimit","indexed":false}],"anonymous":false},{"type":"event","name":"ExecutionDailyLimitChanged","inputs":[{"type":"address","name":"token","indexed":true},{"type":"uint256","name":"newLimit","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":false},{"type":"address","name":"newOwner","indexed":false}],"anonymous":false},{"type":"event","name":"RewardAddressAdded","inputs":[{"type":"address","name":"addr","indexed":true}],"anonymous":false},{"type":"event","name":"RewardAddressRemoved","inputs":[{"type":"address","name":"addr","indexed":true}],"anonymous":false}]
            

Deployed ByteCode

0x608060405260043610620002bd5763ffffffff60e060020a60003504166301e4f53a8114620002c257806301fcc1d314620002eb578063032f693f1462000312578063071664c514620003485780630950d51514620003805780630b26cf66146200039b5780631077523814620003bf57806310b8075b14620003e6578063125e4cfb146200040a578063151a6208146200043757806316ef1913146200046b5780631fa2195f146200048f57806326aa101f14620004b35780632803212f14620004d75780632ae87cdd14620004fe578063392e53cd146200054b5780633a50bc8714620005635780633e6968b6146200058a57806340f8dd8614620005a2578063437764df14620005c657806347ac7d6a14620006105780634b1a7582146200063457806359339982146200065e57806368400963146200067957806369ffa08a14620006a05780636d92f50914620006ca5780636e5d6bea14620006ee578063710c6013146200071257806371e9a8b2146200073c5780637610722f14620007545780637837cf911462000778578063871c0760146200079f5780638da5cb5b14620007b75780639a4a439514620007cf5780639cb7595a14620007ea578063a3f38605146200082e578063a4b1c2431462000852578063a4c0ed361462000876578063ab3a25d914620008e2578063ad58bdd11462000909578063b4be506e1462000936578063be3b625b146200095a578063c1aef4f21462000972578063c794c769146200098a578063cd59658314620009a2578063db6fff8c14620009ba578063dfbe4ae014620009e1578063e9d6c0591462000a05578063ec47de2a1462000a6f578063f07e71a61462000a96578063f2c54fe81462000ae8578063f2fde38b1462000b0f578063f3b837911462000b33578063f3ce14c21462000b4e578063f3f514151462000b66578063fab190911462000b8a575b600080fd5b348015620002cf57600080fd5b50620002e9600160a060020a036004351660243562000ba2565b005b348015620002f857600080fd5b50620002e9600160a060020a036004351660243562000bb3565b3480156200031f57600080fd5b5062000336600160a060020a036004351662000cef565b60408051918252519081900360200190f35b3480156200035557600080fd5b506200036c600160a060020a036004351662000dc6565b604080519115158252519081900360200190f35b3480156200038d57600080fd5b50620002e960043562000dfc565b348015620003a857600080fd5b50620002e9600160a060020a036004351662000ef9565b348015620003cc57600080fd5b506200036c600160a060020a036004351660243562000f26565b348015620003f357600080fd5b50620002e9600160a060020a036004351662000fae565b3480156200041757600080fd5b50620002e9600160a060020a036004358116906024351660443562000fd8565b3480156200044457600080fd5b506200044f62001061565b60408051600160a060020a039092168252519081900360200190f35b3480156200047857600080fd5b5062000336600160a060020a0360043516620010b8565b3480156200049c57600080fd5b50620002e9600160a060020a03600435166200114d565b348015620004c057600080fd5b506200036c600160a060020a036004351662001177565b348015620004e457600080fd5b50620002e9600160a060020a03600435166024356200118c565b3480156200050b57600080fd5b50620002e960048035600160a060020a0390811691602480358082019390830135926044359283019201359060643560ff16906084351660a435620012f9565b3480156200055857600080fd5b506200036c62001761565b3480156200057057600080fd5b506200036c600160a060020a0360043516602435620017b2565b3480156200059757600080fd5b506200033662001815565b348015620005af57600080fd5b5062000336600160a060020a03600435166200181e565b348015620005d357600080fd5b50620005de620018b3565b604080517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff199092168252519081900360200190f35b3480156200061d57600080fd5b506200044f600160a060020a0360043516620018d7565b3480156200064157600080fd5b50620002e9600435600160a060020a0360243516604435620019b8565b3480156200066b57600080fd5b506200036c600435620019e9565b3480156200068657600080fd5b5062000336600435600160a060020a036024351662001ab4565b348015620006ad57600080fd5b50620002e9600160a060020a036004358116906024351662001b99565b348015620006d757600080fd5b506200044f600160a060020a036004351662001c69565b348015620006fb57600080fd5b50620002e9600160a060020a036004351662001cff565b3480156200071f57600080fd5b5062000336600435600160a060020a036024351660443562001d29565b3480156200074957600080fd5b506200033662001d6f565b3480156200076157600080fd5b5062000336600160a060020a036004351662001dbd565b3480156200078557600080fd5b50620002e9600160a060020a036004351660243562001e21565b348015620007ac57600080fd5b506200044f62001f8e565b348015620007c457600080fd5b506200044f62001fe5565b348015620007dc57600080fd5b50620002e96004356200203c565b348015620007f757600080fd5b506200080262002398565b6040805167ffffffffffffffff9485168152928416602084015292168183015290519081900360600190f35b3480156200083b57600080fd5b50620002e9600160a060020a0360043516620023a1565b3480156200085f57600080fd5b5062000336600160a060020a0360043516620023cb565b3480156200088357600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526200036c948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750620024609650505050505050565b348015620008ef57600080fd5b5062000336600160a060020a0360043516602435620024bd565b3480156200091657600080fd5b50620002e9600160a060020a03600435811690602435166044356200259e565b3480156200094357600080fd5b50620002e9600160a060020a0360043516620025ab565b3480156200096757600080fd5b5062000336620025d5565b3480156200097f57600080fd5b506200044f62002623565b3480156200099757600080fd5b506200044f6200267a565b348015620009af57600080fd5b506200044f62002685565b348015620009c757600080fd5b50620002e9600160a060020a0360043516602435620026dc565b348015620009ee57600080fd5b506200044f600160a060020a0360043516620027de565b34801562000a1257600080fd5b5062000a1d62002874565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101562000a5b57818101518382015260200162000a41565b505050509050019250505060405180910390f35b34801562000a7c57600080fd5b50620002e9600160a060020a036004351660243562002939565b34801562000aa357600080fd5b506200036c600160a060020a03600480358216916024803582169260449260a49260e43592610104358316926101243516916101443590810191013561016462002a3f565b34801562000af557600080fd5b5062000336600160a060020a036004351660243562002ced565b34801562000b1c57600080fd5b50620002e9600160a060020a036004351662002d8a565b34801562000b4057600080fd5b50620002e960043562002dca565b34801562000b5b57600080fd5b506200033662002df4565b34801562000b7357600080fd5b5062000336600160a060020a036004351662002e07565b34801562000b9757600080fd5b506200033662002e9c565b62000baf82338362002eaf565b5050565b62000bbd62001fe5565b600160a060020a0316331462000bd257600080fd5b62000bdd8262001177565b151562000be957600080fd5b80158062000c0c575060008111801562000c0c575062000c09826200181e565b81105b151562000c1857600080fd5b806000808460405160200180807f657865637574696f6e4d6178506572547800000000000000000000000000000081525060110182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083835b6020831062000cad5780518252601f19909201916020918201910162000c8c565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020939093555050505050565b60008060008360405160200180807f6d6178506572547800000000000000000000000000000000000000000000000081525060080182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083835b6020831062000d855780518252601f19909201916020918201910162000d64565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205495945050505050565b6000600160a060020a038281161480159062000df65750600062000dea8362001c69565b600160a060020a031614155b92915050565b600080600062000e0b62002685565b600160a060020a0316331462000e2057600080fd5b62000e2a62001f8e565b600160a060020a031662000e3d62002ff5565b600160a060020a03161462000e5157600080fd5b62000e5c84620019e9565b1562000e6757600080fd5b62000e728462003072565b925062000e7f84620030f8565b915062000e8c846200317e565b905062000e998462003203565b62000ea6838383620032d7565b60408051600160a060020a03808616825284166020820152808201839052905185917f07b5483b8e4bd8ea240a474d5117738350e7d431e3668c48a97910b0b397796a919081900360600190a250505050565b62000f0362001fe5565b600160a060020a0316331462000f1857600080fd5b62000f23816200333b565b50565b60008062000f508362000f438662000f3d62001815565b620024bd565b9063ffffffff620033bc16565b9050600062000f60600062002e07565b11801562000f7857508062000f758562002e07565b10155b801562000f8f575062000f8b8462000cef565b8311155b801562000fa6575062000fa284620023cb565b8310155b949350505050565b62000fb862001fe5565b600160a060020a0316331462000fcd57600080fd5b62000f2381620033ca565b600062000fe462002685565b600160a060020a0316331462000ff957600080fd5b6200100362001f8e565b600160a060020a03166200101662002ff5565b600160a060020a0316146200102a57600080fd5b6200103584620027de565b9050620010428162001177565b15156200104e57600080fd5b6200105b81848462003574565b50505050565b7f9ba5a09a13321d5fc0d3150bbf4489a02b9b881bf70e2fc6639c91e8c5ce714c60005260026020527f87f07cf898f772bd3ff661aa30d2354333eefbd852e374d9021ef7a3463e81fd54600160a060020a031690565b60008060008360405160200180807f657865637574696f6e4d6178506572547800000000000000000000000000000081525060110182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083836020831062000d855780518252601f19909201916020918201910162000d64565b6200115762001fe5565b600160a060020a031633146200116c57600080fd5b62000f2381620035bc565b6000806200118583620023cb565b1192915050565b6200119662001fe5565b600160a060020a03163314620011ab57600080fd5b620011b68262001177565b1515620011c257600080fd5b620011cd8262000cef565b811180620011d9575080155b1515620011e557600080fd5b806000808460405160200180807f6461696c794c696d697400000000000000000000000000000000000000000000815250600a0182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083835b602083106200127a5780518252601f19909201916020918201910162001259565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528581019690965250928301600020949094555080518481529051600160a060020a03861693507fca0b3dabefdbd8c72c0a9cf4a6e9d107da897abf036ef3f3f3b010cdd2594159929181900390910190a25050565b60608060006200130862002685565b600160a060020a031633146200131d57600080fd5b6200132762001f8e565b600160a060020a03166200133a62002ff5565b600160a060020a0316146200134e57600080fd5b89898080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f8f018190048102820181019092528d81529598508d94508c9350839250850190508382808284378201915050505050509150825160001415620013c857819250620013d5565b81511515620013d5578291505b826040516020018082805190602001908083835b602083106200140a5780518252601f199092019160209182019101620013e9565b6001836020036101000a038019825116818451168082178552505050505050905001807f206f6e204553430000000000000000000000000000000000000000000000000081525060070191505060405160208183030381529060405292508160405160200180807f626e62000000000000000000000000000000000000000000000000000000000081525060030182805190602001908083835b60208310620014c55780518252601f199092019160209182019101620014a4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405291506200150562002623565b8383886200151262002685565b600160a060020a0316631544298e6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156200155057600080fd5b505af115801562001565573d6000803e3d6000fd5b505050506040513d60208110156200157c57600080fd5b50516200158862005871565b600160a060020a038616815260ff831660608201526080810182905260a060208083018281528751928401929092528651604084019160c08501919089019080838360005b83811015620015e7578181015183820152602001620015cd565b50505050905090810190601f168015620016155780820380516001836020036101000a031916815260200191505b50838103825286518152865160209182019188019080838360005b838110156200164a57818101518382015260200162001630565b50505050905090810190601f168015620016785780820380516001836020036101000a031916815260200191505b50975050505050505050604051809103906000f0801580156200169f573d6000803e3d6000fd5b509050620016ae8b826200363d565b620016bd818760ff1662003804565b620016e560008051602062005dfc83398151915282620016df82600062001ab4565b620039bb565b6200170760008051602062005e1c83398151915282620016df82600062001ab4565b6200171481868662003574565b80600160a060020a03168b600160a060020a03167f78d063210f4fb6b4cc932390bb8045fa2465e51349590182dab8b9e84c57a6ee60405160405180910390a35050505050505050505050565b7f0a6f646cd611241d8073675e00d1a1ff700fbf1b53fcf473de56d1e6e4b714ba60005260046020527f078d888f9b66f3f8bfa10909e31f1e16240db73449f0500afdbbe3a70da457cc5460ff1690565b600080620017cf8362000f4386620017c962001815565b62002ced565b90506000620017df60006200181e565b118015620017f7575080620017f4856200181e565b10155b801562000fa657506200180a84620010b8565b909211159392505050565b62015180420490565b60008060008360405160200180807f657865637574696f6e4461696c794c696d69740000000000000000000000000081525060130182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083836020831062000d855780518252601f19909201916020918201910162000d64565b7fb1516c260000000000000000000000000000000000000000000000000000000090565b6000600260008360405160200180807f666f726569676e546f6b656e416464726573730000000000000000000000000081525060130182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083835b602083106200196e5780518252601f1990920191602091820191016200194d565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054600160a060020a031695945050505050565b620019c262001fe5565b600160a060020a03163314620019d757600080fd5b620019e4838383620039bb565b505050565b6000600460008360405160200180807f6d65737361676546697865640000000000000000000000000000000000000000815250600c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831062001a705780518252601f19909201916020918201910162001a4f565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205460ff1695945050505050565b60008260008051602062005dfc83398151915281148062001ae3575060008051602062005e1c83398151915281145b151562001aef57600080fd5b604080516020808201879052606060020a600160a060020a0387160282840152825160348184030181526054909201928390528151600093849392909182918401908083835b6020831062001b565780518252601f19909201916020918201910162001b35565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054979650505050505050565b30600160a060020a0316636fde82026040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801562001bd857600080fd5b505af115801562001bed573d6000803e3d6000fd5b505050506040513d602081101562001c0457600080fd5b5051600160a060020a0316331462001c1b57600080fd5b80600160a060020a038116151562001c3257600080fd5b600160a060020a038316158062001c51575062001c4f8362001177565b155b151562001c5d57600080fd5b620019e4838362003b10565b6000600260008360405160200180807f726577617264416464726573734c69737400000000000000000000000000000081525060110182600160a060020a0316600160a060020a0316606060020a028152601401915050604051602081830303815290604052604051808280519060200190808383602083106200196e5780518252601f1990920191602091820191016200194d565b62001d0962001fe5565b600160a060020a0316331462001d1e57600080fd5b62000f238162003b3e565b60008062001d38858562001ab4565b905062001d66670de0b6b3a764000062001d59858463ffffffff62003ba816565b9063ffffffff62003bd516565b95945050505050565b7fabc77c82721ced73eef2645facebe8c30249e6ac372cce6eb9d1fed31bd6648f60009081526020527f75fbf9e7a88379132f510aaafa152e59a595fda8e70d0b76dd34200dac99f82e5490565b600080600080600062001dd08662000cef565b935062001ddd8662002e07565b925062001dee8662000f3d62001815565b915081831162001e0057600062001e04565b8183035b905080841062001e15578062001e17565b835b9695505050505050565b62001e2b62001fe5565b600160a060020a0316331462001e4057600080fd5b62001e4b8262001177565b151562001e5757600080fd5b62001e6282620010b8565b81118062001e6e575080155b151562001e7a57600080fd5b806000808460405160200180807f657865637574696f6e4461696c794c696d69740000000000000000000000000081525060130182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083835b6020831062001f0f5780518252601f19909201916020918201910162001eee565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528581019690965250928301600020949094555080518481529051600160a060020a03861693507f4c177b42dbe934b3abbc0208c11a42e46589983431616f1710ab19969c5ed62e929181900390910190a25050565b7f98aa806e31e94a687a31c65769cb99670064dd7f5a87526da075c5fb4eab988060005260026020527f0c1206883be66049a02d4937078367c00b3d71dd1a9465df969363c6ddeac96d54600160a060020a031690565b7f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060005260026020527fb7802e97e87ef2842a6cce7da7ffaeaedaa2f61a6a7870b23d9d01fc9b73712e54600160a060020a031690565b600060606200204a62002685565b600160a060020a031663cb08a10c846040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b1580156200209b57600080fd5b505af1158015620020b0573d6000803e3d6000fd5b505050506040513d6020811015620020c757600080fd5b505115620020d457600080fd5b30620020df62002685565b600160a060020a0316633f9a8e7e856040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b1580156200213057600080fd5b505af115801562002145573d6000803e3d6000fd5b505050506040513d60208110156200215c57600080fd5b5051600160a060020a0316146200217257600080fd5b6200217c62001f8e565b600160a060020a03166200218f62002685565b600160a060020a0316634a610b04856040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b158015620021e057600080fd5b505af1158015620021f5573d6000803e3d6000fd5b505050506040513d60208110156200220c57600080fd5b5051600160a060020a0316146200222257600080fd5b5050604080516024808201849052825180830390910181526044909101909152602081018051600160e060020a03167f0950d51500000000000000000000000000000000000000000000000000000000908117909152906200228362002685565b600160a060020a031663dc8601b36200229b62001f8e565b83620022a6620025d5565b6040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b8381101562002315578181015183820152602001620022fb565b50505050905090810190601f168015620023435780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156200236557600080fd5b505af11580156200237a573d6000803e3d6000fd5b505050506040513d60208110156200239157600080fd5b5050505050565b60018080909192565b620023ab62001fe5565b600160a060020a03163314620023c057600080fd5b62000f238162003beb565b60008060008360405160200180807f6d696e506572547800000000000000000000000000000000000000000000000081525060080182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083836020831062000d855780518252601f19909201916020918201910162000d64565b6000806200246d62003c6c565b1515620024b257503362002482818562000f26565b15156200248e57600080fd5b620024a4816200249d62001815565b8662003cbd565b620024b28186868662003dad565b506001949350505050565b6000806000848460405160200180807f746f74616c5370656e745065724461790000000000000000000000000000000081525060100183600160a060020a0316600160a060020a0316606060020a028152601401828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106200255b5780518252601f1990920191602091820191016200253a565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054935050505092915050565b620019e483838362002eaf565b620025b562001fe5565b600160a060020a03163314620025ca57600080fd5b62000f2381620040df565b7f2dfd6c9f781bb6bbb5369c114e949b69ebb440ef3d4dd6b2836225eb1dc3a2be60009081526020527f2de0d2cdc19d356cb53b5984f91bfd3b31fe0c678a0d190a6db39274bb34753f5490565b7f20b8ca26cc94f39fab299954184cf3a9bd04f69543e4f454fab299f015b8130f60005260026020527f0c25bd6cb8545e46227bc56e841bd085538c74351fb22e98acdfbe596b353cfb54600160a060020a031690565b600160a060020a0381565b7f811bbb11e8899da471f0e69a3ed55090fc90215227fc5fb1cb0d6e962ea7b74f60005260026020527fb4ed64697d3ef8518241966f7c6f28b0d72f20f51198717d198d2d55076c593d54600160a060020a031690565b620026e662001fe5565b600160a060020a03163314620026fb57600080fd5b620027068262001177565b15156200271257600080fd5b8015806200273e57506200272682620023cb565b811180156200273e57506200273b8262002e07565b81105b15156200274a57600080fd5b806000808460405160200180807f6d6178506572547800000000000000000000000000000000000000000000000081525060080182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083836020831062000cad5780518252601f19909201916020918201910162000c8c565b6000600260008360405160200180807f686f6d65546f6b656e416464726573730000000000000000000000000000000081525060100182600160a060020a0316600160a060020a0316606060020a028152601401915050604051602081830303815290604052604051808280519060200190808383602083106200196e5780518252601f1990920191602091820191016200194d565b6060806000806200288462001d6f565b604051908082528060200260200182016040528015620028ae578160200160208202803883390190505b50925060009150620028c7600160a060020a0362001c69565b90505b600160a060020a03818116146200293157600160a060020a0381161515620028f157600080fd5b8083838151811015156200290157fe5b600160a060020a03909216602092830290910190910152620029238162001c69565b6001909201919050620028ca565b509092915050565b6200294362001fe5565b600160a060020a031633146200295857600080fd5b620029638262001177565b15156200296f57600080fd5b600081118015620029895750620029868262002e07565b81105b80156200299f57506200299c8262000cef565b81105b1515620029ab57600080fd5b806000808460405160200180807f6d696e506572547800000000000000000000000000000000000000000000000081525060080182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083836020831062000cad5780518252601f19909201916020918201910162000c8c565b6040805160048152602481018252602081018051600160e060020a03167f6fde8202000000000000000000000000000000000000000000000000000000001781529151815160009330939291829190808383895b8381101562002aad57818101518382015260200162002a93565b50505050905090810190601f16801562002adb5780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1915050158062002b71575030600160a060020a0316636fde82026040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801562002b3757600080fd5b505af115801562002b4c573d6000803e3d6000fd5b505050506040513d602081101562002b6357600080fd5b5051600160a060020a031633145b8062002b7c57503330145b151562002b8857600080fd5b62002b9262001761565b1562002b9d57600080fd5b600160a060020a038616151562002bb357600080fd5b62002bbe8b6200333b565b62002bc98a62003b3e565b62002bf960008a600380602002604051908101604052809291908260036020028082843750620041829350505050565b60408051808201825262002c2491600091908b90600290839083908082843750620044619350505050565b62002c2f876200463a565b62002c3a866200469e565b62002c4585620035bc565b600083111562002c875762002c878484808060200260200160405190810160405280939291908181526020018383602002808284375062004755945050505050565b62002cab60008051602062005dfc833981519152600084815b6020020135620039bb565b62002cca60008051602062005e1c833981519152600084600162002ca0565b62002cd462004908565b62002cde62001761565b9b9a5050505050505050505050565b6000806000848460405160200180807f746f74616c45786563757465645065724461790000000000000000000000000081525060130183600160a060020a0316600160a060020a0316606060020a02815260140182815260200192505050604051602081830303815290604052604051808280519060200190808383602083106200255b5780518252601f1990920191602091820191016200253a565b62002d9462001fe5565b600160a060020a0316331462002da957600080fd5b600160a060020a038116151562002dbf57600080fd5b62000f23816200469e565b62002dd462001fe5565b600160a060020a0316331462002de957600080fd5b62000f23816200463a565b60008051602062005e1c83398151915281565b60008060008360405160200180807f6461696c794c696d697400000000000000000000000000000000000000000000815250600a0182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083836020831062000d855780518252601f19909201916020918201910162000d64565b60008051602062005dfc83398151915281565b600062002ebb62003c6c565b1562002ec657600080fd5b503062002ed4848362000f26565b151562002ee057600080fd5b62002ef68462002eef62001815565b8462003cbd565b62002f0260016200495f565b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a038381166024830152604482018590529151918616916323b872dd916064808201926020929091908290030181600087803b15801562002f7557600080fd5b505af115801562002f8a573d6000803e3d6000fd5b505050506040513d602081101562002fa157600080fd5b5062002fb0905060006200495f565b6200105b843384866040516020018082600160a060020a0316600160a060020a0316606060020a02815260140191505060405160208183030381529060405262003dad565b60006200300162002685565b600160a060020a031663d67bdd256040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156200303f57600080fd5b505af115801562003054573d6000803e3d6000fd5b505050506040513d60208110156200306b57600080fd5b5051905090565b6000600260008360405160200180807f6d657373616765546f6b656e0000000000000000000000000000000000000000815250600c018260001916600019168152602001915050604051602081830303815290604052604051808280519060200190808383602083106200196e5780518252601f1990920191602091820191016200194d565b6000600260008360405160200180807f6d657373616765526563697069656e74000000000000000000000000000000008152506010018260001916600019168152602001915050604051602081830303815290604052604051808280519060200190808383602083106200196e5780518252601f1990920191602091820191016200194d565b60008060008360405160200180807f6d65737361676556616c75650000000000000000000000000000000000000000815250600c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083836020831062000d855780518252601f19909201916020918201910162000d64565b6001600460008360405160200180807f6d65737361676546697865640000000000000000000000000000000000000000815250600c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b602083106200328a5780518252601f19909201916020918201910162003269565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805460ff19169415159490941790935550505050565b82600160a060020a03166340c10f1983836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156200236557600080fd5b6200334681620049ba565b15156200335257600080fd5b7f811bbb11e8899da471f0e69a3ed55090fc90215227fc5fb1cb0d6e962ea7b74f60005260026020527fb4ed64697d3ef8518241966f7c6f28b0d72f20f51198717d198d2d55076c593d8054600160a060020a031916600160a060020a0392909216919091179055565b8181018281101562000df657fe5b6000806000620033da8462000dc6565b1515620033e657600080fd5b620033f18462001c69565b9250600160a060020a039150620034088262001c69565b90505b600160a060020a03818116908516146200346257600160a060020a03811615156200343557600080fd5b809150620034438262001c69565b9050600160a060020a0380821614156200345c57600080fd5b6200340b565b6200346e8284620049c2565b600260008560405160200180807f726577617264416464726573734c69737400000000000000000000000000000081525060110182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083835b60208310620035035780518252601f199092019160209182019101620034e2565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000208054600160a060020a0319169055506200105b91506200356e905060016200356162001d6f565b9063ffffffff62004a5716565b62004a6a565b620035808382620017b2565b15620035af576200359c836200359562001815565b8362004ac6565b620035a983838362004b72565b620019e4565b620019e4838383620002bd565b620035c781620049ba565b1515620035d357600080fd5b7f20b8ca26cc94f39fab299954184cf3a9bd04f69543e4f454fab299f015b8130f60005260026020527f0c25bd6cb8545e46227bc56e841bd085538c74351fb22e98acdfbe596b353cfb8054600160a060020a031916600160a060020a0392909216919091179055565b80600260008460405160200180807f686f6d65546f6b656e416464726573730000000000000000000000000000000081525060100182600160a060020a0316600160a060020a0316606060020a0281526014019150506040516020818303038152906040526040518082805190602001908083835b60208310620036d35780518252601f199092019160209182019101620036b2565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652858101969096525092830160009081208054600160a060020a031916600160a060020a0397881617905583517f666f726569676e546f6b656e416464726573730000000000000000000000000081870152958716606060020a02603387015283518087036027018152604790960193849052855188966002969295909450925082918401908083835b60208310620037a75780518252601f19909201916020918201910162003786565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000208054600160a060020a031916600160a060020a0395909516949094179093555050505050565b6000806000806000806012871015620039065786601203600a0a9550620038318662001d596000620023cb565b9450620038448662001d59600062000cef565b9350620038578662001d59600062002e07565b92506200386a8662001d596000620010b8565b91506200387d8662001d5960006200181e565b9050841515620038b95760019450848411620038b95760649350606491508383111580620038ab5750818111155b15620038b957506127109150815b620038e0886060604051908101604052808681526020018781526020018881525062004182565b620039008860408051908101604052808481526020018581525062004461565b620039b1565b60128703600a0a955062003972886060604051908101604052806200393e8a62003931600062002e07565b9063ffffffff62003ba816565b8152602001620039548a62003931600062000cef565b81526020016200396a8a620039316000620023cb565b905262004182565b620039b1886040805190810160405280620039938a6200393160006200181e565b8152602001620039a98a620039316000620010b8565b905262004461565b5050505050505050565b8260008051602062005dfc833981519152811480620039e8575060008051602062005e1c83398151915281145b1515620039f457600080fd5b81670de0b6b3a7640000811062003a0a57600080fd5b62003a158462001177565b151562003a2157600080fd5b604080516020808201889052606060020a600160a060020a038816028284015282516034818403018152605490920192839052815186936000938493909282918401908083835b6020831062003a895780518252601f19909201916020918201910162003a68565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528581019690965250928301600020949094555080518881529182018690528051600160a060020a03881693507fb8ff7722579ab646299f4f7d3ec42f3aaa482cce1e47d6041e8ca971600455309281900390910190a25050505050565b600160a060020a038216151562003b325762003b2c8162004f73565b62000baf565b62000baf828262004f81565b7f98aa806e31e94a687a31c65769cb99670064dd7f5a87526da075c5fb4eab988060005260026020527f0c1206883be66049a02d4937078367c00b3d71dd1a9465df969363c6ddeac96d8054600160a060020a031916600160a060020a0392909216919091179055565b600082151562003bbb5750600062000df6565b5081810281838281151562003bcc57fe5b041462000df657fe5b6000818381151562003be357fe5b049392505050565b62003bf681620049ba565b151562003c0257600080fd5b7f9ba5a09a13321d5fc0d3150bbf4489a02b9b881bf70e2fc6639c91e8c5ce714c60005260026020527f87f07cf898f772bd3ff661aa30d2354333eefbd852e374d9021ef7a3463e81fd8054600160a060020a031916600160a060020a0392909216919091179055565b7f6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e9260005260046020527fcb8d022f2163402334a4962e3279c5def3417d3d8dab9e27ba26e81e3f8337845460ff1690565b62003cce8162000f438585620024bd565b600080858560405160200180807f746f74616c5370656e745065724461790000000000000000000000000000000081525060100183600160a060020a0316600160a060020a0316606060020a028152601401828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831062003d6a5780518252601f19909201916020918201910162003d49565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002093909355505050505050565b600080600080600062003dbf62003c6c565b1515620040d45762003dd062005024565b945086935062003de188876200506e565b925062003ded62001061565b9150600160a060020a0382161562003fe65788600160a060020a031663095ea7b383866040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801562003e6357600080fd5b505af115801562003e78573d6000803e3d6000fd5b505050506040513d602081101562003e8f57600080fd5b5050604080517ff5a428b5000000000000000000000000000000000000000000000000000000008152600160a060020a038a8116600483015285811660248301528b811660448301526064820187905260006084830181905292519085169263f5a428b59260a480820193602093909283900390910190829087803b15801562003f1857600080fd5b505af115801562003f2d573d6000803e3d6000fd5b505050506040513d602081101562003f4457600080fd5b50511562003f5257620040d4565b88600160a060020a031663095ea7b38360006040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801562003fb757600080fd5b505af115801562003fcc573d6000803e3d6000fd5b505050506040513d602081101562003fe357600080fd5b50505b6200400260008051602062005dfc8339815191528a86620050d0565b9050600081111562004063576040805182815290518691600160a060020a038c16917fd560a522f77cfb4924d6fe51be1615e540a48a8931c48fe0349c7f47ebabe7479181900360200190a362004060848263ffffffff62004a5716565b93505b88600160a060020a03166342966c68856040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b158015620040ad57600080fd5b505af1158015620040c2573d6000803e3d6000fd5b50505050620040d48989858762005372565b505050505050505050565b6000600160a060020a03821615801590620041035750600160a060020a0382811614155b15156200410f57600080fd5b6200411a8262000dc6565b156200412557600080fd5b62004137600160a060020a0362001c69565b9050600160a060020a03811615156200414f57600080fd5b6200415b8282620049c2565b6200416e600160a060020a0383620049c2565b62000baf6200356e600162000f4362001d6f565b604081015160001080156200419e575060408101516020820151115b8015620041af575060208101518151115b1515620041bb57600080fd5b8051604080517f6461696c794c696d697400000000000000000000000000000000000000000000602082810191909152606060020a600160a060020a03871602602a8301528251601e818403018152603e909201928390528151600093849392909182918401908083835b60208310620042475780518252601f19909201916020918201910162004226565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652858101969096525092830160009081209590955550508382015181517f6d6178506572547800000000000000000000000000000000000000000000000081850152600160a060020a038716606060020a0260288201528251808203601c018152603c9091019283905280519194938493919282918401908083835b602083106200430d5780518252601f199092019160209182019101620042ec565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652858101969096525092830160009081209590955550508381015181517f6d696e506572547800000000000000000000000000000000000000000000000081850152600160a060020a038716606060020a0260288201528251808203601c018152603c9091019283905280519194938493919282918401908083835b60208310620043d35780518252601f199092019160209182019101620043b2565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600090812094909455505050600160a060020a038316907fca0b3dabefdbd8c72c0a9cf4a6e9d107da897abf036ef3f3f3b010cdd25941599083905b60200201516040518082815260200191505060405180910390a25050565b80516020820151106200447357600080fd5b8051604080517f657865637574696f6e4461696c794c696d697400000000000000000000000000602082810191909152606060020a600160a060020a038716026033830152825160278184030181526047909201928390528151600093849392909182918401908083835b60208310620044ff5780518252601f199092019160209182019101620044de565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652858101969096525092830160009081209590955550508382015181517f657865637574696f6e4d6178506572547800000000000000000000000000000081850152600160a060020a038716606060020a0260318201528251808203602501815260459091019283905280519194938493919282918401908083835b60208310620045c55780518252601f199092019160209182019101620045a4565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600090812094909455505050600160a060020a038316907f4c177b42dbe934b3abbc0208c11a42e46589983431616f1710ab19969c5ed62e90839062004443565b620046446200554f565b8111156200465157600080fd5b7f2dfd6c9f781bb6bbb5369c114e949b69ebb440ef3d4dd6b2836225eb1dc3a2be60009081526020527f2de0d2cdc19d356cb53b5984f91bfd3b31fe0c678a0d190a6db39274bb34753f55565b7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0620046c962001fe5565b60408051600160a060020a03928316815291841660208301528051918290030190a17f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060005260026020527fb7802e97e87ef2842a6cce7da7ffaeaedaa2f61a6a7870b23d9d01fc9b73712e8054600160a060020a031916600160a060020a0392909216919091179055565b60008082511115156200476757600080fd5b62004793600160a060020a038360008151811015156200478357fe5b90602001906020020151620049c2565b5060005b8151811015620048fc578151600090839083908110620047b357fe5b90602001906020020151600160a060020a031614158015620047fe57508151600160a060020a0390839083908110620047e857fe5b90602001906020020151600160a060020a031614155b15156200480a57600080fd5b6200482d82828151811015156200481d57fe5b9060200190602002015162000dc6565b156200483857600080fd5b600182510381141562004876576200487082828151811015156200485857fe5b90602001906020020151600160a060020a03620049c2565b620048a5565b620048a582828151811015156200488957fe5b9060200190602002015183836001018151811015156200478357fe5b8181815181101515620048b457fe5b90602001906020020151600160a060020a03167f63aa7448a25a575731a7ec06b055a192c07c9c51fc76dbde2aab575401e4714260405160405180910390a260010162004797565b62000baf825162004a6a565b7f0a6f646cd611241d8073675e00d1a1ff700fbf1b53fcf473de56d1e6e4b714ba60005260046020527f078d888f9b66f3f8bfa10909e31f1e16240db73449f0500afdbbe3a70da457cc805460ff19166001179055565b7f6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e9260005260046020527fcb8d022f2163402334a4962e3279c5def3417d3d8dab9e27ba26e81e3f833784805460ff1916911515919091179055565b6000903b1190565b80600260008460405160200180807f726577617264416464726573734c69737400000000000000000000000000000081525060110182600160a060020a0316600160a060020a0316606060020a02815260140191505060405160208183030381529060405260405180828051906020019080838360208310620037a75780518252601f19909201916020918201910162003786565b60008282111562004a6457fe5b50900390565b603281111562004a7957600080fd5b7fabc77c82721ced73eef2645facebe8c30249e6ac372cce6eb9d1fed31bd6648f60009081526020527f75fbf9e7a88379132f510aaafa152e59a595fda8e70d0b76dd34200dac99f82e55565b62004ad78162000f43858562002ced565b600080858560405160200180807f746f74616c45786563757465645065724461790000000000000000000000000081525060130183600160a060020a0316600160a060020a0316606060020a028152601401828152602001925050506040516020818303038152906040526040518082805190602001908083836020831062003d6a5780518252601f19909201916020918201910162003d49565b60008060008062004b8262005024565b935084925062004b9162001061565b9150600160a060020a0382161580159062004c32575081600160a060020a031663fbac3951876040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801562004c0357600080fd5b505af115801562004c18573d6000803e3d6000fd5b505050506040513d602081101562004c2f57600080fd5b50515b1562004e145762004c4460016200495f565b604080517f40c10f19000000000000000000000000000000000000000000000000000000008152306004820152602481018590529051600160a060020a038916916340c10f199160448083019260209291908290030181600087803b15801562004cad57600080fd5b505af115801562004cc2573d6000803e3d6000fd5b505050506040513d602081101562004cd957600080fd5b5062004ce8905060006200495f565b86600160a060020a031663095ea7b383856040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801562004d4c57600080fd5b505af115801562004d61573d6000803e3d6000fd5b505050506040513d602081101562004d7857600080fd5b5050604080517f5d1fed35000000000000000000000000000000000000000000000000000000008152600160a060020a03898116600483015288811660248301526044820186905260648201879052915191841691635d1fed359160848082019260009290919082900301818387803b15801562004df557600080fd5b505af115801562004e0a573d6000803e3d6000fd5b5050505062004f6a565b62004e3060008051602062005e1c8339815191528885620050d0565b9050600081111562004e91576040805182815290518591600160a060020a038a16917fd560a522f77cfb4924d6fe51be1615e540a48a8931c48fe0349c7f47ebabe7479181900360200190a362004e8e838263ffffffff62004a5716565b92505b86600160a060020a03166340c10f1987856040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801562004ef557600080fd5b505af115801562004f0a573d6000803e3d6000fd5b505050506040513d602081101562004f2157600080fd5b50506040805184815290518591600160a060020a03808a1692908b16917f9afd47907e25028cdaca89d193518c302bbb128617d5a992c5abd45815526593919081900360200190a45b50505050505050565b303162000baf828262005599565b604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290518391600091600160a060020a038416916370a0823191602480830192602092919082900301818787803b15801562004fe757600080fd5b505af115801562004ffc573d6000803e3d6000fd5b505050506040513d60208110156200501357600080fd5b505190506200105b848483620055fe565b60006200503062002685565b600160a060020a031663669f618b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156200303f57600080fd5b805182906000101562000df65781516014146200508a57600080fd5b6200509582620056a3565b9050600160a060020a0381161515620050ad57600080fd5b620050b7620056aa565b600160a060020a038281169116141562000df657600080fd5b6000806000806000806000806000620050e862001d6f565b9750620050f78c8c8c62001d29565b965087158062005105575086155b1562005115576000985062005363565b62005127878963ffffffff62003bd516565b95506200514d6200513f878a63ffffffff62003ba816565b889063ffffffff62004a5716565b9350600084111562005167576200516488620056bb565b94505b62005179600160a060020a0362001c69565b9250600160a060020a03808416148015906200519d5750600160a060020a03831615155b1515620051a957600080fd5b600091505b600160a060020a03838116146200535f575084600084118015620051d157508185145b15620051ec57620051e9818563ffffffff620033bc16565b90505b60008051602062005dfc8339815191528c14156200529d578a600160a060020a031663a9059cbb84836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156200526857600080fd5b505af11580156200527d573d6000803e3d6000fd5b505050506040513d60208110156200529457600080fd5b50620053309050565b8a600160a060020a03166340c10f1984836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156200530157600080fd5b505af115801562005316573d6000803e3d6000fd5b505050506040513d60208110156200532d57600080fd5b50505b6200533b8362001c69565b9250600160a060020a03831615156200535357600080fd5b816001019150620051ae565b8698505b50505050505050509392505050565b7f125e4cfb000000000000000000000000000000000000000000000000000000006000606081620053a388620018d7565b60408051600160a060020a038084166024830152891660448201526064808201899052825180830390910181526084909101909152602081018051600160e060020a03167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19881617905290935091506200541962002685565b600160a060020a031663dc8601b36200543162001f8e565b846200543c620025d5565b6040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b83811015620054ab57818101518382015260200162005491565b50505050905090810190601f168015620054d95780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015620054fb57600080fd5b505af115801562005510573d6000803e3d6000fd5b505050506040513d60208110156200552757600080fd5b50519050620055378189620056e3565b62005543818662005768565b620039b18188620057ec565b60006200555b62002685565b600160a060020a031663e5789d036040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156200303f57600080fd5b604051600160a060020a0383169082156108fc029083906000818181858888f19350505050151562000baf578082620055d162005882565b600160a060020a039091168152604051908190036020019082f08015801562002391573d6000803e3d6000fd5b60408051600160a060020a0384166024820152604480820184905282518083039091018152606490910190915260208181018051600160e060020a03167fa9059cbb000000000000000000000000000000000000000000000000000000001781528251606093600093909290918491828a5af16000519350839250808015620002bd5750506000835111156200569b578115156200569b57600080fd5b505050505050565b6014015190565b6000620056b662001f8e565b905090565b600081620056d143600163ffffffff62004a5716565b40811515620056dc57fe5b0692915050565b80600260008460405160200180807f6d657373616765546f6b656e0000000000000000000000000000000000000000815250600c01826000191660001916815260200191505060405160208183030381529060405260405180828051906020019080838360208310620037a75780518252601f19909201916020918201910162003786565b806000808460405160200180807f6d65737361676556616c75650000000000000000000000000000000000000000815250600c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083836020831062000cad5780518252601f19909201916020918201910162000c8c565b80600260008460405160200180807f6d657373616765526563697069656e7400000000000000000000000000000000815250601001826000191660001916815260200191505060405160208183030381529060405260405180828051906020019080838360208310620037a75780518252601f19909201916020918201910162003786565b604051610548806200589383390190565b60405160218062005ddb833901905600608060405234801561001057600080fd5b50604051610548380380610548833981016040818152825160208401518285015160608087015160808801517f54fd4d500000000000000000000000000000000000000000000000000000000088529551949793840196929093019492939091600160a060020a038816916354fd4d509160048082019260009290919082900301818387803b1580156100a257600080fd5b505af11580156100b6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156100df57600080fd5b8101908080516401000000008111156100f757600080fd5b8201602081018481111561010a57600080fd5b815164010000000081118282018710171561012457600080fd5b50507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8a90558851909450610163935060009250602089019150610380565b508351610177906001906020870190610380565b506002805460ff851660ff1990911617905560068054600160a060020a031990811633908117909255600780549091169091179055604080517f454950373132446f6d61696e28737472696e67206e616d652c737472696e672081527f76657273696f6e2c75696e7432353620636861696e49642c61646472657373206020808301919091527f766572696679696e67436f6e74726163742900000000000000000000000000008284015291519081900360520181208751909288929182918401908083835b6020831061025c5780518252601f19909201916020918201910161023d565b51815160209384036101000a6000190180199092169116179052604051919093018190038120875190955087945090928392508401908083835b602083106102b55780518252601f199092019160209182019101610296565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019890985281840196909652606081019690965250608085018790523060a0808701919091528151808703909101815260c09095019081905284519093849350850191508083835b602083106103455780518252601f199092019160209182019101610326565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091206008555061041b975050505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106103c157805160ff19168380011785556103ee565b828001600101855582156103ee579182015b828111156103ee5782518255916020019190600101906103d3565b506103fa9291506103fe565b5090565b61041891905b808211156103fa5760008155600101610404565b90565b61011e8061042a6000396000f300608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416635c60da1b81146092575b6000604660cd565b905073ffffffffffffffffffffffffffffffffffffffff81161515606957600080fd5b60405136600082376000803683855af43d82016040523d6000833e808015608e573d83f35b3d83fd5b348015609d57600080fd5b5060a460cd565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54905600a165627a7a723058208aad6bf35cc5b16253ea60aec576a7756cca1c267f0ca8173295922922902ced0029608060405260405160208060218339810160405251600160a060020a038116ff00741ede137d0537e88e0ea0ff25b1f22d837903dbbee8980b4a06e8523247ee2603be2b2875cb41e0e77355e802a16769bb8dfcf825061cde185c73bf94f12625a165627a7a72305820cb455cd9e02bf99b1af11b2547ece47145955b01885b47f43434bbfaa43c66c20029