S Price: $0.620706 (+2.38%)

Contract

0x169bc0070E308da75e69A41a437EDeD0A9032cb3

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StrategyIchi

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 19 : StrategyIchi.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../Common/BaseAllToNativeFactoryStrat.sol";
import "../../interfaces/common/IRewardPool.sol";
import "./IchiVault.sol";

contract StrategyIchi is BaseAllToNativeFactoryStrat {
    using SafeERC20 for IERC20;

    IRewardPool public gauge;
    address public lpToken0;
    address public lpToken1;

    function initialize(
        address _gauge,
        bool _harvestOnDeposit,
        address[] calldata _rewards,
        Addresses calldata _addresses
    ) public initializer {
        __BaseStrategy_init(_addresses, _rewards);
        gauge = IRewardPool(_gauge);
        if (_harvestOnDeposit) setHarvestOnDeposit(true);

        lpToken0 = IchiVault(want).token0();
        lpToken1 = IchiVault(want).token1();
    }

    function stratName() public pure override returns (string memory) {
        return "Ichi";
    }

    function balanceOfPool() public view override returns (uint) {
        return gauge.balanceOf(address(this));
    }

    function _deposit(uint amount) internal override {
        IERC20(want).forceApprove(address(gauge), amount);
        gauge.deposit(amount);
    }

    function _withdraw(uint amount) internal override {
        if (amount > 0) {
            gauge.withdraw(amount);
        }
    }

    function _emergencyWithdraw() internal override {
        uint amount = balanceOfPool();
        if (amount > 0) {
            if (gauge.emergency()) gauge.emergencyWithdraw();
            else gauge.withdraw(amount);
        }
    }

    function _claim() internal override {
        gauge.getReward();
    }

    function _verifyRewardToken(address token) internal view override {}

    function _swapNativeToWant() internal override {
        if (depositToken != native) {
            _swap(native, depositToken);
        }
        uint depositBal = IERC20(depositToken).balanceOf(address(this));

        uint amount0 = depositToken == lpToken0 ? depositBal : 0;
        uint amount1 = depositToken == lpToken1 ? depositBal : 0;

        IERC20(depositToken).forceApprove(want, depositBal);
        IchiVault(want).deposit(amount0, amount1, address(this));
    }
}

File 2 of 19 : IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 3 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 4 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 5 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

File 6 of 19 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

File 7 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 8 of 19 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 9 of 19 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 10 of 19 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 11 of 19 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 12 of 19 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 13 of 19 : IBeefySwapper.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IBeefySwapper {
    function swap(
        address fromToken,
        address toToken,
        uint256 amountIn
    ) external returns (uint256 amountOut);

    function swap(
        address fromToken,
        address toToken,
        uint256 amountIn,
        uint256 minAmountOut
    ) external returns (uint256 amountOut);

    function getAmountOut(
        address _fromToken,
        address _toToken,
        uint256 _amountIn
    ) external view returns (uint256 amountOut);

    function swapInfo(
        address _fromToken,
        address _toToken
    ) external view returns (
        address router,
        bytes calldata data,
        uint256 amountIndex,
        uint256 minIndex,
        int8 minAmountSign
    );

    struct SwapInfo {
        address router;
        bytes data;
        uint256 amountIndex;
        uint256 minIndex;
        int8 minAmountSign;
    }
}

interface ISimplifiedSwapInfo {
    function swapInfo(address _fromToken, address _toToken) external view returns (address router, bytes calldata data);
}

File 14 of 19 : IStrategyFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStrategyFactory {
    function createStrategy(string calldata _strategyName) external returns (address);
    function native() external view returns (address);
    function keeper() external view returns (address);
    function rebalancers(address) external view returns (bool);
    function beefyFeeRecipient() external view returns (address);
    function beefyFeeConfig() external view returns (address);
    function globalPause() external view returns (bool);
    function strategyPause(string calldata stratName) external view returns (bool);
}

File 15 of 19 : IFeeConfig.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IFeeConfig {
    struct FeeCategory {
        uint256 total;
        uint256 beefy;
        uint256 call;
        uint256 strategist;
        string label;
        bool active;
    }
    struct AllFees {
        FeeCategory performance;
        uint256 deposit;
        uint256 withdraw;
    }
    function getFees(address strategy) external view returns (FeeCategory memory);
    function stratFeeId(address strategy) external view returns (uint256);
    function setStratFeeId(uint256 feeId) external;
}

File 16 of 19 : IRewardPool.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.9.0;

interface IRewardPool {
    function deposit(uint256 amount) external;
    function stake(uint256 amount) external;
    function withdraw(uint256 amount) external;
    function earned(address account) external view returns (uint256);
    function getReward() external;
    function getReward(address account) external;
    function getRewards() external;
    function collectReward() external;
    function balanceOf(address account) external view returns (uint256);
    function stakingToken() external view returns (address);
    function rewardsToken() external view returns (address);
    function emergency() external view returns (bool);
    function emergencyWithdraw() external;
}

File 17 of 19 : IWrappedNative.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.9.0;

interface IWrappedNative {
    function deposit() external payable;
    function withdraw(uint256 wad) external;
}

File 18 of 19 : BaseAllToNativeFactoryStrat.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin-5/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../interfaces/beefy/IBeefySwapper.sol";
import "../../interfaces/beefy/IStrategyFactory.sol";
import "../../interfaces/common/IFeeConfig.sol";
import "../../interfaces/common/IWrappedNative.sol";

abstract contract BaseAllToNativeFactoryStrat is OwnableUpgradeable, PausableUpgradeable {
    using SafeERC20 for IERC20;

    struct Addresses {
        address want;
        address depositToken;
        address factory;
        address vault;
        address swapper;
        address strategist;
    }

    address[] public rewards;
    mapping(address => uint) public minAmounts; // tokens minimum amount to be swapped

    IStrategyFactory public factory;
    address public vault;
    address public swapper;
    address public strategist;

    address public want;
    address public native;
    address public depositToken;
    uint256 public lastHarvest;
    uint256 public totalLocked;
    uint256 public lockDuration;
    bool public harvestOnDeposit;

    uint256 constant DIVISOR = 1 ether;

    event StratHarvest(address indexed harvester, uint256 wantHarvested, uint256 tvl);
    event Deposit(uint256 tvl);
    event Withdraw(uint256 tvl);
    event ChargedFees(uint256 callFees, uint256 beefyFees, uint256 strategistFees);
    event SetVault(address vault);
    event SetSwapper(address swapper);
    event SetStrategist(address strategist);

    error StrategyPaused();
    error NotManager();

    modifier ifNotPaused() {
        if (paused() || factory.globalPause() || factory.strategyPause(stratName())) revert StrategyPaused();
        _;
    }

    modifier onlyManager() {
        _checkManager();
        _;
    }

    function _checkManager() internal view {
        if (msg.sender != owner() && msg.sender != keeper()) revert NotManager();
    }

    function __BaseStrategy_init(Addresses calldata _addresses, address[] calldata _rewards) internal onlyInitializing {
        __Ownable_init();
        __Pausable_init();
        want = _addresses.want;
        factory = IStrategyFactory(_addresses.factory);
        vault = _addresses.vault;
        swapper = _addresses.swapper;
        strategist = _addresses.strategist;
        native = factory.native();

        for (uint i; i < _rewards.length; i++) {
            addReward(_rewards[i]);
        }
        setDepositToken(_addresses.depositToken);

        lockDuration = 1 days;
    }

    function stratName() public view virtual returns (string memory);

    function balanceOfPool() public view virtual returns (uint);

    function _deposit(uint amount) internal virtual;

    function _withdraw(uint amount) internal virtual;

    function _emergencyWithdraw() internal virtual;

    function _claim() internal virtual;

    function _verifyRewardToken(address token) internal view virtual;

    // puts the funds to work
    function deposit() public ifNotPaused {
        uint256 wantBal = balanceOfWant();
        if (wantBal > 0) {
            _deposit(wantBal);
            emit Deposit(balanceOf());
        }
    }

    function withdraw(uint256 _amount) external {
        require(msg.sender == vault, "!vault");

        uint256 wantBal = balanceOfWant();

        if (wantBal < _amount) {
            _withdraw(_amount - wantBal);
            wantBal = balanceOfWant();
        }

        if (wantBal > _amount) {
            wantBal = _amount;
        }

        IERC20(want).safeTransfer(vault, wantBal);

        emit Withdraw(balanceOf());
    }

    function beforeDeposit() external virtual {
        if (harvestOnDeposit) {
            require(msg.sender == vault, "!vault");
            _harvest(tx.origin, true);
        }
    }

    function claim() external virtual {
        _claim();
    }

    function harvest() external virtual {
        _harvest(tx.origin, false);
    }

    function harvest(address callFeeRecipient) external virtual {
        _harvest(callFeeRecipient, false);
    }

    // compounds earnings and charges performance fee
    function _harvest(address callFeeRecipient, bool onDeposit) internal ifNotPaused {
        _claim();
        _swapRewardsToNative();
        uint256 nativeBal = IERC20(native).balanceOf(address(this));
        if (nativeBal > minAmounts[native]) {
            _chargeFees(callFeeRecipient);

            _swapNativeToWant();
            uint256 wantHarvested = balanceOfWant();
            totalLocked = wantHarvested + lockedProfit();
            lastHarvest = block.timestamp;

            if (!onDeposit) {
                deposit();
            }

            emit StratHarvest(msg.sender, wantHarvested, balanceOf());
        }
    }

    function _swapRewardsToNative() internal virtual {
        for (uint i; i < rewards.length; ++i) {
            address token = rewards[i];
            if (token == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
                IWrappedNative(native).deposit{value: address(this).balance}();
            } else {
                uint amount = IERC20(token).balanceOf(address(this));
                if (amount > minAmounts[token]) {
                    _swap(token, native, amount);
                }
            }
        }
    }

    // performance fees
    function _chargeFees(address callFeeRecipient) internal {
        IFeeConfig.FeeCategory memory fees = beefyFeeConfig().getFees(address(this));
        uint256 nativeBal = IERC20(native).balanceOf(address(this)) * fees.total / DIVISOR;

        uint256 callFeeAmount = nativeBal * fees.call / DIVISOR;
        IERC20(native).safeTransfer(callFeeRecipient, callFeeAmount);

        uint256 beefyFeeAmount = nativeBal * fees.beefy / DIVISOR;
        IERC20(native).safeTransfer(beefyFeeRecipient(), beefyFeeAmount);

        uint256 strategistFeeAmount = nativeBal * fees.strategist / DIVISOR;
        IERC20(native).safeTransfer(strategist, strategistFeeAmount);

        emit ChargedFees(callFeeAmount, beefyFeeAmount, strategistFeeAmount);
    }

    function _swapNativeToWant() internal virtual {
        if (depositToken == address(0)) {
            _swap(native, want);
        } else {
            if (depositToken != native) {
                _swap(native, depositToken);
            }
            _swap(depositToken, want);
        }
    }

    function _swap(address tokenFrom, address tokenTo) internal {
        uint bal = IERC20(tokenFrom).balanceOf(address(this));
        _swap(tokenFrom, tokenTo, bal);
    }

    function _swap(address tokenFrom, address tokenTo, uint amount) internal {
        IERC20(tokenFrom).forceApprove(swapper, amount);
        IBeefySwapper(swapper).swap(tokenFrom, tokenTo, amount);
    }

    function rewardsLength() external view returns (uint) {
        return rewards.length;
    }

    function addReward(address _token) public onlyManager {
        require(_token != want, "!want");
        require(_token != native, "!native");
        _verifyRewardToken(_token);
        rewards.push(_token);
    }

    function removeReward(uint i) external onlyManager {
        rewards[i] = rewards[rewards.length - 1];
        rewards.pop();
    }

    function resetRewards() external onlyManager {
        delete rewards;
    }

    function setRewardMinAmount(address token, uint minAmount) external onlyManager {
        minAmounts[token] = minAmount;
    }

    function setDepositToken(address token) public onlyManager {
        if (token == address(0)) {
            depositToken = address(0);
            return;
        }
        
        _verifyRewardToken(token);
        depositToken = token;
    }

    function lockedProfit() public view returns (uint256) {
        if (lockDuration == 0) return 0;
        uint256 elapsed = block.timestamp - lastHarvest;
        uint256 remaining = elapsed < lockDuration ? lockDuration - elapsed : 0;
        return totalLocked * remaining / lockDuration;
    }

    // calculate the total underlaying 'want' held by the strat.
    function balanceOf() public view returns (uint256) {
        return balanceOfWant() + balanceOfPool() - lockedProfit();
    }

    // it calculates how much 'want' this contract holds.
    function balanceOfWant() public view returns (uint256) {
        return IERC20(want).balanceOf(address(this));
    }

    function setHarvestOnDeposit(bool _harvestOnDeposit) public onlyManager {
        harvestOnDeposit = _harvestOnDeposit;
        if (harvestOnDeposit) {
            lockDuration = 0;
        } else {
            lockDuration = 1 days;
        }
    }

    function setLockDuration(uint _duration) external onlyManager {
        lockDuration = _duration;
    }

    function rewardsAvailable() external view virtual returns (uint) {
        return 0;
    }

    function callReward() external view virtual returns (uint) {
        return 0;
    }

    function depositFee() public view virtual returns (uint) {
        return 0;
    }

    function withdrawFee() public view virtual returns (uint) {
        return 0;
    }

    // called as part of strat migration. Sends all the available funds back to the vault.
    function retireStrat() external {
        require(msg.sender == vault, "!vault");
        _emergencyWithdraw();
        IERC20(want).transfer(vault, balanceOfWant());
    }

    // pauses deposits and withdraws all funds from third party systems.
    function panic() public virtual onlyManager {
        pause();
        _emergencyWithdraw();
    }

    function pause() public virtual onlyManager {
        _pause();
    }

    function unpause() external virtual onlyManager {
        _unpause();
        deposit();
    }

    function keeper() public view returns (address) {
        return factory.keeper();
    }

    function beefyFeeConfig() public view returns (IFeeConfig) {
        return IFeeConfig(factory.beefyFeeConfig());
    }

    function beefyFeeRecipient() public view returns (address) {
        return factory.beefyFeeRecipient();
    }

    function getAllFees() external view returns (IFeeConfig.AllFees memory) {
        return IFeeConfig.AllFees(beefyFeeConfig().getFees(address(this)), depositFee(), withdrawFee());
    }

    function setVault(address _vault) external onlyOwner {
        vault = _vault;
        emit SetVault(_vault);
    }

    function setSwapper(address _swapper) external onlyOwner {
        swapper = _swapper;
        emit SetSwapper(_swapper);
    }

    function setStrategist(address _strategist) external {
        require(msg.sender == strategist, "!strategist");
        strategist = _strategist;
        emit SetStrategist(_strategist);
    }

    receive () payable external {}

    uint256[49] private __gap;
}

File 19 of 19 : IchiVault.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IchiVault {
    function token0() external view returns (address);
    function token1() external view returns (address);
    function deposit(uint deposit0, uint deposit1, address to) external returns (uint shares);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"NotManager","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StrategyPaused","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"callFees","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"beefyFees","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strategistFees","type":"uint256"}],"name":"ChargedFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tvl","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategist","type":"address"}],"name":"SetStrategist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"swapper","type":"address"}],"name":"SetSwapper","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vault","type":"address"}],"name":"SetVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"harvester","type":"address"},{"indexed":false,"internalType":"uint256","name":"wantHarvested","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tvl","type":"uint256"}],"name":"StratHarvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tvl","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceOfPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceOfWant","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beefyFeeConfig","outputs":[{"internalType":"contract IFeeConfig","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beefyFeeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beforeDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"callReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IStrategyFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gauge","outputs":[{"internalType":"contract IRewardPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllFees","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"beefy","type":"uint256"},{"internalType":"uint256","name":"call","type":"uint256"},{"internalType":"uint256","name":"strategist","type":"uint256"},{"internalType":"string","name":"label","type":"string"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct IFeeConfig.FeeCategory","name":"performance","type":"tuple"},{"internalType":"uint256","name":"deposit","type":"uint256"},{"internalType":"uint256","name":"withdraw","type":"uint256"}],"internalType":"struct IFeeConfig.AllFees","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"callFeeRecipient","type":"address"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestOnDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"bool","name":"_harvestOnDeposit","type":"bool"},{"internalType":"address[]","name":"_rewards","type":"address[]"},{"components":[{"internalType":"address","name":"want","type":"address"},{"internalType":"address","name":"depositToken","type":"address"},{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"strategist","type":"address"}],"internalType":"struct BaseAllToNativeFactoryStrat.Addresses","name":"_addresses","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"keeper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastHarvest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockedProfit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpToken0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpToken1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"native","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"panic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"removeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"retireStrat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"setDepositToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_harvestOnDeposit","type":"bool"}],"name":"setHarvestOnDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"setLockDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"}],"name":"setRewardMinAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategist","type":"address"}],"name":"setStrategist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_swapper","type":"address"}],"name":"setSwapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"setVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stratName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"strategist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"want","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50612d45806100206000396000f3fe6080604052600436106103545760003560e01c8063877562b6116101c6578063c1a3d44c116100f7578063e7a7250a11610095578063f2fde38b1161006f578063f2fde38b146108b5578063f301af42146108d5578063fb617787146108f5578063fbfa77cf1461090a57600080fd5b8063e7a7250a146105e7578063e941fa78146105e7578063f1a392da1461089f57600080fd5b8063c7b9d530116100d1578063c7b9d5301461082a578063c89039c51461084a578063d0e30db01461086a578063d97d1c3b1461087f57600080fd5b8063c1a3d44c146107d5578063c45a0155146107ea578063c553173f1461080a57600080fd5b80639c9b2e2111610164578063aced16611161013e578063aced166114610774578063ad29f5da14610789578063b20feaaf1461079e578063bbb356d5146107c057600080fd5b80639c9b2e2114610714578063a6f19c8414610734578063a7e9ca821461075457600080fd5b80638e145459116101a05780638e145459146106b257806397fd323d146105e75780639c5e52d5146106c75780639c82f2a4146106f457600080fd5b8063877562b61461065a5780638912cb8b1461067a5780638da5cb5b1461069457600080fd5b80634700d305116102a05780635c975abb1161023e5780636817031b116102185780636817031b146105fb578063715018a61461061b578063722713f7146106305780638456cb591461064557600080fd5b80635c975abb146105a35780635ee167c0146105c757806367a52793146105e757600080fd5b80634eb665af1161027a5780634eb665af146105365780635064010a146105565780635689141214610578578063573fef0a1461058e57600080fd5b80634700d305146104f75780634746fb551461050c5780634e71d92d1461052157600080fd5b80631f1fcd511161030d5780632e1a7d4d116102e75780632e1a7d4d146104985780633f4ba83a146104b857806344b81396146104cd5780634641257d146104e257600080fd5b80631f1fcd51146104385780631fe4a686146104585780632b3297f91461047857600080fd5b806304554443146103605780630c4ed799146103895780630e5c011e146103ab5780630e8fbb5a146103cb57806311588086146103eb57806311b0b42d1461040057600080fd5b3661035b57005b600080fd5b34801561036c57600080fd5b5061037660a25481565b6040519081526020015b60405180910390f35b34801561039557600080fd5b506103a96103a436600461280d565b61092a565b005b3480156103b757600080fd5b506103a96103c636600461280d565b610972565b3480156103d757600080fd5b506103a96103e636600461283f565b61097d565b3480156103f757600080fd5b506103766109b0565b34801561040c57600080fd5b50609e54610420906001600160a01b031681565b6040516001600160a01b039091168152602001610380565b34801561044457600080fd5b50609d54610420906001600160a01b031681565b34801561046457600080fd5b50609c54610420906001600160a01b031681565b34801561048457600080fd5b50609b54610420906001600160a01b031681565b3480156104a457600080fd5b506103a96104b336600461285c565b610a23565b3480156104c457600080fd5b506103a9610aed565b3480156104d957600080fd5b50610376610b07565b3480156104ee57600080fd5b506103a9610b6f565b34801561050357600080fd5b506103a9610b7a565b34801561051857600080fd5b50610420610b92565b34801561052d57600080fd5b506103a9610c00565b34801561054257600080fd5b506103a961055136600461285c565b610c08565b34801561056257600080fd5b5061056b610c15565b60405161038091906128c5565b34801561058457600080fd5b5061037660a15481565b34801561059a57600080fd5b506103a9610c33565b3480156105af57600080fd5b5060655460ff165b6040519015158152602001610380565b3480156105d357600080fd5b5060d654610420906001600160a01b031681565b3480156105f357600080fd5b506000610376565b34801561060757600080fd5b506103a961061636600461280d565b610c73565b34801561062757600080fd5b506103a9610cd0565b34801561063c57600080fd5b50610376610ce2565b34801561065157600080fd5b506103a9610d10565b34801561066657600080fd5b5060d754610420906001600160a01b031681565b34801561068657600080fd5b5060a3546105b79060ff1681565b3480156106a057600080fd5b506033546001600160a01b0316610420565b3480156106be57600080fd5b50610420610d20565b3480156106d357600080fd5b506103766106e236600461280d565b60986020526000908152604090205481565b34801561070057600080fd5b506103a961070f36600461280d565b610d6a565b34801561072057600080fd5b506103a961072f36600461280d565b610dc0565b34801561074057600080fd5b5060d554610420906001600160a01b031681565b34801561076057600080fd5b506103a961076f3660046128d8565b610ea8565b34801561078057600080fd5b50610420610ecc565b34801561079557600080fd5b506103a9610f16565b3480156107aa57600080fd5b506107b3610f2a565b6040516103809190612904565b3480156107cc57600080fd5b50609754610376565b3480156107e157600080fd5b50610376610fc8565b3480156107f657600080fd5b50609954610420906001600160a01b031681565b34801561081657600080fd5b506103a961082536600461285c565b610ff9565b34801561083657600080fd5b506103a961084536600461280d565b6110b1565b34801561085657600080fd5b50609f54610420906001600160a01b031681565b34801561087657600080fd5b506103a9611147565b34801561088b57600080fd5b506103a961089a366004612981565b6112b6565b3480156108ab57600080fd5b5061037660a05481565b3480156108c157600080fd5b506103a96108d036600461280d565b611514565b3480156108e157600080fd5b506104206108f036600461285c565b61158a565b34801561090157600080fd5b506103a96115b4565b34801561091657600080fd5b50609a54610420906001600160a01b031681565b610932611676565b6001600160a01b03811661095357609f80546001600160a01b031916905550565b609f80546001600160a01b0319166001600160a01b0383161790555b50565b61096f8160006116c8565b610985611676565b60a3805460ff191682151590811790915560ff16156109a657600060a25550565b6201518060a25550565b60d5546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a08231906024015b602060405180830381865afa1580156109fa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1e9190612a3a565b905090565b609a546001600160a01b03163314610a565760405162461bcd60e51b8152600401610a4d90612a53565b60405180910390fd5b6000610a60610fc8565b905081811015610a8757610a7c610a778284612a89565b611914565b610a84610fc8565b90505b81811115610a925750805b609a54609d54610aaf916001600160a01b0391821691168361197c565b7f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d610ad8610ce2565b60405190815260200160405180910390a15050565b610af5611676565b610afd6119db565b610b05611147565b565b600060a254600003610b195750600090565b600060a05442610b299190612a89565b9050600060a2548210610b3d576000610b4b565b8160a254610b4b9190612a89565b905060a2548160a154610b5e9190612a9c565b610b689190612ab3565b9250505090565b610b053260006116c8565b610b82611676565b610b8a610d10565b610b05611a2d565b60995460408051634746fb5560e01b815290516000926001600160a01b031691634746fb559160048083019260209291908290030181865afa158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1e9190612ad5565b610b05611b3c565b610c10611676565b60a255565b6040805180820190915260048152634963686960e01b602082015290565b60a35460ff1615610b0557609a546001600160a01b03163314610c685760405162461bcd60e51b8152600401610a4d90612a53565b610b053260016116c8565b610c7b611ba6565b609a80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd459c7242e23d490831b5676a611c4342d899d28f342d89ae80793e56a930f30906020015b60405180910390a150565b610cd8611ba6565b610b056000611c00565b6000610cec610b07565b610cf46109b0565b610cfc610fc8565b610d069190612af2565b610a1e9190612a89565b610d18611676565b610b05611c52565b60995460408051638e14545960e01b815290516000926001600160a01b031691638e1454599160048083019260209291908290030181865afa158015610bdc573d6000803e3d6000fd5b610d72611ba6565b609b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f211f06c051495b535b79192c1a4531d819d569657ff4bd16daa8e9e5e6ed2bfd90602001610cc5565b610dc8611676565b609d546001600160a01b0390811690821603610e0e5760405162461bcd60e51b8152602060048201526005602482015264085dd85b9d60da1b6044820152606401610a4d565b609e546001600160a01b0390811690821603610e565760405162461bcd60e51b8152602060048201526007602482015266216e617469766560c81b6044820152606401610a4d565b609780546001810182556000919091527f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff90180546001600160a01b0319166001600160a01b0392909216919091179055565b610eb0611676565b6001600160a01b03909116600090815260986020526040902055565b6099546040805163aced166160e01b815290516000926001600160a01b03169163aced16619160048083019260209291908290030181865afa158015610bdc573d6000803e3d6000fd5b610f1e611676565b610b0560976000612767565b610f32612785565b6040518060600160405280610f45610b92565b604051639af608c960e01b81523060048201526001600160a01b039190911690639af608c990602401600060405180830381865afa158015610f8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fb39190810190612b85565b81526020016000815260200160009052919050565b609d546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a08231906024016109dd565b611001611676565b6097805461101190600190612a89565b8154811061102157611021612c7b565b600091825260209091200154609780546001600160a01b03909216918390811061104d5761104d612c7b565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550609780548061108c5761108c612c91565b600082815260209020810160001990810180546001600160a01b031916905501905550565b609c546001600160a01b031633146110f95760405162461bcd60e51b815260206004820152600b60248201526a085cdd1c985d1959da5cdd60aa1b6044820152606401610a4d565b609c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f46d58e3fa07bf19b1d27240f0e286b27e9f7c1b0d88933333fe833b60eec541290602001610cc5565b60655460ff16806111ca5750609960009054906101000a90046001600160a01b03166001600160a01b031663f12d54d86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ca9190612ca7565b8061124657506099546001600160a01b031663de73a5946111e9610c15565b6040518263ffffffff1660e01b815260040161120591906128c5565b602060405180830381865afa158015611222573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112469190612ca7565b156112645760405163e628b94960e01b815260040160405180910390fd5b600061126e610fc8565b9050801561096f5761127f81611c8f565b7f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e384266112a8610ce2565b604051908152602001610cc5565b600054610100900460ff16158080156112d65750600054600160ff909116105b806112f05750303b1580156112f0575060005460ff166001145b6113535760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a4d565b6000805460ff191660011790558015611376576000805461ff0019166101001790555b611381828585611cdd565b60d580546001600160a01b0319166001600160a01b03881617905584156113ac576113ac600161097d565b609d60009054906101000a90046001600160a01b03166001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114239190612ad5565b60d680546001600160a01b0319166001600160a01b03928316179055609d546040805163d21220a760e01b81529051919092169163d21220a79160048083019260209291908290030181865afa158015611481573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a59190612ad5565b60d780546001600160a01b0319166001600160a01b0392909216919091179055801561150c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b505050505050565b61151c611ba6565b6001600160a01b0381166115815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a4d565b61096f81611c00565b6097818154811061159a57600080fd5b6000918252602090912001546001600160a01b0316905081565b609a546001600160a01b031633146115de5760405162461bcd60e51b8152600401610a4d90612a53565b6115e6611a2d565b609d54609a546001600160a01b039182169163a9059cbb9116611607610fc8565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611652573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f9190612ca7565b6033546001600160a01b031633148015906116aa5750611694610ecc565b6001600160a01b0316336001600160a01b031614155b15610b055760405163607e454560e11b815260040160405180910390fd5b60655460ff168061174b5750609960009054906101000a90046001600160a01b03166001600160a01b031663f12d54d86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174b9190612ca7565b806117c757506099546001600160a01b031663de73a59461176a610c15565b6040518263ffffffff1660e01b815260040161178691906128c5565b602060405180830381865afa1580156117a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c79190612ca7565b156117e55760405163e628b94960e01b815260040160405180910390fd5b6117ed611b3c565b6117f5611ee0565b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561183e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118629190612a3a565b609e546001600160a01b031660009081526098602052604090205490915081111561190f5761189083612054565b611898612266565b60006118a2610fc8565b90506118ac610b07565b6118b69082612af2565b60a1554260a055826118ca576118ca611147565b337f9bc239f1724cacfb88cb1d66a2dc437467699b68a8c90d7b63110cf4b6f92410826118f5610ce2565b6040805192835260208301919091520160405180910390a2505b505050565b801561096f5760d554604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d906024015b600060405180830381600087803b15801561196157600080fd5b505af1158015611975573d6000803e3d6000fd5b5050505050565b6040516001600160a01b0383811660248301526044820183905261190f91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506123f2565b6119e3612463565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000611a376109b0565b9050801561096f5760d560009054906101000a90046001600160a01b03166001600160a01b031663caa6fea46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab69190612ca7565b15611b0b5760d560009054906101000a90046001600160a01b03166001600160a01b031663db2e21bc6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561196157600080fd5b60d554604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401611947565b60d560009054906101000a90046001600160a01b03166001600160a01b0316633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611b8c57600080fd5b505af1158015611ba0573d6000803e3d6000fd5b50505050565b6033546001600160a01b03163314610b055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a4d565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611c5a6124ac565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611a103390565b60d554609d54611cac916001600160a01b039182169116836124f2565b60d55460405163b6b55f2560e01b8152600481018390526001600160a01b039091169063b6b55f2590602401611947565b600054610100900460ff16611d045760405162461bcd60e51b8152600401610a4d90612cc4565b611d0c612582565b611d146125b1565b611d21602084018461280d565b609d80546001600160a01b0319166001600160a01b0392909216919091179055611d51606084016040850161280d565b609980546001600160a01b0319166001600160a01b0392909216919091179055611d81608084016060850161280d565b609a80546001600160a01b0319166001600160a01b0392909216919091179055611db160a084016080850161280d565b609b80546001600160a01b0319166001600160a01b0392909216919091179055611de160c0840160a0850161280d565b609c80546001600160a01b0319166001600160a01b03928316179055609954604080516311b0b42d60e01b8152905191909216916311b0b42d9160048083019260209291908290030181865afa158015611e3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e639190612ad5565b609e80546001600160a01b0319166001600160a01b039290921691909117905560005b81811015611ec057611eb8838383818110611ea357611ea3612c7b565b905060200201602081019061072f919061280d565b600101611e86565b50611ed46103a4604085016020860161280d565b50506201518060a25550565b60005b60975481101561096f57600060978281548110611f0257611f02612c7b565b6000918252602090912001546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed198101611fa357609e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611f8557600080fd5b505af1158015611f99573d6000803e3d6000fd5b505050505061204b565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200e9190612a3a565b6001600160a01b03831660009081526098602052604090205490915081111561204957609e546120499083906001600160a01b0316836125e0565b505b50600101611ee3565b600061205e610b92565b604051639af608c960e01b81523060048201526001600160a01b039190911690639af608c990602401600060405180830381865afa1580156120a4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120cc9190810190612b85565b8051609e546040516370a0823160e01b8152306004820152929350600092670de0b6b3a764000092916001600160a01b0316906370a0823190602401602060405180830381865afa158015612125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121499190612a3a565b6121539190612a9c565b61215d9190612ab3565b90506000670de0b6b3a764000083604001518361217a9190612a9c565b6121849190612ab3565b609e5490915061219e906001600160a01b0316858361197c565b6000670de0b6b3a76400008460200151846121b99190612a9c565b6121c39190612ab3565b90506121e36121d0610d20565b609e546001600160a01b0316908361197c565b6000670de0b6b3a76400008560600151856121fe9190612a9c565b6122089190612ab3565b609c54609e54919250612228916001600160a01b0390811691168361197c565b60408051848152602081018490529081018290527fd255b592c7f268a73e534da5219a60ff911b4cf6daae21c7d20527dd657bd99a90606001611503565b609e54609f546001600160a01b0390811691161461229a57609e54609f5461229a916001600160a01b03908116911661263b565b609f546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156122e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123079190612a3a565b60d654609f549192506000916001600160a01b0390811691161461232c57600061232e565b815b60d754609f549192506000916001600160a01b03908116911614612353576000612355565b825b609d54609f54919250612375916001600160a01b039081169116856124f2565b609d54604051638dbdbe6d60e01b815260048101849052602481018390523060448201526001600160a01b0390911690638dbdbe6d906064015b6020604051808303816000875af11580156123ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba09190612a3a565b600080602060008451602086016000885af180612415576040513d6000823e3d81fd5b50506000513d9150811561242d57806001141561243a565b6001600160a01b0384163b155b15611ba057604051635274afe760e01b81526001600160a01b0385166004820152602401610a4d565b60655460ff16610b055760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a4d565b60655460ff1615610b055760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610a4d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261254384826126b3565b611ba0576040516001600160a01b0384811660248301526000604483015261257891869182169063095ea7b3906064016119a9565b611ba084826123f2565b600054610100900460ff166125a95760405162461bcd60e51b8152600401610a4d90612cc4565b610b05612704565b600054610100900460ff166125d85760405162461bcd60e51b8152600401610a4d90612cc4565b610b05612734565b609b546125fa906001600160a01b038581169116836124f2565b609b54604051630df791e560e41b81526001600160a01b0385811660048301528481166024830152604482018490529091169063df791e50906064016123af565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015612682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126a69190612a3a565b905061190f8383836125e0565b6000806000806020600086516020880160008a5af192503d915060005190508280156126f8575081156126e957806001146126f8565b6000866001600160a01b03163b115b93505050505b92915050565b600054610100900460ff1661272b5760405162461bcd60e51b8152600401610a4d90612cc4565b610b0533611c00565b600054610100900460ff1661275b5760405162461bcd60e51b8152600401610a4d90612cc4565b6065805460ff19169055565b508054600082559060005260206000209081019061096f91906127df565b60405180606001604052806127cb6040518060c0016040528060008152602001600081526020016000815260200160008152602001606081526020016000151581525090565b815260200160008152602001600081525090565b5b808211156127f457600081556001016127e0565b5090565b6001600160a01b038116811461096f57600080fd5b60006020828403121561281f57600080fd5b813561282a816127f8565b9392505050565b801515811461096f57600080fd5b60006020828403121561285157600080fd5b813561282a81612831565b60006020828403121561286e57600080fd5b5035919050565b60005b83811015612890578181015183820152602001612878565b50506000910152565b600081518084526128b1816020860160208601612875565b601f01601f19169290920160200192915050565b60208152600061282a6020830184612899565b600080604083850312156128eb57600080fd5b82356128f6816127f8565b946020939093013593505050565b60208152600082516060602084015280516080840152602081015160a0840152604081015160c0840152606081015160e0840152608081015160c0610100850152612953610140850182612899565b905060a082015115156101208501526020850151604085015260408501516060850152809250505092915050565b600080600080600085870361012081121561299b57600080fd5b86356129a6816127f8565b955060208701356129b681612831565b9450604087013567ffffffffffffffff808211156129d357600080fd5b818901915089601f8301126129e757600080fd5b8135818111156129f657600080fd5b8a60208260051b8501011115612a0b57600080fd5b60209290920195509093505060c0605f1982011215612a2957600080fd5b506060860190509295509295909350565b600060208284031215612a4c57600080fd5b5051919050565b602080825260069082015265085d985d5b1d60d21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b818103818111156126fe576126fe612a73565b80820281158282048414176126fe576126fe612a73565b600082612ad057634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612ae757600080fd5b815161282a816127f8565b808201808211156126fe576126fe612a73565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715612b3e57612b3e612b05565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612b6d57612b6d612b05565b604052919050565b8051612b8081612831565b919050565b60006020808385031215612b9857600080fd5b825167ffffffffffffffff80821115612bb057600080fd5b9084019060c08287031215612bc457600080fd5b612bcc612b1b565b8251815283830151848201526040830151604082015260608301516060820152608083015182811115612bfe57600080fd5b8301601f81018813612c0f57600080fd5b805183811115612c2157612c21612b05565b612c33601f8201601f19168701612b44565b93508084528886828401011115612c4957600080fd5b612c5881878601888501612875565b5050816080820152612c6c60a08401612b75565b60a08201529695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b600060208284031215612cb957600080fd5b815161282a81612831565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122028107070b7084166daeadb44a3b2ace87bd9748c8a1e41463836d3adc1d8a41464736f6c63430008170033

Deployed Bytecode

0x6080604052600436106103545760003560e01c8063877562b6116101c6578063c1a3d44c116100f7578063e7a7250a11610095578063f2fde38b1161006f578063f2fde38b146108b5578063f301af42146108d5578063fb617787146108f5578063fbfa77cf1461090a57600080fd5b8063e7a7250a146105e7578063e941fa78146105e7578063f1a392da1461089f57600080fd5b8063c7b9d530116100d1578063c7b9d5301461082a578063c89039c51461084a578063d0e30db01461086a578063d97d1c3b1461087f57600080fd5b8063c1a3d44c146107d5578063c45a0155146107ea578063c553173f1461080a57600080fd5b80639c9b2e2111610164578063aced16611161013e578063aced166114610774578063ad29f5da14610789578063b20feaaf1461079e578063bbb356d5146107c057600080fd5b80639c9b2e2114610714578063a6f19c8414610734578063a7e9ca821461075457600080fd5b80638e145459116101a05780638e145459146106b257806397fd323d146105e75780639c5e52d5146106c75780639c82f2a4146106f457600080fd5b8063877562b61461065a5780638912cb8b1461067a5780638da5cb5b1461069457600080fd5b80634700d305116102a05780635c975abb1161023e5780636817031b116102185780636817031b146105fb578063715018a61461061b578063722713f7146106305780638456cb591461064557600080fd5b80635c975abb146105a35780635ee167c0146105c757806367a52793146105e757600080fd5b80634eb665af1161027a5780634eb665af146105365780635064010a146105565780635689141214610578578063573fef0a1461058e57600080fd5b80634700d305146104f75780634746fb551461050c5780634e71d92d1461052157600080fd5b80631f1fcd511161030d5780632e1a7d4d116102e75780632e1a7d4d146104985780633f4ba83a146104b857806344b81396146104cd5780634641257d146104e257600080fd5b80631f1fcd51146104385780631fe4a686146104585780632b3297f91461047857600080fd5b806304554443146103605780630c4ed799146103895780630e5c011e146103ab5780630e8fbb5a146103cb57806311588086146103eb57806311b0b42d1461040057600080fd5b3661035b57005b600080fd5b34801561036c57600080fd5b5061037660a25481565b6040519081526020015b60405180910390f35b34801561039557600080fd5b506103a96103a436600461280d565b61092a565b005b3480156103b757600080fd5b506103a96103c636600461280d565b610972565b3480156103d757600080fd5b506103a96103e636600461283f565b61097d565b3480156103f757600080fd5b506103766109b0565b34801561040c57600080fd5b50609e54610420906001600160a01b031681565b6040516001600160a01b039091168152602001610380565b34801561044457600080fd5b50609d54610420906001600160a01b031681565b34801561046457600080fd5b50609c54610420906001600160a01b031681565b34801561048457600080fd5b50609b54610420906001600160a01b031681565b3480156104a457600080fd5b506103a96104b336600461285c565b610a23565b3480156104c457600080fd5b506103a9610aed565b3480156104d957600080fd5b50610376610b07565b3480156104ee57600080fd5b506103a9610b6f565b34801561050357600080fd5b506103a9610b7a565b34801561051857600080fd5b50610420610b92565b34801561052d57600080fd5b506103a9610c00565b34801561054257600080fd5b506103a961055136600461285c565b610c08565b34801561056257600080fd5b5061056b610c15565b60405161038091906128c5565b34801561058457600080fd5b5061037660a15481565b34801561059a57600080fd5b506103a9610c33565b3480156105af57600080fd5b5060655460ff165b6040519015158152602001610380565b3480156105d357600080fd5b5060d654610420906001600160a01b031681565b3480156105f357600080fd5b506000610376565b34801561060757600080fd5b506103a961061636600461280d565b610c73565b34801561062757600080fd5b506103a9610cd0565b34801561063c57600080fd5b50610376610ce2565b34801561065157600080fd5b506103a9610d10565b34801561066657600080fd5b5060d754610420906001600160a01b031681565b34801561068657600080fd5b5060a3546105b79060ff1681565b3480156106a057600080fd5b506033546001600160a01b0316610420565b3480156106be57600080fd5b50610420610d20565b3480156106d357600080fd5b506103766106e236600461280d565b60986020526000908152604090205481565b34801561070057600080fd5b506103a961070f36600461280d565b610d6a565b34801561072057600080fd5b506103a961072f36600461280d565b610dc0565b34801561074057600080fd5b5060d554610420906001600160a01b031681565b34801561076057600080fd5b506103a961076f3660046128d8565b610ea8565b34801561078057600080fd5b50610420610ecc565b34801561079557600080fd5b506103a9610f16565b3480156107aa57600080fd5b506107b3610f2a565b6040516103809190612904565b3480156107cc57600080fd5b50609754610376565b3480156107e157600080fd5b50610376610fc8565b3480156107f657600080fd5b50609954610420906001600160a01b031681565b34801561081657600080fd5b506103a961082536600461285c565b610ff9565b34801561083657600080fd5b506103a961084536600461280d565b6110b1565b34801561085657600080fd5b50609f54610420906001600160a01b031681565b34801561087657600080fd5b506103a9611147565b34801561088b57600080fd5b506103a961089a366004612981565b6112b6565b3480156108ab57600080fd5b5061037660a05481565b3480156108c157600080fd5b506103a96108d036600461280d565b611514565b3480156108e157600080fd5b506104206108f036600461285c565b61158a565b34801561090157600080fd5b506103a96115b4565b34801561091657600080fd5b50609a54610420906001600160a01b031681565b610932611676565b6001600160a01b03811661095357609f80546001600160a01b031916905550565b609f80546001600160a01b0319166001600160a01b0383161790555b50565b61096f8160006116c8565b610985611676565b60a3805460ff191682151590811790915560ff16156109a657600060a25550565b6201518060a25550565b60d5546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a08231906024015b602060405180830381865afa1580156109fa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1e9190612a3a565b905090565b609a546001600160a01b03163314610a565760405162461bcd60e51b8152600401610a4d90612a53565b60405180910390fd5b6000610a60610fc8565b905081811015610a8757610a7c610a778284612a89565b611914565b610a84610fc8565b90505b81811115610a925750805b609a54609d54610aaf916001600160a01b0391821691168361197c565b7f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d610ad8610ce2565b60405190815260200160405180910390a15050565b610af5611676565b610afd6119db565b610b05611147565b565b600060a254600003610b195750600090565b600060a05442610b299190612a89565b9050600060a2548210610b3d576000610b4b565b8160a254610b4b9190612a89565b905060a2548160a154610b5e9190612a9c565b610b689190612ab3565b9250505090565b610b053260006116c8565b610b82611676565b610b8a610d10565b610b05611a2d565b60995460408051634746fb5560e01b815290516000926001600160a01b031691634746fb559160048083019260209291908290030181865afa158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1e9190612ad5565b610b05611b3c565b610c10611676565b60a255565b6040805180820190915260048152634963686960e01b602082015290565b60a35460ff1615610b0557609a546001600160a01b03163314610c685760405162461bcd60e51b8152600401610a4d90612a53565b610b053260016116c8565b610c7b611ba6565b609a80546001600160a01b0319166001600160a01b0383169081179091556040519081527fd459c7242e23d490831b5676a611c4342d899d28f342d89ae80793e56a930f30906020015b60405180910390a150565b610cd8611ba6565b610b056000611c00565b6000610cec610b07565b610cf46109b0565b610cfc610fc8565b610d069190612af2565b610a1e9190612a89565b610d18611676565b610b05611c52565b60995460408051638e14545960e01b815290516000926001600160a01b031691638e1454599160048083019260209291908290030181865afa158015610bdc573d6000803e3d6000fd5b610d72611ba6565b609b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f211f06c051495b535b79192c1a4531d819d569657ff4bd16daa8e9e5e6ed2bfd90602001610cc5565b610dc8611676565b609d546001600160a01b0390811690821603610e0e5760405162461bcd60e51b8152602060048201526005602482015264085dd85b9d60da1b6044820152606401610a4d565b609e546001600160a01b0390811690821603610e565760405162461bcd60e51b8152602060048201526007602482015266216e617469766560c81b6044820152606401610a4d565b609780546001810182556000919091527f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff90180546001600160a01b0319166001600160a01b0392909216919091179055565b610eb0611676565b6001600160a01b03909116600090815260986020526040902055565b6099546040805163aced166160e01b815290516000926001600160a01b03169163aced16619160048083019260209291908290030181865afa158015610bdc573d6000803e3d6000fd5b610f1e611676565b610b0560976000612767565b610f32612785565b6040518060600160405280610f45610b92565b604051639af608c960e01b81523060048201526001600160a01b039190911690639af608c990602401600060405180830381865afa158015610f8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fb39190810190612b85565b81526020016000815260200160009052919050565b609d546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a08231906024016109dd565b611001611676565b6097805461101190600190612a89565b8154811061102157611021612c7b565b600091825260209091200154609780546001600160a01b03909216918390811061104d5761104d612c7b565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550609780548061108c5761108c612c91565b600082815260209020810160001990810180546001600160a01b031916905501905550565b609c546001600160a01b031633146110f95760405162461bcd60e51b815260206004820152600b60248201526a085cdd1c985d1959da5cdd60aa1b6044820152606401610a4d565b609c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f46d58e3fa07bf19b1d27240f0e286b27e9f7c1b0d88933333fe833b60eec541290602001610cc5565b60655460ff16806111ca5750609960009054906101000a90046001600160a01b03166001600160a01b031663f12d54d86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ca9190612ca7565b8061124657506099546001600160a01b031663de73a5946111e9610c15565b6040518263ffffffff1660e01b815260040161120591906128c5565b602060405180830381865afa158015611222573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112469190612ca7565b156112645760405163e628b94960e01b815260040160405180910390fd5b600061126e610fc8565b9050801561096f5761127f81611c8f565b7f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e384266112a8610ce2565b604051908152602001610cc5565b600054610100900460ff16158080156112d65750600054600160ff909116105b806112f05750303b1580156112f0575060005460ff166001145b6113535760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a4d565b6000805460ff191660011790558015611376576000805461ff0019166101001790555b611381828585611cdd565b60d580546001600160a01b0319166001600160a01b03881617905584156113ac576113ac600161097d565b609d60009054906101000a90046001600160a01b03166001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114239190612ad5565b60d680546001600160a01b0319166001600160a01b03928316179055609d546040805163d21220a760e01b81529051919092169163d21220a79160048083019260209291908290030181865afa158015611481573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a59190612ad5565b60d780546001600160a01b0319166001600160a01b0392909216919091179055801561150c576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b505050505050565b61151c611ba6565b6001600160a01b0381166115815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a4d565b61096f81611c00565b6097818154811061159a57600080fd5b6000918252602090912001546001600160a01b0316905081565b609a546001600160a01b031633146115de5760405162461bcd60e51b8152600401610a4d90612a53565b6115e6611a2d565b609d54609a546001600160a01b039182169163a9059cbb9116611607610fc8565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611652573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f9190612ca7565b6033546001600160a01b031633148015906116aa5750611694610ecc565b6001600160a01b0316336001600160a01b031614155b15610b055760405163607e454560e11b815260040160405180910390fd5b60655460ff168061174b5750609960009054906101000a90046001600160a01b03166001600160a01b031663f12d54d86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174b9190612ca7565b806117c757506099546001600160a01b031663de73a59461176a610c15565b6040518263ffffffff1660e01b815260040161178691906128c5565b602060405180830381865afa1580156117a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c79190612ca7565b156117e55760405163e628b94960e01b815260040160405180910390fd5b6117ed611b3c565b6117f5611ee0565b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561183e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118629190612a3a565b609e546001600160a01b031660009081526098602052604090205490915081111561190f5761189083612054565b611898612266565b60006118a2610fc8565b90506118ac610b07565b6118b69082612af2565b60a1554260a055826118ca576118ca611147565b337f9bc239f1724cacfb88cb1d66a2dc437467699b68a8c90d7b63110cf4b6f92410826118f5610ce2565b6040805192835260208301919091520160405180910390a2505b505050565b801561096f5760d554604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d906024015b600060405180830381600087803b15801561196157600080fd5b505af1158015611975573d6000803e3d6000fd5b5050505050565b6040516001600160a01b0383811660248301526044820183905261190f91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506123f2565b6119e3612463565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000611a376109b0565b9050801561096f5760d560009054906101000a90046001600160a01b03166001600160a01b031663caa6fea46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab69190612ca7565b15611b0b5760d560009054906101000a90046001600160a01b03166001600160a01b031663db2e21bc6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561196157600080fd5b60d554604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401611947565b60d560009054906101000a90046001600160a01b03166001600160a01b0316633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611b8c57600080fd5b505af1158015611ba0573d6000803e3d6000fd5b50505050565b6033546001600160a01b03163314610b055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a4d565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611c5a6124ac565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611a103390565b60d554609d54611cac916001600160a01b039182169116836124f2565b60d55460405163b6b55f2560e01b8152600481018390526001600160a01b039091169063b6b55f2590602401611947565b600054610100900460ff16611d045760405162461bcd60e51b8152600401610a4d90612cc4565b611d0c612582565b611d146125b1565b611d21602084018461280d565b609d80546001600160a01b0319166001600160a01b0392909216919091179055611d51606084016040850161280d565b609980546001600160a01b0319166001600160a01b0392909216919091179055611d81608084016060850161280d565b609a80546001600160a01b0319166001600160a01b0392909216919091179055611db160a084016080850161280d565b609b80546001600160a01b0319166001600160a01b0392909216919091179055611de160c0840160a0850161280d565b609c80546001600160a01b0319166001600160a01b03928316179055609954604080516311b0b42d60e01b8152905191909216916311b0b42d9160048083019260209291908290030181865afa158015611e3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e639190612ad5565b609e80546001600160a01b0319166001600160a01b039290921691909117905560005b81811015611ec057611eb8838383818110611ea357611ea3612c7b565b905060200201602081019061072f919061280d565b600101611e86565b50611ed46103a4604085016020860161280d565b50506201518060a25550565b60005b60975481101561096f57600060978281548110611f0257611f02612c7b565b6000918252602090912001546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed198101611fa357609e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611f8557600080fd5b505af1158015611f99573d6000803e3d6000fd5b505050505061204b565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200e9190612a3a565b6001600160a01b03831660009081526098602052604090205490915081111561204957609e546120499083906001600160a01b0316836125e0565b505b50600101611ee3565b600061205e610b92565b604051639af608c960e01b81523060048201526001600160a01b039190911690639af608c990602401600060405180830381865afa1580156120a4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120cc9190810190612b85565b8051609e546040516370a0823160e01b8152306004820152929350600092670de0b6b3a764000092916001600160a01b0316906370a0823190602401602060405180830381865afa158015612125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121499190612a3a565b6121539190612a9c565b61215d9190612ab3565b90506000670de0b6b3a764000083604001518361217a9190612a9c565b6121849190612ab3565b609e5490915061219e906001600160a01b0316858361197c565b6000670de0b6b3a76400008460200151846121b99190612a9c565b6121c39190612ab3565b90506121e36121d0610d20565b609e546001600160a01b0316908361197c565b6000670de0b6b3a76400008560600151856121fe9190612a9c565b6122089190612ab3565b609c54609e54919250612228916001600160a01b0390811691168361197c565b60408051848152602081018490529081018290527fd255b592c7f268a73e534da5219a60ff911b4cf6daae21c7d20527dd657bd99a90606001611503565b609e54609f546001600160a01b0390811691161461229a57609e54609f5461229a916001600160a01b03908116911661263b565b609f546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156122e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123079190612a3a565b60d654609f549192506000916001600160a01b0390811691161461232c57600061232e565b815b60d754609f549192506000916001600160a01b03908116911614612353576000612355565b825b609d54609f54919250612375916001600160a01b039081169116856124f2565b609d54604051638dbdbe6d60e01b815260048101849052602481018390523060448201526001600160a01b0390911690638dbdbe6d906064015b6020604051808303816000875af11580156123ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba09190612a3a565b600080602060008451602086016000885af180612415576040513d6000823e3d81fd5b50506000513d9150811561242d57806001141561243a565b6001600160a01b0384163b155b15611ba057604051635274afe760e01b81526001600160a01b0385166004820152602401610a4d565b60655460ff16610b055760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a4d565b60655460ff1615610b055760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610a4d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261254384826126b3565b611ba0576040516001600160a01b0384811660248301526000604483015261257891869182169063095ea7b3906064016119a9565b611ba084826123f2565b600054610100900460ff166125a95760405162461bcd60e51b8152600401610a4d90612cc4565b610b05612704565b600054610100900460ff166125d85760405162461bcd60e51b8152600401610a4d90612cc4565b610b05612734565b609b546125fa906001600160a01b038581169116836124f2565b609b54604051630df791e560e41b81526001600160a01b0385811660048301528481166024830152604482018490529091169063df791e50906064016123af565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015612682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126a69190612a3a565b905061190f8383836125e0565b6000806000806020600086516020880160008a5af192503d915060005190508280156126f8575081156126e957806001146126f8565b6000866001600160a01b03163b115b93505050505b92915050565b600054610100900460ff1661272b5760405162461bcd60e51b8152600401610a4d90612cc4565b610b0533611c00565b600054610100900460ff1661275b5760405162461bcd60e51b8152600401610a4d90612cc4565b6065805460ff19169055565b508054600082559060005260206000209081019061096f91906127df565b60405180606001604052806127cb6040518060c0016040528060008152602001600081526020016000815260200160008152602001606081526020016000151581525090565b815260200160008152602001600081525090565b5b808211156127f457600081556001016127e0565b5090565b6001600160a01b038116811461096f57600080fd5b60006020828403121561281f57600080fd5b813561282a816127f8565b9392505050565b801515811461096f57600080fd5b60006020828403121561285157600080fd5b813561282a81612831565b60006020828403121561286e57600080fd5b5035919050565b60005b83811015612890578181015183820152602001612878565b50506000910152565b600081518084526128b1816020860160208601612875565b601f01601f19169290920160200192915050565b60208152600061282a6020830184612899565b600080604083850312156128eb57600080fd5b82356128f6816127f8565b946020939093013593505050565b60208152600082516060602084015280516080840152602081015160a0840152604081015160c0840152606081015160e0840152608081015160c0610100850152612953610140850182612899565b905060a082015115156101208501526020850151604085015260408501516060850152809250505092915050565b600080600080600085870361012081121561299b57600080fd5b86356129a6816127f8565b955060208701356129b681612831565b9450604087013567ffffffffffffffff808211156129d357600080fd5b818901915089601f8301126129e757600080fd5b8135818111156129f657600080fd5b8a60208260051b8501011115612a0b57600080fd5b60209290920195509093505060c0605f1982011215612a2957600080fd5b506060860190509295509295909350565b600060208284031215612a4c57600080fd5b5051919050565b602080825260069082015265085d985d5b1d60d21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b818103818111156126fe576126fe612a73565b80820281158282048414176126fe576126fe612a73565b600082612ad057634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612ae757600080fd5b815161282a816127f8565b808201808211156126fe576126fe612a73565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715612b3e57612b3e612b05565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612b6d57612b6d612b05565b604052919050565b8051612b8081612831565b919050565b60006020808385031215612b9857600080fd5b825167ffffffffffffffff80821115612bb057600080fd5b9084019060c08287031215612bc457600080fd5b612bcc612b1b565b8251815283830151848201526040830151604082015260608301516060820152608083015182811115612bfe57600080fd5b8301601f81018813612c0f57600080fd5b805183811115612c2157612c21612b05565b612c33601f8201601f19168701612b44565b93508084528886828401011115612c4957600080fd5b612c5881878601888501612875565b5050816080820152612c6c60a08401612b75565b60a08201529695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b600060208284031215612cb957600080fd5b815161282a81612831565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122028107070b7084166daeadb44a3b2ace87bd9748c8a1e41463836d3adc1d8a41464736f6c63430008170033

Block Transaction 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

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.