Address Details
contract
0xCe74d14163deb82af57f253108F7E5699e62116d
- Contract Name
- VotableStakingRewards
- Creator
- 0x4c828d–78dc3e at 0x05fcd1–8f89ea
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 63,060 Transactions
- Transfers
- 158,647 Transfers
- Gas Used
- 7,308,376,326
- Last Balance Update
- 25312811
Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- VotableStakingRewards
- Optimization enabled
- true
- Compiler version
- v0.8.9+commit.e5eed63a
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2021-11-02T22:13:13.292973Z
project:/contracts/VotableStakingRewards.sol
// SPDX-License-Identifier: MIT // solhint-disable not-rely-on-time pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./interfaces/IRomulusDelegate.sol"; import "./interfaces/IStakingRewards.sol"; import "./RewardsDistributionRecipient.sol"; import "./Voter.sol"; // Base: https://github.com/Ubeswap/ubeswap-farming/blob/master/contracts/synthetix/contracts/StakingRewards.sol contract VotableStakingRewards is IStakingRewards, RewardsDistributionRecipient, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ IERC20 public rewardsToken; IERC20 public stakingToken; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public rewardsDuration = 7 days; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; uint256 private _totalSupply; mapping(address => uint256) private _balances; // Voters // 0 - Abstain // 1 - For // 2 - Against Voter[3] public delegates; mapping(address => uint8) public userDelegateIdx; /* ========== CONSTRUCTOR ========== */ constructor( address _owner, address _rewardsDistribution, address _rewardsToken, address _stakingToken, IRomulusDelegate _romulusDelegate ) Owned(_owner) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; delegates[0] = new Voter( 2, // Abstain IVotingDelegates(_stakingToken), _romulusDelegate ); delegates[1] = new Voter( 1, // For IVotingDelegates(_stakingToken), _romulusDelegate ); delegates[2] = new Voter( 0, // Against IVotingDelegates(_stakingToken), _romulusDelegate ); } /* ========== VIEWS ========== */ function supportOf(address account) external view returns (uint8) { return delegates[userDelegateIdx[account]].support(); } function totalSupply() external view override returns (uint256) { return _totalSupply; } function balanceOf(address account) external view override returns (uint256) { return _balances[account]; } function lastTimeRewardApplicable() public view override returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view override returns (uint256) { if (_totalSupply == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(_totalSupply) ); } function earned(address account) public view override returns (uint256) { return _balances[account] .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } function getRewardForDuration() external view override returns (uint256) { return rewardRate.mul(rewardsDuration); } /* ========== MUTATIVE FUNCTIONS ========== */ function stake(uint256 amount) external override nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); stakingToken.safeTransferFrom(msg.sender, address(this), amount); Voter v = delegates[userDelegateIdx[msg.sender]]; require( stakingToken.approve(address(v), amount), "Approve to voter failed" ); v.addVotes(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public override nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); Voter v = delegates[userDelegateIdx[msg.sender]]; v.removeVotes(amount); stakingToken.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); } function changeDelegateIdx(uint8 nextIdx) external nonReentrant { require(nextIdx < 3, "newDelegateIdx out of bounds."); uint8 previousIdx = userDelegateIdx[msg.sender]; Voter previous = delegates[previousIdx]; uint256 balance = _balances[msg.sender]; previous.removeVotes(balance); Voter next = delegates[nextIdx]; require( stakingToken.approve(address(next), balance), "Approve to voter failed" ); next.addVotes(balance); userDelegateIdx[msg.sender] = nextIdx; emit DelegateIdxChanged(previousIdx, nextIdx); } function getReward() public override nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { rewards[msg.sender] = 0; rewardsToken.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } function exit() external override { withdraw(_balances[msg.sender]); getReward(); } /* ========== RESTRICTED FUNCTIONS ========== */ function notifyRewardAmount(uint256 reward) external override onlyRewardsDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(rewardsDuration); } // Ensure the provided reward amount is not more than the balance in the contract. // This keeps the reward rate in the right range, preventing overflows due to // very high values of rewardRate in the earned and rewardsPerToken functions; // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. uint256 balance = rewardsToken.balanceOf(address(this)); require( rewardRate <= balance.div(rewardsDuration), "Provided reward too high" ); lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(rewardsDuration); emit RewardAdded(reward); } // Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner { require( tokenAddress != address(stakingToken), "Cannot withdraw the staking token" ); IERC20(tokenAddress).safeTransfer(owner, tokenAmount); emit Recovered(tokenAddress, tokenAmount); } function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner { require( block.timestamp > periodFinish, "Previous rewards period must be complete before changing the duration for the new period" ); rewardsDuration = _rewardsDuration; emit RewardsDurationUpdated(rewardsDuration); } /* ========== MODIFIERS ========== */ modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } /* ========== EVENTS ========== */ event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); event RewardsDurationUpdated(uint256 newDuration); event Recovered(address token, uint256 amount); event DelegateIdxChanged(uint8 previousDelegateIdx, uint8 nextDelegateIdx); }
/_openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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() { _setOwner(_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 { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
/_openzeppelin/contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
/_openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
/_openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/_openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/_openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/_openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
/_openzeppelin/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
/_openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ 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; } } }
/_ubeswap/governance/contracts/interfaces/IVotingDelegates.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; /** * Interface for a contract that keeps track of voting delegates. */ interface IVotingDelegates { /// @notice An event thats emitted when an account changes its delegate event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate ); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged( address indexed delegate, uint256 previousBalance, uint256 newBalance ); /// @notice An event emitted when an account's voting power is transferred. // - If `from` is `address(0)`, power was minted. // - If `to` is `address(0)`, power was burned. event Transfer(address indexed from, address indexed to, uint256 amount); /// @notice Name of the contract. // Required for signing. function name() external view returns (string memory); /// @notice A record of each accounts delegate function delegates(address delegatee) external view returns (address); /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external; /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external; /** * @notice Get the amount of voting power of an account * @param account The address of the account to get the balance of * @return The amount of voting power held */ function votingPower(address account) external view returns (uint96); /// @notice Total voting power in existence. function totalVotingPower() external view returns (uint96); }
/project_/contracts/Owned.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; // https://docs.synthetix.io/contracts/source/contracts/owned contract Owned { address public owner; address public nominatedOwner; constructor(address _owner) { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require( msg.sender == nominatedOwner, "You must be nominated before you can accept ownership" ); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner() { _onlyOwner(); _; } function _onlyOwner() private view { require( msg.sender == owner, "Only the contract owner may perform this action" ); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); }
/project_/contracts/RewardsDistributionRecipient.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; // Inheritance import "./Owned.sol"; // https://docs.synthetix.io/contracts/source/contracts/rewardsdistributionrecipient abstract contract RewardsDistributionRecipient is Owned { address public rewardsDistribution; event RewardsDistributionChanged( address indexed previousRewardsDistribution, address indexed nextRewardsDistribution ); function notifyRewardAmount(uint256 reward) external virtual; modifier onlyRewardsDistribution() { require( msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract" ); _; } function setRewardsDistribution(address _rewardsDistribution) external onlyOwner { address previousRewardsDistribution = rewardsDistribution; rewardsDistribution = _rewardsDistribution; emit RewardsDistributionChanged( previousRewardsDistribution, rewardsDistribution ); } }
/project_/contracts/Voter.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@ubeswap/governance/contracts/interfaces/IVotingDelegates.sol"; import "./interfaces/IRomulusDelegate.sol"; contract Voter is Ownable { using SafeERC20 for IERC20; uint8 public immutable support; IVotingDelegates public immutable votingToken; IRomulusDelegate public immutable romulusDelegate; constructor( uint8 _support, IVotingDelegates _votingToken, IRomulusDelegate _romulusDelegate ) { support = _support; votingToken = _votingToken; romulusDelegate = _romulusDelegate; _votingToken.delegate(address(this)); } function addVotes(uint256 amount) external onlyOwner { IERC20(address(votingToken)).safeTransferFrom( msg.sender, address(this), amount ); } function removeVotes(uint256 amount) external onlyOwner { IERC20(address(votingToken)).safeTransfer(msg.sender, amount); } function castVote(uint256 proposalId) external { romulusDelegate.castVote(proposalId, support); } }
/project_/contracts/interfaces/IRomulusDelegate.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; interface IRomulusDelegate { function castVote(uint256 proposalId, uint8 support) external; }
/project_/contracts/interfaces/IStakingRewards.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.4.24; interface IStakingRewards { // Views function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); // Mutative function stake(uint256 amount) external; function withdraw(uint256 amount) external; function getReward() external; function exit() external; }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_owner","internalType":"address"},{"type":"address","name":"_rewardsDistribution","internalType":"address"},{"type":"address","name":"_rewardsToken","internalType":"address"},{"type":"address","name":"_stakingToken","internalType":"address"},{"type":"address","name":"_romulusDelegate","internalType":"contract IRomulusDelegate"}]},{"type":"event","name":"DelegateIdxChanged","inputs":[{"type":"uint8","name":"previousDelegateIdx","internalType":"uint8","indexed":false},{"type":"uint8","name":"nextDelegateIdx","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"OwnerChanged","inputs":[{"type":"address","name":"oldOwner","internalType":"address","indexed":false},{"type":"address","name":"newOwner","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"OwnerNominated","inputs":[{"type":"address","name":"newOwner","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Recovered","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardAdded","inputs":[{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardPaid","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardsDistributionChanged","inputs":[{"type":"address","name":"previousRewardsDistribution","internalType":"address","indexed":true},{"type":"address","name":"nextRewardsDistribution","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RewardsDurationUpdated","inputs":[{"type":"uint256","name":"newDuration","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Staked","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdrawn","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeDelegateIdx","inputs":[{"type":"uint8","name":"nextIdx","internalType":"uint8"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract Voter"}],"name":"delegates","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"earned","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"exit","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"getReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRewardForDuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastTimeRewardApplicable","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastUpdateTime","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"nominateNewOwner","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"nominatedOwner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"notifyRewardAmount","inputs":[{"type":"uint256","name":"reward","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"periodFinish","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"recoverERC20","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPerToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPerTokenStored","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardRate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewards","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardsDistribution","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardsDuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"rewardsToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardsDistribution","inputs":[{"type":"address","name":"_rewardsDistribution","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardsDuration","inputs":[{"type":"uint256","name":"_rewardsDuration","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"stakingToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"supportOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"userDelegateIdx","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userRewardPerTokenPaid","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]}]
Contract Creation Code
0x60806040526000600655600060075562093a806008553480156200002257600080fd5b50604051620027d6380380620027d68339810160408190526200004591620002c7565b846001600160a01b038116620000a15760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015260640160405180910390fd5b600080546001600160a01b0319166001600160a01b03831690811782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1506001600355600480546001600160a01b038086166001600160a01b031992831617909255600580548584169083161790556002805492871692909116919091178155604051839083906200014d90620002a0565b60ff90931683526001600160a01b039182166020840152166040820152606001604051809103906000f0801580156200018a573d6000803e3d6000fd5b50600f80546001600160a01b0319166001600160a01b039290921691909117905560405160019083908390620001c090620002a0565b60ff90931683526001600160a01b039182166020840152166040820152606001604051809103906000f080158015620001fd573d6000803e3d6000fd5b50601080546001600160a01b0319166001600160a01b0392909216919091179055604051600090839083906200023390620002a0565b60ff90931683526001600160a01b039182166020840152166040820152606001604051809103906000f08015801562000270573d6000803e3d6000fd5b50600f60020180546001600160a01b0319166001600160a01b039290921691909117905550620003479350505050565b610a178062001dbf83390190565b6001600160a01b0381168114620002c457600080fd5b50565b600080600080600060a08688031215620002e057600080fd5b8551620002ed81620002ae565b60208701519095506200030081620002ae565b60408701519094506200031381620002ae565b60608701519093506200032681620002ae565b60808701519092506200033981620002ae565b809150509295509295909350565b611a6880620003576000396000f3fe608060405234801561001057600080fd5b50600436106101ef5760003560e01c806379ba50971161010f578063c8f33c91116100a2578063dee6fd6011610071578063dee6fd6014610427578063df136d651461043a578063e9fad8ee14610443578063ebe2b12b1461044b57600080fd5b8063c8f33c91146103f0578063cc1a378f146103f9578063cd3daf9d1461040c578063d1af0c7d1461041457600080fd5b80638b876347116100de5780638b876347146103975780638da5cb5b146103b7578063a694fc3a146103ca578063b1548afc146103dd57600080fd5b806379ba50971461036b5780637b0a47ee1461037357806380faa57d1461037c5780638980f11f1461038457600080fd5b80633702b616116101875780633fc6df6e116101565780633fc6df6e146102f157806353a47bb71461031c57806370a082311461032f57806372f702f31461035857600080fd5b80633702b616146102ba578063386a9525146102cd5780633c6b16ab146102d65780633d18b912146102e957600080fd5b806319762143116101c357806319762143146102575780631c1f78eb1461026a57806326fcc94a146102725780632e1a7d4d146102a757600080fd5b80628cc262146101f45780630700037d1461021a5780631627540c1461023a57806318160ddd1461024f575b600080fd5b6102076102023660046117ff565b610454565b6040519081526020015b60405180910390f35b6102076102283660046117ff565b600c6020526000908152604090205481565b61024d6102483660046117ff565b6104d2565b005b600d54610207565b61024d6102653660046117ff565b61052f565b610207610589565b6102956102803660046117ff565b60126020526000908152604090205460ff1681565b60405160ff9091168152602001610211565b61024d6102b536600461181a565b6105a7565b61024d6102c8366004611845565b61078d565b61020760085481565b61024d6102e436600461181a565b610a4e565b61024d610cb0565b600254610304906001600160a01b031681565b6040516001600160a01b039091168152602001610211565b600154610304906001600160a01b031681565b61020761033d3660046117ff565b6001600160a01b03166000908152600e602052604090205490565b600554610304906001600160a01b031681565b61024d610db1565b61020760075481565b610207610e9b565b61024d610392366004611862565b610ea9565b6102076103a53660046117ff565b600b6020526000908152604090205481565b600054610304906001600160a01b031681565b61024d6103d836600461181a565b610f79565b6103046103eb36600461181a565b611217565b61020760095481565b61024d61040736600461181a565b611237565b610207611311565b600454610304906001600160a01b031681565b6102956104353660046117ff565b61135d565b610207600a5481565b61024d611411565b61020760065481565b6001600160a01b0381166000908152600c6020908152604080832054600b9092528220546104cc91906104c690670de0b6b3a7640000906104c0906104a19061049b611311565b90611434565b6001600160a01b0388166000908152600e602052604090205490611447565b90611453565b9061145f565b92915050565b6104da61146b565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b61053761146b565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f7cd0eff38c2bfa946cee93bb97833afb376387f4d6c0df35a7fb8b20b3f3ece190600090a35050565b60006105a260085460075461144790919063ffffffff16565b905090565b600260035414156105d35760405162461bcd60e51b81526004016105ca9061188c565b60405180910390fd5b6002600355336105e1611311565b600a556105ec610e9b565b6009556001600160a01b038116156106335761060781610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b600082116106775760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016105ca565b600d546106849083611434565b600d55336000908152600e60205260409020546106a19083611434565b336000908152600e60209081526040808320939093556012905290812054600f9060ff16600381106106d5576106d56118c3565b0154604051630e81c8b560e31b8152600481018590526001600160a01b039091169150819063740e45a890602401600060405180830381600087803b15801561071d57600080fd5b505af1158015610731573d6000803e3d6000fd5b505060055461074d92506001600160a01b0316905033856114dd565b60405183815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25050600160035550565b600260035414156107b05760405162461bcd60e51b81526004016105ca9061188c565b6002600390815560ff8216106108085760405162461bcd60e51b815260206004820152601d60248201527f6e657744656c6567617465496478206f7574206f6620626f756e64732e00000060448201526064016105ca565b3360009081526012602052604081205460ff1690600f826003811061082f5761082f6118c3565b0154336000908152600e602052604090819020549051630e81c8b560e31b8152600481018290526001600160a01b03909216925090829063740e45a890602401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050506000600f8560ff16600381106108b9576108b96118c3565b015460055460405163095ea7b360e01b81526001600160a01b039283166004820181905260248201869052935091169063095ea7b390604401602060405180830381600087803b15801561090c57600080fd5b505af1158015610920573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094491906118d9565b61098a5760405162461bcd60e51b8152602060048201526017602482015276105c1c1c9bdd99481d1bc81d9bdd195c8819985a5b1959604a1b60448201526064016105ca565b6040516325286fa760e21b8152600481018390526001600160a01b038216906394a1be9c90602401600060405180830381600087803b1580156109cc57600080fd5b505af11580156109e0573d6000803e3d6000fd5b505033600090815260126020908152604091829020805460ff191660ff8b81169182179092558351918a168252918101919091527f326999ca27a19c4177665d55ec90a8c9a1c2b393e30837e37db589071e06f1b1935001905060405180910390a150506001600355505050565b6002546001600160a01b03163314610abb5760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084016105ca565b6000610ac5611311565b600a55610ad0610e9b565b6009556001600160a01b03811615610b1757610aeb81610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b6006544210610b3657600854610b2e908390611453565b600755610b79565b600654600090610b469042611434565b90506000610b5f6007548361144790919063ffffffff16565b600854909150610b73906104c0868461145f565b60075550505b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a082319060240160206040518083038186803b158015610bc257600080fd5b505afa158015610bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfa91906118fb565b9050610c116008548261145390919063ffffffff16565b6007541115610c625760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016105ca565b426009819055600854610c75919061145f565b6006556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b60026003541415610cd35760405162461bcd60e51b81526004016105ca9061188c565b600260035533610ce1611311565b600a55610cec610e9b565b6009556001600160a01b03811615610d3357610d0781610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b336000908152600c60205260409020548015610da857336000818152600c6020526040812055600454610d72916001600160a01b0390911690836114dd565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b50506001600355565b6001546001600160a01b03163314610e295760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b60648201526084016105ca565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60006105a242600654611545565b610eb161146b565b6005546001600160a01b0383811691161415610f195760405162461bcd60e51b815260206004820152602160248201527f43616e6e6f7420776974686472617720746865207374616b696e6720746f6b656044820152603760f91b60648201526084016105ca565b600054610f33906001600160a01b038481169116836114dd565b604080516001600160a01b0384168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b60026003541415610f9c5760405162461bcd60e51b81526004016105ca9061188c565b600260035533610faa611311565b600a55610fb5610e9b565b6009556001600160a01b03811615610ffc57610fd081610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b6000821161103d5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016105ca565b600d5461104a908361145f565b600d55336000908152600e6020526040902054611067908361145f565b336000818152600e6020526040902091909155600554611094916001600160a01b0390911690308561155b565b33600090815260126020526040812054600f9060ff16600381106110ba576110ba6118c3565b015460055460405163095ea7b360e01b81526001600160a01b039283166004820181905260248201879052935091169063095ea7b390604401602060405180830381600087803b15801561110d57600080fd5b505af1158015611121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114591906118d9565b61118b5760405162461bcd60e51b8152602060048201526017602482015276105c1c1c9bdd99481d1bc81d9bdd195c8819985a5b1959604a1b60448201526064016105ca565b6040516325286fa760e21b8152600481018490526001600160a01b038216906394a1be9c90602401600060405180830381600087803b1580156111cd57600080fd5b505af11580156111e1573d6000803e3d6000fd5b50506040518581523392507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d915060200161077b565b600f816003811061122757600080fd5b01546001600160a01b0316905081565b61123f61146b565b60065442116112dc5760405162461bcd60e51b815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a4016105ca565b60088190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d390602001610524565b6000600d54600014156113255750600a5490565b6105a2611354600d546104c0670de0b6b3a764000061134e60075461134e60095461049b610e9b565b90611447565b600a549061145f565b6001600160a01b038116600090815260126020526040812054600f9060ff166003811061138c5761138c6118c3565b0160009054906101000a90046001600160a01b03166001600160a01b031663119f87476040518163ffffffff1660e01b815260040160206040518083038186803b1580156113d957600080fd5b505afa1580156113ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cc9190611914565b336000908152600e602052604090205461142a906105a7565b611432610cb0565b565b60006114408284611947565b9392505050565b6000611440828461195e565b6000611440828461197d565b6000611440828461199f565b6000546001600160a01b031633146114325760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084016105ca565b6040516001600160a01b03831660248201526044810182905261154090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611599565b505050565b60008183106115545781611440565b5090919050565b6040516001600160a01b03808516602483015283166044820152606481018290526115939085906323b872dd60e01b90608401611509565b50505050565b60006115ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661166b9092919063ffffffff16565b805190915015611540578080602001905181019061160c91906118d9565b6115405760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105ca565b606061167a8484600085611682565b949350505050565b6060824710156116e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105ca565b843b6117315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ca565b600080866001600160a01b0316858760405161174d91906119e3565b60006040518083038185875af1925050503d806000811461178a576040519150601f19603f3d011682016040523d82523d6000602084013e61178f565b606091505b509150915061179f8282866117aa565b979650505050505050565b606083156117b9575081611440565b8251156117c95782518084602001fd5b8160405162461bcd60e51b81526004016105ca91906119ff565b80356001600160a01b03811681146117fa57600080fd5b919050565b60006020828403121561181157600080fd5b611440826117e3565b60006020828403121561182c57600080fd5b5035919050565b60ff8116811461184257600080fd5b50565b60006020828403121561185757600080fd5b813561144081611833565b6000806040838503121561187557600080fd5b61187e836117e3565b946020939093013593505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156118eb57600080fd5b8151801515811461144057600080fd5b60006020828403121561190d57600080fd5b5051919050565b60006020828403121561192657600080fd5b815161144081611833565b634e487b7160e01b600052601160045260246000fd5b60008282101561195957611959611931565b500390565b600081600019048311821515161561197857611978611931565b500290565b60008261199a57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156119b2576119b2611931565b500190565b60005b838110156119d25781810151838201526020016119ba565b838111156115935750506000910152565b600082516119f58184602087016119b7565b9190910192915050565b6020815260008251806020840152611a1e8160408501602087016119b7565b601f01601f1916919091016040019291505056fea264697066735822122008644aa5f391312b4ab31fb2f7a04b98f4449e177751bb06236098dab156bcf464736f6c6343000809003360e060405234801561001057600080fd5b50604051610a17380380610a1783398101604081905261002f91610113565b610038336100ab565b60ff83166080526001600160a01b0382811660a081905290821660c0526040516317066a5760e21b8152306004820152635c19a95c90602401600060405180830381600087803b15801561008b57600080fd5b505af115801561009f573d6000803e3d6000fd5b50505050505050610166565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461011057600080fd5b50565b60008060006060848603121561012857600080fd5b835160ff8116811461013957600080fd5b602085015190935061014a816100fb565b604085015190925061015b816100fb565b809150509250925092565b60805160a05160c0516108686101af6000396000818160db01526101e201526000818161016e015281816102bf0152610320015260008181609d01526101bb01526108686000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063740e45a811610066578063740e45a8146101325780638da5cb5b1461014557806394a1be9c14610156578063b034012314610169578063f2fde38b1461019057600080fd5b8063119f8747146100985780633310c7df146100d65780633eb76b9c14610115578063715018a61461012a575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020015b60405180910390f35b6100fd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100cd565b61012861012336600461071e565b6101a3565b005b610128610249565b61012861014036600461071e565b610288565b6000546001600160a01b03166100fd565b61012861016436600461071e565b6102e9565b6100fd7f000000000000000000000000000000000000000000000000000000000000000081565b61012861019e366004610737565b610348565b604051630acf027160e31b81526004810182905260ff7f00000000000000000000000000000000000000000000000000000000000000001660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635678138890604401600060405180830381600087803b15801561022e57600080fd5b505af1158015610242573d6000803e3d6000fd5b5050505050565b6000546001600160a01b0316331461027c5760405162461bcd60e51b815260040161027390610760565b60405180910390fd5b61028660006103dc565b565b6000546001600160a01b031633146102b25760405162461bcd60e51b815260040161027390610760565b6102e66001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338361042c565b50565b6000546001600160a01b031633146103135760405162461bcd60e51b815260040161027390610760565b6102e66001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333084610494565b6000546001600160a01b031633146103725760405162461bcd60e51b815260040161027390610760565b6001600160a01b0381166103d75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610273565b6102e6815b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03831660248201526044810182905261048f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526104d2565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526104cc9085906323b872dd60e01b90608401610458565b50505050565b6000610527826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166105a49092919063ffffffff16565b80519091501561048f57808060200190518101906105459190610795565b61048f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610273565b60606105b384846000856105bd565b90505b9392505050565b60608247101561061e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610273565b843b61066c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610273565b600080866001600160a01b0316858760405161068891906107e3565b60006040518083038185875af1925050503d80600081146106c5576040519150601f19603f3d011682016040523d82523d6000602084013e6106ca565b606091505b50915091506106da8282866106e5565b979650505050505050565b606083156106f45750816105b6565b8251156107045782518084602001fd5b8160405162461bcd60e51b815260040161027391906107ff565b60006020828403121561073057600080fd5b5035919050565b60006020828403121561074957600080fd5b81356001600160a01b03811681146105b657600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156107a757600080fd5b815180151581146105b657600080fd5b60005b838110156107d25781810151838201526020016107ba565b838111156104cc5750506000910152565b600082516107f58184602087016107b7565b9190910192915050565b602081526000825180602084015261081e8160408501602087016107b7565b601f01601f1916919091016040019291505056fea26469706673582212207518773f7ae94cf560e3da937dd79ac210c2874f48e21995a00bff63a0a32c2964736f6c634300080900330000000000000000000000000ce41dbcea62580ae2c894a7d93e97da0c3dac3a0000000000000000000000000ce41dbcea62580ae2c894a7d93e97da0c3dac3a00000000000000000000000000be915b9dcf56a3cbe739d9b9c202ca692409ec00000000000000000000000000be915b9dcf56a3cbe739d9b9c202ca692409ec000000000000000000000000a7581d8e26007f4d2374507736327f5b46dd6ba8
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c806379ba50971161010f578063c8f33c91116100a2578063dee6fd6011610071578063dee6fd6014610427578063df136d651461043a578063e9fad8ee14610443578063ebe2b12b1461044b57600080fd5b8063c8f33c91146103f0578063cc1a378f146103f9578063cd3daf9d1461040c578063d1af0c7d1461041457600080fd5b80638b876347116100de5780638b876347146103975780638da5cb5b146103b7578063a694fc3a146103ca578063b1548afc146103dd57600080fd5b806379ba50971461036b5780637b0a47ee1461037357806380faa57d1461037c5780638980f11f1461038457600080fd5b80633702b616116101875780633fc6df6e116101565780633fc6df6e146102f157806353a47bb71461031c57806370a082311461032f57806372f702f31461035857600080fd5b80633702b616146102ba578063386a9525146102cd5780633c6b16ab146102d65780633d18b912146102e957600080fd5b806319762143116101c357806319762143146102575780631c1f78eb1461026a57806326fcc94a146102725780632e1a7d4d146102a757600080fd5b80628cc262146101f45780630700037d1461021a5780631627540c1461023a57806318160ddd1461024f575b600080fd5b6102076102023660046117ff565b610454565b6040519081526020015b60405180910390f35b6102076102283660046117ff565b600c6020526000908152604090205481565b61024d6102483660046117ff565b6104d2565b005b600d54610207565b61024d6102653660046117ff565b61052f565b610207610589565b6102956102803660046117ff565b60126020526000908152604090205460ff1681565b60405160ff9091168152602001610211565b61024d6102b536600461181a565b6105a7565b61024d6102c8366004611845565b61078d565b61020760085481565b61024d6102e436600461181a565b610a4e565b61024d610cb0565b600254610304906001600160a01b031681565b6040516001600160a01b039091168152602001610211565b600154610304906001600160a01b031681565b61020761033d3660046117ff565b6001600160a01b03166000908152600e602052604090205490565b600554610304906001600160a01b031681565b61024d610db1565b61020760075481565b610207610e9b565b61024d610392366004611862565b610ea9565b6102076103a53660046117ff565b600b6020526000908152604090205481565b600054610304906001600160a01b031681565b61024d6103d836600461181a565b610f79565b6103046103eb36600461181a565b611217565b61020760095481565b61024d61040736600461181a565b611237565b610207611311565b600454610304906001600160a01b031681565b6102956104353660046117ff565b61135d565b610207600a5481565b61024d611411565b61020760065481565b6001600160a01b0381166000908152600c6020908152604080832054600b9092528220546104cc91906104c690670de0b6b3a7640000906104c0906104a19061049b611311565b90611434565b6001600160a01b0388166000908152600e602052604090205490611447565b90611453565b9061145f565b92915050565b6104da61146b565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b61053761146b565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f7cd0eff38c2bfa946cee93bb97833afb376387f4d6c0df35a7fb8b20b3f3ece190600090a35050565b60006105a260085460075461144790919063ffffffff16565b905090565b600260035414156105d35760405162461bcd60e51b81526004016105ca9061188c565b60405180910390fd5b6002600355336105e1611311565b600a556105ec610e9b565b6009556001600160a01b038116156106335761060781610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b600082116106775760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016105ca565b600d546106849083611434565b600d55336000908152600e60205260409020546106a19083611434565b336000908152600e60209081526040808320939093556012905290812054600f9060ff16600381106106d5576106d56118c3565b0154604051630e81c8b560e31b8152600481018590526001600160a01b039091169150819063740e45a890602401600060405180830381600087803b15801561071d57600080fd5b505af1158015610731573d6000803e3d6000fd5b505060055461074d92506001600160a01b0316905033856114dd565b60405183815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25050600160035550565b600260035414156107b05760405162461bcd60e51b81526004016105ca9061188c565b6002600390815560ff8216106108085760405162461bcd60e51b815260206004820152601d60248201527f6e657744656c6567617465496478206f7574206f6620626f756e64732e00000060448201526064016105ca565b3360009081526012602052604081205460ff1690600f826003811061082f5761082f6118c3565b0154336000908152600e602052604090819020549051630e81c8b560e31b8152600481018290526001600160a01b03909216925090829063740e45a890602401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050506000600f8560ff16600381106108b9576108b96118c3565b015460055460405163095ea7b360e01b81526001600160a01b039283166004820181905260248201869052935091169063095ea7b390604401602060405180830381600087803b15801561090c57600080fd5b505af1158015610920573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094491906118d9565b61098a5760405162461bcd60e51b8152602060048201526017602482015276105c1c1c9bdd99481d1bc81d9bdd195c8819985a5b1959604a1b60448201526064016105ca565b6040516325286fa760e21b8152600481018390526001600160a01b038216906394a1be9c90602401600060405180830381600087803b1580156109cc57600080fd5b505af11580156109e0573d6000803e3d6000fd5b505033600090815260126020908152604091829020805460ff191660ff8b81169182179092558351918a168252918101919091527f326999ca27a19c4177665d55ec90a8c9a1c2b393e30837e37db589071e06f1b1935001905060405180910390a150506001600355505050565b6002546001600160a01b03163314610abb5760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084016105ca565b6000610ac5611311565b600a55610ad0610e9b565b6009556001600160a01b03811615610b1757610aeb81610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b6006544210610b3657600854610b2e908390611453565b600755610b79565b600654600090610b469042611434565b90506000610b5f6007548361144790919063ffffffff16565b600854909150610b73906104c0868461145f565b60075550505b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a082319060240160206040518083038186803b158015610bc257600080fd5b505afa158015610bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfa91906118fb565b9050610c116008548261145390919063ffffffff16565b6007541115610c625760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016105ca565b426009819055600854610c75919061145f565b6006556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b60026003541415610cd35760405162461bcd60e51b81526004016105ca9061188c565b600260035533610ce1611311565b600a55610cec610e9b565b6009556001600160a01b03811615610d3357610d0781610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b336000908152600c60205260409020548015610da857336000818152600c6020526040812055600454610d72916001600160a01b0390911690836114dd565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b50506001600355565b6001546001600160a01b03163314610e295760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b60648201526084016105ca565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60006105a242600654611545565b610eb161146b565b6005546001600160a01b0383811691161415610f195760405162461bcd60e51b815260206004820152602160248201527f43616e6e6f7420776974686472617720746865207374616b696e6720746f6b656044820152603760f91b60648201526084016105ca565b600054610f33906001600160a01b038481169116836114dd565b604080516001600160a01b0384168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b60026003541415610f9c5760405162461bcd60e51b81526004016105ca9061188c565b600260035533610faa611311565b600a55610fb5610e9b565b6009556001600160a01b03811615610ffc57610fd081610454565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b6000821161103d5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016105ca565b600d5461104a908361145f565b600d55336000908152600e6020526040902054611067908361145f565b336000818152600e6020526040902091909155600554611094916001600160a01b0390911690308561155b565b33600090815260126020526040812054600f9060ff16600381106110ba576110ba6118c3565b015460055460405163095ea7b360e01b81526001600160a01b039283166004820181905260248201879052935091169063095ea7b390604401602060405180830381600087803b15801561110d57600080fd5b505af1158015611121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114591906118d9565b61118b5760405162461bcd60e51b8152602060048201526017602482015276105c1c1c9bdd99481d1bc81d9bdd195c8819985a5b1959604a1b60448201526064016105ca565b6040516325286fa760e21b8152600481018490526001600160a01b038216906394a1be9c90602401600060405180830381600087803b1580156111cd57600080fd5b505af11580156111e1573d6000803e3d6000fd5b50506040518581523392507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d915060200161077b565b600f816003811061122757600080fd5b01546001600160a01b0316905081565b61123f61146b565b60065442116112dc5760405162461bcd60e51b815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a4016105ca565b60088190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d390602001610524565b6000600d54600014156113255750600a5490565b6105a2611354600d546104c0670de0b6b3a764000061134e60075461134e60095461049b610e9b565b90611447565b600a549061145f565b6001600160a01b038116600090815260126020526040812054600f9060ff166003811061138c5761138c6118c3565b0160009054906101000a90046001600160a01b03166001600160a01b031663119f87476040518163ffffffff1660e01b815260040160206040518083038186803b1580156113d957600080fd5b505afa1580156113ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cc9190611914565b336000908152600e602052604090205461142a906105a7565b611432610cb0565b565b60006114408284611947565b9392505050565b6000611440828461195e565b6000611440828461197d565b6000611440828461199f565b6000546001600160a01b031633146114325760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084016105ca565b6040516001600160a01b03831660248201526044810182905261154090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611599565b505050565b60008183106115545781611440565b5090919050565b6040516001600160a01b03808516602483015283166044820152606481018290526115939085906323b872dd60e01b90608401611509565b50505050565b60006115ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661166b9092919063ffffffff16565b805190915015611540578080602001905181019061160c91906118d9565b6115405760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105ca565b606061167a8484600085611682565b949350505050565b6060824710156116e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105ca565b843b6117315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ca565b600080866001600160a01b0316858760405161174d91906119e3565b60006040518083038185875af1925050503d806000811461178a576040519150601f19603f3d011682016040523d82523d6000602084013e61178f565b606091505b509150915061179f8282866117aa565b979650505050505050565b606083156117b9575081611440565b8251156117c95782518084602001fd5b8160405162461bcd60e51b81526004016105ca91906119ff565b80356001600160a01b03811681146117fa57600080fd5b919050565b60006020828403121561181157600080fd5b611440826117e3565b60006020828403121561182c57600080fd5b5035919050565b60ff8116811461184257600080fd5b50565b60006020828403121561185757600080fd5b813561144081611833565b6000806040838503121561187557600080fd5b61187e836117e3565b946020939093013593505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156118eb57600080fd5b8151801515811461144057600080fd5b60006020828403121561190d57600080fd5b5051919050565b60006020828403121561192657600080fd5b815161144081611833565b634e487b7160e01b600052601160045260246000fd5b60008282101561195957611959611931565b500390565b600081600019048311821515161561197857611978611931565b500290565b60008261199a57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156119b2576119b2611931565b500190565b60005b838110156119d25781810151838201526020016119ba565b838111156115935750506000910152565b600082516119f58184602087016119b7565b9190910192915050565b6020815260008251806020840152611a1e8160408501602087016119b7565b601f01601f1916919091016040019291505056fea264697066735822122008644aa5f391312b4ab31fb2f7a04b98f4449e177751bb06236098dab156bcf464736f6c63430008090033