ETH Price: $2,443.10 (-0.06%)

Contract

0xe115b50c52cB5624fD76232cDF498ADA6ECD1e69
Transaction Hash
Method
Block
From
To
Set Swap Info1263494732024-10-07 10:42:032 days ago1728297723IN
0xe115b50c...A6ECD1e69
0 ETH0.0000006503670.0009863
Set Swap Info1252485572024-09-11 23:04:5127 days ago1726095891IN
0xe115b50c...A6ECD1e69
0 ETH0.0000004193670.00136501
Set Swap Infos1248419052024-09-02 13:09:4737 days ago1725282587IN
0xe115b50c...A6ECD1e69
0 ETH0.0000001995870.00042443
Set Swap Infos1247124092024-08-30 13:13:1540 days ago1725023595IN
0xe115b50c...A6ECD1e69
0 ETH0.000000190420.00029943
Set Swap Info1239948872024-08-13 22:35:5156 days ago1723588551IN
0xe115b50c...A6ECD1e69
0 ETH0.0000000434840.00019342
Set Swap Info1239947652024-08-13 22:31:4756 days ago1723588307IN
0xe115b50c...A6ECD1e69
0 ETH0.0000003794040.00113357
Set Swap Infos1232984502024-07-28 19:41:1772 days ago1722195677IN
0xe115b50c...A6ECD1e69
0 ETH0.0000003932130.00124379
Set Swap Infos1232972752024-07-28 19:02:0772 days ago1722193327IN
0xe115b50c...A6ECD1e69
0 ETH0.0000006155720.00185512
Set Swap Infos1222490512024-07-04 12:41:1997 days ago1720096879IN
0xe115b50c...A6ECD1e69
0 ETH0.0000176380360.06033577
Set Swap Infos1216471072024-06-20 14:16:31111 days ago1718892991IN
0xe115b50c...A6ECD1e69
0 ETH0.0000169197850.21612695
Set Swap Infos1216466282024-06-20 14:00:33111 days ago1718892033IN
0xe115b50c...A6ECD1e69
0 ETH0.0000580842720.19933488
Set Swap Infos1215708882024-06-18 19:55:53112 days ago1718740553IN
0xe115b50c...A6ECD1e69
0 ETH0.0000046517260.06114127
Set Swap Infos1215707602024-06-18 19:51:37112 days ago1718740297IN
0xe115b50c...A6ECD1e69
0 ETH0.0000185839350.06369231
Set Swap Infos1215704192024-06-18 19:40:15112 days ago1718739615IN
0xe115b50c...A6ECD1e69
0 ETH0.0000178012730.06098954
Set Swap Infos1215703852024-06-18 19:39:07112 days ago1718739547IN
0xe115b50c...A6ECD1e69
0 ETH0.0000192512180.06115671
Set Swap Infos1215703362024-06-18 19:37:29112 days ago1718739449IN
0xe115b50c...A6ECD1e69
0 ETH0.0000175499790.06014221
Set Swap Infos1215702962024-06-18 19:36:09112 days ago1718739369IN
0xe115b50c...A6ECD1e69
0 ETH0.0000176562930.06051462
Set Swap Infos1215702682024-06-18 19:35:13112 days ago1718739313IN
0xe115b50c...A6ECD1e69
0 ETH0.0000062778650.06139917
Set Swap Infos1215702432024-06-18 19:34:23112 days ago1718739263IN
0xe115b50c...A6ECD1e69
0 ETH0.0000175544450.06022701
Set Swap Infos1214342502024-06-15 16:01:17116 days ago1718467277IN
0xe115b50c...A6ECD1e69
0 ETH0.0000006473930.00195571
Set Swap Infos1214318202024-06-15 14:40:17116 days ago1718462417IN
0xe115b50c...A6ECD1e69
0 ETH0.0000006606830.0020299
Set Swap Infos1214301532024-06-15 13:44:43116 days ago1718459083IN
0xe115b50c...A6ECD1e69
0 ETH0.000000491270.00212476
Set Swap Infos1214281872024-06-15 12:39:11116 days ago1718455151IN
0xe115b50c...A6ECD1e69
0 ETH0.0000015821750.00176066
Set Swap Infos1212641102024-06-11 17:29:57119 days ago1718126997IN
0xe115b50c...A6ECD1e69
0 ETH0.0000069013670.061764
Set Swap Infos1212616842024-06-11 16:09:05120 days ago1718122145IN
0xe115b50c...A6ECD1e69
0 ETH0.0000293299850.09964065
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BeefySwapper

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : BeefySwapper.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.19;

import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { IERC20MetadataUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import { IBeefyOracle } from "../interfaces/oracle/IBeefyOracle.sol";
import { BytesLib } from "../utils/BytesLib.sol";

/// @title Beefy Swapper
/// @author Beefy, @kexley
/// @notice Centralized swapper
contract BeefySwapper is OwnableUpgradeable {
    using SafeERC20Upgradeable for IERC20MetadataUpgradeable;
    using BytesLib for bytes;

    /// @dev Price update failed for a token
    /// @param token Address of token that failed the price update
    error PriceFailed(address token);

    /// @dev No swap data has been set by the owner
    /// @param fromToken Token to swap from
    /// @param toToken Token to swap to
    error NoSwapData(address fromToken, address toToken);

    /// @dev Swap call failed
    /// @param router Target address of the failed swap call
    /// @param data Payload of the failed call
    error SwapFailed(address router, bytes data);

    /// @dev Not enough output was returned from the swap
    /// @param amountOut Amount returned by the swap
    /// @param minAmountOut Minimum amount required from the swap
    error SlippageExceeded(uint256 amountOut, uint256 minAmountOut);

    /// @dev Stored data for a swap
    /// @param router Target address that will handle the swap
    /// @param data Payload of a template swap between the two tokens
    /// @param amountIndex Location in the data byte string where the amount should be overwritten
    /// @param minIndex Location in the data byte string where the min amount to swap should be
    /// overwritten
    /// @param minAmountSign Represents the sign of the min amount to be included in the swap, any
    /// negative value will encode a negative min amount (required for Balancer)
    struct SwapInfo {
        address router;
        bytes data;
        uint256 amountIndex;
        uint256 minIndex;
        int8 minAmountSign;
    }

    /// @notice Stored swap info for a token
    mapping(address => mapping(address => SwapInfo)) public swapInfo;

    /// @notice Oracle used to calculate the minimum output of a swap
    IBeefyOracle public oracle;

    /// @notice Minimum acceptable percentage slippage output in 18 decimals
    uint256 public slippage;

    /// @notice Swap between two tokens
    /// @param caller Address of the caller of the swap
    /// @param fromToken Address of the source token
    /// @param toToken Address of the destination token
    /// @param amountIn Amount of source token inputted to the swap
    /// @param amountOut Amount of destination token outputted from the swap
    event Swap(
        address indexed caller,
        address indexed fromToken,
        address indexed toToken,
        uint256 amountIn,
        uint256 amountOut
    );

    /// @notice Set new swap info for the route between two tokens
    /// @param fromToken Address of the source token
    /// @param toToken Address of the destination token
    /// @param swapInfo Struct of stored swap information for the pair of tokens
    event SetSwapInfo(address indexed fromToken, address indexed toToken, SwapInfo swapInfo);

    /// @notice Set a new oracle
    /// @param oracle New oracle address
    event SetOracle(address oracle);

    /// @notice Set a new slippage
    /// @param slippage New slippage amount
    event SetSlippage(uint256 slippage);

    /// @notice Initialize the contract
    /// @dev Ownership is transferred to msg.sender
    /// @param _oracle Oracle to find prices for tokens
    /// @param _slippage Acceptable slippage for any swap
    function initialize(address _oracle, uint256 _slippage) external initializer {
        __Ownable_init();
        oracle = IBeefyOracle(_oracle);
        slippage = _slippage;
    }

    /// @notice Swap between two tokens with slippage calculated using the oracle
    /// @dev Caller must have already approved this contract to spend the _fromToken. After the
    /// swap the _toToken token is sent directly to the caller
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @param _amountIn Amount of _fromToken to use in the swap
    /// @return amountOut Amount of _toToken returned to the caller
    function swap(
        address _fromToken,
        address _toToken,
        uint256 _amountIn
    ) external returns (uint256 amountOut) {
        uint256 minAmountOut = _getAmountOut(_fromToken, _toToken, _amountIn);
        amountOut = _swap(_fromToken, _toToken, _amountIn, minAmountOut);
    }

    /// @notice Swap between two tokens with slippage provided by the caller
    /// @dev Caller must have already approved this contract to spend the _fromToken. After the
    /// swap the _toToken token is sent directly to the caller
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @param _amountIn Amount of _fromToken to use in the swap
    /// @param _minAmountOut Minimum amount of _toToken that is acceptable to be returned to caller
    /// @return amountOut Amount of _toToken returned to the caller
    function swap(
        address _fromToken,
        address _toToken,
        uint256 _amountIn,
        uint256 _minAmountOut
    ) external returns (uint256 amountOut) {
        amountOut = _swap(_fromToken, _toToken, _amountIn, _minAmountOut);
    }

    /// @notice Get the amount out from a simulated swap with slippage and non-fresh prices
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @param _amountIn Amount of _fromToken to use in the swap
    /// @return amountOut Amount of _toTokens returned from the swap
    function getAmountOut(
        address _fromToken,
        address _toToken,
        uint256 _amountIn
    ) external view returns (uint256 amountOut) {
        (uint256 fromPrice, uint256 toPrice) = 
            (oracle.getPrice(_fromToken), oracle.getPrice(_toToken));
        uint8 decimals0 = IERC20MetadataUpgradeable(_fromToken).decimals();
        uint8 decimals1 = IERC20MetadataUpgradeable(_toToken).decimals();
        amountOut = _calculateAmountOut(_amountIn, fromPrice, toPrice, decimals0, decimals1);
    }

    /// @dev Use the oracle to get prices for both _fromToken and _toToken and calculate the
    /// estimated output reduced by the slippage
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @param _amountIn Amount of _fromToken to use in the swap
    /// @return amountOut Amount of _toToken returned by the swap
    function _getAmountOut(
        address _fromToken,
        address _toToken,
        uint256 _amountIn
    ) private returns (uint256 amountOut) {
        (uint256 fromPrice, uint256 toPrice) = _getFreshPrice(_fromToken, _toToken);
        uint8 decimals0 = IERC20MetadataUpgradeable(_fromToken).decimals();
        uint8 decimals1 = IERC20MetadataUpgradeable(_toToken).decimals();
        uint256 slippedAmountIn = _amountIn * slippage / 1 ether;
        amountOut = _calculateAmountOut(slippedAmountIn, fromPrice, toPrice, decimals0, decimals1);
    }

    /// @dev _fromToken is pulled into this contract from the caller, swap is executed according to
    /// the stored data, resulting _toTokens are sent to the caller
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @param _amountIn Amount of _fromToken to use in the swap
    /// @param _minAmountOut Minimum amount of _toToken that is acceptable to be returned to caller
    /// @return amountOut Amount of _toToken returned to the caller
    function _swap(
        address _fromToken,
        address _toToken,
        uint256 _amountIn,
        uint256 _minAmountOut
    ) private returns (uint256 amountOut) {
        IERC20MetadataUpgradeable(_fromToken).safeTransferFrom(msg.sender, address(this), _amountIn);
        _executeSwap(_fromToken, _toToken, _amountIn, _minAmountOut);
        amountOut = IERC20MetadataUpgradeable(_toToken).balanceOf(address(this));
        if (amountOut < _minAmountOut) revert SlippageExceeded(amountOut, _minAmountOut);
        IERC20MetadataUpgradeable(_toToken).safeTransfer(msg.sender, amountOut);
        emit Swap(msg.sender, _fromToken, _toToken, _amountIn, amountOut);
    }

    /// @dev Fetch the stored swap info for the route between the two tokens, insert the encoded
    /// balance and minimum output to the payload and call the stored router with the data
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @param _amountIn Amount of _fromToken to use in the swap
    /// @param _minAmountOut Minimum amount of _toToken that is acceptable to be returned to caller
    function _executeSwap(
        address _fromToken,
        address _toToken,
        uint256 _amountIn,
        uint256 _minAmountOut
    ) private {
        SwapInfo memory swapData = swapInfo[_fromToken][_toToken];
        address router = swapData.router;
        if (router == address(0)) revert NoSwapData(_fromToken, _toToken);
        bytes memory data = swapData.data;

        data = _insertData(data, swapData.amountIndex, abi.encode(_amountIn));

        bytes memory minAmountData = swapData.minAmountSign >= 0
            ? abi.encode(_minAmountOut)
            : abi.encode(-int256(_minAmountOut));
        
        data = _insertData(data, swapData.minIndex, minAmountData);

        IERC20MetadataUpgradeable(_fromToken).forceApprove(router, type(uint256).max);
        (bool success,) = router.call(data);
        if (!success) revert SwapFailed(router, data);
    }

    /// @dev Helper function to insert data to an in-memory bytes string
    /// @param _data Template swap payload with blank spaces to overwrite
    /// @param _index Start location in the data byte string where the _newData should overwrite
    /// @param _newData New data that is to be inserted
    /// @return data The resulting string from the insertion
    function _insertData(
        bytes memory _data,
        uint256 _index,
        bytes memory _newData
    ) private pure returns (bytes memory data) {
        data = bytes.concat(
            bytes.concat(
                _data.slice(0, _index),
                _newData
            ),
            _data.slice(_index + 32, _data.length - (_index + 32))
        );
    }

    /// @dev Fetch fresh prices from the oracle
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @return fromPrice Price of token to swap from
    /// @return toPrice Price of token to swap to
    function _getFreshPrice(
        address _fromToken,
        address _toToken
    ) private returns (uint256 fromPrice, uint256 toPrice) {
        bool success;
        (fromPrice, success) = oracle.getFreshPrice(_fromToken);
        if (!success) revert PriceFailed(_fromToken);
        (toPrice, success) = oracle.getFreshPrice(_toToken);
        if (!success) revert PriceFailed(_toToken);
    }

    /// @dev Calculate the amount out given the prices and the decimals of the tokens involved
    /// @param _amountIn Amount of _fromToken to use in the swap
    /// @param _price0 Price of the _fromToken
    /// @param _price1 Price of the _toToken
    /// @param _decimals0 Decimals of the _fromToken
    /// @param _decimals1 Decimals of the _toToken
    function _calculateAmountOut(
        uint256 _amountIn,
        uint256 _price0,
        uint256 _price1,
        uint8 _decimals0,
        uint8 _decimals1
    ) private pure returns (uint256 amountOut) {
        amountOut = _amountIn * (_price0 * 10 ** _decimals1) / (_price1 * 10 ** _decimals0);
    }

    /* ----------------------------------- OWNER FUNCTIONS ----------------------------------- */

    /// @notice Owner function to set the stored swap info for the route between two tokens
    /// @dev No validation checks
    /// @param _fromToken Token to swap from
    /// @param _toToken Token to swap to
    /// @param _swapInfo Swap info to store
    function setSwapInfo(
        address _fromToken,
        address _toToken,
        SwapInfo calldata _swapInfo
    ) external onlyOwner {
        swapInfo[_fromToken][_toToken] = _swapInfo;
        emit SetSwapInfo(_fromToken, _toToken, _swapInfo);
    }

    /// @notice Owner function to set multiple stored swap info for the routes between two tokens
    /// @dev No validation checks
    /// @param _fromTokens Tokens to swap from
    /// @param _toTokens Tokens to swap to
    /// @param _swapInfos Swap infos to store
    function setSwapInfos(
        address[] calldata _fromTokens,
        address[] calldata _toTokens,
        SwapInfo[] calldata _swapInfos
    ) external onlyOwner {
        uint256 tokenLength = _fromTokens.length;
        for (uint i; i < tokenLength;) {
            swapInfo[_fromTokens[i]][_toTokens[i]] = _swapInfos[i];
            emit SetSwapInfo(_fromTokens[i], _toTokens[i], _swapInfos[i]);
            unchecked { ++i; }
        }
    }

    /// @notice Owner function to set the oracle used to calculate the minimum outputs
    /// @dev No validation checks
    /// @param _oracle Address of the new oracle
    function setOracle(address _oracle) external onlyOwner {
        oracle = IBeefyOracle(_oracle);
        emit SetOracle(_oracle);
    }

    /// @notice Owner function to set the slippage
    /// @param _slippage Acceptable slippage level
    function setSlippage(uint256 _slippage) external onlyOwner {
        if (_slippage > 1 ether) _slippage = 1 ether;
        slippage = _slippage;
        emit SetSlippage(_slippage);
    }
}

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @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 11 : IERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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 IERC20PermitUpgradeable {
    /**
     * @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 6 of 11 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 7 of 11 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

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

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20Upgradeable 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(IERC20Upgradeable 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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20PermitUpgradeable 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(IERC20Upgradeable 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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 9 of 11 : 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 10 of 11 : IBeefyOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IBeefyOracle {
    function getPrice(address token) external view returns (uint256 price);
    function getPrice(address[] calldata tokens) external view returns (uint256[] memory prices);
    function getFreshPrice(address token) external returns (uint256 price, bool success);
    function getFreshPrice(address[] calldata tokens) external returns (uint256[] memory prices, bool[] memory successes);
}

File 11 of 11 : BytesLib.sol
// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;


library BytesLib {
    function concat(
        bytes memory _preBytes,
        bytes memory _postBytes
    )
    internal
    pure
    returns (bytes memory)
    {
        bytes memory tempBytes;

        assembly {
        // Get a location of some free memory and store it in tempBytes as
        // Solidity does for memory variables.
            tempBytes := mload(0x40)

        // Store the length of the first bytes array at the beginning of
        // the memory for tempBytes.
            let length := mload(_preBytes)
            mstore(tempBytes, length)

        // Maintain a memory counter for the current write location in the
        // temp bytes array by adding the 32 bytes for the array length to
        // the starting location.
            let mc := add(tempBytes, 0x20)
        // Stop copying when the memory counter reaches the length of the
        // first bytes array.
            let end := add(mc, length)

            for {
            // Initialize a copy counter to the start of the _preBytes data,
            // 32 bytes into its memory.
                let cc := add(_preBytes, 0x20)
            } lt(mc, end) {
            // Increase both counters by 32 bytes each iteration.
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
            // Write the _preBytes data into the tempBytes memory 32 bytes
            // at a time.
                mstore(mc, mload(cc))
            }

        // Add the length of _postBytes to the current length of tempBytes
        // and store it as the new length in the first 32 bytes of the
        // tempBytes memory.
            length := mload(_postBytes)
            mstore(tempBytes, add(length, mload(tempBytes)))

        // Move the memory counter back from a multiple of 0x20 to the
        // actual end of the _preBytes data.
            mc := end
        // Stop copying when the memory counter reaches the new combined
        // length of the arrays.
            end := add(mc, length)

            for {
                let cc := add(_postBytes, 0x20)
            } lt(mc, end) {
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                mstore(mc, mload(cc))
            }

        // Update the free-memory pointer by padding our last write location
        // to 32 bytes: add 31 bytes to the end of tempBytes to move to the
        // next 32 byte block, then round down to the nearest multiple of
        // 32. If the sum of the length of the two arrays is zero then add
        // one before rounding down to leave a blank 32 bytes (the length block with 0).
            mstore(0x40, and(
            add(add(end, iszero(add(length, mload(_preBytes)))), 31),
            not(31) // Round down to the nearest 32 bytes.
            ))
        }

        return tempBytes;
    }

    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
        assembly {
        // Read the first 32 bytes of _preBytes storage, which is the length
        // of the array. (We don't need to use the offset into the slot
        // because arrays use the entire slot.)
            let fslot := sload(_preBytes.slot)
        // Arrays of 31 bytes or less have an even value in their slot,
        // while longer arrays have an odd value. The actual length is
        // the slot divided by two for odd values, and the lowest order
        // byte divided by two for even values.
        // If the slot is even, bitwise and the slot with 255 and divide by
        // two to get the length. If the slot is odd, bitwise and the slot
        // with -1 and divide by two.
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)
            let newlength := add(slength, mlength)
        // slength can contain both the length and contents of the array
        // if length < 32 bytes so let's prepare for that
        // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
            switch add(lt(slength, 32), lt(newlength, 32))
            case 2 {
            // Since the new array still fits in the slot, we just need to
            // update the contents of the slot.
            // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
                sstore(
                _preBytes.slot,
                // all the modifications to the slot are inside this
                // next block
                add(
                // we can just add to the slot contents because the
                // bytes we want to change are the LSBs
                fslot,
                add(
                mul(
                div(
                // load the bytes from memory
                mload(add(_postBytes, 0x20)),
                // zero all bytes to the right
                exp(0x100, sub(32, mlength))
                ),
                // and now shift left the number of bytes to
                // leave space for the length in the slot
                exp(0x100, sub(32, newlength))
                ),
                // increase length by the double of the memory
                // bytes length
                mul(mlength, 2)
                )
                )
                )
            }
            case 1 {
            // The stored value fits in the slot, but the combined value
            // will exceed it.
            // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

            // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

            // The contents of the _postBytes array start 32 bytes into
            // the structure. Our first read should obtain the `submod`
            // bytes that can fit into the unused space in the last word
            // of the stored array. To get this, we read 32 bytes starting
            // from `submod`, so the data we read overlaps with the array
            // contents by `submod` bytes. Masking the lowest-order
            // `submod` bytes allows us to add that value directly to the
            // stored value.

                let submod := sub(32, slength)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(
                sc,
                add(
                and(
                fslot,
                0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
                ),
                and(mload(mc), mask)
                )
                )

                for {
                    mc := add(mc, 0x20)
                    sc := add(sc, 1)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
            default {
            // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
            // Start copying to the last used word of the stored array.
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

            // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

            // Copy over the first `submod` bytes of the new data as in
            // case 1 above.
                let slengthmod := mod(slength, 32)
                let mlengthmod := mod(mlength, 32)
                let submod := sub(32, slengthmod)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(sc, add(sload(sc), and(mload(mc), mask)))

                for {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
        }
    }

    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    )
    internal
    pure
    returns (bytes memory)
    {
        require(_length + 31 >= _length, "slice_overflow");
        require(_bytes.length >= _start + _length, "slice_outOfBounds");

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
            // Get a location of some free memory and store it in tempBytes as
            // Solidity does for memory variables.
                tempBytes := mload(0x40)

            // The first word of the slice result is potentially a partial
            // word read from the original array. To read it, we calculate
            // the length of that partial word and start copying that many
            // bytes into the array. The first word we copy will start with
            // data we don't care about, but the last `lengthmod` bytes will
            // land at the beginning of the contents of the new array. When
            // we're done copying, we overwrite the full first word with
            // the actual length of the slice.
                let lengthmod := and(_length, 31)

            // The multiplication in the next line is necessary
            // because when slicing multiples of 32 bytes (lengthmod == 0)
            // the following copy loop was copying the origin's length
            // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                // The multiplication in the next line has the same exact purpose
                // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

            //update free-memory pointer
            //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)
            //zero out the 32 bytes slice we are about to return
            //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {
        require(_bytes.length >= _start + 1 , "toUint8_outOfBounds");
        uint8 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x1), _start))
        }

        return tempUint;
    }

    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {
        require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
        uint16 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x2), _start))
        }

        return tempUint;
    }

    function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {
        require(_start + 3 >= _start, 'toUint24_overflow');
        require(_bytes.length >= _start + 3, 'toUint24_outOfBounds');
        uint24 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x3), _start))
        }

        return tempUint;
    }

    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {
        require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }

    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {
        require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
        uint64 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x8), _start))
        }

        return tempUint;
    }

    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {
        require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
        uint96 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0xc), _start))
        }

        return tempUint;
    }

    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {
        require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
        uint128 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x10), _start))
        }

        return tempUint;
    }

    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
        require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
        uint256 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {
        require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
        bytes32 tempBytes32;

        assembly {
            tempBytes32 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes32;
    }

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

        // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
            // cb is a circuit breaker in the for loop since there's
            //  no said feature for inline assembly loops
            // cb = 1 - don't breaker
            // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                // the next line is the loop condition:
                // while(uint256(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                    // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
            // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(
        bytes storage _preBytes,
        bytes memory _postBytes
    )
    internal
    view
    returns (bool)
    {
        bool success = true;

        assembly {
        // we know _preBytes_offset is 0
            let fslot := sload(_preBytes.slot)
        // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

        // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
            // slength can contain both the length and contents of the array
            // if length < 32 bytes so let's prepare for that
            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                    // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                        // unsuccess:
                            success := 0
                        }
                    }
                    default {
                    // cb is a circuit breaker in the for loop since there's
                    //  no said feature for inline assembly loops
                    // cb = 1 - don't breaker
                    // cb = 0 - break
                        let cb := 1

                    // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes.slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                    // the next line is the loop condition:
                    // while(uint256(mc < end) + cb == 2)
                        for {} eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                            // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
            // unsuccess:
                success := 0
            }
        }

        return success;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"}],"name":"NoSwapData","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"PriceFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"}],"name":"SlippageExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"SwapFailed","type":"error"},{"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":"oracle","type":"address"}],"name":"SetOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"slippage","type":"uint256"}],"name":"SetSlippage","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"},{"internalType":"uint256","name":"minIndex","type":"uint256"},{"internalType":"int8","name":"minAmountSign","type":"int8"}],"indexed":false,"internalType":"struct BeefySwapper.SwapInfo","name":"swapInfo","type":"tuple"}],"name":"SetSwapInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"address","name":"_toToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IBeefyOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oracle","type":"address"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"setSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"address","name":"_toToken","type":"address"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"},{"internalType":"uint256","name":"minIndex","type":"uint256"},{"internalType":"int8","name":"minAmountSign","type":"int8"}],"internalType":"struct BeefySwapper.SwapInfo","name":"_swapInfo","type":"tuple"}],"name":"setSwapInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fromTokens","type":"address[]"},{"internalType":"address[]","name":"_toTokens","type":"address[]"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"},{"internalType":"uint256","name":"minIndex","type":"uint256"},{"internalType":"int8","name":"minAmountSign","type":"int8"}],"internalType":"struct BeefySwapper.SwapInfo[]","name":"_swapInfos","type":"tuple[]"}],"name":"setSwapInfos","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"address","name":"_toToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"address","name":"_toToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"swapInfo","outputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"},{"internalType":"uint256","name":"minIndex","type":"uint256"},{"internalType":"int8","name":"minAmountSign","type":"int8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061203f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063b84ea7731161008c578063e0146c8e11610066578063e0146c8e146101c3578063f0fa55a9146101e7578063f2fde38b146101fa578063fe0291561461020d57600080fd5b8063b84ea7731461018a578063cd6dc6871461019d578063df791e50146101b057600080fd5b8063717c821b116100c8578063717c821b146101285780637adbf9731461013b5780637dc0d1d01461014e5780638da5cb5b1461017957600080fd5b80633e032a3b146100ef5780634aa066521461010b578063715018a61461011e575b600080fd5b6100f860675481565b6040519081526020015b60405180910390f35b6100f86101193660046116d7565b610220565b6101266103ec565b005b610126610136366004611764565b610400565b6101266101493660046117fe565b61059e565b606654610161906001600160a01b031681565b6040516001600160a01b039091168152602001610102565b6033546001600160a01b0316610161565b610126610198366004611822565b6105fb565b6101266101ab36600461188b565b610687565b6100f86101be3660046116d7565b6107bf565b6101d66101d13660046118b7565b6107e4565b604051610102959493929190611940565b6101266101f5366004611984565b6108b5565b6101266102083660046117fe565b61090d565b6100f861021b36600461199d565b610986565b6066546040516341976e0960e01b81526001600160a01b03858116600483015260009283928392909116906341976e0990602401602060405180830381865afa158015610271573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029591906119e3565b6066546040516341976e0960e01b81526001600160a01b038881166004830152909116906341976e0990602401602060405180830381865afa1580156102df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030391906119e3565b915091506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610347573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036b91906119fc565b90506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d191906119fc565b90506103e08685858585610994565b98975050505050505050565b6103f46109de565b6103fe6000610a38565b565b6104086109de565b8460005b818110156105945783838281811061042657610426611a1f565b90506020028101906104389190611a35565b606560008a8a8581811061044e5761044e611a1f565b905060200201602081019061046391906117fe565b6001600160a01b03166001600160a01b03168152602001908152602001600020600088888581811061049757610497611a1f565b90506020020160208101906104ac91906117fe565b6001600160a01b0316815260208101919091526040016000206104cf8282611bd0565b9050508585828181106104e4576104e4611a1f565b90506020020160208101906104f991906117fe565b6001600160a01b031688888381811061051457610514611a1f565b905060200201602081019061052991906117fe565b6001600160a01b03167f5f3b2610bbe37065dec3d702f3bec7a246a869b1fa28b632468981cda5b241a686868581811061056557610565611a1f565b90506020028101906105779190611a35565b6040516105849190611cbf565b60405180910390a360010161040c565b5050505050505050565b6105a66109de565b606680546001600160a01b0319166001600160a01b0383169081179091556040519081527fd3b5d1e0ffaeff528910f3663f0adace7694ab8241d58e17a91351ced2e08031906020015b60405180910390a150565b6106036109de565b6001600160a01b03808416600090815260656020908152604080832093861683529290522081906106348282611bd0565b905050816001600160a01b0316836001600160a01b03167f5f3b2610bbe37065dec3d702f3bec7a246a869b1fa28b632468981cda5b241a68360405161067a9190611cbf565b60405180910390a3505050565b600054610100900460ff16158080156106a75750600054600160ff909116105b806106c15750303b1580156106c1575060005460ff166001145b6107295760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561074c576000805461ff0019166101001790555b610754610a8a565b606680546001600160a01b0319166001600160a01b038516179055606782905580156107ba576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6000806107cd858585610ab9565b90506107db85858584610bd7565b95945050505050565b6065602090815260009283526040808420909152908252902080546001820180546001600160a01b03909216929161081b90611a6b565b80601f016020809104026020016040519081016040528092919081815260200182805461084790611a6b565b80156108945780601f1061086957610100808354040283529160200191610894565b820191906000526020600020905b81548152906001019060200180831161087757829003601f168201915b50505050600283015460038401546004909401549293909290915060000b85565b6108bd6109de565b670de0b6b3a76400008111156108d85750670de0b6b3a76400005b60678190556040518181527f3facf1379d243c7dca4557da77e575797c040ac0b1bc8ea70d997b452fcf8af3906020016105f0565b6109156109de565b6001600160a01b03811661097a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610720565b61098381610a38565b50565b60006107db85858585610bd7565b60006109a183600a611e65565b6109ab9085611e74565b6109b683600a611e65565b6109c09087611e74565b6109ca9088611e74565b6109d49190611e8b565b9695505050505050565b6033546001600160a01b031633146103fe5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610720565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610ab15760405162461bcd60e51b815260040161072090611ead565b6103fe610cf6565b6000806000610ac88686610d26565b915091506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3091906119fc565b90506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9691906119fc565b90506000670de0b6b3a764000060675488610bb19190611e74565b610bbb9190611e8b565b9050610bca8186868686610994565b9998505050505050505050565b6000610bee6001600160a01b038616333086610e6f565b610bfa85858585610ee0565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa158015610c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6291906119e3565b905081811015610c8f576040516371c4efed60e01b81526004810182905260248101839052604401610720565b610ca36001600160a01b038516338361115e565b60408051848152602081018390526001600160a01b03808716929088169133917fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e46062910160405180910390a4949350505050565b600054610100900460ff16610d1d5760405162461bcd60e51b815260040161072090611ead565b6103fe33610a38565b60665460405163baeb325b60e01b81526001600160a01b038481166004830152600092839283929091169063baeb325b9060240160408051808303816000875af1158015610d78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9c9190611f08565b909350905080610dca576040516310c0e38560e21b81526001600160a01b0386166004820152602401610720565b60665460405163baeb325b60e01b81526001600160a01b0386811660048301529091169063baeb325b9060240160408051808303816000875af1158015610e15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e399190611f08565b909250905080610e67576040516310c0e38560e21b81526001600160a01b0385166004820152602401610720565b509250929050565b6040516001600160a01b0380851660248301528316604482015260648101829052610eda9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261118e565b50505050565b6001600160a01b03808516600090815260656020908152604080832087851684528252808320815160a0810190925280549094168152600184018054939491939192840191610f2e90611a6b565b80601f0160208091040260200160405190810160405280929190818152602001828054610f5a90611a6b565b8015610fa75780601f10610f7c57610100808354040283529160200191610fa7565b820191906000526020600020905b815481529060010190602001808311610f8a57829003601f168201915b5050509183525050600282015460208201526003820154604082015260049091015460000b60609091015280519091506001600160a01b0381166110115760405163661af8a960e11b81526001600160a01b03808816600483015286166024820152604401610720565b60008260200151905061104a8184604001518760405160200161103691815260200190565b604051602081830303815290604052611263565b9050600080846080015160000b121561108c5761106685611f34565b60405160200161107891815260200190565b6040516020818303038152906040526110a8565b6040805160208101879052016040516020818303038152906040525b90506110b982856060015183611263565b91506110d16001600160a01b038916846000196112e9565b6000836001600160a01b0316836040516110eb9190611f50565b6000604051808303816000865af19150503d8060008114611128576040519150601f19603f3d011682016040523d82523d6000602084013e61112d565b606091505b5050905080611153578383604051630de816ad60e31b8152600401610720929190611f62565b505050505050505050565b6040516001600160a01b0383166024820152604481018290526107ba90849063a9059cbb60e01b90606401610ea3565b60006111e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113789092919063ffffffff16565b90508051600014806112045750808060200190518101906112049190611f86565b6107ba5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610720565b60606112718460008561138f565b82604051602001611283929190611fa1565b60408051601f198184030181529190526112c06112a1856020611fd0565b6112ac866020611fd0565b87516112b89190611fe3565b87919061138f565b6040516020016112d1929190611fa1565b60405160208183030381529060405290509392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261133a848261149c565b610eda576040516001600160a01b03841660248201526000604482015261136e90859063095ea7b360e01b90606401610ea3565b610eda848261118e565b60606113878484600085611545565b949350505050565b60608161139d81601f611fd0565b10156113dc5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610720565b6113e68284611fd0565b8451101561142a5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610720565b6060821580156114495760405191506000825260208201604052611493565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561148257805183526020928301920161146a565b5050858452601f01601f1916604052505b50949350505050565b6000806000846001600160a01b0316846040516114b99190611f50565b6000604051808303816000865af19150503d80600081146114f6576040519150601f19603f3d011682016040523d82523d6000602084013e6114fb565b606091505b50915091508180156115255750805115806115255750808060200190518101906115259190611f86565b801561153a57506001600160a01b0385163b15155b925050505b92915050565b6060824710156115a65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610720565b600080866001600160a01b031685876040516115c29190611f50565b60006040518083038185875af1925050503d80600081146115ff576040519150601f19603f3d011682016040523d82523d6000602084013e611604565b606091505b509150915061161587838387611620565b979650505050505050565b6060831561168f578251600003611688576001600160a01b0385163b6116885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610720565b5081611387565b61138783838151156116a45781518083602001fd5b8060405162461bcd60e51b81526004016107209190611ff6565b5050565b6001600160a01b038116811461098357600080fd5b6000806000606084860312156116ec57600080fd5b83356116f7816116c2565b92506020840135611707816116c2565b929592945050506040919091013590565b60008083601f84011261172a57600080fd5b50813567ffffffffffffffff81111561174257600080fd5b6020830191508360208260051b850101111561175d57600080fd5b9250929050565b6000806000806000806060878903121561177d57600080fd5b863567ffffffffffffffff8082111561179557600080fd5b6117a18a838b01611718565b909850965060208901359150808211156117ba57600080fd5b6117c68a838b01611718565b909650945060408901359150808211156117df57600080fd5b506117ec89828a01611718565b979a9699509497509295939492505050565b60006020828403121561181057600080fd5b813561181b816116c2565b9392505050565b60008060006060848603121561183757600080fd5b8335611842816116c2565b92506020840135611852816116c2565b9150604084013567ffffffffffffffff81111561186e57600080fd5b840160a0818703121561188057600080fd5b809150509250925092565b6000806040838503121561189e57600080fd5b82356118a9816116c2565b946020939093013593505050565b600080604083850312156118ca57600080fd5b82356118d5816116c2565b915060208301356118e5816116c2565b809150509250929050565b60005b8381101561190b5781810151838201526020016118f3565b50506000910152565b6000815180845261192c8160208601602086016118f0565b601f01601f19169290920160200192915050565b6001600160a01b038616815260a06020820181905260009061196490830187611914565b604083019590955250606081019290925260000b60809091015292915050565b60006020828403121561199657600080fd5b5035919050565b600080600080608085870312156119b357600080fd5b84356119be816116c2565b935060208501356119ce816116c2565b93969395505050506040820135916060013590565b6000602082840312156119f557600080fd5b5051919050565b600060208284031215611a0e57600080fd5b815160ff8116811461181b57600080fd5b634e487b7160e01b600052603260045260246000fd5b60008235609e19833603018112611a4b57600080fd5b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680611a7f57607f821691505b602082108103611a9f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156107ba57600081815260208120601f850160051c81016020861015611acc5750805b601f850160051c820191505b81811015611aeb57828155600101611ad8565b505050505050565b67ffffffffffffffff831115611b0b57611b0b611a55565b611b1f83611b198354611a6b565b83611aa5565b6000601f841160018114611b535760008515611b3b5750838201355b600019600387901b1c1916600186901b178355611bad565b600083815260209020601f19861690835b82811015611b845786850135825560209485019460019092019101611b64565b5086821015611ba15760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b8060000b811461098357600080fd5b6000813561153f81611bb4565b8135611bdb816116c2565b81546001600160a01b0319166001600160a01b0391909116178155602082013536839003601e19018112611c0e57600080fd5b8201803567ffffffffffffffff811115611c2757600080fd5b602082019150803603821315611c3c57600080fd5b611c4a818360018601611af3565b505060408201356002820155606082013560038201556116be611c6f60808401611bc3565b6004830160ff198154168260ff1681178255505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8035611cba81611bb4565b919050565b6020815260008235611cd0816116c2565b6001600160a01b031660208381019190915283013536849003601e19018112611cf857600080fd5b830160208101903567ffffffffffffffff811115611d1557600080fd5b803603821315611d2457600080fd5b60a06040850152611d3960c085018284611c86565b9150506040840135606084015260608401356080840152611d5c60808501611caf565b611d6b60a085018260000b9052565b509392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115610e67578160001904821115611daa57611daa611d73565b80851615611db757918102915b93841c9390800290611d8e565b600082611dd35750600161153f565b81611de05750600061153f565b8160018114611df65760028114611e0057611e1c565b600191505061153f565b60ff841115611e1157611e11611d73565b50506001821b61153f565b5060208310610133831016604e8410600b8410161715611e3f575081810a61153f565b611e498383611d89565b8060001904821115611e5d57611e5d611d73565b029392505050565b600061181b60ff841683611dc4565b808202811582820484141761153f5761153f611d73565b600082611ea857634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b80518015158114611cba57600080fd5b60008060408385031215611f1b57600080fd5b82519150611f2b60208401611ef8565b90509250929050565b6000600160ff1b8201611f4957611f49611d73565b5060000390565b60008251611a4b8184602087016118f0565b6001600160a01b038316815260406020820181905260009061138790830184611914565b600060208284031215611f9857600080fd5b61181b82611ef8565b60008351611fb38184602088016118f0565b835190830190611fc78183602088016118f0565b01949350505050565b8082018082111561153f5761153f611d73565b8181038181111561153f5761153f611d73565b60208152600061181b602083018461191456fea2646970667358221220cf84bd423535c21afff0a28fc19da2636586ac6b6ce197539b2f0299c7d8cb6064736f6c63430008130033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063b84ea7731161008c578063e0146c8e11610066578063e0146c8e146101c3578063f0fa55a9146101e7578063f2fde38b146101fa578063fe0291561461020d57600080fd5b8063b84ea7731461018a578063cd6dc6871461019d578063df791e50146101b057600080fd5b8063717c821b116100c8578063717c821b146101285780637adbf9731461013b5780637dc0d1d01461014e5780638da5cb5b1461017957600080fd5b80633e032a3b146100ef5780634aa066521461010b578063715018a61461011e575b600080fd5b6100f860675481565b6040519081526020015b60405180910390f35b6100f86101193660046116d7565b610220565b6101266103ec565b005b610126610136366004611764565b610400565b6101266101493660046117fe565b61059e565b606654610161906001600160a01b031681565b6040516001600160a01b039091168152602001610102565b6033546001600160a01b0316610161565b610126610198366004611822565b6105fb565b6101266101ab36600461188b565b610687565b6100f86101be3660046116d7565b6107bf565b6101d66101d13660046118b7565b6107e4565b604051610102959493929190611940565b6101266101f5366004611984565b6108b5565b6101266102083660046117fe565b61090d565b6100f861021b36600461199d565b610986565b6066546040516341976e0960e01b81526001600160a01b03858116600483015260009283928392909116906341976e0990602401602060405180830381865afa158015610271573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029591906119e3565b6066546040516341976e0960e01b81526001600160a01b038881166004830152909116906341976e0990602401602060405180830381865afa1580156102df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030391906119e3565b915091506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610347573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036b91906119fc565b90506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d191906119fc565b90506103e08685858585610994565b98975050505050505050565b6103f46109de565b6103fe6000610a38565b565b6104086109de565b8460005b818110156105945783838281811061042657610426611a1f565b90506020028101906104389190611a35565b606560008a8a8581811061044e5761044e611a1f565b905060200201602081019061046391906117fe565b6001600160a01b03166001600160a01b03168152602001908152602001600020600088888581811061049757610497611a1f565b90506020020160208101906104ac91906117fe565b6001600160a01b0316815260208101919091526040016000206104cf8282611bd0565b9050508585828181106104e4576104e4611a1f565b90506020020160208101906104f991906117fe565b6001600160a01b031688888381811061051457610514611a1f565b905060200201602081019061052991906117fe565b6001600160a01b03167f5f3b2610bbe37065dec3d702f3bec7a246a869b1fa28b632468981cda5b241a686868581811061056557610565611a1f565b90506020028101906105779190611a35565b6040516105849190611cbf565b60405180910390a360010161040c565b5050505050505050565b6105a66109de565b606680546001600160a01b0319166001600160a01b0383169081179091556040519081527fd3b5d1e0ffaeff528910f3663f0adace7694ab8241d58e17a91351ced2e08031906020015b60405180910390a150565b6106036109de565b6001600160a01b03808416600090815260656020908152604080832093861683529290522081906106348282611bd0565b905050816001600160a01b0316836001600160a01b03167f5f3b2610bbe37065dec3d702f3bec7a246a869b1fa28b632468981cda5b241a68360405161067a9190611cbf565b60405180910390a3505050565b600054610100900460ff16158080156106a75750600054600160ff909116105b806106c15750303b1580156106c1575060005460ff166001145b6107295760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801561074c576000805461ff0019166101001790555b610754610a8a565b606680546001600160a01b0319166001600160a01b038516179055606782905580156107ba576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6000806107cd858585610ab9565b90506107db85858584610bd7565b95945050505050565b6065602090815260009283526040808420909152908252902080546001820180546001600160a01b03909216929161081b90611a6b565b80601f016020809104026020016040519081016040528092919081815260200182805461084790611a6b565b80156108945780601f1061086957610100808354040283529160200191610894565b820191906000526020600020905b81548152906001019060200180831161087757829003601f168201915b50505050600283015460038401546004909401549293909290915060000b85565b6108bd6109de565b670de0b6b3a76400008111156108d85750670de0b6b3a76400005b60678190556040518181527f3facf1379d243c7dca4557da77e575797c040ac0b1bc8ea70d997b452fcf8af3906020016105f0565b6109156109de565b6001600160a01b03811661097a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610720565b61098381610a38565b50565b60006107db85858585610bd7565b60006109a183600a611e65565b6109ab9085611e74565b6109b683600a611e65565b6109c09087611e74565b6109ca9088611e74565b6109d49190611e8b565b9695505050505050565b6033546001600160a01b031633146103fe5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610720565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610ab15760405162461bcd60e51b815260040161072090611ead565b6103fe610cf6565b6000806000610ac88686610d26565b915091506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3091906119fc565b90506000866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9691906119fc565b90506000670de0b6b3a764000060675488610bb19190611e74565b610bbb9190611e8b565b9050610bca8186868686610994565b9998505050505050505050565b6000610bee6001600160a01b038616333086610e6f565b610bfa85858585610ee0565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa158015610c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6291906119e3565b905081811015610c8f576040516371c4efed60e01b81526004810182905260248101839052604401610720565b610ca36001600160a01b038516338361115e565b60408051848152602081018390526001600160a01b03808716929088169133917fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e46062910160405180910390a4949350505050565b600054610100900460ff16610d1d5760405162461bcd60e51b815260040161072090611ead565b6103fe33610a38565b60665460405163baeb325b60e01b81526001600160a01b038481166004830152600092839283929091169063baeb325b9060240160408051808303816000875af1158015610d78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9c9190611f08565b909350905080610dca576040516310c0e38560e21b81526001600160a01b0386166004820152602401610720565b60665460405163baeb325b60e01b81526001600160a01b0386811660048301529091169063baeb325b9060240160408051808303816000875af1158015610e15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e399190611f08565b909250905080610e67576040516310c0e38560e21b81526001600160a01b0385166004820152602401610720565b509250929050565b6040516001600160a01b0380851660248301528316604482015260648101829052610eda9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261118e565b50505050565b6001600160a01b03808516600090815260656020908152604080832087851684528252808320815160a0810190925280549094168152600184018054939491939192840191610f2e90611a6b565b80601f0160208091040260200160405190810160405280929190818152602001828054610f5a90611a6b565b8015610fa75780601f10610f7c57610100808354040283529160200191610fa7565b820191906000526020600020905b815481529060010190602001808311610f8a57829003601f168201915b5050509183525050600282015460208201526003820154604082015260049091015460000b60609091015280519091506001600160a01b0381166110115760405163661af8a960e11b81526001600160a01b03808816600483015286166024820152604401610720565b60008260200151905061104a8184604001518760405160200161103691815260200190565b604051602081830303815290604052611263565b9050600080846080015160000b121561108c5761106685611f34565b60405160200161107891815260200190565b6040516020818303038152906040526110a8565b6040805160208101879052016040516020818303038152906040525b90506110b982856060015183611263565b91506110d16001600160a01b038916846000196112e9565b6000836001600160a01b0316836040516110eb9190611f50565b6000604051808303816000865af19150503d8060008114611128576040519150601f19603f3d011682016040523d82523d6000602084013e61112d565b606091505b5050905080611153578383604051630de816ad60e31b8152600401610720929190611f62565b505050505050505050565b6040516001600160a01b0383166024820152604481018290526107ba90849063a9059cbb60e01b90606401610ea3565b60006111e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113789092919063ffffffff16565b90508051600014806112045750808060200190518101906112049190611f86565b6107ba5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610720565b60606112718460008561138f565b82604051602001611283929190611fa1565b60408051601f198184030181529190526112c06112a1856020611fd0565b6112ac866020611fd0565b87516112b89190611fe3565b87919061138f565b6040516020016112d1929190611fa1565b60405160208183030381529060405290509392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261133a848261149c565b610eda576040516001600160a01b03841660248201526000604482015261136e90859063095ea7b360e01b90606401610ea3565b610eda848261118e565b60606113878484600085611545565b949350505050565b60608161139d81601f611fd0565b10156113dc5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610720565b6113e68284611fd0565b8451101561142a5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610720565b6060821580156114495760405191506000825260208201604052611493565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561148257805183526020928301920161146a565b5050858452601f01601f1916604052505b50949350505050565b6000806000846001600160a01b0316846040516114b99190611f50565b6000604051808303816000865af19150503d80600081146114f6576040519150601f19603f3d011682016040523d82523d6000602084013e6114fb565b606091505b50915091508180156115255750805115806115255750808060200190518101906115259190611f86565b801561153a57506001600160a01b0385163b15155b925050505b92915050565b6060824710156115a65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610720565b600080866001600160a01b031685876040516115c29190611f50565b60006040518083038185875af1925050503d80600081146115ff576040519150601f19603f3d011682016040523d82523d6000602084013e611604565b606091505b509150915061161587838387611620565b979650505050505050565b6060831561168f578251600003611688576001600160a01b0385163b6116885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610720565b5081611387565b61138783838151156116a45781518083602001fd5b8060405162461bcd60e51b81526004016107209190611ff6565b5050565b6001600160a01b038116811461098357600080fd5b6000806000606084860312156116ec57600080fd5b83356116f7816116c2565b92506020840135611707816116c2565b929592945050506040919091013590565b60008083601f84011261172a57600080fd5b50813567ffffffffffffffff81111561174257600080fd5b6020830191508360208260051b850101111561175d57600080fd5b9250929050565b6000806000806000806060878903121561177d57600080fd5b863567ffffffffffffffff8082111561179557600080fd5b6117a18a838b01611718565b909850965060208901359150808211156117ba57600080fd5b6117c68a838b01611718565b909650945060408901359150808211156117df57600080fd5b506117ec89828a01611718565b979a9699509497509295939492505050565b60006020828403121561181057600080fd5b813561181b816116c2565b9392505050565b60008060006060848603121561183757600080fd5b8335611842816116c2565b92506020840135611852816116c2565b9150604084013567ffffffffffffffff81111561186e57600080fd5b840160a0818703121561188057600080fd5b809150509250925092565b6000806040838503121561189e57600080fd5b82356118a9816116c2565b946020939093013593505050565b600080604083850312156118ca57600080fd5b82356118d5816116c2565b915060208301356118e5816116c2565b809150509250929050565b60005b8381101561190b5781810151838201526020016118f3565b50506000910152565b6000815180845261192c8160208601602086016118f0565b601f01601f19169290920160200192915050565b6001600160a01b038616815260a06020820181905260009061196490830187611914565b604083019590955250606081019290925260000b60809091015292915050565b60006020828403121561199657600080fd5b5035919050565b600080600080608085870312156119b357600080fd5b84356119be816116c2565b935060208501356119ce816116c2565b93969395505050506040820135916060013590565b6000602082840312156119f557600080fd5b5051919050565b600060208284031215611a0e57600080fd5b815160ff8116811461181b57600080fd5b634e487b7160e01b600052603260045260246000fd5b60008235609e19833603018112611a4b57600080fd5b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680611a7f57607f821691505b602082108103611a9f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156107ba57600081815260208120601f850160051c81016020861015611acc5750805b601f850160051c820191505b81811015611aeb57828155600101611ad8565b505050505050565b67ffffffffffffffff831115611b0b57611b0b611a55565b611b1f83611b198354611a6b565b83611aa5565b6000601f841160018114611b535760008515611b3b5750838201355b600019600387901b1c1916600186901b178355611bad565b600083815260209020601f19861690835b82811015611b845786850135825560209485019460019092019101611b64565b5086821015611ba15760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b8060000b811461098357600080fd5b6000813561153f81611bb4565b8135611bdb816116c2565b81546001600160a01b0319166001600160a01b0391909116178155602082013536839003601e19018112611c0e57600080fd5b8201803567ffffffffffffffff811115611c2757600080fd5b602082019150803603821315611c3c57600080fd5b611c4a818360018601611af3565b505060408201356002820155606082013560038201556116be611c6f60808401611bc3565b6004830160ff198154168260ff1681178255505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8035611cba81611bb4565b919050565b6020815260008235611cd0816116c2565b6001600160a01b031660208381019190915283013536849003601e19018112611cf857600080fd5b830160208101903567ffffffffffffffff811115611d1557600080fd5b803603821315611d2457600080fd5b60a06040850152611d3960c085018284611c86565b9150506040840135606084015260608401356080840152611d5c60808501611caf565b611d6b60a085018260000b9052565b509392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115610e67578160001904821115611daa57611daa611d73565b80851615611db757918102915b93841c9390800290611d8e565b600082611dd35750600161153f565b81611de05750600061153f565b8160018114611df65760028114611e0057611e1c565b600191505061153f565b60ff841115611e1157611e11611d73565b50506001821b61153f565b5060208310610133831016604e8410600b8410161715611e3f575081810a61153f565b611e498383611d89565b8060001904821115611e5d57611e5d611d73565b029392505050565b600061181b60ff841683611dc4565b808202811582820484141761153f5761153f611d73565b600082611ea857634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b80518015158114611cba57600080fd5b60008060408385031215611f1b57600080fd5b82519150611f2b60208401611ef8565b90509250929050565b6000600160ff1b8201611f4957611f49611d73565b5060000390565b60008251611a4b8184602087016118f0565b6001600160a01b038316815260406020820181905260009061138790830184611914565b600060208284031215611f9857600080fd5b61181b82611ef8565b60008351611fb38184602088016118f0565b835190830190611fc78183602088016118f0565b01949350505050565b8082018082111561153f5761153f611d73565b8181038181111561153f5761153f611d73565b60208152600061181b602083018461191456fea2646970667358221220cf84bd423535c21afff0a28fc19da2636586ac6b6ce197539b2f0299c7d8cb6064736f6c63430008130033

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.