POL Price: $0.374905 (+0.99%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Zap Bond609772942024-08-24 10:03:3716 days ago1724493817IN
0x13314157...c2189c1A7
0 POL0.0249990630.00000004
Zap Bond609730752024-08-24 7:34:1316 days ago1724484853IN
0x13314157...c2189c1A7
0 POL0.0250012230.00000003
Zap Bond609703532024-08-24 5:56:1316 days ago1724478973IN
0x13314157...c2189c1A7
75 POL0.028726330.24999999
Zap Bond609625352024-08-24 1:10:3816 days ago1724461838IN
0x13314157...c2189c1A7
0 POL0.0251437830.00000002
Zap Bond609471812024-08-23 15:58:1616 days ago1724428696IN
0x13314157...c2189c1A7
0 POL0.0259249830.93208777
Zap Bond609402262024-08-23 11:51:4317 days ago1724413903IN
0x13314157...c2189c1A7
0.1 POL0.0325617930.00000029
Zap Bond609281012024-08-23 4:40:5417 days ago1724388054IN
0x13314157...c2189c1A7
0 POL0.025000530.00000002
Zap Bond609268412024-08-23 3:56:1617 days ago1724385376IN
0x13314157...c2189c1A7
0 POL0.0250012230.00000013
Zap Bond609180282024-08-22 22:43:5917 days ago1724366639IN
0x13314157...c2189c1A7
850 POL0.0280699230.00000002
Zap Bond609052672024-08-22 15:07:2317 days ago1724339243IN
0x13314157...c2189c1A7
0 POL0.0251451830.00038228
Zap Bond609041282024-08-22 14:27:0217 days ago1724336822IN
0x13314157...c2189c1A7
0 POL0.040150850
Zap Bond608876622024-08-22 4:43:0418 days ago1724301784IN
0x13314157...c2189c1A7
0 POL0.040150250
Zap Bond608798112024-08-22 0:03:5718 days ago1724285037IN
0x13314157...c2189c1A7
0 POL0.040150850
Zap Bond608646052024-08-21 14:59:4418 days ago1724252384IN
0x13314157...c2189c1A7
0 POL0.0375610140.58697976
Zap Bond608543962024-08-21 8:56:5419 days ago1724230614IN
0x13314157...c2189c1A7
5 POL0.0287693730.00000003
Zap Bond608430172024-08-21 2:09:0619 days ago1724206146IN
0x13314157...c2189c1A7
0 POL0.040150250
Zap Bond608375312024-08-20 22:52:0419 days ago1724194324IN
0x13314157...c2189c1A7
0 POL0.0242719530.00000003
Zap Bond608326452024-08-20 19:58:5919 days ago1724183939IN
0x13314157...c2189c1A7
216 POL0.0270660630.00000002
Zap Bond608241802024-08-20 14:53:0519 days ago1724165585IN
0x13314157...c2189c1A7
0 POL0.024998730.00000367
Zap Bond608236972024-08-20 14:35:5919 days ago1724164559IN
0x13314157...c2189c1A7
0 POL0.0249150630.0000021
Zap Bond608172062024-08-20 10:45:1120 days ago1724150711IN
0x13314157...c2189c1A7
0 POL0.040150850
Zap Bond608099062024-08-20 6:25:3220 days ago1724135132IN
0x13314157...c2189c1A7
0 POL0.0251437830.00000003
Zap Bond608038252024-08-20 2:46:4820 days ago1724122008IN
0x13314157...c2189c1A7
0 POL0.0249898531.12000002
Zap Bond607982552024-08-19 23:25:1320 days ago1724109913IN
0x13314157...c2189c1A7
0 POL0.024949731.07000002
Zap Bond607911272024-08-19 19:05:0320 days ago1724094303IN
0x13314157...c2189c1A7
0 POL0.0249143430.00000002
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
609703532024-08-24 5:56:1316 days ago1724478973
0x13314157...c2189c1A7
75 POL
609402262024-08-23 11:51:4317 days ago1724413903
0x13314157...c2189c1A7
0.1 POL
609180282024-08-22 22:43:5917 days ago1724366639
0x13314157...c2189c1A7
850 POL
608543962024-08-21 8:56:5419 days ago1724230614
0x13314157...c2189c1A7
5 POL
608326452024-08-20 19:58:5919 days ago1724183939
0x13314157...c2189c1A7
216 POL
607891472024-08-19 17:49:3920 days ago1724089779
0x13314157...c2189c1A7
197 POL
607832752024-08-19 14:17:1320 days ago1724077033
0x13314157...c2189c1A7
330 POL
607125312024-08-17 20:14:1822 days ago1723925658
0x13314157...c2189c1A7
543 POL
606850562024-08-17 3:51:2523 days ago1723866685
0x13314157...c2189c1A7
1,500 POL
605843032024-08-14 15:30:2925 days ago1723649429
0x13314157...c2189c1A7
694.6 POL
605806672024-08-14 13:21:3325 days ago1723641693
0x13314157...c2189c1A7
687 POL
605675852024-08-14 5:32:3126 days ago1723613551
0x13314157...c2189c1A7
1,069 POL
605508382024-08-13 19:13:5026 days ago1723576430
0x13314157...c2189c1A7
12 POL
604997502024-08-12 12:40:2527 days ago1723466425
0x13314157...c2189c1A7
12.3 POL
604997372024-08-12 12:39:5727 days ago1723466397
0x13314157...c2189c1A7
11.7 POL
604997122024-08-12 12:39:0527 days ago1723466345
0x13314157...c2189c1A7
11.7 POL
604996912024-08-12 12:38:1927 days ago1723466299
0x13314157...c2189c1A7
11.68 POL
604996682024-08-12 12:37:3127 days ago1723466251
0x13314157...c2189c1A7
11.68 POL
604996432024-08-12 12:36:3727 days ago1723466197
0x13314157...c2189c1A7
11.69 POL
604996222024-08-12 12:35:5327 days ago1723466153
0x13314157...c2189c1A7
11.68 POL
604995982024-08-12 12:35:0127 days ago1723466101
0x13314157...c2189c1A7
11.67 POL
604995702024-08-12 12:34:0327 days ago1723466043
0x13314157...c2189c1A7
11.67 POL
604994902024-08-12 12:31:1328 days ago1723465873
0x13314157...c2189c1A7
12 POL
604991792024-08-12 12:20:1028 days ago1723465210
0x13314157...c2189c1A7
12 POL
604991212024-08-12 12:18:0828 days ago1723465088
0x13314157...c2189c1A7
12 POL
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SoulZap_UniV2_Extended_V1

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 38 : SoulZap_UniV2_Extended_V1.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

// External package imports
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";

// Internal route directory imports
import {IWETH} from "../lib/IWETH.sol";
import {ISoulFeeManager} from "../fee-manager/ISoulFeeManager.sol";
import {SoulZap_UniV2} from "../SoulZap_UniV2.sol";
import {SoulZap_Ext_ApeBond} from "../extensions/ApeBond/SoulZap_Ext_ApeBond.sol";

/**
 * @title SoulZap_UniV2_Extended_V1
 * @dev This contract is an implementation of ISoulZap interface. It includes functionalities for zapping into
 * UniswapV2 type liquidity pools.
 * @notice This contract has the following features:
 * 1. UniswapV2 Zap In
 * 2. Deposit into ApeBond, Bond contracts.
 * @author Soul Solidity - Contact for mainnet licensing until 730 days after first deployment transaction with matching bytecode.
 * Otherwise feel free to experiment locally or on testnets.
 */
contract SoulZap_UniV2_Extended_V1 is SoulZap_UniV2, SoulZap_Ext_ApeBond {
    constructor(
        address _accessRegistry,
        IWETH _wnative,
        ISoulFeeManager _soulFeeManager,
        /// @dev Set to zero to start epoch tracking immediately
        uint256 _epochStartTime
    ) SoulZap_UniV2(_accessRegistry, _wnative, _soulFeeManager, _epochStartTime) SoulZap_Ext_ApeBond() {}
}

File 2 of 38 : 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 3 of 38 : 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 4 of 38 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

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

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

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

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

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

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

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

File 7 of 38 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

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

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

File 9 of 38 : IERC20Permit.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 IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 10 of 38 : IERC20.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 IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

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

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

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

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

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

File 11 of 38 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.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(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @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(IERC20 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(IERC20 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(IERC20 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(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        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(IERC20 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))) && Address.isContract(address(token));
    }
}

File 12 of 38 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 13 of 38 : Address.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 Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * 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 14 of 38 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 15 of 38 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 16 of 38 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 17 of 38 : IUniswapV2Factory.sol
pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 18 of 38 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 19 of 38 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 20 of 38 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 21 of 38 : ISoulAccessManaged.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

interface ISoulAccessManaged {
    function soulAccessRegistry() external view returns (address soulAccessRegistry);
}

File 22 of 38 : SoulAccessManaged.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.19;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ISoulAccessManaged} from "./ISoulAccessManaged.sol";

contract SoulAccessManaged is ISoulAccessManaged {
    address public soulAccessRegistry;

    error SoulAccessUnauthorized();

    constructor(address _accessRegistryAddress) {
        soulAccessRegistry = _accessRegistryAddress;
    }

    /**
     * @dev Modifier to make a function callable only by accounts with a specific role in the SoulAccessRegistry.
     * @param roleName The name of the role to check.
     * Reverts with a SoulAccessUnauthorizedAccount error if the calling account does not have the role.
     */
    modifier onlyAccessRegistryRoleName(string memory roleName) {
        if (!_hasAccessRegistryRole(_getRoleHash(roleName), msg.sender)) {
            revert SoulAccessUnauthorized();
        }
        _;
    }

    /**
     * @dev Modifier to make a function callable only by accounts with a specific role in the SoulAccessRegistry.
     * @param role The hash of the role to check.
     * Reverts with a SoulAccessUnauthorizedAccount error if the calling account does not have the role.
     */
    modifier onlyAccessRegistryRole(bytes32 role) {
        if (!_hasAccessRegistryRole(role, msg.sender)) {
            revert SoulAccessUnauthorized();
        }
        _;
    }

    /**
     * @dev Generates a hash for a role name to be used within the SoulAccessRegistry.
     * @param role The name of the role.
     * @return bytes32 The hash of the role name.
     */
    function _getRoleHash(string memory role) internal pure returns (bytes32) {
        return keccak256(bytes(role));
    }

    /**
     * @dev Checks if an account has a specific role in the SoulAccessRegistry.
     * @param role The hash of the role to check.
     * @param account The address of the account to check.
     * @return bool True if the account has the role, false otherwise.
     */
    function _hasAccessRegistryRole(bytes32 role, address account) private view returns (bool) {
        return IAccessControl(soulAccessRegistry).hasRole(role, account);
    }
}

File 23 of 38 : ICustomBillRefillable.sol
// SPDX-License-Identifier: UNLICENSED
// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.8.0. SEE SOURCE BELOW. !!
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

interface ICustomBillRefillable {
    event BillClaimed(uint256 indexed billId, address indexed recipient, uint256 payout, uint256 remaining);
    event BillCreated(uint256 deposit, uint256 payout, uint256 expires, uint256 indexed billId);
    event BillInitialized(ICustomBill.BillTerms billTerms, uint256 lastDecay);
    event BillPriceChanged(uint256 internalPrice, uint256 debtRatio);
    event BillRefilled(address payoutToken, uint256 amountAdded);
    event ControlVariableAdjustment(uint256 initialBCV, uint256 newBCV, uint256 adjustment);
    event FeeToChanged(address indexed newFeeTo);
    event Initialized(uint8 version);
    event MaxTotalPayoutChanged(uint256 newMaxTotalPayout);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
    event SetAdjustment(uint256 currentBCV, uint256 increment, uint256 targetBCV, uint256 buffer);
    event SetFees(uint256[] fees, uint256[] tierCeilings);
    event SetPendingOwner(address indexed pendingOwner);
    event TermsSet(uint8 parameter, uint256 input);
    event UpdateClaimApproval(address indexed owner, address indexed approvedAccount, bool approved);

    function DAO() external view returns (address);

    function DEFAULT_ADMIN_ROLE() external view returns (bytes32);

    function MAX_FEE() external view returns (uint256);

    function REFILL_ROLE() external view returns (bytes32);

    function acceptOwnership() external;

    function adjustment()
        external
        view
        returns (uint256 rate, uint256 target, uint256 buffer, uint256 lastAdjustmentTimestamp);

    function allIssuedBillIds() external view returns (uint256[] memory);

    function batchClaim(uint256[] memory _billIds) external returns (uint256 payout);

    function batchRedeem(uint256[] memory _billIds) external returns (uint256 payout);

    function billInfo(
        uint256
    )
        external
        view
        returns (
            uint256 payout,
            uint256 payoutClaimed,
            uint256 vesting,
            uint256 vestingTerm,
            uint256 vestingStartTimestamp,
            uint256 lastClaimTimestamp,
            uint256 truePricePaid
        );

    function billNft() external view returns (address);

    function billPrice() external view returns (uint256 price_);

    function changeFeeTo(address _feeTo) external;

    function claim(uint256 _billId) external returns (uint256);

    function claimablePayout(uint256 _billId) external view returns (uint256 claimablePayout_);

    function currentDebt() external view returns (uint256);

    function currentFee() external view returns (uint256 currentFee_);

    function customTreasury() external view returns (address);

    function debtDecay() external view returns (uint256 decay_);

    function debtRatio() external view returns (uint256 debtRatio_);

    function deposit(uint256 _amount, uint256 _maxPrice, address _depositor) external returns (uint256);

    function feeInPayout() external view returns (bool);

    function feeTiers(uint256) external view returns (uint256 tierCeilings, uint256 fees);

    function feeTo() external view returns (address);

    function getBillIds(address user) external view returns (uint256[] memory);

    function getBillIdsInRange(address user, uint256 start, uint256 end) external view returns (uint256[] memory);

    function getBillInfo(uint256 billId) external view returns (ICustomBill.Bill memory);

    function getFeeTierLength() external view returns (uint256 tierLength_);

    function getMaxTotalPayout() external view returns (uint256);

    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    function getRoleMemberCount(bytes32 role) external view returns (uint256);

    function grantRefillRole(address[] memory _billRefillers) external;

    function grantRole(bytes32 role, address account) external;

    function hasRole(bytes32 role, address account) external view returns (bool);

    function initialize(
        address _customTreasury,
        ICustomBill.BillCreationDetails memory _billCreationDetails,
        ICustomBill.BillTerms memory _billTerms,
        ICustomBill.BillAccounts memory _billAccounts,
        address[] memory _billRefillers
    ) external;

    function initialize(
        address _customTreasury,
        ICustomBill.BillCreationDetails memory _billCreationDetails,
        ICustomBill.BillTerms memory _billTerms,
        ICustomBill.BillAccounts memory _billAccounts
    ) external;

    function lastDecay() external view returns (uint256);

    function maxPayout() external view returns (uint256);

    function owner() external view returns (address);

    function payoutFor(uint256 _amount) external view returns (uint256 _payout, uint256 _fee);

    function payoutToken() external view returns (address);

    function pendingOwner() external view returns (address);

    function pendingPayout(uint256 _billId) external view returns (uint256 pendingPayout_);

    function pendingVesting(uint256 _billId) external view returns (uint256 pendingVesting_);

    function principalToken() external view returns (address);

    function redeem(uint256 _billId) external returns (uint256);

    function redeemerApproved(address, address) external view returns (bool);

    function refillPayoutToken(uint256 _refillAmount) external;

    function renounceOwnership() external;

    function renounceRole(bytes32 role, address account) external;

    function revokeRefillRole(address[] memory _billRefillers) external;

    function revokeRole(bytes32 role, address account) external;

    function setAdjustment(uint256 _rate, uint256 _target, uint256 _buffer) external;

    function setBillTerms(uint8 _parameter, uint256 _input) external;

    function setClaimApproval(address approvedAccount, bool approved) external;

    function setFeeTiers(uint256[] memory fees, uint256[] memory tierCeilings) external;

    function setMaxTotalPayout(uint256 _maxTotalPayout) external;

    function setPendingOwner(address newPendingOwner) external;

    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    function terms()
        external
        view
        returns (
            uint256 controlVariable,
            uint256 vestingTerm,
            uint256 minimumPrice,
            uint256 maxPayout,
            uint256 maxDebt,
            uint256 maxTotalPayout,
            uint256 initialDebt
        );

    function totalDebt() external view returns (uint256);

    function totalPayoutGiven() external view returns (uint256);

    function totalPrincipalBilled() external view returns (uint256);

    function transferOwnership(address) external view;

    function trueBillPrice() external view returns (uint256 price_);

    function userBillIds() external view returns (uint256[] memory);

    function vestedPayoutAtTime(uint256 _billId, uint256 _timestamp) external view returns (uint256 vestedPayout_);

    function vestingCurve() external view returns (address);

    function vestingPayout(uint256 _billId) external view returns (uint256 vestingPayout_);

    function vestingPeriod(uint256 _billId) external view returns (uint256 vestingStart_, uint256 vestingEnd_);
}

interface ICustomBill {
    struct BillTerms {
        uint256 controlVariable;
        uint256 vestingTerm;
        uint256 minimumPrice;
        uint256 maxPayout;
        uint256 maxDebt;
        uint256 maxTotalPayout;
        uint256 initialDebt;
    }

    struct Bill {
        uint256 payout;
        uint256 payoutClaimed;
        uint256 vesting;
        uint256 vestingTerm;
        uint256 vestingStartTimestamp;
        uint256 lastClaimTimestamp;
        uint256 truePricePaid;
    }

    struct BillCreationDetails {
        address payoutToken;
        address principalToken;
        address initialOwner;
        address vestingCurve;
        uint256[] tierCeilings;
        uint256[] fees;
        bool feeInPayout;
    }

    struct BillAccounts {
        address feeTo;
        address DAO;
        address billNft;
    }
}

File 24 of 38 : SoulZap_Ext_ApeBond.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

/// -----------------------------------------------------------------------
/// Package Imports (alphabetical)
/// -----------------------------------------------------------------------
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// -----------------------------------------------------------------------
/// Local Imports (alphabetical)
/// -----------------------------------------------------------------------
import {Constants} from "../../utils/Constants.sol";
import {ICustomBillRefillable} from "./lib/ICustomBillRefillable.sol";
import {ISoulFeeManager} from "../../fee-manager/ISoulFeeManager.sol";
import {SoulZap_Ext_BondNftWhitelist} from "./SoulZap_Ext_BondNftWhitelist.sol";
import {SoulZap_UniV2} from "../../SoulZap_UniV2.sol";

/**
 * @title SoulZap_Ext_ApeBond
 * @dev This contract extends the SoulZap_UniV2 contract with additional functionality for ApeBond.
 * @author Soul Solidity - Contact for mainnet licensing until 730 days after first deployment transaction with matching bytecode.
 * Otherwise feel free to experiment locally or on testnets.
 * @notice Do not use this contract for any tokens that do not have a standard ERC20 implementation.
 */
abstract contract SoulZap_Ext_ApeBond is SoulZap_Ext_BondNftWhitelist, SoulZap_UniV2 {
    using SafeERC20 for IERC20;

    /// -----------------------------------------------------------------------
    /// Events
    /// -----------------------------------------------------------------------

    event ZapBond(ZapParams zapParams, ICustomBillRefillable bond, uint256 maxPrice);

    /// -----------------------------------------------------------------------
    /// External Functions
    /// -----------------------------------------------------------------------

    /// @notice Zap single token to ApeBond
    /// @param zapParams ISoulZap.ZapParams
    /// @param bond Treasury bond address
    /// @param maxPrice Max price of treasury bond
    function zapBond(
        ZapParams memory zapParams,
        SwapPath memory feeSwapPath,
        ICustomBillRefillable bond,
        uint256 maxPrice
    ) external payable nonReentrant whenNotPaused verifyMsgValueAndWrap(zapParams.tokenIn, zapParams.amountIn) {
        if (address(zapParams.tokenIn) == address(Constants.NATIVE_ADDRESS)) {
            _zapBond(zapParams, feeSwapPath, bond, maxPrice);
        } else {
            uint256 balanceBefore = _getBalance(zapParams.tokenIn);
            zapParams.tokenIn.safeTransferFrom(msg.sender, address(this), zapParams.amountIn);
            zapParams.amountIn = _getBalance(zapParams.tokenIn) - balanceBefore;
            _zapBond(zapParams, feeSwapPath, bond, maxPrice);
        }
    }

    /// -----------------------------------------------------------------------
    /// Private Functions
    /// -----------------------------------------------------------------------

    function _zapBond(
        ZapParams memory zapParams,
        SwapPath memory feeSwapPath,
        ICustomBillRefillable bond,
        uint256 maxPrice
    ) private {
        // Verify inputs
        require(zapParams.amountIn > 0, "SoulZap: amountIn must be > 0");
        require(zapParams.to != address(0), "SoulZap: Can't zap to null address");
        require(zapParams.liquidityPath.lpRouter != address(0), "SoulZap: lp router can not be address(0)");
        require(zapParams.token0 != address(0), "SoulZap: token0 can not be address(0)");
        require(zapParams.token1 != address(0), "SoulZap: token1 can not be address(0)");

        IUniswapV2Pair bondPrincipalToken = IUniswapV2Pair(bond.principalToken());
        bool skipFee = isBondNftWhitelisted(bond);

        //Check if bond principal token is single token or lp
        bool isSingleTokenBond = true;
        try IUniswapV2Pair(bondPrincipalToken).token0() returns (address /*_token0*/) {
            isSingleTokenBond = false;
        } catch (bytes memory) {}

        address to;
        if (isSingleTokenBond) {
            SwapParams memory swapParams = SwapParams({
                tokenIn: zapParams.tokenIn,
                amountIn: zapParams.amountIn,
                tokenOut: zapParams.token0,
                path: zapParams.path0,
                to: zapParams.to,
                deadline: zapParams.deadline
            });
            require(swapParams.tokenOut == address(bondPrincipalToken), "ApeBond: Wrong token for Bond");
            to = swapParams.to;
            swapParams.to = address(this);
            _swap(swapParams, feeSwapPath, !skipFee);
        } else {
            require(
                (zapParams.token0 == bondPrincipalToken.token0() && zapParams.token1 == bondPrincipalToken.token1()) ||
                    (zapParams.token1 == bondPrincipalToken.token0() &&
                        zapParams.token0 == bondPrincipalToken.token1()),
                "ApeBond: Wrong LP bondPrincipalToken for Bond"
            );
            to = zapParams.to;
            zapParams.to = address(this);
            _zap(zapParams, feeSwapPath, !skipFee);
        }

        uint256 balance = bondPrincipalToken.balanceOf(address(this));
        IERC20(address(bondPrincipalToken)).forceApprove(address(bond), balance);
        bond.deposit(balance, maxPrice, to);
        IERC20(address(bondPrincipalToken)).forceApprove(address(bond), 0);

        emit ZapBond(zapParams, bond, maxPrice);
    }
}

File 25 of 38 : SoulZap_Ext_BondNftWhitelist.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

/// -----------------------------------------------------------------------
/// Package Imports (alphabetical)
/// -----------------------------------------------------------------------
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/// -----------------------------------------------------------------------
/// Local Imports (alphabetical)
/// -----------------------------------------------------------------------
import {ICustomBillRefillable} from "./lib/ICustomBillRefillable.sol";
import {SoulAccessManaged} from "../../access/SoulAccessManaged.sol";

/// @title SoulZap_Ext_BondNftWhitelist
/// @notice This contract extension requires specific role setup to manage the whitelist of Bond NFTs.
/// The roles are managed through the SoulAccessManaged contract and are critical for the
/// security and proper administration of the whitelist functionality.
abstract contract SoulZap_Ext_BondNftWhitelist is SoulAccessManaged {
    using EnumerableSet for EnumerableSet.AddressSet;

    EnumerableSet.AddressSet private _whitelistedBondNfts;

    event BondNftWhitelisted(address indexed bondNft, bool whitelisted);

    /// @notice Add or remove a bondNft from the whitelist
    /// @param _bondNft The address of the bondNft to be added or removed
    /// @param _isWhitelisted True to add the bondNft to the whitelist, false to remove it
    function setBondNftWhitelist(
        address _bondNft,
        bool _isWhitelisted
    ) external onlyAccessRegistryRoleName("SOUL_ZAP_ADMIN_ROLE") {
        if (_isWhitelisted) {
            require(_whitelistedBondNfts.add(_bondNft), "BondNft already whitelisted");
            emit BondNftWhitelisted(_bondNft, true);
        } else {
            require(_whitelistedBondNfts.remove(_bondNft), "BondNft not whitelisted");
            emit BondNftWhitelisted(_bondNft, false);
        }
    }

    /// @notice Check if a bondNft is whitelisted
    /// @param _bond The bondNft to check
    /// @return True if the bondNft is whitelisted, false otherwise
    function isBondNftWhitelisted(ICustomBillRefillable _bond) public view returns (bool) {
        return _whitelistedBondNfts.contains(_bond.billNft());
    }

    /// @notice Get the count of whitelisted bondNfts
    /// @return The number of whitelisted bondNfts
    function getWhitelistedBondNftCount() public view returns (uint256) {
        return _whitelistedBondNfts.length();
    }

    /// @notice Get a whitelisted bondNft by index
    /// @param _index The index of the whitelisted bondNft
    /// @return The address of the whitelisted bondNft at the given index
    function getWhitelistedBondNftAtIndex(uint256 _index) public view returns (address) {
        require(_index < _whitelistedBondNfts.length(), "Index out of bounds");
        return _whitelistedBondNfts.at(_index);
    }
}

File 26 of 38 : ISoulFeeManager.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

/**
 * @title SoulFeeManager_Interface
 * @dev This contract is an interface for the SoulFeeManager. It includes a function for getting the fee based on epoch volume.
 * @author Soul Solidity - Contact for mainnet licensing until 730 days after first deployment transaction with matching bytecode.
 * Otherwise feel free to experiment locally or on testnets.
 */
interface ISoulFeeManager {
    function isSoulFeeManager() external view returns (bool);

    function FEE_DENOMINATOR() external view returns (uint256 denominator);

    function getFeeInfo(
        uint256 _volume
    )
        external
        view
        returns (
            address[] memory feeTokens,
            uint256 currentFeePercentage,
            uint256 feeDenominator,
            address feeCollector
        );

    function getFee(uint256 epochVolume) external view returns (uint256 fee);

    function getFeeCollector() external view returns (address fee);

    function getFeeTokensLength() external view returns (uint256 length);

    function getFeeTokens() external view returns (address[] memory tokens);

    function getFeeToken(uint256 index) external view returns (address token);

    function isFeeToken(address _token) external view returns (bool valid);
}

File 27 of 38 : ISoulZap_UniV2.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ISoulAccessManaged} from "./access/ISoulAccessManaged.sol";
import {ISoulFeeManager} from "./fee-manager/ISoulFeeManager.sol";
import {ITransferHelper} from "./utils/ITransferHelper.sol";
import {IEpochVolumeTracker} from "./utils/IEpochVolumeTracker.sol";

interface ISoulZap_UniV2 is ISoulAccessManaged, ITransferHelper, IEpochVolumeTracker {
    /// -----------------------------------------------------------------------
    /// Swap Path
    /// -----------------------------------------------------------------------

    enum SwapType {
        V2
    }

    struct SwapPath {
        address swapRouter;
        SwapType swapType;
        address[] path;
        uint256 amountOut;
        uint256 amountOutMin;
    }

    //// -----------------------------------------------------------------------
    /// Liquidity Path
    /// -----------------------------------------------------------------------

    enum LPType {
        V2
    }

    struct LiquidityPath {
        address lpRouter;
        LPType lpType;
        uint256 amountAMin;
        uint256 amountBMin;
        uint256 lpAmount;
    }

    /// -----------------------------------------------------------------------
    /// Swap Params
    /// -----------------------------------------------------------------------

    struct SwapParams {
        IERC20 tokenIn;
        uint256 amountIn;
        address tokenOut;
        SwapPath path;
        address to;
        uint256 deadline;
    }

    /// -----------------------------------------------------------------------
    /// Zap Params
    /// -----------------------------------------------------------------------

    struct ZapParams {
        IERC20 tokenIn;
        uint256 amountIn;
        address token0;
        address token1;
        SwapPath path0;
        SwapPath path1;
        LiquidityPath liquidityPath;
        address to;
        uint256 deadline;
    }

    /// -----------------------------------------------------------------------
    /// Storage Variables
    /// -----------------------------------------------------------------------

    function soulFeeManager() external view returns (ISoulFeeManager);

    /// -----------------------------------------------------------------------
    /// Functions
    /// -----------------------------------------------------------------------

    function swap(SwapParams memory swapParams, SwapPath memory feeSwapPath) external payable;

    function zap(ZapParams memory zapParams, SwapPath memory feeSwapPath) external payable;

    /// -----------------------------------------------------------------------
    /// Fee Management
    /// -----------------------------------------------------------------------

    function isFeeToken(address _token) external view returns (bool valid);

    function getFeeInfo()
        external
        view
        returns (
            address[] memory feeTokens,
            uint256 currentFeePercentage,
            uint256 feeDenominator,
            address feeCollector
        );
}

File 28 of 38 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

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

interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256) external;
}

File 29 of 38 : SoulZap_UniV2_Whitelist.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

/// -----------------------------------------------------------------------
/// Package Imports
/// -----------------------------------------------------------------------
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/// -----------------------------------------------------------------------
/// Local Imports
/// -----------------------------------------------------------------------
import {SoulAccessManaged} from "./access/SoulAccessManaged.sol";

/// @title SoulZap_UniV2_Whitelist
/// @notice This contract extension requires specific role setup to manage the whitelist of Bond NFTs.
/// The roles are managed through the SoulAccessManaged contract and are critical for the
/// security and proper administration of the whitelist functionality.
abstract contract SoulZap_UniV2_Whitelist is SoulAccessManaged {
    using EnumerableSet for EnumerableSet.AddressSet;

    EnumerableSet.AddressSet private _whitelistedRouters;

    event RouterWhitelisted(address indexed router, bool whitelisted);

    /// @notice Add or remove a router from the whitelist
    /// @dev This function allows adding or removing a router from the whitelist.
    /// @param _router The address of the router to be added or removed
    /// @param _isWhitelisted True to add the router to the whitelist, false to remove it
    function setRouterWhitelist(
        address _router,
        bool _isWhitelisted
    ) external onlyAccessRegistryRoleName("SOUL_ZAP_ADMIN_ROLE") {
        if (_isWhitelisted) {
            require(_whitelistedRouters.add(_router), "Router already whitelisted");
            emit RouterWhitelisted(_router, true);
        } else {
            require(_whitelistedRouters.remove(_router), "Router not whitelisted");
            emit RouterWhitelisted(_router, false);
        }
    }

    /// @notice Check if a router is whitelisted
    /// @dev This function checks if a router is whitelisted.
    /// @param _router The address of the router to check
    /// @return true if the router is whitelisted, false otherwise
    function isRouterWhitelisted(address _router) public view returns (bool) {
        return _whitelistedRouters.contains(_router);
    }

    /// @notice Get the count of whitelisted routers
    /// @dev This function returns the count of whitelisted routers.
    /// @return the count of whitelisted routers
    function getWhitelistedRouterCount() public view returns (uint256) {
        return _whitelistedRouters.length();
    }

    /// @notice Get the whitelisted router at a specific index
    /// @dev This function returns the whitelisted router at the specified index.
    /// @param _index The index of the whitelisted router to retrieve
    /// @return the address of the whitelisted router at the specified index
    function getWhitelistedRouterAtIndex(uint256 _index) public view returns (address) {
        require(_index < _whitelistedRouters.length(), "Index out of bounds");
        return _whitelistedRouters.at(_index);
    }
}

File 30 of 38 : SoulZap_UniV2.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

/// -----------------------------------------------------------------------
/// Package Imports (alphabetical)
/// -----------------------------------------------------------------------

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// -----------------------------------------------------------------------
/// Internal Imports (alphabetical)
/// -----------------------------------------------------------------------
import {Constants} from "./utils/Constants.sol";
import {IWETH} from "./lib/IWETH.sol";
import {EpochVolumeTracker} from "./utils/EpochVolumeTracker.sol";
import {ISoulFeeManager} from "./fee-manager/ISoulFeeManager.sol";
import {ISoulZap_UniV2} from "./ISoulZap_UniV2.sol";
import {SoulAccessManaged} from "./access/SoulAccessManaged.sol";
import {SoulZap_UniV2_Whitelist} from "./SoulZap_UniV2_Whitelist.sol";
import {TransferHelper} from "./utils/TransferHelper.sol";
import {TokenHelper} from "./utils/TokenHelper.sol";
import {LocalVarsLib} from "./utils/LocalVarsLib.sol";
import {Sweeper} from "./utils/Sweeper.sol";

/*
/// @dev The receive method is used as a fallback function in a contract
/// and is called when ether is sent to a contract with no calldata.

*/
/**
 * @title SoulZap_UniV2
 * @notice This contract includes functionalities for zapping in and out of UniswapV2 type liquidity pools.
 * @dev Do not use this contract for any tokens that do not have a standard ERC20 implementation.
 * @author Soul Solidity - Contact for mainnet licensing until 730 days after first deployment
 *   transaction with matching bytecode.
 * Otherwise feel free to experiment locally or on testnets.
 */
contract SoulZap_UniV2 is
    ISoulZap_UniV2,
    SoulAccessManaged,
    SoulZap_UniV2_Whitelist,
    EpochVolumeTracker,
    Initializable,
    Pausable,
    ReentrancyGuard,
    TransferHelper,
    Sweeper
{
    using SafeERC20 for IERC20;

    /// -----------------------------------------------------------------------
    /// Storage variables
    /// -----------------------------------------------------------------------

    ISoulFeeManager public soulFeeManager;

    bytes32 public SOUL_ZAP_ADMIN_ROLE = _getRoleHash("SOUL_ZAP_ADMIN_ROLE");
    bytes32 public SOUL_ZAP_PAUSER_ROLE = _getRoleHash("SOUL_ZAP_PAUSER_ROLE");

    /// -----------------------------------------------------------------------
    /// Events
    /// -----------------------------------------------------------------------

    event Swap(SwapParams swapParams);
    event Zap(ZapParams zapParams);

    /// -----------------------------------------------------------------------
    /// Constructor
    /// -----------------------------------------------------------------------

    constructor(
        address _accessRegistry,
        IWETH _wnative,
        ISoulFeeManager _soulFeeManager,
        /// @dev Set to zero to start epoch tracking immediately
        uint256 _epochStartTime
    )
        SoulAccessManaged(_accessRegistry)
        EpochVolumeTracker(_epochStartTime, 0)
        TransferHelper(_wnative)
        Sweeper(new address[](0), true, SOUL_ZAP_ADMIN_ROLE)
    {
        require(_soulFeeManager.isSoulFeeManager(), "SoulZap: soulFeeManager is not ISoulFeeManager");
        soulFeeManager = _soulFeeManager;
    }

    /// @dev The receive method is used as a fallback function in a contract
    /// and is called when ether is sent to a contract with no calldata.
    receive() external payable {
        require(msg.sender == address(WNATIVE), "SoulZap: Only receive from WNATIVE");
    }

    /**
     * @dev This modifier checks if the transaction includes Ether (msg.value > 0).
     * If it does, it ensures that the input token is Wrapped Native (WNATIVE) and the input amount is 0.
     * It then wraps the Ether into WNATIVE and returns the amount of WNATIVE.
     *
     * @param _inputToken The token that the user wants to use for the transaction.
     * @param _inputAmount The amount of the token that the user wants to use for the transaction.
     */
    modifier verifyMsgValueAndWrap(IERC20 _inputToken, uint256 _inputAmount) {
        if (address(_inputToken) == address(Constants.NATIVE_ADDRESS)) {
            (, uint256 wrappedAmount) = _wrapNative();
            require(_inputAmount == wrappedAmount, "SoulZap: amountIn not equal to wrappedAmount");
        } else {
            require(msg.value == 0, "SoulZap: msg.value should be 0");
        }
        _;
    }

    /// -----------------------------------------------------------------------
    /// Pausing
    /// -----------------------------------------------------------------------

    /// @notice Pauses the contract functionality.
    function pause() external onlyAccessRegistryRole(SOUL_ZAP_PAUSER_ROLE) {
        _pause();
    }

    /// @notice Unpauses the contract functionality.
    /// @dev This operation should only be performed by an admin role as it can be a critical operation.
    function unpause() external onlyAccessRegistryRole(SOUL_ZAP_ADMIN_ROLE) {
        _unpause();
    }

    /// -----------------------------------------------------------------------
    /// Swap Functions
    /// -----------------------------------------------------------------------

    /// @notice Zap single token to LP
    /// @param swapParams all parameters for zap
    /// @param feeSwapPath swap path for protocol fee
    function swap(
        SwapParams memory swapParams,
        SwapPath memory feeSwapPath
    )
        external
        payable
        override
        nonReentrant
        whenNotPaused
        verifyMsgValueAndWrap(swapParams.tokenIn, swapParams.amountIn)
    {
        if (address(swapParams.tokenIn) == address(Constants.NATIVE_ADDRESS)) {
            _swap(swapParams, feeSwapPath, true);
        } else {
            // No msg.value
            uint256 balanceBefore = _getBalance(swapParams.tokenIn);
            swapParams.tokenIn.safeTransferFrom(msg.sender, address(this), swapParams.amountIn);
            swapParams.amountIn = _getBalance(swapParams.tokenIn) - balanceBefore;
            _swap(swapParams, feeSwapPath, true);
        }
    }

    /// @notice Ultimate ZAP function
    /// @dev Assumes tokens are already transferred to this contract.
    /// @param swapParams all parameters for swap
    /// @param feeSwapPath swap path for protocol fee
    function _swap(SwapParams memory swapParams, SwapPath memory feeSwapPath, bool takeFee) internal {
        // Verify inputs
        require(swapParams.amountIn > 0, "SoulZap: amountIn must be > 0");
        require(swapParams.to != address(0), "SoulZap: Can't swap to null address");
        require(swapParams.tokenOut != address(0), "SoulZap: tokenOut can't be address(0)");
        require(address(swapParams.tokenIn) != swapParams.tokenOut, "SoulZap: tokens can't be the same");

        bool native = address(swapParams.tokenIn) == address(Constants.NATIVE_ADDRESS);
        if (native) swapParams.tokenIn = WNATIVE;

        if (takeFee) {
            swapParams.amountIn -= _handleFee(
                swapParams.tokenIn,
                swapParams.amountIn,
                feeSwapPath,
                swapParams.deadline
            );
        }

        /**
         * Handle token Swap
         */
        require(swapParams.path.swapRouter != address(0), "SoulZap: swap router can not be address(0)");
        require(swapParams.path.path[0] == address(swapParams.tokenIn), "SoulZap: wrong path path[0]");
        require(
            swapParams.path.path[swapParams.path.path.length - 1] == swapParams.tokenOut,
            "SoulZap: wrong path path[-1]"
        );
        swapParams.tokenIn.forceApprove(swapParams.path.swapRouter, swapParams.amountIn);
        _routerSwapFromPath(swapParams.path, swapParams.amountIn, swapParams.to, swapParams.deadline);

        emit Swap(swapParams);
    }

    /// -----------------------------------------------------------------------
    /// Zap Functions
    /// -----------------------------------------------------------------------

    /// @notice Zap single token to LP
    /// @param zapParams parameters for Zap
    /// @param feeSwapPath swap path for protocol fee
    function zap(
        ZapParams memory zapParams,
        SwapPath memory feeSwapPath
    )
        external
        payable
        override
        nonReentrant
        whenNotPaused
        verifyMsgValueAndWrap(zapParams.tokenIn, zapParams.amountIn)
    {
        if (address(zapParams.tokenIn) == address(Constants.NATIVE_ADDRESS)) {
            _zap(zapParams, feeSwapPath, true);
        } else {
            uint256 balanceBefore = _getBalance(zapParams.tokenIn);
            zapParams.tokenIn.safeTransferFrom(msg.sender, address(this), zapParams.amountIn);
            zapParams.amountIn = _getBalance(zapParams.tokenIn) - balanceBefore;
            _zap(zapParams, feeSwapPath, true);
        }
    }

    /// @notice Ultimate ZAP function
    /// @dev Assumes tokens are already transferred to this contract.
    /// - Native input zap MUST be done with Constants.NATIVE_ADDRESS
    /// @param zapParams see ISoulZap_UniV2.ZapParams struct
    /// @param feeSwapPath see ISoulZap_UniV2.SwapPath struct
    function _zap(ZapParams memory zapParams, SwapPath memory feeSwapPath, bool takeFee) internal {
        // Verify inputs
        require(zapParams.amountIn > 0, "SoulZap: amountIn must be > 0");
        require(zapParams.to != address(0), "SoulZap: Can't zap to null address");
        require(zapParams.liquidityPath.lpRouter != address(0), "SoulZap: lp router can not be address(0)");
        require(zapParams.token0 != address(0), "SoulZap: token0 can not be address(0)");
        require(zapParams.token1 != address(0), "SoulZap: token1 can not be address(0)");

        bool native = address(zapParams.tokenIn) == address(Constants.NATIVE_ADDRESS);
        if (native) zapParams.tokenIn = WNATIVE;

        // Setup struct to prevent stack overflow
        LocalVarsLib.LocalVars memory vars;

        if (takeFee) {
            zapParams.amountIn -= _handleFee(zapParams.tokenIn, zapParams.amountIn, feeSwapPath, zapParams.deadline);
        }

        /**
         * Setup swap amount0 and amount1
         */
        if (zapParams.liquidityPath.lpType == LPType.V2) {
            // Handle UniswapV2 Liquidity
            require(
                IUniswapV2Factory(IUniswapV2Router02(zapParams.liquidityPath.lpRouter).factory()).getPair(
                    zapParams.token0,
                    zapParams.token1
                ) != address(0),
                "SoulZap: Pair doesn't exist"
            );
            vars.amount0In = zapParams.amountIn / 2;
            vars.amount1In = zapParams.amountIn / 2;
        } else {
            revert("SoulZap: LPType not supported");
        }

        /**
         * Handle token0 Swap
         */
        if (zapParams.token0 != address(zapParams.tokenIn)) {
            require(zapParams.path0.swapRouter != address(0), "SoulZap: swap router can not be address(0)");
            require(zapParams.path0.path[0] == address(zapParams.tokenIn), "SoulZap: wrong path path0[0]");
            require(
                zapParams.path0.path[zapParams.path0.path.length - 1] == zapParams.token0,
                "SoulZap: wrong path path0[-1]"
            );
            zapParams.tokenIn.forceApprove(zapParams.path0.swapRouter, vars.amount0In);
            vars.amount0Out = _routerSwapFromPath(zapParams.path0, vars.amount0In, address(this), zapParams.deadline);
        } else {
            vars.amount0Out = zapParams.amountIn - vars.amount1In;
        }
        /**
         * Handle token1 Swap
         */
        if (zapParams.token1 != address(zapParams.tokenIn)) {
            require(zapParams.path1.swapRouter != address(0), "SoulZap: swap router can not be address(0)");
            require(zapParams.path1.path[0] == address(zapParams.tokenIn), "SoulZap: wrong path path1[0]");
            require(
                zapParams.path1.path[zapParams.path1.path.length - 1] == zapParams.token1,
                "SoulZap: wrong path path1[-1]"
            );
            zapParams.tokenIn.forceApprove(zapParams.path1.swapRouter, vars.amount1In);
            vars.amount1Out = _routerSwapFromPath(zapParams.path1, vars.amount1In, address(this), zapParams.deadline);
        } else {
            vars.amount1Out = zapParams.amountIn - vars.amount0In;
        }

        /**
         * Handle Liquidity Add
         */
        IERC20(zapParams.token0).forceApprove(address(zapParams.liquidityPath.lpRouter), vars.amount0Out);
        IERC20(zapParams.token1).forceApprove(address(zapParams.liquidityPath.lpRouter), vars.amount1Out);

        if (zapParams.liquidityPath.lpType == LPType.V2) {
            // Add liquidity to UniswapV2 Pool
            (vars.amount0Lp, vars.amount1Lp, vars.lpAmount) = IUniswapV2Router02(zapParams.liquidityPath.lpRouter)
                .addLiquidity(
                    zapParams.token0,
                    zapParams.token1,
                    vars.amount0Out,
                    vars.amount1Out,
                    zapParams.liquidityPath.amountAMin,
                    zapParams.liquidityPath.amountBMin,
                    zapParams.to,
                    zapParams.deadline
                );
            // Possible option to check for min amount of LP tokens received
            // require(vars.lpAmount >= zapParams.liquidityPath.lpAmount, "SoulZap: Not enough LP tokens received");
        } else {
            revert("SoulZap: lpType not supported");
        }

        if (zapParams.token0 == address(WNATIVE)) {
            // Ensure WNATIVE is called last
            _transferOut(IERC20(zapParams.token1), vars.amount1Out - vars.amount1Lp, msg.sender, native);
            _transferOut(IERC20(zapParams.token0), vars.amount0Out - vars.amount0Lp, msg.sender, native);
        } else {
            _transferOut(IERC20(zapParams.token0), vars.amount0Out - vars.amount0Lp, msg.sender, native);
            _transferOut(IERC20(zapParams.token1), vars.amount1Out - vars.amount1Lp, msg.sender, native);
        }

        /**
         * Remove approval
         */
        IERC20(zapParams.token0).forceApprove(address(zapParams.liquidityPath.lpRouter), 0);
        IERC20(zapParams.token1).forceApprove(address(zapParams.liquidityPath.lpRouter), 0);

        emit Zap(zapParams);
    }

    function _routerSwapFromPath(
        SwapPath memory _uniSwapPath,
        uint256 _amountIn,
        address _to,
        uint256 _deadline
    ) private returns (uint256 amountOut) {
        require(isRouterWhitelisted(_uniSwapPath.swapRouter), "SoulZap: router not whitelisted");
        require(_uniSwapPath.path.length >= 2, "SoulZap: need path0 of >=2");

        address outputToken = _uniSwapPath.path[_uniSwapPath.path.length - 1];
        uint256 balanceBefore = _getBalance(IERC20(outputToken), _to);
        // Swap based on swap type
        if (_uniSwapPath.swapType == SwapType.V2) {
            IUniswapV2Router02(_uniSwapPath.swapRouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(
                _amountIn,
                _uniSwapPath.amountOutMin,
                _uniSwapPath.path,
                _to,
                _deadline
            );
        } else {
            revert("SoulZap: SwapType not supported");
        }
        // Return the balance increase of the output token sent to _to
        amountOut = _getBalance(IERC20(outputToken), _to) - balanceBefore;
    }

    /// -----------------------------------------------------------------------
    /// Fee functions
    /// -----------------------------------------------------------------------

    /**
     * @notice Checks if a given token is a valid fee token.
     * @dev Calls the soulFeeManager's isFeeToken function to determine if the token is used for fees.
     * @param _token The address of the token to check.
     * @return valid True if the token is a valid fee token, false otherwise.
     */
    function isFeeToken(address _token) external view returns (bool valid) {
        return soulFeeManager.isFeeToken(_token);
    }

    /**
     * @notice Retrieves the current fee information for a given epoch volume.
     * @dev Calls the soulFeeManager's getFeeInfo function with the current epoch volume to get fee details.
     * @return feeTokens An array of addresses representing the fee tokens.
     * @return currentFeePercentage The current fee percentage for the epoch.
     * @return feeDenominator The denominator used to calculate the fee percentage.
     * @return feeCollector The address of the fee collector.
     */
    function getFeeInfo()
        public
        view
        override
        returns (address[] memory feeTokens, uint256 currentFeePercentage, uint256 feeDenominator, address feeCollector)
    {
        (feeTokens, currentFeePercentage, feeDenominator, feeCollector) = soulFeeManager.getFeeInfo(getEpochVolume());
    }

    /**
     * @notice Handles the protocol fee calculation and transfer.
     * @dev This function calculates the protocol fee based on the input amount and the current epoch volume.
     * If the protocol fee is not zero, it checks if the output token from the fee swap path is a valid fee token.
     * If the fee swap path length is greater than or equal to 2, it approves the input token for the swap router
     *   and performs a router swap.
     * If the fee swap path length is less than 2, it transfers out the input token to the fee collector.
     * The function also accumulates the volume based on the output of the swap or the input fee amount.
     * @param _inputToken The input token for which the fee is to be calculated.
     * @param _inputAmount The amount of the input token.
     * @param _feeSwapPath The swap path for the fee.
     * @param _deadline The deadline for the swap to occur.
     * @return inputFeeAmount The calculated fee amount.
     */
    function _handleFee(
        IERC20 _inputToken,
        uint256 _inputAmount,
        SwapPath memory _feeSwapPath,
        uint256 _deadline
    ) private returns (uint256 inputFeeAmount) {
        (, uint256 feePercentage, uint256 feeDenominator, address feeCollector) = getFeeInfo();
        if (feePercentage == 0) {
            return 0;
        }

        inputFeeAmount = (_inputAmount * feePercentage) / feeDenominator;

        if (_feeSwapPath.path.length >= 2) {
            require(address(_inputToken) == _feeSwapPath.path[0], "SoulZap: Invalid input token in feeSwapPath");
            address outputToken = _feeSwapPath.path[_feeSwapPath.path.length - 1];
            require(soulFeeManager.isFeeToken(outputToken), "SoulZap: Invalid output token in feeSwapPath");

            _inputToken.forceApprove(_feeSwapPath.swapRouter, inputFeeAmount);
            uint256 amountOut = _routerSwapFromPath(_feeSwapPath, inputFeeAmount, feeCollector, _deadline);
            // Accumulate normalized fee volume
            _accumulateFeeVolume(TokenHelper.normalizeTokenAmount(outputToken, amountOut));
        } else {
            /// @dev Input token is considered fee token or a token with no output route
            /// In order to not create a denial of service, we take any input token in this case.
            _transferOut(_inputToken, inputFeeAmount, feeCollector, false);
            // Only increase fee volume if input token is a fee token
            if (soulFeeManager.isFeeToken(address(_inputToken))) {
                // Accumulate normalized fee volume
                _accumulateFeeVolume(TokenHelper.normalizeTokenAmount(address(_inputToken), inputFeeAmount));
            }
        }
    }
}

File 31 of 38 : Constants.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.19;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

library Constants {
    address public constant NATIVE_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    uint256 internal constant DENOMINATOR = 10_000;
    uint256 internal constant PRECISION = 1e18;
}

File 32 of 38 : EpochVolumeTracker.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

import {IEpochVolumeTracker} from "./IEpochVolumeTracker.sol";

/**
 * @title EpochVolumeTracker
 * @dev This contract is used to track the volume of epochs.
 * @author Soul Solidity - Contact for mainnet licensing until 730 days after first deployment transaction with matching bytecode.
 * Otherwise feel free to experiment locally or on testnets.
 */
contract EpochVolumeTracker is IEpochVolumeTracker {
    /// -----------------------------------------------------------------------
    /// Storage variables
    /// -----------------------------------------------------------------------

    uint256 private _EPOCH_DURATION = 28 days;
    /// @dev Setting to 1 to reduce gas costs
    uint256 private _lifetimeCumulativeVolume = 1;
    uint256 private _epochStartCumulativeVolume = 1;
    uint256 private _lastEpochStartTime;
    uint256 private _initialEpochStartTime;

    /// -----------------------------------------------------------------------
    /// Constructor
    /// -----------------------------------------------------------------------

    constructor(uint256 __lastEpochStartTime, uint256 _epochDuration) {
        if (__lastEpochStartTime == 0) {
            /// @dev Default current epoch start time is current block timestamp
            _lastEpochStartTime = block.timestamp;
        } else {
            /// @dev Can set the current epoch start time to a past time or future for integration flexibility
            // If epoch start time is too far in the past past, then the epoch will start immediately
            // IF epoch start time is in the future, then the epoch will not start until the epoch start time
            _lastEpochStartTime = __lastEpochStartTime;
        }

        _initialEpochStartTime = __lastEpochStartTime;

        if (_epochDuration == 0) {
            /// @dev Default epoch duration is 28 days
            _EPOCH_DURATION = 28 days;
        } else {
            _EPOCH_DURATION = _epochDuration;
        }
    }

    /// -----------------------------------------------------------------------
    /// Epoch functions
    /// -----------------------------------------------------------------------

    /**
     * @notice Retrieves the volume information for the current epoch.
     * @dev This function returns the lifetime cumulative volume, the cumulative volume at the start of the epoch,
     * the start time of the last epoch, the time left in the current epoch, and the duration of an epoch.
     * @return epochVolume The volume of the current epoch.
     * @return lifetimeCumulativeVolume The total volume accumulated since the contract's inception.
     * @return epochStartCumulativeVolume The total volume accumulated at the start of the current epoch.
     * @return lastEpochStartTime The start time of the last epoch.
     * @return timeLeftInEpoch The remaining time in the current epoch.
     * @return epochDuration The duration of an epoch.
     */
    function getEpochVolumeInfo()
        public
        view
        override
        returns (
            uint256 epochVolume,
            uint256 lifetimeCumulativeVolume,
            uint256 epochStartCumulativeVolume,
            uint256 lastEpochStartTime,
            uint256 timeLeftInEpoch,
            uint256 epochDuration
        )
    {
        return (
            getEpochVolume(),
            _lifetimeCumulativeVolume,
            _epochStartCumulativeVolume,
            _lastEpochStartTime,
            getTimeLeftInEpoch(),
            _EPOCH_DURATION
        );
    }

    /// @notice Returns the volume of the current epoch
    /// @return The volume of the current epoch
    function getEpochVolume() public view override returns (uint256) {
        if (_epochNeedsReset()) {
            return 0;
        }
        return _lifetimeCumulativeVolume - _epochStartCumulativeVolume;
    }

    /// @notice Returns the "virtual" time left in the current epoch
    /// @return The "virtual" time left in the current epoch
    function getTimeLeftInEpoch() public view override returns (uint256) {
        if (block.timestamp < _initialEpochStartTime) {
            return 0;
        }
        uint256 timeSinceInitialEpochStart = block.timestamp - _initialEpochStartTime;
        uint256 timeElapsedInCurrentEpoch = timeSinceInitialEpochStart % _EPOCH_DURATION;
        return _EPOCH_DURATION - timeElapsedInCurrentEpoch;
    }

    /// @dev Resets the epoch based on the "virtual" time left in the current epoch
    function _resetEpoch() internal {
        // Update epoch start cumulative volume to lifetime cumulative volume
        _epochStartCumulativeVolume = _lifetimeCumulativeVolume;
        // Update current epoch start time based on the "virtual" time left in the current epoch
        _lastEpochStartTime = block.timestamp - ((block.timestamp - _initialEpochStartTime) % _EPOCH_DURATION);
    }

    /// @notice Checks if the current epoch is over
    /// @return True if the current epoch is over, false otherwise
    function _epochNeedsReset() private view returns (bool) {
        return block.timestamp >= _lastEpochStartTime + _EPOCH_DURATION;
    }

    /// -----------------------------------------------------------------------
    /// Volume functions
    /// -----------------------------------------------------------------------

    /// @dev Accumulates volume and updates epoch start time if current epoch is over.
    /// @param _volume The volume to be accumulated. Intended to be normalized to 18 decimals
    function _accumulateFeeVolume(uint256 _volume) internal {
        // Epoch start time in future, do not accumulate volume until epoch starts.
        // Allows for setting epoch start time to a future time for configuration flexibility.
        if (block.timestamp < _initialEpochStartTime) {
            return;
        }

        if (_epochNeedsReset()) {
            _resetEpoch();
        }

        // Add the volume to lifetime cumulative volume
        _lifetimeCumulativeVolume += _volume;
        emit AccumulateVolume(_volume, _lifetimeCumulativeVolume, _epochStartCumulativeVolume, _lastEpochStartTime);
    }
}

File 33 of 38 : IEpochVolumeTracker.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

interface IEpochVolumeTracker {
    /// -----------------------------------------------------------------------
    /// Events
    /// -----------------------------------------------------------------------

    event AccumulateVolume(
        uint256 volumeAccumulated,
        uint256 lifetimeCumulativeVolume,
        uint256 epochStartCumulativeVolume,
        uint256 currentEpochStartTime
    );

    /// -----------------------------------------------------------------------
    /// Public/External functions
    /// -----------------------------------------------------------------------

    function getEpochVolume() external view returns (uint256);

    function getTimeLeftInEpoch() external view returns (uint256);

    function getEpochVolumeInfo()
        external
        view
        returns (
            uint256 epochVolume,
            uint256 lifetimeCumulativeVolume,
            uint256 epochStartCumulativeVolume,
            uint256 lastEpochStartTime,
            uint256 timeLeftInEpoch,
            uint256 epochDuration
        );
}

File 34 of 38 : ITransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

import {IWETH} from "../lib/IWETH.sol";

interface ITransferHelper {
    /// -----------------------------------------------------------------------
    /// Storage variables
    /// -----------------------------------------------------------------------
    function WNATIVE() external view returns (IWETH);
}

File 35 of 38 : LocalVarsLib.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

library LocalVarsLib {
    struct LocalVars {
        uint256 amount0In;
        uint256 amount1In;
        uint256 amount0Out;
        uint256 amount1Out;
        uint256 amount0Lp;
        uint256 amount1Lp;
        uint256 lpAmount;
    }
}

File 36 of 38 : Sweeper.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.19;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import {SoulAccessManaged} from "../access/SoulAccessManaged.sol";

/**
 * @dev Sweep any ERC20 token.
 * Sometimes people accidentally send tokens to a contract without any way to retrieve them.
 * This contract makes sure any erc20 tokens can be removed from the contract.
 */
abstract contract Sweeper is SoulAccessManaged {
    bytes32 private immutable sweeperAdminRole;

    struct NFT {
        IERC721 nftAddress;
        uint256[] ids;
    }
    mapping(address => bool) public lockedTokens;
    bool public allowNativeSweep;

    event SweepWithdrawToken(address indexed receiver, IERC20 indexed token, uint256 balance);

    event SweepWithdrawNFTs(address indexed receiver, NFT[] indexed nfts);

    event SweepWithdrawNative(address indexed receiver, uint256 balance);

    constructor(address[] memory _lockedTokens, bool _allowNativeSweep, bytes32 _sweeperAdminRole) {
        _lockTokens(_lockedTokens);
        allowNativeSweep = _allowNativeSweep;
        sweeperAdminRole = _sweeperAdminRole;
    }

    /**
     * @dev Transfers erc20 tokens to owner
     * Only owner of contract can call this function
     */
    function sweepTokens(IERC20[] memory tokens, address to) external onlyAccessRegistryRole(sweeperAdminRole) {
        NFT[] memory empty;
        sweepTokensAndNFTs(tokens, empty, to);
    }

    /**
     * @dev Transfers NFT to owner
     * Only owner of contract can call this function
     */
    function sweepNFTs(NFT[] memory nfts, address to) external onlyAccessRegistryRole(sweeperAdminRole) {
        IERC20[] memory empty;
        sweepTokensAndNFTs(empty, nfts, to);
    }

    /**
     * @dev Transfers ERC20 and NFT to owner
     * Only owner of contract can call this function
     */
    function sweepTokensAndNFTs(
        IERC20[] memory tokens,
        NFT[] memory nfts,
        address to
    ) public onlyAccessRegistryRole(sweeperAdminRole) {
        for (uint256 i = 0; i < tokens.length; i++) {
            IERC20 token = tokens[i];
            require(!lockedTokens[address(token)], "Tokens can't be swept");
            uint256 balance = token.balanceOf(address(this));
            token.transfer(to, balance);
            emit SweepWithdrawToken(to, token, balance);
        }

        for (uint256 i = 0; i < nfts.length; i++) {
            IERC721 nftAddress = nfts[i].nftAddress;
            require(!lockedTokens[address(nftAddress)], "Tokens can't be swept");
            uint256[] memory ids = nfts[i].ids;
            for (uint256 j = 0; j < ids.length; j++) {
                nftAddress.safeTransferFrom(address(this), to, ids[j]);
            }
        }
        emit SweepWithdrawNFTs(to, nfts);
    }

    /// @notice Sweep native coin
    /// @param _to address the native coins should be transferred to
    function sweepNative(address payable _to) external onlyAccessRegistryRole(sweeperAdminRole) {
        require(allowNativeSweep, "Not allowed");
        uint256 balance = address(this).balance;
        _to.transfer(balance);
        emit SweepWithdrawNative(_to, balance);
    }

    /**
     * @dev Refuse native sweep.
     * Once refused can't be allowed again
     */
    function refuseNativeSweep() external onlyAccessRegistryRole(sweeperAdminRole) {
        allowNativeSweep = false;
    }

    /**
     * @dev Lock single token so they can't be transferred from the contract.
     * Once locked it can't be unlocked
     */
    function lockToken(address token) external onlyAccessRegistryRole(sweeperAdminRole) {
        address[] memory tokenArray = new address[](1);
        tokenArray[0] = token;
        _lockTokens(tokenArray);
    }

    /**
     * @dev Lock multiple tokens so they can't be transferred from the contract.
     * Once locked it can't be unlocked
     */
    function lockTokens(address[] memory tokens) external onlyAccessRegistryRole(sweeperAdminRole) {
        _lockTokens(tokens);
    }

    function _lockTokens(address[] memory tokens) private {
        for (uint256 i = 0; i < tokens.length; i++) {
            lockedTokens[tokens[i]] = true;
        }
    }
}

File 37 of 38 : TokenHelper.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.19;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

library TokenHelper {
    /**
     * @notice Retrieves the number of decimal places used by a given token.
     * @dev If the token supports the IERC20Metadata interface, it will return the token's decimals.
     * If the token does not support the interface, it will default to 18 decimals.
     * @param token The address of the token for which to retrieve the decimal places.
     * @return decimals The number of decimal places used by the token.
     */
    function getTokenDecimals(address token) internal view returns (uint8 decimals) {
        try IERC20Metadata(token).decimals() returns (uint8 dec) {
            decimals = dec;
        } catch {
            decimals = 18;
        }
    }

    /**
     * @notice Normalizes the amount of tokens to a standard 18 decimal format.
     * @dev This function adjusts the amount of tokens to a normalized 18 decimal format,
     *      taking into account the number of decimal places the token uses.
     * @param token The address of the ERC20 token for which to normalize the amount.
     * @param amount The original amount of tokens to be normalized.
     * @return The adjusted amount of tokens, normalized to 18 decimal places.
     */
    function normalizeTokenAmount(address token, uint256 amount) internal view returns (uint256) {
        return normalizeAmountByDecimals(amount, getTokenDecimals(token));
    }

    /**
     * @notice Adjusts the amount of tokens to a normalized 18 decimal format.
     * @dev Tokens with less than 18 decimals will loose precision to 18 decimals.
     * @param amount The original amount of tokens with `decimals` decimal places.
     * @param decimals The number of decimal places the token uses.
     * @return The adjusted amount of tokens, normalized to 18 decimal places.
     */
    function normalizeAmountByDecimals(uint256 amount, uint8 decimals) internal pure returns (uint256) {
        // If the token has more than 18 decimals, we divide the amount to normalize to 18 decimals.
        if (decimals > 18) {
            // Dividing by 10 ** (decimals - 18) to reduce the number of decimals.
            return amount / 10 ** (decimals - 18);
        } else if (decimals < 18) {
            // Multiplying by 10 ** (18 - decimals) to increase the number of decimals.
            return amount * 10 ** (18 - decimals);
        } else {
            // If the token already has 18 decimals, return the amount unchanged.
            return amount;
        }
    }
}

File 38 of 38 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.19;

/*
 ██████╗ █████╗ ██╗   ██╗██╗        ██████╗ █████╗ ██╗     ██╗██████╗ ██╗████████╗██╗   ██╗
██╔════╝██╔══██╗██║   ██║██║       ██╔════╝██╔══██╗██║     ██║██╔══██╗██║╚══██╔══╝╚██╗ ██╔╝
╚█████╗ ██║  ██║██║   ██║██║       ╚█████╗ ██║  ██║██║     ██║██║  ██║██║   ██║    ╚████╔╝ 
 ╚═══██╗██║  ██║██║   ██║██║        ╚═══██╗██║  ██║██║     ██║██║  ██║██║   ██║     ╚██╔╝  
██████╔╝╚█████╔╝╚██████╔╝███████╗  ██████╔╝╚█████╔╝███████╗██║██████╔╝██║   ██║      ██║   
╚═════╝  ╚════╝  ╚═════╝ ╚══════╝  ╚═════╝  ╚════╝ ╚══════╝╚═╝╚═════╝ ╚═╝   ╚═╝      ╚═╝   

 * Twitter: https://twitter.com/SoulSolidity
 *  GitHub: https://github.com/SoulSolidity
 *     Web: https://SoulSolidity.com
 */

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ITransferHelper} from "../utils/ITransferHelper.sol";
import {IWETH} from "../lib/IWETH.sol";

contract TransferHelper is ITransferHelper {
    using SafeERC20 for IERC20;

    /// -----------------------------------------------------------------------
    /// Storage variables
    /// -----------------------------------------------------------------------

    IWETH public immutable WNATIVE;

    /// -----------------------------------------------------------------------
    /// Constructor
    /// -----------------------------------------------------------------------

    constructor(IWETH wnative) {
        WNATIVE = wnative;
    }

    /// -----------------------------------------------------------------------
    /// Wrapped Native helpers
    /// -----------------------------------------------------------------------

    /// @notice Wrap the msg.value into the Wrapped Native token
    /// @return wNative The IERC20 representation of the wrapped asset
    /// @return amount Amount of native tokens wrapped
    function _wrapNative() internal returns (IERC20 wNative, uint256 amount) {
        wNative = IERC20(address(WNATIVE));
        amount = msg.value;
        WNATIVE.deposit{value: amount}();
    }

    /// @notice Unwrap current balance of Wrapped Native tokens
    /// @return amount Amount of native tokens unwrapped
    function _unwrapNative() internal returns (uint256 amount) {
        amount = _getBalance(IERC20(address(WNATIVE)));
        IWETH(WNATIVE).withdraw(amount);
    }

    /// -----------------------------------------------------------------------
    /// ERC20 transfer helpers (supporting fee on transfer)
    /// - Also `_transferOut` WNative unwrap support.
    /// -----------------------------------------------------------------------

    /// @notice Transfers in ERC20 tokens from the sender to this contract
    /// @param token The ERC20 token to transfer
    /// @param amount The amount of tokens to transfer
    /// @return amountIn The actual amount of tokens transferred

    function _transferIn(IERC20 token, uint256 amount) internal returns (uint256 amountIn) {
        if (amount == 0) return 0;
        uint256 balanceBefore = _getBalance(token);
        token.safeTransferFrom(msg.sender, address(this), amount);
        amountIn = _getBalance(token) - balanceBefore;
    }

    /// @notice Transfers out ERC20 tokens from this contract to a recipient
    /// @param token The ERC20 token to transfer
    /// @param amount The amount of tokens to transfer
    /// @param to The recipient of the tokens
    /// @param native Whether to unwrap Wrapped Native tokens before transfer
    function _transferOut(IERC20 token, uint256 amount, address to, bool native) internal {
        if (amount == 0) return;
        if (address(token) == address(WNATIVE) && native) {
            IWETH(WNATIVE).withdraw(amount);
            // 2600 COLD_ACCOUNT_ACCESS_COST plus 2300 transfer gas - 1
            // Intended to support transfers to contracts, but not allow for further code execution
            (bool success, ) = to.call{value: amount, gas: 4899}("");
            require(success, "native transfer error");
        } else {
            token.safeTransfer(to, amount);
        }
    }

    /// @notice Gets the balance of an ERC20 token in this contract
    /// @param token The ERC20 token to check the balance of
    /// @return balance The balance of the tokens in this contract
    function _getBalance(IERC20 token) internal view returns (uint256 balance) {
        balance = token.balanceOf(address(this));
    }

    /// @notice Gets the balance of an ERC20 token in this contract
    /// @param token The ERC20 token to check the balance of
    /// @param token The address to check the balance of
    /// @return balance The balance of the tokens in this contract
    function _getBalance(IERC20 token, address _address) internal view returns (uint256 balance) {
        balance = token.balanceOf(_address);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_accessRegistry","type":"address"},{"internalType":"contract IWETH","name":"_wnative","type":"address"},{"internalType":"contract ISoulFeeManager","name":"_soulFeeManager","type":"address"},{"internalType":"uint256","name":"_epochStartTime","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"SoulAccessUnauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"volumeAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lifetimeCumulativeVolume","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"epochStartCumulativeVolume","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currentEpochStartTime","type":"uint256"}],"name":"AccumulateVolume","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bondNft","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"BondNftWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"router","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"RouterWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path","type":"tuple"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"indexed":false,"internalType":"struct ISoulZap_UniV2.SwapParams","name":"swapParams","type":"tuple"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"indexed":true,"internalType":"struct Sweeper.NFT[]","name":"nfts","type":"tuple[]"}],"name":"SweepWithdrawNFTs","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"SweepWithdrawNative","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"SweepWithdrawToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path0","type":"tuple"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path1","type":"tuple"},{"components":[{"internalType":"address","name":"lpRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.LPType","name":"lpType","type":"uint8"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"uint256","name":"lpAmount","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.LiquidityPath","name":"liquidityPath","type":"tuple"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"indexed":false,"internalType":"struct ISoulZap_UniV2.ZapParams","name":"zapParams","type":"tuple"}],"name":"Zap","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path0","type":"tuple"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path1","type":"tuple"},{"components":[{"internalType":"address","name":"lpRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.LPType","name":"lpType","type":"uint8"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"uint256","name":"lpAmount","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.LiquidityPath","name":"liquidityPath","type":"tuple"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"indexed":false,"internalType":"struct ISoulZap_UniV2.ZapParams","name":"zapParams","type":"tuple"},{"indexed":false,"internalType":"contract ICustomBillRefillable","name":"bond","type":"address"},{"indexed":false,"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"ZapBond","type":"event"},{"inputs":[],"name":"SOUL_ZAP_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SOUL_ZAP_PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WNATIVE","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowNativeSweep","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEpochVolume","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEpochVolumeInfo","outputs":[{"internalType":"uint256","name":"epochVolume","type":"uint256"},{"internalType":"uint256","name":"lifetimeCumulativeVolume","type":"uint256"},{"internalType":"uint256","name":"epochStartCumulativeVolume","type":"uint256"},{"internalType":"uint256","name":"lastEpochStartTime","type":"uint256"},{"internalType":"uint256","name":"timeLeftInEpoch","type":"uint256"},{"internalType":"uint256","name":"epochDuration","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeInfo","outputs":[{"internalType":"address[]","name":"feeTokens","type":"address[]"},{"internalType":"uint256","name":"currentFeePercentage","type":"uint256"},{"internalType":"uint256","name":"feeDenominator","type":"uint256"},{"internalType":"address","name":"feeCollector","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimeLeftInEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getWhitelistedBondNftAtIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWhitelistedBondNftCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getWhitelistedRouterAtIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWhitelistedRouterCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ICustomBillRefillable","name":"_bond","type":"address"}],"name":"isBondNftWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isFeeToken","outputs":[{"internalType":"bool","name":"valid","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"isRouterWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"lockToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"lockTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lockedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refuseNativeSweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bondNft","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setBondNftWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setRouterWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"soulAccessRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"soulFeeManager","outputs":[{"internalType":"contract ISoulFeeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path","type":"tuple"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapParams","name":"swapParams","type":"tuple"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"feeSwapPath","type":"tuple"}],"name":"swap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct Sweeper.NFT[]","name":"nfts","type":"tuple[]"},{"internalType":"address","name":"to","type":"address"}],"name":"sweepNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"}],"name":"sweepNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"sweepTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"components":[{"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct Sweeper.NFT[]","name":"nfts","type":"tuple[]"},{"internalType":"address","name":"to","type":"address"}],"name":"sweepTokensAndNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path0","type":"tuple"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path1","type":"tuple"},{"components":[{"internalType":"address","name":"lpRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.LPType","name":"lpType","type":"uint8"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"uint256","name":"lpAmount","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.LiquidityPath","name":"liquidityPath","type":"tuple"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.ZapParams","name":"zapParams","type":"tuple"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"feeSwapPath","type":"tuple"}],"name":"zap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path0","type":"tuple"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"path1","type":"tuple"},{"components":[{"internalType":"address","name":"lpRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.LPType","name":"lpType","type":"uint8"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"uint256","name":"lpAmount","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.LiquidityPath","name":"liquidityPath","type":"tuple"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.ZapParams","name":"zapParams","type":"tuple"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"enum ISoulZap_UniV2.SwapType","name":"swapType","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"internalType":"struct ISoulZap_UniV2.SwapPath","name":"feeSwapPath","type":"tuple"},{"internalType":"contract ICustomBillRefillable","name":"bond","type":"address"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"zapBond","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6224ea0060055560016006819055600755601360c0527f534f554c5f5a41505f41444d494e5f524f4c450000000000000000000000000060e0527f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc600e556101406040526014610100527f534f554c5f5a41505f5041555345525f524f4c45000000000000000000000000610120527fdd3033d0f711bbbcef7a32dab5fb628703ce2ebe8da76963b825d3f16dec1dd7600f55348015620000bf57600080fd5b50604051620058ad380380620058ad833981016040819052620000e29162000347565b83838383600060405190808252806020026020018201604052801562000112578160200160208202803683370190505b50600e54600080546001600160a01b0319166001600160a01b03881617815560019190869085908181036200014b574260085562000151565b60088290555b600982905560008190036200016d576224ea0060055562000173565b60058190555b5050600a805462ff0000191690556001600b556001600160a01b03166080526200019d83620002bb565b600d805460ff19169215159290921790915560a0525060408051633f22b90360e01b815290516001600160a01b03841691633f22b9039160048083019260209291908290030181865afa158015620001f9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200021f9190620003a1565b620002875760405162461bcd60e51b815260206004820152602e60248201527f536f756c5a61703a20736f756c4665654d616e61676572206973206e6f74204960448201526d29b7bab62332b2a6b0b730b3b2b960911b606482015260840160405180910390fd5b50600d80546001600160a01b0390921661010002610100600160a81b0319909216919091179055506200040a945050505050565b60005b81518110156200032a576001600c6000848481518110620002e357620002e3620003cc565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806200032181620003e2565b915050620002be565b5050565b6001600160a01b03811681146200034457600080fd5b50565b600080600080608085870312156200035e57600080fd5b84516200036b816200032e565b60208601519094506200037e816200032e565b604086015190935062000391816200032e565b6060959095015193969295505050565b600060208284031215620003b457600080fd5b81518015158114620003c557600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016200040357634e487b7160e01b600052601160045260246000fd5b5060010190565b60805160a05161541b620004926000396000818161076a015281816107d801528181610aba015281816110b3015281816111080152818161119501526118850152600081816102110152818161060501528181611bab01528181611bd101528181611e430152818161247801528181612cc601528181613e050152613e75015261541b6000f3fe6080604052600436106102015760003560e01c80636b131ed21161011d5780639e01ec1d116100b0578063cc6fd8731161007f578063d911933011610064578063d91193301461066f578063e38659d01461068f578063fa1b0cc9146106af57600080fd5b8063cc6fd87314610647578063d3c277e71461065a57600080fd5b80639e01ec1d146105ca578063a45a0471146105dd578063b381cf40146105f3578063c1dacec81461062757600080fd5b806378c093cf116100ec57806378c093cf146105605780637b224339146105805780638456cb59146105a0578063927d9b2a146105b557600080fd5b80636b131ed2146104c45780637071f0c4146104e9578063728efc5f14610509578063732ea9711461051e57600080fd5b8063304f56dc116101955780635c975abb116101645780635c975abb146104295780635eb7413a1461044757806360d561da14610477578063637e2f43146104af57600080fd5b8063304f56dc146103c75780633066e0a0146103e75780633ca41611146103fa5780633f4ba83a1461041457600080fd5b806316ad82d7116101d157806316ad82d71461034e578063183260921461036e5780631ce5dc5a14610392578063299b5528146103b257600080fd5b806202eab7146102b05780630420aab1146102de5780630aef023f146102fe57806310693fcd1461032e57600080fd5b366102ab57336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146102a95760405162461bcd60e51b815260206004820152602260248201527f536f756c5a61703a204f6e6c7920726563656976652066726f6d20574e41544960448201527f564500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b005b600080fd5b3480156102bc57600080fd5b506102c56106cf565b6040516102d59493929190614484565b60405180910390f35b3480156102ea57600080fd5b506102a96102f936600461470e565b610768565b34801561030a57600080fd5b5061031e610319366004614760565b6107c3565b60405190151581526020016102d5565b34801561033a57600080fd5b506102a9610349366004614760565b6107d6565b34801561035a57600080fd5b5061031e610369366004614760565b610882565b34801561037a57600080fd5b50610384600e5481565b6040519081526020016102d5565b34801561039e57600080fd5b506102a96103ad36600461478b565b6108f6565b3480156103be57600080fd5b50610384610aa7565b3480156103d357600080fd5b506102a96103e2366004614828565b610ab8565b6102a96103f5366004614993565b610ecd565b34801561040657600080fd5b50600d5461031e9060ff1681565b34801561042057600080fd5b506102a9611070565b34801561043557600080fd5b50600a5462010000900460ff1661031e565b34801561045357600080fd5b5061031e610462366004614760565b600c6020526000908152604090205460ff1681565b34801561048357600080fd5b50600054610497906001600160a01b031681565b6040516001600160a01b0390911681526020016102d5565b3480156104bb57600080fd5b506103846110a5565b3480156104d057600080fd5b50600d546104979061010090046001600160a01b031681565b3480156104f557600080fd5b506102a9610504366004614a76565b6110b1565b34801561051557600080fd5b506102a9611106565b34801561052a57600080fd5b5061053361115b565b604080519687526020870195909552938501929092526060840152608083015260a082015260c0016102d5565b34801561056c57600080fd5b506102a961057b366004614760565b611193565b34801561058c57600080fd5b506102a961059b36600461478b565b6112a1565b3480156105ac57600080fd5b506102a9611447565b3480156105c157600080fd5b50610384611479565b6102a96105d8366004614beb565b6114c4565b3480156105e957600080fd5b50610384600f5481565b3480156105ff57600080fd5b506104977f000000000000000000000000000000000000000000000000000000000000000081565b34801561063357600080fd5b5061031e610642366004614760565b611650565b6102a9610655366004614c38565b6116bf565b34801561066657600080fd5b5061038461185e565b34801561067b57600080fd5b506102a961068a366004614cb6565b611883565b34801561069b57600080fd5b506104976106aa366004614ceb565b6118d4565b3480156106bb57600080fd5b506104976106ca366004614ceb565b611939565b600d546060906000908190819061010090046001600160a01b031663d45c267a6106f761185e565b6040518263ffffffff1660e01b815260040161071591815260200190565b600060405180830381865afa158015610732573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261075a9190810190614d0f565b929791965094509092509050565b7f0000000000000000000000000000000000000000000000000000000000000000610793813361199e565b6107b05760405163224af60760e11b815260040160405180910390fd5b60606107bd818585610ab8565b50505050565b60006107d0600383611a34565b92915050565b7f0000000000000000000000000000000000000000000000000000000000000000610801813361199e565b61081e5760405163224af60760e11b815260040160405180910390fd5b60408051600180825281830190925260009160208083019080368337019050509050828160008151811061085457610854614dcf565b60200260200101906001600160a01b031690816001600160a01b03168152505061087d81611a56565b505050565b600d546040516316ad82d760e01b81526001600160a01b038381166004830152600092610100900416906316ad82d790602401602060405180830381865afa1580156108d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d09190614de5565b60408051808201909152601381527f534f554c5f5a41505f41444d494e5f524f4c450000000000000000000000000060208201526109557f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc5b3361199e565b6109725760405163224af60760e11b815260040160405180910390fd5b8115610a1457610983600184611abe565b6109cf5760405162461bcd60e51b815260206004820152601b60248201527f426f6e644e667420616c72656164792077686974656c6973746564000000000060448201526064016102a0565b604051600181526001600160a01b038416907f2d9fd319ac1d77401938fc890b085975b59d44783507766c698f93fdfe89c244906020015b60405180910390a2505050565b610a1f600184611ad3565b610a6b5760405162461bcd60e51b815260206004820152601760248201527f426f6e644e6674206e6f742077686974656c697374656400000000000000000060448201526064016102a0565b604051600081526001600160a01b038416907f2d9fd319ac1d77401938fc890b085975b59d44783507766c698f93fdfe89c24490602001610a07565b6000610ab36003611ae8565b905090565b7f0000000000000000000000000000000000000000000000000000000000000000610ae3813361199e565b610b005760405163224af60760e11b815260040160405180910390fd5b60005b8451811015610cde576000858281518110610b2057610b20614dcf565b6020908102919091018101516001600160a01b0381166000908152600c90925260409091205490915060ff1615610b995760405162461bcd60e51b815260206004820152601560248201527f546f6b656e732063616e2774206265207377657074000000000000000000000060448201526064016102a0565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190614e02565b60405163a9059cbb60e01b81526001600160a01b038781166004830152602482018390529192509083169063a9059cbb906044016020604051808303816000875af1158015610c57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7b9190614de5565b50816001600160a01b0316856001600160a01b03167f5bf76ef0db3550a96f76d3c13dfa002b5e1df9e4c4d65dce31f074c670b8b64883604051610cc191815260200190565b60405180910390a350508080610cd690614e31565b915050610b03565b5060005b8351811015610e7d576000848281518110610cff57610cff614dcf565b602090810291909101810151516001600160a01b0381166000908152600c90925260409091205490915060ff1615610d795760405162461bcd60e51b815260206004820152601560248201527f546f6b656e732063616e2774206265207377657074000000000000000000000060448201526064016102a0565b6000858381518110610d8d57610d8d614dcf565b602002602001015160200151905060005b8151811015610e6757826001600160a01b03166342842e0e3088858581518110610dca57610dca614dcf565b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015610e3c57600080fd5b505af1158015610e50573d6000803e3d6000fd5b505050508080610e5f90614e31565b915050610d9e565b5050508080610e7590614e31565b915050610ce2565b5082604051610e8c9190614e4a565b604051908190038120906001600160a01b038416907fb7d54fb67ddf621754e70da8666b8f260b9d90d503a96e15fdf8753d59af387790600090a350505050565b610ed5611af2565b610edd611b4b565b8151602083015173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610f80576000610f13611ba6565b915050808214610f7a5760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20616d6f756e74496e206e6f7420657175616c20746f207760448201526b1c985c1c1959105b5bdd5b9d60a21b60648201526084016102a0565b50610fce565b3415610fce5760405162461bcd60e51b815260206004820152601e60248201527f536f756c5a61703a206d73672e76616c75652073686f756c642062652030000060448201526064016102a0565b83516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed19016110055761100084846001611c47565b611060565b600061101485600001516120a1565b60208601518651919250611035916001600160a01b0316903390309061210c565b8061104386600001516120a1565b61104d9190614ebe565b602086015261105e85856001611c47565b505b505061106c6001600b55565b5050565b600e5461107d813361199e565b61109a5760405163224af60760e11b815260040160405180910390fd5b6110a26121bd565b50565b6000610ab36001611ae8565b7f00000000000000000000000000000000000000000000000000000000000000006110dc813361199e565b6110f95760405163224af60760e11b815260040160405180910390fd5b60606107bd848285610ab8565b7f0000000000000000000000000000000000000000000000000000000000000000611131813361199e565b61114e5760405163224af60760e11b815260040160405180910390fd5b50600d805460ff19169055565b60008060008060008061116c61185e565b60065460075460085461117d611479565b600554949b939a50919850965094509092509050565b7f00000000000000000000000000000000000000000000000000000000000000006111be813361199e565b6111db5760405163224af60760e11b815260040160405180910390fd5b600d5460ff1661122d5760405162461bcd60e51b815260206004820152600b60248201527f4e6f7420616c6c6f77656400000000000000000000000000000000000000000060448201526064016102a0565b60405147906001600160a01b0384169082156108fc029083906000818181858888f19350505050158015611265573d6000803e3d6000fd5b50826001600160a01b03167fdc495bd3b5344fcb85ff9c1b44ebfd7d2d9ee001c0826360fdbc13665f9cb4ed82604051610a0791815260200190565b60408051808201909152601381527f534f554c5f5a41505f41444d494e5f524f4c450000000000000000000000000060208201526112fe7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc61094f565b61131b5760405163224af60760e11b815260040160405180910390fd5b81156113b45761132c600384611abe565b6113785760405162461bcd60e51b815260206004820152601a60248201527f526f7574657220616c72656164792077686974656c697374656400000000000060448201526064016102a0565b604051600181526001600160a01b038416907fcf2b36bf2aa8353623d06f58eab9577176d9214e588362c013a7eeb0586463f190602001610a07565b6113bf600384611ad3565b61140b5760405162461bcd60e51b815260206004820152601660248201527f526f75746572206e6f742077686974656c69737465640000000000000000000060448201526064016102a0565b604051600081526001600160a01b038416907fcf2b36bf2aa8353623d06f58eab9577176d9214e588362c013a7eeb0586463f190602001610a07565b600f54611454813361199e565b6114715760405163224af60760e11b815260040160405180910390fd5b6110a2612211565b600060095442101561148b5750600090565b60006009544261149b9190614ebe565b90506000600554826114ad9190614ee7565b9050806005546114bd9190614ebe565b9250505090565b6114cc611af2565b6114d4611b4b565b8151602083015173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b0383160161157757600061150a611ba6565b9150508082146115715760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20616d6f756e74496e206e6f7420657175616c20746f207760448201526b1c985c1c1959105b5bdd5b9d60a21b60648201526084016102a0565b506115c5565b34156115c55760405162461bcd60e51b815260206004820152601e60248201527f536f756c5a61703a206d73672e76616c75652073686f756c642062652030000060448201526064016102a0565b83516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed19016115f75761100084846001612252565b600061160685600001516120a1565b60208601518651919250611627916001600160a01b0316903390309061210c565b8061163586600001516120a1565b61163f9190614ebe565b602086015261105e85856001612252565b60006107d0826001600160a01b031663d3aac7746040518163ffffffff1660e01b8152600401602060405180830381865afa158015611693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b79190614efb565b600190611a34565b6116c7611af2565b6116cf611b4b565b8351602085015173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601611772576000611705611ba6565b91505080821461176c5760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20616d6f756e74496e206e6f7420657175616c20746f207760448201526b1c985c1c1959105b5bdd5b9d60a21b60648201526084016102a0565b506117c0565b34156117c05760405162461bcd60e51b815260206004820152601e60248201527f536f756c5a61703a206d73672e76616c75652073686f756c642062652030000060448201526064016102a0565b85516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed19016117f7576117f286868686612dff565b611852565b600061180687600001516120a1565b60208801518851919250611827916001600160a01b0316903390309061210c565b8061183588600001516120a1565b61183f9190614ebe565b602088015261185087878787612dff565b505b50506107bd6001600b55565b60006118686135c6565b156118735750600090565b600754600654610ab39190614ebe565b7f00000000000000000000000000000000000000000000000000000000000000006118ae813361199e565b6118cb5760405163224af60760e11b815260040160405180910390fd5b61106c82611a56565b60006118e06003611ae8565b821061192e5760405162461bcd60e51b815260206004820152601360248201527f496e646578206f7574206f6620626f756e64730000000000000000000000000060448201526064016102a0565b6107d06003836135e0565b60006119456001611ae8565b82106119935760405162461bcd60e51b815260206004820152601360248201527f496e646578206f7574206f6620626f756e64730000000000000000000000000060448201526064016102a0565b6107d06001836135e0565b600080546040517f91d14854000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b038481166024830152909116906391d1485490604401602060405180830381865afa158015611a09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2d9190614de5565b9392505050565b6001600160a01b03811660009081526001830160205260408120541515611a2d565b60005b815181101561106c576001600c6000848481518110611a7a57611a7a614dcf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580611ab681614e31565b915050611a59565b6000611a2d836001600160a01b0384166135ec565b6000611a2d836001600160a01b03841661363b565b60006107d0825490565b6002600b5403611b445760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102a0565b6002600b55565b600a5462010000900460ff1615611ba45760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016102a0565b565b6000807f000000000000000000000000000000000000000000000000000000000000000091503490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c2a57600080fd5b505af1158015611c3e573d6000803e3d6000fd5b50505050509091565b6000836020015111611c9b5760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a20616d6f756e74496e206d757374206265203e203000000060448201526064016102a0565b60808301516001600160a01b0316611d1b5760405162461bcd60e51b815260206004820152602360248201527f536f756c5a61703a2043616e2774207377617020746f206e756c6c206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016102a0565b60408301516001600160a01b0316611d835760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e4f75742063616e2774206265206164647265604482015264737328302960d81b60648201526084016102a0565b82604001516001600160a01b031683600001516001600160a01b031603611e125760405162461bcd60e51b815260206004820152602160248201527f536f756c5a61703a20746f6b656e732063616e2774206265207468652073616d60448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016102a0565b82516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148015611e66576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684525b8115611e9957611e8484600001518560200151858760a0015161372e565b84602001818151611e959190614ebe565b9052505b6060840151516001600160a01b0316611f075760405162461bcd60e51b815260206004820152602a60248201527f536f756c5a61703a207377617020726f757465722063616e206e6f74206265206044820152696164647265737328302960b01b60648201526084016102a0565b83600001516001600160a01b0316846060015160400151600081518110611f3057611f30614dcf565b60200260200101516001600160a01b031614611f8e5760405162461bcd60e51b815260206004820152601b60248201527f536f756c5a61703a2077726f6e67207061746820706174685b305d000000000060448201526064016102a0565b60408085015160608601519091015180516001600160a01b0390921691611fb790600190614ebe565b81518110611fc757611fc7614dcf565b60200260200101516001600160a01b0316146120255760405162461bcd60e51b815260206004820152601c60248201527f536f756c5a61703a2077726f6e67207061746820706174685b2d315d0000000060448201526064016102a0565b60608401515160208501518551612047926001600160a01b0390911691613a1a565b6120638460600151856020015186608001518760a00151613abe565b507f8f6b93a35e02889ccab3af6294b788054d73dcb358d18b5df8a827adf615e1fa846040516120939190614fd9565b60405180910390a150505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156120e8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d09190614e02565b6040516001600160a01b03808516602483015283166044820152606481018290526107bd9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613cbd565b6121c5613da5565b600a805462ff0000191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b612219611b4b565b600a805462ff00001916620100001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121f43390565b60008360200151116122a65760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a20616d6f756e74496e206d757374206265203e203000000060448201526064016102a0565b60e08301516001600160a01b031661230b5760405162461bcd60e51b815260206004820152602260248201527f536f756c5a61703a2043616e2774207a617020746f206e756c6c206164647265604482015261737360f01b60648201526084016102a0565b60c0830151516001600160a01b03166123775760405162461bcd60e51b815260206004820152602860248201527f536f756c5a61703a206c7020726f757465722063616e206e6f74206265206164604482015267647265737328302960c01b60648201526084016102a0565b60408301516001600160a01b03166123df5760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e302063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b60608301516001600160a01b03166124475760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e312063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b82516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561249b576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001684525b6124db6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b821561250f576124fa856000015186602001518688610100015161372e565b8560200181815161250b9190614ebe565b9052505b600060c086015160200151801561252857612528614f18565b036126bd5760006001600160a01b03168560c00151600001516001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561257e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a29190614efb565b604080880151606089015191517fe6a439050000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201529181166024830152919091169063e6a4390590604401602060405180830381865afa158015612615573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126399190614efb565b6001600160a01b03160361268f5760405162461bcd60e51b815260206004820152601b60248201527f536f756c5a61703a205061697220646f65736e2774206578697374000000000060448201526064016102a0565b600285602001516126a09190615042565b815260208501516126b390600290615042565b6020820152612705565b60405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a204c5054797065206e6f7420737570706f7274656400000060448201526064016102a0565b84600001516001600160a01b031685604001516001600160a01b0316146128f4576080850151516001600160a01b03166127945760405162461bcd60e51b815260206004820152602a60248201527f536f756c5a61703a207377617020726f757465722063616e206e6f74206265206044820152696164647265737328302960b01b60648201526084016102a0565b84600001516001600160a01b03168560800151604001516000815181106127bd576127bd614dcf565b60200260200101516001600160a01b03161461281b5760405162461bcd60e51b815260206004820152601c60248201527f536f756c5a61703a2077726f6e6720706174682070617468305b305d0000000060448201526064016102a0565b60408086015160808701519091015180516001600160a01b039092169161284490600190614ebe565b8151811061285457612854614dcf565b60200260200101516001600160a01b0316146128b25760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a2077726f6e6720706174682070617468305b2d315d00000060448201526064016102a0565b608085015151815186516128d1926001600160a01b0390911691613a1a565b6128ea8560800151826000015130886101000151613abe565b604082015261290e565b806020015185602001516129089190614ebe565b60408201525b84600001516001600160a01b031685606001516001600160a01b031614612aff5760a0850151516001600160a01b031661299d5760405162461bcd60e51b815260206004820152602a60248201527f536f756c5a61703a207377617020726f757465722063616e206e6f74206265206044820152696164647265737328302960b01b60648201526084016102a0565b84600001516001600160a01b03168560a00151604001516000815181106129c6576129c6614dcf565b60200260200101516001600160a01b031614612a245760405162461bcd60e51b815260206004820152601c60248201527f536f756c5a61703a2077726f6e6720706174682070617468315b305d0000000060448201526064016102a0565b606085015160a08601516040015180516001600160a01b0390921691612a4c90600190614ebe565b81518110612a5c57612a5c614dcf565b60200260200101516001600160a01b031614612aba5760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a2077726f6e6720706174682070617468315b2d315d00000060448201526064016102a0565b60a08501515160208201518651612adc926001600160a01b0390911691613a1a565b612af58560a00151826020015130886101000151613abe565b6060820152612b16565b80516020860151612b109190614ebe565b60608201525b60c08501515160408083015190870151612b3b926001600160a01b0390911691613a1a565b60c08501515160608083015190870151612b60926001600160a01b0390911691613a1a565b600060c0860151602001518015612b7957612b79614f18565b03612c7c5760c085015180516040808801516060808a0151868401518783015185880151939097015160e08d01516101008e015196517fe8e337000000000000000000000000000000000000000000000000000000000081526001600160a01b039687166004820152938616602485015260448401929092526064830197909752608482019290925260a4810195909552811660c485015260e4840191909152169063e8e3370090610104016060604051808303816000875af1158015612c44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c689190615056565b60c084015260a08301526080820152612cc4565b60405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a206c7054797065206e6f7420737570706f7274656400000060448201526064016102a0565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031685604001516001600160a01b031603612d4557612d2485606001518260a001518360600151612d1d9190614ebe565b3385613dfd565b612d40856040015182608001518360400151612d1d9190614ebe565b612d7d565b612d61856040015182608001518360400151612d1d9190614ebe565b612d7d85606001518260a001518360600151612d1d9190614ebe565b60c0850151516040860151612d9f916001600160a01b03909116906000613a1a565b60c0850151516060860151612dc1916001600160a01b03909116906000613a1a565b7f8e1dbffc2c04c9b0567968ef85f4ac2a2488fc8f387be763637e04a0f9217ca185604051612df09190615186565b60405180910390a15050505050565b6000846020015111612e535760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a20616d6f756e74496e206d757374206265203e203000000060448201526064016102a0565b60e08401516001600160a01b0316612eb85760405162461bcd60e51b815260206004820152602260248201527f536f756c5a61703a2043616e2774207a617020746f206e756c6c206164647265604482015261737360f01b60648201526084016102a0565b60c0840151516001600160a01b0316612f245760405162461bcd60e51b815260206004820152602860248201527f536f756c5a61703a206c7020726f757465722063616e206e6f74206265206164604482015267647265737328302960c01b60648201526084016102a0565b60408401516001600160a01b0316612f8c5760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e302063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b60608401516001600160a01b0316612ff45760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e312063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b6000826001600160a01b031663dbc162de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130589190614efb565b9050600061306584611650565b9050600060019050826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156130c7575060408051601f3d908101601f191682019092526130c491810190614efb565b60015b613101573d8080156130f5576040519150601f19603f3d011682016040523d82523d6000602084013e6130fa565b606091505b5050613107565b60009150505b600081156131cf576040805160c08101825289516001600160a01b0390811682526020808c0151908301528a83015181169282018390526080808c0151606084015260e08c01518216908301526101008b015160a08301529091908616146131b15760405162461bcd60e51b815260206004820152601d60248201527f417065426f6e643a2057726f6e6720746f6b656e20666f7220426f6e6400000060448201526064016102a0565b6080810180513090915291506131c981898615611c47565b50613456565b836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561320d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132319190614efb565b6001600160a01b031688604001516001600160a01b03161480156132cb5750836001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561328e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b29190614efb565b6001600160a01b031688606001516001600160a01b0316145b806133cd5750836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561330f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133339190614efb565b6001600160a01b031688606001516001600160a01b03161480156133cd5750836001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b49190614efb565b6001600160a01b031688604001516001600160a01b0316145b61343f5760405162461bcd60e51b815260206004820152602d60248201527f417065426f6e643a2057726f6e67204c5020626f6e645072696e636970616c5460448201527f6f6b656e20666f7220426f6e640000000000000000000000000000000000000060648201526084016102a0565b5060e0870180513090915261345688888515612252565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561349d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134c19190614e02565b90506134d76001600160a01b0386168883613a1a565b6040517f8dbdbe6d00000000000000000000000000000000000000000000000000000000815260048101829052602481018790526001600160a01b038381166044830152881690638dbdbe6d906064016020604051808303816000875af1158015613546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356a9190614e02565b506135806001600160a01b038616886000613a1a565b7f1368402a506ccc1c7ac016a83cb662991aec2765beef4d5442d8a98cad2344558988886040516135b393929190615199565b60405180910390a1505050505050505050565b60006005546008546135d891906151c7565b421015905090565b6000611a2d8383613f9b565b6000818152600183016020526040812054613633575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107d0565b5060006107d0565b6000818152600183016020526040812054801561372457600061365f600183614ebe565b855490915060009061367390600190614ebe565b90508181146136d857600086600001828154811061369357613693614dcf565b90600052602060002001549050808760000184815481106136b6576136b6614dcf565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806136e9576136e96151da565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107d0565b60009150506107d0565b60008060008061373c6106cf565b93509350935050826000036137575760009350505050613a12565b8161376284896151f0565b61376c9190615042565b935060028660400151511061397b57856040015160008151811061379257613792614dcf565b60200260200101516001600160a01b0316886001600160a01b0316146138205760405162461bcd60e51b815260206004820152602b60248201527f536f756c5a61703a20496e76616c696420696e70757420746f6b656e20696e2060448201527f666565537761705061746800000000000000000000000000000000000000000060648201526084016102a0565b604086015180516000919061383790600190614ebe565b8151811061384757613847614dcf565b6020908102919091010151600d546040516316ad82d760e01b81526001600160a01b038084166004830152929350610100909104909116906316ad82d790602401602060405180830381865afa1580156138a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138c99190614de5565b61393b5760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20496e76616c6964206f757470757420746f6b656e20696e60448201527f206665655377617050617468000000000000000000000000000000000000000060648201526084016102a0565b8651613952906001600160a01b038b169087613a1a565b60006139608887858a613abe565b905061397461396f8383613fc5565b613fd9565b5050613a0e565b6139888885836000613dfd565b600d546040516316ad82d760e01b81526001600160a01b038a81166004830152610100909204909116906316ad82d790602401602060405180830381865afa1580156139d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139fc9190614de5565b15613a0e57613a0e61396f8986613fc5565b5050505b949350505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663095ea7b360e01b179052613a808482614065565b6107bd576040516001600160a01b038416602482015260006044820152613ab490859063095ea7b360e01b90606401612159565b6107bd8482613cbd565b6000613acd85600001516107c3565b613b195760405162461bcd60e51b815260206004820152601f60248201527f536f756c5a61703a20726f75746572206e6f742077686974656c69737465640060448201526064016102a0565b60028560400151511015613b6f5760405162461bcd60e51b815260206004820152601a60248201527f536f756c5a61703a206e656564207061746830206f66203e3d3200000000000060448201526064016102a0565b6040850151805160009190613b8690600190614ebe565b81518110613b9657613b96614dcf565b602002602001015190506000613bac828661410c565b9050600060208801518015613bc357613bc3614f18565b03613c5557865160808801516040808a015190517f5c11d7950000000000000000000000000000000000000000000000000000000081526001600160a01b0390931692635c11d79592613c1e928b928b908b90600401615207565b600060405180830381600087803b158015613c3857600080fd5b505af1158015613c4c573d6000803e3d6000fd5b50505050613c9d565b60405162461bcd60e51b815260206004820152601f60248201527f536f756c5a61703a205377617054797065206e6f7420737570706f727465640060448201526064016102a0565b80613ca8838761410c565b613cb29190614ebe565b979650505050505050565b6000613d12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661417a9092919063ffffffff16565b9050805160001480613d33575080806020019051810190613d339190614de5565b61087d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016102a0565b600a5462010000900460ff16611ba45760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016102a0565b82156107bd577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316148015613e415750805b15613f87576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015613ec157600080fd5b505af1158015613ed5573d6000803e3d6000fd5b505050506000826001600160a01b03168461132390604051600060405180830381858888f193505050503d8060008114613f2b576040519150601f19603f3d011682016040523d82523d6000602084013e613f30565b606091505b5050905080613f815760405162461bcd60e51b815260206004820152601560248201527f6e6174697665207472616e73666572206572726f72000000000000000000000060448201526064016102a0565b506107bd565b6107bd6001600160a01b0385168385614189565b6000826000018281548110613fb257613fb2614dcf565b9060005260206000200154905092915050565b6000611a2d82613fd4856141b9565b614229565b600954421015613fe65750565b613fee6135c6565b15613ffb57613ffb614291565b806006600082825461400d91906151c7565b909155505060065460075460085460408051858152602081019490945283019190915260608201527f31ad7dd187ed11599baf3412296f22f1c2a7783407ac9a8dddea680d6adb87c79060800160405180910390a150565b6000806000846001600160a01b0316846040516140829190615267565b6000604051808303816000865af19150503d80600081146140bf576040519150601f19603f3d011682016040523d82523d6000602084013e6140c4565b606091505b50915091508180156140ee5750805115806140ee5750808060200190518101906140ee9190614de5565b801561410357506001600160a01b0385163b15155b95945050505050565b6040516370a0823160e01b81526001600160a01b038281166004830152600091908416906370a0823190602401602060405180830381865afa158015614156573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2d9190614e02565b6060613a1284846000856142c0565b6040516001600160a01b03831660248201526044810182905261087d90849063a9059cbb60e01b90606401612159565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015614215575060408051601f3d908101601f1916820190925261421291810190615283565b60015b61422157506012919050565b90505b919050565b600060128260ff16111561425e576142426012836152a6565b61424d90600a6153a3565b6142579084615042565b90506107d0565b60128260ff16101561428a576142758260126152a6565b61428090600a6153a3565b61425790846151f0565b50816107d0565b6006546007556005546009546142a79042614ebe565b6142b19190614ee7565b6142bb9042614ebe565b600855565b6060824710156143385760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016102a0565b600080866001600160a01b031685876040516143549190615267565b60006040518083038185875af1925050503d8060008114614391576040519150601f19603f3d011682016040523d82523d6000602084013e614396565b606091505b5091509150613cb2878383876060831561441157825160000361440a576001600160a01b0385163b61440a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102a0565b5081613a12565b613a1283838151156144265781518083602001fd5b8060405162461bcd60e51b81526004016102a091906153b2565b600081518084526020808501945080840160005b838110156144795781516001600160a01b031687529582019590820190600101614454565b509495945050505050565b6080815260006144976080830187614440565b60208301959095525060408101929092526001600160a01b0316606090910152919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156144f5576144f56144bc565b60405290565b60405160a0810167ffffffffffffffff811182821017156144f5576144f56144bc565b60405160c0810167ffffffffffffffff811182821017156144f5576144f56144bc565b604051610120810167ffffffffffffffff811182821017156144f5576144f56144bc565b604051601f8201601f1916810167ffffffffffffffff8111828210171561458e5761458e6144bc565b604052919050565b600067ffffffffffffffff8211156145b0576145b06144bc565b5060051b60200190565b6001600160a01b03811681146110a257600080fd5b600082601f8301126145e057600080fd5b813560206145f56145f083614596565b614565565b828152600592831b850182019282820191908785111561461457600080fd5b8387015b858110156146f657803567ffffffffffffffff808211156146395760008081fd5b908901906040828c03601f19018113156146535760008081fd5b61465b6144d2565b88840135614668816145ba565b8152838201358381111561467c5760008081fd5b8085019450508c603f85011261469457600092508283fd5b8884013592506146a66145f084614596565b83815292861b8401820192898101908e8511156146c35760008081fd5b948301945b848610156146e15785358252948a0194908a01906146c8565b828b0152508752505050928401928401614618565b5090979650505050505050565b8035614224816145ba565b6000806040838503121561472157600080fd5b823567ffffffffffffffff81111561473857600080fd5b614744858286016145cf565b9250506020830135614755816145ba565b809150509250929050565b60006020828403121561477257600080fd5b8135611a2d816145ba565b80151581146110a257600080fd5b6000806040838503121561479e57600080fd5b82356147a9816145ba565b915060208301356147558161477d565b600082601f8301126147ca57600080fd5b813560206147da6145f083614596565b82815260059290921b840181019181810190868411156147f957600080fd5b8286015b8481101561481d578035614810816145ba565b83529183019183016147fd565b509695505050505050565b60008060006060848603121561483d57600080fd5b833567ffffffffffffffff8082111561485557600080fd5b614861878388016147b9565b9450602086013591508082111561487757600080fd5b50614884868287016145cf565b9250506040840135614895816145ba565b809150509250925092565b600181106110a257600080fd5b600082601f8301126148be57600080fd5b813560206148ce6145f083614596565b82815260059290921b840181019181810190868411156148ed57600080fd5b8286015b8481101561481d578035614904816145ba565b83529183019183016148f1565b600060a0828403121561492357600080fd5b61492b6144fb565b90508135614938816145ba565b81526020820135614948816148a0565b6020820152604082013567ffffffffffffffff81111561496757600080fd5b614973848285016148ad565b604083015250606082013560608201526080820135608082015292915050565b600080604083850312156149a657600080fd5b823567ffffffffffffffff808211156149be57600080fd5b9084019060c082870312156149d257600080fd5b6149da61451e565b82356149e5816145ba565b81526020838101359082015260408301356149ff816145ba565b6040820152606083013582811115614a1657600080fd5b614a2288828601614911565b6060830152506080830135614a36816145ba565b8060808301525060a083013560a0820152809450506020850135915080821115614a5f57600080fd5b50614a6c85828601614911565b9150509250929050565b60008060408385031215614a8957600080fd5b823567ffffffffffffffff811115614aa057600080fd5b614744858286016147b9565b600060a08284031215614abe57600080fd5b614ac66144fb565b90508135614ad3816145ba565b81526020820135614ae3816148a0565b8060208301525060408201356040820152606082013560608201526080820135608082015292915050565b60006101a08284031215614b2157600080fd5b614b29614541565b9050614b3482614703565b815260208201356020820152614b4c60408301614703565b6040820152614b5d60608301614703565b6060820152608082013567ffffffffffffffff80821115614b7d57600080fd5b614b8985838601614911565b608084015260a0840135915080821115614ba257600080fd5b50614baf84828501614911565b60a083015250614bc28360c08401614aac565b60c0820152614bd46101608301614703565b60e082015261018082013561010082015292915050565b60008060408385031215614bfe57600080fd5b823567ffffffffffffffff80821115614c1657600080fd5b614c2286838701614b0e565b93506020850135915080821115614a5f57600080fd5b60008060008060808587031215614c4e57600080fd5b843567ffffffffffffffff80821115614c6657600080fd5b614c7288838901614b0e565b95506020870135915080821115614c8857600080fd5b50614c9587828801614911565b9350506040850135614ca6816145ba565b9396929550929360600135925050565b600060208284031215614cc857600080fd5b813567ffffffffffffffff811115614cdf57600080fd5b613a12848285016148ad565b600060208284031215614cfd57600080fd5b5035919050565b8051614224816145ba565b60008060008060808587031215614d2557600080fd5b845167ffffffffffffffff811115614d3c57600080fd5b8501601f81018713614d4d57600080fd5b80516020614d5d6145f083614596565b82815260059290921b8301810191818101908a841115614d7c57600080fd5b938201935b83851015614da3578451614d94816145ba565b82529382019390820190614d81565b809850505080880151955050505060408501519150614dc460608601614d04565b905092959194509250565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614df757600080fd5b8151611a2d8161477d565b600060208284031215614e1457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600060018201614e4357614e43614e1b565b5060010190565b81516000908290602080860184805b84811015614eb157825180516001600160a01b031687528401518051908501908390868901905b80831015614ea05783518252928701926001929092019190870190614e80565b509750505091830191600101614e59565b5093979650505050505050565b818103818111156107d0576107d0614e1b565b634e487b7160e01b600052601260045260246000fd5b600082614ef657614ef6614ed1565b500690565b600060208284031215614f0d57600080fd5b8151611a2d816145ba565b634e487b7160e01b600052602160045260246000fd5b600181106110a257634e487b7160e01b600052602160045260246000fd5b600060a083016001600160a01b03808451168552602080850151614f6f81614f2e565b8682015260408581015160a09188019190915280519384905281019260009060c08801905b80831015614fb657855185168252948301946001929092019190830190614f94565b506060870151606089015260808701516080890152809550505050505092915050565b6020815260006001600160a01b0380845116602084015260208401516040840152806040850151166060840152606084015160c0608085015261501f60e0850182614f4c565b90508160808601511660a085015260a085015160c0850152809250505092915050565b60008261505157615051614ed1565b500490565b60008060006060848603121561506b57600080fd5b8351925060208401519150604084015190509250925092565b6001600160a01b038151168252602081015161509f81614f2e565b60208301526040818101519083015260608082015190830152608090810151910152565b80516001600160a01b0316825260006101a06020830151602085015260408301516150f960408601826001600160a01b03169052565b50606083015161511460608601826001600160a01b03169052565b50608083015181608086015261512c82860182614f4c565b91505060a083015184820360a08601526151468282614f4c565b91505060c083015161515b60c0860182615084565b5060e08301516001600160a01b03166101608501526101009092015161018090930192909252919050565b602081526000611a2d60208301846150c3565b6060815260006151ac60608301866150c3565b6001600160a01b039490941660208301525060400152919050565b808201808211156107d0576107d0614e1b565b634e487b7160e01b600052603160045260246000fd5b80820281158282048414176107d0576107d0614e1b565b85815284602082015260a06040820152600061522660a0830186614440565b6001600160a01b0394909416606083015250608001529392505050565b60005b8381101561525e578181015183820152602001615246565b50506000910152565b60008251615279818460208701615243565b9190910192915050565b60006020828403121561529557600080fd5b815160ff81168114611a2d57600080fd5b60ff82811682821603908111156107d0576107d0614e1b565b600181815b808511156152fa5781600019048211156152e0576152e0614e1b565b808516156152ed57918102915b93841c93908002906152c4565b509250929050565b600082615311575060016107d0565b8161531e575060006107d0565b8160018114615334576002811461533e5761535a565b60019150506107d0565b60ff84111561534f5761534f614e1b565b50506001821b6107d0565b5060208310610133831016604e8410600b841016171561537d575081810a6107d0565b61538783836152bf565b806000190482111561539b5761539b614e1b565b029392505050565b6000611a2d60ff841683615302565b60208152600082518060208401526153d1816040850160208701615243565b601f01601f1916919091016040019291505056fea2646970667358221220a4ff89f6dcb2d3245035c081f4be7d79f5139bed6339cec7d4b9627416b0687564736f6c634300081300330000000000000000000000002433594ac4736de4898e6cd1df74e1d301132b1c0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000fe50e927d74e6bc65cd07a9c68bb7b44cbff04660000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106102015760003560e01c80636b131ed21161011d5780639e01ec1d116100b0578063cc6fd8731161007f578063d911933011610064578063d91193301461066f578063e38659d01461068f578063fa1b0cc9146106af57600080fd5b8063cc6fd87314610647578063d3c277e71461065a57600080fd5b80639e01ec1d146105ca578063a45a0471146105dd578063b381cf40146105f3578063c1dacec81461062757600080fd5b806378c093cf116100ec57806378c093cf146105605780637b224339146105805780638456cb59146105a0578063927d9b2a146105b557600080fd5b80636b131ed2146104c45780637071f0c4146104e9578063728efc5f14610509578063732ea9711461051e57600080fd5b8063304f56dc116101955780635c975abb116101645780635c975abb146104295780635eb7413a1461044757806360d561da14610477578063637e2f43146104af57600080fd5b8063304f56dc146103c75780633066e0a0146103e75780633ca41611146103fa5780633f4ba83a1461041457600080fd5b806316ad82d7116101d157806316ad82d71461034e578063183260921461036e5780631ce5dc5a14610392578063299b5528146103b257600080fd5b806202eab7146102b05780630420aab1146102de5780630aef023f146102fe57806310693fcd1461032e57600080fd5b366102ab57336001600160a01b037f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127016146102a95760405162461bcd60e51b815260206004820152602260248201527f536f756c5a61703a204f6e6c7920726563656976652066726f6d20574e41544960448201527f564500000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b005b600080fd5b3480156102bc57600080fd5b506102c56106cf565b6040516102d59493929190614484565b60405180910390f35b3480156102ea57600080fd5b506102a96102f936600461470e565b610768565b34801561030a57600080fd5b5061031e610319366004614760565b6107c3565b60405190151581526020016102d5565b34801561033a57600080fd5b506102a9610349366004614760565b6107d6565b34801561035a57600080fd5b5061031e610369366004614760565b610882565b34801561037a57600080fd5b50610384600e5481565b6040519081526020016102d5565b34801561039e57600080fd5b506102a96103ad36600461478b565b6108f6565b3480156103be57600080fd5b50610384610aa7565b3480156103d357600080fd5b506102a96103e2366004614828565b610ab8565b6102a96103f5366004614993565b610ecd565b34801561040657600080fd5b50600d5461031e9060ff1681565b34801561042057600080fd5b506102a9611070565b34801561043557600080fd5b50600a5462010000900460ff1661031e565b34801561045357600080fd5b5061031e610462366004614760565b600c6020526000908152604090205460ff1681565b34801561048357600080fd5b50600054610497906001600160a01b031681565b6040516001600160a01b0390911681526020016102d5565b3480156104bb57600080fd5b506103846110a5565b3480156104d057600080fd5b50600d546104979061010090046001600160a01b031681565b3480156104f557600080fd5b506102a9610504366004614a76565b6110b1565b34801561051557600080fd5b506102a9611106565b34801561052a57600080fd5b5061053361115b565b604080519687526020870195909552938501929092526060840152608083015260a082015260c0016102d5565b34801561056c57600080fd5b506102a961057b366004614760565b611193565b34801561058c57600080fd5b506102a961059b36600461478b565b6112a1565b3480156105ac57600080fd5b506102a9611447565b3480156105c157600080fd5b50610384611479565b6102a96105d8366004614beb565b6114c4565b3480156105e957600080fd5b50610384600f5481565b3480156105ff57600080fd5b506104977f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127081565b34801561063357600080fd5b5061031e610642366004614760565b611650565b6102a9610655366004614c38565b6116bf565b34801561066657600080fd5b5061038461185e565b34801561067b57600080fd5b506102a961068a366004614cb6565b611883565b34801561069b57600080fd5b506104976106aa366004614ceb565b6118d4565b3480156106bb57600080fd5b506104976106ca366004614ceb565b611939565b600d546060906000908190819061010090046001600160a01b031663d45c267a6106f761185e565b6040518263ffffffff1660e01b815260040161071591815260200190565b600060405180830381865afa158015610732573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261075a9190810190614d0f565b929791965094509092509050565b7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc610793813361199e565b6107b05760405163224af60760e11b815260040160405180910390fd5b60606107bd818585610ab8565b50505050565b60006107d0600383611a34565b92915050565b7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc610801813361199e565b61081e5760405163224af60760e11b815260040160405180910390fd5b60408051600180825281830190925260009160208083019080368337019050509050828160008151811061085457610854614dcf565b60200260200101906001600160a01b031690816001600160a01b03168152505061087d81611a56565b505050565b600d546040516316ad82d760e01b81526001600160a01b038381166004830152600092610100900416906316ad82d790602401602060405180830381865afa1580156108d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d09190614de5565b60408051808201909152601381527f534f554c5f5a41505f41444d494e5f524f4c450000000000000000000000000060208201526109557f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc5b3361199e565b6109725760405163224af60760e11b815260040160405180910390fd5b8115610a1457610983600184611abe565b6109cf5760405162461bcd60e51b815260206004820152601b60248201527f426f6e644e667420616c72656164792077686974656c6973746564000000000060448201526064016102a0565b604051600181526001600160a01b038416907f2d9fd319ac1d77401938fc890b085975b59d44783507766c698f93fdfe89c244906020015b60405180910390a2505050565b610a1f600184611ad3565b610a6b5760405162461bcd60e51b815260206004820152601760248201527f426f6e644e6674206e6f742077686974656c697374656400000000000000000060448201526064016102a0565b604051600081526001600160a01b038416907f2d9fd319ac1d77401938fc890b085975b59d44783507766c698f93fdfe89c24490602001610a07565b6000610ab36003611ae8565b905090565b7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc610ae3813361199e565b610b005760405163224af60760e11b815260040160405180910390fd5b60005b8451811015610cde576000858281518110610b2057610b20614dcf565b6020908102919091018101516001600160a01b0381166000908152600c90925260409091205490915060ff1615610b995760405162461bcd60e51b815260206004820152601560248201527f546f6b656e732063616e2774206265207377657074000000000000000000000060448201526064016102a0565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190614e02565b60405163a9059cbb60e01b81526001600160a01b038781166004830152602482018390529192509083169063a9059cbb906044016020604051808303816000875af1158015610c57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7b9190614de5565b50816001600160a01b0316856001600160a01b03167f5bf76ef0db3550a96f76d3c13dfa002b5e1df9e4c4d65dce31f074c670b8b64883604051610cc191815260200190565b60405180910390a350508080610cd690614e31565b915050610b03565b5060005b8351811015610e7d576000848281518110610cff57610cff614dcf565b602090810291909101810151516001600160a01b0381166000908152600c90925260409091205490915060ff1615610d795760405162461bcd60e51b815260206004820152601560248201527f546f6b656e732063616e2774206265207377657074000000000000000000000060448201526064016102a0565b6000858381518110610d8d57610d8d614dcf565b602002602001015160200151905060005b8151811015610e6757826001600160a01b03166342842e0e3088858581518110610dca57610dca614dcf565b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015610e3c57600080fd5b505af1158015610e50573d6000803e3d6000fd5b505050508080610e5f90614e31565b915050610d9e565b5050508080610e7590614e31565b915050610ce2565b5082604051610e8c9190614e4a565b604051908190038120906001600160a01b038416907fb7d54fb67ddf621754e70da8666b8f260b9d90d503a96e15fdf8753d59af387790600090a350505050565b610ed5611af2565b610edd611b4b565b8151602083015173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610f80576000610f13611ba6565b915050808214610f7a5760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20616d6f756e74496e206e6f7420657175616c20746f207760448201526b1c985c1c1959105b5bdd5b9d60a21b60648201526084016102a0565b50610fce565b3415610fce5760405162461bcd60e51b815260206004820152601e60248201527f536f756c5a61703a206d73672e76616c75652073686f756c642062652030000060448201526064016102a0565b83516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed19016110055761100084846001611c47565b611060565b600061101485600001516120a1565b60208601518651919250611035916001600160a01b0316903390309061210c565b8061104386600001516120a1565b61104d9190614ebe565b602086015261105e85856001611c47565b505b505061106c6001600b55565b5050565b600e5461107d813361199e565b61109a5760405163224af60760e11b815260040160405180910390fd5b6110a26121bd565b50565b6000610ab36001611ae8565b7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc6110dc813361199e565b6110f95760405163224af60760e11b815260040160405180910390fd5b60606107bd848285610ab8565b7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc611131813361199e565b61114e5760405163224af60760e11b815260040160405180910390fd5b50600d805460ff19169055565b60008060008060008061116c61185e565b60065460075460085461117d611479565b600554949b939a50919850965094509092509050565b7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc6111be813361199e565b6111db5760405163224af60760e11b815260040160405180910390fd5b600d5460ff1661122d5760405162461bcd60e51b815260206004820152600b60248201527f4e6f7420616c6c6f77656400000000000000000000000000000000000000000060448201526064016102a0565b60405147906001600160a01b0384169082156108fc029083906000818181858888f19350505050158015611265573d6000803e3d6000fd5b50826001600160a01b03167fdc495bd3b5344fcb85ff9c1b44ebfd7d2d9ee001c0826360fdbc13665f9cb4ed82604051610a0791815260200190565b60408051808201909152601381527f534f554c5f5a41505f41444d494e5f524f4c450000000000000000000000000060208201526112fe7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc61094f565b61131b5760405163224af60760e11b815260040160405180910390fd5b81156113b45761132c600384611abe565b6113785760405162461bcd60e51b815260206004820152601a60248201527f526f7574657220616c72656164792077686974656c697374656400000000000060448201526064016102a0565b604051600181526001600160a01b038416907fcf2b36bf2aa8353623d06f58eab9577176d9214e588362c013a7eeb0586463f190602001610a07565b6113bf600384611ad3565b61140b5760405162461bcd60e51b815260206004820152601660248201527f526f75746572206e6f742077686974656c69737465640000000000000000000060448201526064016102a0565b604051600081526001600160a01b038416907fcf2b36bf2aa8353623d06f58eab9577176d9214e588362c013a7eeb0586463f190602001610a07565b600f54611454813361199e565b6114715760405163224af60760e11b815260040160405180910390fd5b6110a2612211565b600060095442101561148b5750600090565b60006009544261149b9190614ebe565b90506000600554826114ad9190614ee7565b9050806005546114bd9190614ebe565b9250505090565b6114cc611af2565b6114d4611b4b565b8151602083015173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b0383160161157757600061150a611ba6565b9150508082146115715760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20616d6f756e74496e206e6f7420657175616c20746f207760448201526b1c985c1c1959105b5bdd5b9d60a21b60648201526084016102a0565b506115c5565b34156115c55760405162461bcd60e51b815260206004820152601e60248201527f536f756c5a61703a206d73672e76616c75652073686f756c642062652030000060448201526064016102a0565b83516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed19016115f75761100084846001612252565b600061160685600001516120a1565b60208601518651919250611627916001600160a01b0316903390309061210c565b8061163586600001516120a1565b61163f9190614ebe565b602086015261105e85856001612252565b60006107d0826001600160a01b031663d3aac7746040518163ffffffff1660e01b8152600401602060405180830381865afa158015611693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b79190614efb565b600190611a34565b6116c7611af2565b6116cf611b4b565b8351602085015173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601611772576000611705611ba6565b91505080821461176c5760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20616d6f756e74496e206e6f7420657175616c20746f207760448201526b1c985c1c1959105b5bdd5b9d60a21b60648201526084016102a0565b506117c0565b34156117c05760405162461bcd60e51b815260206004820152601e60248201527f536f756c5a61703a206d73672e76616c75652073686f756c642062652030000060448201526064016102a0565b85516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed19016117f7576117f286868686612dff565b611852565b600061180687600001516120a1565b60208801518851919250611827916001600160a01b0316903390309061210c565b8061183588600001516120a1565b61183f9190614ebe565b602088015261185087878787612dff565b505b50506107bd6001600b55565b60006118686135c6565b156118735750600090565b600754600654610ab39190614ebe565b7f9162b82d28c4229191f5443c914283af7dcda1d12ad2f1c473f980eb39315edc6118ae813361199e565b6118cb5760405163224af60760e11b815260040160405180910390fd5b61106c82611a56565b60006118e06003611ae8565b821061192e5760405162461bcd60e51b815260206004820152601360248201527f496e646578206f7574206f6620626f756e64730000000000000000000000000060448201526064016102a0565b6107d06003836135e0565b60006119456001611ae8565b82106119935760405162461bcd60e51b815260206004820152601360248201527f496e646578206f7574206f6620626f756e64730000000000000000000000000060448201526064016102a0565b6107d06001836135e0565b600080546040517f91d14854000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b038481166024830152909116906391d1485490604401602060405180830381865afa158015611a09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2d9190614de5565b9392505050565b6001600160a01b03811660009081526001830160205260408120541515611a2d565b60005b815181101561106c576001600c6000848481518110611a7a57611a7a614dcf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580611ab681614e31565b915050611a59565b6000611a2d836001600160a01b0384166135ec565b6000611a2d836001600160a01b03841661363b565b60006107d0825490565b6002600b5403611b445760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102a0565b6002600b55565b600a5462010000900460ff1615611ba45760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016102a0565b565b6000807f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127091503490507f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12706001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c2a57600080fd5b505af1158015611c3e573d6000803e3d6000fd5b50505050509091565b6000836020015111611c9b5760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a20616d6f756e74496e206d757374206265203e203000000060448201526064016102a0565b60808301516001600160a01b0316611d1b5760405162461bcd60e51b815260206004820152602360248201527f536f756c5a61703a2043616e2774207377617020746f206e756c6c206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016102a0565b60408301516001600160a01b0316611d835760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e4f75742063616e2774206265206164647265604482015264737328302960d81b60648201526084016102a0565b82604001516001600160a01b031683600001516001600160a01b031603611e125760405162461bcd60e51b815260206004820152602160248201527f536f756c5a61703a20746f6b656e732063616e2774206265207468652073616d60448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016102a0565b82516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148015611e66576001600160a01b037f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12701684525b8115611e9957611e8484600001518560200151858760a0015161372e565b84602001818151611e959190614ebe565b9052505b6060840151516001600160a01b0316611f075760405162461bcd60e51b815260206004820152602a60248201527f536f756c5a61703a207377617020726f757465722063616e206e6f74206265206044820152696164647265737328302960b01b60648201526084016102a0565b83600001516001600160a01b0316846060015160400151600081518110611f3057611f30614dcf565b60200260200101516001600160a01b031614611f8e5760405162461bcd60e51b815260206004820152601b60248201527f536f756c5a61703a2077726f6e67207061746820706174685b305d000000000060448201526064016102a0565b60408085015160608601519091015180516001600160a01b0390921691611fb790600190614ebe565b81518110611fc757611fc7614dcf565b60200260200101516001600160a01b0316146120255760405162461bcd60e51b815260206004820152601c60248201527f536f756c5a61703a2077726f6e67207061746820706174685b2d315d0000000060448201526064016102a0565b60608401515160208501518551612047926001600160a01b0390911691613a1a565b6120638460600151856020015186608001518760a00151613abe565b507f8f6b93a35e02889ccab3af6294b788054d73dcb358d18b5df8a827adf615e1fa846040516120939190614fd9565b60405180910390a150505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156120e8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d09190614e02565b6040516001600160a01b03808516602483015283166044820152606481018290526107bd9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613cbd565b6121c5613da5565b600a805462ff0000191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b612219611b4b565b600a805462ff00001916620100001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121f43390565b60008360200151116122a65760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a20616d6f756e74496e206d757374206265203e203000000060448201526064016102a0565b60e08301516001600160a01b031661230b5760405162461bcd60e51b815260206004820152602260248201527f536f756c5a61703a2043616e2774207a617020746f206e756c6c206164647265604482015261737360f01b60648201526084016102a0565b60c0830151516001600160a01b03166123775760405162461bcd60e51b815260206004820152602860248201527f536f756c5a61703a206c7020726f757465722063616e206e6f74206265206164604482015267647265737328302960c01b60648201526084016102a0565b60408301516001600160a01b03166123df5760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e302063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b60608301516001600160a01b03166124475760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e312063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b82516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561249b576001600160a01b037f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12701684525b6124db6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b821561250f576124fa856000015186602001518688610100015161372e565b8560200181815161250b9190614ebe565b9052505b600060c086015160200151801561252857612528614f18565b036126bd5760006001600160a01b03168560c00151600001516001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561257e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a29190614efb565b604080880151606089015191517fe6a439050000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201529181166024830152919091169063e6a4390590604401602060405180830381865afa158015612615573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126399190614efb565b6001600160a01b03160361268f5760405162461bcd60e51b815260206004820152601b60248201527f536f756c5a61703a205061697220646f65736e2774206578697374000000000060448201526064016102a0565b600285602001516126a09190615042565b815260208501516126b390600290615042565b6020820152612705565b60405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a204c5054797065206e6f7420737570706f7274656400000060448201526064016102a0565b84600001516001600160a01b031685604001516001600160a01b0316146128f4576080850151516001600160a01b03166127945760405162461bcd60e51b815260206004820152602a60248201527f536f756c5a61703a207377617020726f757465722063616e206e6f74206265206044820152696164647265737328302960b01b60648201526084016102a0565b84600001516001600160a01b03168560800151604001516000815181106127bd576127bd614dcf565b60200260200101516001600160a01b03161461281b5760405162461bcd60e51b815260206004820152601c60248201527f536f756c5a61703a2077726f6e6720706174682070617468305b305d0000000060448201526064016102a0565b60408086015160808701519091015180516001600160a01b039092169161284490600190614ebe565b8151811061285457612854614dcf565b60200260200101516001600160a01b0316146128b25760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a2077726f6e6720706174682070617468305b2d315d00000060448201526064016102a0565b608085015151815186516128d1926001600160a01b0390911691613a1a565b6128ea8560800151826000015130886101000151613abe565b604082015261290e565b806020015185602001516129089190614ebe565b60408201525b84600001516001600160a01b031685606001516001600160a01b031614612aff5760a0850151516001600160a01b031661299d5760405162461bcd60e51b815260206004820152602a60248201527f536f756c5a61703a207377617020726f757465722063616e206e6f74206265206044820152696164647265737328302960b01b60648201526084016102a0565b84600001516001600160a01b03168560a00151604001516000815181106129c6576129c6614dcf565b60200260200101516001600160a01b031614612a245760405162461bcd60e51b815260206004820152601c60248201527f536f756c5a61703a2077726f6e6720706174682070617468315b305d0000000060448201526064016102a0565b606085015160a08601516040015180516001600160a01b0390921691612a4c90600190614ebe565b81518110612a5c57612a5c614dcf565b60200260200101516001600160a01b031614612aba5760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a2077726f6e6720706174682070617468315b2d315d00000060448201526064016102a0565b60a08501515160208201518651612adc926001600160a01b0390911691613a1a565b612af58560a00151826020015130886101000151613abe565b6060820152612b16565b80516020860151612b109190614ebe565b60608201525b60c08501515160408083015190870151612b3b926001600160a01b0390911691613a1a565b60c08501515160608083015190870151612b60926001600160a01b0390911691613a1a565b600060c0860151602001518015612b7957612b79614f18565b03612c7c5760c085015180516040808801516060808a0151868401518783015185880151939097015160e08d01516101008e015196517fe8e337000000000000000000000000000000000000000000000000000000000081526001600160a01b039687166004820152938616602485015260448401929092526064830197909752608482019290925260a4810195909552811660c485015260e4840191909152169063e8e3370090610104016060604051808303816000875af1158015612c44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c689190615056565b60c084015260a08301526080820152612cc4565b60405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a206c7054797065206e6f7420737570706f7274656400000060448201526064016102a0565b7f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12706001600160a01b031685604001516001600160a01b031603612d4557612d2485606001518260a001518360600151612d1d9190614ebe565b3385613dfd565b612d40856040015182608001518360400151612d1d9190614ebe565b612d7d565b612d61856040015182608001518360400151612d1d9190614ebe565b612d7d85606001518260a001518360600151612d1d9190614ebe565b60c0850151516040860151612d9f916001600160a01b03909116906000613a1a565b60c0850151516060860151612dc1916001600160a01b03909116906000613a1a565b7f8e1dbffc2c04c9b0567968ef85f4ac2a2488fc8f387be763637e04a0f9217ca185604051612df09190615186565b60405180910390a15050505050565b6000846020015111612e535760405162461bcd60e51b815260206004820152601d60248201527f536f756c5a61703a20616d6f756e74496e206d757374206265203e203000000060448201526064016102a0565b60e08401516001600160a01b0316612eb85760405162461bcd60e51b815260206004820152602260248201527f536f756c5a61703a2043616e2774207a617020746f206e756c6c206164647265604482015261737360f01b60648201526084016102a0565b60c0840151516001600160a01b0316612f245760405162461bcd60e51b815260206004820152602860248201527f536f756c5a61703a206c7020726f757465722063616e206e6f74206265206164604482015267647265737328302960c01b60648201526084016102a0565b60408401516001600160a01b0316612f8c5760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e302063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b60608401516001600160a01b0316612ff45760405162461bcd60e51b815260206004820152602560248201527f536f756c5a61703a20746f6b656e312063616e206e6f74206265206164647265604482015264737328302960d81b60648201526084016102a0565b6000826001600160a01b031663dbc162de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130589190614efb565b9050600061306584611650565b9050600060019050826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156130c7575060408051601f3d908101601f191682019092526130c491810190614efb565b60015b613101573d8080156130f5576040519150601f19603f3d011682016040523d82523d6000602084013e6130fa565b606091505b5050613107565b60009150505b600081156131cf576040805160c08101825289516001600160a01b0390811682526020808c0151908301528a83015181169282018390526080808c0151606084015260e08c01518216908301526101008b015160a08301529091908616146131b15760405162461bcd60e51b815260206004820152601d60248201527f417065426f6e643a2057726f6e6720746f6b656e20666f7220426f6e6400000060448201526064016102a0565b6080810180513090915291506131c981898615611c47565b50613456565b836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561320d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132319190614efb565b6001600160a01b031688604001516001600160a01b03161480156132cb5750836001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561328e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b29190614efb565b6001600160a01b031688606001516001600160a01b0316145b806133cd5750836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561330f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133339190614efb565b6001600160a01b031688606001516001600160a01b03161480156133cd5750836001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b49190614efb565b6001600160a01b031688604001516001600160a01b0316145b61343f5760405162461bcd60e51b815260206004820152602d60248201527f417065426f6e643a2057726f6e67204c5020626f6e645072696e636970616c5460448201527f6f6b656e20666f7220426f6e640000000000000000000000000000000000000060648201526084016102a0565b5060e0870180513090915261345688888515612252565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561349d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134c19190614e02565b90506134d76001600160a01b0386168883613a1a565b6040517f8dbdbe6d00000000000000000000000000000000000000000000000000000000815260048101829052602481018790526001600160a01b038381166044830152881690638dbdbe6d906064016020604051808303816000875af1158015613546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061356a9190614e02565b506135806001600160a01b038616886000613a1a565b7f1368402a506ccc1c7ac016a83cb662991aec2765beef4d5442d8a98cad2344558988886040516135b393929190615199565b60405180910390a1505050505050505050565b60006005546008546135d891906151c7565b421015905090565b6000611a2d8383613f9b565b6000818152600183016020526040812054613633575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107d0565b5060006107d0565b6000818152600183016020526040812054801561372457600061365f600183614ebe565b855490915060009061367390600190614ebe565b90508181146136d857600086600001828154811061369357613693614dcf565b90600052602060002001549050808760000184815481106136b6576136b6614dcf565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806136e9576136e96151da565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107d0565b60009150506107d0565b60008060008061373c6106cf565b93509350935050826000036137575760009350505050613a12565b8161376284896151f0565b61376c9190615042565b935060028660400151511061397b57856040015160008151811061379257613792614dcf565b60200260200101516001600160a01b0316886001600160a01b0316146138205760405162461bcd60e51b815260206004820152602b60248201527f536f756c5a61703a20496e76616c696420696e70757420746f6b656e20696e2060448201527f666565537761705061746800000000000000000000000000000000000000000060648201526084016102a0565b604086015180516000919061383790600190614ebe565b8151811061384757613847614dcf565b6020908102919091010151600d546040516316ad82d760e01b81526001600160a01b038084166004830152929350610100909104909116906316ad82d790602401602060405180830381865afa1580156138a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138c99190614de5565b61393b5760405162461bcd60e51b815260206004820152602c60248201527f536f756c5a61703a20496e76616c6964206f757470757420746f6b656e20696e60448201527f206665655377617050617468000000000000000000000000000000000000000060648201526084016102a0565b8651613952906001600160a01b038b169087613a1a565b60006139608887858a613abe565b905061397461396f8383613fc5565b613fd9565b5050613a0e565b6139888885836000613dfd565b600d546040516316ad82d760e01b81526001600160a01b038a81166004830152610100909204909116906316ad82d790602401602060405180830381865afa1580156139d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139fc9190614de5565b15613a0e57613a0e61396f8986613fc5565b5050505b949350505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663095ea7b360e01b179052613a808482614065565b6107bd576040516001600160a01b038416602482015260006044820152613ab490859063095ea7b360e01b90606401612159565b6107bd8482613cbd565b6000613acd85600001516107c3565b613b195760405162461bcd60e51b815260206004820152601f60248201527f536f756c5a61703a20726f75746572206e6f742077686974656c69737465640060448201526064016102a0565b60028560400151511015613b6f5760405162461bcd60e51b815260206004820152601a60248201527f536f756c5a61703a206e656564207061746830206f66203e3d3200000000000060448201526064016102a0565b6040850151805160009190613b8690600190614ebe565b81518110613b9657613b96614dcf565b602002602001015190506000613bac828661410c565b9050600060208801518015613bc357613bc3614f18565b03613c5557865160808801516040808a015190517f5c11d7950000000000000000000000000000000000000000000000000000000081526001600160a01b0390931692635c11d79592613c1e928b928b908b90600401615207565b600060405180830381600087803b158015613c3857600080fd5b505af1158015613c4c573d6000803e3d6000fd5b50505050613c9d565b60405162461bcd60e51b815260206004820152601f60248201527f536f756c5a61703a205377617054797065206e6f7420737570706f727465640060448201526064016102a0565b80613ca8838761410c565b613cb29190614ebe565b979650505050505050565b6000613d12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661417a9092919063ffffffff16565b9050805160001480613d33575080806020019051810190613d339190614de5565b61087d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016102a0565b600a5462010000900460ff16611ba45760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016102a0565b82156107bd577f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12706001600160a01b0316846001600160a01b0316148015613e415750805b15613f87576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490527f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12706001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015613ec157600080fd5b505af1158015613ed5573d6000803e3d6000fd5b505050506000826001600160a01b03168461132390604051600060405180830381858888f193505050503d8060008114613f2b576040519150601f19603f3d011682016040523d82523d6000602084013e613f30565b606091505b5050905080613f815760405162461bcd60e51b815260206004820152601560248201527f6e6174697665207472616e73666572206572726f72000000000000000000000060448201526064016102a0565b506107bd565b6107bd6001600160a01b0385168385614189565b6000826000018281548110613fb257613fb2614dcf565b9060005260206000200154905092915050565b6000611a2d82613fd4856141b9565b614229565b600954421015613fe65750565b613fee6135c6565b15613ffb57613ffb614291565b806006600082825461400d91906151c7565b909155505060065460075460085460408051858152602081019490945283019190915260608201527f31ad7dd187ed11599baf3412296f22f1c2a7783407ac9a8dddea680d6adb87c79060800160405180910390a150565b6000806000846001600160a01b0316846040516140829190615267565b6000604051808303816000865af19150503d80600081146140bf576040519150601f19603f3d011682016040523d82523d6000602084013e6140c4565b606091505b50915091508180156140ee5750805115806140ee5750808060200190518101906140ee9190614de5565b801561410357506001600160a01b0385163b15155b95945050505050565b6040516370a0823160e01b81526001600160a01b038281166004830152600091908416906370a0823190602401602060405180830381865afa158015614156573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2d9190614e02565b6060613a1284846000856142c0565b6040516001600160a01b03831660248201526044810182905261087d90849063a9059cbb60e01b90606401612159565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015614215575060408051601f3d908101601f1916820190925261421291810190615283565b60015b61422157506012919050565b90505b919050565b600060128260ff16111561425e576142426012836152a6565b61424d90600a6153a3565b6142579084615042565b90506107d0565b60128260ff16101561428a576142758260126152a6565b61428090600a6153a3565b61425790846151f0565b50816107d0565b6006546007556005546009546142a79042614ebe565b6142b19190614ee7565b6142bb9042614ebe565b600855565b6060824710156143385760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016102a0565b600080866001600160a01b031685876040516143549190615267565b60006040518083038185875af1925050503d8060008114614391576040519150601f19603f3d011682016040523d82523d6000602084013e614396565b606091505b5091509150613cb2878383876060831561441157825160000361440a576001600160a01b0385163b61440a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102a0565b5081613a12565b613a1283838151156144265781518083602001fd5b8060405162461bcd60e51b81526004016102a091906153b2565b600081518084526020808501945080840160005b838110156144795781516001600160a01b031687529582019590820190600101614454565b509495945050505050565b6080815260006144976080830187614440565b60208301959095525060408101929092526001600160a01b0316606090910152919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156144f5576144f56144bc565b60405290565b60405160a0810167ffffffffffffffff811182821017156144f5576144f56144bc565b60405160c0810167ffffffffffffffff811182821017156144f5576144f56144bc565b604051610120810167ffffffffffffffff811182821017156144f5576144f56144bc565b604051601f8201601f1916810167ffffffffffffffff8111828210171561458e5761458e6144bc565b604052919050565b600067ffffffffffffffff8211156145b0576145b06144bc565b5060051b60200190565b6001600160a01b03811681146110a257600080fd5b600082601f8301126145e057600080fd5b813560206145f56145f083614596565b614565565b828152600592831b850182019282820191908785111561461457600080fd5b8387015b858110156146f657803567ffffffffffffffff808211156146395760008081fd5b908901906040828c03601f19018113156146535760008081fd5b61465b6144d2565b88840135614668816145ba565b8152838201358381111561467c5760008081fd5b8085019450508c603f85011261469457600092508283fd5b8884013592506146a66145f084614596565b83815292861b8401820192898101908e8511156146c35760008081fd5b948301945b848610156146e15785358252948a0194908a01906146c8565b828b0152508752505050928401928401614618565b5090979650505050505050565b8035614224816145ba565b6000806040838503121561472157600080fd5b823567ffffffffffffffff81111561473857600080fd5b614744858286016145cf565b9250506020830135614755816145ba565b809150509250929050565b60006020828403121561477257600080fd5b8135611a2d816145ba565b80151581146110a257600080fd5b6000806040838503121561479e57600080fd5b82356147a9816145ba565b915060208301356147558161477d565b600082601f8301126147ca57600080fd5b813560206147da6145f083614596565b82815260059290921b840181019181810190868411156147f957600080fd5b8286015b8481101561481d578035614810816145ba565b83529183019183016147fd565b509695505050505050565b60008060006060848603121561483d57600080fd5b833567ffffffffffffffff8082111561485557600080fd5b614861878388016147b9565b9450602086013591508082111561487757600080fd5b50614884868287016145cf565b9250506040840135614895816145ba565b809150509250925092565b600181106110a257600080fd5b600082601f8301126148be57600080fd5b813560206148ce6145f083614596565b82815260059290921b840181019181810190868411156148ed57600080fd5b8286015b8481101561481d578035614904816145ba565b83529183019183016148f1565b600060a0828403121561492357600080fd5b61492b6144fb565b90508135614938816145ba565b81526020820135614948816148a0565b6020820152604082013567ffffffffffffffff81111561496757600080fd5b614973848285016148ad565b604083015250606082013560608201526080820135608082015292915050565b600080604083850312156149a657600080fd5b823567ffffffffffffffff808211156149be57600080fd5b9084019060c082870312156149d257600080fd5b6149da61451e565b82356149e5816145ba565b81526020838101359082015260408301356149ff816145ba565b6040820152606083013582811115614a1657600080fd5b614a2288828601614911565b6060830152506080830135614a36816145ba565b8060808301525060a083013560a0820152809450506020850135915080821115614a5f57600080fd5b50614a6c85828601614911565b9150509250929050565b60008060408385031215614a8957600080fd5b823567ffffffffffffffff811115614aa057600080fd5b614744858286016147b9565b600060a08284031215614abe57600080fd5b614ac66144fb565b90508135614ad3816145ba565b81526020820135614ae3816148a0565b8060208301525060408201356040820152606082013560608201526080820135608082015292915050565b60006101a08284031215614b2157600080fd5b614b29614541565b9050614b3482614703565b815260208201356020820152614b4c60408301614703565b6040820152614b5d60608301614703565b6060820152608082013567ffffffffffffffff80821115614b7d57600080fd5b614b8985838601614911565b608084015260a0840135915080821115614ba257600080fd5b50614baf84828501614911565b60a083015250614bc28360c08401614aac565b60c0820152614bd46101608301614703565b60e082015261018082013561010082015292915050565b60008060408385031215614bfe57600080fd5b823567ffffffffffffffff80821115614c1657600080fd5b614c2286838701614b0e565b93506020850135915080821115614a5f57600080fd5b60008060008060808587031215614c4e57600080fd5b843567ffffffffffffffff80821115614c6657600080fd5b614c7288838901614b0e565b95506020870135915080821115614c8857600080fd5b50614c9587828801614911565b9350506040850135614ca6816145ba565b9396929550929360600135925050565b600060208284031215614cc857600080fd5b813567ffffffffffffffff811115614cdf57600080fd5b613a12848285016148ad565b600060208284031215614cfd57600080fd5b5035919050565b8051614224816145ba565b60008060008060808587031215614d2557600080fd5b845167ffffffffffffffff811115614d3c57600080fd5b8501601f81018713614d4d57600080fd5b80516020614d5d6145f083614596565b82815260059290921b8301810191818101908a841115614d7c57600080fd5b938201935b83851015614da3578451614d94816145ba565b82529382019390820190614d81565b809850505080880151955050505060408501519150614dc460608601614d04565b905092959194509250565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614df757600080fd5b8151611a2d8161477d565b600060208284031215614e1457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600060018201614e4357614e43614e1b565b5060010190565b81516000908290602080860184805b84811015614eb157825180516001600160a01b031687528401518051908501908390868901905b80831015614ea05783518252928701926001929092019190870190614e80565b509750505091830191600101614e59565b5093979650505050505050565b818103818111156107d0576107d0614e1b565b634e487b7160e01b600052601260045260246000fd5b600082614ef657614ef6614ed1565b500690565b600060208284031215614f0d57600080fd5b8151611a2d816145ba565b634e487b7160e01b600052602160045260246000fd5b600181106110a257634e487b7160e01b600052602160045260246000fd5b600060a083016001600160a01b03808451168552602080850151614f6f81614f2e565b8682015260408581015160a09188019190915280519384905281019260009060c08801905b80831015614fb657855185168252948301946001929092019190830190614f94565b506060870151606089015260808701516080890152809550505050505092915050565b6020815260006001600160a01b0380845116602084015260208401516040840152806040850151166060840152606084015160c0608085015261501f60e0850182614f4c565b90508160808601511660a085015260a085015160c0850152809250505092915050565b60008261505157615051614ed1565b500490565b60008060006060848603121561506b57600080fd5b8351925060208401519150604084015190509250925092565b6001600160a01b038151168252602081015161509f81614f2e565b60208301526040818101519083015260608082015190830152608090810151910152565b80516001600160a01b0316825260006101a06020830151602085015260408301516150f960408601826001600160a01b03169052565b50606083015161511460608601826001600160a01b03169052565b50608083015181608086015261512c82860182614f4c565b91505060a083015184820360a08601526151468282614f4c565b91505060c083015161515b60c0860182615084565b5060e08301516001600160a01b03166101608501526101009092015161018090930192909252919050565b602081526000611a2d60208301846150c3565b6060815260006151ac60608301866150c3565b6001600160a01b039490941660208301525060400152919050565b808201808211156107d0576107d0614e1b565b634e487b7160e01b600052603160045260246000fd5b80820281158282048414176107d0576107d0614e1b565b85815284602082015260a06040820152600061522660a0830186614440565b6001600160a01b0394909416606083015250608001529392505050565b60005b8381101561525e578181015183820152602001615246565b50506000910152565b60008251615279818460208701615243565b9190910192915050565b60006020828403121561529557600080fd5b815160ff81168114611a2d57600080fd5b60ff82811682821603908111156107d0576107d0614e1b565b600181815b808511156152fa5781600019048211156152e0576152e0614e1b565b808516156152ed57918102915b93841c93908002906152c4565b509250929050565b600082615311575060016107d0565b8161531e575060006107d0565b8160018114615334576002811461533e5761535a565b60019150506107d0565b60ff84111561534f5761534f614e1b565b50506001821b6107d0565b5060208310610133831016604e8410600b841016171561537d575081810a6107d0565b61538783836152bf565b806000190482111561539b5761539b614e1b565b029392505050565b6000611a2d60ff841683615302565b60208152600082518060208401526153d1816040850160208701615243565b601f01601f1916919091016040019291505056fea2646970667358221220a4ff89f6dcb2d3245035c081f4be7d79f5139bed6339cec7d4b9627416b0687564736f6c63430008130033

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

0000000000000000000000002433594ac4736de4898e6cd1df74e1d301132b1c0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000fe50e927d74e6bc65cd07a9c68bb7b44cbff04660000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _accessRegistry (address): 0x2433594aC4736DE4898e6cd1DF74e1d301132b1C
Arg [1] : _wnative (address): 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270
Arg [2] : _soulFeeManager (address): 0xFe50E927d74e6bc65cD07a9c68Bb7b44cbff0466
Arg [3] : _epochStartTime (uint256): 0

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000002433594ac4736de4898e6cd1df74e1d301132b1c
Arg [1] : 0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270
Arg [2] : 000000000000000000000000fe50e927d74e6bc65cd07a9c68bb7b44cbff0466
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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