Contract Address Details

0x118EAa52519aC8E022f1587D4ec0EF1f7c2246e0

Contract Name
StrategyJoeAvaxJoeLp
Creator
0xc9a51f–32c0a2 at 0xd3e16f–3a28c5
Balance
0 AVAX
Tokens
Fetching tokens...
Transactions
Transfers
Gas Used
Last Balance Update
5807940
Contract name:
StrategyJoeAvaxJoeLp




Optimization enabled
true
Compiler version
v0.6.7+commit.b8d736ae




Optimization runs
200
EVM Version
default




Verified at
2021-07-08 05:58:11.990348Z

Constructor Arguments

000000000000000000000000294ab3200ef36200db84c4128b7f1b4eec71e38a000000000000000000000000c9a51fb9057380494262fd291aed74317332c0a2000000000000000000000000f7b8d9f8a82a7a6dd448398afc5c77744bd6cb85000000000000000000000000c9a51fb9057380494262fd291aed74317332c0a2

Arg [0] (address) : 0x294ab3200ef36200db84c4128b7f1b4eec71e38a
Arg [1] (address) : 0xc9a51fb9057380494262fd291aed74317332c0a2
Arg [2] (address) : 0xf7b8d9f8a82a7a6dd448398afc5c77744bd6cb85
Arg [3] (address) : 0xc9a51fb9057380494262fd291aed74317332c0a2

              

Contract source code

// File: contracts/lib/safe-math.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @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;
}
}
// File: contracts/lib/context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with 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;
}
}
// File: contracts/lib/erc20.sol
// File: contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
// File: contracts/token/ERC20/IERC20.sol
/**
* @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);
}
// File: contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// 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);
}
}
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @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 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 { }
}
/**
* @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");
}
}
}
// File: contracts/interfaces/globe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
interface IGlobe is IERC20 {
function token() external view returns (address);
function claimInsurance() external; // NOTE: Only yDelegatedVault implements this
function getRatio() external view returns (uint256);
function depositAll() external;
function deposit(uint256) external;
function withdrawAll() external;
function withdraw(uint256) external;
function earn() external;
function decimals() external view returns (uint8);
}
// File: contracts/interfaces/staking-rewards.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
interface IStakingRewards {
function balanceOf(address account) external view returns (uint256);
function earned(address account) external view returns (uint256);
function exit() external;
function getReward() external;
function getRewardForDuration() external view returns (uint256);
function lastTimeRewardApplicable() external view returns (uint256);
function lastUpdateTime() external view returns (uint256);
function notifyRewardAmount(uint256 reward) external;
function periodFinish() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function rewardPerTokenStored() external view returns (uint256);
function rewardRate() external view returns (uint256);
function rewards(address) external view returns (uint256);
function rewardsDistribution() external view returns (address);
function rewardsDuration() external view returns (uint256);
function rewardsToken() external view returns (address);
function stake(uint256 amount) external;
function stakeWithPermit(
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function stakingToken() external view returns (address);
function totalSupply() external view returns (uint256);
function userRewardPerTokenPaid(address) external view returns (uint256);
function withdraw(uint256 amount) external;
}
interface IStakingRewardsFactory {
function deploy(address stakingToken, uint256 rewardAmount) external;
function isOwner() external view returns (bool);
function notifyRewardAmount(address stakingToken) external;
function notifyRewardAmounts() external;
function owner() external view returns (address);
function renounceOwnership() external;
function rewardsToken() external view returns (address);
function stakingRewardsGenesis() external view returns (uint256);
function stakingRewardsInfoByStakingToken(address)
external
view
returns (address stakingRewards, uint256 rewardAmount);
function stakingTokens(uint256) external view returns (address);
function transferOwnership(address newOwner) external;
}
// File: contracts/interfaces/icequeen.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
interface IIcequeen {
function BONUS_MULTIPLIER() external view returns (uint256);
function add(
uint256 _allocPoint,
address _lpToken,
bool _withUpdate
) external;
function bonusEndBlock() external view returns (uint256);
function deposit(uint256 _pid, uint256 _amount) external;
function dev(address _devaddr) external;
function devFundDivRate() external view returns (uint256);
function devaddr() external view returns (address);
function emergencyWithdraw(uint256 _pid) external;
function getMultiplier(uint256 _from, uint256 _to)
external
view
returns (uint256);
function massUpdatePools() external;
function owner() external view returns (address);
function pendingSnowball(uint256 _pid, address _user)
external
view
returns (uint256);
function snowball() external view returns (address);
function snowballPerBlock() external view returns (uint256);
function poolInfo(uint256)
external
view
returns (
address lpToken,
uint256 allocPoint,
uint256 lastRewardBlock,
uint256 accSnowballPerShare
);
function poolLength() external view returns (uint256);
function renounceOwnership() external;
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
) external;
function setBonusEndBlock(uint256 _bonusEndBlock) external;
function setDevFundDivRate(uint256 _devFundDivRate) external;
function setSnowballPerBlock(uint256 _snowballPerBlock) external;
function startBlock() external view returns (uint256);
function totalAllocPoint() external view returns (uint256);
function transferOwnership(address newOwner) external;
function updatePool(uint256 _pid) external;
function userInfo(uint256, address)
external
view
returns (uint256 amount, uint256 rewardDebt);
function withdraw(uint256 _pid, uint256 _amount) external;
}
// File: contracts/interfaces/pangolin.sol
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
interface IPangolinRouter {
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityAVAX(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountAVAXMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountAVAX,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function swapAVAXForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapExactAVAXForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
}
interface IPangolinPair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 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 (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 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 (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
}
interface IPangolinFactory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
// File: contracts/interfaces/controller.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
interface IController {
function globes(address) external view returns (address);
function rewards() external view returns (address);
function devfund() external view returns (address);
function treasury() external view returns (address);
function balanceOf(address) external view returns (uint256);
function withdraw(address, uint256) external;
function earn(address, uint256) external;
}
// File: contracts/strategies/strategy-base.sol
pragma solidity ^0.6.7;
// Strategy Contract Basics
abstract contract StrategyBase {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
// Tokens
address public want;
address public constant wavax = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
// Dex
address public pangolinRouter = 0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106;
// Move ^^
// Perfomance fees - start with 20%
uint256 public performanceTreasuryFee = 2000;
uint256 public constant performanceTreasuryMax = 10000;
uint256 public performanceDevFee = 0;
uint256 public constant performanceDevMax = 10000;
// Withdrawal fee 0%
// - 0% to treasury
// - 0% to dev fund
uint256 public withdrawalTreasuryFee = 0;
uint256 public constant withdrawalTreasuryMax = 100000;
uint256 public withdrawalDevFundFee = 0;
uint256 public constant withdrawalDevFundMax = 100000;
// User accounts
address public governance;
address public controller;
address public strategist;
address public timelock;
mapping(address => bool) public harvesters;
constructor(
address _want,
address _governance,
address _strategist,
address _controller,
address _timelock
) public {
require(_want != address(0));
require(_governance != address(0));
require(_strategist != address(0));
require(_controller != address(0));
require(_timelock != address(0));
want = _want;
governance = _governance;
strategist = _strategist;
controller = _controller;
timelock = _timelock;
}
// **** Modifiers **** //
modifier onlyBenevolent {
require(
harvesters[msg.sender] ||
msg.sender == governance ||
msg.sender == strategist
);
_;
}
// **** Views **** //
function balanceOfWant() public view returns (uint256) {
return IERC20(want).balanceOf(address(this));
}
function balanceOfPool() public virtual view returns (uint256);
function balanceOf() public view returns (uint256) {
return balanceOfWant().add(balanceOfPool());
}
function getName() external virtual pure returns (string memory);
// **** Setters **** //
function whitelistHarvester(address _harvester) external {
require(msg.sender == governance ||
msg.sender == strategist, "not authorized");
harvesters[_harvester] = true;
}
function revokeHarvester(address _harvester) external {
require(msg.sender == governance ||
msg.sender == strategist, "not authorized");
harvesters[_harvester] = false;
}
function setWithdrawalDevFundFee(uint256 _withdrawalDevFundFee) external {
require(msg.sender == timelock, "!timelock");
withdrawalDevFundFee = _withdrawalDevFundFee;
}
function setWithdrawalTreasuryFee(uint256 _withdrawalTreasuryFee) external {
require(msg.sender == timelock, "!timelock");
withdrawalTreasuryFee = _withdrawalTreasuryFee;
}
function setPerformanceDevFee(uint256 _performanceDevFee) external {
require(msg.sender == timelock, "!timelock");
performanceDevFee = _performanceDevFee;
}
function setPerformanceTreasuryFee(uint256 _performanceTreasuryFee)
external
{
require(msg.sender == timelock, "!timelock");
performanceTreasuryFee = _performanceTreasuryFee;
}
function setStrategist(address _strategist) external {
require(msg.sender == governance, "!governance");
strategist = _strategist;
}
function setGovernance(address _governance) external {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setTimelock(address _timelock) external {
require(msg.sender == timelock, "!timelock");
timelock = _timelock;
}
function setController(address _controller) external {
require(msg.sender == timelock, "!timelock");
controller = _controller;
}
// **** State mutations **** //
function deposit() public virtual;
// Controller only function for creating additional rewards from dust
function withdraw(IERC20 _asset) external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
require(want != address(_asset), "want");
balance = _asset.balanceOf(address(this));
_asset.safeTransfer(controller, balance);
}
// Withdraw partial funds, normally used with a globe withdrawal
function withdraw(uint256 _amount) external {
require(msg.sender == controller, "!controller");
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
}
uint256 _feeDev = _amount.mul(withdrawalDevFundFee).div(
withdrawalDevFundMax
);
IERC20(want).safeTransfer(IController(controller).devfund(), _feeDev);
uint256 _feeTreasury = _amount.mul(withdrawalTreasuryFee).div(
withdrawalTreasuryMax
);
IERC20(want).safeTransfer(
IController(controller).treasury(),
_feeTreasury
);
address _globe = IController(controller).globes(address(want));
require(_globe != address(0), "!globe"); // additional protection so we don't burn the funds
IERC20(want).safeTransfer(_globe, _amount.sub(_feeDev).sub(_feeTreasury));
}
// Withdraw funds, used to swap between strategies
function withdrawForSwap(uint256 _amount)
external
returns (uint256 balance)
{
require(msg.sender == controller, "!controller");
_withdrawSome(_amount);
balance = IERC20(want).balanceOf(address(this));
address _globe = IController(controller).globes(address(want));
require(_globe != address(0), "!globe");
IERC20(want).safeTransfer(_globe, balance);
}
// Withdraw all funds, normally used when migrating strategies
function withdrawAll() external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
_withdrawAll();
balance = IERC20(want).balanceOf(address(this));
address _globe = IController(controller).globes(address(want));
require(_globe != address(0), "!globe"); // additional protection so we don't burn the funds
IERC20(want).safeTransfer(_globe, balance);
}
function _withdrawAll() internal {
_withdrawSome(balanceOfPool());
}
function _withdrawSome(uint256 _amount) internal virtual returns (uint256);
function harvest() public virtual;
// **** Emergency functions ****
function execute(address _target, bytes memory _data)
public
payable
returns (bytes memory response)
{
require(msg.sender == timelock, "!timelock");
require(_target != address(0), "!target");
// call contract in current context
assembly {
let succeeded := delegatecall(
sub(gas(), 5000),
_target,
add(_data, 0x20),
mload(_data),
0,
0
)
let size := returndatasize()
response := mload(0x40)
mstore(
0x40,
add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))
)
mstore(response, size)
returndatacopy(add(response, 0x20), 0, size)
switch iszero(succeeded)
case 1 {
// throw if delegatecall failed
revert(add(response, 0x20), size)
}
}
}
// **** Internal functions ****
function _swapPangolin(
address _from,
address _to,
uint256 _amount
) internal {
require(_to != address(0));
address[] memory path;
if (_from == wavax || _to == wavax) {
path = new address[](2);
path[0] = _from;
path[1] = _to;
} else {
path = new address[](3);
path[0] = _from;
path[1] = wavax;
path[2] = _to;
}
IPangolinRouter(pangolinRouter).swapExactTokensForTokens(
_amount,
0,
path,
address(this),
now.add(60)
);
}
function _swapPangolinWithPath(
address[] memory path,
uint256 _amount
) internal {
require(path[1] != address(0));
IPangolinRouter(pangolinRouter).swapExactTokensForTokens(
_amount,
0,
path,
address(this),
now.add(60)
);
}
function _distributePerformanceFeesAndDeposit() internal {
uint256 _want = IERC20(want).balanceOf(address(this));
if (_want > 0) {
// Treasury fees
IERC20(want).safeTransfer(
IController(controller).treasury(),
_want.mul(performanceTreasuryFee).div(performanceTreasuryMax)
);
// Performance fee
IERC20(want).safeTransfer(
IController(controller).devfund(),
_want.mul(performanceDevFee).div(performanceDevMax)
);
deposit();
}
}
}
// File: contracts/interfaces/joe-rewarder.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
// interface for Trader Joe Rewarder contract
interface IJoeRewarder {
using SafeERC20 for IERC20;
function onJoeReward(address user, uint256 newLpAmount) external;
function pendingTokens(address user)
external
view
returns (uint256 pending);
function rewardToken() external view returns (address);
}
// File: contracts/interfaces/masterchefjoev2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
// interface for MasterChefJoeV2 contract
interface IMasterChefJoeV2 {
/* Reads */
function userInfo(uint256, address) external view returns (
uint256 amount,
uint256 rewardDebt
);
function poolInfo(uint256 pid) external view returns (
IERC20 lpToken, // Address of LP token contract.
uint256 allocPoint, // How many allocation points assigned to this poolInfo. SUSHI to distribute per block.
uint256 lastRewardTimestamp, // Last block timestamp that SUSHI distribution occurs.
uint256 accJoePerShare, // Accumulated SUSHI per share, times 1e12. See below.
address rewarder
);
function totalAllocPoint() external view returns (uint256);
function poolLength() external view returns (uint256);
function pendingTokens(uint256 _pid, address _user)
external
view
returns (
uint256 pendingJoe,
address bonusTokenAddress,
string memory bonusTokenSymbol,
uint256 pendingBonusToken
);
/* Writes */
function add(
uint256 _allocPoint,
address _lpToken,
address _rewarder
) external;
function set(
uint256 _pid,
uint256 _allocPoint,
IJoeRewarder _rewarder,
bool overwrite
) external;
function updatePool(uint256 _pid) external;
function deposit(
uint256 _pid,
uint256 _amount
) external;
function withdraw(
uint256 _pid,
uint256 _amount
) external;
}
// File: contracts/interfaces/joe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
interface IJoeRouter {
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityAVAX(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountAVAXMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountAVAX,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactAVAXForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapAVAXForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IJoePair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 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 (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 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 (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
}
interface IJoeFactory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
// File: contracts/strategies/strategy-joe-farm-base.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
abstract contract StrategyJoeFarmBase is StrategyBase {
// Token addresses
address public constant joe = 0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd;
address public constant joeRouter = 0x60aE616a2155Ee3d9A68541Ba4544862310933d4;
address public constant masterChefJoeV2 = 0xd6a4F121CA35509aF06A0Be99093d08462f53052;
uint256 public poolId;
// How much PNG tokens to keep?
uint256 public keepJOE = 0;
uint256 public constant keepJOEMax = 10000;
constructor(
uint256 _poolId,
address _lp,
address _governance,
address _strategist,
address _controller,
address _timelock
)
public
StrategyBase(_lp, _governance, _strategist, _controller, _timelock)
{
poolId = _poolId;
}
function balanceOfPool() public view override returns (uint256) {
(uint256 amount, ) =
IMasterChefJoeV2(masterChefJoeV2).userInfo(poolId, address(this));
return amount;
}
function getHarvestable() external view returns (uint256, uint256) {
(uint256 _pendingTokens, , ,) = IMasterChefJoeV2(masterChefJoeV2).pendingTokens(poolId, address(this));
(,,,,address rewarder) = IMasterChefJoeV2(masterChefJoeV2).poolInfo(poolId);
(uint256 pendingReward) = IJoeRewarder(rewarder).pendingTokens(address(this));
return (_pendingTokens, pendingReward);
}
// **** Setters ****
function deposit() public override {
uint256 _want = IERC20(want).balanceOf(address(this));
if (_want > 0) {
IERC20(want).safeApprove(masterChefJoeV2, 0);
IERC20(want).safeApprove(masterChefJoeV2, _want);
IMasterChefJoeV2(masterChefJoeV2).deposit(poolId, _want);
}
}
function _withdrawSome(uint256 _amount)
internal
override
returns (uint256)
{
IMasterChefJoeV2(masterChefJoeV2).withdraw(poolId, _amount);
return _amount;
}
function _swapTraderJoe(
address _from,
address _to,
uint256 _amount
) internal {
require(_to != address(0));
address[] memory path;
if (_from == wavax || _to == wavax) {
path = new address[](2);
path[0] = _from;
path[1] = _to;
} else {
path = new address[](3);
path[0] = _from;
path[1] = wavax;
path[2] = _to;
}
IJoeRouter(joeRouter).swapExactTokensForTokens(
_amount,
0,
path,
address(this),
now.add(60)
);
}
function _swapTraderJoeWithPath(
address[] memory path,
uint256 _amount
) internal {
require(path[1] != address(0));
IJoeRouter(joeRouter).swapExactTokensForTokens(
_amount,
0,
path,
address(this),
now.add(60)
);
}
}
// File: contracts/strategies/traderJoe/strategy-joe-avax-joe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
contract StrategyJoeAvaxJoeLp is StrategyJoeFarmBase {
uint256 public avax_joe_poolId = 0;
address public joe_avax_joe_lp = 0x454E67025631C065d3cFAD6d71E6892f74487a15;
constructor(
address _governance,
address _strategist,
address _controller,
address _timelock
)
public
StrategyJoeFarmBase(
avax_joe_poolId,
joe_avax_joe_lp,
_governance,
_strategist,
_controller,
_timelock
)
{}
// **** State Mutations ****
function harvest() public override onlyBenevolent {
// Anyone can harvest it at any given time.
// I understand the possibility of being frontrun
// But AVAX is a dark forest, and I wanna see how this plays out
// i.e. will be be heavily frontrunned?
// if so, a new strategy will be deployed.
// Collects Joe tokens
IMasterChefJoeV2(masterChefJoeV2).deposit(poolId, 0);
uint256 _joe = IERC20(joe).balanceOf(address(this));
if (_joe > 0) {
// 10% is sent to treasury
uint256 _keepJOE = _joe.mul(keepJOE).div(keepJOEMax);
IERC20(joe).safeTransfer(
IController(controller).treasury(),
_keepJOE
);
uint256 _amount = _joe.sub(_keepJOE).div(2);
IERC20(joe).safeApprove(joeRouter, 0);
IERC20(joe).safeApprove(joeRouter, _amount);
_swapTraderJoe(joe, wavax, _amount);
}
// Adds in liquidity for AVAX/JOE
uint256 _wavax = IERC20(wavax).balanceOf(address(this));
_joe = IERC20(joe).balanceOf(address(this));
if (_wavax > 0 && _joe > 0) {
IERC20(wavax).safeApprove(joeRouter, 0);
IERC20(wavax).safeApprove(joeRouter, _wavax);
IERC20(joe).safeApprove(joeRouter, 0);
IERC20(joe).safeApprove(joeRouter, _joe);
IJoeRouter(joeRouter).addLiquidity(
wavax,
joe,
_wavax,
_joe,
0,
0,
address(this),
now + 60
);
// Donates DUST
IERC20(wavax).transfer(
IController(controller).treasury(),
IERC20(wavax).balanceOf(address(this))
);
IERC20(joe).safeTransfer(
IController(controller).treasury(),
IERC20(joe).balanceOf(address(this))
);
}
_distributePerformanceFeesAndDeposit();
}
// **** Views ****
function getName() external override pure returns (string memory) {
return "StrategyJoeAvaxJoeLp";
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_governance","internalType":"address"},{"type":"address","name":"_strategist","internalType":"address"},{"type":"address","name":"_controller","internalType":"address"},{"type":"address","name":"_timelock","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"avax_joe_poolId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOfPool","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOfWant","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"controller","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bytes","name":"response","internalType":"bytes"}],"name":"execute","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getHarvestable","inputs":[]},{"type":"function","stateMutability":"pure","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getName","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"governance","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"harvest","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"harvesters","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"joe","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"joeRouter","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"joe_avax_joe_lp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"keepJOE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"keepJOEMax","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"masterChefJoeV2","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pangolinRouter","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"performanceDevFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"performanceDevMax","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"performanceTreasuryFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"performanceTreasuryMax","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"poolId","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeHarvester","inputs":[{"type":"address","name":"_harvester","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setController","inputs":[{"type":"address","name":"_controller","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setGovernance","inputs":[{"type":"address","name":"_governance","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPerformanceDevFee","inputs":[{"type":"uint256","name":"_performanceDevFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPerformanceTreasuryFee","inputs":[{"type":"uint256","name":"_performanceTreasuryFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStrategist","inputs":[{"type":"address","name":"_strategist","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTimelock","inputs":[{"type":"address","name":"_timelock","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWithdrawalDevFundFee","inputs":[{"type":"uint256","name":"_withdrawalDevFundFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWithdrawalTreasuryFee","inputs":[{"type":"uint256","name":"_withdrawalTreasuryFee","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"strategist","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"timelock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"want","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"wavax","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"whitelistHarvester","inputs":[{"type":"address","name":"_harvester","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"}],"name":"withdraw","inputs":[{"type":"address","name":"_asset","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"}],"name":"withdrawAll","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"}],"name":"withdrawForSwap","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawalDevFundFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawalDevFundMax","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawalTreasuryFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawalTreasuryMax","inputs":[]}]
            

Deployed ByteCode

0x60806040526004361061027d5760003560e01c80635af0cd901161014f578063ab7f0f48116100c1578063c7b9d5301161007a578063c7b9d53014610863578063c95e372914610896578063d0e30db0146108ab578063d33219b4146108c0578063f77c4791146108d5578063fe1f8f7a1461054f5761027d565b8063ab7f0f481461079d578063b985a3a0146107b2578063bdacb303146107c7578063c1a3d44c146107fa578063c6223e261461080f578063c65e3242146108395761027d565b80638797658311610113578063879765831461069c57806388993f22146106e35780638ccdbb70146106f857806392eefe9b1461070d578063ab033ea914610740578063ab73e433146107735761027d565b80635af0cd901461061e578063645f580b14610633578063722713f714610648578063823785941461065d578063853828b6146106875761027d565b80632e1a7d4d116101f357806351cff8d9116101ac57806351cff8d91461056457806351f3d0b81461059757806354df7b63146105ac57806359739ec4146105df57806359f571e8146105f45780635aa6e675146106095761027d565b80632e1a7d4d146104e65780633e0dc34e146105105780634321d886146105255780634641257d1461053a578063479119be1461054f5780634fe809cc146104925761027d565b80631cff79cd116102455780631cff79cd146103c75780631f1fcd511461047d5780631f652b25146104925780631fe4a686146104a7578063249fb9b4146104bc57806326e886c6146104925761027d565b80630547104d1461028257806311588086146102b0578063117be4c2146102d757806317d7de7c1461030857806318eb0e0b14610392575b600080fd5b34801561028e57600080fd5b506102976108ea565b6040805192835260208301919091528051918290030190f35b3480156102bc57600080fd5b506102c5610b53565b60408051918252519081900360200190f35b3480156102e357600080fd5b506102ec610be3565b604080516001600160a01b039092168252519081900360200190f35b34801561031457600080fd5b5061031d610bfb565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561035757818101518382015260200161033f565b50505050905090810190601f1680156103845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039e57600080fd5b506103c5600480360360208110156103b557600080fd5b50356001600160a01b0316610c29565b005b61031d600480360360408110156103dd57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561040857600080fd5b82018360208201111561041a57600080fd5b8035906020019184600183028401116401000000008311171561043c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610caf945050505050565b34801561048957600080fd5b506102ec610d92565b34801561049e57600080fd5b506102c5610da1565b3480156104b357600080fd5b506102ec610da7565b3480156104c857600080fd5b506103c5600480360360208110156104df57600080fd5b5035610db6565b3480156104f257600080fd5b506103c56004803603602081101561050957600080fd5b5035610e06565b34801561051c57600080fd5b506102c561113f565b34801561053157600080fd5b506102c5611145565b34801561054657600080fd5b506103c561114b565b34801561055b57600080fd5b506102c5611993565b34801561057057600080fd5b506102c56004803603602081101561058757600080fd5b50356001600160a01b031661199a565b3480156105a357600080fd5b506102c5611ad0565b3480156105b857600080fd5b506103c5600480360360208110156105cf57600080fd5b50356001600160a01b0316611ad6565b3480156105eb57600080fd5b506102c5611b5f565b34801561060057600080fd5b506102ec611b65565b34801561061557600080fd5b506102ec611b7d565b34801561062a57600080fd5b506102ec611b8c565b34801561063f57600080fd5b506102c5611b9b565b34801561065457600080fd5b506102c5611ba1565b34801561066957600080fd5b506103c56004803603602081101561068057600080fd5b5035611bc7565b34801561069357600080fd5b506102c5611c17565b3480156106a857600080fd5b506106cf600480360360208110156106bf57600080fd5b50356001600160a01b0316611dce565b604080519115158252519081900360200190f35b3480156106ef57600080fd5b506102c5611de3565b34801561070457600080fd5b506102c5611de9565b34801561071957600080fd5b506103c56004803603602081101561073057600080fd5b50356001600160a01b0316611def565b34801561074c57600080fd5b506103c56004803603602081101561076357600080fd5b50356001600160a01b0316611e5c565b34801561077f57600080fd5b506103c56004803603602081101561079657600080fd5b5035611ecb565b3480156107a957600080fd5b506102ec611f1b565b3480156107be57600080fd5b506102ec611f2a565b3480156107d357600080fd5b506103c5600480360360208110156107ea57600080fd5b50356001600160a01b0316611f42565b34801561080657600080fd5b506102c5611faf565b34801561081b57600080fd5b506102c56004803603602081101561083257600080fd5b503561202c565b34801561084557600080fd5b506103c56004803603602081101561085c57600080fd5b50356121e7565b34801561086f57600080fd5b506103c56004803603602081101561088657600080fd5b50356001600160a01b0316612237565b3480156108a257600080fd5b506102ec6122a6565b3480156108b757600080fd5b506103c56122be565b3480156108cc57600080fd5b506102ec61241f565b3480156108e157600080fd5b506102ec61242e565b600b546040805160016232bd9d60e01b031981526004810192909252306024830152516000918291829173d6a4f121ca35509af06a0be99093d08462f530529163ffcd4263916044808201928692909190829003018186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052608081101561098c57600080fd5b815160208301516040808501805191519395929483019291846401000000008211156109b757600080fd5b9083019060208201858111156109cc57600080fd5b82516401000000008111828201881017156109e657600080fd5b82525081516020918201929091019080838360005b83811015610a135781810151838201526020016109fb565b50505050905090810190601f168015610a405780820380516001836020036101000a031916815260200191505b506040818152600b54631526fe2760e01b835260048301525196975060009673d6a4f121ca35509af06a0be99093d08462f530529650631526fe2795506024808301955060a0945090925090829003018186803b158015610aa057600080fd5b505afa158015610ab4573d6000803e3d6000fd5b505050506040513d60a0811015610aca57600080fd5b50608001516040805163c031a66f60e01b815230600482015290519192506000916001600160a01b0384169163c031a66f916024808301926020929190829003018186803b158015610b1b57600080fd5b505afa158015610b2f573d6000803e3d6000fd5b505050506040513d6020811015610b4557600080fd5b505192945091925050509091565b600b54604080516393f1a40b60e01b815260048101929092523060248301528051600092839273d6a4f121ca35509af06a0be99093d08462f53052926393f1a40b926044808201939291829003018186803b158015610bb157600080fd5b505afa158015610bc5573d6000803e3d6000fd5b505050506040513d6040811015610bdb57600080fd5b505191505090565b73b31f66aa3c1e785363f0875a1b74e27b85fd66c781565b604080518082019091526014815273053747261746567794a6f65417661784a6f654c760641b602082015290565b6006546001600160a01b0316331480610c4c57506008546001600160a01b031633145b610c8e576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6009546060906001600160a01b03163314610cfd576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b6001600160a01b038316610d42576040805162461bcd60e51b8152602060048201526007602482015266085d185c99d95d60ca1b604482015290519081900360640190fd5b600080835160208501866113885a03f43d6040519250601f19601f6020830101168301604052808352806000602085013e811560018114610d8257610d89565b8160208501fd5b50505092915050565b6000546001600160a01b031681565b61271081565b6008546001600160a01b031681565b6009546001600160a01b03163314610e01576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600255565b6007546001600160a01b03163314610e53576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610e9f57600080fd5b505afa158015610eb3573d6000803e3d6000fd5b505050506040513d6020811015610ec957600080fd5b5051905081811015610f0257610eed610ee8838363ffffffff61243d16565b612488565b9150610eff828263ffffffff61250c16565b91505b6000610f2c620186a0610f206005548661256690919063ffffffff16565b9063ffffffff6125bf16565b9050610fc4600760009054906101000a90046001600160a01b03166001600160a01b0316638d8f1e676040518163ffffffff1660e01b815260040160206040518083038186803b158015610f7f57600080fd5b505afa158015610f93573d6000803e3d6000fd5b505050506040513d6020811015610fa957600080fd5b50516000546001600160a01b0316908363ffffffff61260116565b6000610fe2620186a0610f206004548761256690919063ffffffff16565b9050611035600760009054906101000a90046001600160a01b03166001600160a01b03166361d027b36040518163ffffffff1660e01b815260040160206040518083038186803b158015610f7f57600080fd5b600754600080546040805163368da5ef60e11b81526001600160a01b039283166004820152905192939190911691636d1b4bde91602480820192602092909190829003018186803b15801561108957600080fd5b505afa15801561109d573d6000803e3d6000fd5b505050506040513d60208110156110b357600080fd5b505190506001600160a01b0381166110fb576040805162461bcd60e51b815260206004820152600660248201526521676c6f626560d01b604482015290519081900360640190fd5b6111388161111f84611113898863ffffffff61243d16565b9063ffffffff61243d16565b6000546001600160a01b0316919063ffffffff61260116565b5050505050565b600b5481565b600c5481565b336000908152600a602052604090205460ff168061117357506006546001600160a01b031633145b8061118857506008546001600160a01b031633145b61119157600080fd5b73d6a4f121ca35509af06a0be99093d08462f530526001600160a01b031663e2bbb158600b5460006040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156111f657600080fd5b505af115801561120a573d6000803e3d6000fd5b5050604080516370a0823160e01b8152306004820152905160009350736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd92506370a0823191602480820192602092909190829003018186803b15801561126357600080fd5b505afa158015611277573d6000803e3d6000fd5b505050506040513d602081101561128d57600080fd5b5051905080156114175760006112b4612710610f20600c548561256690919063ffffffff16565b9050611355600760009054906101000a90046001600160a01b03166001600160a01b03166361d027b36040518163ffffffff1660e01b815260040160206040518083038186803b15801561130757600080fd5b505afa15801561131b573d6000803e3d6000fd5b505050506040513d602081101561133157600080fd5b5051736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd908363ffffffff61260116565b600061136c6002610f20858563ffffffff61243d16565b90506113a8736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd7360ae616a2155ee3d9a68541ba4544862310933d4600063ffffffff61265816565b6113e1736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd7360ae616a2155ee3d9a68541ba4544862310933d48363ffffffff61265816565b611414736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd73b31f66aa3c1e785363f0875a1b74e27b85fd66c78361276b565b50505b604080516370a0823160e01b8152306004820152905160009173b31f66aa3c1e785363f0875a1b74e27b85fd66c7916370a0823191602480820192602092909190829003018186803b15801561146c57600080fd5b505afa158015611480573d6000803e3d6000fd5b505050506040513d602081101561149657600080fd5b5051604080516370a0823160e01b81523060048201529051919250736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd916370a0823191602480820192602092909190829003018186803b1580156114ed57600080fd5b505afa158015611501573d6000803e3d6000fd5b505050506040513d602081101561151757600080fd5b50519150801580159061152a5750600082115b156119875761156973b31f66aa3c1e785363f0875a1b74e27b85fd66c77360ae616a2155ee3d9a68541ba4544862310933d4600063ffffffff61265816565b6115a273b31f66aa3c1e785363f0875a1b74e27b85fd66c77360ae616a2155ee3d9a68541ba4544862310933d48363ffffffff61265816565b6115dc736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd7360ae616a2155ee3d9a68541ba4544862310933d4600063ffffffff61265816565b611615736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd7360ae616a2155ee3d9a68541ba4544862310933d48463ffffffff61265816565b6040805162e8e33760e81b815273b31f66aa3c1e785363f0875a1b74e27b85fd66c76004820152736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd6024820152604481018390526064810184905260006084820181905260a482018190523060c4830152603c420160e483015291517360ae616a2155ee3d9a68541ba4544862310933d49263e8e337009261010480820193606093909283900390910190829087803b1580156116c557600080fd5b505af11580156116d9573d6000803e3d6000fd5b505050506040513d60608110156116ef57600080fd5b5050600754604080516361d027b360e01b8152905173b31f66aa3c1e785363f0875a1b74e27b85fd66c79263a9059cbb926001600160a01b03909116916361d027b391600480820192602092909190829003018186803b15801561175257600080fd5b505afa158015611766573d6000803e3d6000fd5b505050506040513d602081101561177c57600080fd5b5051604080516370a0823160e01b8152306004820152905173b31f66aa3c1e785363f0875a1b74e27b85fd66c7916370a08231916024808301926020929190829003018186803b1580156117cf57600080fd5b505afa1580156117e3573d6000803e3d6000fd5b505050506040513d60208110156117f957600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561184a57600080fd5b505af115801561185e573d6000803e3d6000fd5b505050506040513d602081101561187457600080fd5b5050600754604080516361d027b360e01b81529051611987926001600160a01b0316916361d027b3916004808301926020929190829003018186803b1580156118bc57600080fd5b505afa1580156118d0573d6000803e3d6000fd5b505050506040513d60208110156118e657600080fd5b5051604080516370a0823160e01b81523060048201529051736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd916370a08231916024808301926020929190829003018186803b15801561193957600080fd5b505afa15801561194d573d6000803e3d6000fd5b505050506040513d602081101561196357600080fd5b5051736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd919063ffffffff61260116565b61198f612aaf565b5050565b620186a081565b6007546000906001600160a01b031633146119ea576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b6000546001600160a01b0383811691161415611a36576040805162461bcd60e51b815260206004808301919091526024820152631dd85b9d60e21b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b158015611a7c57600080fd5b505afa158015611a90573d6000803e3d6000fd5b505050506040513d6020811015611aa657600080fd5b5051600754909150611acb906001600160a01b0384811691168363ffffffff61260116565b919050565b60055481565b6006546001600160a01b0316331480611af957506008546001600160a01b031633145b611b3b576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6001600160a01b03166000908152600a60205260409020805460ff19166001179055565b60025481565b7360ae616a2155ee3d9a68541ba4544862310933d481565b6006546001600160a01b031681565b6001546001600160a01b031681565b600d5481565b6000611bc2611bae610b53565b611bb6611faf565b9063ffffffff61250c16565b905090565b6009546001600160a01b03163314611c12576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600455565b6007546000906001600160a01b03163314611c67576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b611c6f612c53565b600054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611cba57600080fd5b505afa158015611cce573d6000803e3d6000fd5b505050506040513d6020811015611ce457600080fd5b5051600754600080546040805163368da5ef60e11b81526001600160a01b03928316600482015290519495509193921691636d1b4bde91602480820192602092909190829003018186803b158015611d3b57600080fd5b505afa158015611d4f573d6000803e3d6000fd5b505050506040513d6020811015611d6557600080fd5b505190506001600160a01b038116611dad576040805162461bcd60e51b815260206004820152600660248201526521676c6f626560d01b604482015290519081900360640190fd5b600054611dca906001600160a01b0316828463ffffffff61260116565b5090565b600a6020526000908152604090205460ff1681565b60035481565b60045481565b6009546001600160a01b03163314611e3a576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b03163314611ea9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6009546001600160a01b03163314611f16576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600555565b600e546001600160a01b031681565b736e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd81565b6009546001600160a01b03163314611f8d576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611ffb57600080fd5b505afa15801561200f573d6000803e3d6000fd5b505050506040513d602081101561202557600080fd5b5051905090565b6007546000906001600160a01b0316331461207c576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b61208582612488565b50600054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156120d157600080fd5b505afa1580156120e5573d6000803e3d6000fd5b505050506040513d60208110156120fb57600080fd5b5051600754600080546040805163368da5ef60e11b81526001600160a01b03928316600482015290519495509193921691636d1b4bde91602480820192602092909190829003018186803b15801561215257600080fd5b505afa158015612166573d6000803e3d6000fd5b505050506040513d602081101561217c57600080fd5b505190506001600160a01b0381166121c4576040805162461bcd60e51b815260206004820152600660248201526521676c6f626560d01b604482015290519081900360640190fd5b6000546121e1906001600160a01b0316828463ffffffff61260116565b50919050565b6009546001600160a01b03163314612232576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600355565b6006546001600160a01b03163314612284576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b73d6a4f121ca35509af06a0be99093d08462f5305281565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561230a57600080fd5b505afa15801561231e573d6000803e3d6000fd5b505050506040513d602081101561233457600080fd5b50519050801561241c5760008054612373916001600160a01b039091169073d6a4f121ca35509af06a0be99093d08462f530529063ffffffff61265816565b6000546123a4906001600160a01b031673d6a4f121ca35509af06a0be99093d08462f530528363ffffffff61265816565b73d6a4f121ca35509af06a0be99093d08462f530526001600160a01b031663e2bbb158600b54836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561240857600080fd5b505af1158015611138573d6000803e3d6000fd5b50565b6009546001600160a01b031681565b6007546001600160a01b031681565b600061247f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612c5e565b90505b92915050565b600073d6a4f121ca35509af06a0be99093d08462f530526001600160a01b031663441a3e70600b54846040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156124ee57600080fd5b505af1158015612502573d6000803e3d6000fd5b5093949350505050565b60008282018381101561247f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261257557506000612482565b8282028284828161258257fe5b041461247f5760405162461bcd60e51b8152600401808060200182810382526021815260200180612f966021913960400191505060405180910390fd5b600061247f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cf5565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612653908490612d5a565b505050565b8015806126de575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156126b057600080fd5b505afa1580156126c4573d6000803e3d6000fd5b505050506040513d60208110156126da57600080fd5b5051155b6127195760405162461bcd60e51b8152600401808060200182810382526036815260200180612fe16036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612653908490612d5a565b6001600160a01b03821661277e57600080fd5b60606001600160a01b03841673b31f66aa3c1e785363f0875a1b74e27b85fd66c714806127c757506001600160a01b03831673b31f66aa3c1e785363f0875a1b74e27b85fd66c7145b1561284d57604080516002808252606082018352909160208301908036833701905050905083816000815181106127fa57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050828160018151811061282857fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061290d565b604080516003808252608082019092529060208201606080368337019050509050838160008151811061287c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073b31f66aa3c1e785363f0875a1b74e27b85fd66c7816001815181106128be57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505082816002815181106128ec57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b7360ae616a2155ee3d9a68541ba4544862310933d46338ed1739836000843061293d42603c63ffffffff61250c16565b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03166001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156129b657818101518382015260200161299e565b505050509050019650505050505050600060405180830381600087803b1580156129df57600080fd5b505af11580156129f3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612a1c57600080fd5b8101908080516040519392919084640100000000821115612a3c57600080fd5b908301906020820185811115612a5157600080fd5b8251866020820283011164010000000082111715612a6e57600080fd5b82525081516020918201928201910280838360005b83811015612a9b578181015183820152602001612a83565b505050509050016040525050505050505050565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015612afb57600080fd5b505afa158015612b0f573d6000803e3d6000fd5b505050506040513d6020811015612b2557600080fd5b50519050801561241c57600754604080516361d027b360e01b81529051612bbd926001600160a01b0316916361d027b3916004808301926020929190829003018186803b158015612b7557600080fd5b505afa158015612b89573d6000803e3d6000fd5b505050506040513d6020811015612b9f57600080fd5b505160025461111f9061271090610f2090869063ffffffff61256616565b60075460408051638d8f1e6760e01b81529051612c4b926001600160a01b031691638d8f1e67916004808301926020929190829003018186803b158015612c0357600080fd5b505afa158015612c17573d6000803e3d6000fd5b505050506040513d6020811015612c2d57600080fd5b505160035461111f9061271090610f2090869063ffffffff61256616565b61241c6122be565b61241c610ee8610b53565b60008184841115612ced5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612cb2578181015183820152602001612c9a565b50505050905090810190601f168015612cdf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183612d445760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612cb2578181015183820152602001612c9a565b506000838581612d5057fe5b0495945050505050565b6060612daf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e0b9092919063ffffffff16565b80519091501561265357808060200190516020811015612dce57600080fd5b50516126535760405162461bcd60e51b815260040180806020018281038252602a815260200180612fb7602a913960400191505060405180910390fd5b6060612e1a8484600085612e22565b949350505050565b6060612e2d85612f8f565b612e7e576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612ebd5780518252601f199092019160209182019101612e9e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612f1f576040519150601f19603f3d011682016040523d82523d6000602084013e612f24565b606091505b50915091508115612f38579150612e1a9050565b805115612f485780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315612cb2578181015183820152602001612c9a565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220b08173269623ef87b98ccba80815c5cd5b3e320cb5a710c97fb72df58314d65464736f6c63430006070033