ETH Price: $3,206.15 (+1.91%)
Gas: 7 Gwei

Contract

0x00aE9dA036b2Ff83bE756Bc8A77f3900bA878C89
 

Overview

ETH Balance

0.0103035 ETH

Eth Value

$33.03 (@ $3,206.15/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Buy Items Many T...164603822023-01-22 5:53:47456 days ago1674366827IN
0x00aE9dA0...0bA878C89
0.2637635 ETH0.0080228814.26825608
Buy Items Many T...161103632022-12-04 8:50:11505 days ago1670143811IN
0x00aE9dA0...0bA878C89
0.0151125 ETH0.0024321312.50450359
Buy Items Many T...154447362022-08-31 5:19:59600 days ago1661923199IN
0x00aE9dA0...0bA878C89
0.090675 ETH0.0032812412.10237463
Buy Items Many T...154372922022-08-30 0:31:25601 days ago1661819485IN
0x00aE9dA0...0bA878C89
0.147095 ETH0.0112736138.68403883
Buy Items Many T...154355582022-08-29 18:00:58602 days ago1661796058IN
0x00aE9dA0...0bA878C89
0.223665 ETH0.0085946521.95246366
Buy Items Many T...154336452022-08-29 10:43:35602 days ago1661769815IN
0x00aE9dA0...0bA878C89
0.0795925 ETH0.001785279.17762109
Buy Items Many T...154329782022-08-29 8:05:29602 days ago1661760329IN
0x00aE9dA0...0bA878C89
0.453375 ETH0.001012883.23361927
Buy Items Many T...154305832022-08-28 23:03:34602 days ago1661727814IN
0x00aE9dA0...0bA878C89
0.110825 ETH0.0043461120.23077054
Set Fee154060812022-08-25 0:38:44606 days ago1661387924IN
0x00aE9dA0...0bA878C89
0 ETH0.00034867.5628484
0x60806040154060592022-08-25 0:34:18606 days ago1661387658IN
 Create: TroveSmolSweeper
0 ETH0.040788218.35876426

Latest 17 internal transactions

Advanced mode:
Parent Transaction Hash Block From To Value
164603822023-01-22 5:53:47456 days ago1674366827
0x00aE9dA0...0bA878C89
0.07 ETH
164603822023-01-22 5:53:47456 days ago1674366827
0x00aE9dA0...0bA878C89
0.05 ETH
164603822023-01-22 5:53:47456 days ago1674366827
0x00aE9dA0...0bA878C89
0.0475 ETH
164603822023-01-22 5:53:47456 days ago1674366827
0x00aE9dA0...0bA878C89
0.0473 ETH
164603822023-01-22 5:53:47456 days ago1674366827
0x00aE9dA0...0bA878C89
0.047 ETH
161103632022-12-04 8:50:11505 days ago1670143811
0x00aE9dA0...0bA878C89
0.015 ETH
154447362022-08-31 5:19:59600 days ago1661923199
0x00aE9dA0...0bA878C89
0.045 ETH
154447362022-08-31 5:19:59600 days ago1661923199
0x00aE9dA0...0bA878C89
0.045 ETH
154372922022-08-30 0:31:25601 days ago1661819485
0x00aE9dA0...0bA878C89
0.073 ETH
154372922022-08-30 0:31:25601 days ago1661819485
0x00aE9dA0...0bA878C89
0.073 ETH
154355582022-08-29 18:00:58602 days ago1661796058
0x00aE9dA0...0bA878C89
0.074 ETH
154355582022-08-29 18:00:58602 days ago1661796058
0x00aE9dA0...0bA878C89
0.074 ETH
154355582022-08-29 18:00:58602 days ago1661796058
0x00aE9dA0...0bA878C89
0.074 ETH
154336452022-08-29 10:43:35602 days ago1661769815
0x00aE9dA0...0bA878C89
0.079 ETH
154329782022-08-29 8:05:29602 days ago1661760329
0x00aE9dA0...0bA878C89
0.15 ETH
154329782022-08-29 8:05:29602 days ago1661760329
0x00aE9dA0...0bA878C89
0.3 ETH
154305832022-08-28 23:03:34602 days ago1661727814
0x00aE9dA0...0bA878C89
0.11 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TroveSmolSweeper

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 24 : TroveSmolSweeper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

//           _____                    _____                   _______                   _____            _____                    _____                    _____                    _____
//          /\    \                  /\    \                 /::\    \                 /\    \          /\    \                  /\    \                  /\    \                  /\    \
//         /::\    \                /::\____\               /::::\    \               /::\____\        /::\    \                /::\____\                /::\    \                /::\    \
//        /::::\    \              /::::|   |              /::::::\    \             /:::/    /       /::::\    \              /:::/    /               /::::\    \              /::::\    \
//       /::::::\    \            /:::::|   |             /::::::::\    \           /:::/    /       /::::::\    \            /:::/   _/___            /::::::\    \            /::::::\    \
//      /:::/\:::\    \          /::::::|   |            /:::/~~\:::\    \         /:::/    /       /:::/\:::\    \          /:::/   /\    \          /:::/\:::\    \          /:::/\:::\    \
//     /:::/__\:::\    \        /:::/|::|   |           /:::/    \:::\    \       /:::/    /       /:::/__\:::\    \        /:::/   /::\____\        /:::/__\:::\    \        /:::/__\:::\    \
//     \:::\   \:::\    \      /:::/ |::|   |          /:::/    / \:::\    \     /:::/    /        \:::\   \:::\    \      /:::/   /:::/    /       /::::\   \:::\    \      /::::\   \:::\    \
//   ___\:::\   \:::\    \    /:::/  |::|___|______   /:::/____/   \:::\____\   /:::/    /       ___\:::\   \:::\    \    /:::/   /:::/   _/___    /::::::\   \:::\    \    /::::::\   \:::\    \
//  /\   \:::\   \:::\    \  /:::/   |::::::::\    \ |:::|    |     |:::|    | /:::/    /       /\   \:::\   \:::\    \  /:::/___/:::/   /\    \  /:::/\:::\   \:::\    \  /:::/\:::\   \:::\____\
// /::\   \:::\   \:::\____\/:::/    |:::::::::\____\|:::|____|     |:::|    |/:::/____/       /::\   \:::\   \:::\____\|:::|   /:::/   /::\____\/:::/  \:::\   \:::\____\/:::/  \:::\   \:::|    |
// \:::\   \:::\   \::/    /\::/    / ~~~~~/:::/    / \:::\    \   /:::/    / \:::\    \       \:::\   \:::\   \::/    /|:::|__/:::/   /:::/    /\::/    \:::\  /:::/    /\::/    \:::\  /:::|____|
//  \:::\   \:::\   \/____/  \/____/      /:::/    /   \:::\    \ /:::/    /   \:::\    \       \:::\   \:::\   \/____/  \:::\/:::/   /:::/    /  \/____/ \:::\/:::/    /  \/_____/\:::\/:::/    /
//   \:::\   \:::\    \                  /:::/    /     \:::\    /:::/    /     \:::\    \       \:::\   \:::\    \       \::::::/   /:::/    /            \::::::/    /            \::::::/    /
//    \:::\   \:::\____\                /:::/    /       \:::\__/:::/    /       \:::\    \       \:::\   \:::\____\       \::::/___/:::/    /              \::::/    /              \::::/    /
//     \:::\  /:::/    /               /:::/    /         \::::::::/    /         \:::\    \       \:::\  /:::/    /        \:::\__/:::/    /               /:::/    /                \::/____/
//      \:::\/:::/    /               /:::/    /           \::::::/    /           \:::\    \       \:::\/:::/    /          \::::::::/    /               /:::/    /                  ~~
//       \::::::/    /               /:::/    /             \::::/    /             \:::\    \       \::::::/    /            \::::::/    /               /:::/    /
//        \::::/    /               /:::/    /               \::/____/               \:::\____\       \::::/    /              \::::/    /               /:::/    /
//         \::/    /                \::/    /                 ~~                      \::/    /        \::/    /                \::/____/                \::/    /
//          \/____/                  \/____/                                           \/____/          \/____/                  ~~                       \/____/

import "./base/ABaseTroveSmolSweeper.sol";

contract TroveSmolSweeper is ABaseTroveSmolSweeper {
    constructor(
        address _troveMarketplace,
        address _defaultPaymentToken,
        address _weth
    ) ABaseTroveSmolSweeper(_troveMarketplace, _defaultPaymentToken, _weth) {}
}

File 3 of 24 : ABaseTroveSmolSweeper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

//           _____                    _____                   _______                   _____            _____                    _____                    _____                    _____
//          /\    \                  /\    \                 /::\    \                 /\    \          /\    \                  /\    \                  /\    \                  /\    \
//         /::\    \                /::\____\               /::::\    \               /::\____\        /::\    \                /::\____\                /::\    \                /::\    \
//        /::::\    \              /::::|   |              /::::::\    \             /:::/    /       /::::\    \              /:::/    /               /::::\    \              /::::\    \
//       /::::::\    \            /:::::|   |             /::::::::\    \           /:::/    /       /::::::\    \            /:::/   _/___            /::::::\    \            /::::::\    \
//      /:::/\:::\    \          /::::::|   |            /:::/~~\:::\    \         /:::/    /       /:::/\:::\    \          /:::/   /\    \          /:::/\:::\    \          /:::/\:::\    \
//     /:::/__\:::\    \        /:::/|::|   |           /:::/    \:::\    \       /:::/    /       /:::/__\:::\    \        /:::/   /::\____\        /:::/__\:::\    \        /:::/__\:::\    \
//     \:::\   \:::\    \      /:::/ |::|   |          /:::/    / \:::\    \     /:::/    /        \:::\   \:::\    \      /:::/   /:::/    /       /::::\   \:::\    \      /::::\   \:::\    \
//   ___\:::\   \:::\    \    /:::/  |::|___|______   /:::/____/   \:::\____\   /:::/    /       ___\:::\   \:::\    \    /:::/   /:::/   _/___    /::::::\   \:::\    \    /::::::\   \:::\    \
//  /\   \:::\   \:::\    \  /:::/   |::::::::\    \ |:::|    |     |:::|    | /:::/    /       /\   \:::\   \:::\    \  /:::/___/:::/   /\    \  /:::/\:::\   \:::\    \  /:::/\:::\   \:::\____\
// /::\   \:::\   \:::\____\/:::/    |:::::::::\____\|:::|____|     |:::|    |/:::/____/       /::\   \:::\   \:::\____\|:::|   /:::/   /::\____\/:::/  \:::\   \:::\____\/:::/  \:::\   \:::|    |
// \:::\   \:::\   \::/    /\::/    / ~~~~~/:::/    / \:::\    \   /:::/    / \:::\    \       \:::\   \:::\   \::/    /|:::|__/:::/   /:::/    /\::/    \:::\  /:::/    /\::/    \:::\  /:::|____|
//  \:::\   \:::\   \/____/  \/____/      /:::/    /   \:::\    \ /:::/    /   \:::\    \       \:::\   \:::\   \/____/  \:::\/:::/   /:::/    /  \/____/ \:::\/:::/    /  \/_____/\:::\/:::/    /
//   \:::\   \:::\    \                  /:::/    /     \:::\    /:::/    /     \:::\    \       \:::\   \:::\    \       \::::::/   /:::/    /            \::::::/    /            \::::::/    /
//    \:::\   \:::\____\                /:::/    /       \:::\__/:::/    /       \:::\    \       \:::\   \:::\____\       \::::/___/:::/    /              \::::/    /              \::::/    /
//     \:::\  /:::/    /               /:::/    /         \::::::::/    /         \:::\    \       \:::\  /:::/    /        \:::\__/:::/    /               /:::/    /                \::/____/
//      \:::\/:::/    /               /:::/    /           \::::::/    /           \:::\    \       \:::\/:::/    /          \::::::::/    /               /:::/    /                  ~~
//       \::::::/    /               /:::/    /             \::::/    /             \:::\    \       \::::::/    /            \::::::/    /               /:::/    /
//        \::::/    /               /:::/    /               \::/____/               \:::\____\       \::::/    /              \::::/    /               /:::/    /
//         \::/    /                \::/    /                 ~~                      \::/    /        \::/    /                \::/____/                \::/    /
//          \/____/                  \/____/                                           \/____/          \/____/                  ~~                       \/____/

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "../../token/ANFTReceiver.sol";
import "../libraries/SettingsBitFlag.sol";
import "../libraries/Math.sol";
import "../../treasure/interfaces/ITroveMarketplace.sol";
import "../structs/BuyOrder.sol";
import "../interfaces/ITroveSmolSweeper.sol";
import "./ABaseSmolSweeper.sol";

import "../errors/BuyError.sol";

// import "@utils/console.sol";

error InvalidMsgValue();
error MsgValueShouldBeZero();

// Ownable,
abstract contract ABaseTroveSmolSweeper is
    ReentrancyGuard,
    ABaseSmolSweeper,
    ITroveSmolSweeper
{
    using SafeERC20 for IERC20;

    bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd;
    bytes4 private constant INTERFACE_ID_ERC1155 = 0xd9b67a26;

    IERC20 public defaultPaymentToken;
    IERC20 public weth;
    ITroveMarketplace public troveMarketplace;

    constructor(
        address _troveMarketplace,
        address _defaultPaymentToken,
        address _weth
    ) {
        troveMarketplace = ITroveMarketplace(_troveMarketplace);
        defaultPaymentToken = IERC20(_defaultPaymentToken);
        weth = IERC20(_weth);
    }

    function setMarketplaceContract(ITroveMarketplace _troveMarketplace)
        external
        onlyOwner
    {
        troveMarketplace = _troveMarketplace;
    }

    function setDefaultPaymentToken(IERC20 _defaultPaymentToken)
        external
        onlyOwner
    {
        defaultPaymentToken = _defaultPaymentToken;
    }

    function setWeth(IERC20 _weth) external onlyOwner {
        weth = _weth;
    }

    function sumTotalPrice(BuyOrder[] memory _buyOrders)
        internal
        pure
        returns (uint256 totalPrice)
    {
        for (uint256 i = 0; i < _buyOrders.length; i++) {
            totalPrice +=
                _buyOrders[i].quantity *
                _buyOrders[i].maxPricePerItem;
        }
    }

    function tryBuyItem(
        BuyItemParams memory _buyOrder,
        uint16 _inputSettingsBitFlag,
        uint256 _maxSpendAllowanceLeft
    )
        internal
        returns (
            uint256 totalPrice,
            bool success,
            BuyError buyError
        )
    {
        uint256 quantityToBuy = _buyOrder.quantity;
        // check if the listing exists
        ITroveMarketplace.ListingOrBid memory listing = troveMarketplace
            .listings(_buyOrder.nftAddress, _buyOrder.tokenId, _buyOrder.owner);

        // // check if the price is correct
        // if (listing.pricePerItem > _buyOrder.maxPricePerItem) {
        //     // skip this item
        //     return (0, false, SettingsBitFlag.MAX_PRICE_PER_ITEM_EXCEEDED);
        // }

        // not enough listed items
        if (listing.quantity < quantityToBuy) {
            if (
                SettingsBitFlag.checkSetting(
                    _inputSettingsBitFlag,
                    SettingsBitFlag.INSUFFICIENT_QUANTITY_ERC1155
                )
            ) {
                // else buy all listed items even if it's less than requested
                quantityToBuy = listing.quantity;
            } else {
                // skip this item
                return (0, false, BuyError.INSUFFICIENT_QUANTITY_ERC1155);
            }
        }

        // check if total price is less than max spend allowance left
        if ((listing.pricePerItem * quantityToBuy) > _maxSpendAllowanceLeft) {
            return (0, false, BuyError.EXCEEDING_MAX_SPEND);
        }

        BuyItemParams[] memory buyItemParams = new BuyItemParams[](1);
        buyItemParams[0] = _buyOrder;

        uint256 totalSpent = 0;
        uint256 value = (_buyOrder.paymentToken == address(weth))
            ? (_buyOrder.maxPricePerItem * quantityToBuy)
            : 0;

        try troveMarketplace.buyItems{value: value}(buyItemParams) {
            if (
                SettingsBitFlag.checkSetting(
                    _inputSettingsBitFlag,
                    SettingsBitFlag.EMIT_SUCCESS_EVENT_LOGS
                )
            ) {
                emit SuccessBuyItem(
                    _buyOrder.nftAddress,
                    _buyOrder.tokenId,
                    _buyOrder.owner,
                    msg.sender,
                    quantityToBuy,
                    listing.pricePerItem
                );
            }

            if (
                IERC165(_buyOrder.nftAddress).supportsInterface(
                    INTERFACE_ID_ERC721
                )
            ) {
                IERC721(_buyOrder.nftAddress).safeTransferFrom(
                    address(this),
                    msg.sender,
                    _buyOrder.tokenId
                );
            } else if (
                IERC165(_buyOrder.nftAddress).supportsInterface(
                    INTERFACE_ID_ERC1155
                )
            ) {
                IERC1155(_buyOrder.nftAddress).safeTransferFrom(
                    address(this),
                    msg.sender,
                    _buyOrder.tokenId,
                    quantityToBuy,
                    ""
                );
            } else revert InvalidNFTAddress();

            totalSpent = listing.pricePerItem * quantityToBuy;
        } catch (bytes memory errorReason) {
            if (
                SettingsBitFlag.checkSetting(
                    _inputSettingsBitFlag,
                    SettingsBitFlag.EMIT_FAILURE_EVENT_LOGS
                )
            ) {
                emit CaughtFailureBuyItem(
                    _buyOrder.nftAddress,
                    _buyOrder.tokenId,
                    _buyOrder.owner,
                    msg.sender,
                    quantityToBuy,
                    listing.pricePerItem,
                    errorReason
                );
            }

            if (
                SettingsBitFlag.checkSetting(
                    _inputSettingsBitFlag,
                    SettingsBitFlag.MARKETPLACE_BUY_ITEM_REVERTED
                )
            ) revert FirstBuyReverted(errorReason);
            // skip this item
            return (0, false, BuyError.BUY_ITEM_REVERTED);
        }

        return (totalSpent, true, BuyError.NONE);
    }

    function buyItemsSingleToken(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address _inputTokenAddress,
        uint256 _maxSpendIncFees
    ) external payable {
        if (_inputTokenAddress == address(weth) && msg.value > 0) {
            if (_maxSpendIncFees != msg.value) revert InvalidMsgValue();
        } else {
            if (msg.value != 0) revert MsgValueShouldBeZero();
            // transfer payment tokens to this contract
            IERC20(_inputTokenAddress).safeTransferFrom(
                msg.sender,
                address(this),
                _maxSpendIncFees
            );
            IERC20(_inputTokenAddress).approve(
                address(troveMarketplace),
                _maxSpendIncFees
            );
        }

        (uint256 totalSpentAmount, uint256 successCount) = _buyItemsSingleToken(
            _buyOrders,
            _inputSettingsBitFlag,
            _maxSpendIncFees
        );

        // transfer back failed payment tokens to the buyer
        if (successCount == 0) revert AllReverted();

        uint256 feeAmount = _calculateFee(totalSpentAmount);

        if (_inputTokenAddress == address(weth) && _buyOrders[0].usingEth) {
            payable(msg.sender).transfer(
                _maxSpendIncFees - (totalSpentAmount + feeAmount)
            );
        } else {
            IERC20(_inputTokenAddress).safeTransfer(
                msg.sender,
                _maxSpendIncFees - (totalSpentAmount + feeAmount)
            );
        }
    }

    function _buyItemsSingleToken(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        uint256 _maxSpendIncFees
    ) internal returns (uint256 totalSpentAmount, uint256 successCount) {
        // buy all assets
        uint256 _maxSpendIncFees = _calculateAmountWithoutFees(
            _maxSpendIncFees
        );

        uint256 i = 0;
        uint256 length = _buyOrders.length;
        for (; i < length; ) {
            (
                uint256 spentAmount,
                bool spentSuccess,
                BuyError buyError
            ) = tryBuyItem(
                    _buyOrders[i],
                    _inputSettingsBitFlag,
                    _maxSpendIncFees - totalSpentAmount
                );

            if (spentSuccess) {
                totalSpentAmount += spentAmount;
                successCount++;
            } else {
                if (
                    buyError == BuyError.EXCEEDING_MAX_SPEND &&
                    SettingsBitFlag.checkSetting(
                        _inputSettingsBitFlag,
                        SettingsBitFlag.EXCEEDING_MAX_SPEND
                    )
                ) break;
            }

            unchecked {
                ++i;
            }
        }
    }

    function buyItemsManyTokens(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address[] calldata _inputTokenAddresses,
        uint256[] calldata _maxSpendIncFees
    ) external payable {
        // transfer payment tokens to this contract
        uint256 i = 0;
        uint256 length = _inputTokenAddresses.length;
        for (; i < length; ) {
            if (_inputTokenAddresses[i] == address(weth) && msg.value > 0) {
                if (_maxSpendIncFees[i] != msg.value) revert InvalidMsgValue();
            } else {
                // if (msg.value != 0) revert MsgValueShouldBeZero();
                // transfer payment tokens to this contract
                IERC20(_inputTokenAddresses[i]).safeTransferFrom(
                    msg.sender,
                    address(this),
                    _maxSpendIncFees[i]
                );
                IERC20(_inputTokenAddresses[i]).approve(
                    address(troveMarketplace),
                    _maxSpendIncFees[i]
                );
            }

            unchecked {
                ++i;
            }
        }

        uint256[] memory maxSpends = _maxSpendWithoutFees(_maxSpendIncFees);
        (
            uint256[] memory totalSpentAmount,
            uint256 successCount
        ) = _buyItemsManyTokens(
                _buyOrders,
                _inputSettingsBitFlag,
                _inputTokenAddresses,
                maxSpends
            );

        // transfer back failed payment tokens to the buyer
        if (successCount == 0) revert AllReverted();

        i = 0;
        for (; i < length; ) {
            uint256 feeAmount = _calculateFee(totalSpentAmount[i]);

            if (
                _inputTokenAddresses[i] == address(weth) &&
                _buyOrders[0].usingEth
            ) {
                payable(msg.sender).transfer(
                    _maxSpendIncFees[i] - (totalSpentAmount[i] + feeAmount)
                );
            } else {
                IERC20(_inputTokenAddresses[i]).safeTransfer(
                    msg.sender,
                    _maxSpendIncFees[i] - (totalSpentAmount[i] + feeAmount)
                );
            }

            unchecked {
                ++i;
            }
        }
    }

    function _buyItemsManyTokens(
        BuyItemParams[] memory _buyOrders,
        uint16 _inputSettingsBitFlag,
        address[] memory _inputTokenAddresses,
        uint256[] memory _maxSpends
    )
        internal
        returns (uint256[] memory totalSpentAmounts, uint256 successCount)
    {
        totalSpentAmounts = new uint256[](_inputTokenAddresses.length);
        // buy all assets
        for (uint256 i = 0; i < _buyOrders.length; ) {
            uint256 j = _getTokenIndex(
                _inputTokenAddresses,
                _buyOrders[i].paymentToken
            );
            (
                uint256 spentAmount,
                bool spentSuccess,
                BuyError buyError
            ) = tryBuyItem(
                    _buyOrders[i],
                    _inputSettingsBitFlag,
                    _maxSpends[j] - totalSpentAmounts[j]
                );

            if (spentSuccess) {
                totalSpentAmounts[j] += spentAmount;
                successCount++;
            } else {
                if (
                    buyError == BuyError.EXCEEDING_MAX_SPEND &&
                    SettingsBitFlag.checkSetting(
                        _inputSettingsBitFlag,
                        SettingsBitFlag.EXCEEDING_MAX_SPEND
                    )
                ) break;
            }
            unchecked {
                ++i;
            }
        }
    }

    function sweepItemsSingleToken(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address _inputTokenAddress,
        uint256 _maxSpendIncFees,
        uint256 _minSpend,
        uint32 _maxSuccesses,
        uint32 _maxFailures
    ) external payable {
        if (_inputTokenAddress == address(weth) && msg.value > 0) {
            if (_maxSpendIncFees != msg.value) revert InvalidMsgValue();
        } else {
            if (msg.value != 0) revert MsgValueShouldBeZero();
            // transfer payment tokens to this contract
            IERC20(_inputTokenAddress).safeTransferFrom(
                msg.sender,
                address(this),
                _maxSpendIncFees
            );
            IERC20(_inputTokenAddress).approve(
                address(troveMarketplace),
                _maxSpendIncFees
            );
        }

        (
            uint256 totalSpentAmount,
            uint256 successCount,

        ) = _sweepItemsSingleToken(
                _buyOrders,
                _inputSettingsBitFlag,
                _maxSpendIncFees,
                _minSpend,
                _maxSuccesses,
                _maxFailures
            );

        // transfer back failed payment tokens to the buyer
        if (successCount == 0) revert AllReverted();

        uint256 feeAmount = _calculateFee(totalSpentAmount);
        if (_inputTokenAddress == address(weth) && _buyOrders[0].usingEth) {
            payable(msg.sender).transfer(
                _maxSpendIncFees - (totalSpentAmount + feeAmount)
            );
        } else {
            IERC20(_inputTokenAddress).safeTransfer(
                msg.sender,
                _maxSpendIncFees - (totalSpentAmount + feeAmount)
            );
        }
    }

    function _sweepItemsSingleToken(
        BuyItemParams[] memory _buyOrders,
        uint16 _inputSettingsBitFlag,
        uint256 _maxSpendIncFees,
        uint256 _minSpend,
        uint32 _maxSuccesses,
        uint32 _maxFailures
    )
        internal
        returns (
            uint256 totalSpentAmount,
            uint256 successCount,
            uint256 failCount
        )
    {
        // buy all assets
        for (uint256 i = 0; i < _buyOrders.length; ) {
            if (successCount >= _maxSuccesses || failCount >= _maxFailures)
                break;

            if (totalSpentAmount >= _minSpend) break;

            (
                uint256 spentAmount,
                bool spentSuccess,
                BuyError buyError
            ) = tryBuyItem(
                    _buyOrders[i],
                    _inputSettingsBitFlag,
                    _maxSpendIncFees - totalSpentAmount
                );

            if (spentSuccess) {
                totalSpentAmount += spentAmount;
                successCount++;
            } else {
                if (
                    buyError == BuyError.EXCEEDING_MAX_SPEND &&
                    SettingsBitFlag.checkSetting(
                        _inputSettingsBitFlag,
                        SettingsBitFlag.EXCEEDING_MAX_SPEND
                    )
                ) break;
                failCount++;
            }

            unchecked {
                ++i;
            }
        }
    }

    function sweepItemsManyTokens(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address[] calldata _inputTokenAddresses,
        uint256[] calldata _maxSpendIncFees,
        uint256[] calldata _minSpends,
        uint32 _maxSuccesses,
        uint32 _maxFailures
    ) external payable {
        // transfer payment tokens to this contract
        for (uint256 i = 0; i < _maxSpendIncFees.length; ) {
            if (_inputTokenAddresses[i] == address(weth) && msg.value > 0) {
                if (_maxSpendIncFees[i] != msg.value) revert InvalidMsgValue();
            } else {
                // if (msg.value != 0) revert MsgValueShouldBeZero();
                // transfer payment tokens to this contract
                IERC20(_inputTokenAddresses[i]).safeTransferFrom(
                    msg.sender,
                    address(this),
                    _maxSpendIncFees[i]
                );
                IERC20(_inputTokenAddresses[i]).approve(
                    address(troveMarketplace),
                    _maxSpendIncFees[i]
                );
            }

            unchecked {
                ++i;
            }
        }

        uint256[] memory _maxSpendIncFeesAmount = _maxSpendWithoutFees(
            _maxSpendIncFees
        );

        (
            uint256[] memory totalSpentAmount,
            uint256 successCount,

        ) = _sweepItemsManyTokens(
                _buyOrders,
                _inputSettingsBitFlag,
                _inputTokenAddresses,
                _maxSpendIncFeesAmount,
                _minSpends,
                _maxSuccesses,
                _maxFailures
            );

        // transfer back failed payment tokens to the buyer
        if (successCount == 0) revert AllReverted();

        for (uint256 i = 0; i < _maxSpendIncFees.length; ) {
            uint256 feeAmount = _calculateFee(totalSpentAmount[i]);

            if (
                _inputTokenAddresses[i] == address(weth) &&
                _buyOrders[0].usingEth
            ) {
                payable(msg.sender).transfer(
                    _maxSpendIncFees[i] - (totalSpentAmount[i] + feeAmount)
                );
            } else {
                IERC20(_inputTokenAddresses[i]).safeTransfer(
                    msg.sender,
                    _maxSpendIncFees[i] - (totalSpentAmount[i] + feeAmount)
                );
            }

            unchecked {
                ++i;
            }
        }
    }

    function _sweepItemsManyTokens(
        BuyItemParams[] memory _buyOrders,
        uint16 _inputSettingsBitFlag,
        address[] memory _inputTokenAddresses,
        uint256[] memory _maxSpendIncFeesAmount,
        uint256[] memory _minSpends,
        uint32 _maxSuccesses,
        uint32 _maxFailures
    )
        internal
        returns (
            uint256[] memory totalSpentAmounts,
            uint256 successCount,
            uint256 failCount
        )
    {
        totalSpentAmounts = new uint256[](_inputTokenAddresses.length);

        for (uint256 i = 0; i < _buyOrders.length; ) {
            if (successCount >= _maxSuccesses || failCount >= _maxFailures)
                break;

            uint256 j = _getTokenIndex(
                _inputTokenAddresses,
                _buyOrders[i].paymentToken
            );

            if (totalSpentAmounts[j] >= _minSpends[j]) break;

            (
                uint256 spentAmount,
                bool spentSuccess,
                BuyError buyError
            ) = tryBuyItem(
                    _buyOrders[i],
                    _inputSettingsBitFlag,
                    _maxSpendIncFeesAmount[j] - totalSpentAmounts[j]
                );

            if (spentSuccess) {
                totalSpentAmounts[j] += spentAmount;
                successCount++;
            } else {
                if (
                    buyError == BuyError.EXCEEDING_MAX_SPEND &&
                    SettingsBitFlag.checkSetting(
                        _inputSettingsBitFlag,
                        SettingsBitFlag.EXCEEDING_MAX_SPEND
                    )
                ) break;
                failCount++;
            }
            unchecked {
                ++i;
            }
        }
    }

    function _maxSpendWithoutFees(uint256[] memory _maxSpendIncFees)
        internal
        view
        returns (uint256[] memory maxSpendIncFeesAmount)
    {
        maxSpendIncFeesAmount = new uint256[](_maxSpendIncFees.length);

        uint256 maxSpendLength = _maxSpendIncFees.length;
        for (uint256 i = 0; i < maxSpendLength; ) {
            maxSpendIncFeesAmount[i] = _calculateAmountWithoutFees(
                _maxSpendIncFees[i]
            );
            unchecked {
                ++i;
            }
        }
    }

    function _getTokenIndex(
        address[] memory _inputTokenAddresses,
        address _buyOrderPaymentToken
    ) internal returns (uint256 j) {
        for (; j < _inputTokenAddresses.length; ) {
            if (_inputTokenAddresses[j] == _buyOrderPaymentToken) {
                return j;
            }
            unchecked {
                ++j;
            }
        }
        revert("bad");
    }
}

File 4 of 24 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 6 of 24 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 7 of 24 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 8 of 24 : ANFTReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "../token/ERC1155/AERC1155Receiver.sol";

import "../token/ERC721/AERC721Receiver.sol";

abstract contract ANFTReceiver is AERC721Receiver, AERC1155Receiver {}

File 9 of 24 : SettingsBitFlag.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.11;

/**
 * @dev Settings for a buy order.
 */

library SettingsBitFlag {
    // default action is 0b00000000
    uint16 internal constant NONE = 0x00;

    // if marketplace fails to buy an item for some reason
    // default: will skip the item.
    // if 0x04 is set, will revert the entire buy transaction.
    uint16 internal constant MARKETPLACE_BUY_ITEM_REVERTED = 0x0001;

    // if the quantity of an item is less than the requested quantity (for ERC1155)
    // default: will skip the item.
    // if 0x02 is set, will buy as many items as possible (all listed items)
    uint16 internal constant INSUFFICIENT_QUANTITY_ERC1155 = 0x0002;

    // if total spend allowance is exceeded
    // default: will skip the item and continue.
    // if 0x08 is set, will skill the item and stop the transaction.
    uint16 internal constant EXCEEDING_MAX_SPEND = 0x0004;

    // refund in the input token
    // default: refunds in the payment token
    // if 0x10 is set, refunds in the input token
    uint16 internal constant REFUND_IN_INPUT_TOKEN = 0x0008;

    // turn on success event logging
    // default: will not log success events.
    // if 0x20 is set, will log success events.
    uint16 internal constant EMIT_SUCCESS_EVENT_LOGS = 0x000C;

    // turn on failure event logging
    // default: will not log failure events.
    // if 0x40 is set, will log failure events.
    uint16 internal constant EMIT_FAILURE_EVENT_LOGS = 0x0010;

    function checkSetting(uint16 _inputSettings, uint16 _settingBit)
        internal
        pure
        returns (bool)
    {
        return (_inputSettings & _settingBit) == _settingBit;
    }
}

File 10 of 24 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */

library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }
}

File 11 of 24 : ITroveMarketplace.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

/// @title  Treasure NFT marketplace
/// @notice This contract allows you to buy and sell NFTs from token contracts that are approved by the contract owner.
///         Please note that this contract is upgradeable. In the event of a compromised ProxyAdmin contract owner,
///         collectable tokens and payments may be at risk. To prevent this, the ProxyAdmin is owned by a multi-sig
///         governed by the TreasureDAO council.
/// @dev    This contract does not store any tokens at any time, it's only collects details "the sale" and approvals
///         from both parties and preforms non-custodial transaction by transfering NFT from owner to buying and payment
///         token from buying to NFT owner.
interface ITroveMarketplace {
    struct ListingOrBid {
        /// @dev number of tokens for sale or requested (1 if ERC-721 token is active for sale) (for bids, quantity for ERC-721 can be greater than 1)
        uint64 quantity;
        /// @dev price per token sold, i.e. extended sale price equals this times quantity purchased. For bids, price offered per item.
        uint128 pricePerItem;
        /// @dev timestamp after which the listing/bid is invalid
        uint64 expirationTime;
        /// @dev the payment token for this listing/bid.
        address paymentTokenAddress;
    }

    struct CollectionOwnerFee {
        /// @dev the fee, out of 10,000, that this collection owner will be given for each sale
        uint32 fee;
        /// @dev the recipient of the collection specific fee
        address recipient;
    }

    enum TokenApprovalStatus {
        NOT_APPROVED,
        ERC_721_APPROVED,
        ERC_1155_APPROVED
    }

    /// @notice TREASURE_MARKETPLACE_ADMIN_ROLE role hash
    function TREASURE_MARKETPLACE_ADMIN_ROLE() external pure returns (bytes32);

    /// @notice the denominator for portion calculation, i.e. how many basis points are in 100%
    function BASIS_POINTS() external pure returns (uint256);

    /// @notice the maximum fee which the owner may set (in units of basis points)
    function MAX_FEE() external pure returns (uint256);

    /// @notice the maximum fee which the collection owner may set
    function MAX_COLLECTION_FEE() external pure returns (uint256);

    /// @notice the minimum price for which any item can be sold=
    function MIN_PRICE() external pure returns (uint256);

    /// @notice the default token that is used for marketplace sales and fee payments. Can be overridden by collectionToTokenAddress.
    function paymentToken() external view returns (address);

    /// @notice fee portion (in basis points) for each sale, (e.g. a value of 100 is 100/10000 = 1%). This is the fee if no collection owner fee is set.
    function fee() external view returns (uint256);

    /// @notice address that receives fees
    function feeReceipient() external view returns (address);

    /// @notice mapping for listings, maps: nftAddress => tokenId => offeror
    function listings(
        address _nftAddress,
        uint256 _tokenId,
        address _offeror
    ) external view returns (ListingOrBid memory);

    /// @notice NFTs which the owner has approved to be sold on the marketplace, maps: nftAddress => status
    function tokenApprovals(address _nftAddress)
        external
        view
        returns (TokenApprovalStatus);

    /// @notice fee portion (in basis points) for each sale. This is used if a separate fee has been set for the collection owner.
    function feeWithCollectionOwner() external view returns (uint256);

    /// @notice Maps the collection address to the fees which the collection owner collects. Some collections may not have a seperate fee, such as those owned by the Treasure DAO.
    function collectionToCollectionOwnerFee(address _collectionAddress)
        external
        view
        returns (CollectionOwnerFee memory);

    /// @notice Maps the collection address to the payment token that will be used for purchasing. If the address is the zero address, it will use the default paymentToken.
    function collectionToPaymentToken(address _collectionAddress)
        external
        view
        returns (address);

    /// @notice The address for weth.
    function weth() external view returns (address);

    /// @notice mapping for token bids (721/1155): nftAddress => tokneId => offeror
    function tokenBids(
        address _nftAddress,
        uint256 _tokenId,
        address _offeror
    ) external view returns (ListingOrBid memory);

    /// @notice mapping for collection level bids (721 only): nftAddress => offeror
    function collectionBids(address _nftAddress, address _offeror)
        external
        view
        returns (ListingOrBid memory);

    /// @notice Indicates if bid related functions are active.
    function areBidsActive() external view returns (bool);

    /// @notice The fee portion was updated
    /// @param  fee new fee amount (in units of basis points)
    event UpdateFee(uint256 fee);

    /// @notice The fee portion was updated for collections that have a collection owner.
    /// @param  fee new fee amount (in units of basis points)
    event UpdateFeeWithCollectionOwner(uint256 fee);

    /// @notice A collection's fees have changed
    /// @param  _collection  The collection
    /// @param  _recipient   The recipient of the fees. If the address is 0, the collection fees for this collection have been removed.
    /// @param  _fee         The fee amount (in units of basis points)
    event UpdateCollectionOwnerFee(
        address _collection,
        address _recipient,
        uint256 _fee
    );

    /// @notice The fee recipient was updated
    /// @param  feeRecipient the new recipient to get fees
    event UpdateFeeRecipient(address feeRecipient);

    /// @notice The approval status for a token was updated
    /// @param  nft    which token contract was updated
    /// @param  status the new status
    /// @param  paymentToken the token that will be used for payments for this collection
    event TokenApprovalStatusUpdated(
        address nft,
        TokenApprovalStatus status,
        address paymentToken
    );

    event TokenBidCreatedOrUpdated(
        address bidder,
        address nftAddress,
        uint256 tokenId,
        uint64 quantity,
        uint128 pricePerItem,
        uint64 expirationTime,
        address paymentToken
    );

    event CollectionBidCreatedOrUpdated(
        address bidder,
        address nftAddress,
        uint64 quantity,
        uint128 pricePerItem,
        uint64 expirationTime,
        address paymentToken
    );

    event TokenBidCancelled(
        address bidder,
        address nftAddress,
        uint256 tokenId
    );

    event CollectionBidCancelled(address bidder, address nftAddress);

    event BidAccepted(
        address seller,
        address bidder,
        address nftAddress,
        uint256 tokenId,
        uint64 quantity,
        uint128 pricePerItem,
        address paymentToken,
        BidType bidType
    );

    /// @notice An item was listed for sale
    /// @param  seller         the offeror of the item
    /// @param  nftAddress     which token contract holds the offered token
    /// @param  tokenId        the identifier for the offered token
    /// @param  quantity       how many of this token identifier are offered (or 1 for a ERC-721 token)
    /// @param  pricePerItem   the price (in units of the paymentToken) for each token offered
    /// @param  expirationTime UNIX timestamp after when this listing expires
    /// @param  paymentToken   the token used to list this item
    event ItemListed(
        address seller,
        address nftAddress,
        uint256 tokenId,
        uint64 quantity,
        uint128 pricePerItem,
        uint64 expirationTime,
        address paymentToken
    );

    /// @notice An item listing was updated
    /// @param  seller         the offeror of the item
    /// @param  nftAddress     which token contract holds the offered token
    /// @param  tokenId        the identifier for the offered token
    /// @param  quantity       how many of this token identifier are offered (or 1 for a ERC-721 token)
    /// @param  pricePerItem   the price (in units of the paymentToken) for each token offered
    /// @param  expirationTime UNIX timestamp after when this listing expires
    /// @param  paymentToken   the token used to list this item
    event ItemUpdated(
        address seller,
        address nftAddress,
        uint256 tokenId,
        uint64 quantity,
        uint128 pricePerItem,
        uint64 expirationTime,
        address paymentToken
    );

    /// @notice An item is no longer listed for sale
    /// @param  seller     former offeror of the item
    /// @param  nftAddress which token contract holds the formerly offered token
    /// @param  tokenId    the identifier for the formerly offered token
    event ItemCanceled(
        address indexed seller,
        address indexed nftAddress,
        uint256 indexed tokenId
    );

    /// @notice A listed item was sold
    /// @param  seller       the offeror of the item
    /// @param  buyer        the buyer of the item
    /// @param  nftAddress   which token contract holds the sold token
    /// @param  tokenId      the identifier for the sold token
    /// @param  quantity     how many of this token identifier where sold (or 1 for a ERC-721 token)
    /// @param  pricePerItem the price (in units of the paymentToken) for each token sold
    /// @param  paymentToken the payment token that was used to pay for this item
    event ItemSold(
        address seller,
        address buyer,
        address nftAddress,
        uint256 tokenId,
        uint64 quantity,
        uint128 pricePerItem,
        address paymentToken
    );

    /// @notice Perform initial contract setup
    /// @dev    The initializer modifier ensures this is only called once, the owner should confirm this was properly
    ///         performed before publishing this contract address.
    /// @param  _initialFee          fee to be paid on each sale, in basis points
    /// @param  _initialFeeRecipient wallet to collets fees
    /// @param  _initialPaymentToken address of the token that is used for settlement
    function initialize(
        uint256 _initialFee,
        address _initialFeeRecipient,
        address _initialPaymentToken
    ) external;

    /// @notice Creates an item listing. You must authorize this marketplace with your item's token contract to list.
    /// @param  _nftAddress     which token contract holds the offered token
    /// @param  _tokenId        the identifier for the offered token
    /// @param  _quantity       how many of this token identifier are offered (or 1 for a ERC-721 token)
    /// @param  _pricePerItem   the price (in units of the paymentToken) for each token offered
    /// @param  _expirationTime UNIX timestamp after when this listing expires
    function createListing(
        address _nftAddress,
        uint256 _tokenId,
        uint64 _quantity,
        uint128 _pricePerItem,
        uint64 _expirationTime,
        address _paymentToken
    ) external;

    /// @notice Updates an item listing
    /// @param  _nftAddress        which token contract holds the offered token
    /// @param  _tokenId           the identifier for the offered token
    /// @param  _newQuantity       how many of this token identifier are offered (or 1 for a ERC-721 token)
    /// @param  _newPricePerItem   the price (in units of the paymentToken) for each token offered
    /// @param  _newExpirationTime UNIX timestamp after when this listing expires
    function updateListing(
        address _nftAddress,
        uint256 _tokenId,
        uint64 _newQuantity,
        uint128 _newPricePerItem,
        uint64 _newExpirationTime,
        address _paymentToken
    ) external;

    /// @notice Remove an item listing
    /// @param  _nftAddress which token contract holds the offered token
    /// @param  _tokenId    the identifier for the offered token
    function cancelListing(address _nftAddress, uint256 _tokenId) external;

    function cancelManyBids(CancelBidParams[] calldata _cancelBidParams)
        external;

    /// @notice Creates a bid for a particular token.
    function createOrUpdateTokenBid(
        address _nftAddress,
        uint256 _tokenId,
        uint64 _quantity,
        uint128 _pricePerItem,
        uint64 _expirationTime,
        address _paymentToken
    ) external;

    function createOrUpdateCollectionBid(
        address _nftAddress,
        uint64 _quantity,
        uint128 _pricePerItem,
        uint64 _expirationTime,
        address _paymentToken
    ) external;

    function acceptCollectionBid(AcceptBidParams calldata _acceptBidParams)
        external;

    function acceptTokenBid(AcceptBidParams calldata _acceptBidParams) external;

    /// @notice Buy multiple listed items. You must authorize this marketplace with your payment token to completed the buy or purchase with eth if it is a weth collection.
    function buyItems(BuyItemParams[] calldata _buyItemParams) external payable;

    /// @notice Updates the fee amount which is collected during sales, for both collections with and without owner specific fees.
    /// @dev    This is callable only by the owner. Both fees may not exceed MAX_FEE
    /// @param  _newFee the updated fee amount is basis points
    function setFee(uint256 _newFee, uint256 _newFeeWithCollectionOwner)
        external;

    /// @notice Updates the fee amount which is collected during sales fro a specific collection
    /// @dev    This is callable only by the owner
    /// @param  _collectionAddress The collection in question. This must be whitelisted.
    /// @param _collectionOwnerFee The fee and recipient for the collection. If the 0 address is passed as the recipient, collection specific fees will not be collected.
    function setCollectionOwnerFee(
        address _collectionAddress,
        CollectionOwnerFee calldata _collectionOwnerFee
    ) external;

    /// @notice Updates the fee recipient which receives fees during sales
    /// @dev    This is callable only by the owner.
    /// @param  _newFeeRecipient the wallet to receive fees
    function setFeeRecipient(address _newFeeRecipient) external;

    /// @notice Sets a token as an approved kind of NFT or as ineligible for trading
    /// @dev    This is callable only by the owner.
    /// @param  _nft    address of the NFT to be approved
    /// @param  _status the kind of NFT approved, or NOT_APPROVED to remove approval
    function setTokenApprovalStatus(
        address _nft,
        TokenApprovalStatus _status,
        address _paymentToken
    ) external;

    function setWeth(address _wethAddress) external;

    function toggleAreBidsActive() external;

    /// @notice Pauses the marketplace, creatisgn and executing listings is paused
    /// @dev    This is callable only by the owner. Canceling listings is not paused.
    function pause() external;

    /// @notice Unpauses the marketplace, all functionality is restored
    /// @dev    This is callable only by the owner.
    function unpause() external;
}

struct BuyItemParams {
    /// which token contract holds the offered token
    address nftAddress;
    /// the identifier for the token to be bought
    uint256 tokenId;
    /// current owner of the item(s) to be bought
    address owner;
    /// how many of this token identifier to be bought (or 1 for a ERC-721 token)
    uint64 quantity;
    /// the maximum price (in units of the paymentToken) for each token offered
    uint128 maxPricePerItem;
    /// the payment token to be used
    address paymentToken;
    /// indicates if the user is purchasing this item with eth.
    bool usingEth;
}

struct AcceptBidParams {
    // Which token contract holds the given tokens
    address nftAddress;
    // The token id being given
    uint256 tokenId;
    // The user who created the bid initially
    address bidder;
    // The quantity of items being supplied to the bidder
    uint64 quantity;
    // The price per item that the bidder is offering
    uint128 pricePerItem;
    /// the payment token to be used
    address paymentToken;
}

struct CancelBidParams {
    BidType bidType;
    address nftAddress;
    uint256 tokenId;
}

enum BidType {
    TOKEN,
    COLLECTION
}

File 12 of 24 : BuyOrder.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

//           _____                    _____                   _______                   _____            _____                    _____                    _____                    _____
//          /\    \                  /\    \                 /::\    \                 /\    \          /\    \                  /\    \                  /\    \                  /\    \
//         /::\    \                /::\____\               /::::\    \               /::\____\        /::\    \                /::\____\                /::\    \                /::\    \
//        /::::\    \              /::::|   |              /::::::\    \             /:::/    /       /::::\    \              /:::/    /               /::::\    \              /::::\    \
//       /::::::\    \            /:::::|   |             /::::::::\    \           /:::/    /       /::::::\    \            /:::/   _/___            /::::::\    \            /::::::\    \
//      /:::/\:::\    \          /::::::|   |            /:::/~~\:::\    \         /:::/    /       /:::/\:::\    \          /:::/   /\    \          /:::/\:::\    \          /:::/\:::\    \
//     /:::/__\:::\    \        /:::/|::|   |           /:::/    \:::\    \       /:::/    /       /:::/__\:::\    \        /:::/   /::\____\        /:::/__\:::\    \        /:::/__\:::\    \
//     \:::\   \:::\    \      /:::/ |::|   |          /:::/    / \:::\    \     /:::/    /        \:::\   \:::\    \      /:::/   /:::/    /       /::::\   \:::\    \      /::::\   \:::\    \
//   ___\:::\   \:::\    \    /:::/  |::|___|______   /:::/____/   \:::\____\   /:::/    /       ___\:::\   \:::\    \    /:::/   /:::/   _/___    /::::::\   \:::\    \    /::::::\   \:::\    \
//  /\   \:::\   \:::\    \  /:::/   |::::::::\    \ |:::|    |     |:::|    | /:::/    /       /\   \:::\   \:::\    \  /:::/___/:::/   /\    \  /:::/\:::\   \:::\    \  /:::/\:::\   \:::\____\
// /::\   \:::\   \:::\____\/:::/    |:::::::::\____\|:::|____|     |:::|    |/:::/____/       /::\   \:::\   \:::\____\|:::|   /:::/   /::\____\/:::/  \:::\   \:::\____\/:::/  \:::\   \:::|    |
// \:::\   \:::\   \::/    /\::/    / ~~~~~/:::/    / \:::\    \   /:::/    / \:::\    \       \:::\   \:::\   \::/    /|:::|__/:::/   /:::/    /\::/    \:::\  /:::/    /\::/    \:::\  /:::|____|
//  \:::\   \:::\   \/____/  \/____/      /:::/    /   \:::\    \ /:::/    /   \:::\    \       \:::\   \:::\   \/____/  \:::\/:::/   /:::/    /  \/____/ \:::\/:::/    /  \/_____/\:::\/:::/    /
//   \:::\   \:::\    \                  /:::/    /     \:::\    /:::/    /     \:::\    \       \:::\   \:::\    \       \::::::/   /:::/    /            \::::::/    /            \::::::/    /
//    \:::\   \:::\____\                /:::/    /       \:::\__/:::/    /       \:::\    \       \:::\   \:::\____\       \::::/___/:::/    /              \::::/    /              \::::/    /
//     \:::\  /:::/    /               /:::/    /         \::::::::/    /         \:::\    \       \:::\  /:::/    /        \:::\__/:::/    /               /:::/    /                \::/____/
//      \:::\/:::/    /               /:::/    /           \::::::/    /           \:::\    \       \:::\/:::/    /          \::::::::/    /               /:::/    /                  ~~
//       \::::::/    /               /:::/    /             \::::/    /             \:::\    \       \::::::/    /            \::::::/    /               /:::/    /
//        \::::/    /               /:::/    /               \::/____/               \:::\____\       \::::/    /              \::::/    /               /:::/    /
//         \::/    /                \::/    /                 ~~                      \::/    /        \::/    /                \::/____/                \::/    /
//          \/____/                  \/____/                                           \/____/          \/____/                  ~~                       \/____/

struct BuyOrder {
    address assetAddress;
    uint256 tokenId;
    address seller;
    uint256 quantity;
    uint256 maxPricePerItem;
}

File 13 of 24 : ITroveSmolSweeper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

//           _____                    _____                   _______                   _____            _____                    _____                    _____                    _____
//          /\    \                  /\    \                 /::\    \                 /\    \          /\    \                  /\    \                  /\    \                  /\    \
//         /::\    \                /::\____\               /::::\    \               /::\____\        /::\    \                /::\____\                /::\    \                /::\    \
//        /::::\    \              /::::|   |              /::::::\    \             /:::/    /       /::::\    \              /:::/    /               /::::\    \              /::::\    \
//       /::::::\    \            /:::::|   |             /::::::::\    \           /:::/    /       /::::::\    \            /:::/   _/___            /::::::\    \            /::::::\    \
//      /:::/\:::\    \          /::::::|   |            /:::/~~\:::\    \         /:::/    /       /:::/\:::\    \          /:::/   /\    \          /:::/\:::\    \          /:::/\:::\    \
//     /:::/__\:::\    \        /:::/|::|   |           /:::/    \:::\    \       /:::/    /       /:::/__\:::\    \        /:::/   /::\____\        /:::/__\:::\    \        /:::/__\:::\    \
//     \:::\   \:::\    \      /:::/ |::|   |          /:::/    / \:::\    \     /:::/    /        \:::\   \:::\    \      /:::/   /:::/    /       /::::\   \:::\    \      /::::\   \:::\    \
//   ___\:::\   \:::\    \    /:::/  |::|___|______   /:::/____/   \:::\____\   /:::/    /       ___\:::\   \:::\    \    /:::/   /:::/   _/___    /::::::\   \:::\    \    /::::::\   \:::\    \
//  /\   \:::\   \:::\    \  /:::/   |::::::::\    \ |:::|    |     |:::|    | /:::/    /       /\   \:::\   \:::\    \  /:::/___/:::/   /\    \  /:::/\:::\   \:::\    \  /:::/\:::\   \:::\____\
// /::\   \:::\   \:::\____\/:::/    |:::::::::\____\|:::|____|     |:::|    |/:::/____/       /::\   \:::\   \:::\____\|:::|   /:::/   /::\____\/:::/  \:::\   \:::\____\/:::/  \:::\   \:::|    |
// \:::\   \:::\   \::/    /\::/    / ~~~~~/:::/    / \:::\    \   /:::/    / \:::\    \       \:::\   \:::\   \::/    /|:::|__/:::/   /:::/    /\::/    \:::\  /:::/    /\::/    \:::\  /:::|____|
//  \:::\   \:::\   \/____/  \/____/      /:::/    /   \:::\    \ /:::/    /   \:::\    \       \:::\   \:::\   \/____/  \:::\/:::/   /:::/    /  \/____/ \:::\/:::/    /  \/_____/\:::\/:::/    /
//   \:::\   \:::\    \                  /:::/    /     \:::\    /:::/    /     \:::\    \       \:::\   \:::\    \       \::::::/   /:::/    /            \::::::/    /            \::::::/    /
//    \:::\   \:::\____\                /:::/    /       \:::\__/:::/    /       \:::\    \       \:::\   \:::\____\       \::::/___/:::/    /              \::::/    /              \::::/    /
//     \:::\  /:::/    /               /:::/    /         \::::::::/    /         \:::\    \       \:::\  /:::/    /        \:::\__/:::/    /               /:::/    /                \::/____/
//      \:::\/:::/    /               /:::/    /           \::::::/    /           \:::\    \       \:::\/:::/    /          \::::::::/    /               /:::/    /                  ~~
//       \::::::/    /               /:::/    /             \::::/    /             \:::\    \       \::::::/    /            \::::::/    /               /:::/    /
//        \::::/    /               /:::/    /               \::/____/               \:::\____\       \::::/    /              \::::/    /               /:::/    /
//         \::/    /                \::/    /                 ~~                      \::/    /        \::/    /                \::/____/                \::/    /
//          \/____/                  \/____/                                           \/____/          \/____/                  ~~                       \/____/

import "../../treasure/interfaces/ITroveMarketplace.sol";

interface ITroveSmolSweeper {
    event SuccessBuyItem(
        address indexed _nftAddress,
        uint256 _tokenId,
        address indexed _seller,
        address indexed _buyer,
        uint256 _quantity,
        uint256 _price
    );

    event CaughtFailureBuyItem(
        address indexed _nftAddress,
        uint256 _tokenId,
        address indexed _seller,
        address indexed _buyer,
        uint256 _quantity,
        uint256 _price,
        bytes _errorReason
    );

    function buyItemsSingleToken(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address _inputTokenAddress,
        uint256 _maxSpendIncFees
    ) external payable;

    function buyItemsManyTokens(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address[] calldata _inputTokenAddresses,
        uint256[] calldata _maxSpendIncFees
    ) external payable;

    function sweepItemsSingleToken(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address _inputTokenAddress,
        uint256 _maxSpendIncFees,
        uint256 _minSpend,
        uint32 _maxSuccesses,
        uint32 _maxFailures
    ) external payable;

    function sweepItemsManyTokens(
        BuyItemParams[] calldata _buyOrders,
        uint16 _inputSettingsBitFlag,
        address[] calldata _inputTokenAddresses,
        uint256[] calldata _maxSpendIncFees,
        uint256[] calldata _minSpends,
        uint32 _maxSuccesses,
        uint32 _maxFailures
    ) external payable;
}

File 14 of 24 : ABaseSmolSweeper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

//           _____                    _____                   _______                   _____            _____                    _____                    _____                    _____
//          /\    \                  /\    \                 /::\    \                 /\    \          /\    \                  /\    \                  /\    \                  /\    \
//         /::\    \                /::\____\               /::::\    \               /::\____\        /::\    \                /::\____\                /::\    \                /::\    \
//        /::::\    \              /::::|   |              /::::::\    \             /:::/    /       /::::\    \              /:::/    /               /::::\    \              /::::\    \
//       /::::::\    \            /:::::|   |             /::::::::\    \           /:::/    /       /::::::\    \            /:::/   _/___            /::::::\    \            /::::::\    \
//      /:::/\:::\    \          /::::::|   |            /:::/~~\:::\    \         /:::/    /       /:::/\:::\    \          /:::/   /\    \          /:::/\:::\    \          /:::/\:::\    \
//     /:::/__\:::\    \        /:::/|::|   |           /:::/    \:::\    \       /:::/    /       /:::/__\:::\    \        /:::/   /::\____\        /:::/__\:::\    \        /:::/__\:::\    \
//     \:::\   \:::\    \      /:::/ |::|   |          /:::/    / \:::\    \     /:::/    /        \:::\   \:::\    \      /:::/   /:::/    /       /::::\   \:::\    \      /::::\   \:::\    \
//   ___\:::\   \:::\    \    /:::/  |::|___|______   /:::/____/   \:::\____\   /:::/    /       ___\:::\   \:::\    \    /:::/   /:::/   _/___    /::::::\   \:::\    \    /::::::\   \:::\    \
//  /\   \:::\   \:::\    \  /:::/   |::::::::\    \ |:::|    |     |:::|    | /:::/    /       /\   \:::\   \:::\    \  /:::/___/:::/   /\    \  /:::/\:::\   \:::\    \  /:::/\:::\   \:::\____\
// /::\   \:::\   \:::\____\/:::/    |:::::::::\____\|:::|____|     |:::|    |/:::/____/       /::\   \:::\   \:::\____\|:::|   /:::/   /::\____\/:::/  \:::\   \:::\____\/:::/  \:::\   \:::|    |
// \:::\   \:::\   \::/    /\::/    / ~~~~~/:::/    / \:::\    \   /:::/    / \:::\    \       \:::\   \:::\   \::/    /|:::|__/:::/   /:::/    /\::/    \:::\  /:::/    /\::/    \:::\  /:::|____|
//  \:::\   \:::\   \/____/  \/____/      /:::/    /   \:::\    \ /:::/    /   \:::\    \       \:::\   \:::\   \/____/  \:::\/:::/   /:::/    /  \/____/ \:::\/:::/    /  \/_____/\:::\/:::/    /
//   \:::\   \:::\    \                  /:::/    /     \:::\    /:::/    /     \:::\    \       \:::\   \:::\    \       \::::::/   /:::/    /            \::::::/    /            \::::::/    /
//    \:::\   \:::\____\                /:::/    /       \:::\__/:::/    /       \:::\    \       \:::\   \:::\____\       \::::/___/:::/    /              \::::/    /              \::::/    /
//     \:::\  /:::/    /               /:::/    /         \::::::::/    /         \:::\    \       \:::\  /:::/    /        \:::\__/:::/    /               /:::/    /                \::/____/
//      \:::\/:::/    /               /:::/    /           \::::::/    /           \:::\    \       \:::\/:::/    /          \::::::::/    /               /:::/    /                  ~~
//       \::::::/    /               /:::/    /             \::::/    /             \:::\    \       \::::::/    /            \::::::/    /               /:::/    /
//        \::::/    /               /:::/    /               \::/____/               \:::\____\       \::::/    /              \::::/    /               /:::/    /
//         \::/    /                \::/    /                 ~~                      \::/    /        \::/    /                \::/____/                \::/    /
//          \/____/                  \/____/                                           \/____/          \/____/                  ~~                       \/____/

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

import "../../token/ANFTReceiver.sol";

error InvalidNFTAddress();
error FirstBuyReverted(bytes message);
error AllReverted();

abstract contract ABaseSmolSweeper is Ownable, ANFTReceiver, ERC165 {
    using SafeERC20 for IERC20;

    uint256 public constant FEE_BASIS_POINTS = 1_000_000;
    // uint256 public constant MINIMUM_SWEEP_AMOUNT_FOR_FEE = 1_000_000;
    uint256 public sweepFee = 0;

    function _calculateFee(uint256 _amount) internal view returns (uint256) {
        return (_amount * sweepFee) / FEE_BASIS_POINTS;
    }

    function calculateFee(uint256 _amount) external view returns (uint256) {
        return _calculateFee(_amount);
    }

    function _calculateAmountWithoutFees(uint256 _amountWithFee)
        internal
        view
        returns (uint256)
    {
        return ((_amountWithFee * FEE_BASIS_POINTS) /
            (FEE_BASIS_POINTS + sweepFee));
    }

    function calculateAmountAmountWithoutFees(uint256 _amountWithFee)
        external
        view
        returns (uint256)
    {
        return _calculateAmountWithoutFees(_amountWithFee);
    }

    function _setFee(uint256 _fee) internal {
        sweepFee = _fee;
    }

    function setFee(uint256 _fee) external onlyOwner {
        _setFee(_fee);
    }

    function _approveERC20TokenToContract(
        IERC20 _token,
        address _contract,
        uint256 _amount
    ) internal {
        _token.safeApprove(address(_contract), uint256(_amount));
    }

    function approveERC20TokenToContract(
        IERC20 _token,
        address _contract,
        uint256 _amount
    ) external onlyOwner {
        _approveERC20TokenToContract(_token, _contract, _amount);
    }

    // rescue functions
    // those have not been tested yet
    function transferETHTo(address payable _to, uint256 _amount)
        external
        onlyOwner
    {
        _to.transfer(_amount);
    }

    function transferERC20TokenTo(
        IERC20 _token,
        address _address,
        uint256 _amount
    ) external onlyOwner {
        _token.safeTransfer(address(_address), uint256(_amount));
    }

    function transferERC721To(
        IERC721 _token,
        address _to,
        uint256 _tokenId
    ) external onlyOwner {
        _token.safeTransferFrom(address(this), _to, _tokenId);
    }

    function transferERC1155To(
        IERC1155 _token,
        address _to,
        uint256[] calldata _tokenIds,
        uint256[] calldata _amounts,
        bytes calldata _data
    ) external onlyOwner {
        _token.safeBatchTransferFrom(
            address(this),
            _to,
            _tokenIds,
            _amounts,
            _data
        );
    }
}

File 15 of 24 : BuyError.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.11;

/**
 * @dev Errors
 */

enum BuyError {
    NONE,
    BUY_ITEM_REVERTED,
    INSUFFICIENT_QUANTITY_ERC1155,
    EXCEEDING_MAX_SPEND
}

File 16 of 24 : 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 17 of 24 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 18 of 24 : AERC1155Receiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";

abstract contract AERC1155Receiver is IERC1155Receiver {
    /**
     * Always returns `IERC1155Receiver.onERC1155ReceivedFrom.selector`.
     */
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes calldata
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    /**
     * Always returns `IERC1155Receiver.onERC1155BatchReceived.selector`.
     */
    function onERC1155BatchReceived(
        address,
        address,
        uint256[] calldata,
        uint256[] calldata,
        bytes calldata
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 19 of 24 : AERC721Receiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";

abstract contract AERC721Receiver is IERC721Receiver {
    /**
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 20 of 24 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * 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 21 of 24 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 22 of 24 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 23 of 24 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 24 of 24 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 25 of 24 : 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);
}

Settings
{
  "remappings": [
    "@cheatcodes/=src/cheatcodes/",
    "@contracts/=src/contracts/",
    "@ensdomains/=node_modules/@ensdomains/",
    "@forge-std/=lib/forge-std/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "@test/=src/tests/",
    "@uniswap/=node_modules/@uniswap/",
    "@utils/=src/utils/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=node_modules/hardhat/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solidity-lib/=lib/solidity-lib/contracts/",
    "src/=src/",
    "test/=test/",
    "v2-core/=lib/v2-core/contracts/",
    "v2-periphery/=lib/v2-periphery/contracts/",
    "src/=src/",
    "test/=test/"
  ],
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_troveMarketplace","type":"address"},{"internalType":"address","name":"_defaultPaymentToken","type":"address"},{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllReverted","type":"error"},{"inputs":[{"internalType":"bytes","name":"message","type":"bytes"}],"name":"FirstBuyReverted","type":"error"},{"inputs":[],"name":"InvalidMsgValue","type":"error"},{"inputs":[],"name":"InvalidNFTAddress","type":"error"},{"inputs":[],"name":"MsgValueShouldBeZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_seller","type":"address"},{"indexed":true,"internalType":"address","name":"_buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"_quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_price","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"_errorReason","type":"bytes"}],"name":"CaughtFailureBuyItem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_seller","type":"address"},{"indexed":true,"internalType":"address","name":"_buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"_quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_price","type":"uint256"}],"name":"SuccessBuyItem","type":"event"},{"inputs":[],"name":"FEE_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"approveERC20TokenToContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"uint128","name":"maxPricePerItem","type":"uint128"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"bool","name":"usingEth","type":"bool"}],"internalType":"struct BuyItemParams[]","name":"_buyOrders","type":"tuple[]"},{"internalType":"uint16","name":"_inputSettingsBitFlag","type":"uint16"},{"internalType":"address[]","name":"_inputTokenAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_maxSpendIncFees","type":"uint256[]"}],"name":"buyItemsManyTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"uint128","name":"maxPricePerItem","type":"uint128"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"bool","name":"usingEth","type":"bool"}],"internalType":"struct BuyItemParams[]","name":"_buyOrders","type":"tuple[]"},{"internalType":"uint16","name":"_inputSettingsBitFlag","type":"uint16"},{"internalType":"address","name":"_inputTokenAddress","type":"address"},{"internalType":"uint256","name":"_maxSpendIncFees","type":"uint256"}],"name":"buyItemsSingleToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountWithFee","type":"uint256"}],"name":"calculateAmountAmountWithoutFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"calculateFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultPaymentToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_defaultPaymentToken","type":"address"}],"name":"setDefaultPaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITroveMarketplace","name":"_troveMarketplace","type":"address"}],"name":"setMarketplaceContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_weth","type":"address"}],"name":"setWeth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sweepFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"uint128","name":"maxPricePerItem","type":"uint128"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"bool","name":"usingEth","type":"bool"}],"internalType":"struct BuyItemParams[]","name":"_buyOrders","type":"tuple[]"},{"internalType":"uint16","name":"_inputSettingsBitFlag","type":"uint16"},{"internalType":"address[]","name":"_inputTokenAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_maxSpendIncFees","type":"uint256[]"},{"internalType":"uint256[]","name":"_minSpends","type":"uint256[]"},{"internalType":"uint32","name":"_maxSuccesses","type":"uint32"},{"internalType":"uint32","name":"_maxFailures","type":"uint32"}],"name":"sweepItemsManyTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"uint128","name":"maxPricePerItem","type":"uint128"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"bool","name":"usingEth","type":"bool"}],"internalType":"struct BuyItemParams[]","name":"_buyOrders","type":"tuple[]"},{"internalType":"uint16","name":"_inputSettingsBitFlag","type":"uint16"},{"internalType":"address","name":"_inputTokenAddress","type":"address"},{"internalType":"uint256","name":"_maxSpendIncFees","type":"uint256"},{"internalType":"uint256","name":"_minSpend","type":"uint256"},{"internalType":"uint32","name":"_maxSuccesses","type":"uint32"},{"internalType":"uint32","name":"_maxFailures","type":"uint32"}],"name":"sweepItemsSingleToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC1155","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"transferERC1155To","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferERC20TokenTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferERC721To","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferETHTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"troveMarketplace","outputs":[{"internalType":"contract ITroveMarketplace","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405260006002553480156200001657600080fd5b506040516200581a3803806200581a83398181016040528101906200003c91906200026e565b8282826001600081905550620000676200005b6200013660201b60201c565b6200013e60201b60201c565b82600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620002ca565b600033905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002368262000209565b9050919050565b620002488162000229565b81146200025457600080fd5b50565b60008151905062000268816200023d565b92915050565b6000806000606084860312156200028a576200028962000204565b5b60006200029a8682870162000257565b9350506020620002ad8682870162000257565b9250506040620002c08682870162000257565b9150509250925092565b61554080620002da6000396000f3fe60806040526004361061019c5760003560e01c806372fbf15c116100ec578063e4d835b41161008a578063f2fde38b11610064578063f2fde38b146105a8578063f74b059e146105d1578063f924887f146105fa578063f96886c8146106165761019c565b8063e4d835b414610526578063eae3d31c14610542578063f23a6e611461056b5761019c565b806399a5d747116100c657806399a5d74714610458578063a525ad3c14610495578063b8d1452f146104c0578063bc197c81146104e95761019c565b806372fbf15c146103e85780637f266643146104115780638da5cb5b1461042d5761019c565b806338e3127f116101595780636412173e116101335780636412173e14610352578063682c02741461037d57806369fe0e2d146103a8578063715018a6146103d15761019c565b806338e3127f146102d35780633fc8cef3146102fe57806357c1d72b146103295761019c565b806301ffc9a7146101a1578063035b553b146101de5780631102610e14610207578063150b7a0214610230578063209b7abc1461026d57806329d0be8d146102aa575b600080fd5b3480156101ad57600080fd5b506101c860048036038101906101c391906137f4565b610632565b6040516101d5919061383c565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190613929565b61069c565b005b34801561021357600080fd5b5061022e600480360381019061022991906139ba565b61078c565b005b34801561023c57600080fd5b5061025760048036038101906102529190613b2d565b61084c565b6040516102649190613bbf565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f9190613bda565b610860565b6040516102a19190613c16565b60405180910390f35b3480156102b657600080fd5b506102d160048036038101906102cc9190613c6f565b610872565b005b3480156102df57600080fd5b506102e86108fe565b6040516102f59190613c16565b60405180910390f35b34801561030a57600080fd5b50610313610904565b6040516103209190613d21565b60405180910390f35b34801561033557600080fd5b50610350600480360381019061034b9190613d7a565b61092a565b005b34801561035e57600080fd5b506103676109f1565b6040516103749190613d21565b60405180910390f35b34801561038957600080fd5b50610392610a17565b60405161039f9190613ddb565b60405180910390f35b3480156103b457600080fd5b506103cf60048036038101906103ca9190613bda565b610a3d565b005b3480156103dd57600080fd5b506103e6610ac5565b005b3480156103f457600080fd5b5061040f600480360381019061040a9190613eea565b610b4d565b005b61042b60048036038101906104269190614056565b610c4c565b005b34801561043957600080fd5b50610442610f87565b60405161044f91906140ed565b60405180910390f35b34801561046457600080fd5b5061047f600480360381019061047a9190613bda565b610fb1565b60405161048c9190613c16565b60405180910390f35b3480156104a157600080fd5b506104aa610fc3565b6040516104b79190613c16565b60405180910390f35b3480156104cc57600080fd5b506104e760048036038101906104e29190614108565b610fca565b005b3480156104f557600080fd5b50610510600480360381019061050b9190614135565b61108a565b60405161051d9190613bbf565b60405180910390f35b610540600480360381019061053b9190614267565b6110a2565b005b34801561054e57600080fd5b5061056960048036038101906105649190613c6f565b611650565b005b34801561057757600080fd5b50610592600480360381019061058d9190614330565b6116fc565b60405161059f9190613bbf565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca91906143ca565b611712565b005b3480156105dd57600080fd5b506105f860048036038101906105f39190614108565b611809565b005b610614600480360381019061060f9190614433565b6118c9565b005b610630600480360381019061062b9190614557565b611ebd565b005b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6106a4612254565b73ffffffffffffffffffffffffffffffffffffffff166106c2610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610718576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070f90614676565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff166342842e0e3084846040518463ffffffff1660e01b815260040161075593929190614696565b600060405180830381600087803b15801561076f57600080fd5b505af1158015610783573d6000803e3d6000fd5b50505050505050565b610794612254565b73ffffffffffffffffffffffffffffffffffffffff166107b2610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610808576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ff90614676565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600063150b7a0260e01b9050949350505050565b600061086b8261225c565b9050919050565b61087a612254565b73ffffffffffffffffffffffffffffffffffffffff16610898610f87565b73ffffffffffffffffffffffffffffffffffffffff16146108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e590614676565b60405180910390fd5b6108f983838361228f565b505050565b60025481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610932612254565b73ffffffffffffffffffffffffffffffffffffffff16610950610f87565b73ffffffffffffffffffffffffffffffffffffffff16146109a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099d90614676565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156109ec573d6000803e3d6000fd5b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a45612254565b73ffffffffffffffffffffffffffffffffffffffff16610a63610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610ab9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab090614676565b60405180910390fd5b610ac2816122bf565b50565b610acd612254565b73ffffffffffffffffffffffffffffffffffffffff16610aeb610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610b41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3890614676565b60405180910390fd5b610b4b60006122c9565b565b610b55612254565b73ffffffffffffffffffffffffffffffffffffffff16610b73610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610bc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc090614676565b60405180910390fd5b8773ffffffffffffffffffffffffffffffffffffffff16632eb2c2d630898989898989896040518963ffffffff1660e01b8152600401610c1098979695949392919061477d565b600060405180830381600087803b158015610c2a57600080fd5b505af1158015610c3e573d6000803e3d6000fd5b505050505050505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015610ca95750600034115b15610cec57348114610ce7576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610df5565b60003414610d26576040517f34d1c8cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d533330838573ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610db09291906147eb565b6020604051808303816000875af1158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df39190614840565b505b600080610e0487878786612418565b9150915060008103610e42576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610e4d8361250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610ed4575087876000818110610ebb57610eba61486d565b5b905060e0020160c0016020810190610ed391906148b1565b5b15610f3b573373ffffffffffffffffffffffffffffffffffffffff166108fc8285610eff919061490d565b86610f0a9190614963565b9081150290604051600060405180830381858888f19350505050158015610f35573d6000803e3d6000fd5b50610f7d565b610f7c338285610f4b919061490d565b86610f569190614963565b8773ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b5050505050505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610fbc8261250c565b9050919050565b620f424081565b610fd2612254565b73ffffffffffffffffffffffffffffffffffffffff16610ff0610f87565b73ffffffffffffffffffffffffffffffffffffffff1614611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103d90614676565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600063bc197c8160e01b905098975050505050505050565b6000808585905090505b808210156112ee57600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16868684818110611100576110ff61486d565b5b905060200201602081019061111591906143ca565b73ffffffffffffffffffffffffffffffffffffffff161480156111385750600034115b1561119457348484848181106111515761115061486d565b5b905060200201351461118f576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112e3565b61120133308686868181106111ac576111ab61486d565b5b905060200201358989878181106111c6576111c561486d565b5b90506020020160208101906111db91906143ca565b73ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b8585838181106112145761121361486d565b5b905060200201602081019061122991906143ca565b73ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686868681811061127a5761127961486d565b5b905060200201356040518363ffffffff1660e01b815260040161129e9291906147eb565b6020604051808303816000875af11580156112bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e19190614840565b505b8160010191506110ac565b600061133a858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506125b7565b90506000806113e28c8c808060200260200160405190810160405280939291908181526020016000905b8282101561139457848483905060e002018036038101906113859190614ad8565b81526020019060010190611364565b50505050508b8b8b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508661266a565b9150915060008103611420576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600094505b838510156116425760006114528387815181106114455761144461486d565b5b602002602001015161250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168a8a888181106114a05761149f61486d565b5b90506020020160208101906114b591906143ca565b73ffffffffffffffffffffffffffffffffffffffff1614801561150057508c8c60008181106114e7576114e661486d565b5b905060e0020160c00160208101906114ff91906148b1565b5b1561159a573373ffffffffffffffffffffffffffffffffffffffff166108fc828589815181106115335761153261486d565b5b6020026020010151611545919061490d565b8a8a8a8181106115585761155761486d565b5b905060200201356115699190614963565b9081150290604051600060405180830381858888f19350505050158015611594573d6000803e3d6000fd5b50611636565b61163533828589815181106115b2576115b161486d565b5b60200260200101516115c4919061490d565b8a8a8a8181106115d7576115d661486d565b5b905060200201356115e89190614963565b8c8c8a8181106115fb576115fa61486d565b5b905060200201602081019061161091906143ca565b73ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b85600101955050611425565b505050505050505050505050565b611658612254565b73ffffffffffffffffffffffffffffffffffffffff16611676610f87565b73ffffffffffffffffffffffffffffffffffffffff16146116cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c390614676565b60405180910390fd5b6116f782828573ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b505050565b600063f23a6e6160e01b90509695505050505050565b61171a612254565b73ffffffffffffffffffffffffffffffffffffffff16611738610f87565b73ffffffffffffffffffffffffffffffffffffffff161461178e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178590614676565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036117fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f490614b77565b60405180910390fd5b611806816122c9565b50565b611811612254565b73ffffffffffffffffffffffffffffffffffffffff1661182f610f87565b73ffffffffffffffffffffffffffffffffffffffff1614611885576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187c90614676565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60005b86869050811015611b1157600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168989838181106119235761192261486d565b5b905060200201602081019061193891906143ca565b73ffffffffffffffffffffffffffffffffffffffff1614801561195b5750600034115b156119b757348787838181106119745761197361486d565b5b90506020020135146119b2576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b06565b611a2433308989858181106119cf576119ce61486d565b5b905060200201358c8c868181106119e9576119e861486d565b5b90506020020160208101906119fe91906143ca565b73ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b888882818110611a3757611a3661486d565b5b9050602002016020810190611a4c91906143ca565b73ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16898985818110611a9d57611a9c61486d565b5b905060200201356040518363ffffffff1660e01b8152600401611ac19291906147eb565b6020604051808303816000875af1158015611ae0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b049190614840565b505b8060010190506118cc565b506000611b5e878780806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506125b7565b9050600080611c4a8e8e808060200260200160405190810160405280939291908181526020016000905b82821015611bb857848483905060e00201803603810190611ba99190614ad8565b81526020019060010190611b88565b50505050508d8d8d80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050868b8b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508a8a61280b565b509150915060008103611c89576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b89899050811015611eac576000611cbc848381518110611caf57611cae61486d565b5b602002602001015161250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168d8d84818110611d0a57611d0961486d565b5b9050602002016020810190611d1f91906143ca565b73ffffffffffffffffffffffffffffffffffffffff16148015611d6a57508f8f6000818110611d5157611d5061486d565b5b905060e0020160c0016020810190611d6991906148b1565b5b15611e04573373ffffffffffffffffffffffffffffffffffffffff166108fc82868581518110611d9d57611d9c61486d565b5b6020026020010151611daf919061490d565b8d8d86818110611dc257611dc161486d565b5b90506020020135611dd39190614963565b9081150290604051600060405180830381858888f19350505050158015611dfe573d6000803e3d6000fd5b50611ea0565b611e9f3382868581518110611e1c57611e1b61486d565b5b6020026020010151611e2e919061490d565b8d8d86818110611e4157611e4061486d565b5b90506020020135611e529190614963565b8f8f86818110611e6557611e6461486d565b5b9050602002016020810190611e7a91906143ca565b73ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b81600101915050611c8c565b505050505050505050505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015611f1a5750600034115b15611f5d57348414611f58576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612066565b60003414611f97576040517f34d1c8cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fc43330868873ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518363ffffffff1660e01b81526004016120219291906147eb565b6020604051808303816000875af1158015612040573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120649190614840565b505b6000806120cd8a8a808060200260200160405190810160405280939291908181526020016000905b828210156120be57848483905060e002018036038101906120af9190614ad8565b8152602001906001019061208e565b50505050508988888888612a1f565b50915091506000810361210c576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006121178361250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614801561219e57508a8a60008181106121855761218461486d565b5b905060e0020160c001602081019061219d91906148b1565b5b15612205573373ffffffffffffffffffffffffffffffffffffffff166108fc82856121c9919061490d565b896121d49190614963565b9081150290604051600060405180830381858888f193505050501580156121ff573d6000803e3d6000fd5b50612247565b612246338285612215919061490d565b896122209190614963565b8a73ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b5050505050505050505050565b600033905090565b6000600254620f424061226f919061490d565b620f42408361227e9190614b97565b6122889190614c20565b9050919050565b6122ba82828573ffffffffffffffffffffffffffffffffffffffff16612b2d9092919063ffffffff16565b505050565b8060028190555050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612412846323b872dd60e01b8585856040516024016123b093929190614696565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c7c565b50505050565b60008060006124268461225c565b90506000808888905090505b8082101561250057600080600061247d8c8c878181106124555761245461486d565b5b905060e0020180360381019061246b9190614ad8565b8b8a896124789190614963565b612d43565b92509250925081156124aa578288612495919061490d565b975086806124a290614c51565b9750506124f2565b6003808111156124bd576124bc614c99565b5b8160038111156124d0576124cf614c99565b5b1480156124e457506124e38a6004613478565b5b156124f157505050612500565b5b846001019450505050612432565b50505094509492505050565b6000620f4240600254836125209190614b97565b61252a9190614c20565b9050919050565b6125b28363a9059cbb60e01b84846040516024016125509291906147eb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c7c565b505050565b6060815167ffffffffffffffff8111156125d4576125d3613a02565b5b6040519080825280602002602001820160405280156126025781602001602082028036833780820191505090505b50905060008251905060005b818110156126635761263984828151811061262c5761262b61486d565b5b602002602001015161225c565b83828151811061264c5761264b61486d565b5b60200260200101818152505080600101905061260e565b5050919050565b60606000835167ffffffffffffffff81111561268957612688613a02565b5b6040519080825280602002602001820160405280156126b75781602001602082028036833780820191505090505b50915060005b86518110156128015760006126f0868984815181106126df576126de61486d565b5b602002602001015160a0015161348f565b9050600080600061275b8b868151811061270d5761270c61486d565b5b60200260200101518b8987815181106127295761272861486d565b5b60200260200101518b88815181106127445761274361486d565b5b60200260200101516127569190614963565b612d43565b92509250925081156127a9578287858151811061277b5761277a61486d565b5b6020026020010181815161278f919061490d565b9150818152505085806127a190614c51565b9650506127f2565b6003808111156127bc576127bb614c99565b5b8160038111156127cf576127ce614c99565b5b1480156127e357506127e28a6004613478565b5b156127f15750505050612801565b5b846001019450505050506126bd565b5094509492505050565b6060600080875167ffffffffffffffff81111561282b5761282a613a02565b5b6040519080825280602002602001820160405280156128595781602001602082028036833780820191505090505b50925060005b8a51811015612a11578563ffffffff168310158061288357508463ffffffff168210155b612a115760006128b18a8d84815181106128a05761289f61486d565b5b602002602001015160a0015161348f565b90508781815181106128c6576128c561486d565b5b60200260200101518582815181106128e1576128e061486d565b5b6020026020010151106128f45750612a11565b600080600061295d8f868151811061290f5761290e61486d565b5b60200260200101518f8a878151811061292b5761292a61486d565b5b60200260200101518f88815181106129465761294561486d565b5b60200260200101516129589190614963565b612d43565b92509250925081156129ab578288858151811061297d5761297c61486d565b5b60200260200101818151612991919061490d565b9150818152505086806129a390614c51565b975050612a02565b6003808111156129be576129bd614c99565b5b8160038111156129d1576129d0614c99565b5b1480156129e557506129e48e6004613478565b5b156129f35750505050612a11565b85806129fe90614c51565b9650505b8460010194505050505061285f565b509750975097945050505050565b600080600080600090505b8951811015612b20578563ffffffff1683101580612a4e57508463ffffffff168210155b612b205786841015612b20576000806000612a8f8d8581518110612a7557612a7461486d565b5b60200260200101518d898e612a8a9190614963565b612d43565b9250925092508115612abc578287612aa7919061490d565b96508580612ab490614c51565b965050612b12565b600380811115612acf57612ace614c99565b5b816003811115612ae257612ae1614c99565b5b148015612af65750612af58c6004613478565b5b15612b0357505050612b20565b8480612b0e90614c51565b9550505b836001019350505050612a2a565b5096509650969350505050565b6000811480612bb7575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401612b74929190614cc8565b602060405180830381865afa158015612b91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb59190614d06565b145b612bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bed90614da5565b60405180910390fd5b612c778363095ea7b360e01b8484604051602401612c159291906147eb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c7c565b505050565b6000612cde826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166135359092919063ffffffff16565b9050600081511115612d3e5780806020019051810190612cfe9190614840565b612d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d3490614e37565b60405180910390fd5b5b505050565b600080600080866060015167ffffffffffffffff1690506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636bd3a64b89600001518a602001518b604001516040518463ffffffff1660e01b8152600401612dc793929190614e57565b608060405180830381865afa158015612de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e089190614f45565b905081816000015167ffffffffffffffff161015612e5957612e2b876002613478565b15612e4657806000015167ffffffffffffffff169150612e58565b6000806002945094509450505061346f565b5b858282602001516fffffffffffffffffffffffffffffffff16612e7c9190614b97565b1115612e94576000806003945094509450505061346f565b6000600167ffffffffffffffff811115612eb157612eb0613a02565b5b604051908082528060200260200182016040528015612eea57816020015b612ed76136eb565b815260200190600190039081612ecf5790505b5090508881600081518110612f0257612f0161486d565b5b6020026020010181905250600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b60a0015173ffffffffffffffffffffffffffffffffffffffff1614612f70576000612f93565b848b608001516fffffffffffffffffffffffffffffffff16612f929190614b97565b5b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a07076b282856040518363ffffffff1660e01b8152600401612ff191906150fa565b6000604051808303818588803b15801561300a57600080fd5b505af19350505050801561301c575060015b613158573d806000811461304c576040519150601f19603f3d011682016040523d82523d6000602084013e613051565b606091505b5061305d8b6010613478565b156130f5573373ffffffffffffffffffffffffffffffffffffffff168c6040015173ffffffffffffffffffffffffffffffffffffffff168d6000015173ffffffffffffffffffffffffffffffffffffffff167f4219d9724ded66a17a808c838643881e763e9239750585c908c5c58eac8995988f602001518a8a60200151876040516130ec94939291906151c4565b60405180910390a45b6131008b6001613478565b1561314257806040517fd32529e60000000000000000000000000000000000000000000000000000000081526004016131399190615210565b60405180910390fd5b600080600198509850985050505050505061346f565b6131638a600c613478565b156131f9573373ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff168c6000015173ffffffffffffffffffffffffffffffffffffffff167f338caed77504067792f381fe95337e7f5758a61f4d1d12a27b28a05212623d8b8e602001518989602001516040516131f093929190615232565b60405180910390a45b8a6000015173ffffffffffffffffffffffffffffffffffffffff166301ffc9a76380ac58cd60e01b6040518263ffffffff1660e01b815260040161323d9190613bbf565b602060405180830381865afa15801561325a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061327e9190614840565b156132ff578a6000015173ffffffffffffffffffffffffffffffffffffffff166342842e0e30338e602001516040518463ffffffff1660e01b81526004016132c893929190614696565b600060405180830381600087803b1580156132e257600080fd5b505af11580156132f6573d6000803e3d6000fd5b5050505061343a565b8a6000015173ffffffffffffffffffffffffffffffffffffffff166301ffc9a763d9b67a2660e01b6040518263ffffffff1660e01b81526004016133439190613bbf565b602060405180830381865afa158015613360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133849190614840565b15613407578a6000015173ffffffffffffffffffffffffffffffffffffffff1663f242432a30338e60200151896040518563ffffffff1660e01b81526004016133d0949392919061528f565b600060405180830381600087803b1580156133ea57600080fd5b505af11580156133fe573d6000803e3d6000fd5b50505050613439565b6040517fc79e7f5a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b8484602001516fffffffffffffffffffffffffffffffff1661345c9190614b97565b9150816001600097509750975050505050505b93509350939050565b60008161ffff1682841661ffff1614905092915050565b60005b82518110156134f4578173ffffffffffffffffffffffffffffffffffffffff168382815181106134c5576134c461486d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16031561352f57806001019050613492565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161352690615333565b60405180910390fd5b92915050565b6060613544848460008561354d565b90509392505050565b606082471015613592576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613589906153c5565b60405180910390fd5b61359b85613661565b6135da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135d190615431565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613603919061548d565b60006040518083038185875af1925050503d8060008114613640576040519150601f19603f3d011682016040523d82523d6000602084013e613645565b606091505b5091509150613655828286613684565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60608315613694578290506136e4565b6000835111156136a75782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136db91906154e8565b60405180910390fd5b9392505050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff16815260200160006fffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000151581525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6137d18161379c565b81146137dc57600080fd5b50565b6000813590506137ee816137c8565b92915050565b60006020828403121561380a57613809613792565b5b6000613818848285016137df565b91505092915050565b60008115159050919050565b61383681613821565b82525050565b6000602082019050613851600083018461382d565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061388282613857565b9050919050565b600061389482613877565b9050919050565b6138a481613889565b81146138af57600080fd5b50565b6000813590506138c18161389b565b92915050565b6138d081613877565b81146138db57600080fd5b50565b6000813590506138ed816138c7565b92915050565b6000819050919050565b613906816138f3565b811461391157600080fd5b50565b600081359050613923816138fd565b92915050565b60008060006060848603121561394257613941613792565b5b6000613950868287016138b2565b9350506020613961868287016138de565b925050604061397286828701613914565b9150509250925092565b600061398782613877565b9050919050565b6139978161397c565b81146139a257600080fd5b50565b6000813590506139b48161398e565b92915050565b6000602082840312156139d0576139cf613792565b5b60006139de848285016139a5565b91505092915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613a3a826139f1565b810181811067ffffffffffffffff82111715613a5957613a58613a02565b5b80604052505050565b6000613a6c613788565b9050613a788282613a31565b919050565b600067ffffffffffffffff821115613a9857613a97613a02565b5b613aa1826139f1565b9050602081019050919050565b82818337600083830152505050565b6000613ad0613acb84613a7d565b613a62565b905082815260208101848484011115613aec57613aeb6139ec565b5b613af7848285613aae565b509392505050565b600082601f830112613b1457613b136139e7565b5b8135613b24848260208601613abd565b91505092915050565b60008060008060808587031215613b4757613b46613792565b5b6000613b55878288016138de565b9450506020613b66878288016138de565b9350506040613b7787828801613914565b925050606085013567ffffffffffffffff811115613b9857613b97613797565b5b613ba487828801613aff565b91505092959194509250565b613bb98161379c565b82525050565b6000602082019050613bd46000830184613bb0565b92915050565b600060208284031215613bf057613bef613792565b5b6000613bfe84828501613914565b91505092915050565b613c10816138f3565b82525050565b6000602082019050613c2b6000830184613c07565b92915050565b6000613c3c82613877565b9050919050565b613c4c81613c31565b8114613c5757600080fd5b50565b600081359050613c6981613c43565b92915050565b600080600060608486031215613c8857613c87613792565b5b6000613c9686828701613c5a565b9350506020613ca7868287016138de565b9250506040613cb886828701613914565b9150509250925092565b6000819050919050565b6000613ce7613ce2613cdd84613857565b613cc2565b613857565b9050919050565b6000613cf982613ccc565b9050919050565b6000613d0b82613cee565b9050919050565b613d1b81613d00565b82525050565b6000602082019050613d366000830184613d12565b92915050565b6000613d4782613857565b9050919050565b613d5781613d3c565b8114613d6257600080fd5b50565b600081359050613d7481613d4e565b92915050565b60008060408385031215613d9157613d90613792565b5b6000613d9f85828601613d65565b9250506020613db085828601613914565b9150509250929050565b6000613dc582613cee565b9050919050565b613dd581613dba565b82525050565b6000602082019050613df06000830184613dcc565b92915050565b6000613e0182613877565b9050919050565b613e1181613df6565b8114613e1c57600080fd5b50565b600081359050613e2e81613e08565b92915050565b600080fd5b600080fd5b60008083601f840112613e5457613e536139e7565b5b8235905067ffffffffffffffff811115613e7157613e70613e34565b5b602083019150836020820283011115613e8d57613e8c613e39565b5b9250929050565b60008083601f840112613eaa57613ea96139e7565b5b8235905067ffffffffffffffff811115613ec757613ec6613e34565b5b602083019150836001820283011115613ee357613ee2613e39565b5b9250929050565b60008060008060008060008060a0898b031215613f0a57613f09613792565b5b6000613f188b828c01613e1f565b9850506020613f298b828c016138de565b975050604089013567ffffffffffffffff811115613f4a57613f49613797565b5b613f568b828c01613e3e565b9650965050606089013567ffffffffffffffff811115613f7957613f78613797565b5b613f858b828c01613e3e565b9450945050608089013567ffffffffffffffff811115613fa857613fa7613797565b5b613fb48b828c01613e94565b92509250509295985092959890939650565b60008083601f840112613fdc57613fdb6139e7565b5b8235905067ffffffffffffffff811115613ff957613ff8613e34565b5b6020830191508360e082028301111561401557614014613e39565b5b9250929050565b600061ffff82169050919050565b6140338161401c565b811461403e57600080fd5b50565b6000813590506140508161402a565b92915050565b60008060008060006080868803121561407257614071613792565b5b600086013567ffffffffffffffff8111156140905761408f613797565b5b61409c88828901613fc6565b955095505060206140af88828901614041565b93505060406140c0888289016138de565b92505060606140d188828901613914565b9150509295509295909350565b6140e781613877565b82525050565b600060208201905061410260008301846140de565b92915050565b60006020828403121561411e5761411d613792565b5b600061412c84828501613c5a565b91505092915050565b60008060008060008060008060a0898b03121561415557614154613792565b5b60006141638b828c016138de565b98505060206141748b828c016138de565b975050604089013567ffffffffffffffff81111561419557614194613797565b5b6141a18b828c01613e3e565b9650965050606089013567ffffffffffffffff8111156141c4576141c3613797565b5b6141d08b828c01613e3e565b9450945050608089013567ffffffffffffffff8111156141f3576141f2613797565b5b6141ff8b828c01613e94565b92509250509295985092959890939650565b60008083601f840112614227576142266139e7565b5b8235905067ffffffffffffffff81111561424457614243613e34565b5b6020830191508360208202830111156142605761425f613e39565b5b9250929050565b60008060008060008060006080888a03121561428657614285613792565b5b600088013567ffffffffffffffff8111156142a4576142a3613797565b5b6142b08a828b01613fc6565b975097505060206142c38a828b01614041565b955050604088013567ffffffffffffffff8111156142e4576142e3613797565b5b6142f08a828b01614211565b9450945050606088013567ffffffffffffffff81111561431357614312613797565b5b61431f8a828b01613e3e565b925092505092959891949750929550565b60008060008060008060a0878903121561434d5761434c613792565b5b600061435b89828a016138de565b965050602061436c89828a016138de565b955050604061437d89828a01613914565b945050606061438e89828a01613914565b935050608087013567ffffffffffffffff8111156143af576143ae613797565b5b6143bb89828a01613e94565b92509250509295509295509295565b6000602082840312156143e0576143df613792565b5b60006143ee848285016138de565b91505092915050565b600063ffffffff82169050919050565b614410816143f7565b811461441b57600080fd5b50565b60008135905061442d81614407565b92915050565b600080600080600080600080600080600060e08c8e03121561445857614457613792565b5b60008c013567ffffffffffffffff81111561447657614475613797565b5b6144828e828f01613fc6565b9b509b505060206144958e828f01614041565b99505060408c013567ffffffffffffffff8111156144b6576144b5613797565b5b6144c28e828f01614211565b985098505060608c013567ffffffffffffffff8111156144e5576144e4613797565b5b6144f18e828f01613e3e565b965096505060808c013567ffffffffffffffff81111561451457614513613797565b5b6145208e828f01613e3e565b945094505060a06145338e828f0161441e565b92505060c06145448e828f0161441e565b9150509295989b509295989b9093969950565b60008060008060008060008060e0898b03121561457757614576613792565b5b600089013567ffffffffffffffff81111561459557614594613797565b5b6145a18b828c01613fc6565b985098505060206145b48b828c01614041565b96505060406145c58b828c016138de565b95505060606145d68b828c01613914565b94505060806145e78b828c01613914565b93505060a06145f88b828c0161441e565b92505060c06146098b828c0161441e565b9150509295985092959890939650565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614660602083614619565b915061466b8261462a565b602082019050919050565b6000602082019050818103600083015261468f81614653565b9050919050565b60006060820190506146ab60008301866140de565b6146b860208301856140de565b6146c56040830184613c07565b949350505050565b600082825260208201905092915050565b600080fd5b60006146ef83856146cd565b93507f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115614722576147216146de565b5b602083029250614733838584613aae565b82840190509392505050565b600082825260208201905092915050565b600061475c838561473f565b9350614769838584613aae565b614772836139f1565b840190509392505050565b600060a082019050614792600083018b6140de565b61479f602083018a6140de565b81810360408301526147b281888a6146e3565b905081810360608301526147c78186886146e3565b905081810360808301526147dc818486614750565b90509998505050505050505050565b600060408201905061480060008301856140de565b61480d6020830184613c07565b9392505050565b61481d81613821565b811461482857600080fd5b50565b60008151905061483a81614814565b92915050565b60006020828403121561485657614855613792565b5b60006148648482850161482b565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000813590506148ab81614814565b92915050565b6000602082840312156148c7576148c6613792565b5b60006148d58482850161489c565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614918826138f3565b9150614923836138f3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614958576149576148de565b5b828201905092915050565b600061496e826138f3565b9150614979836138f3565b92508282101561498c5761498b6148de565b5b828203905092915050565b600080fd5b600067ffffffffffffffff82169050919050565b6149b98161499c565b81146149c457600080fd5b50565b6000813590506149d6816149b0565b92915050565b60006fffffffffffffffffffffffffffffffff82169050919050565b614a01816149dc565b8114614a0c57600080fd5b50565b600081359050614a1e816149f8565b92915050565b600060e08284031215614a3a57614a39614997565b5b614a4460e0613a62565b90506000614a54848285016138de565b6000830152506020614a6884828501613914565b6020830152506040614a7c848285016138de565b6040830152506060614a90848285016149c7565b6060830152506080614aa484828501614a0f565b60808301525060a0614ab8848285016138de565b60a08301525060c0614acc8482850161489c565b60c08301525092915050565b600060e08284031215614aee57614aed613792565b5b6000614afc84828501614a24565b91505092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614b61602683614619565b9150614b6c82614b05565b604082019050919050565b60006020820190508181036000830152614b9081614b54565b9050919050565b6000614ba2826138f3565b9150614bad836138f3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614be657614be56148de565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614c2b826138f3565b9150614c36836138f3565b925082614c4657614c45614bf1565b5b828204905092915050565b6000614c5c826138f3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614c8e57614c8d6148de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000604082019050614cdd60008301856140de565b614cea60208301846140de565b9392505050565b600081519050614d00816138fd565b92915050565b600060208284031215614d1c57614d1b613792565b5b6000614d2a84828501614cf1565b91505092915050565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60008201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015250565b6000614d8f603683614619565b9150614d9a82614d33565b604082019050919050565b60006020820190508181036000830152614dbe81614d82565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000614e21602a83614619565b9150614e2c82614dc5565b604082019050919050565b60006020820190508181036000830152614e5081614e14565b9050919050565b6000606082019050614e6c60008301866140de565b614e796020830185613c07565b614e8660408301846140de565b949350505050565b600081519050614e9d816149b0565b92915050565b600081519050614eb2816149f8565b92915050565b600081519050614ec7816138c7565b92915050565b600060808284031215614ee357614ee2614997565b5b614eed6080613a62565b90506000614efd84828501614e8e565b6000830152506020614f1184828501614ea3565b6020830152506040614f2584828501614e8e565b6040830152506060614f3984828501614eb8565b60608301525092915050565b600060808284031215614f5b57614f5a613792565b5b6000614f6984828501614ecd565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b614fa781613877565b82525050565b614fb6816138f3565b82525050565b614fc58161499c565b82525050565b614fd4816149dc565b82525050565b614fe381613821565b82525050565b60e082016000820151614fff6000850182614f9e565b5060208201516150126020850182614fad565b5060408201516150256040850182614f9e565b5060608201516150386060850182614fbc565b50608082015161504b6080850182614fcb565b5060a082015161505e60a0850182614f9e565b5060c082015161507160c0850182614fda565b50505050565b60006150838383614fe9565b60e08301905092915050565b6000602082019050919050565b60006150a782614f72565b6150b18185614f7d565b93506150bc83614f8e565b8060005b838110156150ed5781516150d48882615077565b97506150df8361508f565b9250506001810190506150c0565b5085935050505092915050565b60006020820190508181036000830152615114818461509c565b905092915050565b600061513761513261512d846149dc565b613cc2565b6138f3565b9050919050565b6151478161511c565b82525050565b600081519050919050565b60005b8381101561517657808201518184015260208101905061515b565b83811115615185576000848401525b50505050565b60006151968261514d565b6151a0818561473f565b93506151b0818560208601615158565b6151b9816139f1565b840191505092915050565b60006080820190506151d96000830187613c07565b6151e66020830186613c07565b6151f3604083018561513e565b8181036060830152615205818461518b565b905095945050505050565b6000602082019050818103600083015261522a818461518b565b905092915050565b60006060820190506152476000830186613c07565b6152546020830185613c07565b615261604083018461513e565b949350505050565b50565b600061527960008361473f565b915061528482615269565b600082019050919050565b600060a0820190506152a460008301876140de565b6152b160208301866140de565b6152be6040830185613c07565b6152cb6060830184613c07565b81810360808301526152dc8161526c565b905095945050505050565b7f6261640000000000000000000000000000000000000000000000000000000000600082015250565b600061531d600383614619565b9150615328826152e7565b602082019050919050565b6000602082019050818103600083015261534c81615310565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006153af602683614619565b91506153ba82615353565b604082019050919050565b600060208201905081810360008301526153de816153a2565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b600061541b601d83614619565b9150615426826153e5565b602082019050919050565b6000602082019050818103600083015261544a8161540e565b9050919050565b600081905092915050565b60006154678261514d565b6154718185615451565b9350615481818560208601615158565b80840191505092915050565b6000615499828461545c565b915081905092915050565b600081519050919050565b60006154ba826154a4565b6154c48185614619565b93506154d4818560208601615158565b6154dd816139f1565b840191505092915050565b6000602082019050818103600083015261550281846154af565b90509291505056fea26469706673582212206b86ce96f5d968e35ad171793f686ad305161b077025413b0f346e3f612749bb64736f6c634300080e003300000000000000000000000068d25992b1b04be8a70104de8cb598170ab9aad5000000000000000000000000b0c7a3ba49c7a6eaba6cd4a96c55a1391070ac9a000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x60806040526004361061019c5760003560e01c806372fbf15c116100ec578063e4d835b41161008a578063f2fde38b11610064578063f2fde38b146105a8578063f74b059e146105d1578063f924887f146105fa578063f96886c8146106165761019c565b8063e4d835b414610526578063eae3d31c14610542578063f23a6e611461056b5761019c565b806399a5d747116100c657806399a5d74714610458578063a525ad3c14610495578063b8d1452f146104c0578063bc197c81146104e95761019c565b806372fbf15c146103e85780637f266643146104115780638da5cb5b1461042d5761019c565b806338e3127f116101595780636412173e116101335780636412173e14610352578063682c02741461037d57806369fe0e2d146103a8578063715018a6146103d15761019c565b806338e3127f146102d35780633fc8cef3146102fe57806357c1d72b146103295761019c565b806301ffc9a7146101a1578063035b553b146101de5780631102610e14610207578063150b7a0214610230578063209b7abc1461026d57806329d0be8d146102aa575b600080fd5b3480156101ad57600080fd5b506101c860048036038101906101c391906137f4565b610632565b6040516101d5919061383c565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190613929565b61069c565b005b34801561021357600080fd5b5061022e600480360381019061022991906139ba565b61078c565b005b34801561023c57600080fd5b5061025760048036038101906102529190613b2d565b61084c565b6040516102649190613bbf565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f9190613bda565b610860565b6040516102a19190613c16565b60405180910390f35b3480156102b657600080fd5b506102d160048036038101906102cc9190613c6f565b610872565b005b3480156102df57600080fd5b506102e86108fe565b6040516102f59190613c16565b60405180910390f35b34801561030a57600080fd5b50610313610904565b6040516103209190613d21565b60405180910390f35b34801561033557600080fd5b50610350600480360381019061034b9190613d7a565b61092a565b005b34801561035e57600080fd5b506103676109f1565b6040516103749190613d21565b60405180910390f35b34801561038957600080fd5b50610392610a17565b60405161039f9190613ddb565b60405180910390f35b3480156103b457600080fd5b506103cf60048036038101906103ca9190613bda565b610a3d565b005b3480156103dd57600080fd5b506103e6610ac5565b005b3480156103f457600080fd5b5061040f600480360381019061040a9190613eea565b610b4d565b005b61042b60048036038101906104269190614056565b610c4c565b005b34801561043957600080fd5b50610442610f87565b60405161044f91906140ed565b60405180910390f35b34801561046457600080fd5b5061047f600480360381019061047a9190613bda565b610fb1565b60405161048c9190613c16565b60405180910390f35b3480156104a157600080fd5b506104aa610fc3565b6040516104b79190613c16565b60405180910390f35b3480156104cc57600080fd5b506104e760048036038101906104e29190614108565b610fca565b005b3480156104f557600080fd5b50610510600480360381019061050b9190614135565b61108a565b60405161051d9190613bbf565b60405180910390f35b610540600480360381019061053b9190614267565b6110a2565b005b34801561054e57600080fd5b5061056960048036038101906105649190613c6f565b611650565b005b34801561057757600080fd5b50610592600480360381019061058d9190614330565b6116fc565b60405161059f9190613bbf565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca91906143ca565b611712565b005b3480156105dd57600080fd5b506105f860048036038101906105f39190614108565b611809565b005b610614600480360381019061060f9190614433565b6118c9565b005b610630600480360381019061062b9190614557565b611ebd565b005b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6106a4612254565b73ffffffffffffffffffffffffffffffffffffffff166106c2610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610718576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070f90614676565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff166342842e0e3084846040518463ffffffff1660e01b815260040161075593929190614696565b600060405180830381600087803b15801561076f57600080fd5b505af1158015610783573d6000803e3d6000fd5b50505050505050565b610794612254565b73ffffffffffffffffffffffffffffffffffffffff166107b2610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610808576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ff90614676565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600063150b7a0260e01b9050949350505050565b600061086b8261225c565b9050919050565b61087a612254565b73ffffffffffffffffffffffffffffffffffffffff16610898610f87565b73ffffffffffffffffffffffffffffffffffffffff16146108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e590614676565b60405180910390fd5b6108f983838361228f565b505050565b60025481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610932612254565b73ffffffffffffffffffffffffffffffffffffffff16610950610f87565b73ffffffffffffffffffffffffffffffffffffffff16146109a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099d90614676565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156109ec573d6000803e3d6000fd5b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a45612254565b73ffffffffffffffffffffffffffffffffffffffff16610a63610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610ab9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab090614676565b60405180910390fd5b610ac2816122bf565b50565b610acd612254565b73ffffffffffffffffffffffffffffffffffffffff16610aeb610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610b41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3890614676565b60405180910390fd5b610b4b60006122c9565b565b610b55612254565b73ffffffffffffffffffffffffffffffffffffffff16610b73610f87565b73ffffffffffffffffffffffffffffffffffffffff1614610bc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc090614676565b60405180910390fd5b8773ffffffffffffffffffffffffffffffffffffffff16632eb2c2d630898989898989896040518963ffffffff1660e01b8152600401610c1098979695949392919061477d565b600060405180830381600087803b158015610c2a57600080fd5b505af1158015610c3e573d6000803e3d6000fd5b505050505050505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015610ca95750600034115b15610cec57348114610ce7576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610df5565b60003414610d26576040517f34d1c8cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d533330838573ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610db09291906147eb565b6020604051808303816000875af1158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df39190614840565b505b600080610e0487878786612418565b9150915060008103610e42576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610e4d8361250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610ed4575087876000818110610ebb57610eba61486d565b5b905060e0020160c0016020810190610ed391906148b1565b5b15610f3b573373ffffffffffffffffffffffffffffffffffffffff166108fc8285610eff919061490d565b86610f0a9190614963565b9081150290604051600060405180830381858888f19350505050158015610f35573d6000803e3d6000fd5b50610f7d565b610f7c338285610f4b919061490d565b86610f569190614963565b8773ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b5050505050505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610fbc8261250c565b9050919050565b620f424081565b610fd2612254565b73ffffffffffffffffffffffffffffffffffffffff16610ff0610f87565b73ffffffffffffffffffffffffffffffffffffffff1614611046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103d90614676565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600063bc197c8160e01b905098975050505050505050565b6000808585905090505b808210156112ee57600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16868684818110611100576110ff61486d565b5b905060200201602081019061111591906143ca565b73ffffffffffffffffffffffffffffffffffffffff161480156111385750600034115b1561119457348484848181106111515761115061486d565b5b905060200201351461118f576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112e3565b61120133308686868181106111ac576111ab61486d565b5b905060200201358989878181106111c6576111c561486d565b5b90506020020160208101906111db91906143ca565b73ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b8585838181106112145761121361486d565b5b905060200201602081019061122991906143ca565b73ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686868681811061127a5761127961486d565b5b905060200201356040518363ffffffff1660e01b815260040161129e9291906147eb565b6020604051808303816000875af11580156112bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e19190614840565b505b8160010191506110ac565b600061133a858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506125b7565b90506000806113e28c8c808060200260200160405190810160405280939291908181526020016000905b8282101561139457848483905060e002018036038101906113859190614ad8565b81526020019060010190611364565b50505050508b8b8b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508661266a565b9150915060008103611420576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600094505b838510156116425760006114528387815181106114455761144461486d565b5b602002602001015161250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168a8a888181106114a05761149f61486d565b5b90506020020160208101906114b591906143ca565b73ffffffffffffffffffffffffffffffffffffffff1614801561150057508c8c60008181106114e7576114e661486d565b5b905060e0020160c00160208101906114ff91906148b1565b5b1561159a573373ffffffffffffffffffffffffffffffffffffffff166108fc828589815181106115335761153261486d565b5b6020026020010151611545919061490d565b8a8a8a8181106115585761155761486d565b5b905060200201356115699190614963565b9081150290604051600060405180830381858888f19350505050158015611594573d6000803e3d6000fd5b50611636565b61163533828589815181106115b2576115b161486d565b5b60200260200101516115c4919061490d565b8a8a8a8181106115d7576115d661486d565b5b905060200201356115e89190614963565b8c8c8a8181106115fb576115fa61486d565b5b905060200201602081019061161091906143ca565b73ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b85600101955050611425565b505050505050505050505050565b611658612254565b73ffffffffffffffffffffffffffffffffffffffff16611676610f87565b73ffffffffffffffffffffffffffffffffffffffff16146116cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c390614676565b60405180910390fd5b6116f782828573ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b505050565b600063f23a6e6160e01b90509695505050505050565b61171a612254565b73ffffffffffffffffffffffffffffffffffffffff16611738610f87565b73ffffffffffffffffffffffffffffffffffffffff161461178e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178590614676565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036117fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f490614b77565b60405180910390fd5b611806816122c9565b50565b611811612254565b73ffffffffffffffffffffffffffffffffffffffff1661182f610f87565b73ffffffffffffffffffffffffffffffffffffffff1614611885576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187c90614676565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60005b86869050811015611b1157600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168989838181106119235761192261486d565b5b905060200201602081019061193891906143ca565b73ffffffffffffffffffffffffffffffffffffffff1614801561195b5750600034115b156119b757348787838181106119745761197361486d565b5b90506020020135146119b2576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b06565b611a2433308989858181106119cf576119ce61486d565b5b905060200201358c8c868181106119e9576119e861486d565b5b90506020020160208101906119fe91906143ca565b73ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b888882818110611a3757611a3661486d565b5b9050602002016020810190611a4c91906143ca565b73ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16898985818110611a9d57611a9c61486d565b5b905060200201356040518363ffffffff1660e01b8152600401611ac19291906147eb565b6020604051808303816000875af1158015611ae0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b049190614840565b505b8060010190506118cc565b506000611b5e878780806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506125b7565b9050600080611c4a8e8e808060200260200160405190810160405280939291908181526020016000905b82821015611bb857848483905060e00201803603810190611ba99190614ad8565b81526020019060010190611b88565b50505050508d8d8d80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050868b8b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508a8a61280b565b509150915060008103611c89576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b89899050811015611eac576000611cbc848381518110611caf57611cae61486d565b5b602002602001015161250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168d8d84818110611d0a57611d0961486d565b5b9050602002016020810190611d1f91906143ca565b73ffffffffffffffffffffffffffffffffffffffff16148015611d6a57508f8f6000818110611d5157611d5061486d565b5b905060e0020160c0016020810190611d6991906148b1565b5b15611e04573373ffffffffffffffffffffffffffffffffffffffff166108fc82868581518110611d9d57611d9c61486d565b5b6020026020010151611daf919061490d565b8d8d86818110611dc257611dc161486d565b5b90506020020135611dd39190614963565b9081150290604051600060405180830381858888f19350505050158015611dfe573d6000803e3d6000fd5b50611ea0565b611e9f3382868581518110611e1c57611e1b61486d565b5b6020026020010151611e2e919061490d565b8d8d86818110611e4157611e4061486d565b5b90506020020135611e529190614963565b8f8f86818110611e6557611e6461486d565b5b9050602002016020810190611e7a91906143ca565b73ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b81600101915050611c8c565b505050505050505050505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015611f1a5750600034115b15611f5d57348414611f58576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612066565b60003414611f97576040517f34d1c8cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fc43330868873ffffffffffffffffffffffffffffffffffffffff1661238f909392919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518363ffffffff1660e01b81526004016120219291906147eb565b6020604051808303816000875af1158015612040573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120649190614840565b505b6000806120cd8a8a808060200260200160405190810160405280939291908181526020016000905b828210156120be57848483905060e002018036038101906120af9190614ad8565b8152602001906001019061208e565b50505050508988888888612a1f565b50915091506000810361210c576040517f46b4f59500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006121178361250c565b9050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614801561219e57508a8a60008181106121855761218461486d565b5b905060e0020160c001602081019061219d91906148b1565b5b15612205573373ffffffffffffffffffffffffffffffffffffffff166108fc82856121c9919061490d565b896121d49190614963565b9081150290604051600060405180830381858888f193505050501580156121ff573d6000803e3d6000fd5b50612247565b612246338285612215919061490d565b896122209190614963565b8a73ffffffffffffffffffffffffffffffffffffffff166125319092919063ffffffff16565b5b5050505050505050505050565b600033905090565b6000600254620f424061226f919061490d565b620f42408361227e9190614b97565b6122889190614c20565b9050919050565b6122ba82828573ffffffffffffffffffffffffffffffffffffffff16612b2d9092919063ffffffff16565b505050565b8060028190555050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612412846323b872dd60e01b8585856040516024016123b093929190614696565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c7c565b50505050565b60008060006124268461225c565b90506000808888905090505b8082101561250057600080600061247d8c8c878181106124555761245461486d565b5b905060e0020180360381019061246b9190614ad8565b8b8a896124789190614963565b612d43565b92509250925081156124aa578288612495919061490d565b975086806124a290614c51565b9750506124f2565b6003808111156124bd576124bc614c99565b5b8160038111156124d0576124cf614c99565b5b1480156124e457506124e38a6004613478565b5b156124f157505050612500565b5b846001019450505050612432565b50505094509492505050565b6000620f4240600254836125209190614b97565b61252a9190614c20565b9050919050565b6125b28363a9059cbb60e01b84846040516024016125509291906147eb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c7c565b505050565b6060815167ffffffffffffffff8111156125d4576125d3613a02565b5b6040519080825280602002602001820160405280156126025781602001602082028036833780820191505090505b50905060008251905060005b818110156126635761263984828151811061262c5761262b61486d565b5b602002602001015161225c565b83828151811061264c5761264b61486d565b5b60200260200101818152505080600101905061260e565b5050919050565b60606000835167ffffffffffffffff81111561268957612688613a02565b5b6040519080825280602002602001820160405280156126b75781602001602082028036833780820191505090505b50915060005b86518110156128015760006126f0868984815181106126df576126de61486d565b5b602002602001015160a0015161348f565b9050600080600061275b8b868151811061270d5761270c61486d565b5b60200260200101518b8987815181106127295761272861486d565b5b60200260200101518b88815181106127445761274361486d565b5b60200260200101516127569190614963565b612d43565b92509250925081156127a9578287858151811061277b5761277a61486d565b5b6020026020010181815161278f919061490d565b9150818152505085806127a190614c51565b9650506127f2565b6003808111156127bc576127bb614c99565b5b8160038111156127cf576127ce614c99565b5b1480156127e357506127e28a6004613478565b5b156127f15750505050612801565b5b846001019450505050506126bd565b5094509492505050565b6060600080875167ffffffffffffffff81111561282b5761282a613a02565b5b6040519080825280602002602001820160405280156128595781602001602082028036833780820191505090505b50925060005b8a51811015612a11578563ffffffff168310158061288357508463ffffffff168210155b612a115760006128b18a8d84815181106128a05761289f61486d565b5b602002602001015160a0015161348f565b90508781815181106128c6576128c561486d565b5b60200260200101518582815181106128e1576128e061486d565b5b6020026020010151106128f45750612a11565b600080600061295d8f868151811061290f5761290e61486d565b5b60200260200101518f8a878151811061292b5761292a61486d565b5b60200260200101518f88815181106129465761294561486d565b5b60200260200101516129589190614963565b612d43565b92509250925081156129ab578288858151811061297d5761297c61486d565b5b60200260200101818151612991919061490d565b9150818152505086806129a390614c51565b975050612a02565b6003808111156129be576129bd614c99565b5b8160038111156129d1576129d0614c99565b5b1480156129e557506129e48e6004613478565b5b156129f35750505050612a11565b85806129fe90614c51565b9650505b8460010194505050505061285f565b509750975097945050505050565b600080600080600090505b8951811015612b20578563ffffffff1683101580612a4e57508463ffffffff168210155b612b205786841015612b20576000806000612a8f8d8581518110612a7557612a7461486d565b5b60200260200101518d898e612a8a9190614963565b612d43565b9250925092508115612abc578287612aa7919061490d565b96508580612ab490614c51565b965050612b12565b600380811115612acf57612ace614c99565b5b816003811115612ae257612ae1614c99565b5b148015612af65750612af58c6004613478565b5b15612b0357505050612b20565b8480612b0e90614c51565b9550505b836001019350505050612a2a565b5096509650969350505050565b6000811480612bb7575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401612b74929190614cc8565b602060405180830381865afa158015612b91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb59190614d06565b145b612bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bed90614da5565b60405180910390fd5b612c778363095ea7b360e01b8484604051602401612c159291906147eb565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612c7c565b505050565b6000612cde826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166135359092919063ffffffff16565b9050600081511115612d3e5780806020019051810190612cfe9190614840565b612d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d3490614e37565b60405180910390fd5b5b505050565b600080600080866060015167ffffffffffffffff1690506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636bd3a64b89600001518a602001518b604001516040518463ffffffff1660e01b8152600401612dc793929190614e57565b608060405180830381865afa158015612de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e089190614f45565b905081816000015167ffffffffffffffff161015612e5957612e2b876002613478565b15612e4657806000015167ffffffffffffffff169150612e58565b6000806002945094509450505061346f565b5b858282602001516fffffffffffffffffffffffffffffffff16612e7c9190614b97565b1115612e94576000806003945094509450505061346f565b6000600167ffffffffffffffff811115612eb157612eb0613a02565b5b604051908082528060200260200182016040528015612eea57816020015b612ed76136eb565b815260200190600190039081612ecf5790505b5090508881600081518110612f0257612f0161486d565b5b6020026020010181905250600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b60a0015173ffffffffffffffffffffffffffffffffffffffff1614612f70576000612f93565b848b608001516fffffffffffffffffffffffffffffffff16612f929190614b97565b5b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a07076b282856040518363ffffffff1660e01b8152600401612ff191906150fa565b6000604051808303818588803b15801561300a57600080fd5b505af19350505050801561301c575060015b613158573d806000811461304c576040519150601f19603f3d011682016040523d82523d6000602084013e613051565b606091505b5061305d8b6010613478565b156130f5573373ffffffffffffffffffffffffffffffffffffffff168c6040015173ffffffffffffffffffffffffffffffffffffffff168d6000015173ffffffffffffffffffffffffffffffffffffffff167f4219d9724ded66a17a808c838643881e763e9239750585c908c5c58eac8995988f602001518a8a60200151876040516130ec94939291906151c4565b60405180910390a45b6131008b6001613478565b1561314257806040517fd32529e60000000000000000000000000000000000000000000000000000000081526004016131399190615210565b60405180910390fd5b600080600198509850985050505050505061346f565b6131638a600c613478565b156131f9573373ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff168c6000015173ffffffffffffffffffffffffffffffffffffffff167f338caed77504067792f381fe95337e7f5758a61f4d1d12a27b28a05212623d8b8e602001518989602001516040516131f093929190615232565b60405180910390a45b8a6000015173ffffffffffffffffffffffffffffffffffffffff166301ffc9a76380ac58cd60e01b6040518263ffffffff1660e01b815260040161323d9190613bbf565b602060405180830381865afa15801561325a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061327e9190614840565b156132ff578a6000015173ffffffffffffffffffffffffffffffffffffffff166342842e0e30338e602001516040518463ffffffff1660e01b81526004016132c893929190614696565b600060405180830381600087803b1580156132e257600080fd5b505af11580156132f6573d6000803e3d6000fd5b5050505061343a565b8a6000015173ffffffffffffffffffffffffffffffffffffffff166301ffc9a763d9b67a2660e01b6040518263ffffffff1660e01b81526004016133439190613bbf565b602060405180830381865afa158015613360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133849190614840565b15613407578a6000015173ffffffffffffffffffffffffffffffffffffffff1663f242432a30338e60200151896040518563ffffffff1660e01b81526004016133d0949392919061528f565b600060405180830381600087803b1580156133ea57600080fd5b505af11580156133fe573d6000803e3d6000fd5b50505050613439565b6040517fc79e7f5a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b8484602001516fffffffffffffffffffffffffffffffff1661345c9190614b97565b9150816001600097509750975050505050505b93509350939050565b60008161ffff1682841661ffff1614905092915050565b60005b82518110156134f4578173ffffffffffffffffffffffffffffffffffffffff168382815181106134c5576134c461486d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16031561352f57806001019050613492565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161352690615333565b60405180910390fd5b92915050565b6060613544848460008561354d565b90509392505050565b606082471015613592576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613589906153c5565b60405180910390fd5b61359b85613661565b6135da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135d190615431565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613603919061548d565b60006040518083038185875af1925050503d8060008114613640576040519150601f19603f3d011682016040523d82523d6000602084013e613645565b606091505b5091509150613655828286613684565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60608315613694578290506136e4565b6000835111156136a75782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136db91906154e8565b60405180910390fd5b9392505050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff16815260200160006fffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000151581525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6137d18161379c565b81146137dc57600080fd5b50565b6000813590506137ee816137c8565b92915050565b60006020828403121561380a57613809613792565b5b6000613818848285016137df565b91505092915050565b60008115159050919050565b61383681613821565b82525050565b6000602082019050613851600083018461382d565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061388282613857565b9050919050565b600061389482613877565b9050919050565b6138a481613889565b81146138af57600080fd5b50565b6000813590506138c18161389b565b92915050565b6138d081613877565b81146138db57600080fd5b50565b6000813590506138ed816138c7565b92915050565b6000819050919050565b613906816138f3565b811461391157600080fd5b50565b600081359050613923816138fd565b92915050565b60008060006060848603121561394257613941613792565b5b6000613950868287016138b2565b9350506020613961868287016138de565b925050604061397286828701613914565b9150509250925092565b600061398782613877565b9050919050565b6139978161397c565b81146139a257600080fd5b50565b6000813590506139b48161398e565b92915050565b6000602082840312156139d0576139cf613792565b5b60006139de848285016139a5565b91505092915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613a3a826139f1565b810181811067ffffffffffffffff82111715613a5957613a58613a02565b5b80604052505050565b6000613a6c613788565b9050613a788282613a31565b919050565b600067ffffffffffffffff821115613a9857613a97613a02565b5b613aa1826139f1565b9050602081019050919050565b82818337600083830152505050565b6000613ad0613acb84613a7d565b613a62565b905082815260208101848484011115613aec57613aeb6139ec565b5b613af7848285613aae565b509392505050565b600082601f830112613b1457613b136139e7565b5b8135613b24848260208601613abd565b91505092915050565b60008060008060808587031215613b4757613b46613792565b5b6000613b55878288016138de565b9450506020613b66878288016138de565b9350506040613b7787828801613914565b925050606085013567ffffffffffffffff811115613b9857613b97613797565b5b613ba487828801613aff565b91505092959194509250565b613bb98161379c565b82525050565b6000602082019050613bd46000830184613bb0565b92915050565b600060208284031215613bf057613bef613792565b5b6000613bfe84828501613914565b91505092915050565b613c10816138f3565b82525050565b6000602082019050613c2b6000830184613c07565b92915050565b6000613c3c82613877565b9050919050565b613c4c81613c31565b8114613c5757600080fd5b50565b600081359050613c6981613c43565b92915050565b600080600060608486031215613c8857613c87613792565b5b6000613c9686828701613c5a565b9350506020613ca7868287016138de565b9250506040613cb886828701613914565b9150509250925092565b6000819050919050565b6000613ce7613ce2613cdd84613857565b613cc2565b613857565b9050919050565b6000613cf982613ccc565b9050919050565b6000613d0b82613cee565b9050919050565b613d1b81613d00565b82525050565b6000602082019050613d366000830184613d12565b92915050565b6000613d4782613857565b9050919050565b613d5781613d3c565b8114613d6257600080fd5b50565b600081359050613d7481613d4e565b92915050565b60008060408385031215613d9157613d90613792565b5b6000613d9f85828601613d65565b9250506020613db085828601613914565b9150509250929050565b6000613dc582613cee565b9050919050565b613dd581613dba565b82525050565b6000602082019050613df06000830184613dcc565b92915050565b6000613e0182613877565b9050919050565b613e1181613df6565b8114613e1c57600080fd5b50565b600081359050613e2e81613e08565b92915050565b600080fd5b600080fd5b60008083601f840112613e5457613e536139e7565b5b8235905067ffffffffffffffff811115613e7157613e70613e34565b5b602083019150836020820283011115613e8d57613e8c613e39565b5b9250929050565b60008083601f840112613eaa57613ea96139e7565b5b8235905067ffffffffffffffff811115613ec757613ec6613e34565b5b602083019150836001820283011115613ee357613ee2613e39565b5b9250929050565b60008060008060008060008060a0898b031215613f0a57613f09613792565b5b6000613f188b828c01613e1f565b9850506020613f298b828c016138de565b975050604089013567ffffffffffffffff811115613f4a57613f49613797565b5b613f568b828c01613e3e565b9650965050606089013567ffffffffffffffff811115613f7957613f78613797565b5b613f858b828c01613e3e565b9450945050608089013567ffffffffffffffff811115613fa857613fa7613797565b5b613fb48b828c01613e94565b92509250509295985092959890939650565b60008083601f840112613fdc57613fdb6139e7565b5b8235905067ffffffffffffffff811115613ff957613ff8613e34565b5b6020830191508360e082028301111561401557614014613e39565b5b9250929050565b600061ffff82169050919050565b6140338161401c565b811461403e57600080fd5b50565b6000813590506140508161402a565b92915050565b60008060008060006080868803121561407257614071613792565b5b600086013567ffffffffffffffff8111156140905761408f613797565b5b61409c88828901613fc6565b955095505060206140af88828901614041565b93505060406140c0888289016138de565b92505060606140d188828901613914565b9150509295509295909350565b6140e781613877565b82525050565b600060208201905061410260008301846140de565b92915050565b60006020828403121561411e5761411d613792565b5b600061412c84828501613c5a565b91505092915050565b60008060008060008060008060a0898b03121561415557614154613792565b5b60006141638b828c016138de565b98505060206141748b828c016138de565b975050604089013567ffffffffffffffff81111561419557614194613797565b5b6141a18b828c01613e3e565b9650965050606089013567ffffffffffffffff8111156141c4576141c3613797565b5b6141d08b828c01613e3e565b9450945050608089013567ffffffffffffffff8111156141f3576141f2613797565b5b6141ff8b828c01613e94565b92509250509295985092959890939650565b60008083601f840112614227576142266139e7565b5b8235905067ffffffffffffffff81111561424457614243613e34565b5b6020830191508360208202830111156142605761425f613e39565b5b9250929050565b60008060008060008060006080888a03121561428657614285613792565b5b600088013567ffffffffffffffff8111156142a4576142a3613797565b5b6142b08a828b01613fc6565b975097505060206142c38a828b01614041565b955050604088013567ffffffffffffffff8111156142e4576142e3613797565b5b6142f08a828b01614211565b9450945050606088013567ffffffffffffffff81111561431357614312613797565b5b61431f8a828b01613e3e565b925092505092959891949750929550565b60008060008060008060a0878903121561434d5761434c613792565b5b600061435b89828a016138de565b965050602061436c89828a016138de565b955050604061437d89828a01613914565b945050606061438e89828a01613914565b935050608087013567ffffffffffffffff8111156143af576143ae613797565b5b6143bb89828a01613e94565b92509250509295509295509295565b6000602082840312156143e0576143df613792565b5b60006143ee848285016138de565b91505092915050565b600063ffffffff82169050919050565b614410816143f7565b811461441b57600080fd5b50565b60008135905061442d81614407565b92915050565b600080600080600080600080600080600060e08c8e03121561445857614457613792565b5b60008c013567ffffffffffffffff81111561447657614475613797565b5b6144828e828f01613fc6565b9b509b505060206144958e828f01614041565b99505060408c013567ffffffffffffffff8111156144b6576144b5613797565b5b6144c28e828f01614211565b985098505060608c013567ffffffffffffffff8111156144e5576144e4613797565b5b6144f18e828f01613e3e565b965096505060808c013567ffffffffffffffff81111561451457614513613797565b5b6145208e828f01613e3e565b945094505060a06145338e828f0161441e565b92505060c06145448e828f0161441e565b9150509295989b509295989b9093969950565b60008060008060008060008060e0898b03121561457757614576613792565b5b600089013567ffffffffffffffff81111561459557614594613797565b5b6145a18b828c01613fc6565b985098505060206145b48b828c01614041565b96505060406145c58b828c016138de565b95505060606145d68b828c01613914565b94505060806145e78b828c01613914565b93505060a06145f88b828c0161441e565b92505060c06146098b828c0161441e565b9150509295985092959890939650565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614660602083614619565b915061466b8261462a565b602082019050919050565b6000602082019050818103600083015261468f81614653565b9050919050565b60006060820190506146ab60008301866140de565b6146b860208301856140de565b6146c56040830184613c07565b949350505050565b600082825260208201905092915050565b600080fd5b60006146ef83856146cd565b93507f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115614722576147216146de565b5b602083029250614733838584613aae565b82840190509392505050565b600082825260208201905092915050565b600061475c838561473f565b9350614769838584613aae565b614772836139f1565b840190509392505050565b600060a082019050614792600083018b6140de565b61479f602083018a6140de565b81810360408301526147b281888a6146e3565b905081810360608301526147c78186886146e3565b905081810360808301526147dc818486614750565b90509998505050505050505050565b600060408201905061480060008301856140de565b61480d6020830184613c07565b9392505050565b61481d81613821565b811461482857600080fd5b50565b60008151905061483a81614814565b92915050565b60006020828403121561485657614855613792565b5b60006148648482850161482b565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000813590506148ab81614814565b92915050565b6000602082840312156148c7576148c6613792565b5b60006148d58482850161489c565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614918826138f3565b9150614923836138f3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614958576149576148de565b5b828201905092915050565b600061496e826138f3565b9150614979836138f3565b92508282101561498c5761498b6148de565b5b828203905092915050565b600080fd5b600067ffffffffffffffff82169050919050565b6149b98161499c565b81146149c457600080fd5b50565b6000813590506149d6816149b0565b92915050565b60006fffffffffffffffffffffffffffffffff82169050919050565b614a01816149dc565b8114614a0c57600080fd5b50565b600081359050614a1e816149f8565b92915050565b600060e08284031215614a3a57614a39614997565b5b614a4460e0613a62565b90506000614a54848285016138de565b6000830152506020614a6884828501613914565b6020830152506040614a7c848285016138de565b6040830152506060614a90848285016149c7565b6060830152506080614aa484828501614a0f565b60808301525060a0614ab8848285016138de565b60a08301525060c0614acc8482850161489c565b60c08301525092915050565b600060e08284031215614aee57614aed613792565b5b6000614afc84828501614a24565b91505092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614b61602683614619565b9150614b6c82614b05565b604082019050919050565b60006020820190508181036000830152614b9081614b54565b9050919050565b6000614ba2826138f3565b9150614bad836138f3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614be657614be56148de565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614c2b826138f3565b9150614c36836138f3565b925082614c4657614c45614bf1565b5b828204905092915050565b6000614c5c826138f3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614c8e57614c8d6148de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000604082019050614cdd60008301856140de565b614cea60208301846140de565b9392505050565b600081519050614d00816138fd565b92915050565b600060208284031215614d1c57614d1b613792565b5b6000614d2a84828501614cf1565b91505092915050565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60008201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015250565b6000614d8f603683614619565b9150614d9a82614d33565b604082019050919050565b60006020820190508181036000830152614dbe81614d82565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000614e21602a83614619565b9150614e2c82614dc5565b604082019050919050565b60006020820190508181036000830152614e5081614e14565b9050919050565b6000606082019050614e6c60008301866140de565b614e796020830185613c07565b614e8660408301846140de565b949350505050565b600081519050614e9d816149b0565b92915050565b600081519050614eb2816149f8565b92915050565b600081519050614ec7816138c7565b92915050565b600060808284031215614ee357614ee2614997565b5b614eed6080613a62565b90506000614efd84828501614e8e565b6000830152506020614f1184828501614ea3565b6020830152506040614f2584828501614e8e565b6040830152506060614f3984828501614eb8565b60608301525092915050565b600060808284031215614f5b57614f5a613792565b5b6000614f6984828501614ecd565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b614fa781613877565b82525050565b614fb6816138f3565b82525050565b614fc58161499c565b82525050565b614fd4816149dc565b82525050565b614fe381613821565b82525050565b60e082016000820151614fff6000850182614f9e565b5060208201516150126020850182614fad565b5060408201516150256040850182614f9e565b5060608201516150386060850182614fbc565b50608082015161504b6080850182614fcb565b5060a082015161505e60a0850182614f9e565b5060c082015161507160c0850182614fda565b50505050565b60006150838383614fe9565b60e08301905092915050565b6000602082019050919050565b60006150a782614f72565b6150b18185614f7d565b93506150bc83614f8e565b8060005b838110156150ed5781516150d48882615077565b97506150df8361508f565b9250506001810190506150c0565b5085935050505092915050565b60006020820190508181036000830152615114818461509c565b905092915050565b600061513761513261512d846149dc565b613cc2565b6138f3565b9050919050565b6151478161511c565b82525050565b600081519050919050565b60005b8381101561517657808201518184015260208101905061515b565b83811115615185576000848401525b50505050565b60006151968261514d565b6151a0818561473f565b93506151b0818560208601615158565b6151b9816139f1565b840191505092915050565b60006080820190506151d96000830187613c07565b6151e66020830186613c07565b6151f3604083018561513e565b8181036060830152615205818461518b565b905095945050505050565b6000602082019050818103600083015261522a818461518b565b905092915050565b60006060820190506152476000830186613c07565b6152546020830185613c07565b615261604083018461513e565b949350505050565b50565b600061527960008361473f565b915061528482615269565b600082019050919050565b600060a0820190506152a460008301876140de565b6152b160208301866140de565b6152be6040830185613c07565b6152cb6060830184613c07565b81810360808301526152dc8161526c565b905095945050505050565b7f6261640000000000000000000000000000000000000000000000000000000000600082015250565b600061531d600383614619565b9150615328826152e7565b602082019050919050565b6000602082019050818103600083015261534c81615310565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006153af602683614619565b91506153ba82615353565b604082019050919050565b600060208201905081810360008301526153de816153a2565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b600061541b601d83614619565b9150615426826153e5565b602082019050919050565b6000602082019050818103600083015261544a8161540e565b9050919050565b600081905092915050565b60006154678261514d565b6154718185615451565b9350615481818560208601615158565b80840191505092915050565b6000615499828461545c565b915081905092915050565b600081519050919050565b60006154ba826154a4565b6154c48185614619565b93506154d4818560208601615158565b6154dd816139f1565b840191505092915050565b6000602082019050818103600083015261550281846154af565b90509291505056fea26469706673582212206b86ce96f5d968e35ad171793f686ad305161b077025413b0f346e3f612749bb64736f6c634300080e0033

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

00000000000000000000000068d25992b1b04be8a70104de8cb598170ab9aad5000000000000000000000000b0c7a3ba49c7a6eaba6cd4a96c55a1391070ac9a000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _troveMarketplace (address): 0x68D25992B1b04bE8A70104dE8Cb598170aB9aAD5
Arg [1] : _defaultPaymentToken (address): 0xB0c7a3Ba49C7a6EaBa6cD4a96C55a1391070Ac9A
Arg [2] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000068d25992b1b04be8a70104de8cb598170ab9aad5
Arg [1] : 000000000000000000000000b0c7a3ba49c7a6eaba6cd4a96c55a1391070ac9a
Arg [2] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ 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.