Contract 0xF30ef31699BDa87BA4Da9C49DD3075BfdC7EF035

 
 
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0x1c107de8798bded2c523e24642e0858567f7a1cb2371a13af2d3fc2ac990a322Harvest Vault316008752022-08-06 21:30:14178 days 1 hr ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0321085 100
0x5a4759e6df443087de142936a35d1aa8b61bc58b346aac7094e41775c971a608Harvest Vault316005922022-08-06 21:18:24178 days 2 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0433146 100
0x3d0323ae2adf73412b47405f3c1fd3ec8fdd456fe68de27e5ca71d1711d1cc58Harvest Vault295692882022-06-14 19:35:55231 days 3 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0442842 100
0xe8b79747e6dd4071b7e4a5f87b04b050277a727d743109bddea23fbd6ee04bc7Harvest Vault295692582022-06-14 19:34:51231 days 3 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0441597 100
0x63df70b1672f440b62f0b5693ad0563d5cab99c3288febb1dc08ce1454c79b44Harvest Vault295692542022-06-14 19:34:43231 days 3 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0405795 100
0x141bde87f9880c94c554d601f31b71b2b5cab38e75a89cae0e17bf2054020af9Harvest Vault293992852022-06-10 15:03:56235 days 8 hrs ago0x9ae80b1c3e379a8844b37fd588e04af0a8fc3496 IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0442842 100
0x611947be0ee8567ec9b839c2f8c6d90381091ebe0f3a3a6e3d1f5d07c2fe6a6fHarvest Vault293992522022-06-10 15:02:50235 days 8 hrs ago0x9ae80b1c3e379a8844b37fd588e04af0a8fc3496 IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0449141 100
0x8d273d36cd705f41dd4240b5870a0e84d3a2792c3278c5280ae6d0e3ab627918Harvest Vault293992322022-06-10 15:02:10235 days 8 hrs ago0x9ae80b1c3e379a8844b37fd588e04af0a8fc3496 IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0441998 100
0x88173ea59d7e2d8342aa2cc8b6a40ad4f575f2fbc8b4a8cbc137ae97cc2dc6f9Harvest Vault293682802022-06-09 20:04:55236 days 3 hrs ago0x9ae80b1c3e379a8844b37fd588e04af0a8fc3496 IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.04422 100
0x6dc66a09114236da551ee045876cec94e28428e788868ec595d86e689173d8b6Harvest Vault289555042022-05-30 14:20:21246 days 9 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.013296 100
0x79dd7c531dd1397fa86543cc212c6d627cc064cc774e319019fe7a5f08211cc4Harvest Vault285258282022-05-19 23:01:48257 days 22 mins ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0429162 100
0xe7c1d5775757fad7540ef09bc246280317b3f01a01e12d2e8e526383161f4f39Harvest Vault285257862022-05-19 23:00:20257 days 23 mins ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0445209 100
0xb980ac6ac220b2a3b70c22e79cf332a42dde0f0dffde73921bb3ae97d105cfd5Harvest Vault285257812022-05-19 23:00:10257 days 23 mins ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0449141 100
0x0336e3e9cf9706bf6211a2009c5afbc70e4303f53a31d29dfe6e2c7f976e12d3Harvest Vault285257672022-05-19 22:59:42257 days 24 mins ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0427917 100
0x8964e478b92842f4a6c3b706494cd6bffceeebc64c27a7c0f8ca50c4a73c03a5Harvest Vault285257032022-05-19 22:57:30257 days 26 mins ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.013296 100
0x47b7c2ff55a4b3aa0a0dc2dff333dbd2b8ff37ec64b6dd56dd015581896e8507Harvest Vault285256612022-05-19 22:56:00257 days 28 mins ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.0425894 100
0x2f6bb27fba0f0f0b39402598f499990cf2064b3c3319021940f11d1f9a12604bHarvest Vault245477702022-02-04 17:03:31361 days 6 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.00397481 35
0x704d27bd1e8a398852c201f1c29543a032c1d3445422532783bf0cc7b7c9df1eHarvest Vault245476842022-02-04 17:00:35361 days 6 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.014450804133 33.186366406
0x7ef0486de28119254250d9d717013be6d80dd3163afae15c904ef10a2156b688Harvest Vault245476802022-02-04 17:00:27361 days 6 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.016127612303 36.224811949
0x972772e7b604257866ef66541a460c8f6de32983fa78a86eea3d6049d0c8a8d9Harvest Vault245476752022-02-04 17:00:17361 days 6 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.016160549606 37.11135924
0x9a00f894dc49aba6958c638d7ae52f1af74f4eabe9e82d1f73b01841f55d19e2Harvest Vault245476592022-02-04 16:59:45361 days 6 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.013435691993 31.368497224
0x14a953bb416626fe0477d36933cfd963bb8905976baeee0e51d2c52b25d197f6Harvest Vault245476322022-02-04 16:58:47361 days 6 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.01347111 30
0x2a7e96465cd08e7321e852cd1b2b40bd38dfb3d42bdcfdd0c506b34b8ce30de8Harvest Vault245476212022-02-04 16:58:25361 days 6 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.01271124 30
0x1e04b2700a0e65d9390c2b7f0760e9010212f826db687a39d96c323b058e7e53Harvest Vault243868922022-01-31 15:59:16365 days 7 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.017388208181 39.971789702
0xf81509f35b424f69f46c3941a875e963e9995236c4204e0a6cb1909fab42fecaHarvest Vault243218582022-01-29 23:43:34366 days 23 hrs ago0x3c9b942486833fa3fd303dc441432654fa6b18d3 IN  0xf30ef31699bda87ba4da9c49dd3075bfdc7ef0350 MATIC0.015409492561 32.340000003
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Harvester

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 2 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 3 of 7 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 4 of 7 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 5 of 7 : IUniswapV2Router.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IUniswapV2Router {
	function factory() external pure returns (address);

	function WETH() external pure returns (address);

	function getAmountsOut(uint256 amountIn, address[] calldata path)
		external
		view
		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 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);
}

File 6 of 7 : IVault.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IERC20Detailed is IERC20 {
	function decimals() external view returns (uint8);
}

interface IVault {
	function totalSupply() external view returns (uint256);

	function harvest() external returns (uint256);

	function distribute(uint256 amount) external;

	function rewards() external view returns (IERC20);

	function underlying() external view returns (IERC20Detailed);

	function target() external view returns (IERC20);

	function harvester() external view returns (address);

	function owner() external view returns (address);

	function distribution() external view returns (address);

	function strat() external view returns (address);

	function timelock() external view returns (address payable);

	function claimOnBehalf(address recipient) external;

	function lastDistribution() external view returns (uint256);

	function performanceFee() external view returns (uint256);

	function balanceOf(address) external view returns (uint256);

	function totalYield() external returns (uint256);

	function calcTotalValue() external view returns (uint256);

	function deposit(uint256 amount) external;

	function depositAndWait(uint256 amount) external;

	function withdraw(uint256 amount) external;

	function withdrawPending(uint256 amount) external;

	function changePerformanceFee(uint256 fee) external;

	function claim() external returns (uint256 claimed);

	function unclaimedProfit(address user) external view returns (uint256);

	function pending(address user) external view returns (uint256);
}

File 7 of 7 : Harvester.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "../interfaces/IVault.sol";
import "../interfaces/IUniswapV2Router.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract Harvester is Ownable {
	using SafeMath for uint256;

	event Harvested(address indexed vault, address indexed sender);

	// Quickswap Router
	IUniswapV2Router constant ROUTER =
		IUniswapV2Router(0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff);

	// Connectors
	address public WMATIC = 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270;
	address public WETH = 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619;

	uint256 public delay;

	constructor(uint256 _delay) {
		delay = _delay;
	}

	modifier onlyAfterDelay(IVault vault) {
		require(
			block.timestamp >= vault.lastDistribution().add(delay),
			"Not ready to harvest"
		);
		_;
	}

	function getBestConnector(
		address from,
		address to,
		uint256 amount
	) public view returns (address connector) {
		connector = address(0);

		// Check with no connector
		address[] memory path = new address[](2);
		path[0] = address(from);
		path[1] = address(to);
		uint256 noConnector = ROUTER.getAmountsOut(amount, path)[
			path.length - 1
		];

		// Check with WMATIC
		uint256 usingMatic = noConnector;
		// when volatile asset not the connector
		if (address(from) != WMATIC && address(to) != WMATIC) {
			path = new address[](3);
			path[0] = address(from);
			path[1] = WMATIC;
			path[2] = address(to);
			usingMatic = ROUTER.getAmountsOut(amount, path)[path.length - 1];
			connector = usingMatic > noConnector ? WMATIC : connector;
		}

		// Check with WETH
		// when volatile asset is not the connector
		if (address(from) != WETH && address(to) != WETH) {
			path = new address[](3);
			path[0] = address(from);
			path[1] = WETH;
			path[2] = address(to);
			uint256 usingETH = ROUTER.getAmountsOut(amount, path)[
				path.length - 1
			];
			connector = usingETH > usingMatic ? WETH : connector;
		}
	}

	/**
		@notice Harvest vault using quickswap router
		@dev any user can harvest after delay has passed
	*/
	function harvestVault(IVault vault) public onlyAfterDelay(vault) {
		// Amount to Harvest
		uint256 afterFee = vault.harvest();
		require(afterFee > 0, "!Yield");

		IERC20 from = vault.rewards();
		IERC20 to = vault.target();

		address connector = getBestConnector(
			address(from),
			address(to),
			afterFee
		);

		// Quickswap path
		address[] memory path;

		if (connector == address(0)) {
			path = new address[](2);
			path[0] = address(from);
			path[1] = address(to);
		} else {
			path = new address[](3);
			path[0] = address(from);
			path[1] = connector;
			path[2] = address(to);
		}

		// Swap underlying to target
		from.approve(address(ROUTER), afterFee);
		uint256 received = ROUTER.swapExactTokensForTokens(
			afterFee,
			1,
			path,
			address(this),
			block.timestamp + 1
		)[path.length - 1];

		// Send profits to vault
		to.approve(address(vault), received);
		vault.distribute(received);

		emit Harvested(address(vault), msg.sender);
	}

	/**
		@dev update delay required to harvest vault
	*/
	function setDelay(uint256 _delay) external onlyOwner {
		delay = _delay;
	}

	// no tokens should ever be stored on this contract. Any tokens that are sent here by mistake are recoverable by the owner
	function sweep(address _token) external onlyOwner {
		IERC20(_token).transfer(
			owner(),
			IERC20(_token).balanceOf(address(this))
		);
	}
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_delay","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Harvested","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"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WMATIC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getBestConnector","outputs":[{"internalType":"address","name":"connector","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"}],"name":"harvestVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_delay","type":"uint256"}],"name":"setDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600180546001600160a01b0319908116730d500b1d8e8ef31e21c99d1db9a6444d3adf12701790915560028054909116737ceb23fd6bc0add59e62ac25578270cff1b9f61917905534801561005857600080fd5b50604051611419380380611419833981016040819052610077916100d8565b61008033610088565b6003556100f0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100e9578081fd5b5051919050565b61131a806100ff6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b1461011a578063ad5c46481461012b578063dcbed80e1461013e578063e177246e14610151578063f2fde38b1461016457600080fd5b806301681a62146100a35780630a2f023e146100b85780634d95cad9146100cb5780636a42b8f8146100fb578063715018a614610112575b600080fd5b6100b66100b1366004611017565b610177565b005b6100b66100c6366004611017565b6102c4565b6001546100de906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61010460035481565b6040519081526020016100f2565b6100b6610960565b6000546001600160a01b03166100de565b6002546100de906001600160a01b031681565b6100de61014c366004611033565b610996565b6100b661015f36600461116f565b610eea565b6100b6610172366004611017565b610f19565b6000546001600160a01b031633146101aa5760405162461bcd60e51b81526004016101a1906111e2565b60405180910390fd5b806001600160a01b031663a9059cbb6101cb6000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a082319060240160206040518083038186803b15801561020a57600080fd5b505afa15801561021e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102429190611187565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561028857600080fd5b505af115801561029c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c09190611133565b5050565b80610342600354826001600160a01b031663a717639c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561030457600080fd5b505afa158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c9190611187565b90610fb4565b4210156103885760405162461bcd60e51b8152602060048201526014602482015273139bdd081c9958591e481d1bc81a185c9d995cdd60621b60448201526064016101a1565b6000826001600160a01b0316634641257d6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156103c557600080fd5b505af11580156103d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fd9190611187565b9050600081116104385760405162461bcd60e51b815260206004820152600660248201526508565a595b1960d21b60448201526064016101a1565b6000836001600160a01b0316639ec5a8946040518163ffffffff1660e01b815260040160206040518083038186803b15801561047357600080fd5b505afa158015610487573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ab9190611153565b90506000846001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b1580156104e857600080fd5b505afa1580156104fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105209190611153565b9050600061052f838386610996565b905060606001600160a01b0382166105ea576040805160028082526060820183529091602083019080368337019050509050838160008151811061058357634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505082816001815181106105c557634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250506106d2565b604080516003808252608082019092529060208201606080368337019050509050838160008151811061062d57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050818160018151811061066f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505082816002815181106106b157634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b60405163095ea7b360e01b815273a5e0829caced8ffdd4de3c43696c57f7d7a678ff6004820152602481018690526001600160a01b0385169063095ea7b390604401602060405180830381600087803b15801561072e57600080fd5b505af1158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611133565b50600073a5e0829caced8ffdd4de3c43696c57f7d7a678ff6338ed173987600185306107924284611274565b6040518663ffffffff1660e01b81526004016107b2959493929190611238565b600060405180830381600087803b1580156107cc57600080fd5b505af11580156107e0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108089190810190611073565b60018351610816919061128c565b8151811061083457634e487b7160e01b600052603260045260246000fd5b602090810291909101015160405163095ea7b360e01b81526001600160a01b038a81166004830152602482018390529192509085169063095ea7b390604401602060405180830381600087803b15801561088d57600080fd5b505af11580156108a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c59190611133565b506040516391c05b0b60e01b8152600481018290526001600160a01b038916906391c05b0b90602401600060405180830381600087803b15801561090857600080fd5b505af115801561091c573d6000803e3d6000fd5b50506040513392506001600160a01b038b1691507fb0fab2194c544d09f2a81bfec607b4a5532e7ef21412deca0e29aa5a39b1d54190600090a35050505050505050565b6000546001600160a01b0316331461098a5760405162461bcd60e51b81526004016101a1906111e2565b6109946000610fc7565b565b6040805160028082526060820183526000928392919060208301908036833701905050905084816000815181106109dd57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508381600181518110610a1f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015260405163d06ca61f60e01b815260009073a5e0829caced8ffdd4de3c43696c57f7d7a678ff9063d06ca61f90610a739087908690600401611217565b60006040518083038186803b158015610a8b57600080fd5b505afa158015610a9f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ac79190810190611073565b60018351610ad5919061128c565b81518110610af357634e487b7160e01b600052603260045260246000fd5b602090810291909101015160015490915081906001600160a01b03888116911614801590610b2f57506001546001600160a01b03878116911614155b15610cef576040805160038082526080820190925290602082016060803683370190505092508683600081518110610b7757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526001805485519216918591908110610bb557634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508583600281518110610bf757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015260405163d06ca61f60e01b815273a5e0829caced8ffdd4de3c43696c57f7d7a678ff9063d06ca61f90610c489088908790600401611217565b60006040518083038186803b158015610c6057600080fd5b505afa158015610c74573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c9c9190810190611073565b60018451610caa919061128c565b81518110610cc857634e487b7160e01b600052603260045260246000fd5b60200260200101519050818111610cdf5783610cec565b6001546001600160a01b03165b93505b6002546001600160a01b03888116911614801590610d1b57506002546001600160a01b03878116911614155b15610ee0576040805160038082526080820190925290602082016060803683370190505092508683600081518110610d6357634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600254845191169084906001908110610da257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508583600281518110610de457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015260405163d06ca61f60e01b815260009073a5e0829caced8ffdd4de3c43696c57f7d7a678ff9063d06ca61f90610e389089908890600401611217565b60006040518083038186803b158015610e5057600080fd5b505afa158015610e64573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e8c9190810190611073565b60018551610e9a919061128c565b81518110610eb857634e487b7160e01b600052603260045260246000fd5b60200260200101519050818111610ecf5784610edc565b6002546001600160a01b03165b9450505b5050509392505050565b6000546001600160a01b03163314610f145760405162461bcd60e51b81526004016101a1906111e2565b600355565b6000546001600160a01b03163314610f435760405162461bcd60e51b81526004016101a1906111e2565b6001600160a01b038116610fa85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101a1565b610fb181610fc7565b50565b6000610fc08284611274565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215611028578081fd5b8135610fc0816112cf565b600080600060608486031215611047578182fd5b8335611052816112cf565b92506020840135611062816112cf565b929592945050506040919091013590565b60006020808385031215611085578182fd5b825167ffffffffffffffff8082111561109c578384fd5b818501915085601f8301126110af578384fd5b8151818111156110c1576110c16112b9565b8060051b604051601f19603f830116810181811085821117156110e6576110e66112b9565b604052828152858101935084860182860187018a1015611104578788fd5b8795505b83861015611126578051855260019590950194938601938601611108565b5098975050505050505050565b600060208284031215611144578081fd5b81518015158114610fc0578182fd5b600060208284031215611164578081fd5b8151610fc0816112cf565b600060208284031215611180578081fd5b5035919050565b600060208284031215611198578081fd5b5051919050565b6000815180845260208085019450808401835b838110156111d75781516001600160a01b0316875295820195908201906001016111b2565b509495945050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b828152604060208201526000611230604083018461119f565b949350505050565b85815284602082015260a06040820152600061125760a083018661119f565b6001600160a01b0394909416606083015250608001529392505050565b60008219821115611287576112876112a3565b500190565b60008282101561129e5761129e6112a3565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610fb157600080fdfea264697066735822122049d6fe8f530f0f3774c46e3750a3598131dbd5fb7d5fa8df6806e83470a436c964736f6c634300080400330000000000000000000000000000000000000000000000000000000000015180

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000000000000000000000000000000000000000015180

-----Decoded View---------------
Arg [0] : _delay (uint256): 86400

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000015180


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.