Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Staking
- Optimization enabled
- true
- Compiler version
- v0.8.6+commit.11564f7e
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-09-26T15:34:38.780116Z
Contract source code
// File: contracts/EnumerableSet.sol pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { struct AddressSet { // Storage of set values address[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (address => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { if (!contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. address lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } } // File: contracts/StakingBIC.sol pragma solidity ^0.8.0; interface IBEP20 { function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function mint(address user, uint256 amount) external; function balanceOf(address account) external view returns (uint256); } abstract contract Ownable { address internal _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ /* we use proxy, so owner will be set in initialize() function constructor () { _owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } */ /** * @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() == msg.sender, "Ownable: caller is not the owner"); _; } /** * @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"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract Staking is Ownable { using EnumerableSet for EnumerableSet.AddressSet; address public token; // BIC token EnumerableSet.AddressSet usersList; // list of users with stake struct User { uint256 amount; // amount of deposit uint256 weightedTokens; // the user's weighted tokens balance. (weighted tokens = token amount * staked days) uint256 previousWeightedTokens; // the user's weighted tokens balance for previous month. uint256 reward; // amount of reward that user may withdraw before ends of staking. uint64 unlockTime; // when can be unstake uint64 updated; // day when updated uint64 multiplier; // multiplier (with 2 decimals) applied to deposit ([0.25 .. 1]) uint8 status; // 0 - active, 1 - ended (weightedTokens > 0), 2 - ended (previousWeightedTokens > 0), 3 - ended, but not withdrawn } mapping(address => User[]) public users; // users deposits array mapping(uint256 => uint256) public multiplier; // staking days => multiplier (with 2 decimals) uint256 public withdrawWindow; // user may withdraw during this time when previous lock period ends. uint256 public prolongate; // if user did not withdraw, money locked on next 30 days. uint256 public minimumAmount; // minimum amount for staking // for TEST /* uint256 public withdrawWindow = 1 days; // user may withdraw during this time when previous lock period ends. uint256 public prolongate = 2 days; // if user user did not withdraw, money locked on next 30 days. uint256 public minimumAmount = 1; // minimum amount for staking */ uint256 public totalStaked; uint256 public totalStakedWeight; uint256 public previousTotalStakedWeight; // the total staked weight for previous month. int256 public amountPerWeightedToken; // amount (with 18 decimals) of profit/loss per weighted token for previous month. int256 public monthResultAmount; // result for previous month uint256 public processingStep; // 0 - processing complete, 1 - recalculate Weight, 2 - split result uint256 public processedDay; // last day that was processed uint256 public precessedMonth; // month when profit/loss was added. Admin can add profit/loss only once per month. uint256 public nextProcessUser; mapping (address => bool) public admins; event SetAdmin(address admin, bool isActive); event Stake(address user, uint256 amount, uint256 period, uint256 multiplier); event Unstake(address user, uint256 amount); event WithdrawUSD(address user, uint256 amount); event Processed(uint256 number, uint256 total, uint256 step); event RemoveUser(address user); event RemoveDeposit(address user, uint256 depositId); event MonthResult(int256 amount); event SplitResult(address user, uint256 depositId, int256 amount); event MonthBalances(uint256 totalStaked, uint256 totalBalance); // run only once from proxy function initialize(address newOwner, address _token) external { require(newOwner != address(0) && _owner == address(0)); // run only once _owner = newOwner; token = _token; emit OwnershipTransferred(address(0), msg.sender); withdrawWindow = 5 days; // user may withdraw during this time when previous lock period ends. prolongate = 30 days; // if user did not withdraw, money locked on next 30 days. minimumAmount = 200 ether; // minimum amount for staking multiplier[90] = 25; // staking for 90 days = multiplier 0.25 multiplier[180] = 50; // staking for 180 days = multiplier 0.5 multiplier[270] = 75; // staking for 270 days = multiplier 0.75 multiplier[360] = 100; // staking for 180 days = multiplier 1 } /** * @dev Throws if called by any account other than the admin. */ modifier onlyAdmin() { require(admins[msg.sender] || owner() == msg.sender, "Caller is not admin"); _; } function setAdmin(address admin, bool isActive) external onlyOwner { admins[admin] = isActive; emit SetAdmin(admin, isActive); } // set multiplier (with 2 decimals) function setMultiplier(uint256 _days, uint256 _multiplier) external onlyOwner { require(_multiplier <= 100, "Wrong multiplier"); multiplier[_days] = _multiplier; } // set minimumAmount function setMinimumAmount(uint256 _minAmount) external onlyOwner { minimumAmount = _minAmount; } // set withdrawWindow in seconds function setWithdrawWindow(uint256 time) external onlyOwner { withdrawWindow = time; } // set prolongate in seconds function setProlongate(uint256 time) external onlyOwner { prolongate = time; } // get total number of users function getUsersNumber() external view returns(uint256) { return usersList.length(); } // get total number of deposits of user function getUsersDepositsNumber(address user) external view returns(uint256) { return users[user].length; } // get deposits of user function getUsersDeposits(address user) external view returns(User[] memory) { return users[user]; } // get deposits of user function getUsersDepositsByNumber(uint256 userNumber) external view returns(address, User[] memory) { address user = usersList.at(userNumber); return (user, users[user]); } function getTotalBalance() public view returns(uint256 balance) { uint256 lastUser = usersList.length(); for(uint256 precessedUsers = 0; precessedUsers < lastUser; precessedUsers++) { address user = usersList.at(precessedUsers); uint256 deposits = users[user].length; for (uint256 i = 0; i < deposits; i++) { balance += users[user][i].amount; } } } function getTotalStaked() public view returns(uint256 staked) { uint256 lastUser = usersList.length(); for(uint256 precessedUsers = 0; precessedUsers < lastUser; precessedUsers++) { address user = usersList.at(precessedUsers); uint256 deposits = users[user].length; for (uint256 i = 0; i < deposits; i++) { if (users[user][i].status == 0) staked += users[user][i].amount; } } } function updateTotalStaked() external onlyAdmin { totalStaked = getTotalStaked(); } // Step 0. Call this function 1st day of each month // Enter result for previous month function monthResult(int256 amount) external onlyOwner { require(processingStep == 0, "Previous result was not processed"); _updateWeight(); (,uint256 month,) = timestampToDate(block.timestamp); //month = block.timestamp / 1 days; // for TEST require(precessedMonth != month, "Result may be added only once per month"); precessedMonth = month; monthResultAmount = amount; require (int256(totalStaked) + amount >= 0, "totalStaked less then amount"); if (amount > 0) { _safeTransferFrom(token, msg.sender, address(this), uint256(amount)); } processingStep = 1; nextProcessUser = 0; emit MonthResult(amount); } // recalculate users weights and total weights to exclude expired staking. // Step 1. Call this function 1st day of each month // numberUsers - is number of users that will processed at one transaction. Repeat call this function until emit event with number == total. function recalculateWeight(uint256 numberUsers) external onlyAdmin { require(processingStep == 1, "Wrong step"); uint256 currentDay = block.timestamp / 1 days; // number of days that passed //uint256 currentDay = block.timestamp / 1 hours; // for TEST uint256 precessedUsers = nextProcessUser; uint256 lastUser = usersList.length(); while (precessedUsers < lastUser) { address user = usersList.at(precessedUsers); uint256 deposits = users[user].length; if (numberUsers >= deposits) { numberUsers -= deposits; } else { nextProcessUser = precessedUsers; emit Processed(precessedUsers, lastUser, processingStep); return; } for (uint256 i = 0; i < deposits; i++) { _updateUser(currentDay, users[user][i]); } precessedUsers++; } processingStep = 2; nextProcessUser = 0; emit Processed(precessedUsers, lastUser, 1); } // call this function 1st day of each month to split month's result among users. // numberUsers - is number of users that will processed at one transaction. Repeat call this function until emit event with number == total. function splitResult(uint256 numberUsers) external onlyAdmin { require(processingStep == 2, "Wrong step"); int256 _monthResult = monthResultAmount; uint256 lastUser = usersList.length(); if (_monthResult == 0) { // exit if no amount to split processingStep = 0; emit Processed(lastUser, lastUser, 2); return; } int256 _previousTotalStakedWeight = int256(previousTotalStakedWeight); int256 split; uint256 precessedUsers = nextProcessUser; while (precessedUsers < lastUser) { address user = usersList.at(precessedUsers); uint256 deposits = users[user].length; if (numberUsers >= deposits) { numberUsers -= deposits; } else { nextProcessUser = precessedUsers; totalStaked = uint256(int256(totalStaked) + split); // add to totalStaked split amount emit Processed(precessedUsers, lastUser, processingStep); return; } for (uint256 i = 0; i < deposits; i++) { int256 wight = int256(users[user][i].previousWeightedTokens); if (wight != 0) { int256 stakedAmount = int256(users[user][i].amount); int256 reward = _monthResult * wight * int64(users[user][i].multiplier) / (_previousTotalStakedWeight * 100); split += reward; if (reward > 0) users[user][i].reward += uint256(reward); stakedAmount = stakedAmount + reward; if (stakedAmount < 0) { split = split - stakedAmount; // unsplit negative values stakedAmount = 0; } users[user][i].amount = uint256(stakedAmount); users[user][i].previousWeightedTokens = 0; emit SplitResult(user, i, reward); } } precessedUsers++; } totalStaked = uint256(int256(totalStaked) + split); // add to totalStaked split amount processingStep = 0; nextProcessUser = 0; uint256 bal = IBEP20(token).balanceOf(address(this)); uint256 totalBalance = getTotalBalance(); emit MonthBalances(totalStaked, totalBalance); if (totalBalance >= totalStaked && bal > totalBalance) // send rest of money to owner _safeTransfer(token, owner(), bal - totalBalance); emit Processed(precessedUsers, lastUser, 2); } // allow owner to unstake token's on user behalf without waiting unlock time. // user's deposit will be deleted. function unstakeAdmin(address user, uint256 depositId, bool withdrawUSD) external onlyOwner { uint256 currentDay = _updateWeight(); // number of days that passed User storage u = users[user][depositId]; _updateUser(currentDay, u); uint256 totalAmount = u.amount; if (totalAmount != 0) { if (withdrawUSD) { _safeTransfer(token, owner(), totalAmount); emit WithdrawUSD(user, totalAmount); } else { _safeTransfer(token, user, totalAmount); emit Unstake(user, totalAmount); } } if (u.status == 0) totalStaked -= totalAmount; totalStakedWeight -= u.weightedTokens; previousTotalStakedWeight -= u.previousWeightedTokens; // delete deposit records uint256 lastDepositId = users[user].length - 1; if (lastDepositId == 0) { users[user].pop(); // delete last deposit usersList.remove(user); // remove user from list emit RemoveUser(user); } else { if (depositId != lastDepositId) users[user][depositId] = users[user][lastDepositId]; users[user].pop(); emit RemoveDeposit(user, depositId); } } // User stake amount of tokens. // User can't withdraw tokens/USD at least 90 days after first deposit or 30 days after further deposits function stake(uint256 amount, uint256 period) external { require(amount >= minimumAmount, "Staked amount is less then minimum"); uint256 mp = multiplier[period]; require(mp != 0, "Wrong period"); _safeTransferFrom(token, msg.sender, address(this), amount); _stake(msg.sender, amount, period, mp); } // Owner stake amount of tokens on user behalf. // user - address of user's wallet // amount - amount of token to transfer on stake // period - number of days when tokens will be locked on stake // multiplier_ - multiplier (with 2 decimals) applied to deposit ([0.25 .. 1]). I.e. 25 means 0.25 function stakeBehalf(address user, uint256 amount, uint256 period, uint256 multiplier_) external onlyOwner { require(multiplier_ <= 100, "Wrong multiplier"); _safeTransferFrom(token, msg.sender, address(this), amount); _stake(user, amount, period, multiplier_); } // Withdraw rewards during allowed window. function withdrawRewards(uint256 depositId, uint256 amount, bool withdrawUSD) external { User storage u = users[msg.sender][depositId]; uint256 unlockTime = u.unlockTime; if (block.timestamp < unlockTime) { uint256 _days = unlockTime - block.timestamp; _days = _days % prolongate; require(_days > prolongate - withdrawWindow || _days == 0, "Out of withdraw window"); uint256 reward = u.reward; require(amount <= reward && amount <= u.amount, "Not enough rewards"); uint256 currentDay = _updateWeight(); // number of days that passed _updateUser(currentDay, u); u.reward = reward - amount; u.amount -= amount; if (u.status == 0) totalStaked -= amount; if (withdrawUSD) { _safeTransfer(token, owner(), amount); emit WithdrawUSD(msg.sender, amount); } else { _safeTransfer(token, msg.sender, amount); emit Unstake(msg.sender, amount); } } else { _unstake(msg.sender, depositId, withdrawUSD); } } // unstake tokens to user wallet or withdraw USD (tokens will be send to owner()) // User can't unstake/withdraw at least 90 days after first deposit or 30 days after further deposits function unstake(uint256 depositId, bool withdrawUSD) external { require(block.timestamp >= users[msg.sender][depositId].unlockTime, "Account locked"); _unstake(msg.sender, depositId, withdrawUSD); } // Stake amount for selected period (in days) function _stake(address user, uint256 amount, uint256 period, uint256 multiplier_) internal { _updateWeight(); require(users[user].length < 10, "Allowed 10 deposits per wallet"); totalStaked += amount; usersList.add(user); users[user].push( User({ amount: amount, weightedTokens: 0, previousWeightedTokens: 0, reward: 0, unlockTime: uint64(block.timestamp + (period * 1 days)), updated: uint64(block.timestamp / 1 days), //unlockTime: uint64(block.timestamp + (period * 1 hours)), // for TEST //updated: uint64(block.timestamp / 1 hours), // for TEST multiplier: uint64(multiplier_), status: 0 }) ); emit Stake(user, amount, period, multiplier_); } function _unstake(address user, uint256 depositId, bool withdrawUSD) internal { uint256 currentDay = _updateWeight(); // number of days that passed User storage u = users[user][depositId]; _updateUser(currentDay, u); uint256 totalAmount = u.amount; u.amount = 0; u.reward = 0; if (totalAmount != 0) { if (withdrawUSD) { _safeTransfer(token, owner(), totalAmount); emit WithdrawUSD(user, totalAmount); } else { _safeTransfer(token, user, totalAmount); emit Unstake(user, totalAmount); } } if(u.previousWeightedTokens == 0 && u.weightedTokens == 0) { // delete deposit records uint256 lastDepositId = users[user].length - 1; if (lastDepositId == 0) { users[user].pop(); // delete last deposit usersList.remove(user); // remove user from list emit RemoveUser(user); } else { if (depositId != lastDepositId) users[user][depositId] = users[user][lastDepositId]; users[user].pop(); emit RemoveDeposit(user, depositId); } } } function _updateUser(uint256 currentDay, User storage u) internal { uint8 status = u.status; // 0 - active, 1 - ended (weightedTokens > 0), 2 - ended (previousWeightedTokens > 0), 3 - ended, but not withdrawn if (status == 0) { uint256 amount = u.amount; uint256 weightedTokens = u.weightedTokens; uint256 unlockDay = u.unlockTime / 1 days; if (unlockDay <= currentDay) { // Stacking ends. (uint256 previousStakedWeight, uint256 stakedWeight) = _calculateWeight(unlockDay, u.updated, amount, weightedTokens); u.updated = uint64(currentDay); u.weightedTokens = stakedWeight; if (previousStakedWeight != 0) u.previousWeightedTokens = previousStakedWeight; if(stakedWeight != 0) { u.status = 1; // no active staked amount } else if (previousStakedWeight != 0) { u.status = 2; } else { u.status = 3; } totalStaked -= amount; // Fix previous weight. (previousStakedWeight, stakedWeight) = _calculateWeight(currentDay, unlockDay, amount, u.weightedTokens); totalStakedWeight -= stakedWeight; if (previousStakedWeight != 0) previousTotalStakedWeight -= previousStakedWeight; } else { (uint256 previousStakedWeight, uint256 stakedWeight) = _calculateWeight(currentDay, u.updated, amount, weightedTokens); u.updated = uint64(currentDay); u.weightedTokens = stakedWeight; if (previousStakedWeight != 0) u.previousWeightedTokens = previousStakedWeight; } } else if (status == 1 && u.updated < currentDay && u.previousWeightedTokens == 0) { u.previousWeightedTokens = u.weightedTokens; u.weightedTokens = 0; if (u.previousWeightedTokens != 0) { u.status = 2; } else { u.status = 3; } } } function _updateWeight() internal returns(uint256 currentDay) { currentDay = block.timestamp / 1 days; // number of days that passed //currentDay = block.timestamp / 1 hours; // for TEST if (currentDay > processedDay) { (uint256 previousStakedWeight, uint256 stakedWeight) = _calculateWeight(currentDay, processedDay, totalStaked, totalStakedWeight); processedDay = currentDay; totalStakedWeight = stakedWeight; if (previousStakedWeight != 0) previousTotalStakedWeight = previousStakedWeight; } } function _calculateWeight(uint256 currentDay, uint256 lastUpdate, uint256 amount, uint256 currentStakedWeight) internal pure returns(uint256 previousStakedWeight, uint256 stakedWeight) { stakedWeight = currentStakedWeight; if (currentDay > lastUpdate) { uint256 interval = currentDay - lastUpdate; (,,uint day) = _daysToDate(currentDay); if (day <= interval) { // new month starts uint256 previousInterval = interval - day + 1; previousStakedWeight = currentStakedWeight + (amount * previousInterval); interval = interval - previousInterval; // number of days passed in current month stakedWeight = amount * interval; // start total staked weight from zero } else { stakedWeight = currentStakedWeight + (amount * interval); } } } // TEST ======================================================================================================== /* function TEST_calculateWeight(uint256 currentDay, uint256 lastUpdate, uint256 amount, uint256 currentStakedWeight) public pure returns(uint256 previousStakedWeight, uint256 stakedWeight) { stakedWeight = currentStakedWeight; if (currentDay > lastUpdate) { uint256 interval = currentDay - lastUpdate; uint day = (currentDay % 24) + 1; // 1 hour = 1 day, 24 hours = 1 month if (day <= interval) { // new month starts uint256 previousInterval = interval - day + 1; previousStakedWeight = currentStakedWeight + (amount * previousInterval); interval = interval - previousInterval; // number of days passed in current month stakedWeight = amount * interval; // start total staked weight from zero } else { stakedWeight = currentStakedWeight + (amount * interval); } } } */ // END TEST ==================================================================================================== function _safeTransfer(address _token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = _token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function _safeTransferFrom(address _token, address from, address to, uint value) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = _token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } /** * @dev Calculate number of days from 1/1/1970 to selected date. * @param year The year number * @param month The month number * @param day The day number * @return _days number of day. */ function _daysFromDate(uint year, uint month, uint day) internal pure returns (uint _days) { require(year >= 1970); int _year = int(year); int _month = int(month); int _day = int(day); int __days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - 2440588; _days = uint(__days); } /** * @dev Calculate timestamp (UNIX time) of selected date and time. * @param year The year number * @param month The month number * @param day The day number * @param hour number of hours * @param minute number of minutes * @param second number of seconds * @return timestamp UNIX time */ function timestampFromDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns (uint timestamp) { timestamp = _daysFromDate(year, month, day) * 86400 + hour * 3600 + minute * 60 + second; } function _daysToDate(uint _days) internal pure returns (uint year, uint month, uint day) { int __days = int(_days); int L = __days + 68569 + 2440588; int N = 4 * L / 146097; L = L - (146097 * N + 3) / 4; int _year = 4000 * (L + 1) / 1461001; L = L - 1461 * _year / 4 + 31; int _month = 80 * L / 2447; int _day = L - 2447 * _month / 80; L = _month / 11; _month = _month + 2 - 12 * L; _year = 100 * (N - 49) + _year + L; year = uint(_year); month = uint(_month); day = uint(_day); } /** * @dev Calculate date from timestamp (UNIX time) . * @param timestamp UNIX time * @return year The year number * @return month The month number * @return day The day number */ function timestampToDate(uint timestamp) internal pure returns (uint year, uint month, uint day) { (year, month, day) = _daysToDate(timestamp / 86400); } }
Contract ABI
[{"type":"event","name":"MonthBalances","inputs":[{"type":"uint256","name":"totalStaked","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalBalance","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"MonthResult","inputs":[{"type":"int256","name":"amount","internalType":"int256","indexed":false}],"anonymous":false},{"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":"Processed","inputs":[{"type":"uint256","name":"number","internalType":"uint256","indexed":false},{"type":"uint256","name":"total","internalType":"uint256","indexed":false},{"type":"uint256","name":"step","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RemoveDeposit","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"depositId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RemoveUser","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SetAdmin","inputs":[{"type":"address","name":"admin","internalType":"address","indexed":false},{"type":"bool","name":"isActive","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"SplitResult","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"depositId","internalType":"uint256","indexed":false},{"type":"int256","name":"amount","internalType":"int256","indexed":false}],"anonymous":false},{"type":"event","name":"Stake","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"period","internalType":"uint256","indexed":false},{"type":"uint256","name":"multiplier","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unstake","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WithdrawUSD","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"admins","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"int256","name":"","internalType":"int256"}],"name":"amountPerWeightedToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"}],"name":"getTotalBalance","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"staked","internalType":"uint256"}],"name":"getTotalStaked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct Staking.User[]","components":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"weightedTokens","internalType":"uint256"},{"type":"uint256","name":"previousWeightedTokens","internalType":"uint256"},{"type":"uint256","name":"reward","internalType":"uint256"},{"type":"uint64","name":"unlockTime","internalType":"uint64"},{"type":"uint64","name":"updated","internalType":"uint64"},{"type":"uint64","name":"multiplier","internalType":"uint64"},{"type":"uint8","name":"status","internalType":"uint8"}]}],"name":"getUsersDeposits","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"tuple[]","name":"","internalType":"struct Staking.User[]","components":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"weightedTokens","internalType":"uint256"},{"type":"uint256","name":"previousWeightedTokens","internalType":"uint256"},{"type":"uint256","name":"reward","internalType":"uint256"},{"type":"uint64","name":"unlockTime","internalType":"uint64"},{"type":"uint64","name":"updated","internalType":"uint64"},{"type":"uint64","name":"multiplier","internalType":"uint64"},{"type":"uint8","name":"status","internalType":"uint8"}]}],"name":"getUsersDepositsByNumber","inputs":[{"type":"uint256","name":"userNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getUsersDepositsNumber","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getUsersNumber","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"newOwner","internalType":"address"},{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minimumAmount","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"monthResult","inputs":[{"type":"int256","name":"amount","internalType":"int256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"int256","name":"","internalType":"int256"}],"name":"monthResultAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"multiplier","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nextProcessUser","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"precessedMonth","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previousTotalStakedWeight","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"processedDay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"processingStep","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"prolongate","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"recalculateWeight","inputs":[{"type":"uint256","name":"numberUsers","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdmin","inputs":[{"type":"address","name":"admin","internalType":"address"},{"type":"bool","name":"isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinimumAmount","inputs":[{"type":"uint256","name":"_minAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMultiplier","inputs":[{"type":"uint256","name":"_days","internalType":"uint256"},{"type":"uint256","name":"_multiplier","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setProlongate","inputs":[{"type":"uint256","name":"time","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWithdrawWindow","inputs":[{"type":"uint256","name":"time","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"splitResult","inputs":[{"type":"uint256","name":"numberUsers","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"period","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakeBehalf","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"period","internalType":"uint256"},{"type":"uint256","name":"multiplier_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalStaked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalStakedWeight","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unstake","inputs":[{"type":"uint256","name":"depositId","internalType":"uint256"},{"type":"bool","name":"withdrawUSD","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unstakeAdmin","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"depositId","internalType":"uint256"},{"type":"bool","name":"withdrawUSD","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateTotalStaked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"weightedTokens","internalType":"uint256"},{"type":"uint256","name":"previousWeightedTokens","internalType":"uint256"},{"type":"uint256","name":"reward","internalType":"uint256"},{"type":"uint64","name":"unlockTime","internalType":"uint64"},{"type":"uint64","name":"updated","internalType":"uint64"},{"type":"uint64","name":"multiplier","internalType":"uint64"},{"type":"uint8","name":"status","internalType":"uint8"}],"name":"users","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawRewards","inputs":[{"type":"uint256","name":"depositId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bool","name":"withdrawUSD","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawWindow","inputs":[]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50613378806100206000396000f3fe608060405234801561001057600080fd5b506004361061023d5760003560e01c80638da5cb5b1161013b578063e6fc015e116100b8578063eeb4a9c81161007c578063eeb4a9c8146104ea578063f2fde38b146104fd578063f7cb812414610510578063fc0c546a14610519578063ff293df31461052c57600080fd5b8063e6fc015e1461049f578063ebda3b05146104b2578063ed47ab5b146104bb578063edcb208b146104ce578063ee79da19146104e157600080fd5b8063bb0c8298116100ff578063bb0c829814610468578063bbe0d9f614610471578063bc10b17214610484578063cb028a831461048d578063e03aabe61461049657600080fd5b80638da5cb5b146104155780639652b1211461043a5780639ebea88c14610443578063aa8c532414610456578063ab2e58dd1461045f57600080fd5b80633739e388116101c95780635c1419911161018d5780635c141991146103d55780636696f3ff146103e85780637b0472f0146103f15780637fe9123914610404578063817b1cd21461040c57600080fd5b80633739e38814610314578063429b62e51461031c578063485cc9551461034f5780634b0bddd21461036257806354a02f9e1461037557600080fd5b80631e0927e8116102105780631e0927e81461029a57806320114ac2146102bb57806328a6a2dd146102ce578063333271d0146102ee578063345531471461030157600080fd5b806305e30f51146102425780630917e7761461027557806312b583491461027d57806313c0284614610285575b600080fd5b610262610250366004612eb5565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b610262610555565b610262610663565b610298610293366004612eb5565b61071f565b005b6102ad6102a8366004612eb5565b610901565b60405161026c929190613031565b6102986102c9366004612eb5565b6109fe565b6102e16102dc366004612d69565b610bf3565b60405161026c919061305d565b6102986102fc366004612f0c565b610cca565b61029861030f366004612f2e565b610d59565b610298610fb8565b61033f61032a366004612d69565b60126020526000908152604090205460ff1681565b604051901515815260200161026c565b61029861035d366004612d8b565b611018565b610298610370366004612dbe565b611153565b610388610383366004612df5565b6111e8565b6040805198895260208901979097529587019490945260608601929092526001600160401b03908116608086015290811660a08501521660c083015260ff1660e08201526101000161026c565b6102986103e3366004612eb5565b61125f565b61026260105481565b6102986103ff366004612f0c565b61129d565b61026261136e565b61026260095481565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161026c565b610262600d5481565b610298610451366004612ee7565b61137e565b61026260075481565b61026260115481565b61026260085481565b61029861047f366004612e5f565b61140b565b610262600a5481565b61026260065481565b610262600f5481565b6102986104ad366004612eb5565b6114b2565b610262600e5481565b6102986104c9366004612e1f565b611a1d565b6102986104dc366004612eb5565b611ebf565b610262600c5481565b6102986104f8366004612eb5565b611efd565b61029861050b366004612d69565b611f3b565b610262600b5481565b600154610422906001600160a01b031681565b61026261053a366004612d69565b6001600160a01b031660009081526004602052604090205490565b60008061056160025490565b905060005b8181101561065e57600061057b600283612034565b6001600160a01b0381166000908152600460205260408120549192505b81811015610648576001600160a01b03831660009081526004602052604090208054829081106105ca576105ca6132fe565b6000918252602090912060059091020160040154600160c01b900460ff16610636576001600160a01b0383166000908152600460205260409020805482908110610616576106166132fe565b906000526020600020906005020160000154866106339190613113565b95505b806106408161328d565b915050610598565b50505080806106569061328d565b915050610566565b505090565b60008061066f60025490565b905060005b8181101561065e576000610689600283612034565b6001600160a01b0381166000908152600460205260408120549192505b81811015610709576001600160a01b03831660009081526004602052604090208054829081106106d8576106d86132fe565b906000526020600020906005020160000154866106f59190613113565b9550806107018161328d565b9150506106a6565b50505080806107179061328d565b915050610674565b336107326000546001600160a01b031690565b6001600160a01b0316146107615760405162461bcd60e51b815260040161075890613070565b60405180910390fd5b600e54156107bb5760405162461bcd60e51b815260206004820152602160248201527f50726576696f757320726573756c7420776173206e6f742070726f63657373656044820152601960fa1b6064820152608401610758565b6107c36120c5565b5060006107cf42612112565b509150508060105414156108355760405162461bcd60e51b815260206004820152602760248201527f526573756c74206d6179206265206164646564206f6e6c79206f6e63652070656044820152660e440dadedce8d60cb1b6064820152608401610758565b6010819055600d8290556009546000906108509084906130d2565b121561089e5760405162461bcd60e51b815260206004820152601c60248201527f746f74616c5374616b6564206c657373207468656e20616d6f756e74000000006044820152606401610758565b60008213156108bf576001546108bf906001600160a01b0316333085612138565b6001600e5560006011556040518281527f7e378eda7a53c9c96fb609c656ea4cddfd3f364b2fd5a0338fed559471da4fbe906020015b60405180910390a15050565b6000606081610911600285612034565b90508060046000836001600160a01b03166001600160a01b0316815260200190815260200160002080805480602002602001604051908101604052809291908181526020016000905b828210156109ee576000848152602090819020604080516101008101825260058602909201805483526001808201548486015260028201549284019290925260038101546060840152600401546001600160401b038082166080850152600160401b8204811660a0850152600160801b82041660c0840152600160c01b900460ff1660e0830152908352909201910161095a565b5050505090509250925050915091565b3360009081526012602052604090205460ff1680610a35575033610a2a6000546001600160a01b031690565b6001600160a01b0316145b610a515760405162461bcd60e51b8152600401610758906130a5565b600e54600114610a905760405162461bcd60e51b815260206004820152600a602482015269057726f6e6720737465760b41b6044820152606401610758565b6000610a9f6201518042613159565b6011549091506000610ab060025490565b90505b80821015610baf576000610ac8600284612034565b6001600160a01b038116600090815260046020526040902054909150808610610afc57610af58187613276565b9550610b3a565b6011849055600e54604080518681526020810186905280820192909252516000805160206133238339815191529181900360600190a1505050505050565b60005b81811015610b9a576001600160a01b03831660009081526004602052604090208054610b8891889184908110610b7557610b756132fe565b9060005260206000209060050201612268565b80610b928161328d565b915050610b3d565b5083610ba58161328d565b9450505050610ab3565b6002600e5560006011556040805183815260208101839052600191810191909152600080516020613323833981519152906060015b60405180910390a15050505b50565b6001600160a01b0381166000908152600460209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610cbf576000848152602090819020604080516101008101825260058602909201805483526001808201548486015260028201549284019290925260038101546060840152600401546001600160401b038082166080850152600160401b8204811660a0850152600160801b82041660c0840152600160c01b900460ff1660e08301529083529092019101610c2b565b505050509050919050565b33610cdd6000546001600160a01b031690565b6001600160a01b031614610d035760405162461bcd60e51b815260040161075890613070565b6064811115610d475760405162461bcd60e51b815260206004820152601060248201526f2bb937b7339036bab63a34b83634b2b960811b6044820152606401610758565b60009182526005602052604090912055565b336000908152600460205260408120805485908110610d7a57610d7a6132fe565b6000918252602090912060059091020160048101549091506001600160401b031642811115610fa6576000610daf4283613276565b905060075481610dbf91906132a8565b9050600654600754610dd19190613276565b811180610ddc575080155b610e215760405162461bcd60e51b81526020600482015260166024820152754f7574206f662077697468647261772077696e646f7760501b6044820152606401610758565b6003830154808611801590610e37575083548611155b610e785760405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f756768207265776172647360701b6044820152606401610758565b6000610e826120c5565b9050610e8e8186612268565b610e988783613276565b6003860155845487908690600090610eb1908490613276565b90915550506004850154600160c01b900460ff16610ee1578660096000828254610edb9190613276565b90915550505b8515610f4d57600154610f0f906001600160a01b0316610f096000546001600160a01b031690565b896124d1565b60408051338152602081018990527fa859066e89895ffb9f2cdf2af7e7e84061fcb7ddd8657877c264737f25f8b655910160405180910390a1610f9e565b600154610f64906001600160a01b031633896124d1565b60408051338152602081018990527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a15b505050610fb1565b610fb13386856125e5565b5050505050565b3360009081526012602052604090205460ff1680610fef575033610fe46000546001600160a01b031690565b6001600160a01b0316145b61100b5760405162461bcd60e51b8152600401610758906130a5565b611013610555565b600955565b6001600160a01b0382161580159061103957506000546001600160a01b0316155b61104257600080fd5b600080546001600160a01b038085166001600160a01b031992831617835560018054918516919092161790556040513391907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350506206978060065562278d00600755680ad78ebc5ac6200000600855600560205260197faadf04b4a1bf84e121ab68e5c1cffab5aeb9be1a024ff9944a2a0bc1674866095560327fec79235ffe9302935718f9bddc23f2c5c6c950ae49f49d137c786213c361802755604b7fe78ea91a221fb67f10aba14ba22dc39f780130b5cf7d2295f57a7414e295968b5561016860005260647f5464d34515fb195718451914a9b5e2c4ac04dce5fd392ea5e3f190355ea2fb7e55565b336111666000546001600160a01b031690565b6001600160a01b03161461118c5760405162461bcd60e51b815260040161075890613070565b6001600160a01b038216600081815260126020908152604091829020805460ff19168515159081179091558251938452908301527f55a5194bc0174fcaf12b2978bef43911466bf63b34db8d1dd1a0d5dcd5c41bea91016108f5565b6004602052816000526040600020818154811061120457600080fd5b60009182526020909120600590910201805460018201546002830154600384015460049094015492955090935091906001600160401b0380821691600160401b8104821691600160801b82041690600160c01b900460ff1688565b336112726000546001600160a01b031690565b6001600160a01b0316146112985760405162461bcd60e51b815260040161075890613070565b600755565b6008548210156112fa5760405162461bcd60e51b815260206004820152602260248201527f5374616b656420616d6f756e74206973206c657373207468656e206d696e696d604482015261756d60f01b6064820152608401610758565b600081815260056020526040902054806113455760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c81c195c9a5bd960a21b6044820152606401610758565b60015461135d906001600160a01b0316333086612138565b61136933848484612751565b505050565b600061137960025490565b905090565b33600090815260046020526040902080548390811061139f5761139f6132fe565b60009182526020909120600460059092020101546001600160401b03164210156113fc5760405162461bcd60e51b815260206004820152600e60248201526d1058d8dbdd5b9d081b1bd8dad95960921b6044820152606401610758565b6114073383836125e5565b5050565b3361141e6000546001600160a01b031690565b6001600160a01b0316146114445760405162461bcd60e51b815260040161075890613070565b60648111156114885760405162461bcd60e51b815260206004820152601060248201526f2bb937b7339036bab63a34b83634b2b960811b6044820152606401610758565b6001546114a0906001600160a01b0316333086612138565b6114ac84848484612751565b50505050565b3360009081526012602052604090205460ff16806114e95750336114de6000546001600160a01b031690565b6001600160a01b0316145b6115055760405162461bcd60e51b8152600401610758906130a5565b600e546002146115445760405162461bcd60e51b815260206004820152600a602482015269057726f6e6720737465760b41b6044820152606401610758565b600d54600061155260025490565b905081611591576000600e55604080518281526020810183905260028183015290516000805160206133238339815191529181900360600190a1505050565b600b546011546000905b838110156118c45760006115b0600283612034565b6001600160a01b0381166000908152600460205260409020549091508088106115e4576115dd8189613276565b9750611638565b60118390556009546115f79085906130d2565b600955600e54604080518581526020810189905290810191909152600080516020613323833981519152906060015b60405180910390a15050505050505050565b60005b818110156118af576001600160a01b038316600090815260046020526040812080548390811061166d5761166d6132fe565b90600052602060002090600502016002015490508060001461189c576001600160a01b03841660009081526004602052604081208054849081106116b3576116b36132fe565b6000918252602082206005909102015491506116d0896064613193565b6001600160a01b03871660009081526004602052604090208054869081106116fa576116fa6132fe565b6000918252602090912060059091020160040154600160801b90046001600160401b031660070b61172b858e613193565b6117359190613193565b61173f919061312b565b905061174b81896130d2565b975060008113156117a9576001600160a01b0386166000908152600460205260409020805482919086908110611783576117836132fe565b906000526020600020906005020160030160008282546117a39190613113565b90915550505b6117b381836130d2565b915060008212156117cf576117c88289613237565b9750600091505b6001600160a01b03861660009081526004602052604090208054839190869081106117fc576117fc6132fe565b600091825260208083206005909202909101929092556001600160a01b0388168152600490915260408120805486908110611839576118396132fe565b600091825260209182902060026005909202010191909155604080516001600160a01b038916815291820186905281018290527f4410f5289f71baff2baf30dad8844d6c4d5af1f55fd01dd890aec66584f1677c9060600160405180910390a150505b50806118a78161328d565b91505061163b565b50826118ba8161328d565b935050505061159b565b816009546118d291906130d2565b6009556000600e81905560118190556001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561192457600080fd5b505afa158015611938573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195c9190612ece565b90506000611968610663565b60095460408051918252602082018390529192507fd9cdec0295c8edc1c466e37dd37c5afeabaea2e083fe8aabc6b74cd6094182cb910160405180910390a160095481101580156119b857508082115b156119ee576001546119ee906001600160a01b03166119df6000546001600160a01b031690565b6119e98486613276565b6124d1565b604080518481526020810188905260029181019190915260008051602061332383398151915290606001611626565b33611a306000546001600160a01b031690565b6001600160a01b031614611a565760405162461bcd60e51b815260040161075890613070565b6000611a606120c5565b6001600160a01b03851660009081526004602052604081208054929350909185908110611a8f57611a8f6132fe565b90600052602060002090600502019050611aa98282612268565b80548015611b80578315611b2657600154611adf906001600160a01b0316611ad96000546001600160a01b031690565b836124d1565b604080516001600160a01b0388168152602081018390527fa859066e89895ffb9f2cdf2af7e7e84061fcb7ddd8657877c264737f25f8b655910160405180910390a1611b80565b600154611b3d906001600160a01b031687836124d1565b604080516001600160a01b0388168152602081018390527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a15b6004820154600160c01b900460ff16611bab578060096000828254611ba59190613276565b90915550505b8160010154600a6000828254611bc19190613276565b90915550506002820154600b8054600090611bdd908490613276565b90915550506001600160a01b038616600090815260046020526040812054611c0790600190613276565b905080611cc3576001600160a01b0387166000908152600460205260409020805480611c3557611c356132e8565b600082815260208120600560001990930192830201818155600181018290556002808201839055600382019290925560040180546001600160c81b03191690559155611c819088612987565b506040516001600160a01b03881681527f0ad8e54ac59bf2d8a7a1474c1af503b593553cf4fcaaffdef04ab5249f89762b9060200160405180910390a1611eb6565b808614611e08576001600160a01b0387166000908152600460205260409020805482908110611cf457611cf46132fe565b906000526020600020906005020160046000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611d3857611d386132fe565b6000918252602090912082546005909202019081556001808301549082015560028083015490820155600380830154908201556004918201805492909101805467ffffffffffffffff1981166001600160401b0394851690811783558354600160401b908190048616026001600160801b031990921617178082558254600160801b9081900490941690930267ffffffffffffffff60801b19841681178255915460ff600160c01b91829004160260ff60c01b1990921668ffffffffffffffffff60801b19909316929092171790555b6001600160a01b0387166000908152600460205260409020805480611e2f57611e2f6132e8565b600082815260208082206005600019949094019384020182815560018101839055600281018390556003810192909255600490910180546001600160c81b03191690559155604080516001600160a01b038a1681529182018890527f52da67f845146a7b07a837a7e32b5b74f6d3fafb17ec6c04f23acfc9e1aa9d1f910160405180910390a15b50505050505050565b33611ed26000546001600160a01b031690565b6001600160a01b031614611ef85760405162461bcd60e51b815260040161075890613070565b600655565b33611f106000546001600160a01b031690565b6001600160a01b031614611f365760405162461bcd60e51b815260040161075890613070565b600855565b33611f4e6000546001600160a01b031690565b6001600160a01b031614611f745760405162461bcd60e51b815260040161075890613070565b6001600160a01b038116611fd95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610758565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b815460009082106120925760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401610758565b8260000182815481106120a7576120a76132fe565b6000918252602090912001546001600160a01b031690505b92915050565b60006120d46201518042613159565b9050600f5481111561210f576000806120f583600f54600954600a54612ac9565b600f859055600a8190559092509050811561065e5750600b555b90565b6000808061212b6121266201518086613159565b612b68565b9196909550909350915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161219c9190612ff6565b6000604051808303816000865af19150503d80600081146121d9576040519150601f19603f3d011682016040523d82523d6000602084013e6121de565b606091505b50915091508180156122085750805115806122085750808060200190518101906122089190612e98565b6122605760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610758565b505050505050565b6004810154600160c01b900460ff1680612451578154600183015460048401546000906122a29062015180906001600160401b031661316d565b6001600160401b031690508581116123df57600485015460009081906122db908490600160401b90046001600160401b03168787612ac9565b60048901805467ffffffffffffffff60401b1916600160401b6001600160401b038d1602179055600189018190559092509050811561231c57600287018290555b801561233c5760048701805460ff60c01b1916600160c01b179055612372565b811561235c5760048701805460ff60c01b1916600160c11b179055612372565b60048701805460ff60c01b1916600360c01b1790555b84600960008282546123849190613276565b9250508190555061239b8884878a60010154612ac9565b809250819350505080600a60008282546123b59190613276565b909155505081156123d85781600b60008282546123d29190613276565b90915550505b5050612260565b60048501546000908190612406908990600160401b90046001600160401b03168787612ac9565b60048901805467ffffffffffffffff60401b1916600160401b6001600160401b038d1602179055600189018190559092509050811561244757600287018290555b5050505050505050565b8060ff16600114801561247757506004820154600160401b90046001600160401b031683115b801561248557506002820154155b1561136957600182018054600284018190556000909155156124b95750600401805460ff60c01b1916600160c11b17905550565b50600401805460ff60c01b1916600360c01b17905550565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161252d9190612ff6565b6000604051808303816000865af19150503d806000811461256a576040519150601f19603f3d011682016040523d82523d6000602084013e61256f565b606091505b50915091508180156125995750805115806125995750808060200190518101906125999190612e98565b610fb15760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610758565b60006125ef6120c5565b6001600160a01b0385166000908152600460205260408120805492935090918590811061261e5761261e6132fe565b906000526020600020906005020190506126388282612268565b80546000808355600383015580156127135783156126b957600154612672906001600160a01b0316611ad96000546001600160a01b031690565b604080516001600160a01b0388168152602081018390527fa859066e89895ffb9f2cdf2af7e7e84061fcb7ddd8657877c264737f25f8b655910160405180910390a1612713565b6001546126d0906001600160a01b031687836124d1565b604080516001600160a01b0388168152602081018390527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a15b600282015415801561272757506001820154155b15612260576001600160a01b038616600090815260046020526040812054611c0790600190613276565b6127596120c5565b506001600160a01b038416600090815260046020526040902054600a116127c25760405162461bcd60e51b815260206004820152601e60248201527f416c6c6f776564203130206465706f73697473207065722077616c6c657400006044820152606401610758565b82600960008282546127d49190613113565b909155506127e59050600285612cdb565b5060046000856001600160a01b03166001600160a01b0316815260200190815260200160002060405180610100016040528085815260200160008152602001600081526020016000815260200184620151806128419190613218565b61284b9042613113565b6001600160401b031681526020016128666201518042613159565b6001600160401b0390811682528481166020808401919091526000604093840181905285546001818101885596825290829020855160059092020190815590840151948101949094558282015160028501556060830151600385015560808301516004909401805460a085015160c086015160e09096015160ff16600160c01b0260ff60c01b19968516600160801b029690961668ffffffffffffffffff60801b19918516600160401b026001600160801b0319909316979094169690961717949094161791909117909155517ff556991011e831bcfac4f406d547e5e32cdd98267efab83935230d5f8d02c44690610be49086908690869086906001600160a01b0394909416845260208401929092526040830152606082015260800190565b6001600160a01b03811660009081526001830160205260408120548015612abf5760006129b5600183613276565b85549091506000906129c990600190613276565b905060008660000182815481106129e2576129e26132fe565b60009182526020909120015487546001600160a01b0390911691508190889085908110612a1157612a116132fe565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055612a45836001613113565b6001600160a01b03821660009081526001890160205260409020558654879080612a7157612a716132e8565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b03881682526001898101909152604082209190915594506120bf9350505050565b60009150506120bf565b60008184861115612b5f576000612ae08688613276565b90506000612aed88612b68565b92505050818111612b45576000612b048284613276565b612b0f906001613113565b9050612b1b8188613218565b612b259087613113565b9450612b318184613276565b9250612b3d8388613218565b935050612b5c565b612b4f8287613218565b612b599086613113565b92505b50505b94509492505050565b600080808381612b7b8262010bd96130d2565b612b889062253d8c6130d2565b9050600062023ab1612b9b836004613193565b612ba5919061312b565b90506004612bb68262023ab1613193565b612bc19060036130d2565b612bcb919061312b565b612bd59083613237565b9150600062164b09612be88460016130d2565b612bf490610fa0613193565b612bfe919061312b565b90506004612c0e826105b5613193565b612c18919061312b565b612c229084613237565b612c2d90601f6130d2565b9250600061098f612c3f856050613193565b612c49919061312b565b905060006050612c5b8361098f613193565b612c65919061312b565b612c6f9086613237565b9050612c7c600b8361312b565b9450612c8985600c613193565b612c948360026130d2565b612c9e9190613237565b91508483612cad603187613237565b612cb8906064613193565b612cc291906130d2565b612ccc91906130d2565b9a919950975095505050505050565b6001600160a01b0381166000908152600183016020526040812054612d4557508154600180820184556000848152602080822090930180546001600160a01b0319166001600160a01b038616908117909155855490825282860190935260409020919091556120bf565b5060006120bf565b80356001600160a01b0381168114612d6457600080fd5b919050565b600060208284031215612d7b57600080fd5b612d8482612d4d565b9392505050565b60008060408385031215612d9e57600080fd5b612da783612d4d565b9150612db560208401612d4d565b90509250929050565b60008060408385031215612dd157600080fd5b612dda83612d4d565b91506020830135612dea81613314565b809150509250929050565b60008060408385031215612e0857600080fd5b612e1183612d4d565b946020939093013593505050565b600080600060608486031215612e3457600080fd5b612e3d84612d4d565b9250602084013591506040840135612e5481613314565b809150509250925092565b60008060008060808587031215612e7557600080fd5b612e7e85612d4d565b966020860135965060408601359560600135945092505050565b600060208284031215612eaa57600080fd5b8151612d8481613314565b600060208284031215612ec757600080fd5b5035919050565b600060208284031215612ee057600080fd5b5051919050565b60008060408385031215612efa57600080fd5b823591506020830135612dea81613314565b60008060408385031215612f1f57600080fd5b50508035926020909101359150565b600080600060608486031215612f4357600080fd5b83359250602084013591506040840135612e5481613314565b600081518084526020808501945080840160005b83811015612feb57815180518852838101518489015260408082015190890152606080820151908901526080808201516001600160401b03908116918a019190915260a0808301518216908a015260c0808301519091169089015260e09081015160ff16908801526101009096019590820190600101612f70565b509495945050505050565b6000825160005b818110156130175760208186018101518583015201612ffd565b81811115613026576000828501525b509190910192915050565b6001600160a01b038316815260406020820181905260009061305590830184612f5c565b949350505050565b602081526000612d846020830184612f5c565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526013908201527221b0b63632b91034b9903737ba1030b236b4b760691b604082015260600190565b600080821280156001600160ff1b03849003851316156130f4576130f46132bc565b600160ff1b839003841281161561310d5761310d6132bc565b50500190565b60008219821115613126576131266132bc565b500190565b60008261313a5761313a6132d2565b600160ff1b821460001984141615613154576131546132bc565b500590565b600082613168576131686132d2565b500490565b60006001600160401b0380841680613187576131876132d2565b92169190910492915050565b60006001600160ff1b03818413828413808216868404861116156131b9576131b96132bc565b600160ff1b60008712828116878305891216156131d8576131d86132bc565b600087129250878205871284841616156131f4576131f46132bc565b8785058712818416161561320a5761320a6132bc565b505050929093029392505050565b6000816000190483118215151615613232576132326132bc565b500290565b60008083128015600160ff1b850184121615613255576132556132bc565b6001600160ff1b0384018313811615613270576132706132bc565b50500390565b600082821015613288576132886132bc565b500390565b60006000198214156132a1576132a16132bc565b5060010190565b6000826132b7576132b76132d2565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8015158114610bf057600080fdfec534675d962a9c4b4a6eef4e934d46b14162000192fa31cf0c29cd81fdb8c2eea2646970667358221220056b92520ad12be5f5e9f6e0db98e611a49f573ad9b6f29384c4c40b169d6f8564736f6c63430008060033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061023d5760003560e01c80638da5cb5b1161013b578063e6fc015e116100b8578063eeb4a9c81161007c578063eeb4a9c8146104ea578063f2fde38b146104fd578063f7cb812414610510578063fc0c546a14610519578063ff293df31461052c57600080fd5b8063e6fc015e1461049f578063ebda3b05146104b2578063ed47ab5b146104bb578063edcb208b146104ce578063ee79da19146104e157600080fd5b8063bb0c8298116100ff578063bb0c829814610468578063bbe0d9f614610471578063bc10b17214610484578063cb028a831461048d578063e03aabe61461049657600080fd5b80638da5cb5b146104155780639652b1211461043a5780639ebea88c14610443578063aa8c532414610456578063ab2e58dd1461045f57600080fd5b80633739e388116101c95780635c1419911161018d5780635c141991146103d55780636696f3ff146103e85780637b0472f0146103f15780637fe9123914610404578063817b1cd21461040c57600080fd5b80633739e38814610314578063429b62e51461031c578063485cc9551461034f5780634b0bddd21461036257806354a02f9e1461037557600080fd5b80631e0927e8116102105780631e0927e81461029a57806320114ac2146102bb57806328a6a2dd146102ce578063333271d0146102ee578063345531471461030157600080fd5b806305e30f51146102425780630917e7761461027557806312b583491461027d57806313c0284614610285575b600080fd5b610262610250366004612eb5565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b610262610555565b610262610663565b610298610293366004612eb5565b61071f565b005b6102ad6102a8366004612eb5565b610901565b60405161026c929190613031565b6102986102c9366004612eb5565b6109fe565b6102e16102dc366004612d69565b610bf3565b60405161026c919061305d565b6102986102fc366004612f0c565b610cca565b61029861030f366004612f2e565b610d59565b610298610fb8565b61033f61032a366004612d69565b60126020526000908152604090205460ff1681565b604051901515815260200161026c565b61029861035d366004612d8b565b611018565b610298610370366004612dbe565b611153565b610388610383366004612df5565b6111e8565b6040805198895260208901979097529587019490945260608601929092526001600160401b03908116608086015290811660a08501521660c083015260ff1660e08201526101000161026c565b6102986103e3366004612eb5565b61125f565b61026260105481565b6102986103ff366004612f0c565b61129d565b61026261136e565b61026260095481565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161026c565b610262600d5481565b610298610451366004612ee7565b61137e565b61026260075481565b61026260115481565b61026260085481565b61029861047f366004612e5f565b61140b565b610262600a5481565b61026260065481565b610262600f5481565b6102986104ad366004612eb5565b6114b2565b610262600e5481565b6102986104c9366004612e1f565b611a1d565b6102986104dc366004612eb5565b611ebf565b610262600c5481565b6102986104f8366004612eb5565b611efd565b61029861050b366004612d69565b611f3b565b610262600b5481565b600154610422906001600160a01b031681565b61026261053a366004612d69565b6001600160a01b031660009081526004602052604090205490565b60008061056160025490565b905060005b8181101561065e57600061057b600283612034565b6001600160a01b0381166000908152600460205260408120549192505b81811015610648576001600160a01b03831660009081526004602052604090208054829081106105ca576105ca6132fe565b6000918252602090912060059091020160040154600160c01b900460ff16610636576001600160a01b0383166000908152600460205260409020805482908110610616576106166132fe565b906000526020600020906005020160000154866106339190613113565b95505b806106408161328d565b915050610598565b50505080806106569061328d565b915050610566565b505090565b60008061066f60025490565b905060005b8181101561065e576000610689600283612034565b6001600160a01b0381166000908152600460205260408120549192505b81811015610709576001600160a01b03831660009081526004602052604090208054829081106106d8576106d86132fe565b906000526020600020906005020160000154866106f59190613113565b9550806107018161328d565b9150506106a6565b50505080806107179061328d565b915050610674565b336107326000546001600160a01b031690565b6001600160a01b0316146107615760405162461bcd60e51b815260040161075890613070565b60405180910390fd5b600e54156107bb5760405162461bcd60e51b815260206004820152602160248201527f50726576696f757320726573756c7420776173206e6f742070726f63657373656044820152601960fa1b6064820152608401610758565b6107c36120c5565b5060006107cf42612112565b509150508060105414156108355760405162461bcd60e51b815260206004820152602760248201527f526573756c74206d6179206265206164646564206f6e6c79206f6e63652070656044820152660e440dadedce8d60cb1b6064820152608401610758565b6010819055600d8290556009546000906108509084906130d2565b121561089e5760405162461bcd60e51b815260206004820152601c60248201527f746f74616c5374616b6564206c657373207468656e20616d6f756e74000000006044820152606401610758565b60008213156108bf576001546108bf906001600160a01b0316333085612138565b6001600e5560006011556040518281527f7e378eda7a53c9c96fb609c656ea4cddfd3f364b2fd5a0338fed559471da4fbe906020015b60405180910390a15050565b6000606081610911600285612034565b90508060046000836001600160a01b03166001600160a01b0316815260200190815260200160002080805480602002602001604051908101604052809291908181526020016000905b828210156109ee576000848152602090819020604080516101008101825260058602909201805483526001808201548486015260028201549284019290925260038101546060840152600401546001600160401b038082166080850152600160401b8204811660a0850152600160801b82041660c0840152600160c01b900460ff1660e0830152908352909201910161095a565b5050505090509250925050915091565b3360009081526012602052604090205460ff1680610a35575033610a2a6000546001600160a01b031690565b6001600160a01b0316145b610a515760405162461bcd60e51b8152600401610758906130a5565b600e54600114610a905760405162461bcd60e51b815260206004820152600a602482015269057726f6e6720737465760b41b6044820152606401610758565b6000610a9f6201518042613159565b6011549091506000610ab060025490565b90505b80821015610baf576000610ac8600284612034565b6001600160a01b038116600090815260046020526040902054909150808610610afc57610af58187613276565b9550610b3a565b6011849055600e54604080518681526020810186905280820192909252516000805160206133238339815191529181900360600190a1505050505050565b60005b81811015610b9a576001600160a01b03831660009081526004602052604090208054610b8891889184908110610b7557610b756132fe565b9060005260206000209060050201612268565b80610b928161328d565b915050610b3d565b5083610ba58161328d565b9450505050610ab3565b6002600e5560006011556040805183815260208101839052600191810191909152600080516020613323833981519152906060015b60405180910390a15050505b50565b6001600160a01b0381166000908152600460209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610cbf576000848152602090819020604080516101008101825260058602909201805483526001808201548486015260028201549284019290925260038101546060840152600401546001600160401b038082166080850152600160401b8204811660a0850152600160801b82041660c0840152600160c01b900460ff1660e08301529083529092019101610c2b565b505050509050919050565b33610cdd6000546001600160a01b031690565b6001600160a01b031614610d035760405162461bcd60e51b815260040161075890613070565b6064811115610d475760405162461bcd60e51b815260206004820152601060248201526f2bb937b7339036bab63a34b83634b2b960811b6044820152606401610758565b60009182526005602052604090912055565b336000908152600460205260408120805485908110610d7a57610d7a6132fe565b6000918252602090912060059091020160048101549091506001600160401b031642811115610fa6576000610daf4283613276565b905060075481610dbf91906132a8565b9050600654600754610dd19190613276565b811180610ddc575080155b610e215760405162461bcd60e51b81526020600482015260166024820152754f7574206f662077697468647261772077696e646f7760501b6044820152606401610758565b6003830154808611801590610e37575083548611155b610e785760405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f756768207265776172647360701b6044820152606401610758565b6000610e826120c5565b9050610e8e8186612268565b610e988783613276565b6003860155845487908690600090610eb1908490613276565b90915550506004850154600160c01b900460ff16610ee1578660096000828254610edb9190613276565b90915550505b8515610f4d57600154610f0f906001600160a01b0316610f096000546001600160a01b031690565b896124d1565b60408051338152602081018990527fa859066e89895ffb9f2cdf2af7e7e84061fcb7ddd8657877c264737f25f8b655910160405180910390a1610f9e565b600154610f64906001600160a01b031633896124d1565b60408051338152602081018990527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a15b505050610fb1565b610fb13386856125e5565b5050505050565b3360009081526012602052604090205460ff1680610fef575033610fe46000546001600160a01b031690565b6001600160a01b0316145b61100b5760405162461bcd60e51b8152600401610758906130a5565b611013610555565b600955565b6001600160a01b0382161580159061103957506000546001600160a01b0316155b61104257600080fd5b600080546001600160a01b038085166001600160a01b031992831617835560018054918516919092161790556040513391907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350506206978060065562278d00600755680ad78ebc5ac6200000600855600560205260197faadf04b4a1bf84e121ab68e5c1cffab5aeb9be1a024ff9944a2a0bc1674866095560327fec79235ffe9302935718f9bddc23f2c5c6c950ae49f49d137c786213c361802755604b7fe78ea91a221fb67f10aba14ba22dc39f780130b5cf7d2295f57a7414e295968b5561016860005260647f5464d34515fb195718451914a9b5e2c4ac04dce5fd392ea5e3f190355ea2fb7e55565b336111666000546001600160a01b031690565b6001600160a01b03161461118c5760405162461bcd60e51b815260040161075890613070565b6001600160a01b038216600081815260126020908152604091829020805460ff19168515159081179091558251938452908301527f55a5194bc0174fcaf12b2978bef43911466bf63b34db8d1dd1a0d5dcd5c41bea91016108f5565b6004602052816000526040600020818154811061120457600080fd5b60009182526020909120600590910201805460018201546002830154600384015460049094015492955090935091906001600160401b0380821691600160401b8104821691600160801b82041690600160c01b900460ff1688565b336112726000546001600160a01b031690565b6001600160a01b0316146112985760405162461bcd60e51b815260040161075890613070565b600755565b6008548210156112fa5760405162461bcd60e51b815260206004820152602260248201527f5374616b656420616d6f756e74206973206c657373207468656e206d696e696d604482015261756d60f01b6064820152608401610758565b600081815260056020526040902054806113455760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c81c195c9a5bd960a21b6044820152606401610758565b60015461135d906001600160a01b0316333086612138565b61136933848484612751565b505050565b600061137960025490565b905090565b33600090815260046020526040902080548390811061139f5761139f6132fe565b60009182526020909120600460059092020101546001600160401b03164210156113fc5760405162461bcd60e51b815260206004820152600e60248201526d1058d8dbdd5b9d081b1bd8dad95960921b6044820152606401610758565b6114073383836125e5565b5050565b3361141e6000546001600160a01b031690565b6001600160a01b0316146114445760405162461bcd60e51b815260040161075890613070565b60648111156114885760405162461bcd60e51b815260206004820152601060248201526f2bb937b7339036bab63a34b83634b2b960811b6044820152606401610758565b6001546114a0906001600160a01b0316333086612138565b6114ac84848484612751565b50505050565b3360009081526012602052604090205460ff16806114e95750336114de6000546001600160a01b031690565b6001600160a01b0316145b6115055760405162461bcd60e51b8152600401610758906130a5565b600e546002146115445760405162461bcd60e51b815260206004820152600a602482015269057726f6e6720737465760b41b6044820152606401610758565b600d54600061155260025490565b905081611591576000600e55604080518281526020810183905260028183015290516000805160206133238339815191529181900360600190a1505050565b600b546011546000905b838110156118c45760006115b0600283612034565b6001600160a01b0381166000908152600460205260409020549091508088106115e4576115dd8189613276565b9750611638565b60118390556009546115f79085906130d2565b600955600e54604080518581526020810189905290810191909152600080516020613323833981519152906060015b60405180910390a15050505050505050565b60005b818110156118af576001600160a01b038316600090815260046020526040812080548390811061166d5761166d6132fe565b90600052602060002090600502016002015490508060001461189c576001600160a01b03841660009081526004602052604081208054849081106116b3576116b36132fe565b6000918252602082206005909102015491506116d0896064613193565b6001600160a01b03871660009081526004602052604090208054869081106116fa576116fa6132fe565b6000918252602090912060059091020160040154600160801b90046001600160401b031660070b61172b858e613193565b6117359190613193565b61173f919061312b565b905061174b81896130d2565b975060008113156117a9576001600160a01b0386166000908152600460205260409020805482919086908110611783576117836132fe565b906000526020600020906005020160030160008282546117a39190613113565b90915550505b6117b381836130d2565b915060008212156117cf576117c88289613237565b9750600091505b6001600160a01b03861660009081526004602052604090208054839190869081106117fc576117fc6132fe565b600091825260208083206005909202909101929092556001600160a01b0388168152600490915260408120805486908110611839576118396132fe565b600091825260209182902060026005909202010191909155604080516001600160a01b038916815291820186905281018290527f4410f5289f71baff2baf30dad8844d6c4d5af1f55fd01dd890aec66584f1677c9060600160405180910390a150505b50806118a78161328d565b91505061163b565b50826118ba8161328d565b935050505061159b565b816009546118d291906130d2565b6009556000600e81905560118190556001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561192457600080fd5b505afa158015611938573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195c9190612ece565b90506000611968610663565b60095460408051918252602082018390529192507fd9cdec0295c8edc1c466e37dd37c5afeabaea2e083fe8aabc6b74cd6094182cb910160405180910390a160095481101580156119b857508082115b156119ee576001546119ee906001600160a01b03166119df6000546001600160a01b031690565b6119e98486613276565b6124d1565b604080518481526020810188905260029181019190915260008051602061332383398151915290606001611626565b33611a306000546001600160a01b031690565b6001600160a01b031614611a565760405162461bcd60e51b815260040161075890613070565b6000611a606120c5565b6001600160a01b03851660009081526004602052604081208054929350909185908110611a8f57611a8f6132fe565b90600052602060002090600502019050611aa98282612268565b80548015611b80578315611b2657600154611adf906001600160a01b0316611ad96000546001600160a01b031690565b836124d1565b604080516001600160a01b0388168152602081018390527fa859066e89895ffb9f2cdf2af7e7e84061fcb7ddd8657877c264737f25f8b655910160405180910390a1611b80565b600154611b3d906001600160a01b031687836124d1565b604080516001600160a01b0388168152602081018390527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a15b6004820154600160c01b900460ff16611bab578060096000828254611ba59190613276565b90915550505b8160010154600a6000828254611bc19190613276565b90915550506002820154600b8054600090611bdd908490613276565b90915550506001600160a01b038616600090815260046020526040812054611c0790600190613276565b905080611cc3576001600160a01b0387166000908152600460205260409020805480611c3557611c356132e8565b600082815260208120600560001990930192830201818155600181018290556002808201839055600382019290925560040180546001600160c81b03191690559155611c819088612987565b506040516001600160a01b03881681527f0ad8e54ac59bf2d8a7a1474c1af503b593553cf4fcaaffdef04ab5249f89762b9060200160405180910390a1611eb6565b808614611e08576001600160a01b0387166000908152600460205260409020805482908110611cf457611cf46132fe565b906000526020600020906005020160046000896001600160a01b03166001600160a01b031681526020019081526020016000208781548110611d3857611d386132fe565b6000918252602090912082546005909202019081556001808301549082015560028083015490820155600380830154908201556004918201805492909101805467ffffffffffffffff1981166001600160401b0394851690811783558354600160401b908190048616026001600160801b031990921617178082558254600160801b9081900490941690930267ffffffffffffffff60801b19841681178255915460ff600160c01b91829004160260ff60c01b1990921668ffffffffffffffffff60801b19909316929092171790555b6001600160a01b0387166000908152600460205260409020805480611e2f57611e2f6132e8565b600082815260208082206005600019949094019384020182815560018101839055600281018390556003810192909255600490910180546001600160c81b03191690559155604080516001600160a01b038a1681529182018890527f52da67f845146a7b07a837a7e32b5b74f6d3fafb17ec6c04f23acfc9e1aa9d1f910160405180910390a15b50505050505050565b33611ed26000546001600160a01b031690565b6001600160a01b031614611ef85760405162461bcd60e51b815260040161075890613070565b600655565b33611f106000546001600160a01b031690565b6001600160a01b031614611f365760405162461bcd60e51b815260040161075890613070565b600855565b33611f4e6000546001600160a01b031690565b6001600160a01b031614611f745760405162461bcd60e51b815260040161075890613070565b6001600160a01b038116611fd95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610758565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b815460009082106120925760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401610758565b8260000182815481106120a7576120a76132fe565b6000918252602090912001546001600160a01b031690505b92915050565b60006120d46201518042613159565b9050600f5481111561210f576000806120f583600f54600954600a54612ac9565b600f859055600a8190559092509050811561065e5750600b555b90565b6000808061212b6121266201518086613159565b612b68565b9196909550909350915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161219c9190612ff6565b6000604051808303816000865af19150503d80600081146121d9576040519150601f19603f3d011682016040523d82523d6000602084013e6121de565b606091505b50915091508180156122085750805115806122085750808060200190518101906122089190612e98565b6122605760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610758565b505050505050565b6004810154600160c01b900460ff1680612451578154600183015460048401546000906122a29062015180906001600160401b031661316d565b6001600160401b031690508581116123df57600485015460009081906122db908490600160401b90046001600160401b03168787612ac9565b60048901805467ffffffffffffffff60401b1916600160401b6001600160401b038d1602179055600189018190559092509050811561231c57600287018290555b801561233c5760048701805460ff60c01b1916600160c01b179055612372565b811561235c5760048701805460ff60c01b1916600160c11b179055612372565b60048701805460ff60c01b1916600360c01b1790555b84600960008282546123849190613276565b9250508190555061239b8884878a60010154612ac9565b809250819350505080600a60008282546123b59190613276565b909155505081156123d85781600b60008282546123d29190613276565b90915550505b5050612260565b60048501546000908190612406908990600160401b90046001600160401b03168787612ac9565b60048901805467ffffffffffffffff60401b1916600160401b6001600160401b038d1602179055600189018190559092509050811561244757600287018290555b5050505050505050565b8060ff16600114801561247757506004820154600160401b90046001600160401b031683115b801561248557506002820154155b1561136957600182018054600284018190556000909155156124b95750600401805460ff60c01b1916600160c11b17905550565b50600401805460ff60c01b1916600360c01b17905550565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161252d9190612ff6565b6000604051808303816000865af19150503d806000811461256a576040519150601f19603f3d011682016040523d82523d6000602084013e61256f565b606091505b50915091508180156125995750805115806125995750808060200190518101906125999190612e98565b610fb15760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610758565b60006125ef6120c5565b6001600160a01b0385166000908152600460205260408120805492935090918590811061261e5761261e6132fe565b906000526020600020906005020190506126388282612268565b80546000808355600383015580156127135783156126b957600154612672906001600160a01b0316611ad96000546001600160a01b031690565b604080516001600160a01b0388168152602081018390527fa859066e89895ffb9f2cdf2af7e7e84061fcb7ddd8657877c264737f25f8b655910160405180910390a1612713565b6001546126d0906001600160a01b031687836124d1565b604080516001600160a01b0388168152602081018390527f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd910160405180910390a15b600282015415801561272757506001820154155b15612260576001600160a01b038616600090815260046020526040812054611c0790600190613276565b6127596120c5565b506001600160a01b038416600090815260046020526040902054600a116127c25760405162461bcd60e51b815260206004820152601e60248201527f416c6c6f776564203130206465706f73697473207065722077616c6c657400006044820152606401610758565b82600960008282546127d49190613113565b909155506127e59050600285612cdb565b5060046000856001600160a01b03166001600160a01b0316815260200190815260200160002060405180610100016040528085815260200160008152602001600081526020016000815260200184620151806128419190613218565b61284b9042613113565b6001600160401b031681526020016128666201518042613159565b6001600160401b0390811682528481166020808401919091526000604093840181905285546001818101885596825290829020855160059092020190815590840151948101949094558282015160028501556060830151600385015560808301516004909401805460a085015160c086015160e09096015160ff16600160c01b0260ff60c01b19968516600160801b029690961668ffffffffffffffffff60801b19918516600160401b026001600160801b0319909316979094169690961717949094161791909117909155517ff556991011e831bcfac4f406d547e5e32cdd98267efab83935230d5f8d02c44690610be49086908690869086906001600160a01b0394909416845260208401929092526040830152606082015260800190565b6001600160a01b03811660009081526001830160205260408120548015612abf5760006129b5600183613276565b85549091506000906129c990600190613276565b905060008660000182815481106129e2576129e26132fe565b60009182526020909120015487546001600160a01b0390911691508190889085908110612a1157612a116132fe565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055612a45836001613113565b6001600160a01b03821660009081526001890160205260409020558654879080612a7157612a716132e8565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b03881682526001898101909152604082209190915594506120bf9350505050565b60009150506120bf565b60008184861115612b5f576000612ae08688613276565b90506000612aed88612b68565b92505050818111612b45576000612b048284613276565b612b0f906001613113565b9050612b1b8188613218565b612b259087613113565b9450612b318184613276565b9250612b3d8388613218565b935050612b5c565b612b4f8287613218565b612b599086613113565b92505b50505b94509492505050565b600080808381612b7b8262010bd96130d2565b612b889062253d8c6130d2565b9050600062023ab1612b9b836004613193565b612ba5919061312b565b90506004612bb68262023ab1613193565b612bc19060036130d2565b612bcb919061312b565b612bd59083613237565b9150600062164b09612be88460016130d2565b612bf490610fa0613193565b612bfe919061312b565b90506004612c0e826105b5613193565b612c18919061312b565b612c229084613237565b612c2d90601f6130d2565b9250600061098f612c3f856050613193565b612c49919061312b565b905060006050612c5b8361098f613193565b612c65919061312b565b612c6f9086613237565b9050612c7c600b8361312b565b9450612c8985600c613193565b612c948360026130d2565b612c9e9190613237565b91508483612cad603187613237565b612cb8906064613193565b612cc291906130d2565b612ccc91906130d2565b9a919950975095505050505050565b6001600160a01b0381166000908152600183016020526040812054612d4557508154600180820184556000848152602080822090930180546001600160a01b0319166001600160a01b038616908117909155855490825282860190935260409020919091556120bf565b5060006120bf565b80356001600160a01b0381168114612d6457600080fd5b919050565b600060208284031215612d7b57600080fd5b612d8482612d4d565b9392505050565b60008060408385031215612d9e57600080fd5b612da783612d4d565b9150612db560208401612d4d565b90509250929050565b60008060408385031215612dd157600080fd5b612dda83612d4d565b91506020830135612dea81613314565b809150509250929050565b60008060408385031215612e0857600080fd5b612e1183612d4d565b946020939093013593505050565b600080600060608486031215612e3457600080fd5b612e3d84612d4d565b9250602084013591506040840135612e5481613314565b809150509250925092565b60008060008060808587031215612e7557600080fd5b612e7e85612d4d565b966020860135965060408601359560600135945092505050565b600060208284031215612eaa57600080fd5b8151612d8481613314565b600060208284031215612ec757600080fd5b5035919050565b600060208284031215612ee057600080fd5b5051919050565b60008060408385031215612efa57600080fd5b823591506020830135612dea81613314565b60008060408385031215612f1f57600080fd5b50508035926020909101359150565b600080600060608486031215612f4357600080fd5b83359250602084013591506040840135612e5481613314565b600081518084526020808501945080840160005b83811015612feb57815180518852838101518489015260408082015190890152606080820151908901526080808201516001600160401b03908116918a019190915260a0808301518216908a015260c0808301519091169089015260e09081015160ff16908801526101009096019590820190600101612f70565b509495945050505050565b6000825160005b818110156130175760208186018101518583015201612ffd565b81811115613026576000828501525b509190910192915050565b6001600160a01b038316815260406020820181905260009061305590830184612f5c565b949350505050565b602081526000612d846020830184612f5c565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526013908201527221b0b63632b91034b9903737ba1030b236b4b760691b604082015260600190565b600080821280156001600160ff1b03849003851316156130f4576130f46132bc565b600160ff1b839003841281161561310d5761310d6132bc565b50500190565b60008219821115613126576131266132bc565b500190565b60008261313a5761313a6132d2565b600160ff1b821460001984141615613154576131546132bc565b500590565b600082613168576131686132d2565b500490565b60006001600160401b0380841680613187576131876132d2565b92169190910492915050565b60006001600160ff1b03818413828413808216868404861116156131b9576131b96132bc565b600160ff1b60008712828116878305891216156131d8576131d86132bc565b600087129250878205871284841616156131f4576131f46132bc565b8785058712818416161561320a5761320a6132bc565b505050929093029392505050565b6000816000190483118215151615613232576132326132bc565b500290565b60008083128015600160ff1b850184121615613255576132556132bc565b6001600160ff1b0384018313811615613270576132706132bc565b50500390565b600082821015613288576132886132bc565b500390565b60006000198214156132a1576132a16132bc565b5060010190565b6000826132b7576132b76132d2565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b8015158114610bf057600080fdfec534675d962a9c4b4a6eef4e934d46b14162000192fa31cf0c29cd81fdb8c2eea2646970667358221220056b92520ad12be5f5e9f6e0db98e611a49f573ad9b6f29384c4c40b169d6f8564736f6c63430008060033