Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 25 from a total of 370 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Deposit | 12639112 | 1721 days ago | IN | 0 ETH | 0.00159851 | ||||
| Withdraw | 12510419 | 1741 days ago | IN | 0 ETH | 0.0068276 | ||||
| Withdraw | 12367880 | 1763 days ago | IN | 0 ETH | 0.00993441 | ||||
| Withdraw | 12367858 | 1763 days ago | IN | 0 ETH | 0.0071522 | ||||
| Withdraw | 11849426 | 1843 days ago | IN | 0 ETH | 0.04448324 | ||||
| Withdraw | 11848694 | 1843 days ago | IN | 0 ETH | 0.01760038 | ||||
| Withdraw | 11848051 | 1843 days ago | IN | 0 ETH | 0.05161196 | ||||
| Withdraw | 11844010 | 1844 days ago | IN | 0 ETH | 0.05582548 | ||||
| Deposit | 11843573 | 1844 days ago | IN | 0 ETH | 0.03441973 | ||||
| Deposit | 11842585 | 1844 days ago | IN | 0 ETH | 0.02573997 | ||||
| Withdraw | 11708949 | 1865 days ago | IN | 0 ETH | 0.0104635 | ||||
| Withdraw | 11708949 | 1865 days ago | IN | 0 ETH | 0.01115885 | ||||
| Withdraw | 11708949 | 1865 days ago | IN | 0 ETH | 0.00981717 | ||||
| Withdraw | 11708949 | 1865 days ago | IN | 0 ETH | 0.01084399 | ||||
| Withdraw | 11708949 | 1865 days ago | IN | 0 ETH | 0.01084482 | ||||
| Withdraw | 11708949 | 1865 days ago | IN | 0 ETH | 0.01921107 | ||||
| Withdraw | 11708948 | 1865 days ago | IN | 0 ETH | 0.01596834 | ||||
| Withdraw | 11708905 | 1865 days ago | IN | 0 ETH | 0.01625349 | ||||
| Withdraw | 11708898 | 1865 days ago | IN | 0 ETH | 0.01625144 | ||||
| Withdraw | 11528615 | 1892 days ago | IN | 0 ETH | 0.00618345 | ||||
| Withdraw | 11528614 | 1892 days ago | IN | 0 ETH | 0.00676798 | ||||
| Deposit | 11527497 | 1893 days ago | IN | 0 ETH | 0.00658604 | ||||
| Withdraw | 11480298 | 1900 days ago | IN | 0 ETH | 0.00443973 | ||||
| Deposit With Ref... | 11402177 | 1912 days ago | IN | 0 ETH | 0.0030217 | ||||
| Withdraw | 11399539 | 1912 days ago | IN | 0 ETH | 0.00250769 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
HeadFarmer
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2020-10-15
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.6.12;
//
/**
* @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);
}
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @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) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @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 sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @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) {
// 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 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts 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) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts 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) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts 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 mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/**
* @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) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
//
/**
* @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 SafeMath for uint256;
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'
// solhint-disable-next-line max-line-length
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).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_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
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
//
/**
* @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 {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => 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(Set storage set, bytes32 value) private 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(Set storage set, bytes32 value) private 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.
bytes32 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(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private 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(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @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) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @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) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @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) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @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(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @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(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @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(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
//
/*
* @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 GSN 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 payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @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.
*/
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 () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view 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 {
emit OwnershipTransferred(_owner, address(0));
_owner = 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");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
// YieldXToken with Governance.
contract YieldXToken is ERC20("YieldXToken", "YieldX"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (HeadFarmer).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @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, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @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,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "YieldX::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "YieldX::delegateBySig: invalid nonce");
require(now <= expiry, "YieldX::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "YieldX::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying YieldXs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "YieldX::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
abstract contract RewardsDistributionRecipient {
address public rewardsDistribution;
function notifyRewardAmount(uint256 reward) external virtual;
modifier onlyRewardsDistribution() {
require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract");
_;
}
}
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the `nonReentrant` modifier
* available, which can be aplied 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.
*/
contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
constructor () internal {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
}
/**
* @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() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
}
}
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMathUniswap {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
contract StakingRewards is 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 = 60 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;
/* ========== CONSTRUCTOR ========== */
constructor(
address _rewardsDistribution,
address _rewardsToken,
address _stakingToken
) public {
rewardsToken = IERC20(_rewardsToken);
stakingToken = IERC20(_stakingToken);
rewardsDistribution = _rewardsDistribution;
}
/* ========== VIEWS ========== */
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
}
function rewardPerToken() public view 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 returns (uint256) {
return _balances[account].mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]);
}
function getRewardForDuration() external view returns (uint256) {
return rewardRate.mul(rewardsDuration);
}
/* ========== MUTATIVE FUNCTIONS ========== */
function stakeWithPermit(uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external nonReentrant updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
_totalSupply = _totalSupply.add(amount);
_balances[msg.sender] = _balances[msg.sender].add(amount);
// permit
IUniswapV2ERC20(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
}
function stake(uint256 amount) external 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);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender) {
require(amount > 0, "Cannot withdraw 0");
_totalSupply = _totalSupply.sub(amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
stakingToken.safeTransfer(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}
function getReward() public 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 {
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.
uint 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);
}
/* ========== 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);
}
contract StakingRewardsFactory is Ownable {
// immutables
address public rewardsToken;
uint public stakingRewardsGenesis;
// the staking tokens for which the rewards contract has been deployed
address[] public stakingTokens;
// info about rewards for a particular staking token
struct StakingRewardsInfo {
address stakingRewards;
uint rewardAmount;
}
// rewards info by staking token
mapping(address => StakingRewardsInfo) public stakingRewardsInfoByStakingToken;
constructor(
address _rewardsToken,
uint _stakingRewardsGenesis
) Ownable() public {
require(_stakingRewardsGenesis >= block.timestamp, 'StakingRewardsFactory::constructor: genesis too soon');
rewardsToken = _rewardsToken;
stakingRewardsGenesis = _stakingRewardsGenesis;
}
///// permissioned functions
// deploy a staking reward contract for the staking token, and store the reward amount
// the reward will be distributed to the staking reward contract no sooner than the genesis
function deploy(address stakingToken, uint rewardAmount) public onlyOwner {
StakingRewardsInfo storage info = stakingRewardsInfoByStakingToken[stakingToken];
require(info.stakingRewards == address(0), 'StakingRewardsFactory::deploy: already deployed');
info.stakingRewards = address(new StakingRewards(/*_rewardsDistribution=*/ address(this), rewardsToken, stakingToken));
info.rewardAmount = rewardAmount;
stakingTokens.push(stakingToken);
}
///// permissionless functions
// call notifyRewardAmount for all staking tokens.
function notifyRewardAmounts() public {
require(stakingTokens.length > 0, 'StakingRewardsFactory::notifyRewardAmounts: called before any deploys');
for (uint i = 0; i < stakingTokens.length; i++) {
notifyRewardAmount(stakingTokens[i]);
}
}
// notify reward amount for an individual staking token.
// this is a fallback in case the notifyRewardAmounts costs too much gas to call for all contracts
function notifyRewardAmount(address stakingToken) public {
require(block.timestamp >= stakingRewardsGenesis, 'StakingRewardsFactory::notifyRewardAmount: not ready');
StakingRewardsInfo storage info = stakingRewardsInfoByStakingToken[stakingToken];
require(info.stakingRewards != address(0), 'StakingRewardsFactory::notifyRewardAmount: not deployed');
if (info.rewardAmount > 0) {
uint rewardAmount = info.rewardAmount;
info.rewardAmount = 0;
require(
IERC20(rewardsToken).transfer(info.stakingRewards, rewardAmount),
'StakingRewardsFactory::notifyRewardAmount: transfer failed'
);
StakingRewards(info.stakingRewards).notifyRewardAmount(rewardAmount);
}
}
}
interface IMigratorHead {
// Perform LP token migration from legacy UniswapV2 to HubrisOne X.
// Take the current LP token address and return the new LP token address.
// Migrator should have full access to the caller's LP token.
// Return the new LP token address.
//
// XXX Migrator must have allowance access to UniswapV2 LP tokens.
// HubrisOne X must mint EXACTLY the same amount of HubrisOne X LP tokens or
// else something bad will happen. Traditional UniswapV2 does not
// do that so be careful!
function migrate(IERC20 token) external returns (IERC20);
}
// HeadFarmer is the head of YieldX. He can make YieldX and he is a fair guy.
//
// Note that it's ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once YieldX is sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully it's bug-free. God bless.
contract HeadFarmer is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some fancy math here. Basically, any point in time, the amount of YieldXs
// entitled to a user but is pending to be distributed is:
//
// pending reward = (user.amount * pool.accYieldXPerShare) - user.rewardDebt
//
// Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
// 1. The pool's `accYieldXPerShare` (and `lastRewardBlock`) gets updated.
// 2. User receives the pending reward sent to his/her address.
// 3. User's `amount` gets updated.
// 4. User's `rewardDebt` gets updated.
uint256 userRewardPerTokenPaid;
}
// Info of each pool.
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. YieldXs to distribute per block.
uint256 lastRewardBlock; // Last block number that YieldXs distribution occurs.
uint256 accYieldXPerShare; // Accumulated YieldXs per share, times 1e12. See below.
uint256 lastUpdateTime;
uint256 rewardPerTokenStored;
}
// The YieldX TOKEN!
YieldXToken public yieldx;
// Dev address.
address public devaddr;
// Bar address.
address public baraddr;
// YieldX tokens created per block.
uint256 public constant YIELDX_PER_BLOCK = 1e18;
// The migrator contract. It has a lot of power. Can only be set through governance (owner).
IMigratorHead public migrator;
StakingRewardsFactory public stakingRewardsFactory;
// Referral
mapping (address => string) public addressToReferralCode;
mapping (string => address) public referralCodeToAddress;
mapping (address => address) public addressToRefereeAddress;
mapping (address => uint256) public addressToNumReferrals;
mapping (address => uint256) public addressToNumYieldXViaReferral;
// Info of each pool.
PoolInfo[] public poolInfo;
// Info of each user that stakes LP tokens.
mapping (uint256 => mapping (address => UserInfo)) public userInfo;
// Total allocation poitns. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint = 0;
// The block number when YieldX mining starts.
//The block range for calculating YieldX Bonus
uint256[7] public BLOCK_BOUNDRY = [uint256(11050000), 11320000, 13660000, 16000000, 18340000, 20680000, 23020000];
// Bonus muliplier for each block range.
uint256[6] public BONUS_MULTIPLIERS = [uint256(150),13,7,4,2,1];
// Initial Dev Fund
uint256 public initialDevFund;
uint256 public constant INITIAL_DEV_VESTING_NUM_INSTALMENTS = 36;
uint256 public constant INITIAL_DEV_VESTING_START_BLOCK = 11905000;
uint256 public constant INITIAL_DEV_VESTING_PERIOD_LENGTH = 195000;
mapping (uint256 => uint256) public claimedDevFund;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
YieldXToken _yieldx,
address _devaddr,
address _baraddr,
StakingRewardsFactory _stakingRewardsFactory
) public {
yieldx = _yieldx;
devaddr = _devaddr;
baraddr = _baraddr;
stakingRewardsFactory = _stakingRewardsFactory;
}
function min(uint256 x, uint256 y) internal pure returns (uint256) {
return x < y ? x : y;
}
function max(uint256 x, uint256 y) internal pure returns (uint256) {
return x > y ? x : y;
}
function sub(uint256 x, uint256 y) internal pure returns (uint256) {
return x > y ? x - y : 0;
}
function poolLength() external view returns (uint256) {
return poolInfo.length;
}
// Set the migrator contract. Can only be called by the owner.
function setYear5BlockBoundary(uint256 _year5BlockBoundary) public onlyOwner {
BLOCK_BOUNDRY[6] = _year5BlockBoundary;
}
// Add a new lp to the pool. Can only be called by the owner.
// XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = max(block.number, BLOCK_BOUNDRY[0]);
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poolInfo.push(PoolInfo({
lpToken: _lpToken,
allocPoint: _allocPoint,
lastRewardBlock: lastRewardBlock,
accYieldXPerShare: 0,
lastUpdateTime: 0,
rewardPerTokenStored: 0
}));
}
// Update the given pool's YieldX allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
}
// Set the migrator contract. Can only be called by the owner.
function setMigrator(IMigratorHead _migrator) public onlyOwner {
migrator = _migrator;
}
// Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
(address stakingRewardsAddress, ) = stakingRewardsFactory.stakingRewardsInfoByStakingToken(address(pool.lpToken));
updatePool(_pid);
if (stakingRewardsAddress != address(0)) {
StakingRewards stakingRewards = StakingRewards(stakingRewardsAddress);
uint256 tokensStaked = stakingRewards.balanceOf(address(this));
if (tokensStaked > 0) {
stakingRewards.withdraw(tokensStaked);
}
}
IERC20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
IERC20 newLpToken = migrator.migrate(lpToken);
require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");
pool.lpToken = newLpToken;
}
// Return reward multiplier over the given _from to _to block after initial period.
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
uint256 multiplier = 0;
for (uint256 x = 2; x < BLOCK_BOUNDRY.length; ++x) {
multiplier = multiplier.add(sub(min(_to, BLOCK_BOUNDRY[x]), max(_from, BLOCK_BOUNDRY[x-1])).mul(BONUS_MULTIPLIERS[x-1]));
}
return multiplier;
}
// Return reward multiplier over the given _from to _to block in the initial period.
function getMultiplierForInitialPeriod(uint256 _from, uint256 _to) public view returns (uint256) {
return sub(min(_to, BLOCK_BOUNDRY[1]), max(_from, BLOCK_BOUNDRY[0])).mul(BONUS_MULTIPLIERS[0]);
}
// View function to see pending YieldXs on frontend.
function pendingYieldX(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
(address stakingRewardsAddress, ) = stakingRewardsFactory.stakingRewardsInfoByStakingToken(address(pool.lpToken));
UserInfo storage user = userInfo[_pid][_user];
uint256 accYieldXPerShare = pool.accYieldXPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (stakingRewardsAddress != address(0)) {
StakingRewards stakingRewards = StakingRewards(stakingRewardsAddress);
lpSupply = lpSupply.add(stakingRewards.balanceOf(address(this)));
}
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplierForInitialPeriod = getMultiplierForInitialPeriod(pool.lastRewardBlock, block.number);
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
multiplier = multiplier.add(multiplierForInitialPeriod);
uint256 yieldxReward = multiplier.mul(YIELDX_PER_BLOCK).mul(pool.allocPoint).div(totalAllocPoint);
accYieldXPerShare = accYieldXPerShare.add(yieldxReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accYieldXPerShare).div(1e12).sub(user.rewardDebt);
}
// View function to see if extra reward is there for this pool.
function hasExtraReward(uint256 _pid) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
(address stakingRewardsAddress, ) = stakingRewardsFactory.stakingRewardsInfoByStakingToken(address(pool.lpToken));
if (stakingRewardsAddress != address(0)) {
return 1;
}
return 0;
}
// View function to see pending reward on frontend.
function pendingReward(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
(address stakingRewardsAddress, ) = stakingRewardsFactory.stakingRewardsInfoByStakingToken(address(pool.lpToken));
UserInfo storage user = userInfo[_pid][_user];
if (stakingRewardsAddress != address(0)) {
StakingRewards stakingRewards = StakingRewards(stakingRewardsAddress);
uint256 rewardPerTokenStored = pool.rewardPerTokenStored;
uint256 tokensStaked = stakingRewards.balanceOf(address(this));
if (tokensStaked > 0) {
uint256 reward = stakingRewards.earned(address(this));
uint256 rewardPerToken = reward.mul(1e12).div(tokensStaked);
rewardPerTokenStored = rewardPerTokenStored.add(rewardPerToken);
}
uint256 userRewardPerToken = rewardPerTokenStored.sub(user.userRewardPerTokenPaid);
uint256 userReward = userRewardPerToken.mul(user.amount).div(1e12);
return userReward;
}
return 0;
}
// Update reward variables for all pools. Be careful of gas spending!
function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
(address stakingRewardsAddress, ) = stakingRewardsFactory.stakingRewardsInfoByStakingToken(address(pool.lpToken));
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (stakingRewardsAddress != address(0)) {
StakingRewards stakingRewards = StakingRewards(stakingRewardsAddress);
lpSupply = lpSupply.add(stakingRewards.balanceOf(address(this)));
}
if (lpSupply > 0) {
uint256 multiplierForInitialPeriod = getMultiplierForInitialPeriod(pool.lastRewardBlock, block.number);
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
if (multiplierForInitialPeriod > 0) {
uint256 yieldxReward;
yieldxReward = multiplierForInitialPeriod.mul(YIELDX_PER_BLOCK).mul(pool.allocPoint).div(totalAllocPoint);
yieldx.mint(address(this), yieldxReward);
yieldx.mint(baraddr, yieldxReward.div(10));
initialDevFund += yieldxReward.div(10);
pool.accYieldXPerShare = pool.accYieldXPerShare.add(yieldxReward.mul(1e12).div(lpSupply));
}
if (multiplier > 0) {
uint256 yieldxReward;
yieldxReward = multiplier.mul(YIELDX_PER_BLOCK).mul(pool.allocPoint).div(totalAllocPoint);
yieldx.mint(address(this), yieldxReward);
yieldx.mint(baraddr, yieldxReward.div(10));
yieldx.mint(devaddr, yieldxReward.div(10));
pool.accYieldXPerShare = pool.accYieldXPerShare.add(yieldxReward.mul(1e12).div(lpSupply));
}
}
if (stakingRewardsAddress != address(0)) {
StakingRewards stakingRewards = StakingRewards(stakingRewardsAddress);
uint256 tokensStaked = stakingRewards.balanceOf(address(this));
if (tokensStaked > 0) {
uint256 rewardsTokenBalanceBefore = stakingRewards.rewardsToken().balanceOf(address(this));
stakingRewards.getReward();
uint256 rewardsTokenBalanceAfter = stakingRewards.rewardsToken().balanceOf(address(this));
uint256 reward = rewardsTokenBalanceAfter.sub(rewardsTokenBalanceBefore);
uint256 rewardPerToken = reward.mul(1e12).div(tokensStaked);
pool.rewardPerTokenStored = pool.rewardPerTokenStored.add(rewardPerToken);
}
uint256 userRewardPerToken = pool.rewardPerTokenStored.sub(user.userRewardPerTokenPaid);
uint256 userReward = userRewardPerToken.mul(user.amount).div(1e12);
if (userReward > 0) {
stakingRewards.rewardsToken().safeTransfer(msg.sender, userReward);
}
user.userRewardPerTokenPaid = pool.rewardPerTokenStored;
}
pool.lastRewardBlock = block.number;
}
function claimDevFund(uint256 period) public {
require(period < INITIAL_DEV_VESTING_NUM_INSTALMENTS, "period out of range");
uint256 periodEndBlock = INITIAL_DEV_VESTING_START_BLOCK + INITIAL_DEV_VESTING_PERIOD_LENGTH * (period + 1);
require(periodEndBlock <= block.number, "cannot claim for this period right now");
uint256 initialDevFundPerPeriod = initialDevFund.div(INITIAL_DEV_VESTING_NUM_INSTALMENTS);
require(claimedDevFund[period] < initialDevFundPerPeriod, "already claimed for this period");
uint256 claimableDevFund = initialDevFundPerPeriod.sub(claimedDevFund[period]);
claimedDevFund[period] = initialDevFundPerPeriod;
yieldx.mint(devaddr, claimableDevFund);
}
// Deposit with referral code.
function depositWithReferralCode(uint256 _pid, uint256 _amount, string calldata _referralCode, string calldata _refereeCode) external {
if (bytes(_refereeCode).length != 0) {
address refereeAddress = referralCodeToAddress[_refereeCode];
require (refereeAddress != address(0), "invalid referral code");
addressToRefereeAddress[msg.sender] = refereeAddress;
addressToNumReferrals[refereeAddress] = addressToNumReferrals[refereeAddress].add(1);
}
require (bytes(_referralCode).length != 0, "referral code cannot be blank");
require (bytes(addressToReferralCode[msg.sender]).length == 0, "referral code already generated");
require (referralCodeToAddress[_referralCode] == address(0), "referral code already used");
referralCodeToAddress[_referralCode] = msg.sender;
addressToReferralCode[msg.sender] = _referralCode;
deposit(_pid, _amount);
}
// Deposit LP tokens to HeadFarmer for YieldX allocation.
function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
(address stakingRewardsAddress, ) = stakingRewardsFactory.stakingRewardsInfoByStakingToken(address(pool.lpToken));
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accYieldXPerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeYieldXTransfer(msg.sender, pending);
}
}
if(_amount > 0) {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
if (stakingRewardsAddress != address(0)) {
StakingRewards stakingRewards = StakingRewards(stakingRewardsAddress);
pool.lpToken.safeApprove(stakingRewardsAddress, _amount);
stakingRewards.stake(_amount);
}
}
user.rewardDebt = user.amount.mul(pool.accYieldXPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
// Withdraw LP tokens from HeadFarmer.
function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
(address stakingRewardsAddress, ) = stakingRewardsFactory.stakingRewardsInfoByStakingToken(address(pool.lpToken));
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accYieldXPerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeYieldXTransfer(msg.sender, pending);
}
if(_amount > 0) {
user.amount = user.amount.sub(_amount);
if (stakingRewardsAddress != address(0)) {
StakingRewards stakingRewards = StakingRewards(stakingRewardsAddress);
stakingRewards.withdraw(_amount);
}
pool.lpToken.safeTransfer(address(msg.sender), _amount);
}
user.rewardDebt = user.amount.mul(pool.accYieldXPerShare).div(1e12);
emit Withdraw(msg.sender, _pid, _amount);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, _pid, user.amount);
user.amount = 0;
user.rewardDebt = 0;
}
// Safe yieldx transfer function, just in case if rounding error causes pool to not have enough YieldXs.
function safeYieldXTransfer(address _to, uint256 _amount) internal {
_amount = min(_amount, yieldx.balanceOf(address(this)));
yieldx.transfer(_to, _amount);
address refereeAddress = addressToRefereeAddress[_to];
if (refereeAddress != address(0)) {
uint256 refereeReward = _amount.div(10);
yieldx.mint(refereeAddress, refereeReward);
addressToNumYieldXViaReferral[refereeAddress] = addressToNumYieldXViaReferral[refereeAddress].add(refereeReward);
}
}
// Update dev address by the previous dev.
function dev(address _devaddr) public {
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract YieldXToken","name":"_yieldx","type":"address"},{"internalType":"address","name":"_devaddr","type":"address"},{"internalType":"address","name":"_baraddr","type":"address"},{"internalType":"contract StakingRewardsFactory","name":"_stakingRewardsFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"BLOCK_BOUNDRY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"BONUS_MULTIPLIERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_DEV_VESTING_NUM_INSTALMENTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_DEV_VESTING_PERIOD_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_DEV_VESTING_START_BLOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YIELDX_PER_BLOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressToNumReferrals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressToNumYieldXViaReferral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressToRefereeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressToReferralCode","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baraddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"claimDevFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimedDevFund","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_referralCode","type":"string"},{"internalType":"string","name":"_refereeCode","type":"string"}],"name":"depositWithReferralCode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_devaddr","type":"address"}],"name":"dev","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devaddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplierForInitialPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"hasExtraReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialDevFund","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"migrator","outputs":[{"internalType":"contract IMigratorHead","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingYieldX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accYieldXPerShare","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenStored","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"referralCodeToAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMigratorHead","name":"_migrator","type":"address"}],"name":"setMigrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_year5BlockBoundary","type":"uint256"}],"name":"setYear5BlockBoundary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingRewardsFactory","outputs":[{"internalType":"contract StakingRewardsFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"userRewardPerTokenPaid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yieldx","outputs":[{"internalType":"contract YieldXToken","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6000600d5561016060405262a89c10608090815262acbac060a05262d06f6060c05262f4240060e052630117d8a06101005263013b8d406101205263015f41e0610140526200005390600e90600762000192565b506040518060c0016040528060968152602001600d81526020016007815260200160048152602001600281526020016001815250601590600662000099929190620001d5565b50348015620000a757600080fd5b50604051620039643803806200396483398181016040526080811015620000cd57600080fd5b50805160208201516040830151606090930151919290916000620000f06200018e565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b039586166001600160a01b03199182161790915560028054948616948216949094179093556003805492851692841692909217909155600580549190931691161790556200021c565b3390565b8260078101928215620001c3579160200282015b82811115620001c3578251825591602001919060010190620001a6565b50620001d192915062000205565b5090565b8260068101928215620001c35791602002820182811115620001c3578251825591602001919060010190620001a6565b5b80821115620001d1576000815560010162000206565b613738806200022c6000396000f3fe608060405234801561001057600080fd5b50600436106102695760003560e01c806364482f79116101515780639b6d8089116100c3578063d49e77cd11610087578063d49e77cd146107ee578063d6f92372146107f6578063dbe9d7981461089c578063e2bbb158146108a4578063f2fde38b146108c7578063fe40d989146108ed57610269565b80639b6d8089146106ee578063a2417e821461070b578063b81c8b7114610728578063b868e7a114610730578063ce8d92eb146107cb57610269565b80638da5cb5b116101155780638da5cb5b146106285780638dbb1e3a14610630578063907602101461065357806393f1a40b1461065b57806395af608d146106a557806398969e82146106c257610269565b806364482f79146105bf5780636856cf6d146105ea578063715018a6146105f25780637cd07e47146105fa5780638d88a90e1461060257610269565b806323cf3118116101ea5780634940e96e116101ae5780634940e96e1461052357806351eb05a6146105495780635312ea8e1461056657806355b396d214610583578063630b5ba11461058b57806363290fc21461059357610269565b806323cf31181461048357806332f69ac2146104a9578063422176f9146104c6578063441a3e70146104e3578063454b06081461050657610269565b80630c554bef116102315780630c554bef146103bf57806314f38ed1146103c75780631526fe27146103ed57806317caf6f1146104475780631eaaa0451461044f57610269565b806303ab6edd1461026e578063081e3eda1461028d57806308479c9b146102a7578063090bc260146103755780630be9b7f81461037d575b600080fd5b61028b6004803603602081101561028457600080fd5b50356108f5565b005b610295610aa1565b60408051918252519081900360200190f35b61028b600480360360808110156102bd57600080fd5b8135916020810135918101906060810160408201356401000000008111156102e457600080fd5b8201836020820111156102f657600080fd5b8035906020019184600183028401116401000000008311171561031857600080fd5b91939092909160208101903564010000000081111561033657600080fd5b82018360208201111561034857600080fd5b8035906020019184600183028401116401000000008311171561036a57600080fd5b509092509050610aa7565b610295610d53565b6103a36004803603602081101561039357600080fd5b50356001600160a01b0316610d59565b604080516001600160a01b039092168252519081900360200190f35b610295610d74565b610295600480360360208110156103dd57600080fd5b50356001600160a01b0316610d80565b61040a6004803603602081101561040357600080fd5b5035610d92565b604080516001600160a01b0390971687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b610295610ddf565b61028b6004803603606081101561046557600080fd5b508035906001600160a01b0360208201351690604001351515610de5565b61028b6004803603602081101561049957600080fd5b50356001600160a01b0316610fb7565b610295600480360360208110156104bf57600080fd5b5035611031565b610295600480360360208110156104dc57600080fd5b5035611043565b61028b600480360360408110156104f957600080fd5b5080359060200135611057565b61028b6004803603602081101561051c57600080fd5b50356112a8565b6102956004803603602081101561053957600080fd5b50356001600160a01b0316611692565b61028b6004803603602081101561055f57600080fd5b50356116a4565b61028b6004803603602081101561057c57600080fd5b5035611f82565b6103a361201d565b61028b61202c565b610295600480360360408110156105a957600080fd5b50803590602001356001600160a01b031661204f565b61028b600480360360608110156105d557600080fd5b508035906020810135906040013515156122ae565b61029561237f565b61028b612384565b6103a3612426565b61028b6004803603602081101561061857600080fd5b50356001600160a01b0316612435565b6103a36124a2565b6102956004803603604081101561064657600080fd5b50803590602001356124b1565b610295612525565b6106876004803603604081101561067157600080fd5b50803590602001356001600160a01b031661252c565b60408051938452602084019290925282820152519081900360600190f35b610295600480360360208110156106bb57600080fd5b5035612558565b610295600480360360408110156106d857600080fd5b50803590602001356001600160a01b0316612618565b6102956004803603602081101561070457600080fd5b503561285d565b61028b6004803603602081101561072157600080fd5b503561286a565b6102956128c7565b6107566004803603602081101561074657600080fd5b50356001600160a01b03166128ce565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610790578181015183820152602001610778565b50505050905090810190601f1680156107bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610295600480360360408110156107e157600080fd5b5080359060200135612969565b6103a3612997565b6103a36004803603602081101561080c57600080fd5b81019060208101813564010000000081111561082757600080fd5b82018360208201111561083957600080fd5b8035906020019184600183028401116401000000008311171561085b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506129a6945050505050565b6103a36129cc565b61028b600480360360408110156108ba57600080fd5b50803590602001356129db565b61028b600480360360208110156108dd57600080fd5b50356001600160a01b0316612bf0565b6103a3612ce8565b60248110610940576040805162461bcd60e51b8152602060048201526013602482015272706572696f64206f7574206f662072616e676560681b604482015290519081900360640190fd5b62b5a7e86202f9b86001830102014381111561098d5760405162461bcd60e51b81526004018080602001828103825260268152602001806136166026913960400191505060405180910390fd5b601b5460009061099e906024612cf7565b6000848152601c60205260409020549091508111610a03576040805162461bcd60e51b815260206004820152601f60248201527f616c726561647920636c61696d656420666f72207468697320706572696f6400604482015290519081900360640190fd5b6000838152601c6020526040812054610a1d908390612d39565b6000858152601c602052604080822085905560015460025482516340c10f1960e01b81526001600160a01b03918216600482015260248101869052925194955016926340c10f199260448084019391929182900301818387803b158015610a8357600080fd5b505af1158015610a97573d6000803e3d6000fd5b5050505050505050565b600b5490565b8015610b89576000600783836040518083838082843791909101948552505060405192839003602001909220546001600160a01b03169250505080610b2b576040805162461bcd60e51b8152602060048201526015602482015274696e76616c696420726566657272616c20636f646560581b604482015290519081900360640190fd5b33600090815260086020908152604080832080546001600160a01b0319166001600160a01b03861690811790915583526009909152902054610b6e906001612d7b565b6001600160a01b039091166000908152600960205260409020555b82610bdb576040805162461bcd60e51b815260206004820152601d60248201527f726566657272616c20636f64652063616e6e6f7420626520626c616e6b000000604482015290519081900360640190fd5b336000908152600660205260409020546002600019610100600184161502019091160415610c50576040805162461bcd60e51b815260206004820152601f60248201527f726566657272616c20636f646520616c72656164792067656e65726174656400604482015290519081900360640190fd5b60006001600160a01b0316600785856040518083838082843791909101948552505060405192839003602001909220546001600160a01b0316929092149150610ce29050576040805162461bcd60e51b815260206004820152601a60248201527f726566657272616c20636f646520616c72656164792075736564000000000000604482015290519081900360640190fd5b336007858560405180838380828437919091019485525050604080516020948190038501902080546001600160a01b0319166001600160a01b0396909616959095179094555050336000908152600690915220610d40908585613582565b50610d4b86866129db565b505050505050565b601b5481565b6008602052600090815260409020546001600160a01b031681565b670de0b6b3a764000081565b60096020526000908152604090205481565b600b8181548110610d9f57fe5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160a01b0390941695509193909286565b600d5481565b610ded612dd5565b6000546001600160a01b03908116911614610e3d576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b8015610e4b57610e4b61202c565b6000610e5c43600e835b0154612dd9565b600d54909150610e6c9085612d7b565b600d556040805160c0810182526001600160a01b039485168152602081019586529081019182526000606082018181526080830182815260a08401838152600b8054600181018255945293517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9600690940293840180546001600160a01b031916919098161790965595517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba82015591517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbb83015593517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbc82015591517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbd8301555090517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbe90910155565b610fbf612dd5565b6000546001600160a01b0390811691161461100f576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b601c6020526000908152604090205481565b600e816007811061105057fe5b0154905081565b6000600b838154811061106657fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b1580156110c257600080fd5b505afa1580156110d6573d6000803e3d6000fd5b505050506040513d60408110156110ec57600080fd5b50516000858152600c602090815260408083203384529091529020805491925090841115611156576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b61115f856116a4565b6000611199826001015461119364e8d4a5100061118d88600301548760000154612def90919063ffffffff16565b90612cf7565b90612d39565b905080156111ab576111ab3382612e48565b84156112495781546111bd9086612d39565b82556001600160a01b03831615611233576000839050806001600160a01b0316632e1a7d4d876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561121957600080fd5b505af115801561122d573d6000803e3d6000fd5b50505050505b8354611249906001600160a01b0316338761302e565b600384015482546112649164e8d4a510009161118d91612def565b6001830155604080518681529051879133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a3505050505050565b6004546001600160a01b03166112fc576040805162461bcd60e51b815260206004820152601460248201527336b4b3b930ba329d1037379036b4b3b930ba37b960611b604482015290519081900360640190fd5b6000600b828154811061130b57fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b15801561136757600080fd5b505afa15801561137b573d6000803e3d6000fd5b505050506040513d604081101561139157600080fd5b5051905061139e836116a4565b6001600160a01b0381161561148e57604080516370a0823160e01b8152306004820152905182916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156113f857600080fd5b505afa15801561140c573d6000803e3d6000fd5b505050506040513d602081101561142257600080fd5b50519050801561148b57816001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050505b50505b8154604080516370a0823160e01b815230600482015290516001600160a01b039092169160009183916370a0823191602480820192602092909190829003018186803b1580156114dd57600080fd5b505afa1580156114f1573d6000803e3d6000fd5b505050506040513d602081101561150757600080fd5b5051600454909150611526906001600160a01b03848116911683613080565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663ce5494bb846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b15801561158c57600080fd5b505af11580156115a0573d6000803e3d6000fd5b505050506040513d60208110156115b657600080fd5b5051604080516370a0823160e01b815230600482015290519192506001600160a01b038316916370a0823191602480820192602092909190829003018186803b15801561160257600080fd5b505afa158015611616573d6000803e3d6000fd5b505050506040513d602081101561162c57600080fd5b50518214611670576040805162461bcd60e51b815260206004820152600c60248201526b1b5a59dc985d194e8818985960a21b604482015290519081900360640190fd5b84546001600160a01b0319166001600160a01b03919091161790935550505050565b600a6020526000908152604090205481565b6000600b82815481106116b357fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d604081101561173957600080fd5b50516000848152600c602090815260408083203384528252808320865482516370a0823160e01b8152306004820152925195965090946001600160a01b03909116926370a082319260248082019391829003018186803b15801561179c57600080fd5b505afa1580156117b0573d6000803e3d6000fd5b505050506040513d60208110156117c657600080fd5b505190506001600160a01b0383161561185c57604080516370a0823160e01b815230600482015290518491611858916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561182557600080fd5b505afa158015611839573d6000803e3d6000fd5b505050506040513d602081101561184f57600080fd5b50518390612d7b565b9150505b8015611bbe576000611872856002015443612969565b905060006118848660020154436124b1565b905081156119f25760006118bd600d5461118d89600101546118b7670de0b6b3a764000088612def90919063ffffffff16565b90612def565b600154604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b15801561191357600080fd5b505af1158015611927573d6000803e3d6000fd5b50506001546003546001600160a01b0391821693506340c10f1992501661194f84600a612cf7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561199557600080fd5b505af11580156119a9573d6000803e3d6000fd5b505050506119c1600a82612cf790919063ffffffff16565b601b805490910190556119eb6119e08561118d8464e8d4a51000612def565b600389015490612d7b565b6003880155505b8015611bbb576000611a23600d5461118d89600101546118b7670de0b6b3a764000087612def90919063ffffffff16565b600154604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b158015611a7957600080fd5b505af1158015611a8d573d6000803e3d6000fd5b50506001546003546001600160a01b0391821693506340c10f19925016611ab584600a612cf7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611afb57600080fd5b505af1158015611b0f573d6000803e3d6000fd5b50506001546002546001600160a01b0391821693506340c10f19925016611b3784600a612cf7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611b7d57600080fd5b505af1158015611b91573d6000803e3d6000fd5b50505050611bb46119e08561118d64e8d4a5100085612def90919063ffffffff16565b6003880155505b50505b6001600160a01b03831615611f7257604080516370a0823160e01b8152306004820152905184916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b158015611c1857600080fd5b505afa158015611c2c573d6000803e3d6000fd5b505050506040513d6020811015611c4257600080fd5b505190508015611ea0576000826001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c8757600080fd5b505afa158015611c9b573d6000803e3d6000fd5b505050506040513d6020811015611cb157600080fd5b5051604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611cfb57600080fd5b505afa158015611d0f573d6000803e3d6000fd5b505050506040513d6020811015611d2557600080fd5b505160408051631e8c5c8960e11b815290519192506001600160a01b03851691633d18b9129160048082019260009290919082900301818387803b158015611d6c57600080fd5b505af1158015611d80573d6000803e3d6000fd5b505050506000836001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611dbf57600080fd5b505afa158015611dd3573d6000803e3d6000fd5b505050506040513d6020811015611de957600080fd5b5051604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611e3357600080fd5b505afa158015611e47573d6000803e3d6000fd5b505050506040513d6020811015611e5d57600080fd5b505190506000611e6d8284612d39565b90506000611e848561118d8464e8d4a51000612def565b60058b0154909150611e969082612d7b565b60058b0155505050505b6000611ebd85600201548860050154612d3990919063ffffffff16565b90506000611ee164e8d4a5100061118d886000015485612def90919063ffffffff16565b90508015611f6357611f633382866001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611f2757600080fd5b505afa158015611f3b573d6000803e3d6000fd5b505050506040513d6020811015611f5157600080fd5b50516001600160a01b0316919061302e565b50505060058501546002840155505b4384600201819055505050505050565b6000600b8281548110611f9157fe5b60009182526020808320858452600c82526040808520338087529352909320805460069093029093018054909450611fd6926001600160a01b0391909116919061302e565b80546040805191825251849133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a360008082556001909101555050565b6005546001600160a01b031681565b600b5460005b8181101561204b57612043816116a4565b600101612032565b5050565b600080600b848154811061205f57fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b1580156120bb57600080fd5b505afa1580156120cf573d6000803e3d6000fd5b505050506040513d60408110156120e557600080fd5b50516000868152600c602090815260408083206001600160a01b03808a1685529083528184206003880154885484516370a0823160e01b81523060048201529451979850919690959491909216926370a082319260248083019392829003018186803b15801561215457600080fd5b505afa158015612168573d6000803e3d6000fd5b505050506040513d602081101561217e57600080fd5b505190506001600160a01b038416156121e157604080516370a0823160e01b8152306004820152905185916121dd916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561182557600080fd5b9150505b8460020154431180156121f357508015155b15612278576000612208866002015443612969565b9050600061221a8760020154436124b1565b90506122268183612d7b565b90506000612253600d5461118d8a600101546118b7670de0b6b3a764000087612def90919063ffffffff16565b905061227261226b8561118d8464e8d4a51000612def565b8690612d7b565b94505050505b6122a0836001015461119364e8d4a5100061118d868860000154612def90919063ffffffff16565b955050505050505b92915050565b6122b6612dd5565b6000546001600160a01b03908116911614612306576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b80156123145761231461202c565b6123518261234b600b868154811061232857fe5b906000526020600020906006020160010154600d54612d3990919063ffffffff16565b90612d7b565b600d8190555081600b848154811061236557fe5b906000526020600020906006020160010181905550505050565b602481565b61238c612dd5565b6000546001600160a01b039081169116146123dc576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6004546001600160a01b031681565b6002546001600160a01b03163314612480576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b60008060025b600781101561251d5761251361250c601560018403600681106124d657fe5b01546118b76124f388600e87600781106124ec57fe5b0154613193565b6125078a600e6001890360078110610e5557fe5b6131a2565b8390612d7b565b91506001016124b7565b509392505050565b6202f9b881565b600c60209081526000928352604080842090915290825290208054600182015460029092015490919083565b600080600b838154811061256857fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b1580156125c457600080fd5b505afa1580156125d8573d6000803e3d6000fd5b505050506040513d60408110156125ee57600080fd5b505190506001600160a01b0381161561260c57600192505050612613565b6000925050505b919050565b600080600b848154811061262857fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b15801561268457600080fd5b505afa158015612698573d6000803e3d6000fd5b505050506040513d60408110156126ae57600080fd5b50516000868152600c602090815260408083206001600160a01b03808a1685529252909120919250821615612851576005830154604080516370a0823160e01b815230600482015290518492916000916001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561272e57600080fd5b505afa158015612742573d6000803e3d6000fd5b505050506040513d602081101561275857600080fd5b505190508015612804576000836001600160a01b0316628cc262306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156127b057600080fd5b505afa1580156127c4573d6000803e3d6000fd5b505050506040513d60208110156127da57600080fd5b5051905060006127f38361118d8464e8d4a51000612def565b90506127ff8482612d7b565b935050505b600061281d856002015484612d3990919063ffffffff16565b9050600061284164e8d4a5100061118d886000015485612def90919063ffffffff16565b98506122a8975050505050505050565b50600095945050505050565b6015816006811061105057fe5b612872612dd5565b6000546001600160a01b039081169116146128c2576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b601455565b62b5a7e881565b60066020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156129615780601f1061293657610100808354040283529160200191612961565b820191906000526020600020905b81548152906001019060200180831161294457829003601f168201915b505050505081565b600061299060158201546118b761298385600e60016124ec565b61250787600e6000610e55565b9392505050565b6002546001600160a01b031681565b80516020818301810180516007825292820191909301209152546001600160a01b031681565b6003546001600160a01b031681565b6000600b83815481106129ea57fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b158015612a4657600080fd5b505afa158015612a5a573d6000803e3d6000fd5b505050506040513d6040811015612a7057600080fd5b50516000858152600c602090815260408083203384529091529020909150612a97856116a4565b805415612ae0576000612acc826001015461119364e8d4a5100061118d88600301548760000154612def90919063ffffffff16565b90508015612ade57612ade3382612e48565b505b8315612b92578254612afd906001600160a01b03163330876131b8565b8054612b099085612d7b565b81556001600160a01b03821615612b925782548290612b32906001600160a01b03168287613080565b806001600160a01b031663a694fc3a866040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612b7857600080fd5b505af1158015612b8c573d6000803e3d6000fd5b50505050505b60038301548154612bad9164e8d4a510009161118d91612def565b6001820155604080518581529051869133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a35050505050565b612bf8612dd5565b6000546001600160a01b03908116911614612c48576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b6001600160a01b038116612c8d5760405162461bcd60e51b815260040180806020018281038252602681526020018061363c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031681565b600061299083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613218565b600061299083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506132ba565b600082820183811015612990576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b6000818311612de85781612990565b5090919050565b600082612dfe575060006122a8565b82820282848281612e0b57fe5b04146129905760405162461bcd60e51b81526004018080602001828103825260218152602001806136626021913960400191505060405180910390fd5b600154604080516370a0823160e01b81523060048201529051612eca9284926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015612e9957600080fd5b505afa158015612ead573d6000803e3d6000fd5b505050506040513d6020811015612ec357600080fd5b5051613193565b6001546040805163a9059cbb60e01b81526001600160a01b03868116600483015260248201859052915193945091169163a9059cbb916044808201926020929091908290030181600087803b158015612f2257600080fd5b505af1158015612f36573d6000803e3d6000fd5b505050506040513d6020811015612f4c57600080fd5b50506001600160a01b03808316600090815260086020526040902054168015613029576000612f7c83600a612cf7565b600154604080516340c10f1960e01b81526001600160a01b0386811660048301526024820185905291519394509116916340c10f199160448082019260009290919082900301818387803b158015612fd357600080fd5b505af1158015612fe7573d6000803e3d6000fd5b5050506001600160a01b0383166000908152600a602052604090205461300e915082612d7b565b6001600160a01b0383166000908152600a6020526040902055505b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613029908490613314565b801580613106575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156130d857600080fd5b505afa1580156130ec573d6000803e3d6000fd5b505050506040513d602081101561310257600080fd5b5051155b6131415760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052613029908490613314565b6000818310612de85781612990565b60008183116131b2576000612990565b50900390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052613212908590613314565b50505050565b600081836132a45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613269578181015183820152602001613251565b50505050905090810190601f1680156132965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816132b057fe5b0495945050505050565b6000818484111561330c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613269578181015183820152602001613251565b505050900390565b6060613369826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133c59092919063ffffffff16565b8051909150156130295780806020019051602081101561338857600080fd5b50516130295760405162461bcd60e51b815260040180806020018281038252602a8152602001806136a3602a913960400191505060405180910390fd5b60606133d484846000856133dc565b949350505050565b60606133e785613549565b613438576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106134775780518252601f199092019160209182019101613458565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146134d9576040519150601f19603f3d011682016040523d82523d6000602084013e6134de565b606091505b509150915081156134f25791506133d49050565b8051156135025780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315613269578181015183820152602001613251565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906133d4575050151592915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106135c35782800160ff198235161785556135f0565b828001600101855582156135f0579182015b828111156135f05782358255916020019190600101906135d5565b506135fc929150613600565b5090565b5b808211156135fc576000815560010161360156fe63616e6e6f7420636c61696d20666f72207468697320706572696f64207269676874206e6f774f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220d562eb8b2a6ac4ced4b14f2062eddc030565afc3de869bac8fdcb043d80ec01664736f6c634300060c00330000000000000000000000002075ab08d7c74eee8776b3726661c2b55413d72100000000000000000000000023561bef1f52e579317d4479ff2661ef80e5b3c4000000000000000000000000ee9e2fdf7ad581cf1035e9b188638fadad190d6d0000000000000000000000003032ab3fa8c01d786d29dade018d7f2017918e12
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102695760003560e01c806364482f79116101515780639b6d8089116100c3578063d49e77cd11610087578063d49e77cd146107ee578063d6f92372146107f6578063dbe9d7981461089c578063e2bbb158146108a4578063f2fde38b146108c7578063fe40d989146108ed57610269565b80639b6d8089146106ee578063a2417e821461070b578063b81c8b7114610728578063b868e7a114610730578063ce8d92eb146107cb57610269565b80638da5cb5b116101155780638da5cb5b146106285780638dbb1e3a14610630578063907602101461065357806393f1a40b1461065b57806395af608d146106a557806398969e82146106c257610269565b806364482f79146105bf5780636856cf6d146105ea578063715018a6146105f25780637cd07e47146105fa5780638d88a90e1461060257610269565b806323cf3118116101ea5780634940e96e116101ae5780634940e96e1461052357806351eb05a6146105495780635312ea8e1461056657806355b396d214610583578063630b5ba11461058b57806363290fc21461059357610269565b806323cf31181461048357806332f69ac2146104a9578063422176f9146104c6578063441a3e70146104e3578063454b06081461050657610269565b80630c554bef116102315780630c554bef146103bf57806314f38ed1146103c75780631526fe27146103ed57806317caf6f1146104475780631eaaa0451461044f57610269565b806303ab6edd1461026e578063081e3eda1461028d57806308479c9b146102a7578063090bc260146103755780630be9b7f81461037d575b600080fd5b61028b6004803603602081101561028457600080fd5b50356108f5565b005b610295610aa1565b60408051918252519081900360200190f35b61028b600480360360808110156102bd57600080fd5b8135916020810135918101906060810160408201356401000000008111156102e457600080fd5b8201836020820111156102f657600080fd5b8035906020019184600183028401116401000000008311171561031857600080fd5b91939092909160208101903564010000000081111561033657600080fd5b82018360208201111561034857600080fd5b8035906020019184600183028401116401000000008311171561036a57600080fd5b509092509050610aa7565b610295610d53565b6103a36004803603602081101561039357600080fd5b50356001600160a01b0316610d59565b604080516001600160a01b039092168252519081900360200190f35b610295610d74565b610295600480360360208110156103dd57600080fd5b50356001600160a01b0316610d80565b61040a6004803603602081101561040357600080fd5b5035610d92565b604080516001600160a01b0390971687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b610295610ddf565b61028b6004803603606081101561046557600080fd5b508035906001600160a01b0360208201351690604001351515610de5565b61028b6004803603602081101561049957600080fd5b50356001600160a01b0316610fb7565b610295600480360360208110156104bf57600080fd5b5035611031565b610295600480360360208110156104dc57600080fd5b5035611043565b61028b600480360360408110156104f957600080fd5b5080359060200135611057565b61028b6004803603602081101561051c57600080fd5b50356112a8565b6102956004803603602081101561053957600080fd5b50356001600160a01b0316611692565b61028b6004803603602081101561055f57600080fd5b50356116a4565b61028b6004803603602081101561057c57600080fd5b5035611f82565b6103a361201d565b61028b61202c565b610295600480360360408110156105a957600080fd5b50803590602001356001600160a01b031661204f565b61028b600480360360608110156105d557600080fd5b508035906020810135906040013515156122ae565b61029561237f565b61028b612384565b6103a3612426565b61028b6004803603602081101561061857600080fd5b50356001600160a01b0316612435565b6103a36124a2565b6102956004803603604081101561064657600080fd5b50803590602001356124b1565b610295612525565b6106876004803603604081101561067157600080fd5b50803590602001356001600160a01b031661252c565b60408051938452602084019290925282820152519081900360600190f35b610295600480360360208110156106bb57600080fd5b5035612558565b610295600480360360408110156106d857600080fd5b50803590602001356001600160a01b0316612618565b6102956004803603602081101561070457600080fd5b503561285d565b61028b6004803603602081101561072157600080fd5b503561286a565b6102956128c7565b6107566004803603602081101561074657600080fd5b50356001600160a01b03166128ce565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610790578181015183820152602001610778565b50505050905090810190601f1680156107bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610295600480360360408110156107e157600080fd5b5080359060200135612969565b6103a3612997565b6103a36004803603602081101561080c57600080fd5b81019060208101813564010000000081111561082757600080fd5b82018360208201111561083957600080fd5b8035906020019184600183028401116401000000008311171561085b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506129a6945050505050565b6103a36129cc565b61028b600480360360408110156108ba57600080fd5b50803590602001356129db565b61028b600480360360208110156108dd57600080fd5b50356001600160a01b0316612bf0565b6103a3612ce8565b60248110610940576040805162461bcd60e51b8152602060048201526013602482015272706572696f64206f7574206f662072616e676560681b604482015290519081900360640190fd5b62b5a7e86202f9b86001830102014381111561098d5760405162461bcd60e51b81526004018080602001828103825260268152602001806136166026913960400191505060405180910390fd5b601b5460009061099e906024612cf7565b6000848152601c60205260409020549091508111610a03576040805162461bcd60e51b815260206004820152601f60248201527f616c726561647920636c61696d656420666f72207468697320706572696f6400604482015290519081900360640190fd5b6000838152601c6020526040812054610a1d908390612d39565b6000858152601c602052604080822085905560015460025482516340c10f1960e01b81526001600160a01b03918216600482015260248101869052925194955016926340c10f199260448084019391929182900301818387803b158015610a8357600080fd5b505af1158015610a97573d6000803e3d6000fd5b5050505050505050565b600b5490565b8015610b89576000600783836040518083838082843791909101948552505060405192839003602001909220546001600160a01b03169250505080610b2b576040805162461bcd60e51b8152602060048201526015602482015274696e76616c696420726566657272616c20636f646560581b604482015290519081900360640190fd5b33600090815260086020908152604080832080546001600160a01b0319166001600160a01b03861690811790915583526009909152902054610b6e906001612d7b565b6001600160a01b039091166000908152600960205260409020555b82610bdb576040805162461bcd60e51b815260206004820152601d60248201527f726566657272616c20636f64652063616e6e6f7420626520626c616e6b000000604482015290519081900360640190fd5b336000908152600660205260409020546002600019610100600184161502019091160415610c50576040805162461bcd60e51b815260206004820152601f60248201527f726566657272616c20636f646520616c72656164792067656e65726174656400604482015290519081900360640190fd5b60006001600160a01b0316600785856040518083838082843791909101948552505060405192839003602001909220546001600160a01b0316929092149150610ce29050576040805162461bcd60e51b815260206004820152601a60248201527f726566657272616c20636f646520616c72656164792075736564000000000000604482015290519081900360640190fd5b336007858560405180838380828437919091019485525050604080516020948190038501902080546001600160a01b0319166001600160a01b0396909616959095179094555050336000908152600690915220610d40908585613582565b50610d4b86866129db565b505050505050565b601b5481565b6008602052600090815260409020546001600160a01b031681565b670de0b6b3a764000081565b60096020526000908152604090205481565b600b8181548110610d9f57fe5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160a01b0390941695509193909286565b600d5481565b610ded612dd5565b6000546001600160a01b03908116911614610e3d576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b8015610e4b57610e4b61202c565b6000610e5c43600e835b0154612dd9565b600d54909150610e6c9085612d7b565b600d556040805160c0810182526001600160a01b039485168152602081019586529081019182526000606082018181526080830182815260a08401838152600b8054600181018255945293517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9600690940293840180546001600160a01b031916919098161790965595517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba82015591517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbb83015593517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbc82015591517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbd8301555090517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbe90910155565b610fbf612dd5565b6000546001600160a01b0390811691161461100f576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b601c6020526000908152604090205481565b600e816007811061105057fe5b0154905081565b6000600b838154811061106657fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b1580156110c257600080fd5b505afa1580156110d6573d6000803e3d6000fd5b505050506040513d60408110156110ec57600080fd5b50516000858152600c602090815260408083203384529091529020805491925090841115611156576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b61115f856116a4565b6000611199826001015461119364e8d4a5100061118d88600301548760000154612def90919063ffffffff16565b90612cf7565b90612d39565b905080156111ab576111ab3382612e48565b84156112495781546111bd9086612d39565b82556001600160a01b03831615611233576000839050806001600160a01b0316632e1a7d4d876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561121957600080fd5b505af115801561122d573d6000803e3d6000fd5b50505050505b8354611249906001600160a01b0316338761302e565b600384015482546112649164e8d4a510009161118d91612def565b6001830155604080518681529051879133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a3505050505050565b6004546001600160a01b03166112fc576040805162461bcd60e51b815260206004820152601460248201527336b4b3b930ba329d1037379036b4b3b930ba37b960611b604482015290519081900360640190fd5b6000600b828154811061130b57fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b15801561136757600080fd5b505afa15801561137b573d6000803e3d6000fd5b505050506040513d604081101561139157600080fd5b5051905061139e836116a4565b6001600160a01b0381161561148e57604080516370a0823160e01b8152306004820152905182916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156113f857600080fd5b505afa15801561140c573d6000803e3d6000fd5b505050506040513d602081101561142257600080fd5b50519050801561148b57816001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050505b50505b8154604080516370a0823160e01b815230600482015290516001600160a01b039092169160009183916370a0823191602480820192602092909190829003018186803b1580156114dd57600080fd5b505afa1580156114f1573d6000803e3d6000fd5b505050506040513d602081101561150757600080fd5b5051600454909150611526906001600160a01b03848116911683613080565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663ce5494bb846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b15801561158c57600080fd5b505af11580156115a0573d6000803e3d6000fd5b505050506040513d60208110156115b657600080fd5b5051604080516370a0823160e01b815230600482015290519192506001600160a01b038316916370a0823191602480820192602092909190829003018186803b15801561160257600080fd5b505afa158015611616573d6000803e3d6000fd5b505050506040513d602081101561162c57600080fd5b50518214611670576040805162461bcd60e51b815260206004820152600c60248201526b1b5a59dc985d194e8818985960a21b604482015290519081900360640190fd5b84546001600160a01b0319166001600160a01b03919091161790935550505050565b600a6020526000908152604090205481565b6000600b82815481106116b357fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d604081101561173957600080fd5b50516000848152600c602090815260408083203384528252808320865482516370a0823160e01b8152306004820152925195965090946001600160a01b03909116926370a082319260248082019391829003018186803b15801561179c57600080fd5b505afa1580156117b0573d6000803e3d6000fd5b505050506040513d60208110156117c657600080fd5b505190506001600160a01b0383161561185c57604080516370a0823160e01b815230600482015290518491611858916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561182557600080fd5b505afa158015611839573d6000803e3d6000fd5b505050506040513d602081101561184f57600080fd5b50518390612d7b565b9150505b8015611bbe576000611872856002015443612969565b905060006118848660020154436124b1565b905081156119f25760006118bd600d5461118d89600101546118b7670de0b6b3a764000088612def90919063ffffffff16565b90612def565b600154604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b15801561191357600080fd5b505af1158015611927573d6000803e3d6000fd5b50506001546003546001600160a01b0391821693506340c10f1992501661194f84600a612cf7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561199557600080fd5b505af11580156119a9573d6000803e3d6000fd5b505050506119c1600a82612cf790919063ffffffff16565b601b805490910190556119eb6119e08561118d8464e8d4a51000612def565b600389015490612d7b565b6003880155505b8015611bbb576000611a23600d5461118d89600101546118b7670de0b6b3a764000087612def90919063ffffffff16565b600154604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b158015611a7957600080fd5b505af1158015611a8d573d6000803e3d6000fd5b50506001546003546001600160a01b0391821693506340c10f19925016611ab584600a612cf7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611afb57600080fd5b505af1158015611b0f573d6000803e3d6000fd5b50506001546002546001600160a01b0391821693506340c10f19925016611b3784600a612cf7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611b7d57600080fd5b505af1158015611b91573d6000803e3d6000fd5b50505050611bb46119e08561118d64e8d4a5100085612def90919063ffffffff16565b6003880155505b50505b6001600160a01b03831615611f7257604080516370a0823160e01b8152306004820152905184916000916001600160a01b038416916370a08231916024808301926020929190829003018186803b158015611c1857600080fd5b505afa158015611c2c573d6000803e3d6000fd5b505050506040513d6020811015611c4257600080fd5b505190508015611ea0576000826001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c8757600080fd5b505afa158015611c9b573d6000803e3d6000fd5b505050506040513d6020811015611cb157600080fd5b5051604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611cfb57600080fd5b505afa158015611d0f573d6000803e3d6000fd5b505050506040513d6020811015611d2557600080fd5b505160408051631e8c5c8960e11b815290519192506001600160a01b03851691633d18b9129160048082019260009290919082900301818387803b158015611d6c57600080fd5b505af1158015611d80573d6000803e3d6000fd5b505050506000836001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611dbf57600080fd5b505afa158015611dd3573d6000803e3d6000fd5b505050506040513d6020811015611de957600080fd5b5051604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611e3357600080fd5b505afa158015611e47573d6000803e3d6000fd5b505050506040513d6020811015611e5d57600080fd5b505190506000611e6d8284612d39565b90506000611e848561118d8464e8d4a51000612def565b60058b0154909150611e969082612d7b565b60058b0155505050505b6000611ebd85600201548860050154612d3990919063ffffffff16565b90506000611ee164e8d4a5100061118d886000015485612def90919063ffffffff16565b90508015611f6357611f633382866001600160a01b031663d1af0c7d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611f2757600080fd5b505afa158015611f3b573d6000803e3d6000fd5b505050506040513d6020811015611f5157600080fd5b50516001600160a01b0316919061302e565b50505060058501546002840155505b4384600201819055505050505050565b6000600b8281548110611f9157fe5b60009182526020808320858452600c82526040808520338087529352909320805460069093029093018054909450611fd6926001600160a01b0391909116919061302e565b80546040805191825251849133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a360008082556001909101555050565b6005546001600160a01b031681565b600b5460005b8181101561204b57612043816116a4565b600101612032565b5050565b600080600b848154811061205f57fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b1580156120bb57600080fd5b505afa1580156120cf573d6000803e3d6000fd5b505050506040513d60408110156120e557600080fd5b50516000868152600c602090815260408083206001600160a01b03808a1685529083528184206003880154885484516370a0823160e01b81523060048201529451979850919690959491909216926370a082319260248083019392829003018186803b15801561215457600080fd5b505afa158015612168573d6000803e3d6000fd5b505050506040513d602081101561217e57600080fd5b505190506001600160a01b038416156121e157604080516370a0823160e01b8152306004820152905185916121dd916001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561182557600080fd5b9150505b8460020154431180156121f357508015155b15612278576000612208866002015443612969565b9050600061221a8760020154436124b1565b90506122268183612d7b565b90506000612253600d5461118d8a600101546118b7670de0b6b3a764000087612def90919063ffffffff16565b905061227261226b8561118d8464e8d4a51000612def565b8690612d7b565b94505050505b6122a0836001015461119364e8d4a5100061118d868860000154612def90919063ffffffff16565b955050505050505b92915050565b6122b6612dd5565b6000546001600160a01b03908116911614612306576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b80156123145761231461202c565b6123518261234b600b868154811061232857fe5b906000526020600020906006020160010154600d54612d3990919063ffffffff16565b90612d7b565b600d8190555081600b848154811061236557fe5b906000526020600020906006020160010181905550505050565b602481565b61238c612dd5565b6000546001600160a01b039081169116146123dc576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6004546001600160a01b031681565b6002546001600160a01b03163314612480576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b60008060025b600781101561251d5761251361250c601560018403600681106124d657fe5b01546118b76124f388600e87600781106124ec57fe5b0154613193565b6125078a600e6001890360078110610e5557fe5b6131a2565b8390612d7b565b91506001016124b7565b509392505050565b6202f9b881565b600c60209081526000928352604080842090915290825290208054600182015460029092015490919083565b600080600b838154811061256857fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b1580156125c457600080fd5b505afa1580156125d8573d6000803e3d6000fd5b505050506040513d60408110156125ee57600080fd5b505190506001600160a01b0381161561260c57600192505050612613565b6000925050505b919050565b600080600b848154811061262857fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b15801561268457600080fd5b505afa158015612698573d6000803e3d6000fd5b505050506040513d60408110156126ae57600080fd5b50516000868152600c602090815260408083206001600160a01b03808a1685529252909120919250821615612851576005830154604080516370a0823160e01b815230600482015290518492916000916001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561272e57600080fd5b505afa158015612742573d6000803e3d6000fd5b505050506040513d602081101561275857600080fd5b505190508015612804576000836001600160a01b0316628cc262306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156127b057600080fd5b505afa1580156127c4573d6000803e3d6000fd5b505050506040513d60208110156127da57600080fd5b5051905060006127f38361118d8464e8d4a51000612def565b90506127ff8482612d7b565b935050505b600061281d856002015484612d3990919063ffffffff16565b9050600061284164e8d4a5100061118d886000015485612def90919063ffffffff16565b98506122a8975050505050505050565b50600095945050505050565b6015816006811061105057fe5b612872612dd5565b6000546001600160a01b039081169116146128c2576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b601455565b62b5a7e881565b60066020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156129615780601f1061293657610100808354040283529160200191612961565b820191906000526020600020905b81548152906001019060200180831161294457829003601f168201915b505050505081565b600061299060158201546118b761298385600e60016124ec565b61250787600e6000610e55565b9392505050565b6002546001600160a01b031681565b80516020818301810180516007825292820191909301209152546001600160a01b031681565b6003546001600160a01b031681565b6000600b83815481106129ea57fe5b600091825260208220600554600690920201805460408051630d9f195f60e31b81526001600160a01b03928316600482015281519396509190931692636cf8caf892602480840193829003018186803b158015612a4657600080fd5b505afa158015612a5a573d6000803e3d6000fd5b505050506040513d6040811015612a7057600080fd5b50516000858152600c602090815260408083203384529091529020909150612a97856116a4565b805415612ae0576000612acc826001015461119364e8d4a5100061118d88600301548760000154612def90919063ffffffff16565b90508015612ade57612ade3382612e48565b505b8315612b92578254612afd906001600160a01b03163330876131b8565b8054612b099085612d7b565b81556001600160a01b03821615612b925782548290612b32906001600160a01b03168287613080565b806001600160a01b031663a694fc3a866040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612b7857600080fd5b505af1158015612b8c573d6000803e3d6000fd5b50505050505b60038301548154612bad9164e8d4a510009161118d91612def565b6001820155604080518581529051869133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a35050505050565b612bf8612dd5565b6000546001600160a01b03908116911614612c48576040805162461bcd60e51b81526020600482018190526024820152600080516020613683833981519152604482015290519081900360640190fd5b6001600160a01b038116612c8d5760405162461bcd60e51b815260040180806020018281038252602681526020018061363c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031681565b600061299083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613218565b600061299083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506132ba565b600082820183811015612990576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b6000818311612de85781612990565b5090919050565b600082612dfe575060006122a8565b82820282848281612e0b57fe5b04146129905760405162461bcd60e51b81526004018080602001828103825260218152602001806136626021913960400191505060405180910390fd5b600154604080516370a0823160e01b81523060048201529051612eca9284926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015612e9957600080fd5b505afa158015612ead573d6000803e3d6000fd5b505050506040513d6020811015612ec357600080fd5b5051613193565b6001546040805163a9059cbb60e01b81526001600160a01b03868116600483015260248201859052915193945091169163a9059cbb916044808201926020929091908290030181600087803b158015612f2257600080fd5b505af1158015612f36573d6000803e3d6000fd5b505050506040513d6020811015612f4c57600080fd5b50506001600160a01b03808316600090815260086020526040902054168015613029576000612f7c83600a612cf7565b600154604080516340c10f1960e01b81526001600160a01b0386811660048301526024820185905291519394509116916340c10f199160448082019260009290919082900301818387803b158015612fd357600080fd5b505af1158015612fe7573d6000803e3d6000fd5b5050506001600160a01b0383166000908152600a602052604090205461300e915082612d7b565b6001600160a01b0383166000908152600a6020526040902055505b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613029908490613314565b801580613106575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156130d857600080fd5b505afa1580156130ec573d6000803e3d6000fd5b505050506040513d602081101561310257600080fd5b5051155b6131415760405162461bcd60e51b81526004018080602001828103825260368152602001806136cd6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052613029908490613314565b6000818310612de85781612990565b60008183116131b2576000612990565b50900390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052613212908590613314565b50505050565b600081836132a45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613269578181015183820152602001613251565b50505050905090810190601f1680156132965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816132b057fe5b0495945050505050565b6000818484111561330c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613269578181015183820152602001613251565b505050900390565b6060613369826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133c59092919063ffffffff16565b8051909150156130295780806020019051602081101561338857600080fd5b50516130295760405162461bcd60e51b815260040180806020018281038252602a8152602001806136a3602a913960400191505060405180910390fd5b60606133d484846000856133dc565b949350505050565b60606133e785613549565b613438576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106134775780518252601f199092019160209182019101613458565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146134d9576040519150601f19603f3d011682016040523d82523d6000602084013e6134de565b606091505b509150915081156134f25791506133d49050565b8051156135025780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315613269578181015183820152602001613251565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906133d4575050151592915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106135c35782800160ff198235161785556135f0565b828001600101855582156135f0579182015b828111156135f05782358255916020019190600101906135d5565b506135fc929150613600565b5090565b5b808211156135fc576000815560010161360156fe63616e6e6f7420636c61696d20666f72207468697320706572696f64207269676874206e6f774f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220d562eb8b2a6ac4ced4b14f2062eddc030565afc3de869bac8fdcb043d80ec01664736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002075ab08d7c74eee8776b3726661c2b55413d72100000000000000000000000023561bef1f52e579317d4479ff2661ef80e5b3c4000000000000000000000000ee9e2fdf7ad581cf1035e9b188638fadad190d6d0000000000000000000000003032ab3fa8c01d786d29dade018d7f2017918e12
-----Decoded View---------------
Arg [0] : _yieldx (address): 0x2075ab08D7C74EEE8776b3726661C2B55413D721
Arg [1] : _devaddr (address): 0x23561bEF1f52e579317d4479fF2661ef80e5B3C4
Arg [2] : _baraddr (address): 0xEe9e2FdF7AD581cF1035E9B188638fAdAd190D6d
Arg [3] : _stakingRewardsFactory (address): 0x3032Ab3Fa8C01d786D29dAdE018d7f2017918e12
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000002075ab08d7c74eee8776b3726661c2b55413d721
Arg [1] : 00000000000000000000000023561bef1f52e579317d4479ff2661ef80e5b3c4
Arg [2] : 000000000000000000000000ee9e2fdf7ad581cf1035e9b188638fadad190d6d
Arg [3] : 0000000000000000000000003032ab3fa8c01d786d29dade018d7f2017918e12
Loading...
Loading
Loading...
Loading
Net Worth in USD
$19.90
Net Worth in ETH
0.010131
Token Allocations
YIELDX
100.00%
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $0.00 | 6,891,670.057 | $0.00 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.