Contract Address Details

0x4dbDC634Ce3567c854607c73387664cd50E54a7e

Contract Name
RestStorage
Creator
0x195582–c8d801 at 0xe59771–607269
Balance
0 ROSE
Tokens
Fetching tokens...
Transactions
18 Transactions
Transfers
0 Transfers
Gas Used
9,646,845
Last Balance Update
4345262
Contract name:
RestStorage




Optimization enabled
true
Compiler version
v0.8.11+commit.d7f03943




Optimization runs
200
EVM Version
default




Verified at
2022-06-19 09:56:10.876200Z

Contract source code

pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract UserStorage is Ownable {
struct User {
address userAddr;
string avatar;
string email;
uint isOnline;
uint userFlag;
uint256 credit;
uint regTime;
TradeStats tradeStats;
MorgageStats morgageStats;
}
struct TradeStats {
uint256 tradeTotal;
uint256 restTotal;
}
struct MorgageStats {
uint256 mortgage;
uint256 freezeMortgage;
uint256 relieveMortgage;
uint256 inviteUserCount;
uint256 inviteUserReward;
uint applyRelieveTime;
uint handleRelieveTime;
}
mapping (address => User) public users;
mapping (address => uint256) public userIndex;
User[] public userList;
event addUser(address _userAddr);
event updateUser(string _avatar, string _email, uint _isOnline);
address _restCAddr;
address _orderCAddr;
address _recordCAddr;
address _appealCAddr;
modifier onlyAuthFromAddr() {
require(_restCAddr != address(0), 'Invalid address call rest');
require(_orderCAddr != address(0), 'Invalid address call order');
require(_recordCAddr != address(0), 'Invalid address call record');
require(_appealCAddr != address(0), 'Invalid address call appeal');
_;
}
function authFromContract(address _fromRest, address _fromOrder, address _fromRecord, address _fromAppeal) external onlyOwner {
_restCAddr = _fromRest;
_orderCAddr = _fromOrder;
_recordCAddr = _fromRecord;
_appealCAddr = _fromAppeal;
}
modifier onlyMemberOf() {
require(users[msg.sender].userAddr != address(0), 'has no permission');
_;
}
function _insert(address _addr) internal {
require(_addr != address(0), "UserStorage: addr null is not allowed");
require(users[_addr].userAddr == address(0), "UserStorage: current User exist");
TradeStats memory tradeStats = TradeStats({tradeTotal:0, restTotal:0});
MorgageStats memory morgageStats = MorgageStats({mortgage:0, freezeMortgage:0, relieveMortgage: 0, inviteUserCount:0, inviteUserReward:0, applyRelieveTime:0, handleRelieveTime:0});
User memory u = User({userAddr:_addr, avatar: '', email:'',
isOnline:1, userFlag:0, credit:0, regTime:block.timestamp,tradeStats:tradeStats, morgageStats:morgageStats});
users[_addr] = u;
userList.push(u);
userIndex[_addr] = userList.length -1;
emit addUser(_addr);
}
function _updateInfo(address _addr, string memory _avatar, string memory _email, uint _isOnline) internal {
require(_addr != address(0), "UserStorage: _addr null is not allowed");
require(users[_addr].userAddr != address(0), "UserStorage: current User not exist");
User memory u = users[_addr];
if(bytes(_avatar).length != 0){
u.avatar = _avatar;
}
if(bytes(_email).length != 0){
u.email = _email;
}
if(_isOnline != uint(0)){
u.isOnline = _isOnline;
}
users[_addr] = u;
userList[userIndex[_addr]] = u;
}
function _updateTradeStats(address _addr, TradeStats memory _tradeStats, uint _credit) internal {
require(_addr != address(0), "UserStorage: _addr null is not allowed");
require(users[_addr].userAddr != address(0), "UserStorage: current User not exist");
User memory u = users[_addr];
u.credit = _credit;
u.tradeStats.tradeTotal = _tradeStats.tradeTotal;
u.tradeStats.restTotal = _tradeStats.restTotal;
users[_addr] = u;
userList[userIndex[_addr]] = u;
}
function _updateMorgageStats(address _addr, MorgageStats memory _morgageStats) internal {
require(_addr != address(0), "UserStorage: _addr null is not allowed");
require(users[_addr].userAddr != address(0), "UserStorage: current User not exist");
User memory u = users[_addr];
u.morgageStats.mortgage = _morgageStats.mortgage;
u.morgageStats.freezeMortgage = _morgageStats.freezeMortgage;
u.morgageStats.relieveMortgage = _morgageStats.relieveMortgage;
u.morgageStats.inviteUserCount = _morgageStats.inviteUserCount;
u.morgageStats.inviteUserReward = _morgageStats.inviteUserReward;
u.morgageStats.applyRelieveTime = _morgageStats.applyRelieveTime;
u.morgageStats.handleRelieveTime = _morgageStats.handleRelieveTime;
users[_addr] = u;
userList[userIndex[_addr]] = u;
}
function _search(address _addr) internal view returns(User memory user) {
require(_addr != address(0), "UserStorage: _addr null is not allowed");
require(users[_addr].userAddr != address(0), "UserStorage: current User not exist");
User memory a = users[_addr];
return a;
}
function register() external {
require(!isMemberOf(), 'has registed');
_insert(msg.sender);
}
function isMemberOf() public view returns (bool) {
return (users[msg.sender].userAddr != address(0));
}
function updateInfo(string memory _avatar, string memory _email, uint _isOnline) onlyMemberOf external {
_updateInfo(msg.sender, _avatar, _email, _isOnline);
emit updateUser(_avatar, _email, _isOnline);
}
function updateTradeStats(address _addr, TradeStats memory _tradeStats, uint _credit) onlyAuthFromAddr public {
require(msg.sender == _restCAddr || msg.sender == _orderCAddr || msg.sender == _appealCAddr || msg.sender == _recordCAddr, 'UserStorage:Invalid from contract address');
_updateTradeStats(_addr, _tradeStats, _credit);
}
function updateMorgageStats(address _addr, MorgageStats memory _morgageStats) onlyAuthFromAddr public {
require(msg.sender == _recordCAddr, 'UserStorage:Invalid from contract address');
_updateMorgageStats(_addr, _morgageStats);
}
function updateUserRole(address _addr, uint _userFlag) onlyAuthFromAddr public {
require(msg.sender == _recordCAddr, 'UserStorage:Invalid from contract address');
require(_addr != address(0), "UserStorage: _addr null is not allowed");
require(users[_addr].userAddr != address(0), "UserStorage: current User not exist");
require(_userFlag<=3, 'UserStorage: Invalid userFlag 3');
User memory u = users[_addr];
u.userFlag = _userFlag;
users[_addr] = u;
userList[userIndex[_addr]] = u;
}
function searchUser(address _addr) external view returns(User memory user) {
return _search(_addr);
}
function searchUserList() external view returns(User[] memory) {
return userList;
}
}
abstract contract ReentrancyGuardRest {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
library CountersRest {
struct Counter {
uint256 _value;
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
{
if (counter._value == 0) {
counter._value = 10000;
}
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
{
counter._value = value - 1;
}
}
}
contract RestStorage is Ownable,ReentrancyGuardRest {
using CountersRest for CountersRest.Counter;
RecordInterface private _recordStorage;
UserInterface private _userStorage;
address recordAddress;
struct Rest {
address userAddr;
uint restNo;
uint restType;
string coinType;
string currencyType;
uint restCount;
uint price;
uint[] payType;
uint restStatus;
RestDetail restDetail;
}
struct RestDetail {
uint finishCount;
uint remainderCount;
uint limitAmountFrom;
uint limitAmountTo;
uint limitMinCredit;
uint limitMinMortgage;
string restRemark;
uint restTime;
uint updateTime;
uint restFee;
string restHash;
}
CountersRest.Counter private _restNoCounter;
mapping (uint => Rest) private rests;
mapping (uint => uint) private restIndex;
Rest[] private restList;
mapping(address=>mapping(uint=>uint)) restFrozenTotal;
event RestAdd(uint _restNo, uint _restType, string _coinType, string _currencyType, uint _restCount, uint _price, uint[] _payType,RestDetail _restDetail);
event RestUpdate(uint _restNo, string _coinType, string _currencyType, uint _restCount, uint _price,uint[] _payType, RestDetail _restDetail);
address _orderCAddr;
modifier onlyAuthFromAddr() {
require(_orderCAddr == msg.sender, 'Invalid contract address');
_;
}
function authFromContract(address _recordAddr, address _userAddr, address _orderAddr) external onlyOwner {
_orderCAddr = _orderAddr;
_recordStorage = RecordInterface(_recordAddr);
_userStorage = UserInterface(_userAddr);
recordAddress = _recordAddr;
_restNoCounter.increment();
}
modifier onlyRestOwner(uint _restNo) {
require(rests[_restNo].userAddr == msg.sender, "rest address not exist");
_;
}
function _checkParam(uint _restType, string memory _coinType, string memory _currencyType,
uint _restCount, uint _price, uint[] memory _payType) pure internal {
require(_restType != uint(0), "RestStorage: restType null is not allowed");
require(bytes(_coinType).length != 0, "RestStorage: coinType null is not allowed");
require(bytes(_currencyType).length != 0, "RestStorage: currencyType null is not allowed");
require(_restCount != uint(0), "RestStorage: restCount null is not allowed");
require(_price != uint(0), "RestStorage: price null is not allowed");
require(_payType.length != 0, "RestStorage: payType null is not allowed");
}
function _insert(uint _restType, string memory _coinType, string memory _currencyType,
uint _restCount, uint _price, uint[] memory _payType, RestDetail memory _restDetail) internal nonReentrant returns(uint){
_checkParam(_restType, _coinType, _currencyType, _restCount, _price, _payType);
uint _restNo = _restNoCounter.current();
require(rests[_restNo].restNo == uint(0), "rest exist");
_restDetail.finishCount = 0;
_restDetail.remainderCount = _restCount;
_restDetail.restTime = block.timestamp;
_restDetail.updateTime = 0;
if(_restDetail.limitAmountTo > SafeMath.mul(_restCount, _price) || _restDetail.limitAmountTo == 0) {
_restDetail.limitAmountTo = SafeMath.mul(_restCount, _price);
}
Rest memory r = Rest({userAddr: msg.sender, restNo: _restNo, restType:_restType,
coinType:_coinType, currencyType:_currencyType,
restCount:_restCount, price:_price,
payType:_payType, restStatus:1, restDetail: _restDetail});
rests[_restNo] = r;
restList.push(r);
restIndex[_restNo] = restList.length-1;
_restNoCounter.increment();
emit RestAdd(_restNo, _restType, _coinType, _currencyType, _restCount, _price, _payType, _restDetail);
return _restNo;
}
function _updateInfo(uint _restNo, string memory _coinType, string memory _currencyType,
uint _addCount, uint _price, uint[] memory _payType, RestDetail memory _restDetail) internal {
require(_restNo != uint(0), 'Invalid restNo');
Rest memory r = rests[_restNo];
r.restStatus = 1;
if(bytes(_coinType).length != 0){
r.coinType = _coinType;
}
if(bytes(_currencyType).length != 0){
r.currencyType = _currencyType;
}
if(_price != uint(0)){
r.price = _price;
}
if(_addCount != uint(0)){
r.restCount += _addCount;
r.restDetail.remainderCount += _addCount;
r.restDetail.limitAmountTo = SafeMath.mul(r.restDetail.remainderCount, r.price);
}
if(_payType.length != 0){
r.payType = _payType;
}
if(_restDetail.limitAmountFrom != uint(0)){
if(_restDetail.limitAmountFrom > r.restDetail.limitAmountTo) {
_restDetail.limitAmountFrom = r.restDetail.limitAmountTo;
}
r.restDetail.limitAmountFrom = _restDetail.limitAmountFrom;
}
if(_restDetail.limitMinCredit != uint(0)){
r.restDetail.limitMinCredit = _restDetail.limitMinCredit;
}
if(_restDetail.limitMinMortgage != uint(0)){
r.restDetail.limitMinMortgage = _restDetail.limitMinMortgage;
}
if(bytes(_restDetail.restRemark).length != 0){
r.restDetail.restRemark = _restDetail.restRemark;
}
if(_restDetail.restFee != uint(0)){
r.restDetail.restFee = _restDetail.restFee;
}
r.restDetail.updateTime = block.timestamp;
rests[_restNo] = r;
restList[restIndex[_restNo]] = r;
emit RestUpdate(_restNo, _coinType, _currencyType, r.restCount, _price, _payType, _restDetail);
}
function addBuyRest(uint _restType, string memory _coinType, string memory _currencyType,
uint _restCount, uint _price, uint[] memory _payType,RestDetail memory _restDetail) external {
require(_restType == 1, "must buy rest" );
UserStorage.User memory _user = _userStorage.searchUser(msg.sender);
bool _openTrade = _recordStorage.getOpenTrade();
require(_openTrade || _user.userFlag == 3, "invalid user" );
_insert(_restType, _coinType, _currencyType, _restCount, _price, _payType, _restDetail);
}
function _addSell(uint _restType, string memory _coinType, string memory _currencyType,
uint _restCount, uint _restFee, uint _price, uint[] memory _payType,RestDetail memory _restDetail) internal {
require(_restType == 2, "must sell rest" );
require(_restCount > 0, "restCount error");
UserStorage.User memory _user = _userStorage.searchUser(msg.sender);
bool _openTrade = _recordStorage.getOpenTrade();
require(_openTrade || _user.userFlag == 3, "invalid user" );
_recordStorage.addRecord(msg.sender, '', _coinType, _restCount, 2, 1, 2);
uint _needSub = SafeMath.add(_restCount, _restFee);
TokenTransfer _tokenTransfer = _recordStorage.getERC20Address(_coinType);
_tokenTransfer.transferFrom(msg.sender, recordAddress, _needSub);
uint _newRestNo = _insert(_restType, _coinType, _currencyType, _restCount, _price, _payType, _restDetail);
restFrozenTotal[msg.sender][_newRestNo] = _restCount;
}
function addSellRest(uint _restType, string memory _coinType, string memory _currencyType,
uint _restCount,uint _restFee, uint _price, uint[] memory _payType,RestDetail memory _restDetail) external {
_addSell(_restType, _coinType, _currencyType, _restCount,_restFee,_price, _payType, _restDetail);
}
function getRestFrozenTotal(address _addr, uint _restNo) public view returns(uint) {
return restFrozenTotal[_addr][_restNo];
}
function cancelBuyRest(uint _restNo) external onlyRestOwner(_restNo) {
require(rests[_restNo].restStatus == 1, "can't change this rest");
require(rests[_restNo].restType == 1, "Invalid rest type");
require(rests[_restNo].restDetail.finishCount < rests[_restNo].restCount, "this rest has finished");
Rest memory r = rests[_restNo];
r.restStatus = 4;
r.restDetail.updateTime = block.timestamp;
rests[_restNo] = r;
restList[restIndex[_restNo]] = r;
}
function _cancelSell(uint _restNo) onlyRestOwner(_restNo) internal {
require(rests[_restNo].restStatus == 1, "can't cancel this rest");
require(rests[_restNo].restType == 2, "Invalid rest type");
require(rests[_restNo].restDetail.finishCount < rests[_restNo].restCount, "this rest has finished");
require(restFrozenTotal[msg.sender][_restNo] > 0, "rest has finished");
uint _frozenTotal = _recordStorage.getFrozenTotal(msg.sender, rests[_restNo].coinType);
require(_frozenTotal >= restFrozenTotal[msg.sender][_restNo], "can't cancel this rest");
uint remainHoldCoin = restFrozenTotal[msg.sender][_restNo];
Rest memory r = rests[_restNo];
r.restStatus = 4;
if (remainHoldCoin < rests[_restNo].restCount) {
r.restStatus = 5;
}
r.restDetail.remainderCount = 0;
r.restDetail.updateTime = block.timestamp;
rests[_restNo] = r;
restList[restIndex[_restNo]] = r;
restFrozenTotal[msg.sender][_restNo] = 0;
_recordStorage.addAvailableTotal(msg.sender, rests[_restNo].coinType, remainHoldCoin);
}
function cancelSellRest(uint _restNo) external{
_cancelSell(_restNo);
}
function startOrStop(uint _restNo, uint _restStatus) external onlyRestOwner(_restNo){
require(_restStatus == 1 || _restStatus == 3, "Invalid rest status");
Rest memory r = rests[_restNo];
require(r.restStatus == 1 || r.restStatus == 3, "Invalid rest status,opt error");
r.restStatus = _restStatus;
r.restDetail.updateTime = block.timestamp;
rests[_restNo] = r;
restList[restIndex[_restNo]] = r;
}
function updateInfo(uint _restNo, string memory _coinType, string memory _currencyType,
uint _addCount, uint _restFee, uint _price,uint[] memory _payType, RestDetail memory _restDetail) external onlyRestOwner(_restNo){
require(_restNo != uint(0), 'Invalid restNo');
Rest memory _rest = rests[_restNo];
require(_rest.restNo != uint(0), 'rest not exist');
if (_rest.restType == 2) {
_recordStorage.addRecord(msg.sender, '', _coinType, _addCount, 2, 1, 2);
uint _needSub = SafeMath.add(_addCount, _restFee);
TokenTransfer _tokenTransfer = _recordStorage.getERC20Address(_coinType);
_tokenTransfer.transferFrom(msg.sender, recordAddress, _needSub);
restFrozenTotal[msg.sender][_restNo] += _addCount;
}
_updateInfo(_restNo, _coinType, _currencyType, _addCount, _price, _payType, _restDetail);
}
function updateRestFinishCount(uint _restNo, uint _finishCount) onlyAuthFromAddr external {
Rest memory _rest = rests[_restNo];
require(_rest.restDetail.remainderCount >= _finishCount, "RestStorage:finish count error");
if (_rest.restType == 2) {
restFrozenTotal[_rest.userAddr][_restNo] = SafeMath.sub(restFrozenTotal[_rest.userAddr][_restNo], _finishCount);
}
_rest.restDetail.finishCount = SafeMath.add(_rest.restDetail.finishCount, _finishCount);
_rest.restDetail.remainderCount = SafeMath.sub(_rest.restDetail.remainderCount, _finishCount);
_rest.restDetail.limitAmountTo = SafeMath.mul(_rest.price, _rest.restDetail.remainderCount);
if (_rest.restDetail.remainderCount == 0) {
_rest.restStatus = 2;
}
_rest.restDetail.updateTime = block.timestamp;
rests[_restNo] = _rest;
restList[restIndex[_restNo]] = _rest;
}
function addRestRemainCount(uint _restNo, uint _remainCount) onlyAuthFromAddr public {
Rest memory _rest = rests[_restNo];
require(_remainCount > 0 && _rest.restDetail.finishCount >= _remainCount, "count error");
if (_rest.restType == 2) {
restFrozenTotal[_rest.userAddr][_restNo] = SafeMath.add(restFrozenTotal[_rest.userAddr][_restNo], _remainCount);
}
_rest.restDetail.finishCount = SafeMath.sub(_rest.restDetail.finishCount, _remainCount);
_rest.restDetail.remainderCount = SafeMath.add(_rest.restDetail.remainderCount, _remainCount);
_rest.restDetail.limitAmountTo = SafeMath.mul(_rest.price, _rest.restDetail.remainderCount);
_rest.restDetail.limitAmountFrom = _rest.restDetail.limitAmountFrom > _rest.restDetail.limitAmountTo ? _rest.restDetail.limitAmountTo : _rest.restDetail.limitAmountFrom;
_rest.restStatus = 1;
_rest.restDetail.updateTime = block.timestamp;
rests[_restNo] = _rest;
restList[restIndex[_restNo]] = _rest;
}
function searchRest(uint _restNo) external view returns(Rest memory rest) {
require(_restNo != uint(0), "restNo null is not allowed");
Rest memory r = rests[_restNo];
return r;
}
function searchRestList() external view returns(Rest[] memory) {
return restList;
}
}
abstract contract ReentrancyGuardOrder {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
library CountersOrder {
struct Counter {
uint256 _value;
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
{
if (counter._value == 0) {
counter._value = 10000;
}
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
{
counter._value = value - 1;
}
}
}
contract OrderStorage is Ownable, ReentrancyGuardOrder {
using CountersOrder for CountersOrder.Counter;
RestStorage private _restStorage;
RecordInterface private _recordStorage;
UserInterface private _userStorage;
AppealInterface private _appealS;
address recordAddress;
struct Order {
address userAddr;
uint256 orderNo;
uint256 restNo;
uint256 coinCount;
uint256 orderAmount;
uint256 payType;
string currencyType;
uint256 orderType;
uint256 orderStatus;
OrderDetail orderDetail;
}
struct OrderDetail {
address buyerAddr;
address sellerAddr;
string coinType;
uint256 price;
uint256 tradeTime;
uint256 updateTime;
string tradeHash;
uint256 tradeFee;
}
CountersOrder.Counter private _orderNoCounter;
mapping(uint256 => Order) private orders;
mapping(uint256 => uint256) private orderIndex;
Order[] private orderList;
mapping(address => mapping(uint256 => uint256)) orderFrozenTotal;
uint256 cancelOrderTime = 30;
function setCancelOrderTime(uint256 _count) public onlyOwner {
cancelOrderTime = _count;
}
function getCancelOrderTime() public view returns (uint256) {
return cancelOrderTime;
}
uint256 canWithdrawHours = 24;
function setCanWithdrawHours(uint256 _count) public onlyOwner {
canWithdrawHours = _count;
}
function getCanWithdrawHours() public view returns (uint256) {
return canWithdrawHours;
}
event OrderAdd(
uint256 _orderNo,
uint256 _restNo,
uint256 _coinCount,
uint256 _tradeFee,
uint256 _orderAmount,
uint256 _payType,
uint256 _orderType,
address _buyerAddr,
address _sellerAddr
);
event OrderPaidMoney(uint256 _orderNo);
event OrderConfirmCollect(uint256 _orderNo);
event OrderCancel(uint256 _orderNo);
event OrderUpdateStatus(uint256 _orderNo, uint256 _orderStatus);
function authFromContract(
address _recordAddr,
address _restAddr,
address _userAddr,
address _appealAddr
) external onlyOwner {
_recordStorage = RecordInterface(_recordAddr);
_restStorage = RestStorage(_restAddr);
_userStorage = UserInterface(_userAddr);
recordAddress = _recordAddr;
_appealS = AppealInterface(_appealAddr);
_orderNoCounter.increment();
}
modifier onlyBuyer(uint256 _orderNo) {
require(_orderNo != uint256(0), "orderNo null");
require(
orders[_orderNo].orderDetail.buyerAddr == msg.sender,
"only buyer"
);
_;
}
modifier onlySeller(uint256 _orderNo) {
require(_orderNo != uint256(0), "orderNo null");
require(
orders[_orderNo].orderDetail.sellerAddr == msg.sender,
"only seller"
);
_;
}
modifier onlyBuyerOrSeller(uint256 _orderNo) {
require(_orderNo != uint256(0), "orderNo null");
require(
orders[_orderNo].orderDetail.sellerAddr == msg.sender ||
orders[_orderNo].orderDetail.buyerAddr == msg.sender,
"Only buyer or seller"
);
_;
}
function _checkParam(
uint256 _restNo,
uint256 _coinCount,
uint256 _orderAmount,
uint256 _payType
) internal pure {
require(_restNo != uint256(0), "restNo null");
require(_coinCount > 0, "coinCount null");
require(_orderAmount > 0, "orderAmount null");
require(_payType != uint256(0), "payType null");
}
function _insert(
uint256 _restNo,
uint256 _coinCount,
uint256 _tradeFee,
uint256 _orderAmount,
uint256 _payType,
uint256 _orderType,
address _buyerAddr,
address _sellerAddr
) internal nonReentrant returns (uint256 restNo) {
_checkParam(_restNo, _coinCount, _orderAmount, _payType);
RestStorage.Rest memory _rest = _restStorage.searchRest(_restNo);
require(_rest.userAddr != address(0), "rest not exist");
OrderDetail memory _orderDetail = OrderDetail({
buyerAddr: _buyerAddr,
sellerAddr: _sellerAddr,
coinType: _rest.coinType,
price: _rest.price,
tradeTime: block.timestamp,
updateTime: 0,
tradeHash: "",
tradeFee: _tradeFee
});
uint256 _orderNo = _orderNoCounter.current();
require(orders[_orderNo].orderNo == uint256(0), "order exist");
Order memory order = Order({
userAddr: msg.sender,
orderNo: _orderNo,
restNo: _restNo,
coinCount: _coinCount,
orderAmount: _orderAmount,
payType: _payType,
currencyType: _rest.currencyType,
orderType: _orderType,
orderStatus: 1,
orderDetail: _orderDetail
});
orders[_orderNo] = order;
orderList.push(order);
orderIndex[_orderNo] = orderList.length - 1;
if (_orderType == 2) {
orderFrozenTotal[msg.sender][_orderNo] = _coinCount;
} else if (_orderType == 1) {
orderFrozenTotal[_rest.userAddr][_orderNo] = _coinCount;
}
_orderNoCounter.increment();
emit OrderAdd(
_orderNo,
_restNo,
_coinCount,
_tradeFee,
_orderAmount,
_payType,
_orderType,
_buyerAddr,
_sellerAddr
);
return _orderNo;
}
function addBuyOrder(
uint256 _restNo,
uint256 _coinCount,
uint256 _orderAmount,
uint256 _payType
) external {
RestStorage.Rest memory _rest = _restStorage.searchRest(_restNo);
require(_rest.userAddr != msg.sender, "rest not exist");
require(_rest.restType == 2, "sell rest not exist");
require(_coinCount > 0 && _orderAmount > 0, "coin count error");
require(_rest.restStatus == 1, "rest status error");
UserStorage.User memory _currentUser = _userStorage.searchUser(
msg.sender
);
require(
_currentUser.userFlag != 1 && _currentUser.userFlag != 2,
"invalid user"
);
uint256 _restFrozen = _restStorage.getRestFrozenTotal(
_rest.userAddr,
_restNo
);
require(_restFrozen >= _coinCount, "coin not enough");
uint256 _amo = SafeMath.mul(_rest.price, _coinCount);
require(
_amo >= _rest.restDetail.limitAmountFrom &&
_amo <= _rest.restDetail.limitAmountTo,
"amount error"
);
require(
_currentUser.credit >= _rest.restDetail.limitMinCredit,
"credit error"
);
require(
_currentUser.morgageStats.mortgage >=
_rest.restDetail.limitMinMortgage,
"mortgage error"
);
_restStorage.updateRestFinishCount(_restNo, _coinCount);
_insert(
_restNo,
_coinCount,
0,
_orderAmount,
_payType,
1,
msg.sender,
_rest.userAddr
);
}
function addSellOrder(
uint256 _restNo,
uint256 _coinCount,
uint256 _tradeFee,
uint256 _orderAmount,
uint256 _payType
) external {
RestStorage.Rest memory _rest = _restStorage.searchRest(_restNo);
require(_rest.userAddr != msg.sender, "rest not exist");
require(_rest.restType == 1, "buy rest not exist");
require(_coinCount > 0, "coin count error");
require(_orderAmount > 0, "orderAmount error");
require(_rest.restStatus == 1, "rest status error");
uint256 _amo = SafeMath.mul(_rest.price, _coinCount);
require(
_amo >= _rest.restDetail.limitAmountFrom &&
_amo <= _rest.restDetail.limitAmountTo,
"amount error"
);
UserStorage.User memory _currentUser = _userStorage.searchUser(
msg.sender
);
require(
_currentUser.userFlag != 1 && _currentUser.userFlag != 2,
"invalid user"
);
require(
_currentUser.credit >= _rest.restDetail.limitMinCredit,
"credit error"
);
require(
_currentUser.morgageStats.mortgage >=
_rest.restDetail.limitMinMortgage,
"mortgage error"
);
uint256 _needSub = SafeMath.add(_coinCount, _tradeFee);
_restStorage.updateRestFinishCount(_restNo, _coinCount);
_insert(
_restNo,
_coinCount,
_tradeFee,
_orderAmount,
_payType,
2,
_rest.userAddr,
msg.sender
);
TokenTransfer _tokenTransfer = _recordStorage.getERC20Address(
_rest.coinType
);
_tokenTransfer.transferFrom(msg.sender, recordAddress, _needSub);
_recordStorage.addRecord(
msg.sender,
"",
_rest.coinType,
_coinCount,
2,
1,
2
);
}
function setPaidMoney(uint256 _orderNo)
external
onlyBuyer(_orderNo)
returns (bool)
{
_updateOrderStatus(_orderNo, 2);
emit OrderPaidMoney(_orderNo);
return true;
}
function confirmCollect(uint256 _orderNo) external onlySeller(_orderNo) {
require(_orderNo != uint256(0), "orderNo null");
Order memory _order = orders[_orderNo];
require(_order.orderStatus == 2, "Invalid order status");
require(
_order.orderDetail.buyerAddr != address(0),
"Invalid buyer address"
);
require(
orderFrozenTotal[msg.sender][_orderNo] >= _order.coinCount,
"coin not enough"
);
_updateOrderStatus(_orderNo, 3);
orderFrozenTotal[msg.sender][_orderNo] = 0;
uint256 _rc = _recordStorage.getTradeCredit();
UserStorage.User memory _user = _userStorage.searchUser(msg.sender);
uint256 _credit = _user.credit + _rc;
UserStorage.TradeStats memory _tradeStats = _user.tradeStats;
_tradeStats.tradeTotal += 1;
_userStorage.updateTradeStats(msg.sender, _tradeStats, _credit);
UserStorage.User memory _user2 = _userStorage.searchUser(
_order.orderDetail.buyerAddr
);
uint256 _credit2 = _user2.credit + _rc;
UserStorage.TradeStats memory _tradeStats2 = _user2.tradeStats;
_tradeStats2.tradeTotal += 1;
_userStorage.updateTradeStats(
_order.orderDetail.buyerAddr,
_tradeStats2,
_credit2
);
_recordStorage.subFrozenTotal(_orderNo, _order.orderDetail.buyerAddr);
emit OrderConfirmCollect(_orderNo);
}
function cancelOrder(uint256 _orderNo)
external
onlyBuyerOrSeller(_orderNo)
returns (bool)
{
Order memory _order = orders[_orderNo];
require(_order.orderNo != uint256(0), "current Order not exist");
require(_order.orderStatus == 1, "Can't cancel order");
if (_order.orderDetail.sellerAddr == msg.sender) {
require(
_order.orderDetail.tradeTime + cancelOrderTime * 1 minutes <
block.timestamp,
"limit"
);
}
RestStorage.Rest memory _rest = _restStorage.searchRest(_order.restNo);
if (_rest.restStatus == 4 || _rest.restStatus == 5) {
orderFrozenTotal[_order.orderDetail.sellerAddr][_orderNo] = 0;
_recordStorage.addAvailableTotal(
_order.orderDetail.sellerAddr,
_order.orderDetail.coinType,
_order.coinCount
);
} else {
if (_order.orderType == 2) {
orderFrozenTotal[_order.orderDetail.sellerAddr][_orderNo] = 0;
_recordStorage.addAvailableTotal(
_order.orderDetail.sellerAddr,
_order.orderDetail.coinType,
_order.coinCount
);
}
_restStorage.addRestRemainCount(_order.restNo, _order.coinCount);
}
_updateOrderStatus(_orderNo, 4);
emit OrderCancel(_orderNo);
return true;
}
function takeCoin(uint256 _o) external onlyBuyerOrSeller(_o) {
AppealStorage.Appeal memory _appeal = _appealS.searchAppeal(_o);
require(
block.timestamp - _appeal.detail.witnessHandleTime >
canWithdrawHours * 1 hours,
"time error"
);
address _win;
if (_appeal.user == _appeal.buyer) {
if (_appeal.status == 2) {
_win = _appeal.buyer;
} else if (_appeal.status == 3) {
_win = _appeal.seller;
}
} else {
if (_appeal.status == 2) {
_win = _appeal.seller;
} else if (_appeal.status == 3) {
_win = _appeal.buyer;
}
}
require(_win == msg.sender, "opt error");
_updateOrderStatus(_o, 5);
orderFrozenTotal[_appeal.seller][_o] = 0;
_recordStorage.subFrozenTotal(_o, msg.sender);
}
function _updateOrderStatus(uint256 _orderNo, uint256 _orderStatus)
internal
onlyBuyerOrSeller(_orderNo)
{
Order memory order = orders[_orderNo];
require(order.orderNo != uint256(0), "current Order not exist");
require(_orderStatus >= 1 && _orderStatus <= 5, "Invalid order status");
if (_orderStatus == 2 && order.orderStatus != 1) {
revert("Invalid order status 2");
}
if (_orderStatus == 3 && order.orderStatus != 2) {
revert("Invalid order status 3");
}
if (_orderStatus == 4 && order.orderStatus != 1) {
revert("Invalid order status 4");
}
if (
_orderStatus == 5 &&
order.orderStatus != 1 &&
order.orderStatus != 2
) {
revert("Invalid order status 5");
}
if (_orderStatus == 2) {
require(
order.orderDetail.buyerAddr == msg.sender,
"only buyer call"
);
}
if (_orderStatus == 3) {
require(
order.orderDetail.sellerAddr == msg.sender,
"only seller call"
);
}
order.orderStatus = _orderStatus;
order.orderDetail.updateTime = block.timestamp;
orders[_orderNo] = order;
orderList[orderIndex[_orderNo]] = order;
emit OrderUpdateStatus(_orderNo, _orderStatus);
}
function searchOrder(uint256 _orderNo)
external
view
returns (Order memory order)
{
require(_orderNo != uint256(0), "orderNo null");
require(
orders[_orderNo].orderNo != uint256(0),
"current Order not exist"
);
Order memory o = orders[_orderNo];
return o;
}
function searchOrderList() external view returns (Order[] memory) {
return orderList;
}
function searchListByRest(uint256 _restNo)
external
view
returns (Order[] memory)
{
Order[] memory resultList = new Order[](orderList.length);
for (uint256 i = 0; i < orderList.length; i++) {
Order memory _order = orderList[i];
if (_order.restNo == _restNo) {
resultList[i] = _order;
}
}
return resultList;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
contract AppealStorage {
OrderInterface private _oSt;
RecordInterface private _rSt;
UserInterface private _uSt;
address recAddr;
struct Appeal {
address user;
uint256 appealNo;
uint256 orderNo;
address witness;
address buyer;
address seller;
uint256 mortgage;
uint256 status;
uint256 appealTime;
uint256 witTakeTime;
uint256 obTakeTime;
AppealDetail detail;
}
struct AppealDetail {
address finalAppealAddr;
uint256 updateTime;
string witnessReason;
uint256 witnessAppealStatus;
string observerReason;
uint256 witnessHandleTime;
uint256 observerHandleTime;
address observerAddr;
uint256 witnessHandleReward;
uint256 observerHandleReward;
uint256 witnessHandleCredit;
uint256 observerHandleCredit;
uint256 witReward;
uint256 witSub;
uint256 witCreditR;
uint256 witCreditS;
}
mapping(uint256 => Appeal) public appeals;
mapping(uint256 => uint256) public appealIndex;
Appeal[] public appealList;
event addAppeal(uint256 _appealNo, uint256 _orderNo);
constructor(
address _r,
address _o,
address _u
) {
_rSt = RecordInterface(_r);
_oSt = OrderInterface(_o);
_uSt = UserInterface(_u);
recAddr = _r;
}
modifier onlyWit(uint256 _o) {
Appeal memory _al = appeals[_o];
require(_al.witness == msg.sender);
require(_al.buyer != msg.sender && _al.seller != msg.sender);
_;
}
modifier onlyOb(uint256 _o) {
Appeal memory _al = appeals[_o];
require(_al.detail.observerAddr == msg.sender);
require(_al.buyer != msg.sender && _al.seller != msg.sender);
_;
}
modifier onlyBOS(uint256 _o) {
OrderStorage.Order memory _r = _oSt.searchOrder(_o);
require(
_r.orderDetail.sellerAddr == msg.sender ||
_r.orderDetail.buyerAddr == msg.sender
);
_;
}
function _insert(uint256 _o, uint256 _count) internal {
OrderStorage.Order memory _or = _oSt.searchOrder(_o);
require(appeals[_o].appealNo == uint256(0));
AppealDetail memory _detail = AppealDetail({
finalAppealAddr: address(0),
updateTime: uint256(0),
witnessReason: "",
observerReason: "",
witnessAppealStatus: 0,
witnessHandleTime: uint256(0),
observerHandleTime: uint256(0),
observerAddr: address(0),
witnessHandleReward: 0,
observerHandleReward: 0,
witnessHandleCredit: 0,
observerHandleCredit: 0,
witReward: 0,
witSub: 0,
witCreditR: 0,
witCreditS: 0
});
uint256 _appealNo = block.timestamp;
Appeal memory _appeal = Appeal({
user: msg.sender,
appealNo: _appealNo,
orderNo: _o,
witness: address(0),
buyer: _or.orderDetail.buyerAddr,
seller: _or.orderDetail.sellerAddr,
mortgage: _count,
status: 1,
appealTime: block.timestamp,
witTakeTime: 0,
obTakeTime: 0,
detail: _detail
});
appeals[_o] = _appeal;
appealList.push(_appeal);
appealIndex[_o] = appealList.length - 1;
chanT(_or.orderDetail.sellerAddr, _or.orderDetail.buyerAddr, 1, 0);
emit addAppeal(_appealNo, _o);
}
function chanT(
address _seller,
address _buyer,
uint256 _t,
uint256 _r
) internal {
uint256 _tc = _rSt.getTradeCredit();
uint256 _rs = _rSt.getSubTCredit();
UserStorage.User memory _user = _uSt.searchUser(_seller);
UserStorage.TradeStats memory _tr = _user.tradeStats;
UserStorage.User memory _user2 = _uSt.searchUser(_buyer);
UserStorage.TradeStats memory _tr2 = _user2.tradeStats;
uint256 _c2 = _user2.credit;
uint256 _c = _user.credit;
if (_t == 1) {
_tr.tradeTotal = _tr.tradeTotal > 0 ? (_tr.tradeTotal - 1) : 0;
_tr2.tradeTotal = _tr2.tradeTotal > 0 ? (_tr2.tradeTotal - 1) : 0;
_c = (_c >= _tc) ? (_c - _tc) : 0;
_c2 = (_c2 >= _tc) ? (_c2 - _tc) : 0;
} else if (_t == 2) {
_tr.tradeTotal += 1;
_tr2.tradeTotal += 1;
if (_r == 1) {
_c += _tc;
_c2 = (_c2 >= _rs) ? (_c2 - _rs) : 0;
} else if (_r == 2) {
_c2 += _tc;
_c = (_c >= _rs) ? (_c - _rs) : 0;
}
}
_uSt.updateTradeStats(_seller, _tr, _c);
_uSt.updateTradeStats(_buyer, _tr2, _c2);
}
function applyAppeal(uint256 _o) external onlyBOS(_o) {
uint256 _fee = _rSt.getAppealFee();
_insert(_o, _fee);
TokenTransfer _tokenTransfer = _rSt.getERC20Address("wROSE");
_tokenTransfer.transferFrom(msg.sender, recAddr, _fee);
}
function takeWit(uint256 _o) external {
Appeal memory _al = appeals[_o];
require(_al.buyer != msg.sender && _al.seller != msg.sender);
require(_al.witness == address(0));
require(_al.status == 1);
bool _f = witOrOb(1);
require(_f);
_al.witness = msg.sender;
_al.witTakeTime = block.timestamp;
appeals[_o] = _al;
appealList[appealIndex[_o]] = _al;
}
function takeOb(uint256 _o) external {
Appeal memory _al = appeals[_o];
require(_al.buyer != msg.sender && _al.seller != msg.sender);
require(_al.status == 4 || _al.status == 5);
require(_al.detail.observerAddr == address(0));
bool _f = witOrOb(2);
require(_f);
_al.detail.observerAddr = msg.sender;
_al.obTakeTime = block.timestamp;
appeals[_o] = _al;
appealList[appealIndex[_o]] = _al;
}
function changeHandler(uint256 _o, uint256 _type) external onlyBOS(_o) {
Appeal memory _al = appeals[_o];
if (_type == 1) {
require(_al.status == 1);
require(_al.witness != address(0));
require(block.timestamp - _al.witTakeTime > 24 hours);
_al.witness = address(0);
_al.witTakeTime = 0;
} else if (_type == 2) {
require(_al.status == 4 || _al.status == 5);
require(_al.detail.observerAddr != address(0));
require(block.timestamp - _al.obTakeTime > 24 hours);
_al.detail.observerAddr = address(0);
_al.obTakeTime = 0;
}
appeals[_o] = _al;
appealList[appealIndex[_o]] = _al;
}
function witOrOb(uint256 _f) internal view returns (bool) {
UserStorage.User memory _u = _uSt.searchUser(msg.sender);
if (_u.userFlag == _f) {
return true;
}
return false;
}
function applyFinal(uint256 _o) external onlyBOS(_o) {
Appeal memory _al = appeals[_o];
require(_al.status == 2 || _al.status == 3);
require(block.timestamp - _al.detail.witnessHandleTime <= 24 hours);
chanT(_al.seller, _al.buyer, 1, 0);
uint256 _fee = _rSt.getAppealFeeFinal();
TokenTransfer _tokenTransfer = _rSt.getERC20Address("wROSE");
_tokenTransfer.transferFrom(msg.sender, recAddr, _fee);
if (_al.status == 2) {
_al.status = 4;
} else if (_al.status == 3) {
_al.status = 5;
}
_al.detail.finalAppealAddr = msg.sender;
_al.detail.updateTime = block.timestamp;
appeals[_o] = _al;
appealList[appealIndex[_o]] = _al;
}
function witnessOpt(
uint256 _o,
string memory _r,
uint256 _s
) external onlyWit(_o) {
require(_s == 2 || _s == 3);
Appeal memory _al = appeals[_o];
require(_al.status == 1);
uint256 _fee = _rSt.getAppealFee();
uint256 _rcedit = _rSt.getWitnessHandleCredit();
_al.status = _s;
_al.detail.witnessAppealStatus = _s;
_al.detail.witnessReason = _r;
_al.detail.witnessHandleTime = block.timestamp;
_al.detail.witnessHandleReward = _fee;
_al.detail.witnessHandleCredit = _rcedit;
_al.detail.witReward = _fee;
_al.detail.witCreditR = _rcedit;
_al.detail.updateTime = block.timestamp;
appeals[_o] = _al;
appealList[appealIndex[_o]] = _al;
if (_s == 2) {
if (_al.user == _al.buyer) {
_rSt.subAvaAppeal(_al.seller, _al.buyer, _al, _fee, 1, 0);
chanT(_al.seller, _al.buyer, 2, 2);
} else if (_al.user == _al.seller) {
_rSt.subAvaAppeal(_al.buyer, _al.seller, _al, _fee, 1, 0);
chanT(_al.seller, _al.buyer, 2, 1);
}
}
if (_s == 3) {
if (_al.user == _al.buyer) {
_rSt.subAvaAppeal(_al.buyer, _al.seller, _al, _fee, 1, 1);
chanT(_al.seller, _al.buyer, 2, 1);
} else if (_al.user == _al.seller) {
_rSt.subAvaAppeal(_al.seller, _al.buyer, _al, _fee, 1, 1);
chanT(_al.seller, _al.buyer, 2, 2);
}
}
}
function observerOpt(
uint256 _o,
string memory _r,
uint256 _s
) external onlyOb(_o) {
require(_s == 6 || _s == 7);
Appeal memory _appeal = appeals[_o];
require(_appeal.status == 4 || _appeal.status == 5);
uint256 _fee = _rSt.getAppealFeeFinal();
uint256 _rcedit = _rSt.getObserverHandleCredit();
_appeal.status = _s;
_appeal.detail.observerReason = _r;
_appeal.detail.observerHandleTime = block.timestamp;
_appeal.detail.observerHandleReward = _fee;
_appeal.detail.observerHandleCredit = _rcedit;
uint256 _subWC = _rSt.getSubWitCredit();
uint256 _subWF = _rSt.getSubWitFee();
if (_s == 6) {
if (_appeal.user == _appeal.buyer) {
_rSt.subAvaAppeal(
_appeal.seller,
_appeal.buyer,
_appeal,
_fee,
2,
0
);
chanT(_appeal.seller, _appeal.buyer, 2, 2);
_rSt.subFrozenTotal(_o, _appeal.buyer);
} else if (_appeal.user == _appeal.seller) {
_rSt.subAvaAppeal(
_appeal.buyer,
_appeal.seller,
_appeal,
_fee,
2,
0
);
chanT(_appeal.seller, _appeal.buyer, 2, 1);
_rSt.subFrozenTotal(_o, _appeal.seller);
}
if (_appeal.detail.witnessAppealStatus == 3) {
_appeal.detail.witSub = _subWF;
_appeal.detail.witCreditS = _subWC;
if (_appeal.detail.witnessHandleCredit >= _subWC) {
_appeal.detail.witnessHandleCredit = SafeMath.sub(
_appeal.detail.witnessHandleCredit,
_subWC
);
} else {
_appeal.detail.witnessHandleCredit = 0;
}
_rSt.subWitnessAvailable(_appeal.witness);
}
}
if (_s == 7) {
if (_appeal.user == _appeal.buyer) {
_rSt.subAvaAppeal(
_appeal.buyer,
_appeal.seller,
_appeal,
_fee,
2,
1
);
chanT(_appeal.seller, _appeal.buyer, 2, 1);
_rSt.subFrozenTotal(_o, _appeal.seller);
} else if (_appeal.user == _appeal.seller) {
_rSt.subAvaAppeal(
_appeal.seller,
_appeal.buyer,
_appeal,
_fee,
2,
1
);
chanT(_appeal.seller, _appeal.buyer, 2, 2);
_rSt.subFrozenTotal(_o, _appeal.buyer);
}
if (_appeal.detail.witnessAppealStatus == 2) {
_appeal.detail.witSub = _subWF;
_appeal.detail.witCreditS = _subWC;
if (_appeal.detail.witnessHandleCredit >= _subWC) {
_appeal.detail.witnessHandleCredit = SafeMath.sub(
_appeal.detail.witnessHandleCredit,
_subWC
);
} else {
_appeal.detail.witnessHandleCredit = 0;
}
_rSt.subWitnessAvailable(_appeal.witness);
}
}
_appeal.detail.updateTime = block.timestamp;
appeals[_o] = _appeal;
appealList[appealIndex[_o]] = _appeal;
}
function searchAppeal(uint256 _o)
external
view
returns (Appeal memory appeal)
{
return appeals[_o];
}
function searchAppealList() external view returns (Appeal[] memory) {
return appealList;
}
}
interface RecordInterface {
function getErcBalance(string memory _coinType, address _addr)
external
returns (uint256);
function getAvailableTotal(address _addr, string memory _coinType)
external
returns (uint256);
function getFrozenTotal(address _addr, string memory _coinType)
external
returns (uint256);
function addAvailableTotal(
address _addr,
string memory _coinType,
uint256 remainHoldCoin
) external;
function subAvaAppeal(
address _from,
address _to,
AppealStorage.Appeal memory _al,
uint256 _amt,
uint256 _type,
uint256 _self
) external;
function subWitnessAvailable(address _addr) external;
function getERC20Address(string memory _coinType)
external
returns (TokenTransfer);
function subFrozenTotal(uint256 _orderNo, address _addr) external;
function addRecord(
address _addr,
string memory _tradeHash,
string memory _coinType,
uint256 _hostCount,
uint256 _hostStatus,
uint256 _hostType,
uint256 _hostDirection
) external;
function getAppealFee() external view returns (uint256);
function getAppealFeeFinal() external view returns (uint256);
function getWitnessHandleReward() external view returns (uint256);
function getObserverHandleReward() external view returns (uint256);
function getWitnessHandleCredit() external view returns (uint256);
function getObserverHandleCredit() external view returns (uint256);
function getSubWitCredit() external view returns (uint256);
function getOpenTrade() external view returns (bool);
function getTradeCredit() external view returns (uint256);
function getSubTCredit() external view returns (uint256);
function getSubWitFee() external view returns (uint256);
}
interface RestInterface {
function searchRest(uint256 _restNo)
external
returns (RestStorage.Rest memory rest);
function getRestFrozenTotal(address _addr, uint256 _restNo)
external
returns (uint256);
function updateRestFinishCount(uint256 _restNo, uint256 _coinCount)
external
returns (uint256);
function addRestRemainCount(uint256 _restNo, uint256 _remainCount)
external
returns (uint256);
}
interface OrderInterface {
function searchOrder(uint256 _orderNo)
external
returns (OrderStorage.Order memory order);
}
interface UserInterface {
function searchUser(address _addr)
external
view
returns (UserStorage.User memory user);
function searchWitnessList(uint256 _userFlag)
external
returns (UserStorage.User[] memory userList);
function updateTradeStats(
address _addr,
UserStorage.TradeStats memory _tradeStats,
uint256 _credit
) external;
function updateMorgageStats(
address _addr,
UserStorage.MorgageStats memory _morgageStats
) external;
function updateUserRole(address _addr, uint256 _userFlag) external;
}
interface AppealInterface {
function searchAppeal(uint256 _o)
external
view
returns (AppealStorage.Appeal memory appeal);
}
abstract contract ReentrancyGuardRecord {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
library CountersRecord {
struct Counter {
uint256 _value;
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
{
if (counter._value == 0) {
counter._value = 10000;
}
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
{
counter._value = value - 1;
}
}
}
interface TokenTransfer {
function transfer(address recipient, uint256 amount) external;
function balanceOf(address account) external view returns (uint256);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external;
function allowance(address _owner, address _spender)
external
view
returns (uint256 remaining);
}
contract RecordStorage is Ownable, ReentrancyGuardRecord {
using CountersRecord for CountersRecord.Counter;
string constant P_COIN = 'wROSE';
mapping(string => address) coinTypeMaping;
uint256 merchantNeedCount = 100 * (10**18);
uint256 witnessNeedCount = 1000 * (10**18);
uint256 congressNeedCount = 10000 * (10**18);
uint256 appealFee = 100 * (10**18);
uint256 appealFeeFinal = 1000 * (10**18);
uint256 canWithdrawToTime = 28;
uint256 subWitFee = 100 * (10**18);
uint256 subWitCredit = 10;
uint256 witnessHandleReward = 100 * (10**18);
uint256 observerHandleReward = 1000 * (10**18);
uint256 witnessHandleCredit = 1;
uint256 observerHandleCredit = 1;
bool openTrade = false;
uint256 tradeCredit = 1;
uint256 subTCredit = 10;
mapping(address => uint256) witnessFlag;
mapping(address => uint256) congressFlag;
function setWitnessFlag(address _addr, uint256 _flag) external onlyOwner {
witnessFlag[_addr] = _flag;
if (_flag == 1) {
uint256 _amt = availableTotal[_addr][P_COIN];
require(_amt >= witnessNeedCount, "coin not enough");
_userStorage.updateUserRole(_addr, 1);
} else {
_userStorage.updateUserRole(_addr, 0);
}
}
function getWitnessFlag(address _addr) public view returns (uint256) {
return witnessFlag[_addr];
}
function setCongressFlag(address _addr, uint256 _flag) external onlyOwner {
congressFlag[_addr] = _flag;
if (_flag == 1) {
uint256 _amt = availableTotal[_addr][P_COIN];
require(_amt >= congressNeedCount, "coin not enough");
_userStorage.updateUserRole(_addr, 2);
} else {
_userStorage.updateUserRole(_addr, 0);
}
}
function getCongressFlag(address _addr) public view returns (uint256) {
return congressFlag[_addr];
}
function setCoinTypeMapping(
string calldata _coinType,
address _coinTypeAddr
) external onlyOwner {
coinTypeMaping[_coinType] = _coinTypeAddr;
}
function getCoinTypeMapping(string calldata _coinType)
public
view
returns (address)
{
return coinTypeMaping[_coinType];
}
function setMerchantNeedCount(uint256 _count) external onlyOwner {
merchantNeedCount = _count;
}
function getMerchantNeedCount() public view returns (uint256) {
return merchantNeedCount;
}
function setWitnessNeedCount(uint256 _count) external onlyOwner {
witnessNeedCount = _count;
}
function getWitnessNeedCount() public view returns (uint256) {
return witnessNeedCount;
}
function setCongressNeedCount(uint256 _count) external onlyOwner {
congressNeedCount = _count;
}
function getCongressNeedCount() public view returns (uint256) {
return congressNeedCount;
}
function setAppealFee(uint256 _count) external onlyOwner {
appealFee = _count;
}
function getAppealFee() public view returns (uint256) {
return appealFee;
}
function setAppealFeeFinal(uint256 _count) external onlyOwner {
appealFeeFinal = _count;
}
function getAppealFeeFinal() public view returns (uint256) {
return appealFeeFinal;
}
function setCanWithdrawToTime(uint256 _days) external onlyOwner {
canWithdrawToTime = _days;
}
function getCanWithdrawToTime() public view returns (uint256) {
return canWithdrawToTime;
}
function setSubWitFee(uint256 _c) external onlyOwner {
subWitFee = _c;
}
function getSubWitFee() public view returns (uint256) {
return subWitFee;
}
function setSubWitCredit(uint256 _c) external onlyOwner {
subWitCredit = _c;
}
function getSubWitCredit() public view returns (uint256) {
return subWitCredit;
}
function setWitnessHandleReward(uint256 _c) external onlyOwner {
witnessHandleReward = _c;
}
function getWitnessHandleReward() public view returns (uint256) {
return witnessHandleReward;
}
function setObserverHandleReward(uint256 _c) external onlyOwner {
observerHandleReward = _c;
}
function getObserverHandleReward() public view returns (uint256) {
return observerHandleReward;
}
function setWitnessHandleCredit(uint256 _c) external onlyOwner {
witnessHandleCredit = _c;
}
function getWitnessHandleCredit() public view returns (uint256) {
return witnessHandleCredit;
}
function setObserverHandleCredit(uint256 _c) external onlyOwner {
observerHandleCredit = _c;
}
function getObserverHandleCredit() public view returns (uint256) {
return observerHandleCredit;
}
function setOpenTrade(bool _c) external onlyOwner {
openTrade = _c;
}
function getOpenTrade() public view returns (bool) {
return openTrade;
}
function setTradeCredit(uint256 _c) external onlyOwner {
tradeCredit = _c;
}
function getTradeCredit() public view returns (uint256) {
return tradeCredit;
}
function setSubTCredit(uint256 _c) external onlyOwner {
subTCredit = _c;
}
function getSubTCredit() public view returns (uint256) {
return subTCredit;
}
function punishPerson(
address _from,
address _to,
uint256 _count
) external onlyOwner {
require(_from != address(0) && _to != address(0));
UserStorage.User memory _user = _userStorage.searchUser(_from);
require(_user.userFlag == 1 || _user.userFlag == 2, "can't punish");
uint256 _ava = availableTotal[_from][P_COIN];
uint256 _toavailab = availableTotal[_to][P_COIN];
if (_ava >= _count) {
availableTotal[_from][P_COIN] = SafeMath.sub(_ava, _count);
availableTotal[_to][P_COIN] = SafeMath.add(_toavailab, _count);
} else {
availableTotal[_from][P_COIN] = 0;
uint256 _draing = withdrawingTotal[_from][P_COIN];
if (SafeMath.add(_ava, _draing) >= _count) {
withdrawingTotal[_from][P_COIN] = SafeMath.sub(
_draing,
SafeMath.sub(_count, _ava)
);
availableTotal[_to][P_COIN] = SafeMath.add(_toavailab, _count);
} else {
withdrawingTotal[_from][P_COIN] = 0;
availableTotal[_to][P_COIN] = SafeMath.add(
_toavailab,
SafeMath.add(_ava, _draing)
);
}
}
chanRole(_from);
chanRole(_to);
}
UserInterface private _userStorage;
OrderInterface private _orderStorage;
struct Record {
uint256 recordNo;
address userAddr;
string tradeHash;
string coinType;
uint256 hostCount;
uint256 hostStatus;
uint256 hostType;
uint256 hostDirection;
uint256 hostTime;
uint256 updateTime;
}
CountersRecord.Counter private _recordNoCounter;
mapping(uint256 => Record) public records;
mapping(uint256 => uint256) public recordIndex;
Record[] public recordList;
mapping(address => mapping(string => uint256)) public availableTotal;
mapping(address => mapping(string => uint256)) public frozenTotal;
mapping(address => mapping(string => uint256)) public unfrozenTotal;
mapping(address => uint256) lastWithdrawTime;
mapping(address => mapping(uint256 => uint256)) lastWithdrawAmount;
mapping(address => mapping(string => uint256)) public withdrawingTotal;
mapping(address => mapping(uint256 => uint256)) orderSubFrozenList;
constructor(
address _usdtAddress,
address _usdcAddress,
address _coinAddress
) {
coinTypeMaping["USDT"] = _usdtAddress;
coinTypeMaping["USDC"] = _usdcAddress;
coinTypeMaping[P_COIN] = _coinAddress;
_recordNoCounter.increment();
}
function getERC20Address(string memory _coinType)
public
view
returns (TokenTransfer)
{
address _remoteAddr = coinTypeMaping[_coinType];
require(_remoteAddr != address(0));
TokenTransfer _tokenTransfer = TokenTransfer(_remoteAddr);
return _tokenTransfer;
}
event RecordAdd(
uint256 _recordNo,
address _addr,
string _tradeHash,
string _coinType,
uint256 _hostCount,
uint256 _hostStatus,
uint256 _hostType,
uint256 _hostDirection
);
event RecordApplyUnfrozen(address _addr, uint256 _amt);
event UnfrozenTotalTransfer(
address _addr,
string _coinType,
uint256 _lastAmount
);
event RecordUpdate(
address _addr,
uint256 _recordNo,
string _hash,
uint256 _hostStatus
);
address _userAddr;
address _restCAddr;
address _orderCAddr;
address _appealCAddr;
modifier onlyAuthFromAddr() {
require(_userAddr != address(0), "Invalid address call user");
require(_restCAddr != address(0), "Invalid address call rest");
require(_orderCAddr != address(0), "Invalid address call order");
require(_appealCAddr != address(0), "Invalid address call appeal");
_;
}
function authFromContract(
address _fromUser,
address _fromRest,
address _fromOrder,
address _fromAppeal
) external onlyOwner {
_userAddr = _fromUser;
_restCAddr = _fromRest;
_orderCAddr = _fromOrder;
_appealCAddr = _fromAppeal;
_userStorage = UserInterface(_userAddr);
_orderStorage = OrderInterface(_orderCAddr);
}
function _insert(
address _addr,
string memory _tradeHash,
string memory _coinType,
uint256 _hostCount,
uint256 _hostStatus,
uint256 _hostType,
uint256 _hostDirection
) internal nonReentrant returns (uint256 recordNo) {
require(_addr != address(0), "address null");
require(bytes(_coinType).length != 0, "coinType null");
require(_hostCount != uint256(0), "hostCount null");
require(_hostType != uint256(0), "hostType null");
require(_hostDirection != uint256(0), "hostDirection null");
uint256 _recordNo = _recordNoCounter.current();
require(records[_recordNo].recordNo == uint256(0), "order exist");
Record memory _record = Record({
recordNo: _recordNo,
userAddr: _addr,
tradeHash: _tradeHash,
coinType: _coinType,
hostCount: _hostCount,
hostStatus: _hostStatus,
hostType: _hostType,
hostDirection: _hostDirection,
hostTime: block.timestamp,
updateTime: 0
});
records[_recordNo] = _record;
recordList.push(_record);
recordIndex[_recordNo] = recordList.length - 1;
_recordNoCounter.increment();
emit RecordAdd(
_recordNo,
_addr,
_tradeHash,
_coinType,
_hostCount,
_hostStatus,
_hostType,
_hostDirection
);
return _recordNo;
}
function tokenEscrow(string memory _coinType, uint256 _amt) external {
require(_amt > 0, "invalid");
require(
availableTotal[msg.sender][_coinType] + _amt >
availableTotal[msg.sender][_coinType],
"Invalid transfer amount"
);
availableTotal[msg.sender][_coinType] = SafeMath.add(
availableTotal[msg.sender][_coinType],
_amt
);
uint256 _hostType = 1;
if (
keccak256(abi.encodePacked(_coinType)) ==
keccak256(abi.encodePacked(P_COIN))
) {
_hostType = 2;
UserStorage.User memory _user = _userStorage.searchUser(msg.sender);
_changeUserMorgageStats(
msg.sender,
availableTotal[msg.sender][_coinType]
);
if (
_user.userFlag == 0 &&
availableTotal[msg.sender][_coinType] >= merchantNeedCount
) {
_userStorage.updateUserRole(msg.sender, 3);
}
}
_insert(msg.sender, "", _coinType, _amt, 2, _hostType, 1);
TokenTransfer _tokenTransfer = getERC20Address(_coinType);
_tokenTransfer.transferFrom(msg.sender, address(this), _amt);
}
function addRecord(
address _addr,
string memory _tradeHash,
string memory _coinType,
uint256 _hostCount,
uint256 _hostStatus,
uint256 _hostType,
uint256 _hostDirection
) public onlyAuthFromAddr {
require(
msg.sender == _restCAddr || msg.sender == _orderCAddr,
"RedocrdStorage:Invalid from contract address"
);
frozenTotal[_addr][_coinType] = SafeMath.add(
frozenTotal[_addr][_coinType],
_hostCount
);
_insert(
_addr,
_tradeHash,
_coinType,
_hostCount,
_hostStatus,
_hostType,
_hostDirection
);
}
function addAvailableTotal(
address _addr,
string memory _coinType,
uint256 _amt
) public onlyAuthFromAddr {
require(
msg.sender == _restCAddr || msg.sender == _orderCAddr,
"Invalid address"
);
require(_amt > 0, "invalid");
uint256 _aBalance = getErcBalance(_coinType, address(this));
require(_aBalance >= _amt, "not enough");
require(frozenTotal[_addr][_coinType] >= _amt, "insufficient");
require(
SafeMath.sub(frozenTotal[_addr][_coinType], _amt) <=
frozenTotal[_addr][_coinType],
"Invalid amount"
);
frozenTotal[_addr][_coinType] = SafeMath.sub(
frozenTotal[_addr][_coinType],
_amt
);
TokenTransfer _tokenTransfer = getERC20Address(_coinType);
_tokenTransfer.transfer(_addr, _amt);
}
function getAvailableTotal(address _addr, string memory _coinType)
public
view
returns (uint256)
{
return availableTotal[_addr][_coinType];
}
function subFrozenTotal(uint256 _orderNo, address _addr)
public
onlyAuthFromAddr
{
require(
msg.sender == _orderCAddr || msg.sender == _appealCAddr,
"Invalid call"
);
OrderStorage.Order memory _order = _orderStorage.searchOrder(_orderNo);
require(_order.orderNo != uint256(0), "not exist");
address _seller = _order.orderDetail.sellerAddr;
string memory _coinType = _order.orderDetail.coinType;
uint256 _subAmount = orderSubFrozenList[_seller][_orderNo];
require(_subAmount == 0);
uint256 _frozen = frozenTotal[_seller][_coinType];
uint256 _orderCount = _order.coinCount;
require(_frozen >= _orderCount);
require(SafeMath.sub(_frozen, _orderCount) <= _frozen);
frozenTotal[_seller][_coinType] = SafeMath.sub(_frozen, _orderCount);
orderSubFrozenList[_seller][_orderNo] = _orderCount;
TokenTransfer _tokenTransfer = getERC20Address(_coinType);
_tokenTransfer.transfer(_addr, _orderCount);
}
function subAvaAppeal(
address _from,
address _to,
AppealStorage.Appeal memory _al,
uint256 _amt,
uint256 _t,
uint256 _self
) public onlyAuthFromAddr {
require(msg.sender == _appealCAddr, "Invalid call");
uint256 _available = getAvailableTotal(_from, P_COIN);
uint256 _need = 0;
address _opt = _t == 1 ? _al.witness : _al.detail.observerAddr;
if (_available >= _amt) {
_need = _amt;
} else {
_need = _available;
}
if (
(_t == 1 && _self == 0) ||
(_t == 2 && _al.detail.finalAppealAddr != _from)
) {
availableTotal[_from][P_COIN] = SafeMath.sub(
availableTotal[_from][P_COIN],
_need
);
availableTotal[_to][P_COIN] = SafeMath.add(
availableTotal[_to][P_COIN],
_need
);
_changeUserMorgageStats(_from, availableTotal[_from][P_COIN]);
_changeUserMorgageStats(_to, availableTotal[_to][P_COIN]);
}
availableTotal[_opt][P_COIN] = SafeMath.add(
availableTotal[_opt][P_COIN],
_amt
);
_changeUserMorgageStats(_opt, availableTotal[_opt][P_COIN]);
chanRole(_from);
chanRole(_to);
chanRole(_opt);
UserStorage.User memory _user = _userStorage.searchUser(_opt);
if (_t == 1) {
_user.credit = _user.credit + witnessHandleCredit;
} else if (_t == 2) {
_user.credit = _user.credit + observerHandleCredit;
}
UserStorage.TradeStats memory _tradeStats = _user.tradeStats;
_userStorage.updateTradeStats(_opt, _tradeStats, _user.credit);
}
function _changeUserMorgageStats(address _addr, uint256 _amt) internal {
UserStorage.User memory _user = _userStorage.searchUser(_addr);
UserStorage.MorgageStats memory _morgageStats = _user.morgageStats;
_morgageStats.mortgage = _amt;
_userStorage.updateMorgageStats(_addr, _morgageStats);
}
function subWitnessAvailable(address _addr) public onlyAuthFromAddr {
require(msg.sender == _appealCAddr, "Invalid call");
require(_addr != address(0), "address null");
uint256 _availableTotal = availableTotal[_addr][P_COIN];
uint256 _need = 0;
uint256 subFromDraing = 0;
if (_availableTotal >= subWitFee) {
_need = subWitFee;
availableTotal[_addr][P_COIN] = SafeMath.sub(
_availableTotal,
_need
);
} else {
availableTotal[_addr][P_COIN] = 0;
uint256 _draing = withdrawingTotal[_addr][P_COIN];
if (SafeMath.add(_availableTotal, _draing) >= subWitFee) {
_need = subWitFee;
subFromDraing = SafeMath.sub(subWitFee, _availableTotal);
withdrawingTotal[_addr][P_COIN] = SafeMath.sub(
_draing,
subFromDraing
);
} else {
_need = SafeMath.add(_draing, _availableTotal);
withdrawingTotal[_addr][P_COIN] = 0;
}
}
chanRole(_addr);
UserStorage.User memory _user = _userStorage.searchUser(_addr);
_user.credit = _user.credit >= subWitCredit
? (_user.credit - subWitCredit)
: 0;
UserStorage.TradeStats memory _tradeStats = _user.tradeStats;
_userStorage.updateTradeStats(_addr, _tradeStats, _user.credit);
TokenTransfer _tokenTransfer = getERC20Address(P_COIN);
_tokenTransfer.transfer(owner(), _need);
}
function getFrozenTotal(address _addr, string memory _coinType)
public
view
returns (uint256)
{
return frozenTotal[_addr][_coinType];
}
function applyUnfrozen(uint256 _amt) external returns (uint256) {
require(_amt > 0);
require(availableTotal[msg.sender][P_COIN] >= _amt, "Invalid amount");
require(
SafeMath.sub(availableTotal[msg.sender][P_COIN], _amt) <
availableTotal[msg.sender][P_COIN],
"Invalid amount 2"
);
lastWithdrawTime[msg.sender] = block.timestamp;
lastWithdrawAmount[msg.sender][lastWithdrawTime[msg.sender]] = _amt;
availableTotal[msg.sender][P_COIN] = SafeMath.sub(
availableTotal[msg.sender][P_COIN],
_amt
);
withdrawingTotal[msg.sender][P_COIN] = SafeMath.add(
withdrawingTotal[msg.sender][P_COIN],
_amt
);
chanRole(msg.sender);
_insert(msg.sender, "", P_COIN, _amt, 3, 3, 2);
emit RecordApplyUnfrozen(msg.sender, _amt);
return getAvailableTotal(msg.sender, P_COIN);
}
function chanRole(address _addr) internal {
uint256 _avail = availableTotal[_addr][P_COIN];
UserStorage.User memory _user = _userStorage.searchUser(_addr);
_changeUserMorgageStats(_addr, _avail);
if (
_user.userFlag == 2 &&
_avail < congressNeedCount &&
_avail >= merchantNeedCount
) {
_userStorage.updateUserRole(_addr, 3);
}
if (
_user.userFlag == 1 &&
_avail < witnessNeedCount &&
_avail >= merchantNeedCount
) {
_userStorage.updateUserRole(_addr, 3);
}
if (_user.userFlag == 0 && _avail >= merchantNeedCount) {
_userStorage.updateUserRole(_addr, 3);
}
if (_avail < merchantNeedCount) {
_userStorage.updateUserRole(_addr, 0);
}
}
function unApplyUnfrozen(address _addr) external onlyOwner {
uint256 _drawing = withdrawingTotal[_addr][P_COIN];
require(_drawing > 0, "sufficient");
withdrawingTotal[_addr][P_COIN] = 0;
availableTotal[_addr][P_COIN] = SafeMath.add(
availableTotal[_addr][P_COIN],
_drawing
);
chanRole(_addr);
}
function applyWithdraw(uint256 _recordNo) public {
Record memory _record = records[_recordNo];
require(_record.recordNo != uint256(0), "record not exist");
require(_record.userAddr == msg.sender, "record user not exist");
require(_record.hostStatus == 3, "status error");
require(
withdrawingTotal[msg.sender][P_COIN] >= _record.hostCount,
"sufficient"
);
require(
block.timestamp >= (_record.hostTime + canWithdrawToTime * 1 days),
"can't withdraw"
);
withdrawingTotal[msg.sender][P_COIN] = SafeMath.sub(
withdrawingTotal[msg.sender][P_COIN],
_record.hostCount
);
unfrozenTotal[msg.sender][P_COIN] = SafeMath.add(
unfrozenTotal[msg.sender][P_COIN],
_record.hostCount
);
_record.hostStatus = 4;
_record.updateTime = block.timestamp;
records[_recordNo] = _record;
recordList[recordIndex[_recordNo]] = _record;
emit RecordUpdate(msg.sender, _recordNo, _record.tradeHash, 4);
TokenTransfer _tokenTransfer = getERC20Address(P_COIN);
_tokenTransfer.transfer(msg.sender, _record.hostCount);
}
function unfrozenTotalSearch(address _addr, string memory _coinType)
public
view
returns (uint256)
{
require(_addr != address(0), "user address is null");
return unfrozenTotal[_addr][_coinType];
}
function getUnfrozenTotal(address _addr, string memory _coinType)
external
view
returns (uint256)
{
return unfrozenTotal[_addr][_coinType];
}
function getWithdrawingTotal(address _addr, string memory _coinType)
public
view
returns (uint256)
{
return withdrawingTotal[_addr][_coinType];
}
function getErcBalance(string memory _coinType, address _addr)
public
view
returns (uint256)
{
TokenTransfer _tokenTransfer = getERC20Address(_coinType);
return _tokenTransfer.balanceOf(_addr);
}
function _updateInfo(
address _addr,
uint256 _recordNo,
string memory _hash,
uint256 _hostStatus
) internal returns (bool) {
Record storage _record = records[_recordNo];
require(_record.userAddr == _addr);
require(_hostStatus == 1 || _hostStatus == 2, "invalid status");
if (_hostStatus != uint256(0)) {
_record.hostStatus = _hostStatus;
}
if (bytes(_hash).length != 0) {
_record.tradeHash = _hash;
}
_record.updateTime = block.timestamp;
emit RecordUpdate(_addr, _recordNo, _hash, _hostStatus);
return true;
}
function updateInfo(
address _addr,
uint256 _recordNo,
string memory _hash,
uint256 _hostStatus
) external returns (bool) {
return _updateInfo(_addr, _recordNo, _hash, _hostStatus);
}
function searchRecord(uint256 _recordNo)
external
view
returns (Record memory record)
{
return records[_recordNo];
}
function searchRecordList() external view returns (Record[] memory) {
return recordList;
}
}

Contract ABI

[{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RestAdd","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256","indexed":false},{"type":"uint256","name":"_restType","internalType":"uint256","indexed":false},{"type":"string","name":"_coinType","internalType":"string","indexed":false},{"type":"string","name":"_currencyType","internalType":"string","indexed":false},{"type":"uint256","name":"_restCount","internalType":"uint256","indexed":false},{"type":"uint256","name":"_price","internalType":"uint256","indexed":false},{"type":"uint256[]","name":"_payType","internalType":"uint256[]","indexed":false},{"type":"tuple","name":"_restDetail","internalType":"struct RestStorage.RestDetail","indexed":false,"components":[{"type":"uint256","name":"finishCount","internalType":"uint256"},{"type":"uint256","name":"remainderCount","internalType":"uint256"},{"type":"uint256","name":"limitAmountFrom","internalType":"uint256"},{"type":"uint256","name":"limitAmountTo","internalType":"uint256"},{"type":"uint256","name":"limitMinCredit","internalType":"uint256"},{"type":"uint256","name":"limitMinMortgage","internalType":"uint256"},{"type":"string","name":"restRemark","internalType":"string"},{"type":"uint256","name":"restTime","internalType":"uint256"},{"type":"uint256","name":"updateTime","internalType":"uint256"},{"type":"uint256","name":"restFee","internalType":"uint256"},{"type":"string","name":"restHash","internalType":"string"}]}],"anonymous":false},{"type":"event","name":"RestUpdate","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256","indexed":false},{"type":"string","name":"_coinType","internalType":"string","indexed":false},{"type":"string","name":"_currencyType","internalType":"string","indexed":false},{"type":"uint256","name":"_restCount","internalType":"uint256","indexed":false},{"type":"uint256","name":"_price","internalType":"uint256","indexed":false},{"type":"uint256[]","name":"_payType","internalType":"uint256[]","indexed":false},{"type":"tuple","name":"_restDetail","internalType":"struct RestStorage.RestDetail","indexed":false,"components":[{"type":"uint256","name":"finishCount","internalType":"uint256"},{"type":"uint256","name":"remainderCount","internalType":"uint256"},{"type":"uint256","name":"limitAmountFrom","internalType":"uint256"},{"type":"uint256","name":"limitAmountTo","internalType":"uint256"},{"type":"uint256","name":"limitMinCredit","internalType":"uint256"},{"type":"uint256","name":"limitMinMortgage","internalType":"uint256"},{"type":"string","name":"restRemark","internalType":"string"},{"type":"uint256","name":"restTime","internalType":"uint256"},{"type":"uint256","name":"updateTime","internalType":"uint256"},{"type":"uint256","name":"restFee","internalType":"uint256"},{"type":"string","name":"restHash","internalType":"string"}]}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addBuyRest","inputs":[{"type":"uint256","name":"_restType","internalType":"uint256"},{"type":"string","name":"_coinType","internalType":"string"},{"type":"string","name":"_currencyType","internalType":"string"},{"type":"uint256","name":"_restCount","internalType":"uint256"},{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"uint256[]","name":"_payType","internalType":"uint256[]"},{"type":"tuple","name":"_restDetail","internalType":"struct RestStorage.RestDetail","components":[{"type":"uint256","name":"finishCount","internalType":"uint256"},{"type":"uint256","name":"remainderCount","internalType":"uint256"},{"type":"uint256","name":"limitAmountFrom","internalType":"uint256"},{"type":"uint256","name":"limitAmountTo","internalType":"uint256"},{"type":"uint256","name":"limitMinCredit","internalType":"uint256"},{"type":"uint256","name":"limitMinMortgage","internalType":"uint256"},{"type":"string","name":"restRemark","internalType":"string"},{"type":"uint256","name":"restTime","internalType":"uint256"},{"type":"uint256","name":"updateTime","internalType":"uint256"},{"type":"uint256","name":"restFee","internalType":"uint256"},{"type":"string","name":"restHash","internalType":"string"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addRestRemainCount","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256"},{"type":"uint256","name":"_remainCount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addSellRest","inputs":[{"type":"uint256","name":"_restType","internalType":"uint256"},{"type":"string","name":"_coinType","internalType":"string"},{"type":"string","name":"_currencyType","internalType":"string"},{"type":"uint256","name":"_restCount","internalType":"uint256"},{"type":"uint256","name":"_restFee","internalType":"uint256"},{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"uint256[]","name":"_payType","internalType":"uint256[]"},{"type":"tuple","name":"_restDetail","internalType":"struct RestStorage.RestDetail","components":[{"type":"uint256","name":"finishCount","internalType":"uint256"},{"type":"uint256","name":"remainderCount","internalType":"uint256"},{"type":"uint256","name":"limitAmountFrom","internalType":"uint256"},{"type":"uint256","name":"limitAmountTo","internalType":"uint256"},{"type":"uint256","name":"limitMinCredit","internalType":"uint256"},{"type":"uint256","name":"limitMinMortgage","internalType":"uint256"},{"type":"string","name":"restRemark","internalType":"string"},{"type":"uint256","name":"restTime","internalType":"uint256"},{"type":"uint256","name":"updateTime","internalType":"uint256"},{"type":"uint256","name":"restFee","internalType":"uint256"},{"type":"string","name":"restHash","internalType":"string"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"authFromContract","inputs":[{"type":"address","name":"_recordAddr","internalType":"address"},{"type":"address","name":"_userAddr","internalType":"address"},{"type":"address","name":"_orderAddr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelBuyRest","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelSellRest","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRestFrozenTotal","inputs":[{"type":"address","name":"_addr","internalType":"address"},{"type":"uint256","name":"_restNo","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"rest","internalType":"struct RestStorage.Rest","components":[{"type":"address","name":"userAddr","internalType":"address"},{"type":"uint256","name":"restNo","internalType":"uint256"},{"type":"uint256","name":"restType","internalType":"uint256"},{"type":"string","name":"coinType","internalType":"string"},{"type":"string","name":"currencyType","internalType":"string"},{"type":"uint256","name":"restCount","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256[]","name":"payType","internalType":"uint256[]"},{"type":"uint256","name":"restStatus","internalType":"uint256"},{"type":"tuple","name":"restDetail","internalType":"struct RestStorage.RestDetail","components":[{"type":"uint256","name":"finishCount","internalType":"uint256"},{"type":"uint256","name":"remainderCount","internalType":"uint256"},{"type":"uint256","name":"limitAmountFrom","internalType":"uint256"},{"type":"uint256","name":"limitAmountTo","internalType":"uint256"},{"type":"uint256","name":"limitMinCredit","internalType":"uint256"},{"type":"uint256","name":"limitMinMortgage","internalType":"uint256"},{"type":"string","name":"restRemark","internalType":"string"},{"type":"uint256","name":"restTime","internalType":"uint256"},{"type":"uint256","name":"updateTime","internalType":"uint256"},{"type":"uint256","name":"restFee","internalType":"uint256"},{"type":"string","name":"restHash","internalType":"string"}]}]}],"name":"searchRest","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct RestStorage.Rest[]","components":[{"type":"address","name":"userAddr","internalType":"address"},{"type":"uint256","name":"restNo","internalType":"uint256"},{"type":"uint256","name":"restType","internalType":"uint256"},{"type":"string","name":"coinType","internalType":"string"},{"type":"string","name":"currencyType","internalType":"string"},{"type":"uint256","name":"restCount","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256[]","name":"payType","internalType":"uint256[]"},{"type":"uint256","name":"restStatus","internalType":"uint256"},{"type":"tuple","name":"restDetail","internalType":"struct RestStorage.RestDetail","components":[{"type":"uint256","name":"finishCount","internalType":"uint256"},{"type":"uint256","name":"remainderCount","internalType":"uint256"},{"type":"uint256","name":"limitAmountFrom","internalType":"uint256"},{"type":"uint256","name":"limitAmountTo","internalType":"uint256"},{"type":"uint256","name":"limitMinCredit","internalType":"uint256"},{"type":"uint256","name":"limitMinMortgage","internalType":"uint256"},{"type":"string","name":"restRemark","internalType":"string"},{"type":"uint256","name":"restTime","internalType":"uint256"},{"type":"uint256","name":"updateTime","internalType":"uint256"},{"type":"uint256","name":"restFee","internalType":"uint256"},{"type":"string","name":"restHash","internalType":"string"}]}]}],"name":"searchRestList","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"startOrStop","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256"},{"type":"uint256","name":"_restStatus","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateInfo","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256"},{"type":"string","name":"_coinType","internalType":"string"},{"type":"string","name":"_currencyType","internalType":"string"},{"type":"uint256","name":"_addCount","internalType":"uint256"},{"type":"uint256","name":"_restFee","internalType":"uint256"},{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"uint256[]","name":"_payType","internalType":"uint256[]"},{"type":"tuple","name":"_restDetail","internalType":"struct RestStorage.RestDetail","components":[{"type":"uint256","name":"finishCount","internalType":"uint256"},{"type":"uint256","name":"remainderCount","internalType":"uint256"},{"type":"uint256","name":"limitAmountFrom","internalType":"uint256"},{"type":"uint256","name":"limitAmountTo","internalType":"uint256"},{"type":"uint256","name":"limitMinCredit","internalType":"uint256"},{"type":"uint256","name":"limitMinMortgage","internalType":"uint256"},{"type":"string","name":"restRemark","internalType":"string"},{"type":"uint256","name":"restTime","internalType":"uint256"},{"type":"uint256","name":"updateTime","internalType":"uint256"},{"type":"uint256","name":"restFee","internalType":"uint256"},{"type":"string","name":"restHash","internalType":"string"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRestFinishCount","inputs":[{"type":"uint256","name":"_restNo","internalType":"uint256"},{"type":"uint256","name":"_finishCount","internalType":"uint256"}]}]
            

Contract Creation Code

0x60806040523480156200001157600080fd5b506200001d3362000027565b6001805562000077565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61586e80620000876000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806386bf422b11610097578063e9a5f96d11610066578063e9a5f96d146101e2578063f2fde38b14610226578063f5fa8f9a14610239578063f92a3bb41461024c57600080fd5b806386bf422b1461018c5780638da5cb5b1461019f5780639e9c36a3146101ba578063a42fd334146101cf57600080fd5b8063573b6bbe116100d3578063573b6bbe1461014b5780635aaf63891461015e578063715018a614610171578063793e3e371461017957600080fd5b80630129ad51146100fa5780630e27b03c146101235780632320dc4d14610138575b600080fd5b61010d610108366004614b2c565b61025f565b60405161011a9190614d21565b60405180910390f35b610136610131366004614d34565b610631565b005b610136610146366004614b2c565b610d70565b610136610159366004614d34565b611508565b61013661016c366004614fb7565b611a8a565b610136611c1e565b610136610187366004615096565b611c54565b61013661019a3660046150e1565b611cd8565b6000546040516001600160a01b03909116815260200161011a565b6101c26122d4565b60405161011a91906151b5565b6101366101dd3660046150e1565b61268c565b6102186101f0366004615217565b6001600160a01b03919091166000908152600960209081526040808320938352929052205490565b60405190815260200161011a565b610136610234366004615243565b61269c565b610136610247366004614b2c565b612737565b61013661025a366004614d34565b612740565b6102676149a3565b816102b95760405162461bcd60e51b815260206004820152601a60248201527f726573744e6f206e756c6c206973206e6f7420616c6c6f77656400000000000060448201526064015b60405180910390fd5b600082815260066020908152604080832081516101408101835281546001600160a01b0316815260018201549381019390935260028101549183019190915260038101805460608401919061030d90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461033990615260565b80156103865780601f1061035b57610100808354040283529160200191610386565b820191906000526020600020905b81548152906001019060200180831161036957829003601f168201915b5050505050815260200160048201805461039f90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546103cb90615260565b80156104185780601f106103ed57610100808354040283529160200191610418565b820191906000526020600020905b8154815290600101906020018083116103fb57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561048457602002820191906000526020600020905b815481526020019060010190808311610470575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546104f490615260565b80601f016020809104026020016040519081016040528092919081815260200182805461052090615260565b801561056d5780601f106105425761010080835404028352916020019161056d565b820191906000526020600020905b81548152906001019060200180831161055057829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546105a490615260565b80601f01602080910402602001604051908101604052809291908181526020018280546105d090615260565b801561061d5780601f106105f25761010080835404028352916020019161061d565b820191906000526020600020905b81548152906001019060200180831161060057829003601f168201915b505050919092525050509052509392505050565b60008281526006602052604090205482906001600160a01b031633146106695760405162461bcd60e51b81526004016102b09061529b565b81600114806106785750816003145b6106ba5760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420726573742073746174757360681b60448201526064016102b0565b600083815260066020908152604080832081516101408101835281546001600160a01b0316815260018201549381019390935260028101549183019190915260038101805460608401919061070e90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461073a90615260565b80156107875780601f1061075c57610100808354040283529160200191610787565b820191906000526020600020905b81548152906001019060200180831161076a57829003601f168201915b505050505081526020016004820180546107a090615260565b80601f01602080910402602001604051908101604052809291908181526020018280546107cc90615260565b80156108195780601f106107ee57610100808354040283529160200191610819565b820191906000526020600020905b8154815290600101906020018083116107fc57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561088557602002820191906000526020600020905b815481526020019060010190808311610871575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546108f590615260565b80601f016020809104026020016040519081016040528092919081815260200182805461092190615260565b801561096e5780601f106109435761010080835404028352916020019161096e565b820191906000526020600020905b81548152906001019060200180831161095157829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546109a590615260565b80601f01602080910402602001604051908101604052809291908181526020018280546109d190615260565b8015610a1e5780601f106109f357610100808354040283529160200191610a1e565b820191906000526020600020905b815481529060010190602001808311610a0157829003601f168201915b50505050508152505081525050905080610100015160011480610a4657508061010001516003145b610a925760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642072657374207374617475732c6f7074206572726f7200000060448201526064016102b0565b61010081810184905261012082015142910152600084815260066020908152604091829020835181546001600160a01b0319166001600160a01b0390911617815581840151600182015591830151600283015560608301518051849392610b00926003850192910190614a59565b5060808201518051610b1c916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051610b4c916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c08301518051610bb192600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051610bee91600a840191602090910190614a59565b505050600086815260076020526040902054600880548594509092508110610c1857610c186152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b0390921691909117815582820151600182015560408301516002820155606083015180519192610c7792600385019290910190614a59565b5060808201518051610c93916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051610cc3916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c08301518051610d2892600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051610d6591600a840191602090910190614a59565b505050505050505050565b60008181526006602052604090205481906001600160a01b03163314610da85760405162461bcd60e51b81526004016102b09061529b565b600082815260066020526040902060080154600114610e025760405162461bcd60e51b815260206004820152601660248201527518d85b89dd0818da185b99d9481d1a1a5cc81c995cdd60521b60448201526064016102b0565b600082815260066020526040902060020154600114610e575760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642072657374207479706560781b60448201526064016102b0565b6000828152600660205260409020600581015460099091015410610eb65760405162461bcd60e51b81526020600482015260166024820152751d1a1a5cc81c995cdd081a185cc8199a5b9a5cda195960521b60448201526064016102b0565b600082815260066020908152604080832081516101408101835281546001600160a01b03168152600182015493810193909352600281015491830191909152600381018054606084019190610f0a90615260565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3690615260565b8015610f835780601f10610f5857610100808354040283529160200191610f83565b820191906000526020600020905b815481529060010190602001808311610f6657829003601f168201915b50505050508152602001600482018054610f9c90615260565b80601f0160208091040260200160405190810160405280929190818152602001828054610fc890615260565b80156110155780601f10610fea57610100808354040283529160200191611015565b820191906000526020600020905b815481529060010190602001808311610ff857829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561108157602002820191906000526020600020905b81548152602001906001019080831161106d575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546110f190615260565b80601f016020809104026020016040519081016040528092919081815260200182805461111d90615260565b801561116a5780601f1061113f5761010080835404028352916020019161116a565b820191906000526020600020905b81548152906001019060200180831161114d57829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546111a190615260565b80601f01602080910402602001604051908101604052809291908181526020018280546111cd90615260565b801561121a5780601f106111ef5761010080835404028352916020019161121a565b820191906000526020600020905b8154815290600101906020018083116111fd57829003601f168201915b5050509190925250505090525060046101008281019190915261012082015142910152600084815260066020908152604091829020835181546001600160a01b0319166001600160a01b039091161781558184015160018201559183015160028301556060830151805193945084936112999260038501920190614a59565b50608082015180516112b5916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e082015180516112e5916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161134a92600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161138791600a840191602090910190614a59565b5050506000858152600760205260409020546008805485945090925081106113b1576113b16152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b039092169190911781558282015160018201556040830151600282015560608301518051919261141092600385019290910190614a59565b506080820151805161142c916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e0820151805161145c916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c083015180516114c192600f8701920190614a59565b5060e082015160078201556101008201516008820155610120820151600982015561014082015180516114fe91600a840191602090910190614a59565b5050505050505050565b600a546001600160a01b0316331461155d5760405162461bcd60e51b8152602060048201526018602482015277496e76616c696420636f6e7472616374206164647265737360401b60448201526064016102b0565b600082815260066020908152604080832081516101408101835281546001600160a01b031681526001820154938101939093526002810154918301919091526003810180546060840191906115b190615260565b80601f01602080910402602001604051908101604052809291908181526020018280546115dd90615260565b801561162a5780601f106115ff5761010080835404028352916020019161162a565b820191906000526020600020905b81548152906001019060200180831161160d57829003601f168201915b5050505050815260200160048201805461164390615260565b80601f016020809104026020016040519081016040528092919081815260200182805461166f90615260565b80156116bc5780601f10611691576101008083540402835291602001916116bc565b820191906000526020600020905b81548152906001019060200180831161169f57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561172857602002820191906000526020600020905b815481526020019060010190808311611714575b5050505050815260200160088201548152602001600982016040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201805461179890615260565b80601f01602080910402602001604051908101604052809291908181526020018280546117c490615260565b80156118115780601f106117e657610100808354040283529160200191611811565b820191906000526020600020905b8154815290600101906020018083116117f457829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461184890615260565b80601f016020809104026020016040519081016040528092919081815260200182805461187490615260565b80156118c15780601f10611896576101008083540402835291602001916118c1565b820191906000526020600020905b8154815290600101906020018083116118a457829003601f168201915b5050505050815250508152505090506000821180156118e65750610120810151518211155b6119205760405162461bcd60e51b815260206004820152600b60248201526a31b7bab73a1032b93937b960a91b60448201526064016102b0565b8060400151600214156119825780516001600160a01b0316600090815260096020908152604080832086845290915290205461195c9083612c9c565b81516001600160a01b031660009081526009602090815260408083208784529091529020555b610120810151516119939083612caf565b610120820180519190915251602001516119ad9083612c9c565b81610120015160200181815250506119d28160c0015182610120015160200151612cbb565b61012082018051606090810192909252519081015160409091015111611a015780610120015160400151611a0c565b806101200151606001515b61012082018051604090810192909252600161010080850182905291514292019190915260008581526006602090815290839020845181546001600160a01b0319166001600160a01b039091161781558185015192810192909255918301516002820155606083015180518493611299926003850192910190614a59565b86600114611aca5760405162461bcd60e51b815260206004820152600d60248201526c1b5d5cdd08189d5e481c995cdd609a1b60448201526064016102b0565b600354604051639bd7417f60e01b81523360048201526000916001600160a01b031690639bd7417f90602401600060405180830381865afa158015611b13573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b3b9190810190615411565b90506000600260009054906101000a90046001600160a01b03166001600160a01b0316635ff2efad6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb69190615502565b90508080611bc8575081608001516003145b611c035760405162461bcd60e51b815260206004820152600c60248201526b34b73b30b634b2103ab9b2b960a11b60448201526064016102b0565b611c1289898989898989612cc7565b50505050505050505050565b6000546001600160a01b03163314611c485760405162461bcd60e51b81526004016102b090615524565b611c5260006131c2565b565b6000546001600160a01b03163314611c7e5760405162461bcd60e51b81526004016102b090615524565b600a80546001600160a01b038084166001600160a01b0319928316179092556002805486841690831681179091556003805493861693831693909317909255600480549091169091179055611cd36005613212565b505050565b60008881526006602052604090205488906001600160a01b03163314611d105760405162461bcd60e51b81526004016102b09061529b565b88611d4e5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420726573744e6f60901b60448201526064016102b0565b600089815260066020908152604080832081516101408101835281546001600160a01b03168152600182015493810193909352600281015491830191909152600381018054606084019190611da290615260565b80601f0160208091040260200160405190810160405280929190818152602001828054611dce90615260565b8015611e1b5780601f10611df057610100808354040283529160200191611e1b565b820191906000526020600020905b815481529060010190602001808311611dfe57829003601f168201915b50505050508152602001600482018054611e3490615260565b80601f0160208091040260200160405190810160405280929190818152602001828054611e6090615260565b8015611ead5780601f10611e8257610100808354040283529160200191611ead565b820191906000526020600020905b815481529060010190602001808311611e9057829003601f168201915b50505050508152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020018280548015611f1957602002820191906000526020600020905b815481526020019060010190808311611f05575b50505050508152602001600882015481526020016009820160405180610160016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682018054611f8990615260565b80601f0160208091040260200160405190810160405280929190818152602001828054611fb590615260565b80156120025780601f10611fd757610100808354040283529160200191612002565b820191906000526020600020905b815481529060010190602001808311611fe557829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461203990615260565b80601f016020809104026020016040519081016040528092919081815260200182805461206590615260565b80156120b25780601f10612087576101008083540402835291602001916120b2565b820191906000526020600020905b81548152906001019060200180831161209557829003601f168201915b5050505050815250508152505090506000816020015114156121075760405162461bcd60e51b815260206004820152600e60248201526d1c995cdd081b9bdd08195e1a5cdd60921b60448201526064016102b0565b8060400151600214156122c55760028054604051634e23ea9760e01b81526001600160a01b0390911691634e23ea979161214e9133918e918d916001908290600401615559565b600060405180830381600087803b15801561216857600080fd5b505af115801561217c573d6000803e3d6000fd5b50505050600061218c8888612c9c565b600254604051630bc67f9b60e01b81529192506000916001600160a01b0390911690630bc67f9b906121c2908e906004016155af565b6020604051808303816000875af11580156121e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220591906155c2565b600480546040516323b872dd60e01b815233928101929092526001600160a01b03908116602483015260448201859052919250908216906323b872dd90606401600060405180830381600087803b15801561225f57600080fd5b505af1158015612273573d6000803e3d6000fd5b505050508860096000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060008282546122bd91906155f5565b909155505050505b611c128a8a8a8a89898961323b565b60606008805480602002602001604051908101604052809291908181526020016000905b8282101561268357600084815260209081902060408051610140810182526014860290920180546001600160a01b0316835260018101549383019390935260028301549082015260038201805491929160608401919061235790615260565b80601f016020809104026020016040519081016040528092919081815260200182805461238390615260565b80156123d05780601f106123a5576101008083540402835291602001916123d0565b820191906000526020600020905b8154815290600101906020018083116123b357829003601f168201915b505050505081526020016004820180546123e990615260565b80601f016020809104026020016040519081016040528092919081815260200182805461241590615260565b80156124625780601f1061243757610100808354040283529160200191612462565b820191906000526020600020905b81548152906001019060200180831161244557829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782018054806020026020016040519081016040528092919081815260200182805480156124ce57602002820191906000526020600020905b8154815260200190600101908083116124ba575b5050505050815260200160088201548152602001600982016040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201805461253e90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461256a90615260565b80156125b75780601f1061258c576101008083540402835291602001916125b7565b820191906000526020600020905b81548152906001019060200180831161259a57829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546125ee90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461261a90615260565b80156126675780601f1061263c57610100808354040283529160200191612667565b820191906000526020600020905b81548152906001019060200180831161264a57829003601f168201915b50505050508152505081525050815260200190600101906122f8565b50505050905090565b6114fe8888888888888888613a5d565b6000546001600160a01b031633146126c65760405162461bcd60e51b81526004016102b090615524565b6001600160a01b03811661272b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102b0565b612734816131c2565b50565b61273481613db8565b600a546001600160a01b031633146127955760405162461bcd60e51b8152602060048201526018602482015277496e76616c696420636f6e7472616374206164647265737360401b60448201526064016102b0565b600082815260066020908152604080832081516101408101835281546001600160a01b031681526001820154938101939093526002810154918301919091526003810180546060840191906127e990615260565b80601f016020809104026020016040519081016040528092919081815260200182805461281590615260565b80156128625780601f1061283757610100808354040283529160200191612862565b820191906000526020600020905b81548152906001019060200180831161284557829003601f168201915b5050505050815260200160048201805461287b90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546128a790615260565b80156128f45780601f106128c9576101008083540402835291602001916128f4565b820191906000526020600020905b8154815290600101906020018083116128d757829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561296057602002820191906000526020600020905b81548152602001906001019080831161294c575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546129d090615260565b80601f01602080910402602001604051908101604052809291908181526020018280546129fc90615260565b8015612a495780601f10612a1e57610100808354040283529160200191612a49565b820191906000526020600020905b815481529060010190602001808311612a2c57829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a82018054612a8090615260565b80601f0160208091040260200160405190810160405280929190818152602001828054612aac90615260565b8015612af95780601f10612ace57610100808354040283529160200191612af9565b820191906000526020600020905b815481529060010190602001808311612adc57829003601f168201915b50505050508152505081525050905081816101200151602001511015612b615760405162461bcd60e51b815260206004820152601e60248201527f5265737453746f726167653a66696e69736820636f756e74206572726f72000060448201526064016102b0565b806040015160021415612bc35780516001600160a01b03166000908152600960209081526040808320868452909152902054612b9d9083612caf565b81516001600160a01b031660009081526009602090815260408083208784529091529020555b61012081015151612bd49083612c9c565b61012082018051919091525160200151612bee9083612caf565b8161012001516020018181525050612c138160c0015182610120015160200151612cbb565b61012082018051606001919091525160200151612c335760026101008201525b6101208101514261010090910152600083815260066020908152604091829020835181546001600160a01b0319166001600160a01b0390911617815581840151600182015591830151600283015560608301518051849392611299926003850192910190614a59565b6000612ca882846155f5565b9392505050565b6000612ca8828461560d565b6000612ca88284615624565b600060026001541415612d1c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102b0565b6002600155612d2f88888888888861475d565b6000612d3a60055490565b60008181526006602052604090206001015490915015612d895760405162461bcd60e51b815260206004820152600a6024820152691c995cdd08195e1a5cdd60b21b60448201526064016102b0565b6000808452602084018790524260e0850152610100840152612dab8686612cbb565b83606001511180612dbe57506060830151155b15612dd357612dcd8686612cbb565b60608401525b604080516101408101825233815260208082018481528284018d8152606084018d8152608085018d905260a085018c905260c085018b905260e085018a90526001610100860181905261012086018a905260008881526006865296909620855181546001600160a01b0319166001600160a01b0390911617815592519583019590955551600282015592518051929384939092612e77926003850192910190614a59565b5060808201518051612e93916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051612ec3916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c08301518051612f2892600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051612f6591600a840191602090910190614a59565b50506008805460018101825560009190915284517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3601490920291820180546001600160a01b0319166001600160a01b039092169190911781556020808701517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee484015560408701517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee58401556060870151805188975092955061305094507ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee6909301920190614a59565b506080820151805161306c916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e0820151805161309c916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161310192600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161313e91600a840191602090910190614a59565b5050600854613153935060019250905061560d565b60008381526007602052604090205561316c6005613212565b7f3f01ce3e2eed7c005ee70ead085a70f63e460282bbd87ff1009d38d94a7bc92d828b8b8b8b8b8b8b6040516131a9989796959493929190615643565b60405180910390a1506001805598975050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805461321e5761271081555b600181600001600082825461323391906155f5565b909155505050565b866132795760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420726573744e6f60901b60448201526064016102b0565b600087815260066020908152604080832081516101408101835281546001600160a01b031681526001820154938101939093526002810154918301919091526003810180546060840191906132cd90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546132f990615260565b80156133465780601f1061331b57610100808354040283529160200191613346565b820191906000526020600020905b81548152906001019060200180831161332957829003601f168201915b5050505050815260200160048201805461335f90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461338b90615260565b80156133d85780601f106133ad576101008083540402835291602001916133d8565b820191906000526020600020905b8154815290600101906020018083116133bb57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561344457602002820191906000526020600020905b815481526020019060010190808311613430575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546134b490615260565b80601f01602080910402602001604051908101604052809291908181526020018280546134e090615260565b801561352d5780601f106135025761010080835404028352916020019161352d565b820191906000526020600020905b81548152906001019060200180831161351057829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461356490615260565b80601f016020809104026020016040519081016040528092919081815260200182805461359090615260565b80156135dd5780601f106135b2576101008083540402835291602001916135dd565b820191906000526020600020905b8154815290600101906020018083116135c057829003601f168201915b50505091909252505050905250600161010082015287519091501561360457606081018790525b85511561361357608081018690525b83156136215760c081018490525b841561367c57848160a00181815161363991906155f5565b90525061012081015160200180518691906136559083906155f5565b9052506101208101516020015160c08201516136719190612cbb565b610120820151606001525b82511561368b5760e081018390525b6040820151156136cb5780610120015160600151826040015111156136ba576101208101516060015160408301525b604080830151610120830151909101525b6080820151156136e657608080830151610120830151909101525b60a0820151156137015760a080830151610120830151909101525b60c0820151511561371d5760c080830151610120830151909101525b61012082015115613738576101208083015182820151909101525b6101208101514261010090910152600088815260066020908152604091829020835181546001600160a01b0319166001600160a01b03909116178155818401516001820155918301516002830155606083015180518493926137a1926003850192910190614a59565b50608082015180516137bd916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e082015180516137ed916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161385292600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161388f91600a840191602090910190614a59565b50505060008a8152600760205260409020546008805485945090925081106138b9576138b96152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b039092169190911781558282015160018201556040830151600282015560608301518051919261391892600385019290910190614a59565b5060808201518051613934916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051613964916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c083015180516139c992600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051613a0691600a840191602090910190614a59565b5050509050507fa8cddeb44b34495261936a34d0dc633acf6220fb5e03216a8de51013fe400b698888888460a00151888888604051613a4b97969594939291906156ba565b60405180910390a15050505050505050565b87600214613a9e5760405162461bcd60e51b815260206004820152600e60248201526d1b5d5cdd081cd95b1b081c995cdd60921b60448201526064016102b0565b60008511613ae05760405162461bcd60e51b815260206004820152600f60248201526e3932b9ba21b7bab73a1032b93937b960891b60448201526064016102b0565b600354604051639bd7417f60e01b81523360048201526000916001600160a01b031690639bd7417f90602401600060405180830381865afa158015613b29573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613b519190810190615411565b90506000600260009054906101000a90046001600160a01b03166001600160a01b0316635ff2efad6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bcc9190615502565b90508080613bde575081608001516003145b613c195760405162461bcd60e51b815260206004820152600c60248201526b34b73b30b634b2103ab9b2b960a11b60448201526064016102b0565b60028054604051634e23ea9760e01b81526001600160a01b0390911691634e23ea9791613c539133918e918d916001908290600401615559565b600060405180830381600087803b158015613c6d57600080fd5b505af1158015613c81573d6000803e3d6000fd5b505050506000613c918888612c9c565b600254604051630bc67f9b60e01b81529192506000916001600160a01b0390911690630bc67f9b90613cc7908e906004016155af565b6020604051808303816000875af1158015613ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d0a91906155c2565b600480546040516323b872dd60e01b815233928101929092526001600160a01b03908116602483015260448201859052919250908216906323b872dd90606401600060405180830381600087803b158015613d6457600080fd5b505af1158015613d78573d6000803e3d6000fd5b505050506000613d8d8d8d8d8d8c8c8c612cc7565b3360009081526009602090815260408083209383529290522099909955505050505050505050505050565b60008181526006602052604090205481906001600160a01b03163314613df05760405162461bcd60e51b81526004016102b09061529b565b600082815260066020526040902060080154600114613e4a5760405162461bcd60e51b815260206004820152601660248201527518d85b89dd0818d85b98d95b081d1a1a5cc81c995cdd60521b60448201526064016102b0565b600082815260066020526040902060029081015414613e9f5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642072657374207479706560781b60448201526064016102b0565b6000828152600660205260409020600581015460099091015410613efe5760405162461bcd60e51b81526020600482015260166024820152751d1a1a5cc81c995cdd081a185cc8199a5b9a5cda195960521b60448201526064016102b0565b336000908152600960209081526040808320858452909152902054613f595760405162461bcd60e51b81526020600482015260116024820152701c995cdd081a185cc8199a5b9a5cda1959607a1b60448201526064016102b0565b6002546000838152600660205260408082209051631a4f914360e11b815291926001600160a01b03169163349f228691613f9b913391600301906004016157c7565b6020604051808303816000875af1158015613fba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fde91906157eb565b3360009081526009602090815260408083208784529091529020549091508110156140445760405162461bcd60e51b815260206004820152601660248201527518d85b89dd0818d85b98d95b081d1a1a5cc81c995cdd60521b60448201526064016102b0565b3360009081526009602090815260408083208684528252808320546006835281842082516101408101845281546001600160a01b0316815260018201549481019490945260028101549284019290925260038201805491949392916060840191906140ae90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546140da90615260565b80156141275780601f106140fc57610100808354040283529160200191614127565b820191906000526020600020905b81548152906001019060200180831161410a57829003601f168201915b5050505050815260200160048201805461414090615260565b80601f016020809104026020016040519081016040528092919081815260200182805461416c90615260565b80156141b95780601f1061418e576101008083540402835291602001916141b9565b820191906000526020600020905b81548152906001019060200180831161419c57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561422557602002820191906000526020600020905b815481526020019060010190808311614211575b5050505050815260200160088201548152602001600982016040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201805461429590615260565b80601f01602080910402602001604051908101604052809291908181526020018280546142c190615260565b801561430e5780601f106142e35761010080835404028352916020019161430e565b820191906000526020600020905b8154815290600101906020018083116142f157829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461434590615260565b80601f016020809104026020016040519081016040528092919081815260200182805461437190615260565b80156143be5780601f10614393576101008083540402835291602001916143be565b820191906000526020600020905b8154815290600101906020018083116143a157829003601f168201915b5050509190925250505090525060046101008201526000868152600660205260409020600501549091508210156143f85760056101008201525b6101208101805160006020918201819052915142610100919091015286825260068152604091829020835181546001600160a01b0319166001600160a01b039091161781558184015160018201559183015160028301556060830151805184939261446a926003850192910190614a59565b5060808201518051614486916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e082015180516144b6916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161451b92600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161455891600a840191602090910190614a59565b505050600087815260076020526040902054600880548594509092508110614582576145826152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b03909216919091178155828201516001820155604083015160028201556060830151805191926145e192600385019290910190614a59565b50608082015180516145fd916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e0820151805161462d916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161469292600f8701920190614a59565b5060e082015160078201556101008201516008820155610120820151600982015561014082015180516146cf91600a840191602090910190614a59565b50503360008181526009602090815260408083208c8452825280832083905560025460069092529182902091516332f02e1d60e01b81526001600160a01b0390911695506332f02e1d945061472f93506003909101908790600401615804565b600060405180830381600087803b15801561474957600080fd5b505af1158015610d65573d6000803e3d6000fd5b856147bc5760405162461bcd60e51b815260206004820152602960248201527f5265737453746f726167653a207265737454797065206e756c6c206973206e6f6044820152681d08185b1b1bddd95960ba1b60648201526084016102b0565b845161481c5760405162461bcd60e51b815260206004820152602960248201527f5265737453746f726167653a20636f696e54797065206e756c6c206973206e6f6044820152681d08185b1b1bddd95960ba1b60648201526084016102b0565b83516148805760405162461bcd60e51b815260206004820152602d60248201527f5265737453746f726167653a2063757272656e637954797065206e756c6c206960448201526c1cc81b9bdd08185b1b1bddd959609a1b60648201526084016102b0565b826148e05760405162461bcd60e51b815260206004820152602a60248201527f5265737453746f726167653a2072657374436f756e74206e756c6c206973206e6044820152691bdd08185b1b1bddd95960b21b60648201526084016102b0565b8161493c5760405162461bcd60e51b815260206004820152602660248201527f5265737453746f726167653a207072696365206e756c6c206973206e6f7420616044820152651b1b1bddd95960d21b60648201526084016102b0565b805161499b5760405162461bcd60e51b815260206004820152602860248201527f5265737453746f726167653a2070617954797065206e756c6c206973206e6f7460448201526708185b1b1bddd95960c21b60648201526084016102b0565b505050505050565b60405180610140016040528060006001600160a01b031681526020016000815260200160008152602001606081526020016060815260200160008152602001600081526020016060815260200160008152602001614a5460405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001600081526020016000815260200160008152602001606081525090565b905290565b828054614a6590615260565b90600052602060002090601f016020900481019282614a875760008555614acd565b82601f10614aa057805160ff1916838001178555614acd565b82800160010185558215614acd579182015b82811115614acd578251825591602001919060010190614ab2565b50614ad9929150614b17565b5090565b828054828255906000526020600020908101928215614acd5791602002820182811115614acd578251825591602001919060010190614ab2565b5b80821115614ad95760008155600101614b18565b600060208284031215614b3e57600080fd5b5035919050565b60005b83811015614b60578181015183820152602001614b48565b83811115614b6f576000848401525b50505050565b60008151808452614b8d816020860160208601614b45565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b83811015614bd157815187529582019590820190600101614bb5565b509495945050505050565b6000610160825184526020830151602085015260408301516040850152606083015160608501526080830151608085015260a083015160a085015260c08301518160c0860152614c2e82860182614b75565b91505060e083015160e08501526101008084015181860152506101208084015181860152506101408084015185830382870152614c6b8382614b75565b9695505050505050565b80516001600160a01b03168252600061014060208301516020850152604083015160408501526060830151816060860152614cb282860182614b75565b91505060808301518482036080860152614ccc8282614b75565b91505060a083015160a085015260c083015160c085015260e083015184820360e0860152614cfa8282614ba1565b9150506101008084015181860152506101208084015185830382870152614c6b8382614bdc565b602081526000612ca86020830184614c75565b60008060408385031215614d4757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff81118282101715614d9057614d90614d56565b60405290565b604051610120810167ffffffffffffffff81118282101715614d9057614d90614d56565b604051601f8201601f1916810167ffffffffffffffff81118282101715614de357614de3614d56565b604052919050565b600067ffffffffffffffff821115614e0557614e05614d56565b50601f01601f191660200190565b600082601f830112614e2457600080fd5b8135614e37614e3282614deb565b614dba565b818152846020838601011115614e4c57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614e7a57600080fd5b8135602067ffffffffffffffff821115614e9657614e96614d56565b8160051b614ea5828201614dba565b9283528481018201928281019087851115614ebf57600080fd5b83870192505b84831015614ede57823582529183019190830190614ec5565b979650505050505050565b60006101608284031215614efc57600080fd5b614f04614d6c565b9050813581526020820135602082015260408201356040820152606082013560608201526080820135608082015260a082013560a082015260c082013567ffffffffffffffff80821115614f5757600080fd5b614f6385838601614e13565b60c084015260e084810135908401526101008085013590840152610120808501359084015261014091508184013581811115614f9e57600080fd5b614faa86828701614e13565b8385015250505092915050565b600080600080600080600060e0888a031215614fd257600080fd5b87359650602088013567ffffffffffffffff80821115614ff157600080fd5b614ffd8b838c01614e13565b975060408a013591508082111561501357600080fd5b61501f8b838c01614e13565b965060608a0135955060808a0135945060a08a013591508082111561504357600080fd5b61504f8b838c01614e69565b935060c08a013591508082111561506557600080fd5b506150728a828b01614ee9565b91505092959891949750929550565b6001600160a01b038116811461273457600080fd5b6000806000606084860312156150ab57600080fd5b83356150b681615081565b925060208401356150c681615081565b915060408401356150d681615081565b809150509250925092565b600080600080600080600080610100898b0312156150fe57600080fd5b88359750602089013567ffffffffffffffff8082111561511d57600080fd5b6151298c838d01614e13565b985060408b013591508082111561513f57600080fd5b61514b8c838d01614e13565b975060608b0135965060808b0135955060a08b0135945060c08b013591508082111561517657600080fd5b6151828c838d01614e69565b935060e08b013591508082111561519857600080fd5b506151a58b828c01614ee9565b9150509295985092959890939650565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561520a57603f198886030184526151f8858351614c75565b945092850192908501906001016151dc565b5092979650505050505050565b6000806040838503121561522a57600080fd5b823561523581615081565b946020939093013593505050565b60006020828403121561525557600080fd5b8135612ca881615081565b600181811c9082168061527457607f821691505b6020821081141561529557634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601690820152751c995cdd081859191c995cdcc81b9bdd08195e1a5cdd60521b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b80516152ec81615081565b919050565b600082601f83011261530257600080fd5b8151615310614e3282614deb565b81815284602083860101111561532557600080fd5b615336826020830160208701614b45565b949350505050565b60006040828403121561535057600080fd5b6040516040810181811067ffffffffffffffff8211171561537357615373614d56565b604052825181526020928301519281019290925250919050565b600060e0828403121561539f57600080fd5b60405160e0810181811067ffffffffffffffff821117156153c2576153c2614d56565b8060405250809150825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201525092915050565b60006020828403121561542357600080fd5b815167ffffffffffffffff8082111561543b57600080fd5b90830190610200828603121561545057600080fd5b615458614d96565b615461836152e1565b815260208301518281111561547557600080fd5b615481878286016152f1565b60208301525060408301518281111561549957600080fd5b6154a5878286016152f1565b604083015250606083015160608201526080830151608082015260a083015160a082015260c083015160c08201526154e08660e0850161533e565b60e08201526154f386610120850161538d565b61010082015295945050505050565b60006020828403121561551457600080fd5b81518015158114612ca857600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60018060a01b038716815260e06020820152600060e0820152600061010080604084015261558981840189614b75565b9150508560608301528460808301528360a08301528260c0830152979650505050505050565b602081526000612ca86020830184614b75565b6000602082840312156155d457600080fd5b8151612ca881615081565b634e487b7160e01b600052601160045260246000fd5b60008219821115615608576156086155df565b500190565b60008282101561561f5761561f6155df565b500390565b600081600019048311821515161561563e5761563e6155df565b500290565b60006101008a83528960208401528060408401526156638184018a614b75565b905082810360608401526156778189614b75565b90508660808401528560a084015282810360c08401526156978186614ba1565b905082810360e08401526156ab8185614bdc565b9b9a5050505050505050505050565b87815260e0602082015260006156d360e0830189614b75565b82810360408401526156e58189614b75565b905086606084015285608084015282810360a08401526157058186614ba1565b905082810360c08401526157198185614bdc565b9a9950505050505050505050565b8054600090600181811c908083168061574157607f831692505b602080841082141561576357634e487b7160e01b600052602260045260246000fd5b8388526020880182801561577e576001811461578f576157ba565b60ff198716825282820197506157ba565b60008981526020902060005b878110156157b45781548482015290860190840161579b565b83019850505b5050505050505092915050565b6001600160a01b038316815260406020820181905260009061533690830184615727565b6000602082840312156157fd57600080fd5b5051919050565b6001600160a01b038416815260606020820181905260009061582890830185615727565b905082604083015294935050505056fea2646970667358221220caf8fd3401c2316f9fd858009c9db73c516a1dbaf9a38ff8a218cbfa495c828364736f6c634300080b0033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806386bf422b11610097578063e9a5f96d11610066578063e9a5f96d146101e2578063f2fde38b14610226578063f5fa8f9a14610239578063f92a3bb41461024c57600080fd5b806386bf422b1461018c5780638da5cb5b1461019f5780639e9c36a3146101ba578063a42fd334146101cf57600080fd5b8063573b6bbe116100d3578063573b6bbe1461014b5780635aaf63891461015e578063715018a614610171578063793e3e371461017957600080fd5b80630129ad51146100fa5780630e27b03c146101235780632320dc4d14610138575b600080fd5b61010d610108366004614b2c565b61025f565b60405161011a9190614d21565b60405180910390f35b610136610131366004614d34565b610631565b005b610136610146366004614b2c565b610d70565b610136610159366004614d34565b611508565b61013661016c366004614fb7565b611a8a565b610136611c1e565b610136610187366004615096565b611c54565b61013661019a3660046150e1565b611cd8565b6000546040516001600160a01b03909116815260200161011a565b6101c26122d4565b60405161011a91906151b5565b6101366101dd3660046150e1565b61268c565b6102186101f0366004615217565b6001600160a01b03919091166000908152600960209081526040808320938352929052205490565b60405190815260200161011a565b610136610234366004615243565b61269c565b610136610247366004614b2c565b612737565b61013661025a366004614d34565b612740565b6102676149a3565b816102b95760405162461bcd60e51b815260206004820152601a60248201527f726573744e6f206e756c6c206973206e6f7420616c6c6f77656400000000000060448201526064015b60405180910390fd5b600082815260066020908152604080832081516101408101835281546001600160a01b0316815260018201549381019390935260028101549183019190915260038101805460608401919061030d90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461033990615260565b80156103865780601f1061035b57610100808354040283529160200191610386565b820191906000526020600020905b81548152906001019060200180831161036957829003601f168201915b5050505050815260200160048201805461039f90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546103cb90615260565b80156104185780601f106103ed57610100808354040283529160200191610418565b820191906000526020600020905b8154815290600101906020018083116103fb57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561048457602002820191906000526020600020905b815481526020019060010190808311610470575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546104f490615260565b80601f016020809104026020016040519081016040528092919081815260200182805461052090615260565b801561056d5780601f106105425761010080835404028352916020019161056d565b820191906000526020600020905b81548152906001019060200180831161055057829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546105a490615260565b80601f01602080910402602001604051908101604052809291908181526020018280546105d090615260565b801561061d5780601f106105f25761010080835404028352916020019161061d565b820191906000526020600020905b81548152906001019060200180831161060057829003601f168201915b505050919092525050509052509392505050565b60008281526006602052604090205482906001600160a01b031633146106695760405162461bcd60e51b81526004016102b09061529b565b81600114806106785750816003145b6106ba5760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420726573742073746174757360681b60448201526064016102b0565b600083815260066020908152604080832081516101408101835281546001600160a01b0316815260018201549381019390935260028101549183019190915260038101805460608401919061070e90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461073a90615260565b80156107875780601f1061075c57610100808354040283529160200191610787565b820191906000526020600020905b81548152906001019060200180831161076a57829003601f168201915b505050505081526020016004820180546107a090615260565b80601f01602080910402602001604051908101604052809291908181526020018280546107cc90615260565b80156108195780601f106107ee57610100808354040283529160200191610819565b820191906000526020600020905b8154815290600101906020018083116107fc57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561088557602002820191906000526020600020905b815481526020019060010190808311610871575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546108f590615260565b80601f016020809104026020016040519081016040528092919081815260200182805461092190615260565b801561096e5780601f106109435761010080835404028352916020019161096e565b820191906000526020600020905b81548152906001019060200180831161095157829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546109a590615260565b80601f01602080910402602001604051908101604052809291908181526020018280546109d190615260565b8015610a1e5780601f106109f357610100808354040283529160200191610a1e565b820191906000526020600020905b815481529060010190602001808311610a0157829003601f168201915b50505050508152505081525050905080610100015160011480610a4657508061010001516003145b610a925760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642072657374207374617475732c6f7074206572726f7200000060448201526064016102b0565b61010081810184905261012082015142910152600084815260066020908152604091829020835181546001600160a01b0319166001600160a01b0390911617815581840151600182015591830151600283015560608301518051849392610b00926003850192910190614a59565b5060808201518051610b1c916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051610b4c916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c08301518051610bb192600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051610bee91600a840191602090910190614a59565b505050600086815260076020526040902054600880548594509092508110610c1857610c186152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b0390921691909117815582820151600182015560408301516002820155606083015180519192610c7792600385019290910190614a59565b5060808201518051610c93916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051610cc3916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c08301518051610d2892600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051610d6591600a840191602090910190614a59565b505050505050505050565b60008181526006602052604090205481906001600160a01b03163314610da85760405162461bcd60e51b81526004016102b09061529b565b600082815260066020526040902060080154600114610e025760405162461bcd60e51b815260206004820152601660248201527518d85b89dd0818da185b99d9481d1a1a5cc81c995cdd60521b60448201526064016102b0565b600082815260066020526040902060020154600114610e575760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642072657374207479706560781b60448201526064016102b0565b6000828152600660205260409020600581015460099091015410610eb65760405162461bcd60e51b81526020600482015260166024820152751d1a1a5cc81c995cdd081a185cc8199a5b9a5cda195960521b60448201526064016102b0565b600082815260066020908152604080832081516101408101835281546001600160a01b03168152600182015493810193909352600281015491830191909152600381018054606084019190610f0a90615260565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3690615260565b8015610f835780601f10610f5857610100808354040283529160200191610f83565b820191906000526020600020905b815481529060010190602001808311610f6657829003601f168201915b50505050508152602001600482018054610f9c90615260565b80601f0160208091040260200160405190810160405280929190818152602001828054610fc890615260565b80156110155780601f10610fea57610100808354040283529160200191611015565b820191906000526020600020905b815481529060010190602001808311610ff857829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561108157602002820191906000526020600020905b81548152602001906001019080831161106d575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546110f190615260565b80601f016020809104026020016040519081016040528092919081815260200182805461111d90615260565b801561116a5780601f1061113f5761010080835404028352916020019161116a565b820191906000526020600020905b81548152906001019060200180831161114d57829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546111a190615260565b80601f01602080910402602001604051908101604052809291908181526020018280546111cd90615260565b801561121a5780601f106111ef5761010080835404028352916020019161121a565b820191906000526020600020905b8154815290600101906020018083116111fd57829003601f168201915b5050509190925250505090525060046101008281019190915261012082015142910152600084815260066020908152604091829020835181546001600160a01b0319166001600160a01b039091161781558184015160018201559183015160028301556060830151805193945084936112999260038501920190614a59565b50608082015180516112b5916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e082015180516112e5916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161134a92600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161138791600a840191602090910190614a59565b5050506000858152600760205260409020546008805485945090925081106113b1576113b16152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b039092169190911781558282015160018201556040830151600282015560608301518051919261141092600385019290910190614a59565b506080820151805161142c916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e0820151805161145c916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c083015180516114c192600f8701920190614a59565b5060e082015160078201556101008201516008820155610120820151600982015561014082015180516114fe91600a840191602090910190614a59565b5050505050505050565b600a546001600160a01b0316331461155d5760405162461bcd60e51b8152602060048201526018602482015277496e76616c696420636f6e7472616374206164647265737360401b60448201526064016102b0565b600082815260066020908152604080832081516101408101835281546001600160a01b031681526001820154938101939093526002810154918301919091526003810180546060840191906115b190615260565b80601f01602080910402602001604051908101604052809291908181526020018280546115dd90615260565b801561162a5780601f106115ff5761010080835404028352916020019161162a565b820191906000526020600020905b81548152906001019060200180831161160d57829003601f168201915b5050505050815260200160048201805461164390615260565b80601f016020809104026020016040519081016040528092919081815260200182805461166f90615260565b80156116bc5780601f10611691576101008083540402835291602001916116bc565b820191906000526020600020905b81548152906001019060200180831161169f57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561172857602002820191906000526020600020905b815481526020019060010190808311611714575b5050505050815260200160088201548152602001600982016040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201805461179890615260565b80601f01602080910402602001604051908101604052809291908181526020018280546117c490615260565b80156118115780601f106117e657610100808354040283529160200191611811565b820191906000526020600020905b8154815290600101906020018083116117f457829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461184890615260565b80601f016020809104026020016040519081016040528092919081815260200182805461187490615260565b80156118c15780601f10611896576101008083540402835291602001916118c1565b820191906000526020600020905b8154815290600101906020018083116118a457829003601f168201915b5050505050815250508152505090506000821180156118e65750610120810151518211155b6119205760405162461bcd60e51b815260206004820152600b60248201526a31b7bab73a1032b93937b960a91b60448201526064016102b0565b8060400151600214156119825780516001600160a01b0316600090815260096020908152604080832086845290915290205461195c9083612c9c565b81516001600160a01b031660009081526009602090815260408083208784529091529020555b610120810151516119939083612caf565b610120820180519190915251602001516119ad9083612c9c565b81610120015160200181815250506119d28160c0015182610120015160200151612cbb565b61012082018051606090810192909252519081015160409091015111611a015780610120015160400151611a0c565b806101200151606001515b61012082018051604090810192909252600161010080850182905291514292019190915260008581526006602090815290839020845181546001600160a01b0319166001600160a01b039091161781558185015192810192909255918301516002820155606083015180518493611299926003850192910190614a59565b86600114611aca5760405162461bcd60e51b815260206004820152600d60248201526c1b5d5cdd08189d5e481c995cdd609a1b60448201526064016102b0565b600354604051639bd7417f60e01b81523360048201526000916001600160a01b031690639bd7417f90602401600060405180830381865afa158015611b13573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b3b9190810190615411565b90506000600260009054906101000a90046001600160a01b03166001600160a01b0316635ff2efad6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb69190615502565b90508080611bc8575081608001516003145b611c035760405162461bcd60e51b815260206004820152600c60248201526b34b73b30b634b2103ab9b2b960a11b60448201526064016102b0565b611c1289898989898989612cc7565b50505050505050505050565b6000546001600160a01b03163314611c485760405162461bcd60e51b81526004016102b090615524565b611c5260006131c2565b565b6000546001600160a01b03163314611c7e5760405162461bcd60e51b81526004016102b090615524565b600a80546001600160a01b038084166001600160a01b0319928316179092556002805486841690831681179091556003805493861693831693909317909255600480549091169091179055611cd36005613212565b505050565b60008881526006602052604090205488906001600160a01b03163314611d105760405162461bcd60e51b81526004016102b09061529b565b88611d4e5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420726573744e6f60901b60448201526064016102b0565b600089815260066020908152604080832081516101408101835281546001600160a01b03168152600182015493810193909352600281015491830191909152600381018054606084019190611da290615260565b80601f0160208091040260200160405190810160405280929190818152602001828054611dce90615260565b8015611e1b5780601f10611df057610100808354040283529160200191611e1b565b820191906000526020600020905b815481529060010190602001808311611dfe57829003601f168201915b50505050508152602001600482018054611e3490615260565b80601f0160208091040260200160405190810160405280929190818152602001828054611e6090615260565b8015611ead5780601f10611e8257610100808354040283529160200191611ead565b820191906000526020600020905b815481529060010190602001808311611e9057829003601f168201915b50505050508152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020018280548015611f1957602002820191906000526020600020905b815481526020019060010190808311611f05575b50505050508152602001600882015481526020016009820160405180610160016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682018054611f8990615260565b80601f0160208091040260200160405190810160405280929190818152602001828054611fb590615260565b80156120025780601f10611fd757610100808354040283529160200191612002565b820191906000526020600020905b815481529060010190602001808311611fe557829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461203990615260565b80601f016020809104026020016040519081016040528092919081815260200182805461206590615260565b80156120b25780601f10612087576101008083540402835291602001916120b2565b820191906000526020600020905b81548152906001019060200180831161209557829003601f168201915b5050505050815250508152505090506000816020015114156121075760405162461bcd60e51b815260206004820152600e60248201526d1c995cdd081b9bdd08195e1a5cdd60921b60448201526064016102b0565b8060400151600214156122c55760028054604051634e23ea9760e01b81526001600160a01b0390911691634e23ea979161214e9133918e918d916001908290600401615559565b600060405180830381600087803b15801561216857600080fd5b505af115801561217c573d6000803e3d6000fd5b50505050600061218c8888612c9c565b600254604051630bc67f9b60e01b81529192506000916001600160a01b0390911690630bc67f9b906121c2908e906004016155af565b6020604051808303816000875af11580156121e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220591906155c2565b600480546040516323b872dd60e01b815233928101929092526001600160a01b03908116602483015260448201859052919250908216906323b872dd90606401600060405180830381600087803b15801561225f57600080fd5b505af1158015612273573d6000803e3d6000fd5b505050508860096000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060008282546122bd91906155f5565b909155505050505b611c128a8a8a8a89898961323b565b60606008805480602002602001604051908101604052809291908181526020016000905b8282101561268357600084815260209081902060408051610140810182526014860290920180546001600160a01b0316835260018101549383019390935260028301549082015260038201805491929160608401919061235790615260565b80601f016020809104026020016040519081016040528092919081815260200182805461238390615260565b80156123d05780601f106123a5576101008083540402835291602001916123d0565b820191906000526020600020905b8154815290600101906020018083116123b357829003601f168201915b505050505081526020016004820180546123e990615260565b80601f016020809104026020016040519081016040528092919081815260200182805461241590615260565b80156124625780601f1061243757610100808354040283529160200191612462565b820191906000526020600020905b81548152906001019060200180831161244557829003601f168201915b505050505081526020016005820154815260200160068201548152602001600782018054806020026020016040519081016040528092919081815260200182805480156124ce57602002820191906000526020600020905b8154815260200190600101908083116124ba575b5050505050815260200160088201548152602001600982016040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201805461253e90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461256a90615260565b80156125b75780601f1061258c576101008083540402835291602001916125b7565b820191906000526020600020905b81548152906001019060200180831161259a57829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a820180546125ee90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461261a90615260565b80156126675780601f1061263c57610100808354040283529160200191612667565b820191906000526020600020905b81548152906001019060200180831161264a57829003601f168201915b50505050508152505081525050815260200190600101906122f8565b50505050905090565b6114fe8888888888888888613a5d565b6000546001600160a01b031633146126c65760405162461bcd60e51b81526004016102b090615524565b6001600160a01b03811661272b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102b0565b612734816131c2565b50565b61273481613db8565b600a546001600160a01b031633146127955760405162461bcd60e51b8152602060048201526018602482015277496e76616c696420636f6e7472616374206164647265737360401b60448201526064016102b0565b600082815260066020908152604080832081516101408101835281546001600160a01b031681526001820154938101939093526002810154918301919091526003810180546060840191906127e990615260565b80601f016020809104026020016040519081016040528092919081815260200182805461281590615260565b80156128625780601f1061283757610100808354040283529160200191612862565b820191906000526020600020905b81548152906001019060200180831161284557829003601f168201915b5050505050815260200160048201805461287b90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546128a790615260565b80156128f45780601f106128c9576101008083540402835291602001916128f4565b820191906000526020600020905b8154815290600101906020018083116128d757829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561296057602002820191906000526020600020905b81548152602001906001019080831161294c575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546129d090615260565b80601f01602080910402602001604051908101604052809291908181526020018280546129fc90615260565b8015612a495780601f10612a1e57610100808354040283529160200191612a49565b820191906000526020600020905b815481529060010190602001808311612a2c57829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a82018054612a8090615260565b80601f0160208091040260200160405190810160405280929190818152602001828054612aac90615260565b8015612af95780601f10612ace57610100808354040283529160200191612af9565b820191906000526020600020905b815481529060010190602001808311612adc57829003601f168201915b50505050508152505081525050905081816101200151602001511015612b615760405162461bcd60e51b815260206004820152601e60248201527f5265737453746f726167653a66696e69736820636f756e74206572726f72000060448201526064016102b0565b806040015160021415612bc35780516001600160a01b03166000908152600960209081526040808320868452909152902054612b9d9083612caf565b81516001600160a01b031660009081526009602090815260408083208784529091529020555b61012081015151612bd49083612c9c565b61012082018051919091525160200151612bee9083612caf565b8161012001516020018181525050612c138160c0015182610120015160200151612cbb565b61012082018051606001919091525160200151612c335760026101008201525b6101208101514261010090910152600083815260066020908152604091829020835181546001600160a01b0319166001600160a01b0390911617815581840151600182015591830151600283015560608301518051849392611299926003850192910190614a59565b6000612ca882846155f5565b9392505050565b6000612ca8828461560d565b6000612ca88284615624565b600060026001541415612d1c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102b0565b6002600155612d2f88888888888861475d565b6000612d3a60055490565b60008181526006602052604090206001015490915015612d895760405162461bcd60e51b815260206004820152600a6024820152691c995cdd08195e1a5cdd60b21b60448201526064016102b0565b6000808452602084018790524260e0850152610100840152612dab8686612cbb565b83606001511180612dbe57506060830151155b15612dd357612dcd8686612cbb565b60608401525b604080516101408101825233815260208082018481528284018d8152606084018d8152608085018d905260a085018c905260c085018b905260e085018a90526001610100860181905261012086018a905260008881526006865296909620855181546001600160a01b0319166001600160a01b0390911617815592519583019590955551600282015592518051929384939092612e77926003850192910190614a59565b5060808201518051612e93916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051612ec3916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c08301518051612f2892600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051612f6591600a840191602090910190614a59565b50506008805460018101825560009190915284517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3601490920291820180546001600160a01b0319166001600160a01b039092169190911781556020808701517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee484015560408701517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee58401556060870151805188975092955061305094507ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee6909301920190614a59565b506080820151805161306c916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e0820151805161309c916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161310192600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161313e91600a840191602090910190614a59565b5050600854613153935060019250905061560d565b60008381526007602052604090205561316c6005613212565b7f3f01ce3e2eed7c005ee70ead085a70f63e460282bbd87ff1009d38d94a7bc92d828b8b8b8b8b8b8b6040516131a9989796959493929190615643565b60405180910390a1506001805598975050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805461321e5761271081555b600181600001600082825461323391906155f5565b909155505050565b866132795760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420726573744e6f60901b60448201526064016102b0565b600087815260066020908152604080832081516101408101835281546001600160a01b031681526001820154938101939093526002810154918301919091526003810180546060840191906132cd90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546132f990615260565b80156133465780601f1061331b57610100808354040283529160200191613346565b820191906000526020600020905b81548152906001019060200180831161332957829003601f168201915b5050505050815260200160048201805461335f90615260565b80601f016020809104026020016040519081016040528092919081815260200182805461338b90615260565b80156133d85780601f106133ad576101008083540402835291602001916133d8565b820191906000526020600020905b8154815290600101906020018083116133bb57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561344457602002820191906000526020600020905b815481526020019060010190808311613430575b505050505081526020016008820154815260200160098201604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820180546134b490615260565b80601f01602080910402602001604051908101604052809291908181526020018280546134e090615260565b801561352d5780601f106135025761010080835404028352916020019161352d565b820191906000526020600020905b81548152906001019060200180831161351057829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461356490615260565b80601f016020809104026020016040519081016040528092919081815260200182805461359090615260565b80156135dd5780601f106135b2576101008083540402835291602001916135dd565b820191906000526020600020905b8154815290600101906020018083116135c057829003601f168201915b50505091909252505050905250600161010082015287519091501561360457606081018790525b85511561361357608081018690525b83156136215760c081018490525b841561367c57848160a00181815161363991906155f5565b90525061012081015160200180518691906136559083906155f5565b9052506101208101516020015160c08201516136719190612cbb565b610120820151606001525b82511561368b5760e081018390525b6040820151156136cb5780610120015160600151826040015111156136ba576101208101516060015160408301525b604080830151610120830151909101525b6080820151156136e657608080830151610120830151909101525b60a0820151156137015760a080830151610120830151909101525b60c0820151511561371d5760c080830151610120830151909101525b61012082015115613738576101208083015182820151909101525b6101208101514261010090910152600088815260066020908152604091829020835181546001600160a01b0319166001600160a01b03909116178155818401516001820155918301516002830155606083015180518493926137a1926003850192910190614a59565b50608082015180516137bd916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e082015180516137ed916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161385292600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161388f91600a840191602090910190614a59565b50505060008a8152600760205260409020546008805485945090925081106138b9576138b96152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b039092169190911781558282015160018201556040830151600282015560608301518051919261391892600385019290910190614a59565b5060808201518051613934916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e08201518051613964916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c083015180516139c992600f8701920190614a59565b5060e08201516007820155610100820151600882015561012082015160098201556101408201518051613a0691600a840191602090910190614a59565b5050509050507fa8cddeb44b34495261936a34d0dc633acf6220fb5e03216a8de51013fe400b698888888460a00151888888604051613a4b97969594939291906156ba565b60405180910390a15050505050505050565b87600214613a9e5760405162461bcd60e51b815260206004820152600e60248201526d1b5d5cdd081cd95b1b081c995cdd60921b60448201526064016102b0565b60008511613ae05760405162461bcd60e51b815260206004820152600f60248201526e3932b9ba21b7bab73a1032b93937b960891b60448201526064016102b0565b600354604051639bd7417f60e01b81523360048201526000916001600160a01b031690639bd7417f90602401600060405180830381865afa158015613b29573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613b519190810190615411565b90506000600260009054906101000a90046001600160a01b03166001600160a01b0316635ff2efad6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bcc9190615502565b90508080613bde575081608001516003145b613c195760405162461bcd60e51b815260206004820152600c60248201526b34b73b30b634b2103ab9b2b960a11b60448201526064016102b0565b60028054604051634e23ea9760e01b81526001600160a01b0390911691634e23ea9791613c539133918e918d916001908290600401615559565b600060405180830381600087803b158015613c6d57600080fd5b505af1158015613c81573d6000803e3d6000fd5b505050506000613c918888612c9c565b600254604051630bc67f9b60e01b81529192506000916001600160a01b0390911690630bc67f9b90613cc7908e906004016155af565b6020604051808303816000875af1158015613ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d0a91906155c2565b600480546040516323b872dd60e01b815233928101929092526001600160a01b03908116602483015260448201859052919250908216906323b872dd90606401600060405180830381600087803b158015613d6457600080fd5b505af1158015613d78573d6000803e3d6000fd5b505050506000613d8d8d8d8d8d8c8c8c612cc7565b3360009081526009602090815260408083209383529290522099909955505050505050505050505050565b60008181526006602052604090205481906001600160a01b03163314613df05760405162461bcd60e51b81526004016102b09061529b565b600082815260066020526040902060080154600114613e4a5760405162461bcd60e51b815260206004820152601660248201527518d85b89dd0818d85b98d95b081d1a1a5cc81c995cdd60521b60448201526064016102b0565b600082815260066020526040902060029081015414613e9f5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642072657374207479706560781b60448201526064016102b0565b6000828152600660205260409020600581015460099091015410613efe5760405162461bcd60e51b81526020600482015260166024820152751d1a1a5cc81c995cdd081a185cc8199a5b9a5cda195960521b60448201526064016102b0565b336000908152600960209081526040808320858452909152902054613f595760405162461bcd60e51b81526020600482015260116024820152701c995cdd081a185cc8199a5b9a5cda1959607a1b60448201526064016102b0565b6002546000838152600660205260408082209051631a4f914360e11b815291926001600160a01b03169163349f228691613f9b913391600301906004016157c7565b6020604051808303816000875af1158015613fba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fde91906157eb565b3360009081526009602090815260408083208784529091529020549091508110156140445760405162461bcd60e51b815260206004820152601660248201527518d85b89dd0818d85b98d95b081d1a1a5cc81c995cdd60521b60448201526064016102b0565b3360009081526009602090815260408083208684528252808320546006835281842082516101408101845281546001600160a01b0316815260018201549481019490945260028101549284019290925260038201805491949392916060840191906140ae90615260565b80601f01602080910402602001604051908101604052809291908181526020018280546140da90615260565b80156141275780601f106140fc57610100808354040283529160200191614127565b820191906000526020600020905b81548152906001019060200180831161410a57829003601f168201915b5050505050815260200160048201805461414090615260565b80601f016020809104026020016040519081016040528092919081815260200182805461416c90615260565b80156141b95780601f1061418e576101008083540402835291602001916141b9565b820191906000526020600020905b81548152906001019060200180831161419c57829003601f168201915b5050505050815260200160058201548152602001600682015481526020016007820180548060200260200160405190810160405280929190818152602001828054801561422557602002820191906000526020600020905b815481526020019060010190808311614211575b5050505050815260200160088201548152602001600982016040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201805461429590615260565b80601f01602080910402602001604051908101604052809291908181526020018280546142c190615260565b801561430e5780601f106142e35761010080835404028352916020019161430e565b820191906000526020600020905b8154815290600101906020018083116142f157829003601f168201915b50505050508152602001600782015481526020016008820154815260200160098201548152602001600a8201805461434590615260565b80601f016020809104026020016040519081016040528092919081815260200182805461437190615260565b80156143be5780601f10614393576101008083540402835291602001916143be565b820191906000526020600020905b8154815290600101906020018083116143a157829003601f168201915b5050509190925250505090525060046101008201526000868152600660205260409020600501549091508210156143f85760056101008201525b6101208101805160006020918201819052915142610100919091015286825260068152604091829020835181546001600160a01b0319166001600160a01b039091161781558184015160018201559183015160028301556060830151805184939261446a926003850192910190614a59565b5060808201518051614486916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e082015180516144b6916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161451b92600f8701920190614a59565b5060e0820151600782015561010082015160088201556101208201516009820155610140820151805161455891600a840191602090910190614a59565b505050600087815260076020526040902054600880548594509092508110614582576145826152cb565b600091825260209182902083516014929092020180546001600160a01b0319166001600160a01b03909216919091178155828201516001820155604083015160028201556060830151805191926145e192600385019290910190614a59565b50608082015180516145fd916004840191602090910190614a59565b5060a0820151600582015560c0820151600682015560e0820151805161462d916007840191602090910190614add565b506101008201516008820155610120820151805160098301908155602080830151600a8501556040830151600b8501556060830151600c8501556080830151600d85015560a0830151600e85015560c0830151805161469292600f8701920190614a59565b5060e082015160078201556101008201516008820155610120820151600982015561014082015180516146cf91600a840191602090910190614a59565b50503360008181526009602090815260408083208c8452825280832083905560025460069092529182902091516332f02e1d60e01b81526001600160a01b0390911695506332f02e1d945061472f93506003909101908790600401615804565b600060405180830381600087803b15801561474957600080fd5b505af1158015610d65573d6000803e3d6000fd5b856147bc5760405162461bcd60e51b815260206004820152602960248201527f5265737453746f726167653a207265737454797065206e756c6c206973206e6f6044820152681d08185b1b1bddd95960ba1b60648201526084016102b0565b845161481c5760405162461bcd60e51b815260206004820152602960248201527f5265737453746f726167653a20636f696e54797065206e756c6c206973206e6f6044820152681d08185b1b1bddd95960ba1b60648201526084016102b0565b83516148805760405162461bcd60e51b815260206004820152602d60248201527f5265737453746f726167653a2063757272656e637954797065206e756c6c206960448201526c1cc81b9bdd08185b1b1bddd959609a1b60648201526084016102b0565b826148e05760405162461bcd60e51b815260206004820152602a60248201527f5265737453746f726167653a2072657374436f756e74206e756c6c206973206e6044820152691bdd08185b1b1bddd95960b21b60648201526084016102b0565b8161493c5760405162461bcd60e51b815260206004820152602660248201527f5265737453746f726167653a207072696365206e756c6c206973206e6f7420616044820152651b1b1bddd95960d21b60648201526084016102b0565b805161499b5760405162461bcd60e51b815260206004820152602860248201527f5265737453746f726167653a2070617954797065206e756c6c206973206e6f7460448201526708185b1b1bddd95960c21b60648201526084016102b0565b505050505050565b60405180610140016040528060006001600160a01b031681526020016000815260200160008152602001606081526020016060815260200160008152602001600081526020016060815260200160008152602001614a5460405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001600081526020016000815260200160008152602001606081525090565b905290565b828054614a6590615260565b90600052602060002090601f016020900481019282614a875760008555614acd565b82601f10614aa057805160ff1916838001178555614acd565b82800160010185558215614acd579182015b82811115614acd578251825591602001919060010190614ab2565b50614ad9929150614b17565b5090565b828054828255906000526020600020908101928215614acd5791602002820182811115614acd578251825591602001919060010190614ab2565b5b80821115614ad95760008155600101614b18565b600060208284031215614b3e57600080fd5b5035919050565b60005b83811015614b60578181015183820152602001614b48565b83811115614b6f576000848401525b50505050565b60008151808452614b8d816020860160208601614b45565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b83811015614bd157815187529582019590820190600101614bb5565b509495945050505050565b6000610160825184526020830151602085015260408301516040850152606083015160608501526080830151608085015260a083015160a085015260c08301518160c0860152614c2e82860182614b75565b91505060e083015160e08501526101008084015181860152506101208084015181860152506101408084015185830382870152614c6b8382614b75565b9695505050505050565b80516001600160a01b03168252600061014060208301516020850152604083015160408501526060830151816060860152614cb282860182614b75565b91505060808301518482036080860152614ccc8282614b75565b91505060a083015160a085015260c083015160c085015260e083015184820360e0860152614cfa8282614ba1565b9150506101008084015181860152506101208084015185830382870152614c6b8382614bdc565b602081526000612ca86020830184614c75565b60008060408385031215614d4757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff81118282101715614d9057614d90614d56565b60405290565b604051610120810167ffffffffffffffff81118282101715614d9057614d90614d56565b604051601f8201601f1916810167ffffffffffffffff81118282101715614de357614de3614d56565b604052919050565b600067ffffffffffffffff821115614e0557614e05614d56565b50601f01601f191660200190565b600082601f830112614e2457600080fd5b8135614e37614e3282614deb565b614dba565b818152846020838601011115614e4c57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614e7a57600080fd5b8135602067ffffffffffffffff821115614e9657614e96614d56565b8160051b614ea5828201614dba565b9283528481018201928281019087851115614ebf57600080fd5b83870192505b84831015614ede57823582529183019190830190614ec5565b979650505050505050565b60006101608284031215614efc57600080fd5b614f04614d6c565b9050813581526020820135602082015260408201356040820152606082013560608201526080820135608082015260a082013560a082015260c082013567ffffffffffffffff80821115614f5757600080fd5b614f6385838601614e13565b60c084015260e084810135908401526101008085013590840152610120808501359084015261014091508184013581811115614f9e57600080fd5b614faa86828701614e13565b8385015250505092915050565b600080600080600080600060e0888a031215614fd257600080fd5b87359650602088013567ffffffffffffffff80821115614ff157600080fd5b614ffd8b838c01614e13565b975060408a013591508082111561501357600080fd5b61501f8b838c01614e13565b965060608a0135955060808a0135945060a08a013591508082111561504357600080fd5b61504f8b838c01614e69565b935060c08a013591508082111561506557600080fd5b506150728a828b01614ee9565b91505092959891949750929550565b6001600160a01b038116811461273457600080fd5b6000806000606084860312156150ab57600080fd5b83356150b681615081565b925060208401356150c681615081565b915060408401356150d681615081565b809150509250925092565b600080600080600080600080610100898b0312156150fe57600080fd5b88359750602089013567ffffffffffffffff8082111561511d57600080fd5b6151298c838d01614e13565b985060408b013591508082111561513f57600080fd5b61514b8c838d01614e13565b975060608b0135965060808b0135955060a08b0135945060c08b013591508082111561517657600080fd5b6151828c838d01614e69565b935060e08b013591508082111561519857600080fd5b506151a58b828c01614ee9565b9150509295985092959890939650565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561520a57603f198886030184526151f8858351614c75565b945092850192908501906001016151dc565b5092979650505050505050565b6000806040838503121561522a57600080fd5b823561523581615081565b946020939093013593505050565b60006020828403121561525557600080fd5b8135612ca881615081565b600181811c9082168061527457607f821691505b6020821081141561529557634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601690820152751c995cdd081859191c995cdcc81b9bdd08195e1a5cdd60521b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b80516152ec81615081565b919050565b600082601f83011261530257600080fd5b8151615310614e3282614deb565b81815284602083860101111561532557600080fd5b615336826020830160208701614b45565b949350505050565b60006040828403121561535057600080fd5b6040516040810181811067ffffffffffffffff8211171561537357615373614d56565b604052825181526020928301519281019290925250919050565b600060e0828403121561539f57600080fd5b60405160e0810181811067ffffffffffffffff821117156153c2576153c2614d56565b8060405250809150825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201525092915050565b60006020828403121561542357600080fd5b815167ffffffffffffffff8082111561543b57600080fd5b90830190610200828603121561545057600080fd5b615458614d96565b615461836152e1565b815260208301518281111561547557600080fd5b615481878286016152f1565b60208301525060408301518281111561549957600080fd5b6154a5878286016152f1565b604083015250606083015160608201526080830151608082015260a083015160a082015260c083015160c08201526154e08660e0850161533e565b60e08201526154f386610120850161538d565b61010082015295945050505050565b60006020828403121561551457600080fd5b81518015158114612ca857600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60018060a01b038716815260e06020820152600060e0820152600061010080604084015261558981840189614b75565b9150508560608301528460808301528360a08301528260c0830152979650505050505050565b602081526000612ca86020830184614b75565b6000602082840312156155d457600080fd5b8151612ca881615081565b634e487b7160e01b600052601160045260246000fd5b60008219821115615608576156086155df565b500190565b60008282101561561f5761561f6155df565b500390565b600081600019048311821515161561563e5761563e6155df565b500290565b60006101008a83528960208401528060408401526156638184018a614b75565b905082810360608401526156778189614b75565b90508660808401528560a084015282810360c08401526156978186614ba1565b905082810360e08401526156ab8185614bdc565b9b9a5050505050505050505050565b87815260e0602082015260006156d360e0830189614b75565b82810360408401526156e58189614b75565b905086606084015285608084015282810360a08401526157058186614ba1565b905082810360c08401526157198185614bdc565b9a9950505050505050505050565b8054600090600181811c908083168061574157607f831692505b602080841082141561576357634e487b7160e01b600052602260045260246000fd5b8388526020880182801561577e576001811461578f576157ba565b60ff198716825282820197506157ba565b60008981526020902060005b878110156157b45781548482015290860190840161579b565b83019850505b5050505050505092915050565b6001600160a01b038316815260406020820181905260009061533690830184615727565b6000602082840312156157fd57600080fd5b5051919050565b6001600160a01b038416815260606020820181905260009061582890830185615727565b905082604083015294935050505056fea2646970667358221220caf8fd3401c2316f9fd858009c9db73c516a1dbaf9a38ff8a218cbfa495c828364736f6c634300080b0033