ETH Price: $2,398.55 (-1.24%)

Contract

0x16Ab7178b1B062A326C007a52E32A67218151b59

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
0x608060401086814042023-08-25 11:06:25407 days ago1692961585IN
 Create: StrategyAuraSideChainOmnichainSwap
0 ETH0.0034354459780.00000007

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StrategyAuraSideChainOmnichainSwap

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 27 : StrategyAuraSideChainOmnichainSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin-4/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin-4/contracts/token/ERC20/utils/SafeERC20.sol";

import "../../interfaces/common/IUniswapRouterETH.sol";
import "../../interfaces/beethovenx/IBalancerVault.sol";
import "../../interfaces/aura/IAuraRewardPool.sol";
import "../../interfaces/curve/IStreamer.sol";
import "../../interfaces/aura/IAuraBooster.sol";
import "../../interfaces/common/IWrappedNative.sol";
import "../Common/StratFeeManagerInitializable.sol";
import "./BalancerActionsLib.sol";
import "./BeefyBalancerStructs.sol";
import "../../utils/UniV3Actions.sol";

interface IBalancerPool {
    function getPoolId() external view returns (bytes32);
}

interface ISwapper { 
    function swapAura(uint256 _amount) external payable;
    function estimate(uint256 _amount) external view returns (uint256 gasNeeded);
}

contract StrategyAuraSideChainOmnichainSwap is StratFeeManagerInitializable {
    using SafeERC20 for IERC20;

    // Tokens used
    address public want;
    address public output;
    address public aura;
    address public native;

    // Third party contracts
    address public booster;
    address public rewardPool;
    address public uniswapRouter;
    address public swapper;
    uint256 public pid;

    // Balancer Router set up
    IBalancerVault.SwapKind public swapKind;
    IBalancerVault.FundManagement public funds;

    // Swap details
    BeefyBalancerStructs.Input public input;
    BeefyBalancerStructs.BatchSwapStruct[] public nativeToInputRoute;
    BeefyBalancerStructs.BatchSwapStruct[] public outputToNativeRoute;
    address[] public nativeToInputAssets;
    address[] public outputToNativeAssets;

    // Our needed reward token information
    mapping(address => BeefyBalancerStructs.Reward) public rewards;
    address[] public rewardTokens;

  
    // Some needed state variables
    bool public harvestOnDeposit;
    uint256 public lastHarvest;
    uint256 public totalLocked;
    uint256 public minSwap; 
    uint256 public constant DURATION = 1 days;

    event StratHarvest(address indexed harvester, uint256 indexed wantHarvested, uint256 indexed tvl);
    event Deposit(uint256 indexed tvl);
    event Withdraw(uint256 indexed tvl);
    event ChargedFees(uint256 indexed callFees, uint256 indexed beefyFees, uint256 indexed strategistFees);

    function initialize(
        address _want,
        address _aura,
        bool _inputIsComposable,
        BeefyBalancerStructs.BatchSwapStruct[] memory _nativeToInputRoute,
        BeefyBalancerStructs.BatchSwapStruct[] memory _outputToNativeRoute,
        address _booster,
        address _swapper,
        uint256 _pid,
        address[] memory _nativeToInput,
        address[] memory _outputToNative,
        CommonAddresses calldata _commonAddresses
    ) public initializer  {
        __StratFeeManager_init(_commonAddresses);

        for (uint i; i < _nativeToInputRoute.length; ++i) {
            nativeToInputRoute.push(_nativeToInputRoute[i]);
        }

        for (uint j; j < _outputToNativeRoute.length; ++j) {
            outputToNativeRoute.push(_outputToNativeRoute[j]);
        }

        want = _want;
        aura = _aura;
        booster = _booster;
        pid = _pid;
        outputToNativeAssets = _outputToNative;
        nativeToInputAssets = _nativeToInput;
        output = outputToNativeAssets[0];
        native = nativeToInputAssets[0];
        input.input = nativeToInputAssets[nativeToInputAssets.length - 1];
        input.isComposable = _inputIsComposable;
        uniswapRouter = address(0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45);
        swapper = _swapper;

        (,,,rewardPool,,) = IAuraBooster(booster).poolInfo(pid);

        minSwap = 10 ether;

        swapKind = IBalancerVault.SwapKind.GIVEN_IN;
        funds = IBalancerVault.FundManagement(address(this), false, payable(address(this)), false);

        _giveAllowances();
    }

    // puts the funds to work
    function deposit() public whenNotPaused {
        uint256 wantBal = IERC20(want).balanceOf(address(this));

        if (wantBal > 0) {
            IAuraBooster(booster).deposit(pid, wantBal, true);
            emit Deposit(balanceOf());
        }
    }

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

        uint256 wantBal = IERC20(want).balanceOf(address(this));

        if (wantBal < _amount) {
            IAuraRewardPool(rewardPool).withdrawAndUnwrap(_amount - wantBal, false);
            wantBal = IERC20(want).balanceOf(address(this));
        }

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

        if (tx.origin != owner() && !paused()) {
            uint256 withdrawalFeeAmount = wantBal * withdrawalFee / WITHDRAWAL_MAX;
            wantBal = wantBal - withdrawalFeeAmount;
        }

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

        emit Withdraw(balanceOf());
    }

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

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

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

    // compounds earnings and charges performance fee
    function _harvest(address callFeeRecipient) internal whenNotPaused {
        uint256 before = balanceOfWant();
        IAuraRewardPool(rewardPool).getReward();
        swapRewardsToNative();
        uint256 nativeBal = IERC20(native).balanceOf(address(this));

        if (nativeBal > 0) {
            chargeFees(callFeeRecipient);
            addLiquidity();
            uint256 wantHarvested = balanceOfWant() - before;
            totalLocked = wantHarvested + lockedProfit();
            deposit();

            lastHarvest = block.timestamp;
            emit StratHarvest(msg.sender, wantHarvested, balanceOf());
        }
    }

    function swapRewardsToNative() internal {
        uint256 outputBal = IERC20(output).balanceOf(address(this));
        if (outputBal > 0) {
            IBalancerVault.BatchSwapStep[] memory _swaps = BalancerActionsLib.buildSwapStructArray(outputToNativeRoute, outputBal);
            BalancerActionsLib.balancerSwap(unirouter, swapKind, _swaps, outputToNativeAssets, funds, int256(outputBal));
        }

        // extras
        for (uint i; i < rewardTokens.length; ++i) {
            uint bal = IERC20(rewardTokens[i]).balanceOf(address(this));
            if (bal >= rewards[rewardTokens[i]].minAmount) {
                if (rewards[rewardTokens[i]].assets[0] != address(0)) {
                    BeefyBalancerStructs.BatchSwapStruct[] memory swapInfo = new BeefyBalancerStructs.BatchSwapStruct[](rewards[rewardTokens[i]].assets.length - 1);
                    for (uint j; j < rewards[rewardTokens[i]].assets.length - 1; ++j) {
                        swapInfo[j] = rewards[rewardTokens[i]].swapInfo[j];
                    }
                    IBalancerVault.BatchSwapStep[] memory _swaps = BalancerActionsLib.buildSwapStructArray(swapInfo, bal);
                    BalancerActionsLib.balancerSwap(unirouter, swapKind, _swaps, rewards[rewardTokens[i]].assets, funds, int256(bal));
                } else {
                    UniV3Actions.swapV3(uniswapRouter, rewards[rewardTokens[i]].routeToNative, bal);
                }
            }
        }

        uint256 auraBal = IERC20(aura).balanceOf(address(this));
        uint256 nativeBal = IERC20(native).balanceOf(address(this));
        uint256 balanceThis = address(this).balance;
        uint256 gasNeeded = ISwapper(swapper).estimate(auraBal);

        if ((nativeBal + balanceThis) >= gasNeeded) {
            uint256 nativeToWithdraw = gasNeeded <= balanceThis ? 0 : gasNeeded - balanceThis;
            if (auraBal > minSwap) {
                IWrappedNative(native).withdraw(nativeToWithdraw);
                ISwapper(swapper).swapAura{value: gasNeeded}(auraBal);
            }
        }
    }

    // performance fees
    function chargeFees(address callFeeRecipient) internal {
        IFeeConfig.FeeCategory memory fees = getFees();
        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);
    }

    // Adds liquidity to AMM and gets more LP tokens.
     function addLiquidity() internal {
        uint256 nativeBal = IERC20(native).balanceOf(address(this));
        if (native != input.input) {
            IBalancerVault.BatchSwapStep[] memory _swaps = BalancerActionsLib.buildSwapStructArray(nativeToInputRoute, nativeBal);
            BalancerActionsLib.balancerSwap(unirouter, swapKind, _swaps, nativeToInputAssets, funds, int256(nativeBal));
        }

        if (input.input != want) {
            uint256 inputBal = IERC20(input.input).balanceOf(address(this));
            BalancerActionsLib.balancerJoin(unirouter, IBalancerPool(want).getPoolId(), input.input, inputBal);
        }
    }
    
    function lockedProfit() public view returns (uint256) {
        uint256 elapsed = block.timestamp - lastHarvest;
        uint256 remaining = elapsed < DURATION ? DURATION - elapsed : 0;
        return totalLocked * remaining / DURATION;
    }

    // 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));
    }

    // it calculates how much 'want' the strategy has working in the farm.
    function balanceOfPool() public view returns (uint256) {
        return IAuraRewardPool(rewardPool).balanceOf(address(this));
    }

    // returns rewards unharvested
    function rewardsAvailable() public view returns (uint256) {
        return IAuraRewardPool(rewardPool).earned(address(this));
    }

    // native reward amount for calling harvest
    function callReward() public pure returns (uint256) {
        return 0; // multiple swap providers with no easy way to estimate native output.
    }

    function addRewardToken(address _token, BeefyBalancerStructs.BatchSwapStruct[] memory _swapInfo, address[] memory _assets, bytes calldata _routeToNative, uint _minAmount) external onlyOwner {
        require(_token != want, "!want");
        require(_token != native, "!native");
        if (_assets[0] != address(0)) {
            IERC20(_token).safeApprove(unirouter, 0);
            IERC20(_token).safeApprove(unirouter, type(uint).max);
        } else {
            IERC20(_token).safeApprove(uniswapRouter, 0);
            IERC20(_token).safeApprove(uniswapRouter, type(uint).max);
        }

        rewards[_token].assets = _assets;
        rewards[_token].routeToNative = _routeToNative;
        rewards[_token].minAmount = _minAmount;

        for (uint i; i < _swapInfo.length; ++i) {
            rewards[_token].swapInfo[i].poolId = _swapInfo[i].poolId;
            rewards[_token].swapInfo[i].assetInIndex = _swapInfo[i].assetInIndex;
            rewards[_token].swapInfo[i].assetOutIndex = _swapInfo[i].assetOutIndex;
        }
        rewardTokens.push(_token);
    }

    function resetRewardTokens() external onlyManager {
        for (uint i; i < rewardTokens.length; ++i) {
            delete rewards[rewardTokens[i]];
        }

        delete rewardTokens;
    }

    function setMinSwap(uint256 _min) external onlyManager {
        minSwap = _min;
    }

    function setHarvestOnDeposit(bool _harvestOnDeposit) external onlyManager {
        harvestOnDeposit = _harvestOnDeposit;

        if (harvestOnDeposit) {
            setWithdrawalFee(0);
        } else {
            setWithdrawalFee(10);
        }
    }

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

        IAuraRewardPool(rewardPool).withdrawAndUnwrap(balanceOfPool(), false);

        uint256 wantBal = IERC20(want).balanceOf(address(this));
        IERC20(want).transfer(vault, wantBal);
    }

    // pauses deposits and withdraws all funds from third party systems.
    function panic() public onlyManager {
        pause();
        IAuraRewardPool(rewardPool).withdrawAndUnwrap(balanceOfPool(), false);
    }

    function pause() public onlyManager {
        _pause();

        _removeAllowances();
    }

    function unpause() external onlyManager {
        _unpause();

        _giveAllowances();

        deposit();
    }

    function _giveAllowances() internal {
        IERC20(want).safeApprove(booster, type(uint).max);
        IERC20(output).safeApprove(unirouter, type(uint).max);
        IERC20(native).safeApprove(unirouter, type(uint).max);
        IERC20(aura).safeApprove(swapper, type(uint).max);
        if (!input.isComposable) {
            IERC20(input.input).safeApprove(unirouter, 0);
            IERC20(input.input).safeApprove(unirouter, type(uint).max);
        }
        if (rewardTokens.length != 0) {
            for (uint i; i < rewardTokens.length; ++i) {
                if (rewards[rewardTokens[i]].assets[0] != address(0)) {
                    IERC20(rewardTokens[i]).safeApprove(unirouter, 0);
                    IERC20(rewardTokens[i]).safeApprove(unirouter, type(uint).max);
                } else {
                    IERC20(rewardTokens[i]).safeApprove(uniswapRouter, 0);
                    IERC20(rewardTokens[i]).safeApprove(uniswapRouter, type(uint).max);
                }
            }
        }
    }

    function _removeAllowances() internal {
        IERC20(want).safeApprove(booster, 0);
        IERC20(output).safeApprove(unirouter, 0);
        IERC20(native).safeApprove(unirouter, 0);
        IERC20(aura).safeApprove(swapper, 0);
        if (!input.isComposable) {
            IERC20(input.input).safeApprove(unirouter, 0);
        }
        if (rewardTokens.length != 0) {
            for (uint i; i < rewardTokens.length; ++i) {
                if (rewards[rewardTokens[i]].assets[0] != address(0)) {
                    IERC20(rewardTokens[i]).safeApprove(unirouter, 0);
                } else {
                    IERC20(rewardTokens[i]).safeApprove(uniswapRouter, 0);
                }
            }
        }
    }

     // allow this contract to receive ether
    receive() external payable {}
}

File 2 of 27 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 3 of 27 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 27 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 5 of 27 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 6 of 27 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 7 of 27 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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 8 of 27 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 9 of 27 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _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 10 of 27 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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]
 * ```
 * 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. Equivalent to `reinitializer(1)`.
     */
    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.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so 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.
     *
     * 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.
     */
    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.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 11 of 27 : 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 "../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 12 of 27 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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
     * ====
     *
     * [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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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 13 of 27 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../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;
    }

    /**
     * @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 14 of 27 : IAuraBooster.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IAuraBooster {
    function deposit(uint256 pid, uint256 amount, bool stake) external returns (bool);
    function withdraw(uint256 _pid, uint256 _amount) external returns(bool);
    function earmarkRewards(uint256 _pid) external;
    function poolInfo(uint256 pid) external view returns (
        address lptoken,
        address token,
        address gauge,
        address crvRewards,
        address stash,
        bool shutdown
    );
}

File 15 of 27 : IAuraRewardPool.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.9.0;

interface IAuraRewardPool {
    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 balanceOf(address account) external view returns (uint256);
    function stakingToken() external view returns (address);
    function rewardsToken() external view returns (address);
    function withdrawAndUnwrap(uint256 _amount, bool claim) external;
}

File 16 of 27 : IBalancerVault.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;

interface IBalancerVault {
    struct SingleSwap {
        bytes32 poolId;
        SwapKind kind;
        address assetIn;
        address assetOut;
        uint256 amount;
        bytes userData;
    }

    struct BatchSwapStep {
        bytes32 poolId;
        uint256 assetInIndex;
        uint256 assetOutIndex;
        uint256 amount;
        bytes userData;
    }

    struct FundManagement {
        address sender;
        bool fromInternalBalance;
        address payable recipient;
        bool toInternalBalance;
    }

    struct JoinPoolRequest {
        address[] assets;
        uint256[] maxAmountsIn;
        bytes userData;
        bool fromInternalBalance;
    }

    enum SwapKind { GIVEN_IN, GIVEN_OUT }

    function swap(
        SingleSwap memory singleSwap,
        FundManagement memory funds,
        uint256 limit,
        uint256 deadline
    ) external payable returns (uint256);

    function batchSwap(
        SwapKind kind,
        BatchSwapStep[] memory swaps,
        address[] memory assets,
        FundManagement memory funds,
        int256[] memory limits,
        uint256 deadline
    ) external returns (int256[] memory assetDeltas);

    function joinPool(
        bytes32 poolId,
        address sender,
        address recipient,
        JoinPoolRequest memory request
    ) external;

    function getPoolTokens(bytes32 poolId)
        external
        view
        returns (
            address[] memory tokens,
            uint256[] memory balances,
            uint256 lastChangeBlock
        );

    function getPool(bytes32 poolId)
        external
        view
        returns (address, uint8);

    function flashLoan(
        address recipient,
        address[] memory tokens,
        uint256[] memory amounts,
        bytes memory userData
    ) external;
    
}

File 17 of 27 : 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 18 of 27 : IKyberElastic.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IKyberElastic {
    struct ExactInputSingleParams {
    address tokenIn;
    address tokenOut;
    uint24 fee;
    address recipient;
    uint256 deadline;
    uint256 amountIn;
    uint256 minAmountOut;
    uint160 limitSqrtP;
  }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function swapExactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 minAmountOut;
  }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function swapExactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 maxAmountIn;
        uint160 limitSqrtP;
  }


    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function swapExactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
         bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 maxAmountIn;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function swapExactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 19 of 27 : IUniswapRouterETH.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.9.0;

interface IUniswapRouterETH {
    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);

    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);

    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);

    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);

    function swapExactTokensForTokens(
        uint amountIn, 
        uint amountOutMin, 
        address[] calldata path, 
        address to, 
        uint deadline
    ) external returns (uint[] memory amounts);

    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);

    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}

File 20 of 27 : IUniswapRouterV3.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IUniswapRouterV3 {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 21 of 27 : IUniswapRouterV3WithDeadline.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0;
pragma experimental ABIEncoderV2;

interface IUniswapRouterV3WithDeadline {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 22 of 27 : 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 23 of 27 : IStreamer.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.9.0;

interface IStreamer {
    function get_reward() external;
}

File 24 of 27 : BalancerActionsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; 

import "../../interfaces/beethovenx/IBalancerVault.sol";
import "@openzeppelin-4/contracts/token/ERC20/ERC20.sol";
import "./BeefyBalancerStructs.sol";

library BalancerActionsLib {
    function balancerJoin(address _vault, bytes32 _poolId, address _tokenIn, uint256 _amountIn) internal {
        (address[] memory lpTokens,,) = IBalancerVault(_vault).getPoolTokens(_poolId);
        uint256[] memory amounts = new uint256[](lpTokens.length);
        for (uint256 i = 0; i < amounts.length;) {
            amounts[i] = lpTokens[i] == _tokenIn ? _amountIn : 0;
            unchecked { ++i; }
        }
        bytes memory userData = abi.encode(1, amounts, 1);

        IBalancerVault.JoinPoolRequest memory request = IBalancerVault.JoinPoolRequest(lpTokens, amounts, userData, false);
        IBalancerVault(_vault).joinPool(_poolId, address(this), address(this), request);
    }

    function multiJoin(address _vault, address _want, bytes32 _poolId, address _token0In, address _token1In, uint256 _amount0In, uint256 _amount1In) internal {
        (address[] memory lpTokens,uint256[] memory balances,) = IBalancerVault(_vault).getPoolTokens(_poolId);
        uint256 supply = IERC20(_want).totalSupply();
        uint256[] memory amounts = new uint256[](lpTokens.length);
        for (uint256 i = 0; i < amounts.length;) {
            if (lpTokens[i] == _token0In) amounts[i] = _amount0In;
            else if (lpTokens[i] == _token1In) amounts[i] = _amount1In;
            else amounts[i] = 0;
            unchecked { ++i; }
        }

        uint256 bpt0 = amounts[0] * supply / balances[0] - 10;
        uint256 bpt1 = amounts[1] * supply / balances[1] - 10;

        uint256 bptOut = bpt0 > bpt1 ? bpt1 : bpt0;
        bytes memory userData = abi.encode(3, bptOut);

        IBalancerVault.JoinPoolRequest memory request = IBalancerVault.JoinPoolRequest(lpTokens, amounts, userData, false);
        IBalancerVault(_vault).joinPool(_poolId, address(this), address(this), request);
    }

     function buildSwapStructArray(BeefyBalancerStructs.BatchSwapStruct[] memory _route, uint256 _amountIn) internal pure returns (IBalancerVault.BatchSwapStep[] memory) {
        IBalancerVault.BatchSwapStep[] memory swaps = new IBalancerVault.BatchSwapStep[](_route.length);
        for (uint i; i < _route.length;) {
            if (i == 0) {
                swaps[0] =
                    IBalancerVault.BatchSwapStep({
                        poolId: _route[0].poolId,
                        assetInIndex: _route[0].assetInIndex,
                        assetOutIndex: _route[0].assetOutIndex,
                        amount: _amountIn,
                        userData: ""
                    });
            } else {
                swaps[i] =
                    IBalancerVault.BatchSwapStep({
                        poolId: _route[i].poolId,
                        assetInIndex: _route[i].assetInIndex,
                        assetOutIndex: _route[i].assetOutIndex,
                        amount: 0,
                        userData: ""
                    });
            }
            unchecked {
                ++i;
            }
        }

        return swaps;
    }

    function balancerSwap(address _vault, IBalancerVault.SwapKind _swapKind, IBalancerVault.BatchSwapStep[] memory _swaps, address[] memory _route, IBalancerVault.FundManagement memory _funds, int256 _amountIn) internal returns (int256[] memory) {
        int256[] memory limits = new int256[](_route.length);
        for (uint i; i < _route.length;) {
            if (i == 0) {
                limits[0] = _amountIn;
            } else if (i == _route.length - 1) {
                limits[i] = -1;
            }
            unchecked { ++i; }
        }
        return IBalancerVault(_vault).batchSwap(_swapKind, _swaps, _route, _funds, limits, block.timestamp);
    }
}

File 25 of 27 : BeefyBalancerStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; 

library BeefyBalancerStructs {
    enum RouterType {
        BALANCER,
        UNISWAP_V2,
        UNISWAP_V3
    }
    struct BatchSwapStruct {
        bytes32 poolId;
        uint256 assetInIndex;
        uint256 assetOutIndex;
    }

    struct Reward {
        RouterType routerType;
        address router;
        mapping(uint => BatchSwapStruct) swapInfo;
        address[] assets;
        bytes routeToNative; // backup route in case there is no Balancer liquidity for reward
        uint minAmount; // minimum amount to be swapped to native
    }

     struct Input {
        address input;
        bool isComposable;
        bool isBeets;
    }
}

File 26 of 27 : StratFeeManagerInitializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "../../interfaces/common/IFeeConfig.sol";

contract StratFeeManagerInitializable is OwnableUpgradeable, PausableUpgradeable {

    struct CommonAddresses {
        address vault;
        address unirouter;
        address keeper;
        address strategist;
        address beefyFeeRecipient;
        address beefyFeeConfig;
    }

    // common addresses for the strategy
    address public vault;
    address public unirouter;
    address public keeper;
    address public strategist;
    address public beefyFeeRecipient;
    IFeeConfig public beefyFeeConfig;

    uint256 constant DIVISOR = 1 ether;
    uint256 constant public WITHDRAWAL_FEE_CAP = 50;
    uint256 constant public WITHDRAWAL_MAX = 10000;
    uint256 internal withdrawalFee;

    event SetStratFeeId(uint256 feeId);
    event SetWithdrawalFee(uint256 withdrawalFee);
    event SetVault(address vault);
    event SetUnirouter(address unirouter);
    event SetKeeper(address keeper);
    event SetStrategist(address strategist);
    event SetBeefyFeeRecipient(address beefyFeeRecipient);
    event SetBeefyFeeConfig(address beefyFeeConfig);

    function __StratFeeManager_init(CommonAddresses calldata _commonAddresses) internal onlyInitializing {
        __Ownable_init();
        __Pausable_init();
        vault = _commonAddresses.vault;
        unirouter = _commonAddresses.unirouter;
        keeper = _commonAddresses.keeper;
        strategist = _commonAddresses.strategist;
        beefyFeeRecipient = _commonAddresses.beefyFeeRecipient;
        beefyFeeConfig = IFeeConfig(_commonAddresses.beefyFeeConfig);
        withdrawalFee = 10;
    }

    // checks that caller is either owner or keeper.
    modifier onlyManager() {
        _checkManager();
        _;
    }

    function _checkManager() internal view {
        require(msg.sender == owner() || msg.sender == keeper, "!manager");
    }

    // fetch fees from config contract
    function getFees() internal view returns (IFeeConfig.FeeCategory memory) {
        return beefyFeeConfig.getFees(address(this));
    }

    // fetch fees from config contract and dynamic deposit/withdraw fees
    function getAllFees() external view returns (IFeeConfig.AllFees memory) {
        return IFeeConfig.AllFees(getFees(), depositFee(), withdrawFee());
    }

    function getStratFeeId() external view returns (uint256) {
        return beefyFeeConfig.stratFeeId(address(this));
    }

    function setStratFeeId(uint256 _feeId) external onlyManager {
        beefyFeeConfig.setStratFeeId(_feeId);
        emit SetStratFeeId(_feeId);
    }

    // adjust withdrawal fee
    function setWithdrawalFee(uint256 _fee) public onlyManager {
        require(_fee <= WITHDRAWAL_FEE_CAP, "!cap");
        withdrawalFee = _fee;
        emit SetWithdrawalFee(_fee);
    }

    // set new vault (only for strategy upgrades)
    function setVault(address _vault) external onlyOwner {
        vault = _vault;
        emit SetVault(_vault);
    }

    // set new unirouter
    function setUnirouter(address _unirouter) external onlyOwner {
        unirouter = _unirouter;
        emit SetUnirouter(_unirouter);
    }

    // set new keeper to manage strat
    function setKeeper(address _keeper) external onlyManager {
        keeper = _keeper;
        emit SetKeeper(_keeper);
    }

    // set new strategist address to receive strat fees
    function setStrategist(address _strategist) external {
        require(msg.sender == strategist, "!strategist");
        strategist = _strategist;
        emit SetStrategist(_strategist);
    }

    // set new beefy fee address to receive beefy fees
    function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner {
        beefyFeeRecipient = _beefyFeeRecipient;
        emit SetBeefyFeeRecipient(_beefyFeeRecipient);
    }

    // set new fee config address to fetch fees
    function setBeefyFeeConfig(address _beefyFeeConfig) external onlyOwner {
        beefyFeeConfig = IFeeConfig(_beefyFeeConfig);
        emit SetBeefyFeeConfig(_beefyFeeConfig);
    }

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

    function withdrawFee() public virtual view returns (uint256) {
        return paused() ? 0 : withdrawalFee;
    }

    function beforeDeposit() external virtual {}
}

File 27 of 27 : UniV3Actions.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; 
import "../interfaces/common/IKyberElastic.sol";
import "../interfaces/common/IUniswapRouterV3.sol";
import "../interfaces/common/IUniswapRouterV3WithDeadline.sol";

library UniV3Actions {
     // kyber V3 swap
    function kyberSwap(address _router, bytes memory _path, uint256 _amount) internal returns (uint256 amountOut) {
        IKyberElastic.ExactInputParams memory swapParams = IKyberElastic.ExactInputParams({
            path: _path,
            recipient: address(this),
            deadline: block.timestamp,
            amountIn: _amount,
            minAmountOut: 0
        });
        return IKyberElastic(_router).swapExactInput(swapParams);
    }

    // Uniswap V3 swap
    function swapV3(address _router, bytes memory _path, uint256 _amount) internal returns (uint256 amountOut) {
        IUniswapRouterV3.ExactInputParams memory swapParams = IUniswapRouterV3.ExactInputParams({
            path: _path,
            recipient: address(this),
            amountIn: _amount,
            amountOutMinimum: 0
        });
        return IUniswapRouterV3(_router).exactInput(swapParams);
    }

    // Uniswap V3 swap with deadline
    function swapV3WithDeadline(address _router, bytes memory _path, uint256 _amount) internal returns (uint256 amountOut) {
        IUniswapRouterV3WithDeadline.ExactInputParams memory swapParams = IUniswapRouterV3WithDeadline.ExactInputParams({
            path: _path,
            recipient: address(this),
            deadline: block.timestamp,
            amountIn: _amount,
            amountOutMinimum: 0
        });
        return IUniswapRouterV3WithDeadline(_router).exactInput(swapParams);
    }

    // Uniswap V3 swap with deadline
    function swapV3WithDeadline(address _router, bytes memory _path, uint256 _amount, address _to) internal returns (uint256 amountOut) {
        IUniswapRouterV3WithDeadline.ExactInputParams memory swapParams = IUniswapRouterV3WithDeadline.ExactInputParams({
            path: _path,
            recipient: _to,
            deadline: block.timestamp,
            amountIn: _amount,
            amountOutMinimum: 0
        });
        return IUniswapRouterV3WithDeadline(_router).exactInput(swapParams);
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"callFees","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"beefyFees","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"strategistFees","type":"uint256"}],"name":"ChargedFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"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":"beefyFeeConfig","type":"address"}],"name":"SetBeefyFeeConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"beefyFeeRecipient","type":"address"}],"name":"SetBeefyFeeRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"keeper","type":"address"}],"name":"SetKeeper","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feeId","type":"uint256"}],"name":"SetStratFeeId","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":"unirouter","type":"address"}],"name":"SetUnirouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vault","type":"address"}],"name":"SetVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawalFee","type":"uint256"}],"name":"SetWithdrawalFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"harvester","type":"address"},{"indexed":true,"internalType":"uint256","name":"wantHarvested","type":"uint256"},{"indexed":true,"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":true,"internalType":"uint256","name":"tvl","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWAL_FEE_CAP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWAL_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"}],"internalType":"struct BeefyBalancerStructs.BatchSwapStruct[]","name":"_swapInfo","type":"tuple[]"},{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"bytes","name":"_routeToNative","type":"bytes"},{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"addRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"aura","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"booster","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","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":"funds","outputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"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":[],"name":"getStratFeeId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_want","type":"address"},{"internalType":"address","name":"_aura","type":"address"},{"internalType":"bool","name":"_inputIsComposable","type":"bool"},{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"}],"internalType":"struct BeefyBalancerStructs.BatchSwapStruct[]","name":"_nativeToInputRoute","type":"tuple[]"},{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"}],"internalType":"struct BeefyBalancerStructs.BatchSwapStruct[]","name":"_outputToNativeRoute","type":"tuple[]"},{"internalType":"address","name":"_booster","type":"address"},{"internalType":"address","name":"_swapper","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address[]","name":"_nativeToInput","type":"address[]"},{"internalType":"address[]","name":"_outputToNative","type":"address[]"},{"components":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"unirouter","type":"address"},{"internalType":"address","name":"keeper","type":"address"},{"internalType":"address","name":"strategist","type":"address"},{"internalType":"address","name":"beefyFeeRecipient","type":"address"},{"internalType":"address","name":"beefyFeeConfig","type":"address"}],"internalType":"struct StratFeeManagerInitializable.CommonAddresses","name":"_commonAddresses","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"input","outputs":[{"internalType":"address","name":"input","type":"address"},{"internalType":"bool","name":"isComposable","type":"bool"},{"internalType":"bool","name":"isBeets","type":"bool"}],"stateMutability":"view","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":"lockedProfit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"native","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nativeToInputAssets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nativeToInputRoute","outputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"output","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"outputToNativeAssets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"outputToNativeRoute","outputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"}],"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":[],"name":"pid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"retireStrat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"enum BeefyBalancerStructs.RouterType","name":"routerType","type":"uint8"},{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"routeToNative","type":"bytes"},{"internalType":"uint256","name":"minAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_beefyFeeConfig","type":"address"}],"name":"setBeefyFeeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_beefyFeeRecipient","type":"address"}],"name":"setBeefyFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_harvestOnDeposit","type":"bool"}],"name":"setHarvestOnDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_keeper","type":"address"}],"name":"setKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min","type":"uint256"}],"name":"setMinSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeId","type":"uint256"}],"name":"setStratFeeId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategist","type":"address"}],"name":"setStrategist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_unirouter","type":"address"}],"name":"setUnirouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"setVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setWithdrawalFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapKind","outputs":[{"internalType":"enum IBalancerVault.SwapKind","name":"","type":"uint8"}],"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":"unirouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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"}]

608060405234801561001057600080fd5b5061524a806100206000396000f3fe6080604052600436106103e85760003560e01c8063735de9f711610208578063c1a3d44c11610118578063e7a7250a116100ab578063f1a392da1161007a578063f1a392da14610b96578063f20eaeb814610bac578063f2fde38b14610bcc578063fb61778714610bec578063fbfa77cf14610c0157600080fd5b8063e7a7250a14610af9578063e941fa7814610b0e578063eaed3f4f14610b23578063f106845414610b8057600080fd5b8063d0e30db0116100e7578063d0e30db014610a8f578063d92f3d7314610aa4578063dfbdc43714610ac4578063e13b7f5c14610ad957600080fd5b8063c1a3d44c146109c9578063c6def076146109de578063c7b9d530146109fe578063c89f2ce414610a1e57600080fd5b806397fd323d1161019b578063ac1e50251161016a578063ac1e502514610927578063aced166114610947578063b087432414610967578063b20feaaf14610987578063be12a978146109a957600080fd5b806397fd323d1461074c5780639e1a297a146108c7578063a68833e5146108e7578063a9e282b81461090757600080fd5b80638912cb8b116101d75780638912cb8b1461085a5780638cfc0250146108745780638da5cb5b146108895780638e145459146108a757600080fd5b8063735de9f7146107e5578063748747e6146108055780637bb7bed1146108255780638456cb591461084557600080fd5b8063449c27a81161030357806359cd90311161029657806367a527931161026557806367a527931461074c5780636817031b146107605780636ae1a26d14610780578063715018a6146107bb578063722713f7146107d057600080fd5b806359cd9031146106cb5780635c975abb146106e157806366666aa914610705578063671f6a261461072557600080fd5b80634746fb55116102d25780634746fb551461066a57806354518b1a1461068a57806356891412146106a0578063573fef0a146106b657600080fd5b8063449c27a81461061657806344b813961461062b5780634641257d146106405780634700d3051461065557600080fd5b80631fe4a6861161037b5780633c800d5d1161034a5780633c800d5d146105a15780633cdc9c7a146105c15780633e55f932146105e15780633f4ba83a1461060157600080fd5b80631fe4a68614610521578063257ae0de146105415780632b3297f9146105615780632e1a7d4d1461058157600080fd5b806311588086116103b7578063115880861461048f57806311b0b42d146104b25780631be05289146104ea5780631f1fcd511461050157600080fd5b80630700037d146103f45780630e5c011e1461042d5780630e8fbb5a1461044f578063106fdbd01461046f57600080fd5b366103ef57005b600080fd5b34801561040057600080fd5b5061041461040f36600461440b565b610c21565b604051610424949392919061448e565b60405180910390f35b34801561043957600080fd5b5061044d61044836600461440b565b610ce0565b005b34801561045b57600080fd5b5061044d61046a3660046144f1565b610cec565b34801561047b57600080fd5b5061044d61048a36600461440b565b610d21565b34801561049b57600080fd5b506104a4610d7e565b604051908152602001610424565b3480156104be57600080fd5b5060a1546104d2906001600160a01b031681565b6040516001600160a01b039091168152602001610424565b3480156104f657600080fd5b506104a46201518081565b34801561050d57600080fd5b50609e546104d2906001600160a01b031681565b34801561052d57600080fd5b50609a546104d2906001600160a01b031681565b34801561054d57600080fd5b506098546104d2906001600160a01b031681565b34801561056d57600080fd5b5060a5546104d2906001600160a01b031681565b34801561058d57600080fd5b5061044d61059c36600461450e565b610df1565b3480156105ad57600080fd5b506104d26105bc36600461450e565b61102a565b3480156105cd57600080fd5b5061044d6105dc3660046146e2565b611054565b3480156105ed57600080fd5b5061044d6105fc36600461450e565b611355565b34801561060d57600080fd5b5061044d6113ec565b34801561062257600080fd5b5061044d61140e565b34801561063757600080fd5b506104a46114af565b34801561064c57600080fd5b5061044d611507565b34801561066157600080fd5b5061044d611510565b34801561067657600080fd5b50609c546104d2906001600160a01b031681565b34801561069657600080fd5b506104a461271081565b3480156106ac57600080fd5b506104a460b35481565b3480156106c257600080fd5b5061044d611593565b3480156106d757600080fd5b506104a460b45481565b3480156106ed57600080fd5b5060655460ff165b6040519015158152602001610424565b34801561071157600080fd5b5060a3546104d2906001600160a01b031681565b34801561073157600080fd5b5060a75461073f9060ff1681565b60405161042491906147cc565b34801561075857600080fd5b5060006104a4565b34801561076c57600080fd5b5061044d61077b36600461440b565b6115c8565b34801561078c57600080fd5b506107a061079b36600461450e565b61161e565b60408051938452602084019290925290820152606001610424565b3480156107c757600080fd5b5061044d611651565b3480156107dc57600080fd5b506104a4611663565b3480156107f157600080fd5b5060a4546104d2906001600160a01b031681565b34801561081157600080fd5b5061044d61082036600461440b565b611691565b34801561083157600080fd5b506104d261084036600461450e565b6116e7565b34801561085157600080fd5b5061044d6116f7565b34801561086657600080fd5b5060b1546106f59060ff1681565b34801561088057600080fd5b506104a461170f565b34801561089557600080fd5b506033546001600160a01b03166104d2565b3480156108b357600080fd5b50609b546104d2906001600160a01b031681565b3480156108d357600080fd5b506104d26108e236600461450e565b611740565b3480156108f357600080fd5b5061044d61090236600461440b565b611750565b34801561091357600080fd5b5061044d61092236600461450e565b6117a6565b34801561093357600080fd5b5061044d61094236600461450e565b6117b3565b34801561095357600080fd5b506099546104d2906001600160a01b031681565b34801561097357600080fd5b5061044d6109823660046147f2565b61182a565b34801561099357600080fd5b5061099c611c92565b6040516104249190614917565b3480156109b557600080fd5b506107a06109c436600461450e565b611cc8565b3480156109d557600080fd5b506104a4611cd8565b3480156109ea57600080fd5b5060a2546104d2906001600160a01b031681565b348015610a0a57600080fd5b5061044d610a1936600461440b565b611d09565b348015610a2a57600080fd5b5060a85460a954610a5a916001600160a01b038082169260ff600160a01b93849004811693928216929091041684565b60405161042494939291906001600160a01b039485168152921515602084015292166040820152901515606082015260800190565b348015610a9b57600080fd5b5061044d611d9f565b348015610ab057600080fd5b5061044d610abf36600461440b565b611ed2565b348015610ad057600080fd5b506104a4603281565b348015610ae557600080fd5b5060a0546104d2906001600160a01b031681565b348015610b0557600080fd5b506104a4611f28565b348015610b1a57600080fd5b506104a4611f57565b348015610b2f57600080fd5b5060aa54610b59906001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b0390941684529115156020840152151590820152606001610424565b348015610b8c57600080fd5b506104a460a65481565b348015610ba257600080fd5b506104a460b25481565b348015610bb857600080fd5b50609f546104d2906001600160a01b031681565b348015610bd857600080fd5b5061044d610be736600461440b565b611f76565b348015610bf857600080fd5b5061044d611fec565b348015610c0d57600080fd5b506097546104d2906001600160a01b031681565b60af602052600090815260409020805460038201805460ff8316936101009093046001600160a01b0316929190610c5790614994565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8390614994565b8015610cd05780601f10610ca557610100808354040283529160200191610cd0565b820191906000526020600020905b815481529060010190602001808311610cb357829003601f168201915b5050505050908060040154905084565b610ce981612175565b50565b610cf46122f3565b60b1805460ff191682151590811790915560ff1615610d1757610ce960006117b3565b610ce9600a6117b3565b610d2961234d565b609c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f91e28ce4210d103c13c5174847e463b836900f8dc63e9d9b42a4255169d19529906020015b60405180910390a150565b60a3546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a08231906024015b602060405180830381865afa158015610dc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dec91906149c8565b905090565b6097546001600160a01b03163314610e245760405162461bcd60e51b8152600401610e1b906149e1565b60405180910390fd5b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9191906149c8565b905081811015610f7d5760a3546001600160a01b031663c32e7202610eb68385614a17565b6040516001600160e01b031960e084901b168152600481019190915260006024820152604401600060405180830381600087803b158015610ef657600080fd5b505af1158015610f0a573d6000803e3d6000fd5b5050609e546040516370a0823160e01b81523060048201526001600160a01b0390911692506370a082319150602401602060405180830381865afa158015610f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7a91906149c8565b90505b81811115610f885750805b6033546001600160a01b03163214801590610fa6575060655460ff16155b15610fd8576000612710609d5483610fbe9190614a2a565b610fc89190614a41565b9050610fd48183614a17565b9150505b609754609e54610ff5916001600160a01b039182169116836123a7565b610ffd611663565b6040517f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d90600090a25050565b60ad818154811061103a57600080fd5b6000918252602090912001546001600160a01b0316905081565b61105c61234d565b609e546001600160a01b03908116908716036110a25760405162461bcd60e51b8152602060048201526005602482015264085dd85b9d60da1b6044820152606401610e1b565b60a1546001600160a01b03908116908716036110ea5760405162461bcd60e51b8152602060048201526007602482015266216e617469766560c81b6044820152606401610e1b565b60006001600160a01b03168460008151811061110857611108614a63565b60200260200101516001600160a01b03161461115a57609854611139906001600160a01b038881169116600061240a565b609854611155906001600160a01b03888116911660001961240a565b611191565b60a454611175906001600160a01b038881169116600061240a565b60a454611191906001600160a01b03888116911660001961240a565b6001600160a01b038616600090815260af6020908152604090912085516111c0926002909201918701906142ba565b506001600160a01b038616600090815260af602052604090206003016111e7838583614abf565b506001600160a01b038616600090815260af602052604081206004018290555b85518110156112fc5785818151811061122257611222614a63565b602090810291909101810151516001600160a01b038916600090815260af835260408082208583526001019093529190912055855186908290811061126957611269614a63565b6020908102919091018101518101516001600160a01b038916600090815260af83526040808220858352600190810190945290209091015585518690829081106112b5576112b5614a63565b6020908102919091018101516040908101516001600160a01b038a16600090815260af84528281208582526001019093529120600201556112f581614b7e565b9050611207565b505060b080546001810182556000919091527f238ba8d02078544847438db7773730a25d584074eac94489bd8eb86ca267c9370180546001600160a01b0319166001600160a01b03969096169590951790945550505050565b61135d6122f3565b609c54604051631f2afc9960e11b8152600481018390526001600160a01b0390911690633e55f93290602401600060405180830381600087803b1580156113a357600080fd5b505af11580156113b7573d6000803e3d6000fd5b505050507f9163810ee1e29168d4ce900e48a333fb8fbd3fd070d2bef67f6d4db0846a469f81604051610d7391815260200190565b6113f46122f3565b6113fc61251f565b611404612571565b61140c611d9f565b565b6114166122f3565b60005b60b0548110156114a25760af600060b0838154811061143a5761143a614a63565b60009182526020808320909101546001600160a01b03168352820192909252604001812080546001600160a81b03191681559061147a600283018261431f565b61148860038301600061433d565b5060006004919091015561149b81614b7e565b9050611419565b5061140c60b0600061431f565b60008060b254426114c09190614a17565b905060006201518082106114d55760006114e2565b6114e28262015180614a17565b9050620151808160b3546114f69190614a2a565b6115009190614a41565b9250505090565b61140c32612175565b6115186122f3565b6115206116f7565b60a3546001600160a01b031663c32e7202611539610d7e565b6040516001600160e01b031960e084901b168152600481019190915260006024820152604401600060405180830381600087803b15801561157957600080fd5b505af115801561158d573d6000803e3d6000fd5b50505050565b60b15460ff161561140c576097546001600160a01b031633146115075760405162461bcd60e51b8152600401610e1b906149e1565b6115d061234d565b609780546001600160a01b0319166001600160a01b0383169081179091556040519081527fd459c7242e23d490831b5676a611c4342d899d28f342d89ae80793e56a930f3090602001610d73565b60ab818154811061162e57600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b61165961234d565b61140c6000612797565b600061166d6114af565b611675610d7e565b61167d611cd8565b6116879190614b97565b610dec9190614a17565b6116996122f3565b609980546001600160a01b0319166001600160a01b0383169081179091556040519081527fefb5cfa1a8690c124332ab93324539c5c9c4be03f28aeb8be86f2d8a0c9fb99b90602001610d73565b60b0818154811061103a57600080fd5b6116ff6122f3565b6117076127e9565b61140c612826565b609c54604051636788231160e11b81523060048201526000916001600160a01b03169063cf10462290602401610dab565b60ae818154811061103a57600080fd5b61175861234d565b609b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f8041329bf7057543a2c2ff4e4071d1d488a31f82ed44e169b5cd2f04f5e3ac8590602001610d73565b6117ae6122f3565b60b455565b6117bb6122f3565b60328111156117f55760405162461bcd60e51b8152600401610e1b906020808252600490820152630216361760e41b604082015260600190565b609d8190556040518181527f3aa4413905e8f015896ec5880bdde24088ccb19b578f9fcf6800354d5320d4af90602001610d73565b600054610100900460ff161580801561184a5750600054600160ff909116105b806118645750303b158015611864575060005460ff166001145b6118c75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610e1b565b6000805460ff1916600117905580156118ea576000805461ff0019166101001790555b6118f3826129bb565b60005b89518110156119635760ab8a828151811061191357611913614a63565b6020908102919091018101518254600181810185556000948552938390208251600390920201908155918101519282019290925560409091015160029091015561195c81614b7e565b90506118f6565b5060005b88518110156119d45760ac89828151811061198457611984614a63565b602090810291909101810151825460018181018555600094855293839020825160039092020190815591810151928201929092556040909101516002909101556119cd81614b7e565b9050611967565b50609e80546001600160a01b03808f166001600160a01b03199283161790925560a080548e841690831617905560a28054928a169290911691909117905560a68590558251611a2a9060ae9060208601906142ba565b508351611a3e9060ad9060208701906142ba565b5060ae600081548110611a5357611a53614a63565b6000918252602082200154609f80546001600160a01b0319166001600160a01b0390921691909117905560ad8054909190611a9057611a90614a63565b60009182526020909120015460a180546001600160a01b0319166001600160a01b0390921691909117905560ad8054611acb90600190614a17565b81548110611adb57611adb614a63565b60009182526020909120015460aa80546001600160a01b039283166001600160a81b031990911617600160a01b8d15150217905560a480547368b3465833fb72a70ecdf485e0e4c7bd8665fc456001600160a01b03199182161790915560a5805490911688831617905560a25460a654604051631526fe2760e01b81526004810191909152911690631526fe279060240160c060405180830381865afa158015611b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bad9190614bb5565b505060a380546001600160a01b0319166001600160a01b03929092169190911790555050678ac7230489e8000060b4555060a7805460ff19169055604080516080810182523080825260006020830181905292820181905260609091019190915260a8805460ff60a01b199092166001600160a81b0319928316811790915560a98054909216179055611c3e612571565b8015611c84576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b611c9a614377565b6040518060600160405280611cad612b17565b815260200160008152602001611cc1611f57565b9052919050565b60ac818154811061162e57600080fd5b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401610dab565b609a546001600160a01b03163314611d515760405162461bcd60e51b815260206004820152600b60248201526a085cdd1c985d1959da5cdd60aa1b6044820152606401610e1b565b609a80546001600160a01b0319166001600160a01b0383169081179091556040519081527f46d58e3fa07bf19b1d27240f0e286b27e9f7c1b0d88933333fe833b60eec541290602001610d73565b611da7612bc2565b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1491906149c8565b90508015610ce95760a25460a6546040516321d0683360e11b8152600481019190915260248101839052600160448201526001600160a01b03909116906343a0d066906064016020604051808303816000875af1158015611e79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9d9190614c3c565b50611ea6611663565b6040517f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e3842690600090a250565b611eda61234d565b609880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5ca6e64c4522e68e154aa9372f2c5969cd37d9640e59f66953dc472f54ee86fa90602001610d73565b60a3546040516246613160e11b81523060048201526000916001600160a01b031690628cc26290602401610dab565b6000611f6560655460ff1690565b611f705750609d5490565b50600090565b611f7e61234d565b6001600160a01b038116611fe35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610e1b565b610ce981612797565b6097546001600160a01b031633146120165760405162461bcd60e51b8152600401610e1b906149e1565b60a3546001600160a01b031663c32e720261202f610d7e565b6040516001600160e01b031960e084901b168152600481019190915260006024820152604401600060405180830381600087803b15801561206f57600080fd5b505af1158015612083573d6000803e3d6000fd5b5050609e546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa1580156120d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120f691906149c8565b609e5460975460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af115801561214d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121719190614c3c565b5050565b61217d612bc2565b6000612187611cd8565b905060a360009054906101000a90046001600160a01b03166001600160a01b0316633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156121d957600080fd5b505af11580156121ed573d6000803e3d6000fd5b505050506121f9612c08565b60a1546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612242573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226691906149c8565b905080156122ee5761227783613528565b61227f6136c5565b60008261228a611cd8565b6122949190614a17565b905061229e6114af565b6122a89082614b97565b60b3556122b3611d9f565b4260b2556122bf611663565b604051829033907f9bc239f1724cacfb88cb1d66a2dc437467699b68a8c90d7b63110cf4b6f9241090600090a4505b505050565b6033546001600160a01b031633148061231657506099546001600160a01b031633145b61140c5760405162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b6044820152606401610e1b565b6033546001600160a01b0316331461140c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e1b565b6040516001600160a01b0383166024820152604481018290526122ee90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526139a0565b8015806124845750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561245e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248291906149c8565b155b6124ef5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610e1b565b6040516001600160a01b0383166024820152604481018290526122ee90849063095ea7b360e01b906064016123d3565b612527613a72565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60a254609e54612590916001600160a01b03918216911660001961240a565b609854609f546125af916001600160a01b03918216911660001961240a565b60985460a1546125ce916001600160a01b03918216911660001961240a565b60a55460a0546125ed916001600160a01b03918216911660001961240a565b60aa54600160a01b900460ff1661263b5760985460aa5461261c916001600160a01b039182169116600061240a565b60985460aa5461263b916001600160a01b03918216911660001961240a565b60b0541561140c5760005b60b054811015610ce95760006001600160a01b031660af600060b0848154811061267257612672614a63565b60009182526020808320909101546001600160a01b03168352820192909252604001812060020180549091906126aa576126aa614a63565b6000918252602090912001546001600160a01b0316146127365760985460b08054612708926001600160a01b031691600091859081106126ec576126ec614a63565b6000918252602090912001546001600160a01b0316919061240a565b60985460b08054612731926001600160a01b03169160001991859081106126ec576126ec614a63565b612787565b60a45460b0805461275e926001600160a01b031691600091859081106126ec576126ec614a63565b60a45460b08054612787926001600160a01b03169160001991859081106126ec576126ec614a63565b61279081614b7e565b9050612646565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127f1612bc2565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586125543390565b60a254609e54612844916001600160a01b039182169116600061240a565b609854609f54612862916001600160a01b039182169116600061240a565b60985460a154612880916001600160a01b039182169116600061240a565b60a55460a05461289e916001600160a01b039182169116600061240a565b60aa54600160a01b900460ff166128cd5760985460aa546128cd916001600160a01b039182169116600061240a565b60b0541561140c5760005b60b054811015610ce95760006001600160a01b031660af600060b0848154811061290457612904614a63565b60009182526020808320909101546001600160a01b031683528201929092526040018120600201805490919061293c5761293c614a63565b6000918252602090912001546001600160a01b0316146129835760985460b0805461297e926001600160a01b031691600091859081106126ec576126ec614a63565b6129ab565b60a45460b080546129ab926001600160a01b031691600091859081106126ec576126ec614a63565b6129b481614b7e565b90506128d8565b600054610100900460ff166129e25760405162461bcd60e51b8152600401610e1b90614c59565b6129ea613abb565b6129f2613aea565b6129ff602082018261440b565b609780546001600160a01b0319166001600160a01b0392909216919091179055612a2f604082016020830161440b565b609880546001600160a01b0319166001600160a01b0392909216919091179055612a5f606082016040830161440b565b609980546001600160a01b0319166001600160a01b0392909216919091179055612a8f608082016060830161440b565b609a80546001600160a01b0319166001600160a01b0392909216919091179055612abf60a082016080830161440b565b609b80546001600160a01b0319166001600160a01b0392909216919091179055612aef60c0820160a0830161440b565b609c80546001600160a01b0319166001600160a01b039290921691909117905550600a609d55565b612b526040518060c0016040528060008152602001600081526020016000815260200160008152602001606081526020016000151581525090565b609c54604051639af608c960e01b81523060048201526001600160a01b0390911690639af608c990602401600060405180830381865afa158015612b9a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dec9190810190614ca4565b60655460ff161561140c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610e1b565b609f546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612c51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c7591906149c8565b90508015612dca576000612cfe60ac805480602002602001604051908101604052809291908181526020016000905b82821015612cf45783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190612ca4565b5050505083613b19565b60985460a75460ae805460408051602080840282018101909252828152959650612dc7956001600160a01b039095169460ff90941693879390929091830182828015612d7357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612d55575b50506040805160808101825260a8546001600160a01b03808216835260ff600160a01b9283900481161515602085015260a9549182169484019490945204909116151560608201529250899150613d249050565b50505b60005b60b0548110156132d357600060b08281548110612dec57612dec614a63565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612e3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6191906149c8565b905060af600060b08481548110612e7a57612e7a614a63565b60009182526020808320909101546001600160a01b0316835282019290925260400190206004015481106132c25760006001600160a01b031660af600060b08581548110612eca57612eca614a63565b60009182526020808320909101546001600160a01b0316835282019290925260400181206002018054909190612f0257612f02614a63565b6000918252602090912001546001600160a01b0316146131de576000600160af600060b08681548110612f3757612f37614a63565b60009182526020808320909101546001600160a01b03168352820192909252604001902060020154612f699190614a17565b6001600160401b03811115612f8057612f80614527565b604051908082528060200260200182016040528015612fcb57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181612f9e5790505b50905060005b600160af600060b08781548110612fea57612fea614a63565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015461301c9190614a17565b8110156130c05760af600060b0868154811061303a5761303a614a63565b60009182526020808320909101546001600160a01b031683528281019390935260409182018120848252600190810184529082902082516060810184528154815291810154938201939093526002909201549082015282518390839081106130a4576130a4614a63565b6020026020010181905250806130b990614b7e565b9050612fd1565b5060006130cd8284613b19565b60985460a75460b080549394506131d6936001600160a01b039093169260ff90921691859160af91600091908b90811061310957613109614a63565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190206002018054825181850281018501909352808352919290919083018282801561318257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613164575b50506040805160808101825260a8546001600160a01b03808216835260ff600160a01b9283900481161515602085015260a95491821694840194909452049091161515606082015292508a9150613d249050565b5050506132c2565b60a45460b080546132c0926001600160a01b03169160af91600091908790811061320a5761320a614a63565b60009182526020808320909101546001600160a01b031683528201929092526040019020600301805461323c90614994565b80601f016020809104026020016040519081016040528092919081815260200182805461326890614994565b80156132b55780601f1061328a576101008083540402835291602001916132b5565b820191906000526020600020905b81548152906001019060200180831161329857829003601f168201915b505050505083613e6e565b505b506132cc81614b7e565b9050612dcd565b5060a0546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561331d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334191906149c8565b60a1546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561338f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b391906149c8565b60a55460405163138f252760e31b81526004810185905291925047916000916001600160a01b031690639c79293890602401602060405180830381865afa158015613402573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061342691906149c8565b9050806134338385614b97565b10613521576000828211156134515761344c8383614a17565b613454565b60005b905060b45485111561351f5760a154604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156134a657600080fd5b505af11580156134ba573d6000803e3d6000fd5b505060a55460405163093adb2760e11b8152600481018990526001600160a01b039091169250631275b64e915084906024016000604051808303818588803b15801561350557600080fd5b505af1158015613519573d6000803e3d6000fd5b50505050505b505b5050505050565b6000613532612b17565b805160a1546040516370a0823160e01b8152306004820152929350600092670de0b6b3a764000092916001600160a01b0316906370a0823190602401602060405180830381865afa15801561358b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135af91906149c8565b6135b99190614a2a565b6135c39190614a41565b90506000670de0b6b3a76400008360400151836135e09190614a2a565b6135ea9190614a41565b60a154909150613604906001600160a01b031685836123a7565b6000670de0b6b3a764000084602001518461361f9190614a2a565b6136299190614a41565b609b5460a154919250613649916001600160a01b039081169116836123a7565b6000670de0b6b3a76400008560600151856136649190614a2a565b61366e9190614a41565b609a5460a15491925061368e916001600160a01b039081169116836123a7565b8082847fd255b592c7f268a73e534da5219a60ff911b4cf6daae21c7d20527dd657bd99a60405160405180910390a4505050505050565b60a1546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561370e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061373291906149c8565b60aa5460a1549192506001600160a01b0391821691161461388d5760006137c360ab8054806020026020016040519081016040528092919081815260200160009082821015612cf45783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190612ca4565b60985460a75460ad80546040805160208084028201810190925282815295965061388a956001600160a01b039095169460ff90941693879390929091830182828015612d73576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311612d555750506040805160808101825260a8546001600160a01b03808216835260ff600160a01b9283900481161515602085015260a9549182169484019490945204909116151560608201529250899150613d249050565b50505b609e5460aa546001600160a01b03908116911614610ce95760aa546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156138ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061391291906149c8565b609854609e546040805163038fff2d60e41b81529051939450612171936001600160a01b0393841693909216916338fff2d0916004808201926020929091908290030181865afa15801561396a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061398e91906149c8565b60aa546001600160a01b031684613f09565b60006139f5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166140d69092919063ffffffff16565b8051909150156122ee5780806020019051810190613a139190614c3c565b6122ee5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610e1b565b60655460ff1661140c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610e1b565b600054610100900460ff16613ae25760405162461bcd60e51b8152600401610e1b90614c59565b61140c6140ed565b600054610100900460ff16613b115760405162461bcd60e51b8152600401610e1b90614c59565b61140c61411d565b6060600083516001600160401b03811115613b3657613b36614527565b604051908082528060200260200182016040528015613b9c57816020015b613b896040518060a0016040528060008019168152602001600081526020016000815260200160008152602001606081525090565b815260200190600190039081613b545790505b50905060005b8451811015613d1a5780600003613c66576040518060a0016040528086600081518110613bd157613bd1614a63565b602002602001015160000151815260200186600081518110613bf557613bf5614a63565b602002602001015160200151815260200186600081518110613c1957613c19614a63565b60200260200101516040015181526020018581526020016040518060200160405280600081525081525082600081518110613c5657613c56614a63565b6020026020010181905250613d12565b6040518060a00160405280868381518110613c8357613c83614a63565b6020026020010151600001518152602001868381518110613ca657613ca6614a63565b6020026020010151602001518152602001868381518110613cc957613cc9614a63565b60200260200101516040015181526020016000815260200160405180602001604052806000815250815250828281518110613d0657613d06614a63565b60200260200101819052505b600101613ba2565b5090505b92915050565b6060600084516001600160401b03811115613d4157613d41614527565b604051908082528060200260200182016040528015613d6a578160200160208202803683370190505b50905060005b8551811015613de45780600003613da6578382600081518110613d9557613d95614a63565b602002602001018181525050613ddc565b60018651613db49190614a17565b8103613ddc57600019828281518110613dcf57613dcf614a63565b6020026020010181815250505b600101613d70565b5060405163945bcec960e01b81526001600160a01b0389169063945bcec990613e1b908a908a908a908a9088904290600401614e0d565b6000604051808303816000875af1158015613e3a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e629190810190614f26565b98975050505050505050565b60408051608081018252838152306020820152808201839052600060608201819052915163b858183f60e01b81526001600160a01b0386169063b858183f90613ebb908490600401614fab565b6020604051808303816000875af1158015613eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613efe91906149c8565b9150505b9392505050565b604051631f29a8cd60e31b8152600481018490526000906001600160a01b0386169063f94d466890602401600060405180830381865afa158015613f51573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f799190810190615054565b50509050600081516001600160401b03811115613f9857613f98614527565b604051908082528060200260200182016040528015613fc1578160200160208202803683370190505b50905060005b815181101561403057846001600160a01b0316838281518110613fec57613fec614a63565b60200260200101516001600160a01b03161461400957600061400b565b835b82828151811061401d5761401d614a63565b6020908102919091010152600101613fc7565b506000600182600160405160200161404a93929190615121565b60408051601f198184030181526080830182528583526020830185905282820181905260006060840152905163172b958560e31b81529092506001600160a01b0389169063b95cac28906140a8908a90309081908790600401615150565b600060405180830381600087803b1580156140c257600080fd5b505af1158015611c84573d6000803e3d6000fd5b60606140e58484600085614150565b949350505050565b600054610100900460ff166141145760405162461bcd60e51b8152600401610e1b90614c59565b61140c33612797565b600054610100900460ff166141445760405162461bcd60e51b8152600401610e1b90614c59565b6065805460ff19169055565b6060824710156141b15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610e1b565b6001600160a01b0385163b6142085760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610e1b565b600080866001600160a01b0316858760405161422491906151e5565b60006040518083038185875af1925050503d8060008114614261576040519150601f19603f3d011682016040523d82523d6000602084013e614266565b606091505b5091509150614276828286614281565b979650505050505050565b60608315614290575081613f02565b8251156142a05782518084602001fd5b8160405162461bcd60e51b8152600401610e1b9190615201565b82805482825590600052602060002090810192821561430f579160200282015b8281111561430f57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906142da565b5061431b9291506143d1565b5090565b5080546000825590600052602060002090810190610ce991906143d1565b50805461434990614994565b6000825580601f10614359575050565b601f016020900490600052602060002090810190610ce991906143d1565b60405180606001604052806143bd6040518060c0016040528060008152602001600081526020016000815260200160008152602001606081526020016000151581525090565b815260200160008152602001600081525090565b5b8082111561431b57600081556001016143d2565b6001600160a01b0381168114610ce957600080fd5b8035614406816143e6565b919050565b60006020828403121561441d57600080fd5b8135613f02816143e6565b634e487b7160e01b600052602160045260246000fd5b60005b83811015614459578181015183820152602001614441565b50506000910152565b6000815180845261447a81602086016020860161443e565b601f01601f19169290920160200192915050565b6000600386106144a0576144a0614428565b8582526001600160a01b03851660208301526080604083018190526144c790830185614462565b905082606083015295945050505050565b8015158114610ce957600080fd5b8035614406816144d8565b60006020828403121561450357600080fd5b8135613f02816144d8565b60006020828403121561452057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171561455f5761455f614527565b60405290565b60405160c081016001600160401b038111828210171561455f5761455f614527565b604051601f8201601f191681016001600160401b03811182821017156145af576145af614527565b604052919050565b60006001600160401b038211156145d0576145d0614527565b5060051b60200190565b600082601f8301126145eb57600080fd5b813560206146006145fb836145b7565b614587565b8281526060928302850182019282820191908785111561461f57600080fd5b8387015b858110156146665781818a03121561463b5760008081fd5b61464361453d565b813581528582013586820152604080830135908201528452928401928101614623565b5090979650505050505050565b600082601f83011261468457600080fd5b813560206146946145fb836145b7565b82815260059290921b840181019181810190868411156146b357600080fd5b8286015b848110156146d75780356146ca816143e6565b83529183019183016146b7565b509695505050505050565b60008060008060008060a087890312156146fb57600080fd5b8635614706816143e6565b955060208701356001600160401b038082111561472257600080fd5b61472e8a838b016145da565b9650604089013591508082111561474457600080fd5b6147508a838b01614673565b9550606089013591508082111561476657600080fd5b818901915089601f83011261477a57600080fd5b81358181111561478957600080fd5b8a602082850101111561479b57600080fd5b602083019550809450505050608087013590509295509295509295565b600281106147c8576147c8614428565b9052565b60208101613d1e82846147b8565b600060c082840312156147ec57600080fd5b50919050565b60008060008060008060008060008060006102008c8e03121561481457600080fd5b61481d8c6143fb565b9a5061482b60208d016143fb565b995061483960408d016144e6565b98506001600160401b038060608e0135111561485457600080fd5b6148648e60608f01358f016145da565b98508060808e0135111561487757600080fd5b6148878e60808f01358f016145da565b975061489560a08e016143fb565b96506148a360c08e016143fb565b955060e08d01359450806101008e013511156148be57600080fd5b6148cf8e6101008f01358f01614673565b9350806101208e013511156148e357600080fd5b506148f58d6101208e01358e01614673565b91506149058d6101408e016147da565b90509295989b509295989b9093969950565b60208152600082516060602084015280516080840152602081015160a0840152604081015160c0840152606081015160e0840152608081015160c0610100850152614966610140850182614462565b905060a082015115156101208501526020850151604085015260408501516060850152809250505092915050565b600181811c908216806149a857607f821691505b6020821081036147ec57634e487b7160e01b600052602260045260246000fd5b6000602082840312156149da57600080fd5b5051919050565b602080825260069082015265085d985d5b1d60d21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115613d1e57613d1e614a01565b8082028115828204841417613d1e57613d1e614a01565b600082614a5e57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f8211156122ee57600081815260208120601f850160051c81016020861015614aa05750805b601f850160051c820191505b8181101561351f57828155600101614aac565b6001600160401b03831115614ad657614ad6614527565b614aea83614ae48354614994565b83614a79565b6000601f841160018114614b1e5760008515614b065750838201355b600019600387901b1c1916600186901b178355613521565b600083815260209020601f19861690835b82811015614b4f5786850135825560209485019460019092019101614b2f565b5086821015614b6c5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600060018201614b9057614b90614a01565b5060010190565b80820180821115613d1e57613d1e614a01565b8051614406816144d8565b60008060008060008060c08789031215614bce57600080fd5b8651614bd9816143e6565b6020880151909650614bea816143e6565b6040880151909550614bfb816143e6565b6060880151909450614c0c816143e6565b6080880151909350614c1d816143e6565b60a0880151909250614c2e816144d8565b809150509295509295509295565b600060208284031215614c4e57600080fd5b8151613f02816144d8565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020808385031215614cb757600080fd5b82516001600160401b0380821115614cce57600080fd5b9084019060c08287031215614ce257600080fd5b614cea614565565b8251815283830151848201526040830151604082015260608301516060820152608083015182811115614d1c57600080fd5b8301601f81018813614d2d57600080fd5b805183811115614d3f57614d3f614527565b614d51601f8201601f19168701614587565b93508084528886828401011115614d6757600080fd5b614d768187860188850161443e565b5050816080820152614d8a60a08401614baa565b60a08201529695505050505050565b600081518084526020808501945080840160005b83811015614dd25781516001600160a01b031687529582019590820190600101614dad565b509495945050505050565b600081518084526020808501945080840160005b83811015614dd257815187529582019590820190600101614df1565b6000610120808301614e1f848b6147b8565b60208481019290925288519081905261014080850192600583901b8601909101918a820160005b82811015614ea95787850361013f190186528151805186528481015185870152604080820151908701526060808201519087015260809081015160a091870182905290614e9581880183614462565b978601979650505090830190600101614e46565b505050508381036040850152614ebf8189614d99565b915050614eff606084018780516001600160a01b039081168352602080830151151590840152604080830151909116908301526060908101511515910152565b82810360e0840152614f118186614ddd565b91505082610100830152979650505050505050565b60006020808385031215614f3957600080fd5b82516001600160401b03811115614f4f57600080fd5b8301601f81018513614f6057600080fd5b8051614f6e6145fb826145b7565b81815260059190911b82018301908381019087831115614f8d57600080fd5b928401925b8284101561427657835182529284019290840190614f92565b602081526000825160806020840152614fc760a0840182614462565b905060018060a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b600082601f83011261500a57600080fd5b8151602061501a6145fb836145b7565b82815260059290921b8401810191818101908684111561503957600080fd5b8286015b848110156146d7578051835291830191830161503d565b60008060006060848603121561506957600080fd5b83516001600160401b038082111561508057600080fd5b818601915086601f83011261509457600080fd5b815160206150a46145fb836145b7565b82815260059290921b8401810191818101908a8411156150c357600080fd5b948201945b838610156150ea5785516150db816143e6565b825294820194908201906150c8565b9189015191975090935050508082111561510357600080fd5b5061511086828701614ff9565b925050604084015190509250925092565b60ff8416815260606020820152600061513d6060830185614ddd565b905060ff83166040830152949350505050565b8481526001600160a01b0384811660208301528316604082015260806060820181905282518183019190915260009061518d610100840182614d99565b90506020840151607f19808584030160a08601526151ab8383614ddd565b925060408601519150808584030160c0860152506151c98282614462565b9150506060840151151560e08401528091505095945050505050565b600082516151f781846020870161443e565b9190910192915050565b602081526000613f02602083018461446256fea26469706673582212203d0bb485ed9a1a623a89646a1a49fb8bd65c7b94e29a228b145f73f38753d75964736f6c63430008130033

Deployed Bytecode

0x6080604052600436106103e85760003560e01c8063735de9f711610208578063c1a3d44c11610118578063e7a7250a116100ab578063f1a392da1161007a578063f1a392da14610b96578063f20eaeb814610bac578063f2fde38b14610bcc578063fb61778714610bec578063fbfa77cf14610c0157600080fd5b8063e7a7250a14610af9578063e941fa7814610b0e578063eaed3f4f14610b23578063f106845414610b8057600080fd5b8063d0e30db0116100e7578063d0e30db014610a8f578063d92f3d7314610aa4578063dfbdc43714610ac4578063e13b7f5c14610ad957600080fd5b8063c1a3d44c146109c9578063c6def076146109de578063c7b9d530146109fe578063c89f2ce414610a1e57600080fd5b806397fd323d1161019b578063ac1e50251161016a578063ac1e502514610927578063aced166114610947578063b087432414610967578063b20feaaf14610987578063be12a978146109a957600080fd5b806397fd323d1461074c5780639e1a297a146108c7578063a68833e5146108e7578063a9e282b81461090757600080fd5b80638912cb8b116101d75780638912cb8b1461085a5780638cfc0250146108745780638da5cb5b146108895780638e145459146108a757600080fd5b8063735de9f7146107e5578063748747e6146108055780637bb7bed1146108255780638456cb591461084557600080fd5b8063449c27a81161030357806359cd90311161029657806367a527931161026557806367a527931461074c5780636817031b146107605780636ae1a26d14610780578063715018a6146107bb578063722713f7146107d057600080fd5b806359cd9031146106cb5780635c975abb146106e157806366666aa914610705578063671f6a261461072557600080fd5b80634746fb55116102d25780634746fb551461066a57806354518b1a1461068a57806356891412146106a0578063573fef0a146106b657600080fd5b8063449c27a81461061657806344b813961461062b5780634641257d146106405780634700d3051461065557600080fd5b80631fe4a6861161037b5780633c800d5d1161034a5780633c800d5d146105a15780633cdc9c7a146105c15780633e55f932146105e15780633f4ba83a1461060157600080fd5b80631fe4a68614610521578063257ae0de146105415780632b3297f9146105615780632e1a7d4d1461058157600080fd5b806311588086116103b7578063115880861461048f57806311b0b42d146104b25780631be05289146104ea5780631f1fcd511461050157600080fd5b80630700037d146103f45780630e5c011e1461042d5780630e8fbb5a1461044f578063106fdbd01461046f57600080fd5b366103ef57005b600080fd5b34801561040057600080fd5b5061041461040f36600461440b565b610c21565b604051610424949392919061448e565b60405180910390f35b34801561043957600080fd5b5061044d61044836600461440b565b610ce0565b005b34801561045b57600080fd5b5061044d61046a3660046144f1565b610cec565b34801561047b57600080fd5b5061044d61048a36600461440b565b610d21565b34801561049b57600080fd5b506104a4610d7e565b604051908152602001610424565b3480156104be57600080fd5b5060a1546104d2906001600160a01b031681565b6040516001600160a01b039091168152602001610424565b3480156104f657600080fd5b506104a46201518081565b34801561050d57600080fd5b50609e546104d2906001600160a01b031681565b34801561052d57600080fd5b50609a546104d2906001600160a01b031681565b34801561054d57600080fd5b506098546104d2906001600160a01b031681565b34801561056d57600080fd5b5060a5546104d2906001600160a01b031681565b34801561058d57600080fd5b5061044d61059c36600461450e565b610df1565b3480156105ad57600080fd5b506104d26105bc36600461450e565b61102a565b3480156105cd57600080fd5b5061044d6105dc3660046146e2565b611054565b3480156105ed57600080fd5b5061044d6105fc36600461450e565b611355565b34801561060d57600080fd5b5061044d6113ec565b34801561062257600080fd5b5061044d61140e565b34801561063757600080fd5b506104a46114af565b34801561064c57600080fd5b5061044d611507565b34801561066157600080fd5b5061044d611510565b34801561067657600080fd5b50609c546104d2906001600160a01b031681565b34801561069657600080fd5b506104a461271081565b3480156106ac57600080fd5b506104a460b35481565b3480156106c257600080fd5b5061044d611593565b3480156106d757600080fd5b506104a460b45481565b3480156106ed57600080fd5b5060655460ff165b6040519015158152602001610424565b34801561071157600080fd5b5060a3546104d2906001600160a01b031681565b34801561073157600080fd5b5060a75461073f9060ff1681565b60405161042491906147cc565b34801561075857600080fd5b5060006104a4565b34801561076c57600080fd5b5061044d61077b36600461440b565b6115c8565b34801561078c57600080fd5b506107a061079b36600461450e565b61161e565b60408051938452602084019290925290820152606001610424565b3480156107c757600080fd5b5061044d611651565b3480156107dc57600080fd5b506104a4611663565b3480156107f157600080fd5b5060a4546104d2906001600160a01b031681565b34801561081157600080fd5b5061044d61082036600461440b565b611691565b34801561083157600080fd5b506104d261084036600461450e565b6116e7565b34801561085157600080fd5b5061044d6116f7565b34801561086657600080fd5b5060b1546106f59060ff1681565b34801561088057600080fd5b506104a461170f565b34801561089557600080fd5b506033546001600160a01b03166104d2565b3480156108b357600080fd5b50609b546104d2906001600160a01b031681565b3480156108d357600080fd5b506104d26108e236600461450e565b611740565b3480156108f357600080fd5b5061044d61090236600461440b565b611750565b34801561091357600080fd5b5061044d61092236600461450e565b6117a6565b34801561093357600080fd5b5061044d61094236600461450e565b6117b3565b34801561095357600080fd5b506099546104d2906001600160a01b031681565b34801561097357600080fd5b5061044d6109823660046147f2565b61182a565b34801561099357600080fd5b5061099c611c92565b6040516104249190614917565b3480156109b557600080fd5b506107a06109c436600461450e565b611cc8565b3480156109d557600080fd5b506104a4611cd8565b3480156109ea57600080fd5b5060a2546104d2906001600160a01b031681565b348015610a0a57600080fd5b5061044d610a1936600461440b565b611d09565b348015610a2a57600080fd5b5060a85460a954610a5a916001600160a01b038082169260ff600160a01b93849004811693928216929091041684565b60405161042494939291906001600160a01b039485168152921515602084015292166040820152901515606082015260800190565b348015610a9b57600080fd5b5061044d611d9f565b348015610ab057600080fd5b5061044d610abf36600461440b565b611ed2565b348015610ad057600080fd5b506104a4603281565b348015610ae557600080fd5b5060a0546104d2906001600160a01b031681565b348015610b0557600080fd5b506104a4611f28565b348015610b1a57600080fd5b506104a4611f57565b348015610b2f57600080fd5b5060aa54610b59906001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b0390941684529115156020840152151590820152606001610424565b348015610b8c57600080fd5b506104a460a65481565b348015610ba257600080fd5b506104a460b25481565b348015610bb857600080fd5b50609f546104d2906001600160a01b031681565b348015610bd857600080fd5b5061044d610be736600461440b565b611f76565b348015610bf857600080fd5b5061044d611fec565b348015610c0d57600080fd5b506097546104d2906001600160a01b031681565b60af602052600090815260409020805460038201805460ff8316936101009093046001600160a01b0316929190610c5790614994565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8390614994565b8015610cd05780601f10610ca557610100808354040283529160200191610cd0565b820191906000526020600020905b815481529060010190602001808311610cb357829003601f168201915b5050505050908060040154905084565b610ce981612175565b50565b610cf46122f3565b60b1805460ff191682151590811790915560ff1615610d1757610ce960006117b3565b610ce9600a6117b3565b610d2961234d565b609c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f91e28ce4210d103c13c5174847e463b836900f8dc63e9d9b42a4255169d19529906020015b60405180910390a150565b60a3546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a08231906024015b602060405180830381865afa158015610dc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dec91906149c8565b905090565b6097546001600160a01b03163314610e245760405162461bcd60e51b8152600401610e1b906149e1565b60405180910390fd5b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9191906149c8565b905081811015610f7d5760a3546001600160a01b031663c32e7202610eb68385614a17565b6040516001600160e01b031960e084901b168152600481019190915260006024820152604401600060405180830381600087803b158015610ef657600080fd5b505af1158015610f0a573d6000803e3d6000fd5b5050609e546040516370a0823160e01b81523060048201526001600160a01b0390911692506370a082319150602401602060405180830381865afa158015610f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7a91906149c8565b90505b81811115610f885750805b6033546001600160a01b03163214801590610fa6575060655460ff16155b15610fd8576000612710609d5483610fbe9190614a2a565b610fc89190614a41565b9050610fd48183614a17565b9150505b609754609e54610ff5916001600160a01b039182169116836123a7565b610ffd611663565b6040517f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d90600090a25050565b60ad818154811061103a57600080fd5b6000918252602090912001546001600160a01b0316905081565b61105c61234d565b609e546001600160a01b03908116908716036110a25760405162461bcd60e51b8152602060048201526005602482015264085dd85b9d60da1b6044820152606401610e1b565b60a1546001600160a01b03908116908716036110ea5760405162461bcd60e51b8152602060048201526007602482015266216e617469766560c81b6044820152606401610e1b565b60006001600160a01b03168460008151811061110857611108614a63565b60200260200101516001600160a01b03161461115a57609854611139906001600160a01b038881169116600061240a565b609854611155906001600160a01b03888116911660001961240a565b611191565b60a454611175906001600160a01b038881169116600061240a565b60a454611191906001600160a01b03888116911660001961240a565b6001600160a01b038616600090815260af6020908152604090912085516111c0926002909201918701906142ba565b506001600160a01b038616600090815260af602052604090206003016111e7838583614abf565b506001600160a01b038616600090815260af602052604081206004018290555b85518110156112fc5785818151811061122257611222614a63565b602090810291909101810151516001600160a01b038916600090815260af835260408082208583526001019093529190912055855186908290811061126957611269614a63565b6020908102919091018101518101516001600160a01b038916600090815260af83526040808220858352600190810190945290209091015585518690829081106112b5576112b5614a63565b6020908102919091018101516040908101516001600160a01b038a16600090815260af84528281208582526001019093529120600201556112f581614b7e565b9050611207565b505060b080546001810182556000919091527f238ba8d02078544847438db7773730a25d584074eac94489bd8eb86ca267c9370180546001600160a01b0319166001600160a01b03969096169590951790945550505050565b61135d6122f3565b609c54604051631f2afc9960e11b8152600481018390526001600160a01b0390911690633e55f93290602401600060405180830381600087803b1580156113a357600080fd5b505af11580156113b7573d6000803e3d6000fd5b505050507f9163810ee1e29168d4ce900e48a333fb8fbd3fd070d2bef67f6d4db0846a469f81604051610d7391815260200190565b6113f46122f3565b6113fc61251f565b611404612571565b61140c611d9f565b565b6114166122f3565b60005b60b0548110156114a25760af600060b0838154811061143a5761143a614a63565b60009182526020808320909101546001600160a01b03168352820192909252604001812080546001600160a81b03191681559061147a600283018261431f565b61148860038301600061433d565b5060006004919091015561149b81614b7e565b9050611419565b5061140c60b0600061431f565b60008060b254426114c09190614a17565b905060006201518082106114d55760006114e2565b6114e28262015180614a17565b9050620151808160b3546114f69190614a2a565b6115009190614a41565b9250505090565b61140c32612175565b6115186122f3565b6115206116f7565b60a3546001600160a01b031663c32e7202611539610d7e565b6040516001600160e01b031960e084901b168152600481019190915260006024820152604401600060405180830381600087803b15801561157957600080fd5b505af115801561158d573d6000803e3d6000fd5b50505050565b60b15460ff161561140c576097546001600160a01b031633146115075760405162461bcd60e51b8152600401610e1b906149e1565b6115d061234d565b609780546001600160a01b0319166001600160a01b0383169081179091556040519081527fd459c7242e23d490831b5676a611c4342d899d28f342d89ae80793e56a930f3090602001610d73565b60ab818154811061162e57600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b61165961234d565b61140c6000612797565b600061166d6114af565b611675610d7e565b61167d611cd8565b6116879190614b97565b610dec9190614a17565b6116996122f3565b609980546001600160a01b0319166001600160a01b0383169081179091556040519081527fefb5cfa1a8690c124332ab93324539c5c9c4be03f28aeb8be86f2d8a0c9fb99b90602001610d73565b60b0818154811061103a57600080fd5b6116ff6122f3565b6117076127e9565b61140c612826565b609c54604051636788231160e11b81523060048201526000916001600160a01b03169063cf10462290602401610dab565b60ae818154811061103a57600080fd5b61175861234d565b609b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f8041329bf7057543a2c2ff4e4071d1d488a31f82ed44e169b5cd2f04f5e3ac8590602001610d73565b6117ae6122f3565b60b455565b6117bb6122f3565b60328111156117f55760405162461bcd60e51b8152600401610e1b906020808252600490820152630216361760e41b604082015260600190565b609d8190556040518181527f3aa4413905e8f015896ec5880bdde24088ccb19b578f9fcf6800354d5320d4af90602001610d73565b600054610100900460ff161580801561184a5750600054600160ff909116105b806118645750303b158015611864575060005460ff166001145b6118c75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610e1b565b6000805460ff1916600117905580156118ea576000805461ff0019166101001790555b6118f3826129bb565b60005b89518110156119635760ab8a828151811061191357611913614a63565b6020908102919091018101518254600181810185556000948552938390208251600390920201908155918101519282019290925560409091015160029091015561195c81614b7e565b90506118f6565b5060005b88518110156119d45760ac89828151811061198457611984614a63565b602090810291909101810151825460018181018555600094855293839020825160039092020190815591810151928201929092556040909101516002909101556119cd81614b7e565b9050611967565b50609e80546001600160a01b03808f166001600160a01b03199283161790925560a080548e841690831617905560a28054928a169290911691909117905560a68590558251611a2a9060ae9060208601906142ba565b508351611a3e9060ad9060208701906142ba565b5060ae600081548110611a5357611a53614a63565b6000918252602082200154609f80546001600160a01b0319166001600160a01b0390921691909117905560ad8054909190611a9057611a90614a63565b60009182526020909120015460a180546001600160a01b0319166001600160a01b0390921691909117905560ad8054611acb90600190614a17565b81548110611adb57611adb614a63565b60009182526020909120015460aa80546001600160a01b039283166001600160a81b031990911617600160a01b8d15150217905560a480547368b3465833fb72a70ecdf485e0e4c7bd8665fc456001600160a01b03199182161790915560a5805490911688831617905560a25460a654604051631526fe2760e01b81526004810191909152911690631526fe279060240160c060405180830381865afa158015611b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bad9190614bb5565b505060a380546001600160a01b0319166001600160a01b03929092169190911790555050678ac7230489e8000060b4555060a7805460ff19169055604080516080810182523080825260006020830181905292820181905260609091019190915260a8805460ff60a01b199092166001600160a81b0319928316811790915560a98054909216179055611c3e612571565b8015611c84576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b611c9a614377565b6040518060600160405280611cad612b17565b815260200160008152602001611cc1611f57565b9052919050565b60ac818154811061162e57600080fd5b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401610dab565b609a546001600160a01b03163314611d515760405162461bcd60e51b815260206004820152600b60248201526a085cdd1c985d1959da5cdd60aa1b6044820152606401610e1b565b609a80546001600160a01b0319166001600160a01b0383169081179091556040519081527f46d58e3fa07bf19b1d27240f0e286b27e9f7c1b0d88933333fe833b60eec541290602001610d73565b611da7612bc2565b609e546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1491906149c8565b90508015610ce95760a25460a6546040516321d0683360e11b8152600481019190915260248101839052600160448201526001600160a01b03909116906343a0d066906064016020604051808303816000875af1158015611e79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9d9190614c3c565b50611ea6611663565b6040517f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e3842690600090a250565b611eda61234d565b609880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5ca6e64c4522e68e154aa9372f2c5969cd37d9640e59f66953dc472f54ee86fa90602001610d73565b60a3546040516246613160e11b81523060048201526000916001600160a01b031690628cc26290602401610dab565b6000611f6560655460ff1690565b611f705750609d5490565b50600090565b611f7e61234d565b6001600160a01b038116611fe35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610e1b565b610ce981612797565b6097546001600160a01b031633146120165760405162461bcd60e51b8152600401610e1b906149e1565b60a3546001600160a01b031663c32e720261202f610d7e565b6040516001600160e01b031960e084901b168152600481019190915260006024820152604401600060405180830381600087803b15801561206f57600080fd5b505af1158015612083573d6000803e3d6000fd5b5050609e546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa1580156120d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120f691906149c8565b609e5460975460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af115801561214d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121719190614c3c565b5050565b61217d612bc2565b6000612187611cd8565b905060a360009054906101000a90046001600160a01b03166001600160a01b0316633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156121d957600080fd5b505af11580156121ed573d6000803e3d6000fd5b505050506121f9612c08565b60a1546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612242573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226691906149c8565b905080156122ee5761227783613528565b61227f6136c5565b60008261228a611cd8565b6122949190614a17565b905061229e6114af565b6122a89082614b97565b60b3556122b3611d9f565b4260b2556122bf611663565b604051829033907f9bc239f1724cacfb88cb1d66a2dc437467699b68a8c90d7b63110cf4b6f9241090600090a4505b505050565b6033546001600160a01b031633148061231657506099546001600160a01b031633145b61140c5760405162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b6044820152606401610e1b565b6033546001600160a01b0316331461140c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e1b565b6040516001600160a01b0383166024820152604481018290526122ee90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526139a0565b8015806124845750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561245e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248291906149c8565b155b6124ef5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610e1b565b6040516001600160a01b0383166024820152604481018290526122ee90849063095ea7b360e01b906064016123d3565b612527613a72565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60a254609e54612590916001600160a01b03918216911660001961240a565b609854609f546125af916001600160a01b03918216911660001961240a565b60985460a1546125ce916001600160a01b03918216911660001961240a565b60a55460a0546125ed916001600160a01b03918216911660001961240a565b60aa54600160a01b900460ff1661263b5760985460aa5461261c916001600160a01b039182169116600061240a565b60985460aa5461263b916001600160a01b03918216911660001961240a565b60b0541561140c5760005b60b054811015610ce95760006001600160a01b031660af600060b0848154811061267257612672614a63565b60009182526020808320909101546001600160a01b03168352820192909252604001812060020180549091906126aa576126aa614a63565b6000918252602090912001546001600160a01b0316146127365760985460b08054612708926001600160a01b031691600091859081106126ec576126ec614a63565b6000918252602090912001546001600160a01b0316919061240a565b60985460b08054612731926001600160a01b03169160001991859081106126ec576126ec614a63565b612787565b60a45460b0805461275e926001600160a01b031691600091859081106126ec576126ec614a63565b60a45460b08054612787926001600160a01b03169160001991859081106126ec576126ec614a63565b61279081614b7e565b9050612646565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127f1612bc2565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586125543390565b60a254609e54612844916001600160a01b039182169116600061240a565b609854609f54612862916001600160a01b039182169116600061240a565b60985460a154612880916001600160a01b039182169116600061240a565b60a55460a05461289e916001600160a01b039182169116600061240a565b60aa54600160a01b900460ff166128cd5760985460aa546128cd916001600160a01b039182169116600061240a565b60b0541561140c5760005b60b054811015610ce95760006001600160a01b031660af600060b0848154811061290457612904614a63565b60009182526020808320909101546001600160a01b031683528201929092526040018120600201805490919061293c5761293c614a63565b6000918252602090912001546001600160a01b0316146129835760985460b0805461297e926001600160a01b031691600091859081106126ec576126ec614a63565b6129ab565b60a45460b080546129ab926001600160a01b031691600091859081106126ec576126ec614a63565b6129b481614b7e565b90506128d8565b600054610100900460ff166129e25760405162461bcd60e51b8152600401610e1b90614c59565b6129ea613abb565b6129f2613aea565b6129ff602082018261440b565b609780546001600160a01b0319166001600160a01b0392909216919091179055612a2f604082016020830161440b565b609880546001600160a01b0319166001600160a01b0392909216919091179055612a5f606082016040830161440b565b609980546001600160a01b0319166001600160a01b0392909216919091179055612a8f608082016060830161440b565b609a80546001600160a01b0319166001600160a01b0392909216919091179055612abf60a082016080830161440b565b609b80546001600160a01b0319166001600160a01b0392909216919091179055612aef60c0820160a0830161440b565b609c80546001600160a01b0319166001600160a01b039290921691909117905550600a609d55565b612b526040518060c0016040528060008152602001600081526020016000815260200160008152602001606081526020016000151581525090565b609c54604051639af608c960e01b81523060048201526001600160a01b0390911690639af608c990602401600060405180830381865afa158015612b9a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dec9190810190614ca4565b60655460ff161561140c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610e1b565b609f546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612c51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c7591906149c8565b90508015612dca576000612cfe60ac805480602002602001604051908101604052809291908181526020016000905b82821015612cf45783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190612ca4565b5050505083613b19565b60985460a75460ae805460408051602080840282018101909252828152959650612dc7956001600160a01b039095169460ff90941693879390929091830182828015612d7357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612d55575b50506040805160808101825260a8546001600160a01b03808216835260ff600160a01b9283900481161515602085015260a9549182169484019490945204909116151560608201529250899150613d249050565b50505b60005b60b0548110156132d357600060b08281548110612dec57612dec614a63565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612e3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6191906149c8565b905060af600060b08481548110612e7a57612e7a614a63565b60009182526020808320909101546001600160a01b0316835282019290925260400190206004015481106132c25760006001600160a01b031660af600060b08581548110612eca57612eca614a63565b60009182526020808320909101546001600160a01b0316835282019290925260400181206002018054909190612f0257612f02614a63565b6000918252602090912001546001600160a01b0316146131de576000600160af600060b08681548110612f3757612f37614a63565b60009182526020808320909101546001600160a01b03168352820192909252604001902060020154612f699190614a17565b6001600160401b03811115612f8057612f80614527565b604051908082528060200260200182016040528015612fcb57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181612f9e5790505b50905060005b600160af600060b08781548110612fea57612fea614a63565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015461301c9190614a17565b8110156130c05760af600060b0868154811061303a5761303a614a63565b60009182526020808320909101546001600160a01b031683528281019390935260409182018120848252600190810184529082902082516060810184528154815291810154938201939093526002909201549082015282518390839081106130a4576130a4614a63565b6020026020010181905250806130b990614b7e565b9050612fd1565b5060006130cd8284613b19565b60985460a75460b080549394506131d6936001600160a01b039093169260ff90921691859160af91600091908b90811061310957613109614a63565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190206002018054825181850281018501909352808352919290919083018282801561318257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613164575b50506040805160808101825260a8546001600160a01b03808216835260ff600160a01b9283900481161515602085015260a95491821694840194909452049091161515606082015292508a9150613d249050565b5050506132c2565b60a45460b080546132c0926001600160a01b03169160af91600091908790811061320a5761320a614a63565b60009182526020808320909101546001600160a01b031683528201929092526040019020600301805461323c90614994565b80601f016020809104026020016040519081016040528092919081815260200182805461326890614994565b80156132b55780601f1061328a576101008083540402835291602001916132b5565b820191906000526020600020905b81548152906001019060200180831161329857829003601f168201915b505050505083613e6e565b505b506132cc81614b7e565b9050612dcd565b5060a0546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561331d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061334191906149c8565b60a1546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561338f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b391906149c8565b60a55460405163138f252760e31b81526004810185905291925047916000916001600160a01b031690639c79293890602401602060405180830381865afa158015613402573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061342691906149c8565b9050806134338385614b97565b10613521576000828211156134515761344c8383614a17565b613454565b60005b905060b45485111561351f5760a154604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156134a657600080fd5b505af11580156134ba573d6000803e3d6000fd5b505060a55460405163093adb2760e11b8152600481018990526001600160a01b039091169250631275b64e915084906024016000604051808303818588803b15801561350557600080fd5b505af1158015613519573d6000803e3d6000fd5b50505050505b505b5050505050565b6000613532612b17565b805160a1546040516370a0823160e01b8152306004820152929350600092670de0b6b3a764000092916001600160a01b0316906370a0823190602401602060405180830381865afa15801561358b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135af91906149c8565b6135b99190614a2a565b6135c39190614a41565b90506000670de0b6b3a76400008360400151836135e09190614a2a565b6135ea9190614a41565b60a154909150613604906001600160a01b031685836123a7565b6000670de0b6b3a764000084602001518461361f9190614a2a565b6136299190614a41565b609b5460a154919250613649916001600160a01b039081169116836123a7565b6000670de0b6b3a76400008560600151856136649190614a2a565b61366e9190614a41565b609a5460a15491925061368e916001600160a01b039081169116836123a7565b8082847fd255b592c7f268a73e534da5219a60ff911b4cf6daae21c7d20527dd657bd99a60405160405180910390a4505050505050565b60a1546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561370e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061373291906149c8565b60aa5460a1549192506001600160a01b0391821691161461388d5760006137c360ab8054806020026020016040519081016040528092919081815260200160009082821015612cf45783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190612ca4565b60985460a75460ad80546040805160208084028201810190925282815295965061388a956001600160a01b039095169460ff90941693879390929091830182828015612d73576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311612d555750506040805160808101825260a8546001600160a01b03808216835260ff600160a01b9283900481161515602085015260a9549182169484019490945204909116151560608201529250899150613d249050565b50505b609e5460aa546001600160a01b03908116911614610ce95760aa546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156138ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061391291906149c8565b609854609e546040805163038fff2d60e41b81529051939450612171936001600160a01b0393841693909216916338fff2d0916004808201926020929091908290030181865afa15801561396a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061398e91906149c8565b60aa546001600160a01b031684613f09565b60006139f5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166140d69092919063ffffffff16565b8051909150156122ee5780806020019051810190613a139190614c3c565b6122ee5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610e1b565b60655460ff1661140c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610e1b565b600054610100900460ff16613ae25760405162461bcd60e51b8152600401610e1b90614c59565b61140c6140ed565b600054610100900460ff16613b115760405162461bcd60e51b8152600401610e1b90614c59565b61140c61411d565b6060600083516001600160401b03811115613b3657613b36614527565b604051908082528060200260200182016040528015613b9c57816020015b613b896040518060a0016040528060008019168152602001600081526020016000815260200160008152602001606081525090565b815260200190600190039081613b545790505b50905060005b8451811015613d1a5780600003613c66576040518060a0016040528086600081518110613bd157613bd1614a63565b602002602001015160000151815260200186600081518110613bf557613bf5614a63565b602002602001015160200151815260200186600081518110613c1957613c19614a63565b60200260200101516040015181526020018581526020016040518060200160405280600081525081525082600081518110613c5657613c56614a63565b6020026020010181905250613d12565b6040518060a00160405280868381518110613c8357613c83614a63565b6020026020010151600001518152602001868381518110613ca657613ca6614a63565b6020026020010151602001518152602001868381518110613cc957613cc9614a63565b60200260200101516040015181526020016000815260200160405180602001604052806000815250815250828281518110613d0657613d06614a63565b60200260200101819052505b600101613ba2565b5090505b92915050565b6060600084516001600160401b03811115613d4157613d41614527565b604051908082528060200260200182016040528015613d6a578160200160208202803683370190505b50905060005b8551811015613de45780600003613da6578382600081518110613d9557613d95614a63565b602002602001018181525050613ddc565b60018651613db49190614a17565b8103613ddc57600019828281518110613dcf57613dcf614a63565b6020026020010181815250505b600101613d70565b5060405163945bcec960e01b81526001600160a01b0389169063945bcec990613e1b908a908a908a908a9088904290600401614e0d565b6000604051808303816000875af1158015613e3a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e629190810190614f26565b98975050505050505050565b60408051608081018252838152306020820152808201839052600060608201819052915163b858183f60e01b81526001600160a01b0386169063b858183f90613ebb908490600401614fab565b6020604051808303816000875af1158015613eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613efe91906149c8565b9150505b9392505050565b604051631f29a8cd60e31b8152600481018490526000906001600160a01b0386169063f94d466890602401600060405180830381865afa158015613f51573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f799190810190615054565b50509050600081516001600160401b03811115613f9857613f98614527565b604051908082528060200260200182016040528015613fc1578160200160208202803683370190505b50905060005b815181101561403057846001600160a01b0316838281518110613fec57613fec614a63565b60200260200101516001600160a01b03161461400957600061400b565b835b82828151811061401d5761401d614a63565b6020908102919091010152600101613fc7565b506000600182600160405160200161404a93929190615121565b60408051601f198184030181526080830182528583526020830185905282820181905260006060840152905163172b958560e31b81529092506001600160a01b0389169063b95cac28906140a8908a90309081908790600401615150565b600060405180830381600087803b1580156140c257600080fd5b505af1158015611c84573d6000803e3d6000fd5b60606140e58484600085614150565b949350505050565b600054610100900460ff166141145760405162461bcd60e51b8152600401610e1b90614c59565b61140c33612797565b600054610100900460ff166141445760405162461bcd60e51b8152600401610e1b90614c59565b6065805460ff19169055565b6060824710156141b15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610e1b565b6001600160a01b0385163b6142085760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610e1b565b600080866001600160a01b0316858760405161422491906151e5565b60006040518083038185875af1925050503d8060008114614261576040519150601f19603f3d011682016040523d82523d6000602084013e614266565b606091505b5091509150614276828286614281565b979650505050505050565b60608315614290575081613f02565b8251156142a05782518084602001fd5b8160405162461bcd60e51b8152600401610e1b9190615201565b82805482825590600052602060002090810192821561430f579160200282015b8281111561430f57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906142da565b5061431b9291506143d1565b5090565b5080546000825590600052602060002090810190610ce991906143d1565b50805461434990614994565b6000825580601f10614359575050565b601f016020900490600052602060002090810190610ce991906143d1565b60405180606001604052806143bd6040518060c0016040528060008152602001600081526020016000815260200160008152602001606081526020016000151581525090565b815260200160008152602001600081525090565b5b8082111561431b57600081556001016143d2565b6001600160a01b0381168114610ce957600080fd5b8035614406816143e6565b919050565b60006020828403121561441d57600080fd5b8135613f02816143e6565b634e487b7160e01b600052602160045260246000fd5b60005b83811015614459578181015183820152602001614441565b50506000910152565b6000815180845261447a81602086016020860161443e565b601f01601f19169290920160200192915050565b6000600386106144a0576144a0614428565b8582526001600160a01b03851660208301526080604083018190526144c790830185614462565b905082606083015295945050505050565b8015158114610ce957600080fd5b8035614406816144d8565b60006020828403121561450357600080fd5b8135613f02816144d8565b60006020828403121561452057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171561455f5761455f614527565b60405290565b60405160c081016001600160401b038111828210171561455f5761455f614527565b604051601f8201601f191681016001600160401b03811182821017156145af576145af614527565b604052919050565b60006001600160401b038211156145d0576145d0614527565b5060051b60200190565b600082601f8301126145eb57600080fd5b813560206146006145fb836145b7565b614587565b8281526060928302850182019282820191908785111561461f57600080fd5b8387015b858110156146665781818a03121561463b5760008081fd5b61464361453d565b813581528582013586820152604080830135908201528452928401928101614623565b5090979650505050505050565b600082601f83011261468457600080fd5b813560206146946145fb836145b7565b82815260059290921b840181019181810190868411156146b357600080fd5b8286015b848110156146d75780356146ca816143e6565b83529183019183016146b7565b509695505050505050565b60008060008060008060a087890312156146fb57600080fd5b8635614706816143e6565b955060208701356001600160401b038082111561472257600080fd5b61472e8a838b016145da565b9650604089013591508082111561474457600080fd5b6147508a838b01614673565b9550606089013591508082111561476657600080fd5b818901915089601f83011261477a57600080fd5b81358181111561478957600080fd5b8a602082850101111561479b57600080fd5b602083019550809450505050608087013590509295509295509295565b600281106147c8576147c8614428565b9052565b60208101613d1e82846147b8565b600060c082840312156147ec57600080fd5b50919050565b60008060008060008060008060008060006102008c8e03121561481457600080fd5b61481d8c6143fb565b9a5061482b60208d016143fb565b995061483960408d016144e6565b98506001600160401b038060608e0135111561485457600080fd5b6148648e60608f01358f016145da565b98508060808e0135111561487757600080fd5b6148878e60808f01358f016145da565b975061489560a08e016143fb565b96506148a360c08e016143fb565b955060e08d01359450806101008e013511156148be57600080fd5b6148cf8e6101008f01358f01614673565b9350806101208e013511156148e357600080fd5b506148f58d6101208e01358e01614673565b91506149058d6101408e016147da565b90509295989b509295989b9093969950565b60208152600082516060602084015280516080840152602081015160a0840152604081015160c0840152606081015160e0840152608081015160c0610100850152614966610140850182614462565b905060a082015115156101208501526020850151604085015260408501516060850152809250505092915050565b600181811c908216806149a857607f821691505b6020821081036147ec57634e487b7160e01b600052602260045260246000fd5b6000602082840312156149da57600080fd5b5051919050565b602080825260069082015265085d985d5b1d60d21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115613d1e57613d1e614a01565b8082028115828204841417613d1e57613d1e614a01565b600082614a5e57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f8211156122ee57600081815260208120601f850160051c81016020861015614aa05750805b601f850160051c820191505b8181101561351f57828155600101614aac565b6001600160401b03831115614ad657614ad6614527565b614aea83614ae48354614994565b83614a79565b6000601f841160018114614b1e5760008515614b065750838201355b600019600387901b1c1916600186901b178355613521565b600083815260209020601f19861690835b82811015614b4f5786850135825560209485019460019092019101614b2f565b5086821015614b6c5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600060018201614b9057614b90614a01565b5060010190565b80820180821115613d1e57613d1e614a01565b8051614406816144d8565b60008060008060008060c08789031215614bce57600080fd5b8651614bd9816143e6565b6020880151909650614bea816143e6565b6040880151909550614bfb816143e6565b6060880151909450614c0c816143e6565b6080880151909350614c1d816143e6565b60a0880151909250614c2e816144d8565b809150509295509295509295565b600060208284031215614c4e57600080fd5b8151613f02816144d8565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020808385031215614cb757600080fd5b82516001600160401b0380821115614cce57600080fd5b9084019060c08287031215614ce257600080fd5b614cea614565565b8251815283830151848201526040830151604082015260608301516060820152608083015182811115614d1c57600080fd5b8301601f81018813614d2d57600080fd5b805183811115614d3f57614d3f614527565b614d51601f8201601f19168701614587565b93508084528886828401011115614d6757600080fd5b614d768187860188850161443e565b5050816080820152614d8a60a08401614baa565b60a08201529695505050505050565b600081518084526020808501945080840160005b83811015614dd25781516001600160a01b031687529582019590820190600101614dad565b509495945050505050565b600081518084526020808501945080840160005b83811015614dd257815187529582019590820190600101614df1565b6000610120808301614e1f848b6147b8565b60208481019290925288519081905261014080850192600583901b8601909101918a820160005b82811015614ea95787850361013f190186528151805186528481015185870152604080820151908701526060808201519087015260809081015160a091870182905290614e9581880183614462565b978601979650505090830190600101614e46565b505050508381036040850152614ebf8189614d99565b915050614eff606084018780516001600160a01b039081168352602080830151151590840152604080830151909116908301526060908101511515910152565b82810360e0840152614f118186614ddd565b91505082610100830152979650505050505050565b60006020808385031215614f3957600080fd5b82516001600160401b03811115614f4f57600080fd5b8301601f81018513614f6057600080fd5b8051614f6e6145fb826145b7565b81815260059190911b82018301908381019087831115614f8d57600080fd5b928401925b8284101561427657835182529284019290840190614f92565b602081526000825160806020840152614fc760a0840182614462565b905060018060a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b600082601f83011261500a57600080fd5b8151602061501a6145fb836145b7565b82815260059290921b8401810191818101908684111561503957600080fd5b8286015b848110156146d7578051835291830191830161503d565b60008060006060848603121561506957600080fd5b83516001600160401b038082111561508057600080fd5b818601915086601f83011261509457600080fd5b815160206150a46145fb836145b7565b82815260059290921b8401810191818101908a8411156150c357600080fd5b948201945b838610156150ea5785516150db816143e6565b825294820194908201906150c8565b9189015191975090935050508082111561510357600080fd5b5061511086828701614ff9565b925050604084015190509250925092565b60ff8416815260606020820152600061513d6060830185614ddd565b905060ff83166040830152949350505050565b8481526001600160a01b0384811660208301528316604082015260806060820181905282518183019190915260009061518d610100840182614d99565b90506020840151607f19808584030160a08601526151ab8383614ddd565b925060408601519150808584030160c0860152506151c98282614462565b9150506060840151151560e08401528091505095945050505050565b600082516151f781846020870161443e565b9190910192915050565b602081526000613f02602083018461446256fea26469706673582212203d0bb485ed9a1a623a89646a1a49fb8bd65c7b94e29a228b145f73f38753d75964736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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