FTM Price: $1.02 (+1.03%)
Gas: 130 GWei

Contract

0x9AB353057CF41CfbA981a37e6C8F3942cc0147b6
 

Overview

FTM Balance

Fantom LogoFantom LogoFantom Logo143.440913956091108052 FTM

FTM Value

$145.77 (@ $1.02/FTM)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Transfer529401712022-12-27 16:54:11457 days ago1672160051IN
0x9AB35305...2cc0147b6
99.99850871 FTM0.0008724439.46469165
Transfer529348902022-12-27 13:52:51457 days ago1672149171IN
0x9AB35305...2cc0147b6
70 FTM0.0007626934.4999838
Transfer400747272022-06-08 16:10:09659 days ago1654704609IN
0x9AB35305...2cc0147b6
30 FTM0.0013222659.81201315
Initiate Strateg...395469092022-06-01 14:19:01666 days ago1654093141IN
0x9AB35305...2cc0147b6
0 FTM0.44124632,503.70979696
Transfer395468722022-06-01 14:18:01666 days ago1654093081IN
0x9AB35305...2cc0147b6
15 FTM0.0015794374.27377886
0x60806040395467982022-06-01 14:16:20666 days ago1654092980IN
 Create: YearnHarvest
0 FTM0.0452410627.14546167

Latest 25 internal transactions (View All)

Parent Txn Hash Block From To Value
783942972024-03-28 22:55:001 hr ago1711666500
0x9AB35305...2cc0147b6
0.09351861 FTM
783241352024-03-27 23:42:1824 hrs ago1711582938
0x9AB35305...2cc0147b6
0.14734392 FTM
783236212024-03-27 23:31:4224 hrs ago1711582302
0x9AB35305...2cc0147b6
0.10324141 FTM
782950302024-03-27 14:26:5733 hrs ago1711549617
0x9AB35305...2cc0147b6
0.1946069 FTM
782948472024-03-27 14:23:5133 hrs ago1711549431
0x9AB35305...2cc0147b6
0.19161183 FTM
782940462024-03-27 14:10:5734 hrs ago1711548657
0x9AB35305...2cc0147b6
0.1745831 FTM
782346632024-03-26 17:41:172 days ago1711474877
0x9AB35305...2cc0147b6
0.04128318 FTM
782339222024-03-26 17:27:172 days ago1711474037
0x9AB35305...2cc0147b6
0.04423013 FTM
781782622024-03-25 23:42:133 days ago1711410133
0x9AB35305...2cc0147b6
0.12080521 FTM
781777382024-03-25 23:31:233 days ago1711409483
0x9AB35305...2cc0147b6
0.05768677 FTM
781469802024-03-25 14:26:533 days ago1711376813
0x9AB35305...2cc0147b6
0.04916165 FTM
781467442024-03-25 14:23:313 days ago1711376611
0x9AB35305...2cc0147b6
0.11880018 FTM
781459512024-03-25 14:10:543 days ago1711375854
0x9AB35305...2cc0147b6
0.05747936 FTM
780790652024-03-23 23:42:025 days ago1711237322
0x9AB35305...2cc0147b6
0.04078002 FTM
780784362024-03-23 23:31:095 days ago1711236669
0x9AB35305...2cc0147b6
0.02169381 FTM
780671402024-03-23 19:08:405 days ago1711220920
0x9AB35305...2cc0147b6
0.05578021 FTM
780557252024-03-23 15:09:275 days ago1711206567
0x9AB35305...2cc0147b6
0.08108784 FTM
780533842024-03-23 14:26:485 days ago1711204008
0x9AB35305...2cc0147b6
0.08220639 FTM
780532142024-03-23 14:23:195 days ago1711203799
0x9AB35305...2cc0147b6
0.08001908 FTM
780529482024-03-23 14:18:185 days ago1711203498
0x9AB35305...2cc0147b6
0.09014073 FTM
780525832024-03-23 14:10:495 days ago1711203049
0x9AB35305...2cc0147b6
0.0741808 FTM
779186512024-03-21 23:41:537 days ago1711064513
0x9AB35305...2cc0147b6
0.18136763 FTM
779180052024-03-21 23:31:047 days ago1711063864
0x9AB35305...2cc0147b6
0.16442337 FTM
778963922024-03-21 17:40:527 days ago1711042852
0x9AB35305...2cc0147b6
0.08626001 FTM
778851222024-03-21 14:26:437 days ago1711031203
0x9AB35305...2cc0147b6
0.08895116 FTM
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
YearnHarvest

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU AGPLv3 license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : YearnHarvest.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

/**
@title Yearn Harvest
@author yearn.finance
@notice Yearn Harvest or yHarvest is a smart contract that leverages Gelato to automate
the harvest of strategies that have yHarvest assigned as its keeper.
The contract provides the Gelato network of keepers Yearn harvest jobs that
are ready to execute, and it pays Gelato after a succesful harvest.
*/

import {SafeMath} from "SafeMath.sol";
import {Address} from "Address.sol";
import {SafeERC20, IERC20} from "SafeERC20.sol";
import {StrategyAPI, VaultAPI, StrategyParams} from "BaseStrategy.sol";
import {IGelatoOps} from "IGelato.sol";

/**
@title Yearn Lens Interface
@notice We leverage the Yearn Lens set of contracts to obtain an up-to-date
snapshot of active strategies in production.
 */
interface IStrategyDataAggregator {
    function assetsStrategiesAddresses()
        external
        view
        returns (address[] memory);
}

contract YearnHarvest {
    using Address for address;
    using SafeMath for uint256;

    // `jobIds` keeps track of the Gelato job IDs for each strategy and
    // the yHarvest contract
    mapping(address => bytes32) public jobIds;

    // `feeToken` is the crypto used for payment.
    address public constant feeToken =
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    // `maxFee` determines the max fee allowed to be paid to Gelato
    // denominated in `feeToken`. Note that setting it to 0 would
    // effectively present all executors from running any task.
    // To do so, call `setMaxFee()`
    uint256 public maxFee = 1e18;

    // Yearn Lens data aggregator
    IStrategyDataAggregator internal constant aggregator =
        IStrategyDataAggregator(0x97D0bE2a72fc4Db90eD9Dbc2Ea7F03B4968f6938);

    // Gelato Ops Proxy contract
    IGelatoOps internal constant ops =
        IGelatoOps(0x6EDe1597c05A0ca77031cBA43Ab887ccf24cd7e8);

    // Yearn accounts
    address public management;
    address public owner;
    address payable public governance;
    address payable public pendingGovernance;

    // Yearn modifiers
    // ops.gelato() and address(ops) are the addresses allowed to run 'exec' on the Gelato side
    modifier onlyKeepers() {
        require(
            msg.sender == address(ops) ||
                msg.sender == owner ||
                msg.sender == management ||
                msg.sender == governance,
            "!keeper"
        );
        _;
    }

    modifier onlyAuthorized() {
        require(
            msg.sender == owner ||
                msg.sender == management ||
                msg.sender == governance,
            "!authorized"
        );
        _;
    }

    modifier onlyGovernance() {
        require(msg.sender == governance, "!governance");
        _;
    }

    // `HarvestedByGelato` is an event we emit when there's a succesful harvest
    event HarvestedByGelato(
        bytes32 jobId,
        address strategy,
        address gelatoFeeToken,
        uint256 gelatoFee
    );

    constructor() public {
        owner = msg.sender;
        management = msg.sender;
        governance = msg.sender;
    }

    /**
    @notice Create Gelato job that will monitor new strategies in Yearn Lens. When
    a new startegy is detected with its keeper set as yHarvest, yHarvest creates a
    gelato job for it. 
    */
    function initiateStrategyMonitor() external onlyAuthorized {
        jobIds[address(this)] = ops.createTaskNoPrepayment(
            address(this), // `execAddress`
            this.createJobAndPay.selector, // `execSelector`
            address(this), // `resolverAddress`
            abi.encodeWithSelector(this.checkNewStrategies.selector),
            feeToken
        );
    }

    /**
    @notice Creates Gelato job for a strategy. The job and resolver address are the same -- the
    Yearn Harvest contract. Updates `jobIds`, which we use to log events and
    to manage the job.
    @param strategyAddress Strategy Address for which a job will be created
    */
    function createJobAndPay(address strategyAddress) external onlyKeepers {
        createJob(strategyAddress);

        // `gelatoFee` and `gelatoFeeToken` are state variables in the gelato contract that
        // are temporarily modified by the executors before executing the payload. They are
        // reverted to default values when the gelato contract exec() method wraps up.
        (uint256 gelatoFee, address gelatoFeeToken) = ops.getFeeDetails();

        require(gelatoFeeToken == feeToken, "!token"); // dev: gelato not using intended token
        require(gelatoFee <= maxFee, "!fee"); // dev: gelato executor overcharnging for the tx

        // Pay Gelato for the service.
        payKeeper(gelatoFee);
    }

    /**
    @notice Like `createJobAndPay()` but without payment. We can use this function to 
    manually create new jobs, if needed (for example, if we have to manually cancel any
    and re-start it afterwards). 
    @param strategyAddress Strategy Address for which a job will be created
    */
    function createJob(address strategyAddress) public onlyKeepers {
        jobIds[strategyAddress] = ops.createTaskNoPrepayment(
            address(this), // `execAddress`
            this.harvestStrategy.selector, // `execSelector`
            address(this), // `resolverAddress`
            abi.encodeWithSelector(
                this.checkHarvestStatus.selector,
                strategyAddress
            ),
            feeToken
        );
    }

    /**
    @notice Cancel a Gelato job given a strategy address
    @dev cancelJob(address(this)) cancels the strategy monitor job
    @param strategyAddress Strategy for which to cancel a job
    */
    function cancelJob(address strategyAddress) external onlyAuthorized {
        require(jobIds[strategyAddress] != 0, "!exist");
        bytes32 jobId = jobIds[strategyAddress];
        ops.cancelTask(jobId);
        delete jobIds[strategyAddress];
    }

    /**
    @notice Used by keepers to determine whether a new strategy was added to Yearn Lens
    that has the yHarvest contract as its keeper.
    @return canExec boolean indicating whether a new strategy requires automation.
    @return execPayload call data used by Gelato executors to call createJob(). It
    includes the address of the strategy to harvest.
    */
    function checkNewStrategies()
        external
        view
        returns (bool canExec, bytes memory execPayload)
    {
        // Pull list of active strategies in production
        address[] memory strategies = aggregator.assetsStrategiesAddresses();

        // Check active strategies and return the first one that is ready to harvest.
        for (uint256 i = 0; i < strategies.length; i++) {
            // To enable automatic harvest() calls, a strategy must have the Yearn Harvest
            // contract as the keeper.
            if (StrategyAPI(strategies[i]).keeper() != address(this)) {
                continue;
            }

            if (jobIds[strategies[i]] == 0) {
                canExec = true;
                execPayload = execPayload = abi.encodeWithSelector(
                    this.createJobAndPay.selector,
                    strategies[i]
                );
                break;
            }
        }
    }

    /**
    @notice Used by keepers to check whether a strategy is ready to harvest. 
    @param strategyAddress Strategy for which to obtain a harvest status
    @return canExec boolean indicating whether the strategy is ready to harvest()
    @return execPayload call data used by Gelato executors to call harvestStrategy(). It
    includes the address of the strategy to harvest.
    */
    function checkHarvestStatus(address strategyAddress)
        external
        view
        returns (bool canExec, bytes memory execPayload)
    {
        require(jobIds[strategyAddress] != 0, "!job");

        // Declare a strategy objects
        StrategyAPI strategy = StrategyAPI(strategyAddress);

        // To enable automatic harvest() calls, a strategy must have the yHarvest
        // contract as the keeper.
        if (strategy.keeper() != address(this)) return (canExec, execPayload);

        // `callCostInWei` is a required input to the `harvestTrigger()` method of the strategy
        // and represents the expected cost to call `harvest()`. Fantom does not currently
        // offer the same global variables/functions that we have in mainnet -- block.basefee or
        // gasUsed() -- to estimate the cost to harvest.
        // For now, yHarvest uses a common, low fixed cost accross strategies so that the trigger
        // focuses on all other conditions

        // call the harvest trigger
        canExec = strategy.harvestTrigger(uint256(1e8));

        // If we can execute, prepare the payload
        if (canExec) {
            execPayload = abi.encodeWithSelector(
                this.harvestStrategy.selector,
                strategyAddress
            );
        }
    }

    /**
    @notice This is the executable method that Gelato keepers call to harvest a strategy.
    It checks that the executors are getting paid in the expected crytocurrency and that
    they do not overcharge for the tx. The method also pays executors.
    @param strategyAddress Strategy address to harvest
    */
    function harvestStrategy(address strategyAddress) public onlyKeepers {
        require(jobIds[strategyAddress] != 0, "!job");

        StrategyAPI strategy = StrategyAPI(strategyAddress);

        // `gelatoFee` and `gelatoFeeToken` are state variables in the gelato contract that
        // are temporarily modified by the executors before executing the payload. They are
        // reverted to default values when the gelato contract exec() method wraps up.
        (uint256 gelatoFee, address gelatoFeeToken) = ops.getFeeDetails();

        require(gelatoFeeToken == feeToken, "!token"); // dev: gelato not using intended token
        require(gelatoFee <= maxFee, "!fee"); // dev: gelato executor overcharnging for the tx

        // Re-run harvestTrigger() with the gelatoFee passed by the executor to ensure
        // the tx makes economic sense, and that harvestStrategy() is only called when
        // conditions are met.
        require(strategy.harvestTrigger(gelatoFee), "!economic");

        strategy.harvest();

        // Pay Gelato for the service.
        payKeeper(gelatoFee);

        emit HarvestedByGelato(
            jobIds[strategyAddress],
            strategyAddress,
            gelatoFeeToken,
            gelatoFee
        );
    }

    /**
    @notice Pays Gelato keepers.
    @param gelatoFee Fee amount to pay Gelato keepers. Determined by the keeper.
    */
    function payKeeper(uint256 gelatoFee) internal {
        address payable gelato = ops.gelato();

        (bool success, ) = gelato.call{value: gelatoFee}("");
        require(success, "!transfer");
    }

    /**
    @notice Set the max fee we allow Gelato to charge for a harvest
    @param _maxFee Max fee we allow Gelato to charge for a harvest.
    */
    function setMaxFee(uint256 _maxFee) external onlyAuthorized {
        maxFee = _maxFee;
    }

    /**
    @notice Used to change `owner`.
    @param _owner The new address to assign as `owner`.
    */
    function setOwner(address _owner) external onlyAuthorized {
        require(_owner != address(0));
        owner = _owner;
    }

    /**
    @notice Used to change `management`.
    @param _management The new address to assign as `management`.
    */
    function setManagement(address _management) external onlyAuthorized {
        require(_management != address(0));
        management = _management;
    }

    // 2-phase commit for a change in governance
    /**
    @notice
    Nominate a new address to use as governance.

    The change does not go into effect immediately. This function sets a
    pending change, and the governance address is not updated until
    the proposed governance address has accepted the responsibility.

    @param _governance The address requested to take over Vault governance.
    */
    function setGovernance(address payable _governance)
        external
        onlyGovernance
    {
        pendingGovernance = _governance;
    }

    /**
    @notice
    Once a new governance address has been proposed using setGovernance(),
    this function may be called by the proposed address to accept the
    responsibility of taking over governance for this contract.

    This may only be called by the proposed governance address.
    @dev
    setGovernance() should be called by the existing governance address,
    prior to calling this function.
    */
    function acceptGovernance() external {
        require(msg.sender == pendingGovernance, "!authorized");
        governance = pendingGovernance;
        delete pendingGovernance;
    }

    /**
    @notice Allows governance to transfer funds out of the contract
    @param _token The address of the token, which balance is to be transfered
    to the governance multisig.
    */
    function sweep(address _token) external onlyGovernance {
        uint256 amount;
        if (_token == feeToken) {
            amount = address(this).balance;
            (bool success, ) = governance.call{value: amount}("");
            require(success, "!transfer");
        } else {
            amount = IERC20(_token).balanceOf(address(this));
            SafeERC20.safeTransfer(IERC20(_token), governance, amount);
        }
    }

    // enables the contract to receive native crypto (ETH, FTM, AETH, etc)
    receive() external payable {}
}

File 2 of 7 : SafeMath.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 3 of 7 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.6.0;

import "IERC20.sol";
import "SafeMath.sol";
import "Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using 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 5 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 6 of 7 : BaseStrategy.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;

import "IERC20.sol";
import "SafeERC20.sol";
import "SafeMath.sol";

struct StrategyParams {
    uint256 performanceFee;
    uint256 activation;
    uint256 debtRatio;
    uint256 minDebtPerHarvest;
    uint256 maxDebtPerHarvest;
    uint256 lastReport;
    uint256 totalDebt;
    uint256 totalGain;
    uint256 totalLoss;
}

interface VaultAPI is IERC20 {
    function name() external view returns (string calldata);

    function symbol() external view returns (string calldata);

    function decimals() external view returns (uint256);

    function apiVersion() external pure returns (string memory);

    function permit(
        address owner,
        address spender,
        uint256 amount,
        uint256 expiry,
        bytes calldata signature
    ) external returns (bool);

    // NOTE: Vyper produces multiple signatures for a given function with "default" args
    function deposit() external returns (uint256);

    function deposit(uint256 amount) external returns (uint256);

    function deposit(uint256 amount, address recipient) external returns (uint256);

    // NOTE: Vyper produces multiple signatures for a given function with "default" args
    function withdraw() external returns (uint256);

    function withdraw(uint256 maxShares) external returns (uint256);

    function withdraw(uint256 maxShares, address recipient) external returns (uint256);

    function token() external view returns (address);

    function strategies(address _strategy) external view returns (StrategyParams memory);

    function pricePerShare() external view returns (uint256);

    function totalAssets() external view returns (uint256);

    function depositLimit() external view returns (uint256);

    function maxAvailableShares() external view returns (uint256);

    /**
     * View how much the Vault would increase this Strategy's borrow limit,
     * based on its present performance (since its last report). Can be used to
     * determine expectedReturn in your Strategy.
     */
    function creditAvailable() external view returns (uint256);

    /**
     * View how much the Vault would like to pull back from the Strategy,
     * based on its present performance (since its last report). Can be used to
     * determine expectedReturn in your Strategy.
     */
    function debtOutstanding() external view returns (uint256);

    /**
     * View how much the Vault expect this Strategy to return at the current
     * block, based on its present performance (since its last report). Can be
     * used to determine expectedReturn in your Strategy.
     */
    function expectedReturn() external view returns (uint256);

    /**
     * This is the main contact point where the Strategy interacts with the
     * Vault. It is critical that this call is handled as intended by the
     * Strategy. Therefore, this function will be called by BaseStrategy to
     * make sure the integration is correct.
     */
    function report(
        uint256 _gain,
        uint256 _loss,
        uint256 _debtPayment
    ) external returns (uint256);

    /**
     * This function should only be used in the scenario where the Strategy is
     * being retired but no migration of the positions are possible, or in the
     * extreme scenario that the Strategy needs to be put into "Emergency Exit"
     * mode in order for it to exit as quickly as possible. The latter scenario
     * could be for any reason that is considered "critical" that the Strategy
     * exits its position as fast as possible, such as a sudden change in
     * market conditions leading to losses, or an imminent failure in an
     * external dependency.
     */
    function revokeStrategy() external;

    /**
     * View the governance address of the Vault to assert privileged functions
     * can only be called by governance. The Strategy serves the Vault, so it
     * is subject to governance defined by the Vault.
     */
    function governance() external view returns (address);

    /**
     * View the management address of the Vault to assert privileged functions
     * can only be called by management. The Strategy serves the Vault, so it
     * is subject to management defined by the Vault.
     */
    function management() external view returns (address);

    /**
     * View the guardian address of the Vault to assert privileged functions
     * can only be called by guardian. The Strategy serves the Vault, so it
     * is subject to guardian defined by the Vault.
     */
    function guardian() external view returns (address);
}

/**
 * This interface is here for the keeper bot to use.
 */
interface StrategyAPI {
    function name() external view returns (string memory);

    function vault() external view returns (address);

    function want() external view returns (address);

    function apiVersion() external pure returns (string memory);

    function keeper() external view returns (address);

    function isActive() external view returns (bool);

    function delegatedAssets() external view returns (uint256);

    function estimatedTotalAssets() external view returns (uint256);

    function tendTrigger(uint256 callCost) external view returns (bool);

    function tend() external;

    function harvestTrigger(uint256 callCost) external view returns (bool);

    function harvest() external;

    event Harvested(uint256 profit, uint256 loss, uint256 debtPayment, uint256 debtOutstanding);
}

interface HealthCheck {
    function check(
        uint256 profit,
        uint256 loss,
        uint256 debtPayment,
        uint256 debtOutstanding,
        uint256 totalDebt
    ) external view returns (bool);
}

/**
 * @title Yearn Base Strategy
 * @author yearn.finance
 * @notice
 *  BaseStrategy implements all of the required functionality to interoperate
 *  closely with the Vault contract. This contract should be inherited and the
 *  abstract methods implemented to adapt the Strategy to the particular needs
 *  it has to create a return.
 *
 *  Of special interest is the relationship between `harvest()` and
 *  `vault.report()'. `harvest()` may be called simply because enough time has
 *  elapsed since the last report, and not because any funds need to be moved
 *  or positions adjusted. This is critical so that the Vault may maintain an
 *  accurate picture of the Strategy's performance. See  `vault.report()`,
 *  `harvest()`, and `harvestTrigger()` for further details.
 */

abstract contract BaseStrategy {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    string public metadataURI;

    // health checks
    bool public doHealthCheck;
    address public healthCheck;

    /**
     * @notice
     *  Used to track which version of `StrategyAPI` this Strategy
     *  implements.
     * @dev The Strategy's version must match the Vault's `API_VERSION`.
     * @return A string which holds the current API version of this contract.
     */
    function apiVersion() public pure returns (string memory) {
        return "0.4.3";
    }

    /**
     * @notice This Strategy's name.
     * @dev
     *  You can use this field to manage the "version" of this Strategy, e.g.
     *  `StrategySomethingOrOtherV1`. However, "API Version" is managed by
     *  `apiVersion()` function above.
     * @return This Strategy's name.
     */
    function name() external view virtual returns (string memory);

    /**
     * @notice
     *  The amount (priced in want) of the total assets managed by this strategy should not count
     *  towards Yearn's TVL calculations.
     * @dev
     *  You can override this field to set it to a non-zero value if some of the assets of this
     *  Strategy is somehow delegated inside another part of of Yearn's ecosystem e.g. another Vault.
     *  Note that this value must be strictly less than or equal to the amount provided by
     *  `estimatedTotalAssets()` below, as the TVL calc will be total assets minus delegated assets.
     *  Also note that this value is used to determine the total assets under management by this
     *  strategy, for the purposes of computing the management fee in `Vault`
     * @return
     *  The amount of assets this strategy manages that should not be included in Yearn's Total Value
     *  Locked (TVL) calculation across it's ecosystem.
     */
    function delegatedAssets() external view virtual returns (uint256) {
        return 0;
    }

    VaultAPI public vault;
    address public strategist;
    address public rewards;
    address public keeper;

    IERC20 public want;

    // So indexers can keep track of this
    event Harvested(uint256 profit, uint256 loss, uint256 debtPayment, uint256 debtOutstanding);

    event UpdatedStrategist(address newStrategist);

    event UpdatedKeeper(address newKeeper);

    event UpdatedRewards(address rewards);

    event UpdatedMinReportDelay(uint256 delay);

    event UpdatedMaxReportDelay(uint256 delay);

    event UpdatedProfitFactor(uint256 profitFactor);

    event UpdatedDebtThreshold(uint256 debtThreshold);

    event EmergencyExitEnabled();

    event UpdatedMetadataURI(string metadataURI);

    event SetHealthCheck(address);
    event SetDoHealthCheck(bool);

    // The minimum number of seconds between harvest calls. See
    // `setMinReportDelay()` for more details.
    uint256 public minReportDelay;

    // The maximum number of seconds between harvest calls. See
    // `setMaxReportDelay()` for more details.
    uint256 public maxReportDelay;

    // The minimum multiple that `callCost` must be above the credit/profit to
    // be "justifiable". See `setProfitFactor()` for more details.
    uint256 public profitFactor;

    // Use this to adjust the threshold at which running a debt causes a
    // harvest trigger. See `setDebtThreshold()` for more details.
    uint256 public debtThreshold;

    // See note on `setEmergencyExit()`.
    bool public emergencyExit;

    // modifiers
    modifier onlyAuthorized() {
        require(msg.sender == strategist || msg.sender == governance(), "!authorized");
        _;
    }

    modifier onlyEmergencyAuthorized() {
        require(
            msg.sender == strategist || msg.sender == governance() || msg.sender == vault.guardian() || msg.sender == vault.management(),
            "!authorized"
        );
        _;
    }

    modifier onlyStrategist() {
        require(msg.sender == strategist, "!strategist");
        _;
    }

    modifier onlyGovernance() {
        require(msg.sender == governance(), "!authorized");
        _;
    }

    modifier onlyKeepers() {
        require(
            msg.sender == keeper ||
                msg.sender == strategist ||
                msg.sender == governance() ||
                msg.sender == vault.guardian() ||
                msg.sender == vault.management(),
            "!authorized"
        );
        _;
    }

    modifier onlyVaultManagers() {
        require(msg.sender == vault.management() || msg.sender == governance(), "!authorized");
        _;
    }

    constructor(address _vault) public {
        _initialize(_vault, msg.sender, msg.sender, msg.sender);
    }

    /**
     * @notice
     *  Initializes the Strategy, this is called only once, when the
     *  contract is deployed.
     * @dev `_vault` should implement `VaultAPI`.
     * @param _vault The address of the Vault responsible for this Strategy.
     * @param _strategist The address to assign as `strategist`.
     * The strategist is able to change the reward address
     * @param _rewards  The address to use for pulling rewards.
     * @param _keeper The adddress of the _keeper. _keeper
     * can harvest and tend a strategy.
     */
    function _initialize(
        address _vault,
        address _strategist,
        address _rewards,
        address _keeper
    ) internal {
        require(address(want) == address(0), "Strategy already initialized");

        vault = VaultAPI(_vault);
        want = IERC20(vault.token());
        want.safeApprove(_vault, uint256(-1)); // Give Vault unlimited access (might save gas)
        strategist = _strategist;
        rewards = _rewards;
        keeper = _keeper;

        // initialize variables
        minReportDelay = 0;
        maxReportDelay = 86400;
        profitFactor = 100;
        debtThreshold = 0;

        vault.approve(rewards, uint256(-1)); // Allow rewards to be pulled
    }

    function setHealthCheck(address _healthCheck) external onlyVaultManagers {
        emit SetHealthCheck(_healthCheck);
        healthCheck = _healthCheck;
    }

    function setDoHealthCheck(bool _doHealthCheck) external onlyVaultManagers {
        emit SetDoHealthCheck(_doHealthCheck);
        doHealthCheck = _doHealthCheck;
    }

    /**
     * @notice
     *  Used to change `strategist`.
     *
     *  This may only be called by governance or the existing strategist.
     * @param _strategist The new address to assign as `strategist`.
     */
    function setStrategist(address _strategist) external onlyAuthorized {
        require(_strategist != address(0));
        strategist = _strategist;
        emit UpdatedStrategist(_strategist);
    }

    /**
     * @notice
     *  Used to change `keeper`.
     *
     *  `keeper` is the only address that may call `tend()` or `harvest()`,
     *  other than `governance()` or `strategist`. However, unlike
     *  `governance()` or `strategist`, `keeper` may *only* call `tend()`
     *  and `harvest()`, and no other authorized functions, following the
     *  principle of least privilege.
     *
     *  This may only be called by governance or the strategist.
     * @param _keeper The new address to assign as `keeper`.
     */
    function setKeeper(address _keeper) external onlyAuthorized {
        require(_keeper != address(0));
        keeper = _keeper;
        emit UpdatedKeeper(_keeper);
    }

    /**
     * @notice
     *  Used to change `rewards`. EOA or smart contract which has the permission
     *  to pull rewards from the vault.
     *
     *  This may only be called by the strategist.
     * @param _rewards The address to use for pulling rewards.
     */
    function setRewards(address _rewards) external onlyStrategist {
        require(_rewards != address(0));
        vault.approve(rewards, 0);
        rewards = _rewards;
        vault.approve(rewards, uint256(-1));
        emit UpdatedRewards(_rewards);
    }

    /**
     * @notice
     *  Used to change `minReportDelay`. `minReportDelay` is the minimum number
     *  of blocks that should pass for `harvest()` to be called.
     *
     *  For external keepers (such as the Keep3r network), this is the minimum
     *  time between jobs to wait. (see `harvestTrigger()`
     *  for more details.)
     *
     *  This may only be called by governance or the strategist.
     * @param _delay The minimum number of seconds to wait between harvests.
     */
    function setMinReportDelay(uint256 _delay) external onlyAuthorized {
        minReportDelay = _delay;
        emit UpdatedMinReportDelay(_delay);
    }

    /**
     * @notice
     *  Used to change `maxReportDelay`. `maxReportDelay` is the maximum number
     *  of blocks that should pass for `harvest()` to be called.
     *
     *  For external keepers (such as the Keep3r network), this is the maximum
     *  time between jobs to wait. (see `harvestTrigger()`
     *  for more details.)
     *
     *  This may only be called by governance or the strategist.
     * @param _delay The maximum number of seconds to wait between harvests.
     */
    function setMaxReportDelay(uint256 _delay) external onlyAuthorized {
        maxReportDelay = _delay;
        emit UpdatedMaxReportDelay(_delay);
    }

    /**
     * @notice
     *  Used to change `profitFactor`. `profitFactor` is used to determine
     *  if it's worthwhile to harvest, given gas costs. (See `harvestTrigger()`
     *  for more details.)
     *
     *  This may only be called by governance or the strategist.
     * @param _profitFactor A ratio to multiply anticipated
     * `harvest()` gas cost against.
     */
    function setProfitFactor(uint256 _profitFactor) external onlyAuthorized {
        profitFactor = _profitFactor;
        emit UpdatedProfitFactor(_profitFactor);
    }

    /**
     * @notice
     *  Sets how far the Strategy can go into loss without a harvest and report
     *  being required.
     *
     *  By default this is 0, meaning any losses would cause a harvest which
     *  will subsequently report the loss to the Vault for tracking. (See
     *  `harvestTrigger()` for more details.)
     *
     *  This may only be called by governance or the strategist.
     * @param _debtThreshold How big of a loss this Strategy may carry without
     * being required to report to the Vault.
     */
    function setDebtThreshold(uint256 _debtThreshold) external onlyAuthorized {
        debtThreshold = _debtThreshold;
        emit UpdatedDebtThreshold(_debtThreshold);
    }

    /**
     * @notice
     *  Used to change `metadataURI`. `metadataURI` is used to store the URI
     * of the file describing the strategy.
     *
     *  This may only be called by governance or the strategist.
     * @param _metadataURI The URI that describe the strategy.
     */
    function setMetadataURI(string calldata _metadataURI) external onlyAuthorized {
        metadataURI = _metadataURI;
        emit UpdatedMetadataURI(_metadataURI);
    }

    /**
     * Resolve governance address from Vault contract, used to make assertions
     * on protected functions in the Strategy.
     */
    function governance() internal view returns (address) {
        return vault.governance();
    }

    /**
     * @notice
     *  Provide an accurate conversion from `_amtInWei` (denominated in wei)
     *  to `want` (using the native decimal characteristics of `want`).
     * @dev
     *  Care must be taken when working with decimals to assure that the conversion
     *  is compatible. As an example:
     *
     *      given 1e17 wei (0.1 ETH) as input, and want is USDC (6 decimals),
     *      with USDC/ETH = 1800, this should give back 1800000000 (180 USDC)
     *
     * @param _amtInWei The amount (in wei/1e-18 ETH) to convert to `want`
     * @return The amount in `want` of `_amtInEth` converted to `want`
     **/
    function ethToWant(uint256 _amtInWei) public view virtual returns (uint256);

    /**
     * @notice
     *  Provide an accurate estimate for the total amount of assets
     *  (principle + return) that this Strategy is currently managing,
     *  denominated in terms of `want` tokens.
     *
     *  This total should be "realizable" e.g. the total value that could
     *  *actually* be obtained from this Strategy if it were to divest its
     *  entire position based on current on-chain conditions.
     * @dev
     *  Care must be taken in using this function, since it relies on external
     *  systems, which could be manipulated by the attacker to give an inflated
     *  (or reduced) value produced by this function, based on current on-chain
     *  conditions (e.g. this function is possible to influence through
     *  flashloan attacks, oracle manipulations, or other DeFi attack
     *  mechanisms).
     *
     *  It is up to governance to use this function to correctly order this
     *  Strategy relative to its peers in the withdrawal queue to minimize
     *  losses for the Vault based on sudden withdrawals. This value should be
     *  higher than the total debt of the Strategy and higher than its expected
     *  value to be "safe".
     * @return The estimated total assets in this Strategy.
     */
    function estimatedTotalAssets() public view virtual returns (uint256);

    /*
     * @notice
     *  Provide an indication of whether this strategy is currently "active"
     *  in that it is managing an active position, or will manage a position in
     *  the future. This should correlate to `harvest()` activity, so that Harvest
     *  events can be tracked externally by indexing agents.
     * @return True if the strategy is actively managing a position.
     */
    function isActive() public view returns (bool) {
        return vault.strategies(address(this)).debtRatio > 0 || estimatedTotalAssets() > 0;
    }

    /**
     * Perform any Strategy unwinding or other calls necessary to capture the
     * "free return" this Strategy has generated since the last time its core
     * position(s) were adjusted. Examples include unwrapping extra rewards.
     * This call is only used during "normal operation" of a Strategy, and
     * should be optimized to minimize losses as much as possible.
     *
     * This method returns any realized profits and/or realized losses
     * incurred, and should return the total amounts of profits/losses/debt
     * payments (in `want` tokens) for the Vault's accounting (e.g.
     * `want.balanceOf(this) >= _debtPayment + _profit`).
     *
     * `_debtOutstanding` will be 0 if the Strategy is not past the configured
     * debt limit, otherwise its value will be how far past the debt limit
     * the Strategy is. The Strategy's debt limit is configured in the Vault.
     *
     * NOTE: `_debtPayment` should be less than or equal to `_debtOutstanding`.
     *       It is okay for it to be less than `_debtOutstanding`, as that
     *       should only used as a guide for how much is left to pay back.
     *       Payments should be made to minimize loss from slippage, debt,
     *       withdrawal fees, etc.
     *
     * See `vault.debtOutstanding()`.
     */
    function prepareReturn(uint256 _debtOutstanding)
        internal
        virtual
        returns (
            uint256 _profit,
            uint256 _loss,
            uint256 _debtPayment
        );

    /**
     * Perform any adjustments to the core position(s) of this Strategy given
     * what change the Vault made in the "investable capital" available to the
     * Strategy. Note that all "free capital" in the Strategy after the report
     * was made is available for reinvestment. Also note that this number
     * could be 0, and you should handle that scenario accordingly.
     *
     * See comments regarding `_debtOutstanding` on `prepareReturn()`.
     */
    function adjustPosition(uint256 _debtOutstanding) internal virtual;

    /**
     * Liquidate up to `_amountNeeded` of `want` of this strategy's positions,
     * irregardless of slippage. Any excess will be re-invested with `adjustPosition()`.
     * This function should return the amount of `want` tokens made available by the
     * liquidation. If there is a difference between them, `_loss` indicates whether the
     * difference is due to a realized loss, or if there is some other sitution at play
     * (e.g. locked funds) where the amount made available is less than what is needed.
     *
     * NOTE: The invariant `_liquidatedAmount + _loss <= _amountNeeded` should always be maintained
     */
    function liquidatePosition(uint256 _amountNeeded) internal virtual returns (uint256 _liquidatedAmount, uint256 _loss);

    /**
     * Liquidate everything and returns the amount that got freed.
     * This function is used during emergency exit instead of `prepareReturn()` to
     * liquidate all of the Strategy's positions back to the Vault.
     */

    function liquidateAllPositions() internal virtual returns (uint256 _amountFreed);

    /**
     * @notice
     *  Provide a signal to the keeper that `tend()` should be called. The
     *  keeper will provide the estimated gas cost that they would pay to call
     *  `tend()`, and this function should use that estimate to make a
     *  determination if calling it is "worth it" for the keeper. This is not
     *  the only consideration into issuing this trigger, for example if the
     *  position would be negatively affected if `tend()` is not called
     *  shortly, then this can return `true` even if the keeper might be
     *  "at a loss" (keepers are always reimbursed by Yearn).
     * @dev
     *  `callCostInWei` must be priced in terms of `wei` (1e-18 ETH).
     *
     *  This call and `harvestTrigger()` should never return `true` at the same
     *  time.
     * @param callCostInWei The keeper's estimated gas cost to call `tend()` (in wei).
     * @return `true` if `tend()` should be called, `false` otherwise.
     */
    function tendTrigger(uint256 callCostInWei) public view virtual returns (bool) {
        // We usually don't need tend, but if there are positions that need
        // active maintainence, overriding this function is how you would
        // signal for that.
        // If your implementation uses the cost of the call in want, you can
        // use uint256 callCost = ethToWant(callCostInWei);

        return false;
    }

    /**
     * @notice
     *  Adjust the Strategy's position. The purpose of tending isn't to
     *  realize gains, but to maximize yield by reinvesting any returns.
     *
     *  See comments on `adjustPosition()`.
     *
     *  This may only be called by governance, the strategist, or the keeper.
     */
    function tend() external onlyKeepers {
        // Don't take profits with this call, but adjust for better gains
        adjustPosition(vault.debtOutstanding());
    }

    /**
     * @notice
     *  Provide a signal to the keeper that `harvest()` should be called. The
     *  keeper will provide the estimated gas cost that they would pay to call
     *  `harvest()`, and this function should use that estimate to make a
     *  determination if calling it is "worth it" for the keeper. This is not
     *  the only consideration into issuing this trigger, for example if the
     *  position would be negatively affected if `harvest()` is not called
     *  shortly, then this can return `true` even if the keeper might be "at a
     *  loss" (keepers are always reimbursed by Yearn).
     * @dev
     *  `callCostInWei` must be priced in terms of `wei` (1e-18 ETH).
     *
     *  This call and `tendTrigger` should never return `true` at the
     *  same time.
     *
     *  See `min/maxReportDelay`, `profitFactor`, `debtThreshold` to adjust the
     *  strategist-controlled parameters that will influence whether this call
     *  returns `true` or not. These parameters will be used in conjunction
     *  with the parameters reported to the Vault (see `params`) to determine
     *  if calling `harvest()` is merited.
     *
     *  It is expected that an external system will check `harvestTrigger()`.
     *  This could be a script run off a desktop or cloud bot (e.g.
     *  https://github.com/iearn-finance/yearn-vaults/blob/main/scripts/keep.py),
     *  or via an integration with the Keep3r network (e.g.
     *  https://github.com/Macarse/GenericKeep3rV2/blob/master/contracts/keep3r/GenericKeep3rV2.sol).
     * @param callCostInWei The keeper's estimated gas cost to call `harvest()` (in wei).
     * @return `true` if `harvest()` should be called, `false` otherwise.
     */
    function harvestTrigger(uint256 callCostInWei) public view virtual returns (bool) {
        uint256 callCost = ethToWant(callCostInWei);
        StrategyParams memory params = vault.strategies(address(this));

        // Should not trigger if Strategy is not activated
        if (params.activation == 0) return false;

        // Should not trigger if we haven't waited long enough since previous harvest
        if (block.timestamp.sub(params.lastReport) < minReportDelay) return false;

        // Should trigger if hasn't been called in a while
        if (block.timestamp.sub(params.lastReport) >= maxReportDelay) return true;

        // If some amount is owed, pay it back
        // NOTE: Since debt is based on deposits, it makes sense to guard against large
        //       changes to the value from triggering a harvest directly through user
        //       behavior. This should ensure reasonable resistance to manipulation
        //       from user-initiated withdrawals as the outstanding debt fluctuates.
        uint256 outstanding = vault.debtOutstanding();
        if (outstanding > debtThreshold) return true;

        // Check for profits and losses
        uint256 total = estimatedTotalAssets();
        // Trigger if we have a loss to report
        if (total.add(debtThreshold) < params.totalDebt) return true;

        uint256 profit = 0;
        if (total > params.totalDebt) profit = total.sub(params.totalDebt); // We've earned a profit!

        // Otherwise, only trigger if it "makes sense" economically (gas cost
        // is <N% of value moved)
        uint256 credit = vault.creditAvailable();
        return (profitFactor.mul(callCost) < credit.add(profit));
    }

    /**
     * @notice
     *  Harvests the Strategy, recognizing any profits or losses and adjusting
     *  the Strategy's position.
     *
     *  In the rare case the Strategy is in emergency shutdown, this will exit
     *  the Strategy's position.
     *
     *  This may only be called by governance, the strategist, or the keeper.
     * @dev
     *  When `harvest()` is called, the Strategy reports to the Vault (via
     *  `vault.report()`), so in some cases `harvest()` must be called in order
     *  to take in profits, to borrow newly available funds from the Vault, or
     *  otherwise adjust its position. In other cases `harvest()` must be
     *  called to report to the Vault on the Strategy's position, especially if
     *  any losses have occurred.
     */
    function harvest() external onlyKeepers {
        uint256 profit = 0;
        uint256 loss = 0;
        uint256 debtOutstanding = vault.debtOutstanding();
        uint256 debtPayment = 0;
        if (emergencyExit) {
            // Free up as much capital as possible
            uint256 amountFreed = liquidateAllPositions();
            if (amountFreed < debtOutstanding) {
                loss = debtOutstanding.sub(amountFreed);
            } else if (amountFreed > debtOutstanding) {
                profit = amountFreed.sub(debtOutstanding);
            }
            debtPayment = debtOutstanding.sub(loss);
        } else {
            // Free up returns for Vault to pull
            (profit, loss, debtPayment) = prepareReturn(debtOutstanding);
        }

        // Allow Vault to take up to the "harvested" balance of this contract,
        // which is the amount it has earned since the last time it reported to
        // the Vault.
        uint256 totalDebt = vault.strategies(address(this)).totalDebt;
        debtOutstanding = vault.report(profit, loss, debtPayment);

        // Check if free returns are left, and re-invest them
        adjustPosition(debtOutstanding);

        // call healthCheck contract
        if (doHealthCheck && healthCheck != address(0)) {
            require(HealthCheck(healthCheck).check(profit, loss, debtPayment, debtOutstanding, totalDebt), "!healthcheck");
        } else {
            emit SetDoHealthCheck(true);
            doHealthCheck = true;
        }

        emit Harvested(profit, loss, debtPayment, debtOutstanding);
    }

    /**
     * @notice
     *  Withdraws `_amountNeeded` to `vault`.
     *
     *  This may only be called by the Vault.
     * @param _amountNeeded How much `want` to withdraw.
     * @return _loss Any realized losses
     */
    function withdraw(uint256 _amountNeeded) external returns (uint256 _loss) {
        require(msg.sender == address(vault), "!vault");
        // Liquidate as much as possible to `want`, up to `_amountNeeded`
        uint256 amountFreed;
        (amountFreed, _loss) = liquidatePosition(_amountNeeded);
        // Send it directly back (NOTE: Using `msg.sender` saves some gas here)
        want.safeTransfer(msg.sender, amountFreed);
        // NOTE: Reinvest anything leftover on next `tend`/`harvest`
    }

    /**
     * Do anything necessary to prepare this Strategy for migration, such as
     * transferring any reserve or LP tokens, CDPs, or other tokens or stores of
     * value.
     */
    function prepareMigration(address _newStrategy) internal virtual;

    /**
     * @notice
     *  Transfers all `want` from this Strategy to `_newStrategy`.
     *
     *  This may only be called by the Vault.
     * @dev
     * The new Strategy's Vault must be the same as this Strategy's Vault.
     *  The migration process should be carefully performed to make sure all
     * the assets are migrated to the new address, which should have never
     * interacted with the vault before.
     * @param _newStrategy The Strategy to migrate to.
     */
    function migrate(address _newStrategy) external {
        require(msg.sender == address(vault));
        require(BaseStrategy(_newStrategy).vault() == vault);
        prepareMigration(_newStrategy);
        want.safeTransfer(_newStrategy, want.balanceOf(address(this)));
    }

    /**
     * @notice
     *  Activates emergency exit. Once activated, the Strategy will exit its
     *  position upon the next harvest, depositing all funds into the Vault as
     *  quickly as is reasonable given on-chain conditions.
     *
     *  This may only be called by governance or the strategist.
     * @dev
     *  See `vault.setEmergencyShutdown()` and `harvest()` for further details.
     */
    function setEmergencyExit() external onlyEmergencyAuthorized {
        emergencyExit = true;
        vault.revokeStrategy();

        emit EmergencyExitEnabled();
    }

    /**
     * Override this to add all tokens/tokenized positions this contract
     * manages on a *persistent* basis (e.g. not just for swapping back to
     * want ephemerally).
     *
     * NOTE: Do *not* include `want`, already included in `sweep` below.
     *
     * Example:
     * ```
     *    function protectedTokens() internal override view returns (address[] memory) {
     *      address[] memory protected = new address[](3);
     *      protected[0] = tokenA;
     *      protected[1] = tokenB;
     *      protected[2] = tokenC;
     *      return protected;
     *    }
     * ```
     */
    function protectedTokens() internal view virtual returns (address[] memory);

    /**
     * @notice
     *  Removes tokens from this Strategy that are not the type of tokens
     *  managed by this Strategy. This may be used in case of accidentally
     *  sending the wrong kind of token to this Strategy.
     *
     *  Tokens will be sent to `governance()`.
     *
     *  This will fail if an attempt is made to sweep `want`, or any tokens
     *  that are protected by this Strategy.
     *
     *  This may only be called by governance.
     * @dev
     *  Implement `protectedTokens()` to specify any additional tokens that
     *  should be protected from sweeping in addition to `want`.
     * @param _token The token to transfer out of this vault.
     */
    function sweep(address _token) external onlyGovernance {
        require(_token != address(want), "!want");
        require(_token != address(vault), "!shares");

        address[] memory _protectedTokens = protectedTokens();
        for (uint256 i; i < _protectedTokens.length; i++) require(_token != _protectedTokens[i], "!protected");

        IERC20(_token).safeTransfer(governance(), IERC20(_token).balanceOf(address(this)));
    }
}

abstract contract BaseStrategyInitializable is BaseStrategy {
    bool public isOriginal = true;
    event Cloned(address indexed clone);

    constructor(address _vault) public BaseStrategy(_vault) {}

    function initialize(
        address _vault,
        address _strategist,
        address _rewards,
        address _keeper
    ) external virtual {
        _initialize(_vault, _strategist, _rewards, _keeper);
    }

    function clone(address _vault) external returns (address) {
        require(isOriginal, "!clone");
        return this.clone(_vault, msg.sender, msg.sender, msg.sender);
    }

    function clone(
        address _vault,
        address _strategist,
        address _rewards,
        address _keeper
    ) external returns (address newStrategy) {
        // Copied from https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol
        bytes20 addressBytes = bytes20(address(this));

        assembly {
            // EIP-1167 bytecode
            let clone_code := mload(0x40)
            mstore(clone_code, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(clone_code, 0x14), addressBytes)
            mstore(add(clone_code, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            newStrategy := create(0, clone_code, 0x37)
        }

        BaseStrategyInitializable(newStrategy).initialize(_vault, _strategist, _rewards, _keeper);

        emit Cloned(newStrategy);
    }
}

File 7 of 7 : IGelato.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import {SafeERC20, IERC20} from "SafeERC20.sol";

interface IGelatoOps {
    function createTask(
        address _execAddress,
        bytes4 _execSelector,
        address _resolverAddress,
        bytes calldata _resolverData
    ) external returns (bytes32 task);

    function createTaskNoPrepayment(
        address _execAddress,
        bytes4 _execSelector,
        address _resolverAddress,
        bytes calldata _resolverData,
        address _feeToken
    ) external returns (bytes32 task);

    function getFeeDetails() external view returns (uint256, address);

    /// @notice Cancel a task so that Gelato can no longer execute it
    /// @param _taskId The hash of the task, can be computed using getTaskId()
    function cancelTask(bytes32 _taskId) external;

    function getTaskId(
        address _taskCreator,
        address _execAddress,
        bytes4 _selector,
        bool _useTaskTreasuryFunds,
        address _feeToken,
        bytes32 _resolverHash
    ) external pure returns (bytes32);

    function getResolverHash(
        address _resolverAddress,
        bytes memory _resolverData
    ) external pure returns (bytes32);

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

    function exec(
        uint256 _txFee,
        address _feeToken,
        address _taskCreator,
        bool _useTaskTreasuryFunds,
        bool _revertOnFailure,
        bytes32 _resolverHash,
        address _execAddress,
        bytes calldata _execData
    ) external;

    function getTaskIdsByUser(address _taskCreator)
        external
        view
        returns (bytes32[] memory);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"jobId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"address","name":"gelatoFeeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"gelatoFee","type":"uint256"}],"name":"HarvestedByGelato","type":"event"},{"inputs":[],"name":"acceptGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategyAddress","type":"address"}],"name":"cancelJob","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategyAddress","type":"address"}],"name":"checkHarvestStatus","outputs":[{"internalType":"bool","name":"canExec","type":"bool"},{"internalType":"bytes","name":"execPayload","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkNewStrategies","outputs":[{"internalType":"bool","name":"canExec","type":"bool"},{"internalType":"bytes","name":"execPayload","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"strategyAddress","type":"address"}],"name":"createJob","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategyAddress","type":"address"}],"name":"createJobAndPay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"strategyAddress","type":"address"}],"name":"harvestStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initiateStrategyMonitor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"jobIds","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"management","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingGovernance","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_management","type":"address"}],"name":"setManagement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxFee","type":"uint256"}],"name":"setMaxFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052670de0b6b3a764000060015534801561001c57600080fd5b5060038054336001600160a01b0319918216811790925560028054821683179055600480549091169091179055611b43806100586000396000f3fe6080604052600436106101235760003560e01c806364db71b8116100a0578063b7a921b911610064578063b7a921b9146102f5578063cc51ac221461030a578063d004e9851461032a578063d4a22bde1461034a578063f39c38a01461036a5761012a565b806364db71b81461026b578063710e5d2f1461028b57806388a8d602146102ab5780638da5cb5b146102c0578063ab033ea9146102d55761012a565b80633970c50e116100e75780633970c50e146101d15780635a70824c146101ff5780635aa6e6751461021457806361f13e0014610236578063647846a5146102565761012a565b806301681a621461012f57806301f59d161461015157806313af40351461017c57806315cd41de1461019c578063238efcbc146101bc5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b5061014f61014a366004611660565b61037f565b005b34801561015d57600080fd5b50610166610500565b60405161017391906118af565b60405180910390f35b34801561018857600080fd5b5061014f610197366004611660565b610506565b3480156101a857600080fd5b506101666101b7366004611660565b61058f565b3480156101c857600080fd5b5061014f6105a1565b3480156101dd57600080fd5b506101f16101ec366004611660565b6105f2565b604051610173929190611894565b34801561020b57600080fd5b506101f161079b565b34801561022057600080fd5b50610229610991565b6040516101739190611814565b34801561024257600080fd5b5061014f610251366004611660565b6109a0565b34801561026257600080fd5b50610229610c86565b34801561027757600080fd5b5061014f610286366004611660565b610c9e565b34801561029757600080fd5b5061014f6102a6366004611782565b610dc7565b3480156102b757600080fd5b50610229610e20565b3480156102cc57600080fd5b50610229610e2f565b3480156102e157600080fd5b5061014f6102f0366004611660565b610e3e565b34801561030157600080fd5b5061014f610e8a565b34801561031657600080fd5b5061014f610325366004611660565b610fc2565b34801561033657600080fd5b5061014f610345366004611660565b611135565b34801561035657600080fd5b5061014f610365366004611660565b6112b9565b34801561037657600080fd5b50610229611342565b6004546001600160a01b031633146103b25760405162461bcd60e51b81526004016103a990611933565b60405180910390fd5b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610465575060045460405147916000916001600160a01b039091169083906103fc90611811565b60006040518083038185875af1925050503d8060008114610439576040519150601f19603f3d011682016040523d82523d6000602084013e61043e565b606091505b505090508061045f5760405162461bcd60e51b81526004016103a9906119b7565b506104fc565b6040516370a0823160e01b81526001600160a01b038316906370a0823190610491903090600401611814565b60206040518083038186803b1580156104a957600080fd5b505afa1580156104bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e1919061176a565b6004549091506104fc9083906001600160a01b031683611351565b5050565b60015481565b6003546001600160a01b031633148061052957506002546001600160a01b031633145b8061053e57506004546001600160a01b031633145b61055a5760405162461bcd60e51b81526004016103a990611a11565b6001600160a01b03811661056d57600080fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006020819052908152604090205481565b6005546001600160a01b031633146105cb5760405162461bcd60e51b81526004016103a990611a11565b60058054600480546001600160a01b03199081166001600160a01b03841617909155169055565b6001600160a01b03811660009081526020819052604081205460609061062a5760405162461bcd60e51b81526004016103a990611a36565b6000839050306001600160a01b0316816001600160a01b031663aced16616040518163ffffffff1660e01b815260040160206040518083038186803b15801561067257600080fd5b505afa158015610686573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106aa9190611683565b6001600160a01b0316146106be5750610796565b60405163ed882c2b60e01b81526001600160a01b0382169063ed882c2b906106ee906305f5e100906004016118af565b60206040518083038186803b15801561070657600080fd5b505afa15801561071a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073e919061174a565b92508215610794576040516230f89f60e91b9061075f908690602401611814565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915291505b505b915091565b60006060807397d0be2a72fc4db90ed9dbc2ea7f03b4968f69386001600160a01b031663474119196040518163ffffffff1660e01b815260040160006040518083038186803b1580156107ed57600080fd5b505afa158015610801573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610829919081019061169f565b905060005b815181101561098b57306001600160a01b031682828151811061084d57fe5b60200260200101516001600160a01b031663aced16616040518163ffffffff1660e01b815260040160206040518083038186803b15801561088d57600080fd5b505afa1580156108a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c59190611683565b6001600160a01b0316146108d857610983565b6000808383815181106108e757fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020546000801b1415610983576001935063cc51ac2260e01b82828151811061093257fe5b602002602001015160405160240161094a9190611814565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152925061098b565b60010161082e565b50509091565b6004546001600160a01b031681565b33736ede1597c05a0ca77031cba43ab887ccf24cd7e814806109cc57506003546001600160a01b031633145b806109e157506002546001600160a01b031633145b806109f657506004546001600160a01b031633145b610a125760405162461bcd60e51b81526004016103a990611996565b6001600160a01b038116600090815260208190526040902054610a475760405162461bcd60e51b81526004016103a990611a36565b6000819050600080736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663b810c6366040518163ffffffff1660e01b8152600401604080518083038186803b158015610a9b57600080fd5b505afa158015610aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad3919061179a565b90925090506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610b145760405162461bcd60e51b81526004016103a990611976565b600154821115610b365760405162461bcd60e51b81526004016103a990611958565b60405163ed882c2b60e01b81526001600160a01b0384169063ed882c2b90610b629085906004016118af565b60206040518083038186803b158015610b7a57600080fd5b505afa158015610b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb2919061174a565b610bce5760405162461bcd60e51b81526004016103a990611910565b826001600160a01b0316634641257d6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610c0957600080fd5b505af1158015610c1d573d6000803e3d6000fd5b50505050610c2a826113a7565b6001600160a01b038416600090815260208190526040908190205490517fcd3d36a669b0143461074f3ed708d2aa3a57798004c8f7a34380a3146937767091610c78918790859087906118b8565b60405180910390a150505050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6003546001600160a01b0316331480610cc157506002546001600160a01b031633145b80610cd657506004546001600160a01b031633145b610cf25760405162461bcd60e51b81526004016103a990611a11565b6001600160a01b038116600090815260208190526040902054610d275760405162461bcd60e51b81526004016103a9906118f0565b6001600160a01b0381166000908152602081905260409081902054905163ee8ca3b560e01b8152736ede1597c05a0ca77031cba43ab887ccf24cd7e89063ee8ca3b590610d789084906004016118af565b600060405180830381600087803b158015610d9257600080fd5b505af1158015610da6573d6000803e3d6000fd5b5050506001600160a01b039092166000908152602081905260408120555050565b6003546001600160a01b0316331480610dea57506002546001600160a01b031633145b80610dff57506004546001600160a01b031633145b610e1b5760405162461bcd60e51b81526004016103a990611a11565b600155565b6002546001600160a01b031681565b6003546001600160a01b031681565b6004546001600160a01b03163314610e685760405162461bcd60e51b81526004016103a990611933565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b0316331480610ead57506002546001600160a01b031633145b80610ec257506004546001600160a01b031633145b610ede5760405162461bcd60e51b81526004016103a990611a11565b6040805160048082526024820183526020820180516001600160e01b031663169c209360e21b179052915163b9f45adb60e01b8152736ede1597c05a0ca77031cba43ab887ccf24cd7e89263b9f45adb92610f5e923092636628d61160e11b928492909173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee9101611828565b602060405180830381600087803b158015610f7857600080fd5b505af1158015610f8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb0919061176a565b30600090815260208190526040902055565b33736ede1597c05a0ca77031cba43ab887ccf24cd7e81480610fee57506003546001600160a01b031633145b8061100357506002546001600160a01b031633145b8061101857506004546001600160a01b031633145b6110345760405162461bcd60e51b81526004016103a990611996565b61103d81611135565b600080736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663b810c6366040518163ffffffff1660e01b8152600401604080518083038186803b15801561108c57600080fd5b505afa1580156110a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c4919061179a565b90925090506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146111055760405162461bcd60e51b81526004016103a990611976565b6001548211156111275760405162461bcd60e51b81526004016103a990611958565b611130826113a7565b505050565b33736ede1597c05a0ca77031cba43ab887ccf24cd7e8148061116157506003546001600160a01b031633145b8061117657506002546001600160a01b031633145b8061118b57506004546001600160a01b031633145b6111a75760405162461bcd60e51b81526004016103a990611996565b736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663b9f45adb306361f13e0060e01b30633970c50e60e01b866040516024016111ed9190611814565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199485161790525160e087901b909216825261124b9493929173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90600401611828565b602060405180830381600087803b15801561126557600080fd5b505af1158015611279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129d919061176a565b6001600160a01b03909116600090815260208190526040902055565b6003546001600160a01b03163314806112dc57506002546001600160a01b031633145b806112f157506004546001600160a01b031633145b61130d5760405162461bcd60e51b81526004016103a990611a11565b6001600160a01b03811661132057600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031681565b6111308363a9059cbb60e01b848460405160240161137092919061187b565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526114ac565b6000736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663573ea5756040518163ffffffff1660e01b815260040160206040518083038186803b1580156113f657600080fd5b505afa15801561140a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142e9190611683565b90506000816001600160a01b03168360405161144990611811565b60006040518083038185875af1925050503d8060008114611486576040519150601f19603f3d011682016040523d82523d6000602084013e61148b565b606091505b50509050806111305760405162461bcd60e51b81526004016103a9906119b7565b6060611501826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661153b9092919063ffffffff16565b805190915015611130578080602001905181019061151f919061174a565b6111305760405162461bcd60e51b81526004016103a990611a54565b606061154a8484600085611552565b949350505050565b606061155d85611616565b6115795760405162461bcd60e51b81526004016103a9906119da565b60006060866001600160a01b0316858760405161159691906117f5565b60006040518083038185875af1925050503d80600081146115d3576040519150601f19603f3d011682016040523d82523d6000602084013e6115d8565b606091505b509150915081156115ec57915061154a9050565b8051156115fc5780518082602001fd5b8360405162461bcd60e51b81526004016103a991906118dd565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061154a575050151592915050565b805161165a81611af5565b92915050565b600060208284031215611671578081fd5b813561167c81611af5565b9392505050565b600060208284031215611694578081fd5b815161167c81611af5565b600060208083850312156116b1578182fd5b825167ffffffffffffffff808211156116c8578384fd5b818501915085601f8301126116db578384fd5b8151818111156116e9578485fd5b83810291506116f9848301611a9e565b8181528481019084860184860187018a1015611713578788fd5b8795505b8386101561173d576117298a8261164f565b835260019590950194918601918601611717565b5098975050505050505050565b60006020828403121561175b578081fd5b8151801515811461167c578182fd5b60006020828403121561177b578081fd5b5051919050565b600060208284031215611793578081fd5b5035919050565b600080604083850312156117ac578081fd5b8251915060208301516117be81611af5565b809150509250929050565b600081518084526117e1816020860160208601611ac5565b601f01601f19169290920160200192915050565b60008251611807818460208701611ac5565b9190910192915050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682526001600160e01b031986166020830152848116604083015260a06060830181905260009190611866908401866117c9565b91508084166080840152509695505050505050565b6001600160a01b03929092168252602082015260400190565b600083151582526040602083015261154a60408301846117c9565b90815260200190565b9384526001600160a01b03928316602085015291166040830152606082015260800190565b60006020825261167c60208301846117c9565b60208082526006908201526508595e1a5cdd60d21b604082015260600190565b6020808252600990820152682165636f6e6f6d696360b81b604082015260600190565b6020808252600b908201526a21676f7665726e616e636560a81b604082015260600190565b6020808252600490820152632166656560e01b604082015260600190565b60208082526006908201526510ba37b5b2b760d11b604082015260600190565b60208082526007908201526610b5b2b2b832b960c91b604082015260600190565b60208082526009908201526810ba3930b739b332b960b91b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600b908201526a08585d5d1a1bdc9a5e995960aa1b604082015260600190565b60208082526004908201526310b537b160e11b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60405181810167ffffffffffffffff81118282101715611abd57600080fd5b604052919050565b60005b83811015611ae0578181015183820152602001611ac8565b83811115611aef576000848401525b50505050565b6001600160a01b0381168114611b0a57600080fd5b5056fea2646970667358221220a4d3dafe2374826a85b7adccee3f096fc0f80ae5106e8ce605f5ea34651f4f7a64736f6c634300060c0033

Deployed Bytecode

0x6080604052600436106101235760003560e01c806364db71b8116100a0578063b7a921b911610064578063b7a921b9146102f5578063cc51ac221461030a578063d004e9851461032a578063d4a22bde1461034a578063f39c38a01461036a5761012a565b806364db71b81461026b578063710e5d2f1461028b57806388a8d602146102ab5780638da5cb5b146102c0578063ab033ea9146102d55761012a565b80633970c50e116100e75780633970c50e146101d15780635a70824c146101ff5780635aa6e6751461021457806361f13e0014610236578063647846a5146102565761012a565b806301681a621461012f57806301f59d161461015157806313af40351461017c57806315cd41de1461019c578063238efcbc146101bc5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b5061014f61014a366004611660565b61037f565b005b34801561015d57600080fd5b50610166610500565b60405161017391906118af565b60405180910390f35b34801561018857600080fd5b5061014f610197366004611660565b610506565b3480156101a857600080fd5b506101666101b7366004611660565b61058f565b3480156101c857600080fd5b5061014f6105a1565b3480156101dd57600080fd5b506101f16101ec366004611660565b6105f2565b604051610173929190611894565b34801561020b57600080fd5b506101f161079b565b34801561022057600080fd5b50610229610991565b6040516101739190611814565b34801561024257600080fd5b5061014f610251366004611660565b6109a0565b34801561026257600080fd5b50610229610c86565b34801561027757600080fd5b5061014f610286366004611660565b610c9e565b34801561029757600080fd5b5061014f6102a6366004611782565b610dc7565b3480156102b757600080fd5b50610229610e20565b3480156102cc57600080fd5b50610229610e2f565b3480156102e157600080fd5b5061014f6102f0366004611660565b610e3e565b34801561030157600080fd5b5061014f610e8a565b34801561031657600080fd5b5061014f610325366004611660565b610fc2565b34801561033657600080fd5b5061014f610345366004611660565b611135565b34801561035657600080fd5b5061014f610365366004611660565b6112b9565b34801561037657600080fd5b50610229611342565b6004546001600160a01b031633146103b25760405162461bcd60e51b81526004016103a990611933565b60405180910390fd5b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610465575060045460405147916000916001600160a01b039091169083906103fc90611811565b60006040518083038185875af1925050503d8060008114610439576040519150601f19603f3d011682016040523d82523d6000602084013e61043e565b606091505b505090508061045f5760405162461bcd60e51b81526004016103a9906119b7565b506104fc565b6040516370a0823160e01b81526001600160a01b038316906370a0823190610491903090600401611814565b60206040518083038186803b1580156104a957600080fd5b505afa1580156104bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e1919061176a565b6004549091506104fc9083906001600160a01b031683611351565b5050565b60015481565b6003546001600160a01b031633148061052957506002546001600160a01b031633145b8061053e57506004546001600160a01b031633145b61055a5760405162461bcd60e51b81526004016103a990611a11565b6001600160a01b03811661056d57600080fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006020819052908152604090205481565b6005546001600160a01b031633146105cb5760405162461bcd60e51b81526004016103a990611a11565b60058054600480546001600160a01b03199081166001600160a01b03841617909155169055565b6001600160a01b03811660009081526020819052604081205460609061062a5760405162461bcd60e51b81526004016103a990611a36565b6000839050306001600160a01b0316816001600160a01b031663aced16616040518163ffffffff1660e01b815260040160206040518083038186803b15801561067257600080fd5b505afa158015610686573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106aa9190611683565b6001600160a01b0316146106be5750610796565b60405163ed882c2b60e01b81526001600160a01b0382169063ed882c2b906106ee906305f5e100906004016118af565b60206040518083038186803b15801561070657600080fd5b505afa15801561071a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073e919061174a565b92508215610794576040516230f89f60e91b9061075f908690602401611814565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915291505b505b915091565b60006060807397d0be2a72fc4db90ed9dbc2ea7f03b4968f69386001600160a01b031663474119196040518163ffffffff1660e01b815260040160006040518083038186803b1580156107ed57600080fd5b505afa158015610801573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610829919081019061169f565b905060005b815181101561098b57306001600160a01b031682828151811061084d57fe5b60200260200101516001600160a01b031663aced16616040518163ffffffff1660e01b815260040160206040518083038186803b15801561088d57600080fd5b505afa1580156108a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c59190611683565b6001600160a01b0316146108d857610983565b6000808383815181106108e757fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020546000801b1415610983576001935063cc51ac2260e01b82828151811061093257fe5b602002602001015160405160240161094a9190611814565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152925061098b565b60010161082e565b50509091565b6004546001600160a01b031681565b33736ede1597c05a0ca77031cba43ab887ccf24cd7e814806109cc57506003546001600160a01b031633145b806109e157506002546001600160a01b031633145b806109f657506004546001600160a01b031633145b610a125760405162461bcd60e51b81526004016103a990611996565b6001600160a01b038116600090815260208190526040902054610a475760405162461bcd60e51b81526004016103a990611a36565b6000819050600080736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663b810c6366040518163ffffffff1660e01b8152600401604080518083038186803b158015610a9b57600080fd5b505afa158015610aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad3919061179a565b90925090506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610b145760405162461bcd60e51b81526004016103a990611976565b600154821115610b365760405162461bcd60e51b81526004016103a990611958565b60405163ed882c2b60e01b81526001600160a01b0384169063ed882c2b90610b629085906004016118af565b60206040518083038186803b158015610b7a57600080fd5b505afa158015610b8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb2919061174a565b610bce5760405162461bcd60e51b81526004016103a990611910565b826001600160a01b0316634641257d6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610c0957600080fd5b505af1158015610c1d573d6000803e3d6000fd5b50505050610c2a826113a7565b6001600160a01b038416600090815260208190526040908190205490517fcd3d36a669b0143461074f3ed708d2aa3a57798004c8f7a34380a3146937767091610c78918790859087906118b8565b60405180910390a150505050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6003546001600160a01b0316331480610cc157506002546001600160a01b031633145b80610cd657506004546001600160a01b031633145b610cf25760405162461bcd60e51b81526004016103a990611a11565b6001600160a01b038116600090815260208190526040902054610d275760405162461bcd60e51b81526004016103a9906118f0565b6001600160a01b0381166000908152602081905260409081902054905163ee8ca3b560e01b8152736ede1597c05a0ca77031cba43ab887ccf24cd7e89063ee8ca3b590610d789084906004016118af565b600060405180830381600087803b158015610d9257600080fd5b505af1158015610da6573d6000803e3d6000fd5b5050506001600160a01b039092166000908152602081905260408120555050565b6003546001600160a01b0316331480610dea57506002546001600160a01b031633145b80610dff57506004546001600160a01b031633145b610e1b5760405162461bcd60e51b81526004016103a990611a11565b600155565b6002546001600160a01b031681565b6003546001600160a01b031681565b6004546001600160a01b03163314610e685760405162461bcd60e51b81526004016103a990611933565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b0316331480610ead57506002546001600160a01b031633145b80610ec257506004546001600160a01b031633145b610ede5760405162461bcd60e51b81526004016103a990611a11565b6040805160048082526024820183526020820180516001600160e01b031663169c209360e21b179052915163b9f45adb60e01b8152736ede1597c05a0ca77031cba43ab887ccf24cd7e89263b9f45adb92610f5e923092636628d61160e11b928492909173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee9101611828565b602060405180830381600087803b158015610f7857600080fd5b505af1158015610f8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb0919061176a565b30600090815260208190526040902055565b33736ede1597c05a0ca77031cba43ab887ccf24cd7e81480610fee57506003546001600160a01b031633145b8061100357506002546001600160a01b031633145b8061101857506004546001600160a01b031633145b6110345760405162461bcd60e51b81526004016103a990611996565b61103d81611135565b600080736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663b810c6366040518163ffffffff1660e01b8152600401604080518083038186803b15801561108c57600080fd5b505afa1580156110a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c4919061179a565b90925090506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146111055760405162461bcd60e51b81526004016103a990611976565b6001548211156111275760405162461bcd60e51b81526004016103a990611958565b611130826113a7565b505050565b33736ede1597c05a0ca77031cba43ab887ccf24cd7e8148061116157506003546001600160a01b031633145b8061117657506002546001600160a01b031633145b8061118b57506004546001600160a01b031633145b6111a75760405162461bcd60e51b81526004016103a990611996565b736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663b9f45adb306361f13e0060e01b30633970c50e60e01b866040516024016111ed9190611814565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199485161790525160e087901b909216825261124b9493929173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90600401611828565b602060405180830381600087803b15801561126557600080fd5b505af1158015611279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129d919061176a565b6001600160a01b03909116600090815260208190526040902055565b6003546001600160a01b03163314806112dc57506002546001600160a01b031633145b806112f157506004546001600160a01b031633145b61130d5760405162461bcd60e51b81526004016103a990611a11565b6001600160a01b03811661132057600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031681565b6111308363a9059cbb60e01b848460405160240161137092919061187b565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526114ac565b6000736ede1597c05a0ca77031cba43ab887ccf24cd7e86001600160a01b031663573ea5756040518163ffffffff1660e01b815260040160206040518083038186803b1580156113f657600080fd5b505afa15801561140a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142e9190611683565b90506000816001600160a01b03168360405161144990611811565b60006040518083038185875af1925050503d8060008114611486576040519150601f19603f3d011682016040523d82523d6000602084013e61148b565b606091505b50509050806111305760405162461bcd60e51b81526004016103a9906119b7565b6060611501826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661153b9092919063ffffffff16565b805190915015611130578080602001905181019061151f919061174a565b6111305760405162461bcd60e51b81526004016103a990611a54565b606061154a8484600085611552565b949350505050565b606061155d85611616565b6115795760405162461bcd60e51b81526004016103a9906119da565b60006060866001600160a01b0316858760405161159691906117f5565b60006040518083038185875af1925050503d80600081146115d3576040519150601f19603f3d011682016040523d82523d6000602084013e6115d8565b606091505b509150915081156115ec57915061154a9050565b8051156115fc5780518082602001fd5b8360405162461bcd60e51b81526004016103a991906118dd565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061154a575050151592915050565b805161165a81611af5565b92915050565b600060208284031215611671578081fd5b813561167c81611af5565b9392505050565b600060208284031215611694578081fd5b815161167c81611af5565b600060208083850312156116b1578182fd5b825167ffffffffffffffff808211156116c8578384fd5b818501915085601f8301126116db578384fd5b8151818111156116e9578485fd5b83810291506116f9848301611a9e565b8181528481019084860184860187018a1015611713578788fd5b8795505b8386101561173d576117298a8261164f565b835260019590950194918601918601611717565b5098975050505050505050565b60006020828403121561175b578081fd5b8151801515811461167c578182fd5b60006020828403121561177b578081fd5b5051919050565b600060208284031215611793578081fd5b5035919050565b600080604083850312156117ac578081fd5b8251915060208301516117be81611af5565b809150509250929050565b600081518084526117e1816020860160208601611ac5565b601f01601f19169290920160200192915050565b60008251611807818460208701611ac5565b9190910192915050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682526001600160e01b031986166020830152848116604083015260a06060830181905260009190611866908401866117c9565b91508084166080840152509695505050505050565b6001600160a01b03929092168252602082015260400190565b600083151582526040602083015261154a60408301846117c9565b90815260200190565b9384526001600160a01b03928316602085015291166040830152606082015260800190565b60006020825261167c60208301846117c9565b60208082526006908201526508595e1a5cdd60d21b604082015260600190565b6020808252600990820152682165636f6e6f6d696360b81b604082015260600190565b6020808252600b908201526a21676f7665726e616e636560a81b604082015260600190565b6020808252600490820152632166656560e01b604082015260600190565b60208082526006908201526510ba37b5b2b760d11b604082015260600190565b60208082526007908201526610b5b2b2b832b960c91b604082015260600190565b60208082526009908201526810ba3930b739b332b960b91b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600b908201526a08585d5d1a1bdc9a5e995960aa1b604082015260600190565b60208082526004908201526310b537b160e11b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60405181810167ffffffffffffffff81118282101715611abd57600080fd5b604052919050565b60005b83811015611ae0578181015183820152602001611ac8565b83811115611aef576000848401525b50505050565b6001600160a01b0381168114611b0a57600080fd5b5056fea2646970667358221220a4d3dafe2374826a85b7adccee3f096fc0f80ae5106e8ce605f5ea34651f4f7a64736f6c634300060c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.