Token Buffer

 

Overview ERC-721

Total Supply:
0 BFR

Holders:
1 addresses

Transfers:
-

Contract:
0x980bEC165f1315399f12DCbE1A935D915A7a17830x980bEC165f1315399f12DCbE1A935D915A7a1783

Social Profiles:
Not Available, Update ?

Loading
[ Download CSV Export  ] 
Loading
[ Download CSV Export  ] 
Loading

Click here to update the token ICO / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
BufferBinaryOptions

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 1 runs

Other Settings:
istanbul EvmVersion, None license
File 1 of 21 : BufferBinaryOptions.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.4;

import "ReentrancyGuard.sol";
import "ERC721.sol";
import "AccessControl.sol";
import "SafeERC20.sol";
import "Interfaces.sol";
import "OptionMath.sol";

/**
 * @author Heisenberg
 * @title Buffer Options
 * @notice Creates ERC721 Options
 */

contract BufferBinaryOptions is
    IBufferBinaryOptions,
    ReentrancyGuard,
    ERC721,
    AccessControl
{
    using SafeERC20 for ERC20;
    uint256 public nextTokenId = 0;
    uint256 public override totalMarketOI;
    bool public isPaused;
    uint16 public stepSize = 25; // Factor of 1e2
    string public override token0;
    string public override token1;

    ILiquidityPool public override pool;
    IOptionsConfig public override config;
    IReferralStorage public referral;
    AssetCategory public assetCategory;
    ERC20 public override tokenX;

    mapping(uint256 => Option) public override options;
    mapping(address => uint256[]) public userOptionIds;
    mapping(address => bool) public approvedAddresses;
    bytes32 public constant ROUTER_ROLE = keccak256("ROUTER_ROLE");
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

    constructor() ERC721("Buffer", "BFR") {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    /************************************************
     *  INITIALIZATION FUNCTIONS
     ***********************************************/

    function initialize(
        ERC20 _tokenX,
        ILiquidityPool _pool,
        IOptionsConfig _config,
        IReferralStorage _referral,
        AssetCategory _category,
        string memory _token0,
        string memory _token1
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (address(tokenX) == address(0)) {
            tokenX = _tokenX;
            pool = _pool;
            config = _config;
            referral = _referral;
            assetCategory = _category;
            token0 = _token0;
            token1 = _token1;
            _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
            emit CreateOptionsContract(
                address(config),
                address(pool),
                address(tokenX),
                token0,
                token1,
                assetCategory
            );
        } else {
            revert("Already initialized");
        }
    }

    function assetPair() external view override returns (string memory) {
        return string(abi.encodePacked(token0, token1));
    }

    /**
     * @notice Grants complete approval from the pool
     */
    function approvePoolToTransferTokenX() public {
        tokenX.approve(address(pool), ~uint256(0));
    }

    /**
     * @notice Pauses/Unpauses the option creation
     */
    function setIsPaused() public {
        if (hasRole(PAUSER_ROLE, msg.sender)) {
            isPaused = true;
        } else if (hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) {
            isPaused = !isPaused;
        } else {
            revert("Wrong role");
        }
        emit Pause(isPaused);
    }

    /************************************************
     *  ROUTER ONLY FUNCTIONS
     ***********************************************/

    /**
     * @notice Creates an option with the specified parameters
     * @dev Can only be called by router
     */
    function createFromRouter(
        OptionParams calldata optionParams,
        uint256 queuedTime
    ) external override onlyRole(ROUTER_ROLE) returns (uint256 optionID) {
        Option memory option = Option(
            State.Active,
            optionParams.strike,
            optionParams.amount,
            optionParams.amount,
            optionParams.amount / 2,
            queuedTime + optionParams.period,
            optionParams.totalFee,
            queuedTime
        );
        optionID = _generateTokenId();
        userOptionIds[optionParams.user].push(optionID);
        options[optionID] = option;
        _mint(optionParams.user, optionID);

        uint256 referrerFee = _processReferralRebate(
            optionParams.user,
            optionParams.totalFee,
            optionParams.amount,
            optionParams.referralCode,
            optionParams.baseSettlementFeePercentage
        );

        uint256 settlementFee = optionParams.totalFee -
            option.premium -
            referrerFee;

        tokenX.safeTransfer(
            config.settlementFeeDisbursalContract(),
            settlementFee
        );

        pool.lock(optionID, option.lockedAmount, option.premium);
        IBooster booster = IBooster(config.boosterContract());
        if (
            booster.getBoostPercentage(optionParams.user, address(tokenX)) > 0
        ) {
            booster.updateUserBoost(optionParams.user, address(tokenX));
        }
        IOptionStorage(config.optionStorageContract()).save(
            optionID,
            address(this),
            optionParams.user
        );
        totalMarketOI += optionParams.totalFee;
        IPoolOIStorage(config.poolOIStorageContract()).updatePoolOI(
            true,
            optionParams.totalFee
        );
        emit Create(
            optionParams.user,
            optionID,
            settlementFee,
            optionParams.totalFee
        );
    }

    /**
     * @notice Unlocks/Exercises the active options
     * @dev Can only be called router
     */
    function unlock(
        uint256 optionID,
        uint256 closingPrice,
        uint256 closingTime,
        bool isAbove
    ) external override onlyRole(ROUTER_ROLE) {
        require(_exists(optionID), "O10");
        Option storage option = options[optionID];
        require(option.state == State.Active, "O5");
        uint256 payout;
        if (
            (isAbove && closingPrice > option.strike) ||
            (!isAbove && closingPrice < option.strike) ||
            option.expiration > closingTime
        ) {
            payout = _exercise(optionID, closingPrice, closingTime, isAbove);
        } else {
            option.state = State.Expired;
            pool.unlock(optionID);
            _burn(optionID);
            emit Expire(optionID, option.premium, closingPrice, isAbove);
        }
        totalMarketOI -= option.totalFee;
        IPoolOIStorage(config.poolOIStorageContract()).updatePoolOI(
            false,
            option.totalFee
        );

        ICircuitBreaker(config.circuitBreakerContract()).update(
            int256(payout) - int256(option.totalFee),
            int256(option.totalFee - option.premium),
            optionID
        );
    }

    /************************************************
     *  READ ONLY FUNCTIONS
     ***********************************************/

    /**
     * @notice Returns decimals of the pool token
     */
    function decimals() public view returns (uint256) {
        return tokenX.decimals();
    }

    /**
     * @notice Calculates the fees for buying an option
     */
    function fees(
        uint256 amount,
        address user,
        string calldata referralCode,
        uint256 baseSettlementFeePercentage
    )
        public
        view
        override
        returns (uint256 total, uint256 settlementFee, uint256 premium)
    {
        uint256 settlementFeePercentage = getSettlementFeePercentage(
            referral.codeOwner(referralCode),
            user,
            baseSettlementFeePercentage
        );
        (total, settlementFee, premium) = _fees(
            amount,
            settlementFeePercentage
        );
    }

    function isStrikeValid(
        uint256 slippage,
        uint256 currentPrice,
        uint256 strike
    ) external pure override returns (bool) {
        if (
            (currentPrice <= (strike * (1e4 + slippage)) / 1e4) &&
            (currentPrice >= (strike * (1e4 - slippage)) / 1e4)
        ) {
            return true;
        } else return false;
    }

    function getMaxTradeSize() public view returns (uint256) {
        return
            min(
                IPoolOIConfig(config.poolOIConfigContract()).getMaxPoolOI(),
                IMarketOIConfig(config.marketOIConfigContract()).getMaxMarketOI(
                    totalMarketOI
                )
            );
    }

    function getMaxOI() public view override returns (uint256) {
        return
            min(
                IPoolOIConfig(config.poolOIConfigContract()).getPoolOICap(),
                IMarketOIConfig(config.marketOIConfigContract())
                    .getMarketOICap()
            );
    }

    /**
     * @notice Runs all the checks on the option parameters and
     * returns the revised amount and fee
     */
    function evaluateParams(
        OptionParams calldata optionParams,
        uint256 slippage
    ) external view override returns (uint256 amount, uint256 revisedFee) {
        require(slippage <= 5e2, "O34"); // 5% is the max slippage a user can use
        require(optionParams.period >= config.minPeriod(), "O21");
        require(optionParams.period <= config.maxPeriod(), "O25");
        require(optionParams.totalFee >= config.minFee(), "O35");
        require(!isPaused, "O33");
        require(
            assetCategory == AssetCategory.Crypto ||
                ICreationWindowContract(config.creationWindowContract())
                    .isInCreationWindow(optionParams.period),
            "O30"
        );

        uint256 maxTradeSize = getMaxTradeSize();
        require(maxTradeSize > 0, "O36");
        revisedFee = min(optionParams.totalFee, maxTradeSize);

        if (revisedFee < optionParams.totalFee) {
            require(optionParams.allowPartialFill, "O29");
        }

        // Calculate the amount here from the revised fees
        uint256 settlementFeePercentage = getSettlementFeePercentage(
            referral.codeOwner(optionParams.referralCode),
            optionParams.user,
            optionParams.baseSettlementFeePercentage
        );
        (uint256 unitFee, , ) = _fees(
            10 ** decimals(),
            settlementFeePercentage
        );
        amount = (revisedFee * 10 ** decimals()) / unitFee;
    }

    /************************************************
     * ERC721 FUNCTIONS
     ***********************************************/

    function _generateTokenId() internal returns (uint256) {
        return nextTokenId++;
    }

    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    function supportsInterface(
        bytes4 interfaceId
    ) public view override(ERC721, AccessControl) returns (bool) {
        return super.supportsInterface(interfaceId);
    }

    function ownerOf(
        uint256 tokenId
    )
        public
        view
        virtual
        override(ERC721, IBufferBinaryOptions)
        returns (address)
    {
        return super.ownerOf(tokenId);
    }

    /************************************************
     *  INTERNAL OPTION UTILITY FUNCTIONS
     ***********************************************/

    /**
     * @notice Calculates the fees for buying an option
     */
    function _fees(
        uint256 amount,
        uint256 settlementFeePercentage
    )
        internal
        pure
        returns (uint256 total, uint256 settlementFee, uint256 premium)
    {
        // Probability for ATM options will always be 0.5 due to which we can skip using BSM
        premium = amount / 2;
        total = (premium * 1e4) / (1e4 - settlementFeePercentage);
        settlementFee = total - premium;
    }

    /**
     * @notice Exercises the ITM options
     */
    function _exercise(
        uint256 optionID,
        uint256 closingPrice,
        uint256 closingTime,
        bool isAbove
    ) internal returns (uint256 profit) {
        Option storage option = options[optionID];
        address user = ownerOf(optionID);
        if (option.expiration > closingTime) {
            bool isITM;
            if (
                (isAbove && option.strike < closingPrice) ||
                (!isAbove && option.strike > closingPrice)
            ) {
                isITM = true;
            }

            profit =
                (option.lockedAmount *
                    OptionMath.blackScholesPriceBinary(
                        config.getFactoredIv(isITM),
                        option.strike,
                        closingPrice,
                        option.expiration - closingTime,
                        true,
                        isAbove
                    )) /
                1e8;
        } else {
            profit = option.lockedAmount;
        }
        pool.send(optionID, address(this), option.lockedAmount);
        tokenX.safeTransfer(user, profit);
        if (profit < option.lockedAmount) {
            tokenX.safeTransfer(address(pool), option.lockedAmount - profit);
        }

        if (profit <= option.premium)
            emit LpProfit(optionID, option.premium - profit);
        else emit LpLoss(optionID, profit - option.premium);

        // Burn the option
        _burn(optionID);
        option.state = State.Exercised;
        emit Exercise(user, optionID, profit, closingPrice, isAbove);
    }

    /**
     * @notice Sends the referral rebate to the referrer and
     * updates the stats in the referral storage contract
     */
    function _processReferralRebate(
        address user,
        uint256 totalFee,
        uint256 amount,
        string calldata referralCode,
        uint256 baseSettlementFeePercentage
    ) internal returns (uint256 referrerFee) {
        address referrer = referral.codeOwner(referralCode);
        if (
            referrer != user &&
            referrer != address(0) &&
            referrer.code.length == 0
        ) {
            bool isReferralValid = true;
            referrerFee = ((totalFee *
                referral.referrerTierDiscount(
                    referral.referrerTier(referrer)
                )) / (1e4 * 1e3));
            if (referrerFee > 0) {
                tokenX.safeTransfer(referrer, referrerFee);

                (uint256 formerUnitFee, , ) = _fees(
                    10 ** decimals(),
                    baseSettlementFeePercentage
                );
                emit UpdateReferral(
                    user,
                    referrer,
                    isReferralValid,
                    totalFee,
                    referrerFee,
                    (((formerUnitFee * amount) / 10 ** decimals()) - totalFee),
                    referralCode
                );
            }
        }
    }

    /**
     * @notice Calculates the discount to be applied on settlement fee based on
     * referrer tiers
     */
    function _getReferralDiscount(
        address referrer,
        address user
    ) public view returns (uint256 referralDiscount) {
        uint256 maxStep;
        if (
            referrer != user &&
            referrer != address(0) &&
            referrer.code.length == 0
        ) {
            uint8 step = referral.referrerTierStep(
                referral.referrerTier(referrer)
            );
            maxStep += step;
        }
        referralDiscount = (stepSize * maxStep);
    }

    /**
     * @notice Returns the discounted settlement fee
     */
    function getSettlementFeePercentage(
        address referrer,
        address user,
        uint256 baseSettlementFeePercentage
    ) public view returns (uint256 settlementFeePercentage) {
        settlementFeePercentage = baseSettlementFeePercentage;
        uint256 referralDiscount = _getReferralDiscount(referrer, user);
        settlementFeePercentage =
            settlementFeePercentage -
            referralDiscount -
            IBooster(config.boosterContract()).getBoostPercentage(
                user,
                address(tokenX)
            );
    }

    function approveAddress(
        address addressToApprove
    ) public onlyRole(DEFAULT_ADMIN_ROLE) {
        approvedAddresses[addressToApprove] = true;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        if (
            from != address(0) &&
            to != address(0) &&
            approvedAddresses[to] == false &&
            approvedAddresses[from] == false
        ) {
            revert("Token transfer not allowed");
        }
    }
}

File 2 of 21 : 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 3 of 21 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "IERC721.sol";
import "IERC721Receiver.sol";
import "IERC721Metadata.sol";
import "Address.sol";
import "Context.sol";
import "Strings.sol";
import "ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

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

File 4 of 21 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "IERC165.sol";

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: 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 5 of 21 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 6 of 21 : 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 7 of 21 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 21 : 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 10 of 21 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 11 of 21 : 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 12 of 21 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "IAccessControl.sol";
import "Context.sol";
import "Strings.sol";
import "ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

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

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

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 13 of 21 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "IERC20.sol";
import "draft-IERC20Permit.sol";
import "Address.sol";

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

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

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

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

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

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

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

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

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

File 15 of 21 : 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 16 of 21 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 17 of 21 : Interfaces.sol
// SPDX-License-Identifier: BUSL-1.1
import "ERC20.sol";

pragma solidity 0.8.4;

interface ICircuitBreaker {
    struct MarketPoolPair {
        address market;
        address pool;
    }
    struct Configs {
        int256 value;
        address contractAddress;
    }
    struct OverallStats {
        address contractAddress;
        int256 loss;
        int256 sf;
        int256 lp_sf;
        int256 net_loss;
    }
    struct MarketStats {
        address pool;
        int256 loss;
        int256 sf;
    }
    struct PoolStats {
        address[] markets;
        int256 loss;
        int256 sf;
    }

    function update(int256 loss, int256 sf, uint256 option_id) external;

    event Update(
        int256 loss,
        int256 sf,
        address market,
        address pool,
        uint256 option_id
    );

    event MarketPaused(address market, address pool);
    event PoolPaused(address pool);
}

interface IBooster {
    struct UserBoostTrades {
        uint256 totalBoostTrades;
        uint256 totalBoostTradesUsed;
    }

    function getUserBoostData(
        address user,
        address token
    ) external view returns (UserBoostTrades memory);

    function updateUserBoost(address user, address token) external;

    function getBoostPercentage(
        address user,
        address token
    ) external view returns (uint256);

    struct Permit {
        uint256 value;
        uint256 deadline;
        uint8 v;
        bytes32 r;
        bytes32 s;
        bool shouldApprove;
    }
    event ApproveTokenX(
        address user,
        uint256 nonce,
        uint256 value,
        uint256 deadline,
        address tokenX
    );
    event BuyCoupon(address indexed token, address indexed user, uint256 price);
    event SetPrice(uint256 couponPrice);
    event SetBoostPercentage(uint256 boost);
    event UpdateBoostTradesUser(address indexed user, address indexed token);
    event Configure(uint8[4] nftTierDiscounts);
}

interface IAccountRegistrar {
    struct AccountMapping {
        address oneCT;
        uint256 nonce;
    }
    event RegisterAccount(
        address indexed user,
        address indexed oneCT,
        uint256 nonce
    );
    event DeregisterAccount(address indexed account, uint256 nonce);

    function accountMapping(
        address
    ) external view returns (address oneCT, uint256 nonce);

    function registerAccount(
        address oneCT,
        address user,
        bytes memory signature
    ) external;
}

interface IBufferRouter {
    struct QueuedTrade {
        address user;
        uint256 totalFee;
        uint256 period;
        address targetContract;
        uint256 strike;
        uint256 slippage;
        bool allowPartialFill;
        string referralCode;
        uint256 settlementFee;
        bool isLimitOrder;
        bool isTradeResolved;
        uint256 optionId;
        bool isEarlyCloseAllowed;
        bool isAbove;
    }

    struct OptionInfo {
        uint256 queueId;
        address signer;
        uint256 nonce;
    }

    struct SignInfo {
        bytes signature;
        uint256 timestamp;
    }

    struct TradeParams {
        uint256 queueId;
        uint256 totalFee;
        uint256 period;
        address targetContract;
        uint256 strike;
        uint256 slippage;
        bool allowPartialFill;
        string referralCode;
        bool isAbove;
        uint256 price;
        uint256 settlementFee;
        bool isLimitOrder;
        uint256 limitOrderExpiry;
        uint256 userSignedSettlementFee;
        uint256 spread;
        SignInfo settlementFeeSignInfo;
        SignInfo userSignInfo;
        SignInfo publisherSignInfo;
        SignInfo spreadSignInfo;
    }

    struct Register {
        address oneCT;
        bytes signature;
        bool shouldRegister;
    }

    struct Permit {
        uint256 value;
        uint256 deadline;
        uint8 v;
        bytes32 r;
        bytes32 s;
        bool shouldApprove;
    }
    struct RevokeParams {
        address tokenX;
        address user;
        Permit permit;
    }
    struct OpenTxn {
        TradeParams tradeParams;
        Register register;
        Permit permit;
        address user;
    }

    struct AccountMapping {
        address oneCT;
        uint256 nonce;
    }

    struct CloseTradeParams {
        uint256 optionId;
        address targetContract;
        uint256 closingPrice;
        bool isAbove;
        SignInfo marketDirectionSignInfo;
        SignInfo publisherSignInfo;
    }

    struct CloseAnytimeParams {
        CloseTradeParams closeTradeParams;
        Register register;
        SignInfo userSignInfo;
    }

    struct IdMapping {
        uint256 id;
        bool isSet;
    }

    event OpenTrade(
        address indexed account,
        uint256 queueId,
        uint256 optionId,
        address targetContract
    );
    event CancelTrade(address indexed account, uint256 queueId, string reason);
    event FailUnlock(
        uint256 indexed optionId,
        address targetContract,
        string reason
    );
    event FailResolve(uint256 indexed queueId, string reason);
    event FailRevoke(address indexed user, address tokenX, string reason);
    event ContractRegistryUpdated(address targetContract, bool register);
    event ApproveRouter(
        address user,
        uint256 nonce,
        uint256 value,
        uint256 deadline,
        address tokenX
    );
    event RevokeRouter(
        address user,
        uint256 nonce,
        uint256 value,
        uint256 deadline,
        address tokenX
    );
}

interface IBufferBinaryOptions {
    event Create(
        address indexed account,
        uint256 indexed id,
        uint256 settlementFee,
        uint256 totalFee
    );

    event Exercise(
        address indexed account,
        uint256 indexed id,
        uint256 profit,
        uint256 priceAtExpiration,
        bool isAbove
    );
    event Expire(
        uint256 indexed id,
        uint256 premium,
        uint256 priceAtExpiration,
        bool isAbove
    );
    event Pause(bool isPaused);
    event UpdateReferral(
        address user,
        address referrer,
        bool isReferralValid,
        uint256 totalFee,
        uint256 referrerFee,
        uint256 rebate,
        string referralCode
    );

    event LpProfit(uint256 indexed id, uint256 amount);
    event LpLoss(uint256 indexed id, uint256 amount);

    function createFromRouter(
        OptionParams calldata optionParams,
        uint256 queuedTime
    ) external returns (uint256 optionID);

    function evaluateParams(
        OptionParams calldata optionParams,
        uint256 slippage
    ) external returns (uint256 amount, uint256 revisedFee);

    function tokenX() external view returns (ERC20);

    function pool() external view returns (ILiquidityPool);

    function config() external view returns (IOptionsConfig);

    function token0() external view returns (string memory);

    function token1() external view returns (string memory);

    function ownerOf(uint256 id) external view returns (address);

    function assetPair() external view returns (string memory);

    function totalMarketOI() external view returns (uint256);

    function getMaxOI() external view returns (uint256);

    function fees(
        uint256 amount,
        address user,
        string calldata referralCode,
        uint256 baseSettlementFeePercent
    )
        external
        view
        returns (uint256 total, uint256 settlementFee, uint256 premium);

    function isStrikeValid(
        uint256 slippage,
        uint256 currentPrice,
        uint256 strike
    ) external pure returns (bool);

    enum State {
        Inactive,
        Active,
        Exercised,
        Expired
    }

    enum AssetCategory {
        Forex,
        Crypto,
        Commodities
    }
    struct OptionExpiryData {
        uint256 optionId;
        uint256 priceAtExpiration;
    }

    event CreateOptionsContract(
        address config,
        address pool,
        address tokenX,
        string token0,
        string token1,
        AssetCategory category
    );
    struct Option {
        State state;
        uint256 strike;
        uint256 amount;
        uint256 lockedAmount;
        uint256 premium;
        uint256 expiration;
        uint256 totalFee;
        uint256 createdAt;
    }
    struct OptionParams {
        uint256 strike;
        uint256 amount;
        uint256 period;
        bool allowPartialFill;
        uint256 totalFee;
        address user;
        string referralCode;
        uint256 baseSettlementFeePercentage;
    }

    function options(
        uint256 optionId
    )
        external
        view
        returns (
            State state,
            uint256 strike,
            uint256 amount,
            uint256 lockedAmount,
            uint256 premium,
            uint256 expiration,
            uint256 totalFee,
            uint256 createdAt
        );

    function unlock(
        uint256 optionID,
        uint256 priceAtExpiration,
        uint256 closingTime,
        bool isAbove
    ) external;
}

interface IBufferBinaryOptionPauserV2_5 {
    function isPaused() external view returns (bool);

    function setIsPaused() external;
}

interface IBufferBinaryOptionPauserV2 {
    function isPaused() external view returns (bool);

    function toggleCreation() external;
}

interface ILiquidityPool {
    struct LockedAmount {
        uint256 timestamp;
        uint256 amount;
    }
    struct ProvidedLiquidity {
        uint256 unlockedAmount;
        LockedAmount[] lockedAmounts;
        uint256 nextIndexForUnlock;
    }
    struct LockedLiquidity {
        uint256 amount;
        uint256 premium;
        bool locked;
    }
    event Profit(uint256 indexed id, uint256 amount);
    event Loss(uint256 indexed id, uint256 amount);
    event Provide(address indexed account, uint256 amount, uint256 writeAmount);
    event UpdateMaxLiquidity(uint256 indexed maxLiquidity);
    event Withdraw(
        address indexed account,
        uint256 amount,
        uint256 writeAmount
    );

    function unlock(uint256 id) external;

    function totalTokenXBalance() external view returns (uint256 amount);

    function availableBalance() external view returns (uint256 balance);

    function send(uint256 id, address account, uint256 amount) external;

    function lock(uint256 id, uint256 tokenXAmount, uint256 premium) external;
}

interface IOptionsConfig {
    event UpdateMaxPeriod(uint32 value);
    event UpdateMinPeriod(uint32 value);
    event UpdateEarlyCloseThreshold(uint32 earlyCloseThreshold);
    event UpdateEarlyClose(bool isAllowed);
    event UpdateSettlementFeeDisbursalContract(address value);
    event UpdatetraderNFTContract(address value);
    event UpdateMinFee(uint256 value);
    event UpdateOptionStorageContract(address value);
    event UpdateCreationWindowContract(address value);
    event UpdatePlatformFee(uint256 _platformFee);
    event UpdatePoolOIStorageContract(address _poolOIStorageContract);
    event UpdatePoolOIConfigContract(address _poolOIConfigContract);
    event UpdateMarketOIConfigContract(address _marketOIConfigContract);
    event UpdateIV(uint32 _iv);
    event UpdateBoosterContract(address _boosterContract);
    event UpdateSpreadConfig1(uint256 spreadConfig1);
    event UpdateSpreadConfig2(uint256 spreadConfig2);
    event UpdateIVFactorITM(uint256 ivFactorITM);
    event UpdateIVFactorOTM(uint256 ivFactorOTM);
    event UpdateSpreadFactor(uint32 ivFactorOTM);
    event UpdateCircuitBreakerContract(address _circuitBreakerContract);

    function circuitBreakerContract() external view returns (address);

    function settlementFeeDisbursalContract() external view returns (address);

    function maxPeriod() external view returns (uint32);

    function minPeriod() external view returns (uint32);

    function minFee() external view returns (uint256);

    function platformFee() external view returns (uint256);

    function optionStorageContract() external view returns (address);

    function creationWindowContract() external view returns (address);

    function poolOIStorageContract() external view returns (address);

    function poolOIConfigContract() external view returns (address);

    function marketOIConfigContract() external view returns (address);

    function iv() external view returns (uint32);

    function earlyCloseThreshold() external view returns (uint32);

    function isEarlyCloseAllowed() external view returns (bool);

    function boosterContract() external view returns (address);

    function spreadConfig1() external view returns (uint256);

    function spreadConfig2() external view returns (uint256);

    function spreadFactor() external view returns (uint32);

    function getFactoredIv(bool isITM) external view returns (uint32);
}

interface ITraderNFT {
    function tokenOwner(uint256 id) external view returns (address user);

    function tokenTierMappings(uint256 id) external view returns (uint8 tier);

    event UpdateTiers(uint256[] tokenIds, uint8[] tiers, uint256[] batchIds);
}

interface IFakeTraderNFT {
    function tokenOwner(uint256 id) external view returns (address user);

    function tokenTierMappings(uint256 id) external view returns (uint8 tier);

    event UpdateNftBasePrice(uint256 nftBasePrice);
    event UpdateMaxNFTMintLimits(uint256 maxNFTMintLimit);
    event UpdateBaseURI(string baseURI);
    event Claim(address indexed account, uint256 claimTokenId);
    event Mint(address indexed account, uint256 tokenId, uint8 tier);
}

interface IReferralStorage {
    function codeOwner(string memory _code) external view returns (address);

    function traderReferralCodes(address) external view returns (string memory);

    function getTraderReferralInfo(
        address user
    ) external view returns (string memory, address);

    function setTraderReferralCode(address user, string memory _code) external;

    function setReferrerTier(address, uint8) external;

    function referrerTierStep(
        uint8 referralTier
    ) external view returns (uint8 step);

    function referrerTierDiscount(
        uint8 referralTier
    ) external view returns (uint32 discount);

    function referrerTier(address referrer) external view returns (uint8 tier);

    struct ReferrerData {
        uint256 tradeVolume;
        uint256 rebate;
        uint256 trades;
    }

    struct ReferreeData {
        uint256 tradeVolume;
        uint256 rebate;
    }

    struct ReferralData {
        ReferrerData referrerData;
        ReferreeData referreeData;
    }

    struct Tier {
        uint256 totalRebate; // e.g. 2400 for 24%
        uint256 discountShare; // 5000 for 50%/50%, 7000 for 30% rebates/70% discount
    }

    event UpdateTraderReferralCode(address indexed account, string code);
    event UpdateReferrerTier(address referrer, uint8 tierId);
    event RegisterCode(address indexed account, string code);
    event SetCodeOwner(
        address indexed account,
        address newAccount,
        string code
    );
}

interface IOptionStorage {
    function save(
        uint256 optionId,
        address optionsContract,
        address user
    ) external;
}

interface ICreationWindowContract {
    function isInCreationWindow(uint256 period) external view returns (bool);
}

interface IPoolOIStorage {
    function updatePoolOI(bool isIncreased, uint256 interest) external;

    function totalPoolOI() external view returns (uint256);
}

interface IPoolOIConfig {
    function getMaxPoolOI() external view returns (uint256);

    function getPoolOICap() external view returns (uint256);
}

interface IMarketOIConfig {
    function getMaxMarketOI(
        uint256 currentMarketOI
    ) external view returns (uint256);

    function getMarketOICap() external view returns (uint256);
}

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

pragma solidity ^0.8.0;

import "IERC20.sol";
import "IERC20Metadata.sol";
import "Context.sol";

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "IERC20.sol";

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

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

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

File 20 of 21 : OptionMath.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.4;
import "ABDKMath64x64.sol";

library OptionMath {
    using ABDKMath64x64 for int128;

    // 64x64 fixed point integer constants
    int128 internal constant ONE_64x64 = 0x10000000000000000;
    int128 internal constant THREE_64x64 = 0x30000000000000000;

    // 64x64 fixed point constants used in Choudhury’s approximation of the Black-Scholes CDF
    int128 private constant CDF_CONST_0 = 0x09109f285df452394; // 2260 / 3989
    int128 private constant CDF_CONST_1 = 0x19abac0ea1da65036; // 6400 / 3989
    int128 private constant CDF_CONST_2 = 0x0d3c84b78b749bd6b; // 3300 / 3989

    /**
     * @notice calculate Choudhury’s approximation of the Black-Scholes CDF
     * @param input64x64 64x64 fixed point representation of random variable
     * @return 64x64 fixed point representation of the approximated CDF of x
     */
    function _N(int128 input64x64) internal pure returns (int128) {
        // squaring via mul is cheaper than via pow
        int128 inputSquared64x64 = input64x64.mul(input64x64);

        int128 value64x64 = (-inputSquared64x64 >> 1).exp().div(
            CDF_CONST_0.add(CDF_CONST_1.mul(input64x64.abs())).add(
                CDF_CONST_2.mul(inputSquared64x64.add(THREE_64x64).sqrt())
            )
        );

        return input64x64 > 0 ? ONE_64x64.sub(value64x64) : value64x64;
    }

    /**
     * @notice calculate the price of an option using the Black-Scholes model
     * @param impliedVol uint256 representation of annualized impliedVol with a factor of 1e4
     * @param strike uint256 representation of strike price with a factor of 1e8
     * @param spot uint256 representation of spot price with a factor of 1e8
     * @param period uint256 representation of duration of option contract (in seconds)
     * @param isYes whether to price "call" or "put" option
     * @param isAbove whether to the user bets the price will stay above this strike or not
     * @return uint256 representation of Black-Scholes option price with a factor of 1e8
     */
    function blackScholesPriceBinary(
        uint256 impliedVol,
        uint256 strike,
        uint256 spot,
        uint256 period,
        bool isYes,
        bool isAbove
    ) internal pure returns (uint256) {
        int128 D8 = ABDKMath64x64.fromUInt(10 ** 8);
        int128 D4 = ABDKMath64x64.fromUInt(10 ** 4);
        int128 impliedVol64x64 = ABDKMath64x64.fromUInt(impliedVol).div(D4);
        int128 variance64x64 = impliedVol64x64.mul(impliedVol64x64);
        int128 strike64x64 = ABDKMath64x64.fromUInt(strike).div(D8);
        int128 spot64x64 = ABDKMath64x64.fromUInt(spot).div(D8);
        int128 maturity64x64 = ABDKMath64x64.fromUInt(period).div(
            ABDKMath64x64.fromUInt(365 days)
        );

        int128 premium64x64 = _blackScholesPriceBinary(
            variance64x64,
            strike64x64,
            spot64x64,
            maturity64x64,
            isYes,
            isAbove
        );
        return ABDKMath64x64.toUInt(premium64x64.mul(D8));
    }

    /**
     * @notice calculate the price of an option using the Black-Scholes model
     * @param varianceAnnualized64x64 64x64 fixed point representation of annualized variance
     * @param strike64x64 64x64 fixed point representation of strike price
     * @param spot64x64 64x64 fixed point representation of spot price
     * @param timeToMaturity64x64 64x64 fixed point representation of duration of option contract (in years)
     * @param isYes whether to price "call" or "put" option
     * @param isAbove whether to the user bets the price will stay above this strike or not
     * @return 64x64 fixed point representation of Black-Scholes option price
     */
    function _blackScholesPriceBinary(
        int128 varianceAnnualized64x64,
        int128 strike64x64,
        int128 spot64x64,
        int128 timeToMaturity64x64,
        bool isYes,
        bool isAbove
    ) internal pure returns (int128) {
        int128 cumulativeVariance64x64 = timeToMaturity64x64.mul(
            varianceAnnualized64x64
        );
        int128 cumulativeVarianceSqrt64x64 = cumulativeVariance64x64.sqrt();

        int128 d1_64x64 = spot64x64
            .div(strike64x64)
            .ln()
            .add(cumulativeVariance64x64 >> 1)
            .div(cumulativeVarianceSqrt64x64);
        int128 d2_64x64 = d1_64x64.sub(cumulativeVarianceSqrt64x64);

        if (isYes) {
            if (isAbove) {
                return _N(d2_64x64);
            } else {
                return _N(-d2_64x64);
            }
        } else {
            if (isAbove) {
                return ABDKMath64x64.fromUInt(1).sub(_N(d2_64x64));
            } else {
                return ABDKMath64x64.fromUInt(1).sub(_N(-d2_64x64));
            }
        }
    }
}

File 21 of 21 : ABDKMath64x64.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.4;

/**
 * Smart contract library of mathematical functions operating with signed
 * 64.64-bit fixed point numbers.  Signed 64.64-bit fixed point number is
 * basically a simple fraction whose numerator is signed 128-bit integer and
 * denominator is 2^64.  As long as denominator is always the same, there is no
 * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are
 * represented by int128 type holding only the numerator.
 */
library ABDKMath64x64 {
    /*
     * Minimum value signed 64.64-bit fixed point number may have.
     */
    int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;

    /*
     * Maximum value signed 64.64-bit fixed point number may have.
     */
    int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;

    /**
     * Convert signed 256-bit integer number into signed 64.64-bit fixed point
     * number.  Revert on overflow.
     *
     * @param x signed 256-bit integer number
     * @return signed 64.64-bit fixed point number
     */
    function fromInt(int256 x) internal pure returns (int128) {
        unchecked {
            require(x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);
            return int128(x << 64);
        }
    }

    /**
     * Convert signed 64.64 fixed point number into signed 64-bit integer number
     * rounding down.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64-bit integer number
     */
    function toInt(int128 x) internal pure returns (int64) {
        unchecked {
            return int64(x >> 64);
        }
    }

    /**
     * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point
     * number.  Revert on overflow.
     *
     * @param x unsigned 256-bit integer number
     * @return signed 64.64-bit fixed point number
     */
    function fromUInt(uint256 x) internal pure returns (int128) {
        unchecked {
            require(x <= 0x7FFFFFFFFFFFFFFF);
            return int128(int256(x << 64));
        }
    }

    /**
     * Convert signed 64.64 fixed point number into unsigned 64-bit integer
     * number rounding down.  Revert on underflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @return unsigned 64-bit integer number
     */
    function toUInt(int128 x) internal pure returns (uint64) {
        unchecked {
            require(x >= 0);
            return uint64(uint128(x >> 64));
        }
    }

    /**
     * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point
     * number rounding down.  Revert on overflow.
     *
     * @param x signed 128.128-bin fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function from128x128(int256 x) internal pure returns (int128) {
        unchecked {
            int256 result = x >> 64;
            require(result >= MIN_64x64 && result <= MAX_64x64);
            return int128(result);
        }
    }

    /**
     * Convert signed 64.64 fixed point number into signed 128.128 fixed point
     * number.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 128.128 fixed point number
     */
    function to128x128(int128 x) internal pure returns (int256) {
        unchecked {
            return int256(x) << 64;
        }
    }

    /**
     * Calculate x + y.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @param y signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function add(int128 x, int128 y) internal pure returns (int128) {
        unchecked {
            int256 result = int256(x) + y;
            require(result >= MIN_64x64 && result <= MAX_64x64);
            return int128(result);
        }
    }

    /**
     * Calculate x - y.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @param y signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function sub(int128 x, int128 y) internal pure returns (int128) {
        unchecked {
            int256 result = int256(x) - y;
            require(result >= MIN_64x64 && result <= MAX_64x64);
            return int128(result);
        }
    }

    /**
     * Calculate x * y rounding down.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @param y signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function mul(int128 x, int128 y) internal pure returns (int128) {
        unchecked {
            int256 result = (int256(x) * y) >> 64;
            require(result >= MIN_64x64 && result <= MAX_64x64);
            return int128(result);
        }
    }

    /**
     * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point
     * number and y is signed 256-bit integer number.  Revert on overflow.
     *
     * @param x signed 64.64 fixed point number
     * @param y signed 256-bit integer number
     * @return signed 256-bit integer number
     */
    function muli(int128 x, int256 y) internal pure returns (int256) {
        unchecked {
            if (x == MIN_64x64) {
                require(
                    y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&
                        y <= 0x1000000000000000000000000000000000000000000000000
                );
                return -y << 63;
            } else {
                bool negativeResult = false;
                if (x < 0) {
                    x = -x;
                    negativeResult = true;
                }
                if (y < 0) {
                    y = -y; // We rely on overflow behavior here
                    negativeResult = !negativeResult;
                }
                uint256 absoluteResult = mulu(x, uint256(y));
                if (negativeResult) {
                    require(
                        absoluteResult <=
                            0x8000000000000000000000000000000000000000000000000000000000000000
                    );
                    return -int256(absoluteResult); // We rely on overflow behavior here
                } else {
                    require(
                        absoluteResult <=
                            0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
                    );
                    return int256(absoluteResult);
                }
            }
        }
    }

    /**
     * Calculate x * y rounding down, where x is signed 64.64 fixed point number
     * and y is unsigned 256-bit integer number.  Revert on overflow.
     *
     * @param x signed 64.64 fixed point number
     * @param y unsigned 256-bit integer number
     * @return unsigned 256-bit integer number
     */
    function mulu(int128 x, uint256 y) internal pure returns (uint256) {
        unchecked {
            if (y == 0) return 0;

            require(x >= 0);

            uint256 lo = (uint256(int256(x)) *
                (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;
            uint256 hi = uint256(int256(x)) * (y >> 128);

            require(hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
            hi <<= 64;

            require(
                hi <=
                    0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -
                        lo
            );
            return hi + lo;
        }
    }

    /**
     * Calculate x / y rounding towards zero.  Revert on overflow or when y is
     * zero.
     *
     * @param x signed 64.64-bit fixed point number
     * @param y signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function div(int128 x, int128 y) internal pure returns (int128) {
        unchecked {
            require(y != 0);
            int256 result = (int256(x) << 64) / y;
            require(result >= MIN_64x64 && result <= MAX_64x64);
            return int128(result);
        }
    }

    /**
     * Calculate x / y rounding towards zero, where x and y are signed 256-bit
     * integer numbers.  Revert on overflow or when y is zero.
     *
     * @param x signed 256-bit integer number
     * @param y signed 256-bit integer number
     * @return signed 64.64-bit fixed point number
     */
    function divi(int256 x, int256 y) internal pure returns (int128) {
        unchecked {
            require(y != 0);

            bool negativeResult = false;
            if (x < 0) {
                x = -x; // We rely on overflow behavior here
                negativeResult = true;
            }
            if (y < 0) {
                y = -y; // We rely on overflow behavior here
                negativeResult = !negativeResult;
            }
            uint128 absoluteResult = divuu(uint256(x), uint256(y));
            if (negativeResult) {
                require(absoluteResult <= 0x80000000000000000000000000000000);
                return -int128(absoluteResult); // We rely on overflow behavior here
            } else {
                require(absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
                return int128(absoluteResult); // We rely on overflow behavior here
            }
        }
    }

    /**
     * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
     * integer numbers.  Revert on overflow or when y is zero.
     *
     * @param x unsigned 256-bit integer number
     * @param y unsigned 256-bit integer number
     * @return signed 64.64-bit fixed point number
     */
    function divu(uint256 x, uint256 y) internal pure returns (int128) {
        unchecked {
            require(y != 0);
            uint128 result = divuu(x, y);
            require(result <= uint128(MAX_64x64));
            return int128(result);
        }
    }

    /**
     * Calculate -x.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function neg(int128 x) internal pure returns (int128) {
        unchecked {
            require(x != MIN_64x64);
            return -x;
        }
    }

    /**
     * Calculate |x|.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function abs(int128 x) internal pure returns (int128) {
        unchecked {
            require(x != MIN_64x64);
            return x < 0 ? -x : x;
        }
    }

    /**
     * Calculate 1 / x rounding towards zero.  Revert on overflow or when x is
     * zero.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function inv(int128 x) internal pure returns (int128) {
        unchecked {
            require(x != 0);
            int256 result = int256(0x100000000000000000000000000000000) / x;
            require(result >= MIN_64x64 && result <= MAX_64x64);
            return int128(result);
        }
    }

    /**
     * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.
     *
     * @param x signed 64.64-bit fixed point number
     * @param y signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function avg(int128 x, int128 y) internal pure returns (int128) {
        unchecked {
            return int128((int256(x) + int256(y)) >> 1);
        }
    }

    /**
     * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.
     * Revert on overflow or in case x * y is negative.
     *
     * @param x signed 64.64-bit fixed point number
     * @param y signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function gavg(int128 x, int128 y) internal pure returns (int128) {
        unchecked {
            int256 m = int256(x) * int256(y);
            require(m >= 0);
            require(
                m <
                    0x4000000000000000000000000000000000000000000000000000000000000000
            );
            return int128(sqrtu(uint256(m)));
        }
    }

    /**
     * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number
     * and y is unsigned 256-bit integer number.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @param y uint256 value
     * @return signed 64.64-bit fixed point number
     */
    function pow(int128 x, uint256 y) internal pure returns (int128) {
        unchecked {
            bool negative = x < 0 && y & 1 == 1;

            uint256 absX = uint128(x < 0 ? -x : x);
            uint256 absResult;
            absResult = 0x100000000000000000000000000000000;

            if (absX <= 0x10000000000000000) {
                absX <<= 63;
                while (y != 0) {
                    if (y & 0x1 != 0) {
                        absResult = (absResult * absX) >> 127;
                    }
                    absX = (absX * absX) >> 127;

                    if (y & 0x2 != 0) {
                        absResult = (absResult * absX) >> 127;
                    }
                    absX = (absX * absX) >> 127;

                    if (y & 0x4 != 0) {
                        absResult = (absResult * absX) >> 127;
                    }
                    absX = (absX * absX) >> 127;

                    if (y & 0x8 != 0) {
                        absResult = (absResult * absX) >> 127;
                    }
                    absX = (absX * absX) >> 127;

                    y >>= 4;
                }

                absResult >>= 64;
            } else {
                uint256 absXShift = 63;
                if (absX < 0x1000000000000000000000000) {
                    absX <<= 32;
                    absXShift -= 32;
                }
                if (absX < 0x10000000000000000000000000000) {
                    absX <<= 16;
                    absXShift -= 16;
                }
                if (absX < 0x1000000000000000000000000000000) {
                    absX <<= 8;
                    absXShift -= 8;
                }
                if (absX < 0x10000000000000000000000000000000) {
                    absX <<= 4;
                    absXShift -= 4;
                }
                if (absX < 0x40000000000000000000000000000000) {
                    absX <<= 2;
                    absXShift -= 2;
                }
                if (absX < 0x80000000000000000000000000000000) {
                    absX <<= 1;
                    absXShift -= 1;
                }

                uint256 resultShift = 0;
                while (y != 0) {
                    require(absXShift < 64);

                    if (y & 0x1 != 0) {
                        absResult = (absResult * absX) >> 127;
                        resultShift += absXShift;
                        if (absResult > 0x100000000000000000000000000000000) {
                            absResult >>= 1;
                            resultShift += 1;
                        }
                    }
                    absX = (absX * absX) >> 127;
                    absXShift <<= 1;
                    if (absX >= 0x100000000000000000000000000000000) {
                        absX >>= 1;
                        absXShift += 1;
                    }

                    y >>= 1;
                }

                require(resultShift < 64);
                absResult >>= 64 - resultShift;
            }
            int256 result = negative ? -int256(absResult) : int256(absResult);
            require(result >= MIN_64x64 && result <= MAX_64x64);
            return int128(result);
        }
    }

    /**
     * Calculate sqrt (x) rounding down.  Revert if x < 0.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function sqrt(int128 x) internal pure returns (int128) {
        unchecked {
            require(x >= 0);
            return int128(sqrtu(uint256(int256(x)) << 64));
        }
    }

    /**
     * Calculate binary logarithm of x.  Revert if x <= 0.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function log_2(int128 x) internal pure returns (int128) {
        unchecked {
            require(x > 0);

            int256 msb = 0;
            int256 xc = x;
            if (xc >= 0x10000000000000000) {
                xc >>= 64;
                msb += 64;
            }
            if (xc >= 0x100000000) {
                xc >>= 32;
                msb += 32;
            }
            if (xc >= 0x10000) {
                xc >>= 16;
                msb += 16;
            }
            if (xc >= 0x100) {
                xc >>= 8;
                msb += 8;
            }
            if (xc >= 0x10) {
                xc >>= 4;
                msb += 4;
            }
            if (xc >= 0x4) {
                xc >>= 2;
                msb += 2;
            }
            if (xc >= 0x2) msb += 1; // No need to shift xc anymore

            int256 result = (msb - 64) << 64;
            uint256 ux = uint256(int256(x)) << uint256(127 - msb);
            for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {
                ux *= ux;
                uint256 b = ux >> 255;
                ux >>= 127 + b;
                result += bit * int256(b);
            }

            return int128(result);
        }
    }

    /**
     * Calculate natural logarithm of x.  Revert if x <= 0.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function ln(int128 x) internal pure returns (int128) {
        unchecked {
            require(x > 0);

            return
                int128(
                    int256(
                        (uint256(int256(log_2(x))) *
                            0xB17217F7D1CF79ABC9E3B39803F2F6AF) >> 128
                    )
                );
        }
    }

    /**
     * Calculate binary exponent of x.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function exp_2(int128 x) internal pure returns (int128) {
        unchecked {
            require(x < 0x400000000000000000); // Overflow

            if (x < -0x400000000000000000) return 0; // Underflow

            uint256 result = 0x80000000000000000000000000000000;

            if (x & 0x8000000000000000 > 0)
                result = (result * 0x16A09E667F3BCC908B2FB1366EA957D3E) >> 128;
            if (x & 0x4000000000000000 > 0)
                result = (result * 0x1306FE0A31B7152DE8D5A46305C85EDEC) >> 128;
            if (x & 0x2000000000000000 > 0)
                result = (result * 0x1172B83C7D517ADCDF7C8C50EB14A791F) >> 128;
            if (x & 0x1000000000000000 > 0)
                result = (result * 0x10B5586CF9890F6298B92B71842A98363) >> 128;
            if (x & 0x800000000000000 > 0)
                result = (result * 0x1059B0D31585743AE7C548EB68CA417FD) >> 128;
            if (x & 0x400000000000000 > 0)
                result = (result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8) >> 128;
            if (x & 0x200000000000000 > 0)
                result = (result * 0x10163DA9FB33356D84A66AE336DCDFA3F) >> 128;
            if (x & 0x100000000000000 > 0)
                result = (result * 0x100B1AFA5ABCBED6129AB13EC11DC9543) >> 128;
            if (x & 0x80000000000000 > 0)
                result = (result * 0x10058C86DA1C09EA1FF19D294CF2F679B) >> 128;
            if (x & 0x40000000000000 > 0)
                result = (result * 0x1002C605E2E8CEC506D21BFC89A23A00F) >> 128;
            if (x & 0x20000000000000 > 0)
                result = (result * 0x100162F3904051FA128BCA9C55C31E5DF) >> 128;
            if (x & 0x10000000000000 > 0)
                result = (result * 0x1000B175EFFDC76BA38E31671CA939725) >> 128;
            if (x & 0x8000000000000 > 0)
                result = (result * 0x100058BA01FB9F96D6CACD4B180917C3D) >> 128;
            if (x & 0x4000000000000 > 0)
                result = (result * 0x10002C5CC37DA9491D0985C348C68E7B3) >> 128;
            if (x & 0x2000000000000 > 0)
                result = (result * 0x1000162E525EE054754457D5995292026) >> 128;
            if (x & 0x1000000000000 > 0)
                result = (result * 0x10000B17255775C040618BF4A4ADE83FC) >> 128;
            if (x & 0x800000000000 > 0)
                result = (result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB) >> 128;
            if (x & 0x400000000000 > 0)
                result = (result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9) >> 128;
            if (x & 0x200000000000 > 0)
                result = (result * 0x10000162E43F4F831060E02D839A9D16D) >> 128;
            if (x & 0x100000000000 > 0)
                result = (result * 0x100000B1721BCFC99D9F890EA06911763) >> 128;
            if (x & 0x80000000000 > 0)
                result = (result * 0x10000058B90CF1E6D97F9CA14DBCC1628) >> 128;
            if (x & 0x40000000000 > 0)
                result = (result * 0x1000002C5C863B73F016468F6BAC5CA2B) >> 128;
            if (x & 0x20000000000 > 0)
                result = (result * 0x100000162E430E5A18F6119E3C02282A5) >> 128;
            if (x & 0x10000000000 > 0)
                result = (result * 0x1000000B1721835514B86E6D96EFD1BFE) >> 128;
            if (x & 0x8000000000 > 0)
                result = (result * 0x100000058B90C0B48C6BE5DF846C5B2EF) >> 128;
            if (x & 0x4000000000 > 0)
                result = (result * 0x10000002C5C8601CC6B9E94213C72737A) >> 128;
            if (x & 0x2000000000 > 0)
                result = (result * 0x1000000162E42FFF037DF38AA2B219F06) >> 128;
            if (x & 0x1000000000 > 0)
                result = (result * 0x10000000B17217FBA9C739AA5819F44F9) >> 128;
            if (x & 0x800000000 > 0)
                result = (result * 0x1000000058B90BFCDEE5ACD3C1CEDC823) >> 128;
            if (x & 0x400000000 > 0)
                result = (result * 0x100000002C5C85FE31F35A6A30DA1BE50) >> 128;
            if (x & 0x200000000 > 0)
                result = (result * 0x10000000162E42FF0999CE3541B9FFFCF) >> 128;
            if (x & 0x100000000 > 0)
                result = (result * 0x100000000B17217F80F4EF5AADDA45554) >> 128;
            if (x & 0x80000000 > 0)
                result = (result * 0x10000000058B90BFBF8479BD5A81B51AD) >> 128;
            if (x & 0x40000000 > 0)
                result = (result * 0x1000000002C5C85FDF84BD62AE30A74CC) >> 128;
            if (x & 0x20000000 > 0)
                result = (result * 0x100000000162E42FEFB2FED257559BDAA) >> 128;
            if (x & 0x10000000 > 0)
                result = (result * 0x1000000000B17217F7D5A7716BBA4A9AE) >> 128;
            if (x & 0x8000000 > 0)
                result = (result * 0x100000000058B90BFBE9DDBAC5E109CCE) >> 128;
            if (x & 0x4000000 > 0)
                result = (result * 0x10000000002C5C85FDF4B15DE6F17EB0D) >> 128;
            if (x & 0x2000000 > 0)
                result = (result * 0x1000000000162E42FEFA494F1478FDE05) >> 128;
            if (x & 0x1000000 > 0)
                result = (result * 0x10000000000B17217F7D20CF927C8E94C) >> 128;
            if (x & 0x800000 > 0)
                result = (result * 0x1000000000058B90BFBE8F71CB4E4B33D) >> 128;
            if (x & 0x400000 > 0)
                result = (result * 0x100000000002C5C85FDF477B662B26945) >> 128;
            if (x & 0x200000 > 0)
                result = (result * 0x10000000000162E42FEFA3AE53369388C) >> 128;
            if (x & 0x100000 > 0)
                result = (result * 0x100000000000B17217F7D1D351A389D40) >> 128;
            if (x & 0x80000 > 0)
                result = (result * 0x10000000000058B90BFBE8E8B2D3D4EDE) >> 128;
            if (x & 0x40000 > 0)
                result = (result * 0x1000000000002C5C85FDF4741BEA6E77E) >> 128;
            if (x & 0x20000 > 0)
                result = (result * 0x100000000000162E42FEFA39FE95583C2) >> 128;
            if (x & 0x10000 > 0)
                result = (result * 0x1000000000000B17217F7D1CFB72B45E1) >> 128;
            if (x & 0x8000 > 0)
                result = (result * 0x100000000000058B90BFBE8E7CC35C3F0) >> 128;
            if (x & 0x4000 > 0)
                result = (result * 0x10000000000002C5C85FDF473E242EA38) >> 128;
            if (x & 0x2000 > 0)
                result = (result * 0x1000000000000162E42FEFA39F02B772C) >> 128;
            if (x & 0x1000 > 0)
                result = (result * 0x10000000000000B17217F7D1CF7D83C1A) >> 128;
            if (x & 0x800 > 0)
                result = (result * 0x1000000000000058B90BFBE8E7BDCBE2E) >> 128;
            if (x & 0x400 > 0)
                result = (result * 0x100000000000002C5C85FDF473DEA871F) >> 128;
            if (x & 0x200 > 0)
                result = (result * 0x10000000000000162E42FEFA39EF44D91) >> 128;
            if (x & 0x100 > 0)
                result = (result * 0x100000000000000B17217F7D1CF79E949) >> 128;
            if (x & 0x80 > 0)
                result = (result * 0x10000000000000058B90BFBE8E7BCE544) >> 128;
            if (x & 0x40 > 0)
                result = (result * 0x1000000000000002C5C85FDF473DE6ECA) >> 128;
            if (x & 0x20 > 0)
                result = (result * 0x100000000000000162E42FEFA39EF366F) >> 128;
            if (x & 0x10 > 0)
                result = (result * 0x1000000000000000B17217F7D1CF79AFA) >> 128;
            if (x & 0x8 > 0)
                result = (result * 0x100000000000000058B90BFBE8E7BCD6D) >> 128;
            if (x & 0x4 > 0)
                result = (result * 0x10000000000000002C5C85FDF473DE6B2) >> 128;
            if (x & 0x2 > 0)
                result = (result * 0x1000000000000000162E42FEFA39EF358) >> 128;
            if (x & 0x1 > 0)
                result = (result * 0x10000000000000000B17217F7D1CF79AB) >> 128;

            result >>= uint256(int256(63 - (x >> 64)));
            require(result <= uint256(int256(MAX_64x64)));

            return int128(int256(result));
        }
    }

    /**
     * Calculate natural exponent of x.  Revert on overflow.
     *
     * @param x signed 64.64-bit fixed point number
     * @return signed 64.64-bit fixed point number
     */
    function exp(int128 x) internal pure returns (int128) {
        unchecked {
            require(x < 0x400000000000000000); // Overflow

            if (x < -0x400000000000000000) return 0; // Underflow

            return
                exp_2(
                    int128(
                        (int256(x) * 0x171547652B82FE1777D0FFDA0D23A7D12) >> 128
                    )
                );
        }
    }

    /**
     * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
     * integer numbers.  Revert on overflow or when y is zero.
     *
     * @param x unsigned 256-bit integer number
     * @param y unsigned 256-bit integer number
     * @return unsigned 64.64-bit fixed point number
     */
    function divuu(uint256 x, uint256 y) private pure returns (uint128) {
        unchecked {
            require(y != 0);

            uint256 result;

            if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
                result = (x << 64) / y;
            else {
                uint256 msb = 192;
                uint256 xc = x >> 192;
                if (xc >= 0x100000000) {
                    xc >>= 32;
                    msb += 32;
                }
                if (xc >= 0x10000) {
                    xc >>= 16;
                    msb += 16;
                }
                if (xc >= 0x100) {
                    xc >>= 8;
                    msb += 8;
                }
                if (xc >= 0x10) {
                    xc >>= 4;
                    msb += 4;
                }
                if (xc >= 0x4) {
                    xc >>= 2;
                    msb += 2;
                }
                if (xc >= 0x2) msb += 1; // No need to shift xc anymore

                result = (x << (255 - msb)) / (((y - 1) >> (msb - 191)) + 1);
                require(result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

                uint256 hi = result * (y >> 128);
                uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

                uint256 xh = x >> 192;
                uint256 xl = x << 64;

                if (xl < lo) xh -= 1;
                xl -= lo; // We rely on overflow behavior here
                lo = hi << 128;
                if (xl < lo) xh -= 1;
                xl -= lo; // We rely on overflow behavior here

                assert(xh == hi >> 128);

                result += xl / y;
            }

            require(result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
            return uint128(result);
        }
    }

    /**
     * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer
     * number.
     *
     * @param x unsigned 256-bit integer number
     * @return unsigned 128-bit integer number
     */
    function sqrtu(uint256 x) private pure returns (uint128) {
        unchecked {
            if (x == 0) return 0;
            else {
                uint256 xx = x;
                uint256 r = 1;
                if (xx >= 0x100000000000000000000000000000000) {
                    xx >>= 128;
                    r <<= 64;
                }
                if (xx >= 0x10000000000000000) {
                    xx >>= 64;
                    r <<= 32;
                }
                if (xx >= 0x100000000) {
                    xx >>= 32;
                    r <<= 16;
                }
                if (xx >= 0x10000) {
                    xx >>= 16;
                    r <<= 8;
                }
                if (xx >= 0x100) {
                    xx >>= 8;
                    r <<= 4;
                }
                if (xx >= 0x10) {
                    xx >>= 4;
                    r <<= 2;
                }
                if (xx >= 0x8) {
                    r <<= 1;
                }
                r = (r + x / r) >> 1;
                r = (r + x / r) >> 1;
                r = (r + x / r) >> 1;
                r = (r + x / r) >> 1;
                r = (r + x / r) >> 1;
                r = (r + x / r) >> 1;
                r = (r + x / r) >> 1; // Seven iterations should be enough
                uint256 r1 = x / r;
                return uint128(r < r1 ? r : r1);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settlementFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalFee","type":"uint256"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"config","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"tokenX","type":"address"},{"indexed":false,"internalType":"string","name":"token0","type":"string"},{"indexed":false,"internalType":"string","name":"token1","type":"string"},{"indexed":false,"internalType":"enum IBufferBinaryOptions.AssetCategory","name":"category","type":"uint8"}],"name":"CreateOptionsContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"profit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceAtExpiration","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isAbove","type":"bool"}],"name":"Exercise","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"premium","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceAtExpiration","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isAbove","type":"bool"}],"name":"Expire","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LpLoss","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LpProfit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"referrer","type":"address"},{"indexed":false,"internalType":"bool","name":"isReferralValid","type":"bool"},{"indexed":false,"internalType":"uint256","name":"totalFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"referrerFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rebate","type":"uint256"},{"indexed":false,"internalType":"string","name":"referralCode","type":"string"}],"name":"UpdateReferral","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROUTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"_getReferralDiscount","outputs":[{"internalType":"uint256","name":"referralDiscount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addressToApprove","type":"address"}],"name":"approveAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"approvePoolToTransferTokenX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetCategory","outputs":[{"internalType":"enum IBufferBinaryOptions.AssetCategory","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetPair","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"contract IOptionsConfig","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"bool","name":"allowPartialFill","type":"bool"},{"internalType":"uint256","name":"totalFee","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"string","name":"referralCode","type":"string"},{"internalType":"uint256","name":"baseSettlementFeePercentage","type":"uint256"}],"internalType":"struct IBufferBinaryOptions.OptionParams","name":"optionParams","type":"tuple"},{"internalType":"uint256","name":"queuedTime","type":"uint256"}],"name":"createFromRouter","outputs":[{"internalType":"uint256","name":"optionID","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"bool","name":"allowPartialFill","type":"bool"},{"internalType":"uint256","name":"totalFee","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"string","name":"referralCode","type":"string"},{"internalType":"uint256","name":"baseSettlementFeePercentage","type":"uint256"}],"internalType":"struct IBufferBinaryOptions.OptionParams","name":"optionParams","type":"tuple"},{"internalType":"uint256","name":"slippage","type":"uint256"}],"name":"evaluateParams","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"revisedFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"string","name":"referralCode","type":"string"},{"internalType":"uint256","name":"baseSettlementFeePercentage","type":"uint256"}],"name":"fees","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"settlementFee","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxOI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxTradeSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"baseSettlementFeePercentage","type":"uint256"}],"name":"getSettlementFeePercentage","outputs":[{"internalType":"uint256","name":"settlementFeePercentage","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"_tokenX","type":"address"},{"internalType":"contract ILiquidityPool","name":"_pool","type":"address"},{"internalType":"contract IOptionsConfig","name":"_config","type":"address"},{"internalType":"contract IReferralStorage","name":"_referral","type":"address"},{"internalType":"enum IBufferBinaryOptions.AssetCategory","name":"_category","type":"uint8"},{"internalType":"string","name":"_token0","type":"string"},{"internalType":"string","name":"_token1","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"uint256","name":"currentPrice","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"}],"name":"isStrikeValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"options","outputs":[{"internalType":"enum IBufferBinaryOptions.State","name":"state","type":"uint8"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"uint256","name":"totalFee","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract ILiquidityPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referral","outputs":[{"internalType":"contract IReferralStorage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setIsPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stepSize","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenX","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMarketOI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"optionID","type":"uint256"},{"internalType":"uint256","name":"closingPrice","type":"uint256"},{"internalType":"uint256","name":"closingTime","type":"uint256"},{"internalType":"bool","name":"isAbove","type":"bool"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userOptionIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040526000600855600a805462ffff0019166119001790553480156200002657600080fd5b506040805180820182526006815265213ab33332b960d11b60208083019182528351808501909452600384526221232960e91b9084015260016000819055825192939262000075929062000157565b5080516200008b90600290602084019062000157565b506200009d91506000905033620000a3565b6200023a565b620000af8282620000b3565b5050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16620000af5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001133390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8280546200016590620001fd565b90600052602060002090601f016020900481019282620001895760008555620001d4565b82601f10620001a457805160ff1916838001178555620001d4565b82800160010185558215620001d4579182015b82811115620001d4578251825591602001919060010190620001b7565b50620001e2929150620001e6565b5090565b5b80821115620001e25760008155600101620001e7565b600181811c908216806200021257607f821691505b602082108114156200023457634e487b7160e01b600052602260045260246000fd5b50919050565b615c61806200024a6000396000f3fe608060405234801561001057600080fd5b50600436106102465760003560e01c806301ffc9a71461024b57806306fdde0314610273578063081812fc14610288578063095ea7b3146102a85780630dfe1681146102bd57806310082c75146102c55780631441a5a9146102cd57806316dc165b146102e057806316f0115b146102f35780631b3979c01461030657806320a6c8ba146103195780632313dd021461033a57806323b872dd14610343578063248a9ca3146103565780632c26d8ee146103695780632f2ff15d1461038a57806330d643b51461039d578063313ce567146103b257806336568abe146103ba57806336ebafe9146103cd5780633c993eee146103f3578063409e22051461040657806342842e0e1461046f57806356799e5f146104825780635a3670931461048a578063617c67191461049d5780636352211e146104b0578063645734e6146104c357806370a08231146104cb57806375794a3c146104de57806379502c55146104e757806391d14854146104fa57806395d89b411461050d5780639d821e0114610515578063a217fddf14610537578063a22cb4651461053f578063b187bd2614610552578063b88d4fde1461055f578063bdfda7c814610572578063c87b56dd1461057a578063c962ca121461058d578063cc04ea4a146105a0578063d21220a7146105a8578063d547741f146105b0578063d6cfef17146105c3578063e63ab1e9146105d6578063e7ec7d35146105eb578063e985e9c514610613578063f136a87414610626578063fabf657a14610649575b600080fd5b61025e61025936600461514a565b61065c565b60405190151581526020015b60405180910390f35b61027b61066d565b60405161026a9190615793565b61029b61029636600461510e565b6106ff565b60405161026a91906155ec565b6102bb6102b63660046150ab565b610726565b005b61027b610841565b61027b6108cf565b600f5461029b906001600160a01b031681565b60105461029b906001600160a01b031681565b600d5461029b906001600160a01b031681565b6102bb610314366004615182565b6108fa565b61032c610327366004614fc2565b610a7e565b60405190815260200161026a565b61032c60095481565b6102bb610351366004614fc2565b610bb4565b61032c61036436600461510e565b610be5565b600f5461037d90600160a01b900460ff1681565b60405161026a9190615710565b6102bb610398366004615126565b610bfa565b61032c600080516020615c0c83398151915281565b61032c610c16565b6102bb6103c8366004615126565b610c9b565b600a546103e090610100900461ffff1681565b60405161ffff909116815260200161026a565b61025e61040136600461531e565b610d19565b61045b61041436600461510e565b6011602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015460ff909616969495939492939192909188565b60405161026a98979695949392919061571e565b6102bb61047d366004614fc2565b610d83565b6102bb610d9e565b6102bb610498366004615349565b610e67565b61032c6104ab366004614f8a565b611235565b61029b6104be36600461510e565b6113a7565b6102bb6113b2565b61032c6104d9366004614f52565b61143f565b61032c60085481565b600e5461029b906001600160a01b031681565b61025e610508366004615126565b6114c5565b61027b6114f0565b610528610523366004615293565b6114ff565b60405161026a93929190615769565b61032c600081565b6102bb61054d36600461507e565b6115b1565b600a5461025e9060ff1681565b6102bb61056d366004615002565b6115bc565b61032c6115f4565b61027b61058836600461510e565b6117fe565b61032c61059b3660046150ab565b611871565b61032c6118a2565b61027b611a5b565b6102bb6105be366004615126565b611a68565b61032c6105d1366004615242565b611a84565b61032c600080516020615bcc83398151915281565b6105fe6105f9366004615242565b61217c565b6040805192835260208301919091520161026a565b61025e610621366004614f8a565b61274b565b61025e610634366004614f52565b60136020526000908152604090205460ff1681565b6102bb610657366004614f52565b612779565b6000610667826127a9565b92915050565b60606001805461067c90615aaa565b80601f01602080910402602001604051908101604052809291908181526020018280546106a890615aaa565b80156106f55780601f106106ca576101008083540402835291602001916106f5565b820191906000526020600020905b8154815290600101906020018083116106d857829003601f168201915b5050505050905090565b600061070a826127ce565b506000908152600560205260409020546001600160a01b031690565b6000610731826127f3565b9050806001600160a01b0316836001600160a01b031614156107a45760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806107c057506107c0813361274b565b6108325760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161079b565b61083c8383612828565b505050565b600b805461084e90615aaa565b80601f016020809104026020016040519081016040528092919081815260200182805461087a90615aaa565b80156108c75780601f1061089c576101008083540402835291602001916108c7565b820191906000526020600020905b8154815290600101906020018083116108aa57829003601f168201915b505050505081565b6060600b600c6040516020016108e6929190615568565b604051602081830303815290604052905090565b600061090581612896565b6010546001600160a01b0316610a3657601080546001600160a01b03808b166001600160a01b031992831617909255600d80548a8416908316179055600e8054898416908316179055600f805492881691831682178155869290916001600160a81b031990911617600160a01b83600281111561099257634e487b7160e01b600052602160045260246000fd5b021790555082516109aa90600b906020860190614e25565b5081516109be90600c906020850190614e25565b506109ca6000336128a0565b600e54600d54601054600f546040517f13d3a1031aba66188cca5785e8045078864e8f69c24715761bf0449ef10304d694610a29946001600160a01b039182169490821693911691600b91600c91600160a01b90910460ff169061561a565b60405180910390a1610a74565b60405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015260640161079b565b5050505050505050565b806000610a8b8585611235565b9050600e60009054906101000a90046001600160a01b03166001600160a01b03166327f7be996040518163ffffffff1660e01b815260040160206040518083038186803b158015610adb57600080fd5b505afa158015610aef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b139190614f6e565b60105460405163037fe71160e41b81526001600160a01b03928316926337fe711092610b4792899290911690600401615600565b60206040518083038186803b158015610b5f57600080fd5b505afa158015610b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b97919061527b565b610ba18284615a50565b610bab9190615a50565b95945050505050565b610bbe33826128aa565b610bda5760405162461bcd60e51b815260040161079b9061582a565b61083c838383612908565b60009081526007602052604090206001015490565b610c0382610be5565b610c0c81612896565b61083c8383612a9d565b6010546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9391906153ad565b60ff16905090565b6001600160a01b0381163314610d0b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161079b565b610d158282612b23565b5050565b6000612710610d2885826158db565b610d3290846159f2565b610d3c91906158f3565b8311158015610d6b5750612710610d538582615a50565b610d5d90846159f2565b610d6791906158f3565b8310155b15610d7857506001610d7c565b5060005b9392505050565b61083c838383604051806020016040528060008152506115bc565b610db6600080516020615bcc833981519152336114c5565b15610dcd57600a805460ff19166001179055610e29565b610dd86000336114c5565b15610df457600a805460ff19811660ff90911615179055610e29565b60405162461bcd60e51b815260206004820152600a60248201526957726f6e6720726f6c6560b01b604482015260640161079b565b600a5460405160ff909116151581527f9422424b175dda897495a07b091ef74a3ef715cf6d866fc972954c1c7f4593049060200160405180910390a1565b600080516020615c0c833981519152610e7f81612896565b610e8885612b8a565b610eba5760405162461bcd60e51b815260206004820152600360248201526204f31360ec1b604482015260640161079b565b60008581526011602052604090206001815460ff166003811115610eee57634e487b7160e01b600052602160045260246000fd5b14610f205760405162461bcd60e51b81526020600482015260026024820152614f3560f01b604482015260640161079b565b6000838015610f325750816001015486115b80610f49575083158015610f495750816001015486105b80610f575750848260050154115b15610f6f57610f6887878787612ba7565b9050611022565b815460ff19166003178255600d54604051636198e33960e01b8152600481018990526001600160a01b0390911690636198e33990602401600060405180830381600087803b158015610fc057600080fd5b505af1158015610fd4573d6000803e3d6000fd5b50505050610fe187612e9a565b867f06b9a7d5e559ec958118dcc25fab116916793fa9782acbf47186bf70bc4cf88e8360040154888760405161101993929190615878565b60405180910390a25b8160060154600960008282546110389190615a50565b9091555050600e5460408051633ca5f63160e11b815290516001600160a01b039092169163794bec6291600480820192602092909190829003018186803b15801561108257600080fd5b505afa158015611096573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ba9190614f6e565b60068301546040516305d7640760e21b81526000600482015260248101919091526001600160a01b03919091169063175d901c90604401600060405180830381600087803b15801561110b57600080fd5b505af115801561111f573d6000803e3d6000fd5b50505050600e60009054906101000a90046001600160a01b03166001600160a01b031663911b171e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561117157600080fd5b505afa158015611185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a99190614f6e565b6001600160a01b0316633a5d92a88360060154836111c79190615a11565b846004015485600601546111db9190615a50565b8a6040518463ffffffff1660e01b81526004016111fa93929190615769565b600060405180830381600087803b15801561121457600080fd5b505af1158015611228573d6000803e3d6000fd5b5050505050505050505050565b600080826001600160a01b0316846001600160a01b03161415801561126257506001600160a01b03841615155b801561127657506001600160a01b0384163b155b1561138857600f5460405163010de89960e21b81526000916001600160a01b03169063ad1b1493908290630437a264906112b4908a906004016155ec565b60206040518083038186803b1580156112cc57600080fd5b505afa1580156112e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130491906153ad565b6040516001600160e01b031960e084901b16815260ff909116600482015260240160206040518083038186803b15801561133d57600080fd5b505afa158015611351573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137591906153ad565b905061138460ff8216836158db565b9150505b600a5461139f908290610100900461ffff166159f2565b949350505050565b6000610667826127f3565b601054600d5460405163095ea7b360e01b81526001600160a01b039283169263095ea7b3926113ea92911690600019906004016156f7565b602060405180830381600087803b15801561140457600080fd5b505af1158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c91906150f2565b50565b60006001600160a01b0382166114a95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161079b565b506001600160a01b031660009081526004602052604090205490565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606002805461067c90615aaa565b600f54604051637d191bdb60e01b8152600091829182918291611593916001600160a01b031690637d191bdb9061153c908b908b9060040161577f565b60206040518083038186803b15801561155457600080fd5b505afa158015611568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158c9190614f6e565b8987610a7e565b905061159f8982612f2f565b919b909a509098509650505050505050565b610d15338383612f77565b6115c633836128aa565b6115e25760405162461bcd60e51b815260040161079b9061582a565b6115ee84848484613042565b50505050565b60006117f9600e60009054906101000a90046001600160a01b03166001600160a01b031663731b7c406040518163ffffffff1660e01b815260040160206040518083038186803b15801561164757600080fd5b505afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167f9190614f6e565b6001600160a01b0316635f64432d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b757600080fd5b505afa1580156116cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ef919061527b565b600e60009054906101000a90046001600160a01b03166001600160a01b031663691aac5f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561173d57600080fd5b505afa158015611751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117759190614f6e565b6001600160a01b031663dec4f15e6009546040518263ffffffff1660e01b81526004016117a491815260200190565b60206040518083038186803b1580156117bc57600080fd5b505afa1580156117d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f4919061527b565b613075565b905090565b6060611809826127ce565b600061182060408051602081019091526000815290565b905060008151116118405760405180602001604052806000815250610d7c565b8061184a8461308b565b60405160200161185b929190615539565b6040516020818303038152906040529392505050565b6012602052816000526040600020818154811061188d57600080fd5b90600052602060002001600091509150505481565b60006117f9600e60009054906101000a90046001600160a01b03166001600160a01b031663731b7c406040518163ffffffff1660e01b815260040160206040518083038186803b1580156118f557600080fd5b505afa158015611909573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192d9190614f6e565b6001600160a01b031663710e595a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561196557600080fd5b505afa158015611979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199d919061527b565b600e60009054906101000a90046001600160a01b03166001600160a01b031663691aac5f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119eb57600080fd5b505afa1580156119ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a239190614f6e565b6001600160a01b031663ceb5fac36040518163ffffffff1660e01b815260040160206040518083038186803b1580156117bc57600080fd5b600c805461084e90615aaa565b611a7182610be5565b611a7a81612896565b61083c8383612b23565b6000600080516020615c0c833981519152611a9e81612896565b6040805161010081018252600181528535602080830191909152860135918101829052606081018290526000916080820190611adc906002906158f3565b8152602001611aef6040880135876158db565b8152608087013560208201526040018590529050611b0b6131a4565b925060126000611b2160c0880160a08901614f52565b6001600160a01b031681526020808201929092526040908101600090812080546001818101835591835284832001879055868252601190935220825181548493839160ff191690836003811115611b8857634e487b7160e01b600052602160045260246000fd5b02179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070155905050611bf28560a0016020810190611bec9190614f52565b846131be565b6000611c28611c0760c0880160a08901614f52565b60808801356020890135611c1e60c08b018b615890565b8b60e001356132ea565b905060008183608001518860800135611c419190615a50565b611c4b9190615a50565b9050611ce9600e60009054906101000a90046001600160a01b03166001600160a01b031663136834366040518163ffffffff1660e01b815260040160206040518083038186803b158015611c9e57600080fd5b505afa158015611cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd69190614f6e565b6010546001600160a01b03169083613599565b600d546060840151608085015160405163edd0d42160e01b81526001600160a01b039093169263edd0d42192611d23928a92600401615769565b600060405180830381600087803b158015611d3d57600080fd5b505af1158015611d51573d6000803e3d6000fd5b505050506000600e60009054906101000a90046001600160a01b03166001600160a01b03166327f7be996040518163ffffffff1660e01b815260040160206040518083038186803b158015611da557600080fd5b505afa158015611db9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddd9190614f6e565b905060006001600160a01b0382166337fe7110611e0060c08c0160a08d01614f52565b6010546040516001600160e01b031960e085901b168152611e2e92916001600160a01b031690600401615600565b60206040518083038186803b158015611e4657600080fd5b505afa158015611e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7e919061527b565b1115611f04576001600160a01b038116633ffc5164611ea360c08b0160a08c01614f52565b6010546040516001600160e01b031960e085901b168152611ed192916001600160a01b031690600401615600565b600060405180830381600087803b158015611eeb57600080fd5b505af1158015611eff573d6000803e3d6000fd5b505050505b600e60009054906101000a90046001600160a01b03166001600160a01b03166395b12ea36040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5257600080fd5b505afa158015611f66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8a9190614f6e565b6001600160a01b031663710b28158730611faa60c08d0160a08e01614f52565b6040516001600160e01b031960e086901b16815260048101939093526001600160a01b039182166024840152166044820152606401600060405180830381600087803b158015611ff957600080fd5b505af115801561200d573d6000803e3d6000fd5b5050505087608001356009600082825461202791906158db565b9091555050600e5460408051633ca5f63160e11b815290516001600160a01b039092169163794bec6291600480820192602092909190829003018186803b15801561207157600080fd5b505afa158015612085573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a99190614f6e565b6040516305d7640760e21b81526001600482015260808a013560248201526001600160a01b03919091169063175d901c90604401600060405180830381600087803b1580156120f757600080fd5b505af115801561210b573d6000803e3d6000fd5b5088925061212291505060c08a0160a08b01614f52565b6001600160a01b03167fe3a07e2ac405f9c908f600ba464ed28dd28f04e308ccc0610a33ca7ed1c59abb848b60800135604051612169929190918252602082015260400190565b60405180910390a3505050505092915050565b6000806101f48311156121b75760405162461bcd60e51b815260206004820152600360248201526213cccd60ea1b604482015260640161079b565b600e60009054906101000a90046001600160a01b03166001600160a01b031663ffd49c846040518163ffffffff1660e01b815260040160206040518083038186803b15801561220557600080fd5b505afa158015612219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223d9190615389565b63ffffffff168460400135101561227c5760405162461bcd60e51b81526020600482015260036024820152624f323160e81b604482015260640161079b565b600e60009054906101000a90046001600160a01b03166001600160a01b03166349b9a67f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156122ca57600080fd5b505afa1580156122de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123029190615389565b63ffffffff16846040013511156123415760405162461bcd60e51b81526020600482015260036024820152624f323560e81b604482015260640161079b565b600e60009054906101000a90046001600160a01b03166001600160a01b03166324ec75906040518163ffffffff1660e01b815260040160206040518083038186803b15801561238f57600080fd5b505afa1580156123a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c7919061527b565b846080013510156124005760405162461bcd60e51b81526020600482015260036024820152624f333560e81b604482015260640161079b565b600a5460ff16156124395760405162461bcd60e51b81526020600482015260036024820152624f333360e81b604482015260640161079b565b6001600f54600160a01b900460ff16600281111561246757634e487b7160e01b600052602160045260246000fd5b14806125755750600e60009054906101000a90046001600160a01b03166001600160a01b0316632677327a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156124bc57600080fd5b505afa1580156124d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f49190614f6e565b6001600160a01b031663f7d52fa185604001356040518263ffffffff1660e01b815260040161252591815260200190565b60206040518083038186803b15801561253d57600080fd5b505afa158015612551573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257591906150f2565b6125a75760405162461bcd60e51b815260206004820152600360248201526204f33360ec1b604482015260640161079b565b60006125b16115f4565b9050600081116125e95760405162461bcd60e51b815260206004820152600360248201526227999b60e91b604482015260640161079b565b6125f7856080013582613075565b915084608001358210156126475761261560808601606087016150d6565b6126475760405162461bcd60e51b81526020600482015260036024820152624f323960e81b604482015260640161079b565b600f546000906126f3906001600160a01b0316637d191bdb61266c60c08a018a615890565b6040518363ffffffff1660e01b815260040161268992919061577f565b60206040518083038186803b1580156126a157600080fd5b505afa1580156126b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d99190614f6e565b6126e960c0890160a08a01614f52565b8860e00135610a7e565b90506000612713612702610c16565b61270d90600a61594a565b83612f2f565b5050905080612720610c16565b61272b90600a61594a565b61273590866159f2565b61273f91906158f3565b94505050509250929050565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b600061278481612896565b506001600160a01b03166000908152601360205260409020805460ff19166001179055565b60006001600160e01b03198216637965db0b60e01b14806106675750610667826135ef565b6127d781612b8a565b61143c5760405162461bcd60e51b815260040161079b906157f8565b6000818152600360205260408120546001600160a01b0316806106675760405162461bcd60e51b815260040161079b906157f8565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061285d826127f3565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61143c813361363f565b610d158282612a9d565b6000806128b6836127f3565b9050806001600160a01b0316846001600160a01b031614806128dd57506128dd818561274b565b8061139f5750836001600160a01b03166128f6846106ff565b6001600160a01b031614949350505050565b826001600160a01b031661291b826127f3565b6001600160a01b03161461297f5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161079b565b6001600160a01b0382166129e15760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161079b565b6129ec8383836136a3565b6129f7600082612828565b6001600160a01b0383166000908152600460205260408120805460019290612a20908490615a50565b90915550506001600160a01b0382166000908152600460205260408120805460019290612a4e9084906158db565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615bec83398151915291a4505050565b612aa782826114c5565b610d155760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612adf3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612b2d82826114c5565b15610d155760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000908152600360205260409020546001600160a01b0316151590565b600084815260116020526040812081612bbf876113a7565b90508482600501541115612ccb576000848015612bdf5750868360010154105b80612bf6575084158015612bf65750868360010154115b15612bff575060015b600e54604051633fbf085d60e21b815282151560048201526305f5e10091612caa916001600160a01b039091169063fefc21749060240160206040518083038186803b158015612c4e57600080fd5b505afa158015612c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c869190615389565b63ffffffff1685600101548a8a8860050154612ca29190615a50565b60018b613757565b8460030154612cb991906159f2565b612cc391906158f3565b935050612cd3565b816003015492505b600d5460038301546040516381b34f1560e01b8152600481018a905230602482015260448101919091526001600160a01b03909116906381b34f1590606401600060405180830381600087803b158015612d2c57600080fd5b505af1158015612d40573d6000803e3d6000fd5b5050601054612d5c92506001600160a01b031690508285613599565b8160030154831015612d9c57600d546003830154612d9c916001600160a01b031690612d89908690615a50565b6010546001600160a01b03169190613599565b81600401548311612def57867fc88c04f82f76cf4112dc206d1a563be25c04a4a762a699eccd4d4abc6df0dff0848460040154612dd99190615a50565b60405190815260200160405180910390a2612e33565b867fa569991d55d525eae5729bac6890aeb7c0bdcd198f36ca0d0a7da8c2c0a734fb836004015485612e219190615a50565b60405190815260200160405180910390a25b612e3c87612e9a565b815460ff1916600217825560405187906001600160a01b038316907ff394088c7503260c927488ca4397d6b43146f13c239078415e6f14029e5cb7f890612e889087908b908a90615878565b60405180910390a35050949350505050565b6000612ea5826127f3565b9050612eb3816000846136a3565b612ebe600083612828565b6001600160a01b0381166000908152600460205260408120805460019290612ee7908490615a50565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020615bec833981519152908390a45050565b60008080612f3e6002866158f3565b9050612f4c84612710615a50565b612f58826127106159f2565b612f6291906158f3565b9250612f6e8184615a50565b91509250925092565b816001600160a01b0316836001600160a01b03161415612fd55760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161079b565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61304d848484612908565b61305984848484613829565b6115ee5760405162461bcd60e51b815260040161079b906157a6565b60008183106130845781610d7c565b5090919050565b6060816130af5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156130d957806130c381615ae5565b91506130d29050600a836158f3565b91506130b3565b6000816001600160401b0381111561310157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561312b576020820181803683370190505b5090505b841561139f57613140600183615a50565b915061314d600a86615b00565b6131589060306158db565b60f81b81838151811061317b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061319d600a866158f3565b945061312f565b60088054600091826131b583615ae5565b91905055905090565b6001600160a01b0382166132145760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161079b565b61321d81612b8a565b156132695760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b604482015260640161079b565b613275600083836136a3565b6001600160a01b038216600090815260046020526040812080546001929061329e9084906158db565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615bec833981519152908290a45050565b600f54604051637d191bdb60e01b815260009182916001600160a01b0390911690637d191bdb90613321908890889060040161577f565b60206040518083038186803b15801561333957600080fd5b505afa15801561334d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133719190614f6e565b9050876001600160a01b0316816001600160a01b03161415801561339d57506001600160a01b03811615155b80156133b157506001600160a01b0381163b155b1561358e57600f5460405163010de89960e21b815260019162989680916001600160a01b0390911690639c5b5a74908290630437a264906133f69088906004016155ec565b60206040518083038186803b15801561340e57600080fd5b505afa158015613422573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061344691906153ad565b6040516001600160e01b031960e084901b16815260ff909116600482015260240160206040518083038186803b15801561347f57600080fd5b505afa158015613493573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134b79190615389565b6134c79063ffffffff168a6159f2565b6134d191906158f3565b9250821561358c576010546134f0906001600160a01b03168385613599565b600061350e6134fd610c16565b61350890600a61594a565b86612f2f565b505090507f4dcf678c034d0e315232ac598af6dbd0ac15f49f05df2c425292d10736d95b368a84848c888e613541610c16565b61354c90600a61594a565b8f8961355891906159f2565b61356291906158f3565b61356c9190615a50565b8d8d604051613582989796959493929190615670565b60405180910390a1505b505b509695505050505050565b61083c8363a9059cbb60e01b84846040516024016135b89291906156f7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261393d565b60006001600160e01b031982166380ac58cd60e01b148061362057506001600160e01b03198216635b5e139f60e01b145b8061066757506301ffc9a760e01b6001600160e01b0319831614610667565b61364982826114c5565b610d1557613661816001600160a01b03166014613a0f565b61366c836020613a0f565b60405160200161367d92919061557d565b60408051601f198184030181529082905262461bcd60e51b825261079b91600401615793565b6001600160a01b038316158015906136c357506001600160a01b03821615155b80156136e857506001600160a01b03821660009081526013602052604090205460ff16155b801561370d57506001600160a01b03831660009081526013602052604090205460ff16155b1561083c5760405162461bcd60e51b815260206004820152601a602482015279151bdad95b881d1c985b9cd9995c881b9bdd08185b1b1bddd95960321b604482015260640161079b565b6000806137676305f5e100613bf0565b90506000613776612710613bf0565b90506000613790826137878c613bf0565b600f0b90613c0d565b905060006137a2600f83900b83613c74565b905060006137b3856137878d613bf0565b905060006137c4866137878d613bf0565b905060006137e16137d86301e13380613bf0565b6137878d613bf0565b905060006137f3858585858f8f613caa565b905061380b613806600f83900b8a613c74565b613d81565b6001600160401b0316985050505050505050505b9695505050505050565b600061383d846001600160a01b0316613d9d565b1561393257604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906138749033908990889088906004016156c4565b602060405180830381600087803b15801561388e57600080fd5b505af19250505080156138be575060408051601f3d908101601f191682019092526138bb91810190615166565b60015b613918573d8080156138ec576040519150601f19603f3d011682016040523d82523d6000602084013e6138f1565b606091505b5080516139105760405162461bcd60e51b815260040161079b906157a6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061139f565b506001949350505050565b6000613992826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613dac9092919063ffffffff16565b80519091501561083c57808060200190518101906139b091906150f2565b61083c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161079b565b60606000613a1e8360026159f2565b613a299060026158db565b6001600160401b03811115613a4e57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613a78576020820181803683370190505b509050600360fc1b81600081518110613aa157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613ade57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613b028460026159f2565b613b0d9060016158db565b90505b6001811115613ba1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613b4f57634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613b7357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613b9a81615a93565b9050613b10565b508315610d7c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161079b565b600060016001603f1b03821115613c0657600080fd5b5060401b90565b600081600f0b60001415613c2057600080fd5b600082600f0b604085600f0b901b81613c4957634e487b7160e01b600052601260045260246000fd5b05905060016001607f1b03198112801590613c6b575060016001607f1b038113155b610d7c57600080fd5b6000600f83810b9083900b0260401d60016001607f1b03198112801590613c6b575060016001607f1b03811315610d7c57600080fd5b600080613cbb600f86900b89613c74565b90506000613ccb82600f0b613dbb565b90506000613d0882613787600186600f0b901d613cff613cf78e8e600f0b613c0d90919063ffffffff16565b600f0b613ddd565b600f0b90613e17565b90506000613d1a600f83900b84613e4a565b90508615613d4d578515613d3c57613d3181613e7d565b94505050505061381f565b613d31613d4882615b14565b613e7d565b8515613d7257613d31613d5f82613e7d565b613d696001613bf0565b600f0b90613e4a565b613d31613d5f613d4883615b14565b60008082600f0b1215613d9357600080fd5b50600f0b60401d90565b6001600160a01b03163b151590565b606061139f8484600085613f34565b60008082600f0b1215613dcd57600080fd5b610667604083600f0b901b614063565b60008082600f0b13613dee57600080fd5b6080613df983614240565b600f0b6fb17217f7d1cf79abc9e3b39803f2f6af02901c9050919050565b6000600f83810b9083900b0160016001607f1b03198112801590613c6b575060016001607f1b03811315610d7c57600080fd5b6000600f82810b9084900b0360016001607f1b03198112801590613c6b575060016001607f1b03811315610d7c57600080fd5b600080613e8e600f84900b84613c74565b90506000613f13613ef8613ec7613eb8613eb0600f87900b600360401b613e17565b600f0b613dbb565b67d3c84b78b749bd6b90613c74565b613cff613ee9613ed989600f0b61431a565b68019abac0ea1da6503690613c74565b679109f285df45239490613e17565b6137876001613f0686615b14565b600f0b901d600f0b61434d565b9050600084600f0b13613f26578061139f565b61139f600160401b82613e4a565b606082471015613f955760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161079b565b613f9e85613d9d565b613fea5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161079b565b600080866001600160a01b03168587604051614006919061551d565b60006040518083038185875af1925050503d8060008114614043576040519150601f19603f3d011682016040523d82523d6000602084013e614048565b606091505b50915091506140588282866143a0565b979650505050505050565b60008161407257506000919050565b816001600160801b821061408b5760809190911c9060401b5b600160401b82106140a15760409190911c9060201b5b600160201b82106140b75760209190911c9060101b5b6201000082106140cc5760109190911c9060081b5b61010082106140e05760089190911c9060041b5b601082106140f35760049190911c9060021b5b600882106140ff5760011b5b600181858161411e57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161414457634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161416a57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161419057634e487b7160e01b600052601260045260246000fd5b048201901c905060018185816141b657634e487b7160e01b600052601260045260246000fd5b048201901c905060018185816141dc57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161420257634e487b7160e01b600052601260045260246000fd5b048201901c9050600081858161422857634e487b7160e01b600052601260045260246000fd5b0490508082106142385780610bab565b509392505050565b60008082600f0b1361425157600080fd5b6000600f83900b600160401b811261426b576040918201911d5b600160201b811261427e576020918201911d5b620100008112614290576010918201911d5b61010081126142a1576008918201911d5b601081126142b1576004918201911d5b600481126142c1576002918201911d5b600281126142d0576001820191505b603f19820160401b600f85900b607f8490031b6001603f1b5b600081131561430f5790800260ff81901c8281029390930192607f011c9060011d6142e9565b509095945050505050565b6000600f82900b60016001607f1b0319141561433557600080fd5b600082600f0b126143465781610667565b5060000390565b6000600160461b82600f0b1261436257600080fd5b6001600160461b031982600f0b121561437d57506000919050565b610667608083600f0b700171547652b82fe1777d0ffda0d23a7d1202901d6143d9565b606083156143af575081610d7c565b8251156143bf5782518084602001fd5b8160405162461bcd60e51b815260040161079b9190615793565b6000600160461b82600f0b126143ee57600080fd5b6001600160461b031982600f0b121561440957506000919050565b6001607f1b60006001603f1b8416600f0b13156144375770016a09e667f3bcc908b2fb1366ea957d3e0260801c5b6000836001603e1b16600f0b1315614460577001306fe0a31b7152de8d5a46305c85edec0260801c5b6000836001603d1b16600f0b1315614489577001172b83c7d517adcdf7c8c50eb14a791f0260801c5b6000836001603c1b16600f0b13156144b25770010b5586cf9890f6298b92b71842a983630260801c5b6000836001603b1b16600f0b13156144db577001059b0d31585743ae7c548eb68ca417fd0260801c5b6000836001603a1b16600f0b131561450457700102c9a3e778060ee6f7caca4f7a29bde80260801c5b600083600160391b16600f0b131561452d5770010163da9fb33356d84a66ae336dcdfa3f0260801c5b600083600160381b16600f0b131561455657700100b1afa5abcbed6129ab13ec11dc95430260801c5b600083600160371b16600f0b131561457f5770010058c86da1c09ea1ff19d294cf2f679b0260801c5b600083600160361b16600f0b13156145a8577001002c605e2e8cec506d21bfc89a23a00f0260801c5b600083600160351b16600f0b13156145d157700100162f3904051fa128bca9c55c31e5df0260801c5b600083600160341b16600f0b13156145fa577001000b175effdc76ba38e31671ca9397250260801c5b600083600160331b16600f0b131561462357700100058ba01fb9f96d6cacd4b180917c3d0260801c5b600083600160321b16600f0b131561464c5770010002c5cc37da9491d0985c348c68e7b30260801c5b600083600160311b16600f0b1315614675577001000162e525ee054754457d59952920260260801c5b600083600160301b16600f0b131561469e5770010000b17255775c040618bf4a4ade83fc0260801c5b6000836001602f1b16600f0b13156146c7577001000058b91b5bc9ae2eed81e9b7d4cfab0260801c5b6000836001602e1b16600f0b13156146f057700100002c5c89d5ec6ca4d7c8acc017b7c90260801c5b6000836001602d1b16600f0b13156147195770010000162e43f4f831060e02d839a9d16d0260801c5b6000836001602c1b16600f0b131561474257700100000b1721bcfc99d9f890ea069117630260801c5b6000836001602b1b16600f0b131561476b5770010000058b90cf1e6d97f9ca14dbcc16280260801c5b6000836001602a1b16600f0b1315614794577001000002c5c863b73f016468f6bac5ca2b0260801c5b600083600160291b16600f0b13156147bd57700100000162e430e5a18f6119e3c02282a50260801c5b600083600160281b16600f0b13156147e6577001000000b1721835514b86e6d96efd1bfe0260801c5b600083600160271b16600f0b131561480f57700100000058b90c0b48c6be5df846c5b2ef0260801c5b600083600160261b16600f0b13156148385770010000002c5c8601cc6b9e94213c72737a0260801c5b600083600160251b16600f0b1315614861577001000000162e42fff037df38aa2b219f060260801c5b600083600160241b16600f0b131561488a5770010000000b17217fba9c739aa5819f44f90260801c5b600083600160231b16600f0b13156148b3577001000000058b90bfcdee5acd3c1cedc8230260801c5b600083600160221b16600f0b13156148dc57700100000002c5c85fe31f35a6a30da1be500260801c5b600083600160211b16600f0b13156149055770010000000162e42ff0999ce3541b9fffcf0260801c5b600083600160201b16600f0b131561492e57700100000000b17217f80f4ef5aadda455540260801c5b600083638000000016600f0b13156149575770010000000058b90bfbf8479bd5a81b51ad0260801c5b600083634000000016600f0b1315614980577001000000002c5c85fdf84bd62ae30a74cc0260801c5b600083632000000016600f0b13156149a957700100000000162e42fefb2fed257559bdaa0260801c5b600083631000000016600f0b13156149d2577001000000000b17217f7d5a7716bba4a9ae0260801c5b600083630800000016600f0b13156149fb57700100000000058b90bfbe9ddbac5e109cce0260801c5b600083630400000016600f0b1315614a245770010000000002c5c85fdf4b15de6f17eb0d0260801c5b600083630200000016600f0b1315614a4d577001000000000162e42fefa494f1478fde050260801c5b600083630100000016600f0b1315614a765770010000000000b17217f7d20cf927c8e94c0260801c5b6000836280000016600f0b1315614a9e577001000000000058b90bfbe8f71cb4e4b33d0260801c5b6000836240000016600f0b1315614ac657700100000000002c5c85fdf477b662b269450260801c5b6000836220000016600f0b1315614aee5770010000000000162e42fefa3ae53369388c0260801c5b6000836210000016600f0b1315614b1657700100000000000b17217f7d1d351a389d400260801c5b6000836208000016600f0b1315614b3e5770010000000000058b90bfbe8e8b2d3d4ede0260801c5b6000836204000016600f0b1315614b66577001000000000002c5c85fdf4741bea6e77e0260801c5b6000836202000016600f0b1315614b8e57700100000000000162e42fefa39fe95583c20260801c5b6000836201000016600f0b1315614bb55769b17217f7d1cfb72b45e1600160801b010260801c5b60008361800016600f0b1315614bdb576958b90bfbe8e7cc35c3f0600160801b010260801c5b60008361400016600f0b1315614c0157692c5c85fdf473e242ea38600160801b010260801c5b60008361200016600f0b1315614c275769162e42fefa39f02b772c600160801b010260801c5b60008361100016600f0b1315614c4d57690b17217f7d1cf7d83c1a600160801b010260801c5b60008361080016600f0b1315614c735769058b90bfbe8e7bdcbe2e600160801b010260801c5b60008361040016600f0b1315614c99576902c5c85fdf473dea871f600160801b010260801c5b60008361020016600f0b1315614cbf57690162e42fefa39ef44d91600160801b010260801c5b60008361010016600f0b1315614ce45768b17217f7d1cf79e949600160801b010260801c5b600083608016600f0b1315614d08576858b90bfbe8e7bce544600160801b010260801c5b600083604016600f0b1315614d2c57682c5c85fdf473de6eca600160801b010260801c5b600083602016600f0b1315614d505768162e42fefa39ef366f600160801b010260801c5b600083601016600f0b1315614d7457680b17217f7d1cf79afa600160801b010260801c5b600083600816600f0b1315614d985768058b90bfbe8e7bcd6d600160801b010260801c5b600083600416600f0b1315614dbc576802c5c85fdf473de6b2600160801b010260801c5b600083600216600f0b1315614de057680162e42fefa39ef358600160801b010260801c5b600083600116600f0b1315614e035767b17217f7d1cf79ab600160801b010260801c5b600f83810b60401d603f03900b1c60016001607f1b0381111561066757600080fd5b828054614e3190615aaa565b90600052602060002090601f016020900481019282614e535760008555614e99565b82601f10614e6c57805160ff1916838001178555614e99565b82800160010185558215614e99579182015b82811115614e99578251825591602001919060010190614e7e565b50614ea5929150614ea9565b5090565b5b80821115614ea55760008155600101614eaa565b60006001600160401b0380841115614ed857614ed8615b7c565b604051601f8501601f19908116603f01168101908282118183101715614f0057614f00615b7c565b81604052809350858152868686011115614f1957600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112614f43578081fd5b610d7c83833560208501614ebe565b600060208284031215614f63578081fd5b8135610d7c81615b92565b600060208284031215614f7f578081fd5b8151610d7c81615b92565b60008060408385031215614f9c578081fd5b8235614fa781615b92565b91506020830135614fb781615b92565b809150509250929050565b600080600060608486031215614fd6578081fd5b8335614fe181615b92565b92506020840135614ff181615b92565b929592945050506040919091013590565b60008060008060808587031215615017578081fd5b843561502281615b92565b9350602085013561503281615b92565b92506040850135915060608501356001600160401b03811115615053578182fd5b8501601f81018713615063578182fd5b61507287823560208401614ebe565b91505092959194509250565b60008060408385031215615090578182fd5b823561509b81615b92565b91506020830135614fb781615ba7565b600080604083850312156150bd578182fd5b82356150c881615b92565b946020939093013593505050565b6000602082840312156150e7578081fd5b8135610d7c81615ba7565b600060208284031215615103578081fd5b8151610d7c81615ba7565b60006020828403121561511f578081fd5b5035919050565b60008060408385031215615138578182fd5b823591506020830135614fb781615b92565b60006020828403121561515b578081fd5b8135610d7c81615bb5565b600060208284031215615177578081fd5b8151610d7c81615bb5565b600080600080600080600060e0888a03121561519c578485fd5b87356151a781615b92565b965060208801356151b781615b92565b955060408801356151c781615b92565b945060608801356151d781615b92565b93506080880135600381106151ea578384fd5b925060a08801356001600160401b0380821115615205578384fd5b6152118b838c01614f33565b935060c08a0135915080821115615226578283fd5b506152338a828b01614f33565b91505092959891949750929550565b60008060408385031215615254578182fd5b82356001600160401b03811115615269578283fd5b830161010081860312156150c8578283fd5b60006020828403121561528c578081fd5b5051919050565b6000806000806000608086880312156152aa578283fd5b8535945060208601356152bc81615b92565b935060408601356001600160401b03808211156152d7578485fd5b818801915088601f8301126152ea578485fd5b8135818111156152f8578586fd5b896020828501011115615309578586fd5b96999598505060200195606001359392505050565b600080600060608486031215615332578081fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561535e578182fd5b843593506020850135925060408501359150606085013561537e81615ba7565b939692955090935050565b60006020828403121561539a578081fd5b815163ffffffff81168114610d7c578182fd5b6000602082840312156153be578081fd5b815160ff81168114610d7c578182fd5b600081518084526153e6816020860160208601615a67565b601f01601f19169290920160200192915050565b6003811061540a5761540a615b66565b9052565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815461544481615aaa565b8085526020600183811680156154615760018114615475576154a3565b60ff198516888401526040880195506154a3565b866000528260002060005b8581101561549b5781548a8201860152908301908401615480565b890184019650505b505050505092915050565b600081546154bb81615aaa565b600182811680156154d357600181146154e457615513565b60ff19841687528287019450615513565b8560005260208060002060005b8581101561550a5781548a8201529084019082016154f1565b50505082870194505b5050505092915050565b6000825161552f818460208701615a67565b9190910192915050565b6000835161554b818460208801615a67565b83519083019061555f818360208801615a67565b01949350505050565b600061139f61557783866154ae565b846154ae565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516155af816017850160208801615a67565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516155e0816028840160208801615a67565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03878116825286811660208301528516604082015260c06060820181905260009061564e90830186615437565b82810360808401526156608186615437565b91505061405860a08301846153fa565b600060018060a01b03808b168352808a1660208401525087151560408301528660608301528560808301528460a083015260e060c08301526156b660e08301848661540e565b9a9950505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061381f908301846153ce565b6001600160a01b03929092168252602082015260400190565b6020810161066782846153fa565b610100810160048a1061573357615733615b66565b988152602081019790975260408701959095526060860193909352608085019190915260a084015260c083015260e09091015290565b9283526020830191909152604082015260600190565b60208152600061139f60208301848661540e565b602081526000610d7c60208301846153ce565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b92835260208301919091521515604082015260600190565b6000808335601e198436030181126158a6578283fd5b8301803591506001600160401b038211156158bf578283fd5b6020019150368190038213156158d457600080fd5b9250929050565b600082198211156158ee576158ee615b3a565b500190565b60008261590257615902615b50565b500490565b600181815b8085111561594257816000190482111561592857615928615b3a565b8085161561593557918102915b93841c939080029061590c565b509250929050565b6000610d7c838360008261596057506001610667565b8161596d57506000610667565b8160018114615983576002811461598d576159a9565b6001915050610667565b60ff84111561599e5761599e615b3a565b50506001821b610667565b5060208310610133831016604e8410600b84101617156159cc575081810a610667565b6159d68383615907565b80600019048211156159ea576159ea615b3a565b029392505050565b6000816000190483118215151615615a0c57615a0c615b3a565b500290565b60008083128015600160ff1b850184121615615a2f57615a2f615b3a565b6001600160ff1b0384018313811615615a4a57615a4a615b3a565b50500390565b600082821015615a6257615a62615b3a565b500390565b60005b83811015615a82578181015183820152602001615a6a565b838111156115ee5750506000910152565b600081615aa257615aa2615b3a565b506000190190565b600181811c90821680615abe57607f821691505b60208210811415615adf57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615af957615af9615b3a565b5060010190565b600082615b0f57615b0f615b50565b500690565b6000600f82900b60016001607f1b0319811415615b3357615b33615b3a565b9003919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461143c57600080fd5b801515811461143c57600080fd5b6001600160e01b03198116811461143c57600080fdfe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862addf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef7a05a596cb0ce7fdea8a1e1ec73be300bdb35097c944ce1897202f7a13122eb2a2646970667358221220baa27153b0d22f498f336f99213b1321555c64cd4edc99c0e2baac03d5d2708764736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102465760003560e01c806301ffc9a71461024b57806306fdde0314610273578063081812fc14610288578063095ea7b3146102a85780630dfe1681146102bd57806310082c75146102c55780631441a5a9146102cd57806316dc165b146102e057806316f0115b146102f35780631b3979c01461030657806320a6c8ba146103195780632313dd021461033a57806323b872dd14610343578063248a9ca3146103565780632c26d8ee146103695780632f2ff15d1461038a57806330d643b51461039d578063313ce567146103b257806336568abe146103ba57806336ebafe9146103cd5780633c993eee146103f3578063409e22051461040657806342842e0e1461046f57806356799e5f146104825780635a3670931461048a578063617c67191461049d5780636352211e146104b0578063645734e6146104c357806370a08231146104cb57806375794a3c146104de57806379502c55146104e757806391d14854146104fa57806395d89b411461050d5780639d821e0114610515578063a217fddf14610537578063a22cb4651461053f578063b187bd2614610552578063b88d4fde1461055f578063bdfda7c814610572578063c87b56dd1461057a578063c962ca121461058d578063cc04ea4a146105a0578063d21220a7146105a8578063d547741f146105b0578063d6cfef17146105c3578063e63ab1e9146105d6578063e7ec7d35146105eb578063e985e9c514610613578063f136a87414610626578063fabf657a14610649575b600080fd5b61025e61025936600461514a565b61065c565b60405190151581526020015b60405180910390f35b61027b61066d565b60405161026a9190615793565b61029b61029636600461510e565b6106ff565b60405161026a91906155ec565b6102bb6102b63660046150ab565b610726565b005b61027b610841565b61027b6108cf565b600f5461029b906001600160a01b031681565b60105461029b906001600160a01b031681565b600d5461029b906001600160a01b031681565b6102bb610314366004615182565b6108fa565b61032c610327366004614fc2565b610a7e565b60405190815260200161026a565b61032c60095481565b6102bb610351366004614fc2565b610bb4565b61032c61036436600461510e565b610be5565b600f5461037d90600160a01b900460ff1681565b60405161026a9190615710565b6102bb610398366004615126565b610bfa565b61032c600080516020615c0c83398151915281565b61032c610c16565b6102bb6103c8366004615126565b610c9b565b600a546103e090610100900461ffff1681565b60405161ffff909116815260200161026a565b61025e61040136600461531e565b610d19565b61045b61041436600461510e565b6011602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015460ff909616969495939492939192909188565b60405161026a98979695949392919061571e565b6102bb61047d366004614fc2565b610d83565b6102bb610d9e565b6102bb610498366004615349565b610e67565b61032c6104ab366004614f8a565b611235565b61029b6104be36600461510e565b6113a7565b6102bb6113b2565b61032c6104d9366004614f52565b61143f565b61032c60085481565b600e5461029b906001600160a01b031681565b61025e610508366004615126565b6114c5565b61027b6114f0565b610528610523366004615293565b6114ff565b60405161026a93929190615769565b61032c600081565b6102bb61054d36600461507e565b6115b1565b600a5461025e9060ff1681565b6102bb61056d366004615002565b6115bc565b61032c6115f4565b61027b61058836600461510e565b6117fe565b61032c61059b3660046150ab565b611871565b61032c6118a2565b61027b611a5b565b6102bb6105be366004615126565b611a68565b61032c6105d1366004615242565b611a84565b61032c600080516020615bcc83398151915281565b6105fe6105f9366004615242565b61217c565b6040805192835260208301919091520161026a565b61025e610621366004614f8a565b61274b565b61025e610634366004614f52565b60136020526000908152604090205460ff1681565b6102bb610657366004614f52565b612779565b6000610667826127a9565b92915050565b60606001805461067c90615aaa565b80601f01602080910402602001604051908101604052809291908181526020018280546106a890615aaa565b80156106f55780601f106106ca576101008083540402835291602001916106f5565b820191906000526020600020905b8154815290600101906020018083116106d857829003601f168201915b5050505050905090565b600061070a826127ce565b506000908152600560205260409020546001600160a01b031690565b6000610731826127f3565b9050806001600160a01b0316836001600160a01b031614156107a45760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806107c057506107c0813361274b565b6108325760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161079b565b61083c8383612828565b505050565b600b805461084e90615aaa565b80601f016020809104026020016040519081016040528092919081815260200182805461087a90615aaa565b80156108c75780601f1061089c576101008083540402835291602001916108c7565b820191906000526020600020905b8154815290600101906020018083116108aa57829003601f168201915b505050505081565b6060600b600c6040516020016108e6929190615568565b604051602081830303815290604052905090565b600061090581612896565b6010546001600160a01b0316610a3657601080546001600160a01b03808b166001600160a01b031992831617909255600d80548a8416908316179055600e8054898416908316179055600f805492881691831682178155869290916001600160a81b031990911617600160a01b83600281111561099257634e487b7160e01b600052602160045260246000fd5b021790555082516109aa90600b906020860190614e25565b5081516109be90600c906020850190614e25565b506109ca6000336128a0565b600e54600d54601054600f546040517f13d3a1031aba66188cca5785e8045078864e8f69c24715761bf0449ef10304d694610a29946001600160a01b039182169490821693911691600b91600c91600160a01b90910460ff169061561a565b60405180910390a1610a74565b60405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015260640161079b565b5050505050505050565b806000610a8b8585611235565b9050600e60009054906101000a90046001600160a01b03166001600160a01b03166327f7be996040518163ffffffff1660e01b815260040160206040518083038186803b158015610adb57600080fd5b505afa158015610aef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b139190614f6e565b60105460405163037fe71160e41b81526001600160a01b03928316926337fe711092610b4792899290911690600401615600565b60206040518083038186803b158015610b5f57600080fd5b505afa158015610b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b97919061527b565b610ba18284615a50565b610bab9190615a50565b95945050505050565b610bbe33826128aa565b610bda5760405162461bcd60e51b815260040161079b9061582a565b61083c838383612908565b60009081526007602052604090206001015490565b610c0382610be5565b610c0c81612896565b61083c8383612a9d565b6010546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9391906153ad565b60ff16905090565b6001600160a01b0381163314610d0b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161079b565b610d158282612b23565b5050565b6000612710610d2885826158db565b610d3290846159f2565b610d3c91906158f3565b8311158015610d6b5750612710610d538582615a50565b610d5d90846159f2565b610d6791906158f3565b8310155b15610d7857506001610d7c565b5060005b9392505050565b61083c838383604051806020016040528060008152506115bc565b610db6600080516020615bcc833981519152336114c5565b15610dcd57600a805460ff19166001179055610e29565b610dd86000336114c5565b15610df457600a805460ff19811660ff90911615179055610e29565b60405162461bcd60e51b815260206004820152600a60248201526957726f6e6720726f6c6560b01b604482015260640161079b565b600a5460405160ff909116151581527f9422424b175dda897495a07b091ef74a3ef715cf6d866fc972954c1c7f4593049060200160405180910390a1565b600080516020615c0c833981519152610e7f81612896565b610e8885612b8a565b610eba5760405162461bcd60e51b815260206004820152600360248201526204f31360ec1b604482015260640161079b565b60008581526011602052604090206001815460ff166003811115610eee57634e487b7160e01b600052602160045260246000fd5b14610f205760405162461bcd60e51b81526020600482015260026024820152614f3560f01b604482015260640161079b565b6000838015610f325750816001015486115b80610f49575083158015610f495750816001015486105b80610f575750848260050154115b15610f6f57610f6887878787612ba7565b9050611022565b815460ff19166003178255600d54604051636198e33960e01b8152600481018990526001600160a01b0390911690636198e33990602401600060405180830381600087803b158015610fc057600080fd5b505af1158015610fd4573d6000803e3d6000fd5b50505050610fe187612e9a565b867f06b9a7d5e559ec958118dcc25fab116916793fa9782acbf47186bf70bc4cf88e8360040154888760405161101993929190615878565b60405180910390a25b8160060154600960008282546110389190615a50565b9091555050600e5460408051633ca5f63160e11b815290516001600160a01b039092169163794bec6291600480820192602092909190829003018186803b15801561108257600080fd5b505afa158015611096573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ba9190614f6e565b60068301546040516305d7640760e21b81526000600482015260248101919091526001600160a01b03919091169063175d901c90604401600060405180830381600087803b15801561110b57600080fd5b505af115801561111f573d6000803e3d6000fd5b50505050600e60009054906101000a90046001600160a01b03166001600160a01b031663911b171e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561117157600080fd5b505afa158015611185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a99190614f6e565b6001600160a01b0316633a5d92a88360060154836111c79190615a11565b846004015485600601546111db9190615a50565b8a6040518463ffffffff1660e01b81526004016111fa93929190615769565b600060405180830381600087803b15801561121457600080fd5b505af1158015611228573d6000803e3d6000fd5b5050505050505050505050565b600080826001600160a01b0316846001600160a01b03161415801561126257506001600160a01b03841615155b801561127657506001600160a01b0384163b155b1561138857600f5460405163010de89960e21b81526000916001600160a01b03169063ad1b1493908290630437a264906112b4908a906004016155ec565b60206040518083038186803b1580156112cc57600080fd5b505afa1580156112e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130491906153ad565b6040516001600160e01b031960e084901b16815260ff909116600482015260240160206040518083038186803b15801561133d57600080fd5b505afa158015611351573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137591906153ad565b905061138460ff8216836158db565b9150505b600a5461139f908290610100900461ffff166159f2565b949350505050565b6000610667826127f3565b601054600d5460405163095ea7b360e01b81526001600160a01b039283169263095ea7b3926113ea92911690600019906004016156f7565b602060405180830381600087803b15801561140457600080fd5b505af1158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c91906150f2565b50565b60006001600160a01b0382166114a95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161079b565b506001600160a01b031660009081526004602052604090205490565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606002805461067c90615aaa565b600f54604051637d191bdb60e01b8152600091829182918291611593916001600160a01b031690637d191bdb9061153c908b908b9060040161577f565b60206040518083038186803b15801561155457600080fd5b505afa158015611568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158c9190614f6e565b8987610a7e565b905061159f8982612f2f565b919b909a509098509650505050505050565b610d15338383612f77565b6115c633836128aa565b6115e25760405162461bcd60e51b815260040161079b9061582a565b6115ee84848484613042565b50505050565b60006117f9600e60009054906101000a90046001600160a01b03166001600160a01b031663731b7c406040518163ffffffff1660e01b815260040160206040518083038186803b15801561164757600080fd5b505afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167f9190614f6e565b6001600160a01b0316635f64432d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b757600080fd5b505afa1580156116cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ef919061527b565b600e60009054906101000a90046001600160a01b03166001600160a01b031663691aac5f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561173d57600080fd5b505afa158015611751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117759190614f6e565b6001600160a01b031663dec4f15e6009546040518263ffffffff1660e01b81526004016117a491815260200190565b60206040518083038186803b1580156117bc57600080fd5b505afa1580156117d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f4919061527b565b613075565b905090565b6060611809826127ce565b600061182060408051602081019091526000815290565b905060008151116118405760405180602001604052806000815250610d7c565b8061184a8461308b565b60405160200161185b929190615539565b6040516020818303038152906040529392505050565b6012602052816000526040600020818154811061188d57600080fd5b90600052602060002001600091509150505481565b60006117f9600e60009054906101000a90046001600160a01b03166001600160a01b031663731b7c406040518163ffffffff1660e01b815260040160206040518083038186803b1580156118f557600080fd5b505afa158015611909573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192d9190614f6e565b6001600160a01b031663710e595a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561196557600080fd5b505afa158015611979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199d919061527b565b600e60009054906101000a90046001600160a01b03166001600160a01b031663691aac5f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119eb57600080fd5b505afa1580156119ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a239190614f6e565b6001600160a01b031663ceb5fac36040518163ffffffff1660e01b815260040160206040518083038186803b1580156117bc57600080fd5b600c805461084e90615aaa565b611a7182610be5565b611a7a81612896565b61083c8383612b23565b6000600080516020615c0c833981519152611a9e81612896565b6040805161010081018252600181528535602080830191909152860135918101829052606081018290526000916080820190611adc906002906158f3565b8152602001611aef6040880135876158db565b8152608087013560208201526040018590529050611b0b6131a4565b925060126000611b2160c0880160a08901614f52565b6001600160a01b031681526020808201929092526040908101600090812080546001818101835591835284832001879055868252601190935220825181548493839160ff191690836003811115611b8857634e487b7160e01b600052602160045260246000fd5b02179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070155905050611bf28560a0016020810190611bec9190614f52565b846131be565b6000611c28611c0760c0880160a08901614f52565b60808801356020890135611c1e60c08b018b615890565b8b60e001356132ea565b905060008183608001518860800135611c419190615a50565b611c4b9190615a50565b9050611ce9600e60009054906101000a90046001600160a01b03166001600160a01b031663136834366040518163ffffffff1660e01b815260040160206040518083038186803b158015611c9e57600080fd5b505afa158015611cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd69190614f6e565b6010546001600160a01b03169083613599565b600d546060840151608085015160405163edd0d42160e01b81526001600160a01b039093169263edd0d42192611d23928a92600401615769565b600060405180830381600087803b158015611d3d57600080fd5b505af1158015611d51573d6000803e3d6000fd5b505050506000600e60009054906101000a90046001600160a01b03166001600160a01b03166327f7be996040518163ffffffff1660e01b815260040160206040518083038186803b158015611da557600080fd5b505afa158015611db9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddd9190614f6e565b905060006001600160a01b0382166337fe7110611e0060c08c0160a08d01614f52565b6010546040516001600160e01b031960e085901b168152611e2e92916001600160a01b031690600401615600565b60206040518083038186803b158015611e4657600080fd5b505afa158015611e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7e919061527b565b1115611f04576001600160a01b038116633ffc5164611ea360c08b0160a08c01614f52565b6010546040516001600160e01b031960e085901b168152611ed192916001600160a01b031690600401615600565b600060405180830381600087803b158015611eeb57600080fd5b505af1158015611eff573d6000803e3d6000fd5b505050505b600e60009054906101000a90046001600160a01b03166001600160a01b03166395b12ea36040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5257600080fd5b505afa158015611f66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8a9190614f6e565b6001600160a01b031663710b28158730611faa60c08d0160a08e01614f52565b6040516001600160e01b031960e086901b16815260048101939093526001600160a01b039182166024840152166044820152606401600060405180830381600087803b158015611ff957600080fd5b505af115801561200d573d6000803e3d6000fd5b5050505087608001356009600082825461202791906158db565b9091555050600e5460408051633ca5f63160e11b815290516001600160a01b039092169163794bec6291600480820192602092909190829003018186803b15801561207157600080fd5b505afa158015612085573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a99190614f6e565b6040516305d7640760e21b81526001600482015260808a013560248201526001600160a01b03919091169063175d901c90604401600060405180830381600087803b1580156120f757600080fd5b505af115801561210b573d6000803e3d6000fd5b5088925061212291505060c08a0160a08b01614f52565b6001600160a01b03167fe3a07e2ac405f9c908f600ba464ed28dd28f04e308ccc0610a33ca7ed1c59abb848b60800135604051612169929190918252602082015260400190565b60405180910390a3505050505092915050565b6000806101f48311156121b75760405162461bcd60e51b815260206004820152600360248201526213cccd60ea1b604482015260640161079b565b600e60009054906101000a90046001600160a01b03166001600160a01b031663ffd49c846040518163ffffffff1660e01b815260040160206040518083038186803b15801561220557600080fd5b505afa158015612219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223d9190615389565b63ffffffff168460400135101561227c5760405162461bcd60e51b81526020600482015260036024820152624f323160e81b604482015260640161079b565b600e60009054906101000a90046001600160a01b03166001600160a01b03166349b9a67f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156122ca57600080fd5b505afa1580156122de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123029190615389565b63ffffffff16846040013511156123415760405162461bcd60e51b81526020600482015260036024820152624f323560e81b604482015260640161079b565b600e60009054906101000a90046001600160a01b03166001600160a01b03166324ec75906040518163ffffffff1660e01b815260040160206040518083038186803b15801561238f57600080fd5b505afa1580156123a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c7919061527b565b846080013510156124005760405162461bcd60e51b81526020600482015260036024820152624f333560e81b604482015260640161079b565b600a5460ff16156124395760405162461bcd60e51b81526020600482015260036024820152624f333360e81b604482015260640161079b565b6001600f54600160a01b900460ff16600281111561246757634e487b7160e01b600052602160045260246000fd5b14806125755750600e60009054906101000a90046001600160a01b03166001600160a01b0316632677327a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156124bc57600080fd5b505afa1580156124d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f49190614f6e565b6001600160a01b031663f7d52fa185604001356040518263ffffffff1660e01b815260040161252591815260200190565b60206040518083038186803b15801561253d57600080fd5b505afa158015612551573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257591906150f2565b6125a75760405162461bcd60e51b815260206004820152600360248201526204f33360ec1b604482015260640161079b565b60006125b16115f4565b9050600081116125e95760405162461bcd60e51b815260206004820152600360248201526227999b60e91b604482015260640161079b565b6125f7856080013582613075565b915084608001358210156126475761261560808601606087016150d6565b6126475760405162461bcd60e51b81526020600482015260036024820152624f323960e81b604482015260640161079b565b600f546000906126f3906001600160a01b0316637d191bdb61266c60c08a018a615890565b6040518363ffffffff1660e01b815260040161268992919061577f565b60206040518083038186803b1580156126a157600080fd5b505afa1580156126b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d99190614f6e565b6126e960c0890160a08a01614f52565b8860e00135610a7e565b90506000612713612702610c16565b61270d90600a61594a565b83612f2f565b5050905080612720610c16565b61272b90600a61594a565b61273590866159f2565b61273f91906158f3565b94505050509250929050565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b600061278481612896565b506001600160a01b03166000908152601360205260409020805460ff19166001179055565b60006001600160e01b03198216637965db0b60e01b14806106675750610667826135ef565b6127d781612b8a565b61143c5760405162461bcd60e51b815260040161079b906157f8565b6000818152600360205260408120546001600160a01b0316806106675760405162461bcd60e51b815260040161079b906157f8565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061285d826127f3565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61143c813361363f565b610d158282612a9d565b6000806128b6836127f3565b9050806001600160a01b0316846001600160a01b031614806128dd57506128dd818561274b565b8061139f5750836001600160a01b03166128f6846106ff565b6001600160a01b031614949350505050565b826001600160a01b031661291b826127f3565b6001600160a01b03161461297f5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161079b565b6001600160a01b0382166129e15760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161079b565b6129ec8383836136a3565b6129f7600082612828565b6001600160a01b0383166000908152600460205260408120805460019290612a20908490615a50565b90915550506001600160a01b0382166000908152600460205260408120805460019290612a4e9084906158db565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615bec83398151915291a4505050565b612aa782826114c5565b610d155760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612adf3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612b2d82826114c5565b15610d155760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000908152600360205260409020546001600160a01b0316151590565b600084815260116020526040812081612bbf876113a7565b90508482600501541115612ccb576000848015612bdf5750868360010154105b80612bf6575084158015612bf65750868360010154115b15612bff575060015b600e54604051633fbf085d60e21b815282151560048201526305f5e10091612caa916001600160a01b039091169063fefc21749060240160206040518083038186803b158015612c4e57600080fd5b505afa158015612c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c869190615389565b63ffffffff1685600101548a8a8860050154612ca29190615a50565b60018b613757565b8460030154612cb991906159f2565b612cc391906158f3565b935050612cd3565b816003015492505b600d5460038301546040516381b34f1560e01b8152600481018a905230602482015260448101919091526001600160a01b03909116906381b34f1590606401600060405180830381600087803b158015612d2c57600080fd5b505af1158015612d40573d6000803e3d6000fd5b5050601054612d5c92506001600160a01b031690508285613599565b8160030154831015612d9c57600d546003830154612d9c916001600160a01b031690612d89908690615a50565b6010546001600160a01b03169190613599565b81600401548311612def57867fc88c04f82f76cf4112dc206d1a563be25c04a4a762a699eccd4d4abc6df0dff0848460040154612dd99190615a50565b60405190815260200160405180910390a2612e33565b867fa569991d55d525eae5729bac6890aeb7c0bdcd198f36ca0d0a7da8c2c0a734fb836004015485612e219190615a50565b60405190815260200160405180910390a25b612e3c87612e9a565b815460ff1916600217825560405187906001600160a01b038316907ff394088c7503260c927488ca4397d6b43146f13c239078415e6f14029e5cb7f890612e889087908b908a90615878565b60405180910390a35050949350505050565b6000612ea5826127f3565b9050612eb3816000846136a3565b612ebe600083612828565b6001600160a01b0381166000908152600460205260408120805460019290612ee7908490615a50565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020615bec833981519152908390a45050565b60008080612f3e6002866158f3565b9050612f4c84612710615a50565b612f58826127106159f2565b612f6291906158f3565b9250612f6e8184615a50565b91509250925092565b816001600160a01b0316836001600160a01b03161415612fd55760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161079b565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61304d848484612908565b61305984848484613829565b6115ee5760405162461bcd60e51b815260040161079b906157a6565b60008183106130845781610d7c565b5090919050565b6060816130af5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156130d957806130c381615ae5565b91506130d29050600a836158f3565b91506130b3565b6000816001600160401b0381111561310157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561312b576020820181803683370190505b5090505b841561139f57613140600183615a50565b915061314d600a86615b00565b6131589060306158db565b60f81b81838151811061317b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061319d600a866158f3565b945061312f565b60088054600091826131b583615ae5565b91905055905090565b6001600160a01b0382166132145760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161079b565b61321d81612b8a565b156132695760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b604482015260640161079b565b613275600083836136a3565b6001600160a01b038216600090815260046020526040812080546001929061329e9084906158db565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615bec833981519152908290a45050565b600f54604051637d191bdb60e01b815260009182916001600160a01b0390911690637d191bdb90613321908890889060040161577f565b60206040518083038186803b15801561333957600080fd5b505afa15801561334d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133719190614f6e565b9050876001600160a01b0316816001600160a01b03161415801561339d57506001600160a01b03811615155b80156133b157506001600160a01b0381163b155b1561358e57600f5460405163010de89960e21b815260019162989680916001600160a01b0390911690639c5b5a74908290630437a264906133f69088906004016155ec565b60206040518083038186803b15801561340e57600080fd5b505afa158015613422573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061344691906153ad565b6040516001600160e01b031960e084901b16815260ff909116600482015260240160206040518083038186803b15801561347f57600080fd5b505afa158015613493573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134b79190615389565b6134c79063ffffffff168a6159f2565b6134d191906158f3565b9250821561358c576010546134f0906001600160a01b03168385613599565b600061350e6134fd610c16565b61350890600a61594a565b86612f2f565b505090507f4dcf678c034d0e315232ac598af6dbd0ac15f49f05df2c425292d10736d95b368a84848c888e613541610c16565b61354c90600a61594a565b8f8961355891906159f2565b61356291906158f3565b61356c9190615a50565b8d8d604051613582989796959493929190615670565b60405180910390a1505b505b509695505050505050565b61083c8363a9059cbb60e01b84846040516024016135b89291906156f7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261393d565b60006001600160e01b031982166380ac58cd60e01b148061362057506001600160e01b03198216635b5e139f60e01b145b8061066757506301ffc9a760e01b6001600160e01b0319831614610667565b61364982826114c5565b610d1557613661816001600160a01b03166014613a0f565b61366c836020613a0f565b60405160200161367d92919061557d565b60408051601f198184030181529082905262461bcd60e51b825261079b91600401615793565b6001600160a01b038316158015906136c357506001600160a01b03821615155b80156136e857506001600160a01b03821660009081526013602052604090205460ff16155b801561370d57506001600160a01b03831660009081526013602052604090205460ff16155b1561083c5760405162461bcd60e51b815260206004820152601a602482015279151bdad95b881d1c985b9cd9995c881b9bdd08185b1b1bddd95960321b604482015260640161079b565b6000806137676305f5e100613bf0565b90506000613776612710613bf0565b90506000613790826137878c613bf0565b600f0b90613c0d565b905060006137a2600f83900b83613c74565b905060006137b3856137878d613bf0565b905060006137c4866137878d613bf0565b905060006137e16137d86301e13380613bf0565b6137878d613bf0565b905060006137f3858585858f8f613caa565b905061380b613806600f83900b8a613c74565b613d81565b6001600160401b0316985050505050505050505b9695505050505050565b600061383d846001600160a01b0316613d9d565b1561393257604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906138749033908990889088906004016156c4565b602060405180830381600087803b15801561388e57600080fd5b505af19250505080156138be575060408051601f3d908101601f191682019092526138bb91810190615166565b60015b613918573d8080156138ec576040519150601f19603f3d011682016040523d82523d6000602084013e6138f1565b606091505b5080516139105760405162461bcd60e51b815260040161079b906157a6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061139f565b506001949350505050565b6000613992826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613dac9092919063ffffffff16565b80519091501561083c57808060200190518101906139b091906150f2565b61083c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161079b565b60606000613a1e8360026159f2565b613a299060026158db565b6001600160401b03811115613a4e57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613a78576020820181803683370190505b509050600360fc1b81600081518110613aa157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613ade57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613b028460026159f2565b613b0d9060016158db565b90505b6001811115613ba1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613b4f57634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613b7357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613b9a81615a93565b9050613b10565b508315610d7c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161079b565b600060016001603f1b03821115613c0657600080fd5b5060401b90565b600081600f0b60001415613c2057600080fd5b600082600f0b604085600f0b901b81613c4957634e487b7160e01b600052601260045260246000fd5b05905060016001607f1b03198112801590613c6b575060016001607f1b038113155b610d7c57600080fd5b6000600f83810b9083900b0260401d60016001607f1b03198112801590613c6b575060016001607f1b03811315610d7c57600080fd5b600080613cbb600f86900b89613c74565b90506000613ccb82600f0b613dbb565b90506000613d0882613787600186600f0b901d613cff613cf78e8e600f0b613c0d90919063ffffffff16565b600f0b613ddd565b600f0b90613e17565b90506000613d1a600f83900b84613e4a565b90508615613d4d578515613d3c57613d3181613e7d565b94505050505061381f565b613d31613d4882615b14565b613e7d565b8515613d7257613d31613d5f82613e7d565b613d696001613bf0565b600f0b90613e4a565b613d31613d5f613d4883615b14565b60008082600f0b1215613d9357600080fd5b50600f0b60401d90565b6001600160a01b03163b151590565b606061139f8484600085613f34565b60008082600f0b1215613dcd57600080fd5b610667604083600f0b901b614063565b60008082600f0b13613dee57600080fd5b6080613df983614240565b600f0b6fb17217f7d1cf79abc9e3b39803f2f6af02901c9050919050565b6000600f83810b9083900b0160016001607f1b03198112801590613c6b575060016001607f1b03811315610d7c57600080fd5b6000600f82810b9084900b0360016001607f1b03198112801590613c6b575060016001607f1b03811315610d7c57600080fd5b600080613e8e600f84900b84613c74565b90506000613f13613ef8613ec7613eb8613eb0600f87900b600360401b613e17565b600f0b613dbb565b67d3c84b78b749bd6b90613c74565b613cff613ee9613ed989600f0b61431a565b68019abac0ea1da6503690613c74565b679109f285df45239490613e17565b6137876001613f0686615b14565b600f0b901d600f0b61434d565b9050600084600f0b13613f26578061139f565b61139f600160401b82613e4a565b606082471015613f955760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161079b565b613f9e85613d9d565b613fea5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161079b565b600080866001600160a01b03168587604051614006919061551d565b60006040518083038185875af1925050503d8060008114614043576040519150601f19603f3d011682016040523d82523d6000602084013e614048565b606091505b50915091506140588282866143a0565b979650505050505050565b60008161407257506000919050565b816001600160801b821061408b5760809190911c9060401b5b600160401b82106140a15760409190911c9060201b5b600160201b82106140b75760209190911c9060101b5b6201000082106140cc5760109190911c9060081b5b61010082106140e05760089190911c9060041b5b601082106140f35760049190911c9060021b5b600882106140ff5760011b5b600181858161411e57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161414457634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161416a57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161419057634e487b7160e01b600052601260045260246000fd5b048201901c905060018185816141b657634e487b7160e01b600052601260045260246000fd5b048201901c905060018185816141dc57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181858161420257634e487b7160e01b600052601260045260246000fd5b048201901c9050600081858161422857634e487b7160e01b600052601260045260246000fd5b0490508082106142385780610bab565b509392505050565b60008082600f0b1361425157600080fd5b6000600f83900b600160401b811261426b576040918201911d5b600160201b811261427e576020918201911d5b620100008112614290576010918201911d5b61010081126142a1576008918201911d5b601081126142b1576004918201911d5b600481126142c1576002918201911d5b600281126142d0576001820191505b603f19820160401b600f85900b607f8490031b6001603f1b5b600081131561430f5790800260ff81901c8281029390930192607f011c9060011d6142e9565b509095945050505050565b6000600f82900b60016001607f1b0319141561433557600080fd5b600082600f0b126143465781610667565b5060000390565b6000600160461b82600f0b1261436257600080fd5b6001600160461b031982600f0b121561437d57506000919050565b610667608083600f0b700171547652b82fe1777d0ffda0d23a7d1202901d6143d9565b606083156143af575081610d7c565b8251156143bf5782518084602001fd5b8160405162461bcd60e51b815260040161079b9190615793565b6000600160461b82600f0b126143ee57600080fd5b6001600160461b031982600f0b121561440957506000919050565b6001607f1b60006001603f1b8416600f0b13156144375770016a09e667f3bcc908b2fb1366ea957d3e0260801c5b6000836001603e1b16600f0b1315614460577001306fe0a31b7152de8d5a46305c85edec0260801c5b6000836001603d1b16600f0b1315614489577001172b83c7d517adcdf7c8c50eb14a791f0260801c5b6000836001603c1b16600f0b13156144b25770010b5586cf9890f6298b92b71842a983630260801c5b6000836001603b1b16600f0b13156144db577001059b0d31585743ae7c548eb68ca417fd0260801c5b6000836001603a1b16600f0b131561450457700102c9a3e778060ee6f7caca4f7a29bde80260801c5b600083600160391b16600f0b131561452d5770010163da9fb33356d84a66ae336dcdfa3f0260801c5b600083600160381b16600f0b131561455657700100b1afa5abcbed6129ab13ec11dc95430260801c5b600083600160371b16600f0b131561457f5770010058c86da1c09ea1ff19d294cf2f679b0260801c5b600083600160361b16600f0b13156145a8577001002c605e2e8cec506d21bfc89a23a00f0260801c5b600083600160351b16600f0b13156145d157700100162f3904051fa128bca9c55c31e5df0260801c5b600083600160341b16600f0b13156145fa577001000b175effdc76ba38e31671ca9397250260801c5b600083600160331b16600f0b131561462357700100058ba01fb9f96d6cacd4b180917c3d0260801c5b600083600160321b16600f0b131561464c5770010002c5cc37da9491d0985c348c68e7b30260801c5b600083600160311b16600f0b1315614675577001000162e525ee054754457d59952920260260801c5b600083600160301b16600f0b131561469e5770010000b17255775c040618bf4a4ade83fc0260801c5b6000836001602f1b16600f0b13156146c7577001000058b91b5bc9ae2eed81e9b7d4cfab0260801c5b6000836001602e1b16600f0b13156146f057700100002c5c89d5ec6ca4d7c8acc017b7c90260801c5b6000836001602d1b16600f0b13156147195770010000162e43f4f831060e02d839a9d16d0260801c5b6000836001602c1b16600f0b131561474257700100000b1721bcfc99d9f890ea069117630260801c5b6000836001602b1b16600f0b131561476b5770010000058b90cf1e6d97f9ca14dbcc16280260801c5b6000836001602a1b16600f0b1315614794577001000002c5c863b73f016468f6bac5ca2b0260801c5b600083600160291b16600f0b13156147bd57700100000162e430e5a18f6119e3c02282a50260801c5b600083600160281b16600f0b13156147e6577001000000b1721835514b86e6d96efd1bfe0260801c5b600083600160271b16600f0b131561480f57700100000058b90c0b48c6be5df846c5b2ef0260801c5b600083600160261b16600f0b13156148385770010000002c5c8601cc6b9e94213c72737a0260801c5b600083600160251b16600f0b1315614861577001000000162e42fff037df38aa2b219f060260801c5b600083600160241b16600f0b131561488a5770010000000b17217fba9c739aa5819f44f90260801c5b600083600160231b16600f0b13156148b3577001000000058b90bfcdee5acd3c1cedc8230260801c5b600083600160221b16600f0b13156148dc57700100000002c5c85fe31f35a6a30da1be500260801c5b600083600160211b16600f0b13156149055770010000000162e42ff0999ce3541b9fffcf0260801c5b600083600160201b16600f0b131561492e57700100000000b17217f80f4ef5aadda455540260801c5b600083638000000016600f0b13156149575770010000000058b90bfbf8479bd5a81b51ad0260801c5b600083634000000016600f0b1315614980577001000000002c5c85fdf84bd62ae30a74cc0260801c5b600083632000000016600f0b13156149a957700100000000162e42fefb2fed257559bdaa0260801c5b600083631000000016600f0b13156149d2577001000000000b17217f7d5a7716bba4a9ae0260801c5b600083630800000016600f0b13156149fb57700100000000058b90bfbe9ddbac5e109cce0260801c5b600083630400000016600f0b1315614a245770010000000002c5c85fdf4b15de6f17eb0d0260801c5b600083630200000016600f0b1315614a4d577001000000000162e42fefa494f1478fde050260801c5b600083630100000016600f0b1315614a765770010000000000b17217f7d20cf927c8e94c0260801c5b6000836280000016600f0b1315614a9e577001000000000058b90bfbe8f71cb4e4b33d0260801c5b6000836240000016600f0b1315614ac657700100000000002c5c85fdf477b662b269450260801c5b6000836220000016600f0b1315614aee5770010000000000162e42fefa3ae53369388c0260801c5b6000836210000016600f0b1315614b1657700100000000000b17217f7d1d351a389d400260801c5b6000836208000016600f0b1315614b3e5770010000000000058b90bfbe8e8b2d3d4ede0260801c5b6000836204000016600f0b1315614b66577001000000000002c5c85fdf4741bea6e77e0260801c5b6000836202000016600f0b1315614b8e57700100000000000162e42fefa39fe95583c20260801c5b6000836201000016600f0b1315614bb55769b17217f7d1cfb72b45e1600160801b010260801c5b60008361800016600f0b1315614bdb576958b90bfbe8e7cc35c3f0600160801b010260801c5b60008361400016600f0b1315614c0157692c5c85fdf473e242ea38600160801b010260801c5b60008361200016600f0b1315614c275769162e42fefa39f02b772c600160801b010260801c5b60008361100016600f0b1315614c4d57690b17217f7d1cf7d83c1a600160801b010260801c5b60008361080016600f0b1315614c735769058b90bfbe8e7bdcbe2e600160801b010260801c5b60008361040016600f0b1315614c99576902c5c85fdf473dea871f600160801b010260801c5b60008361020016600f0b1315614cbf57690162e42fefa39ef44d91600160801b010260801c5b60008361010016600f0b1315614ce45768b17217f7d1cf79e949600160801b010260801c5b600083608016600f0b1315614d08576858b90bfbe8e7bce544600160801b010260801c5b600083604016600f0b1315614d2c57682c5c85fdf473de6eca600160801b010260801c5b600083602016600f0b1315614d505768162e42fefa39ef366f600160801b010260801c5b600083601016600f0b1315614d7457680b17217f7d1cf79afa600160801b010260801c5b600083600816600f0b1315614d985768058b90bfbe8e7bcd6d600160801b010260801c5b600083600416600f0b1315614dbc576802c5c85fdf473de6b2600160801b010260801c5b600083600216600f0b1315614de057680162e42fefa39ef358600160801b010260801c5b600083600116600f0b1315614e035767b17217f7d1cf79ab600160801b010260801c5b600f83810b60401d603f03900b1c60016001607f1b0381111561066757600080fd5b828054614e3190615aaa565b90600052602060002090601f016020900481019282614e535760008555614e99565b82601f10614e6c57805160ff1916838001178555614e99565b82800160010185558215614e99579182015b82811115614e99578251825591602001919060010190614e7e565b50614ea5929150614ea9565b5090565b5b80821115614ea55760008155600101614eaa565b60006001600160401b0380841115614ed857614ed8615b7c565b604051601f8501601f19908116603f01168101908282118183101715614f0057614f00615b7c565b81604052809350858152868686011115614f1957600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112614f43578081fd5b610d7c83833560208501614ebe565b600060208284031215614f63578081fd5b8135610d7c81615b92565b600060208284031215614f7f578081fd5b8151610d7c81615b92565b60008060408385031215614f9c578081fd5b8235614fa781615b92565b91506020830135614fb781615b92565b809150509250929050565b600080600060608486031215614fd6578081fd5b8335614fe181615b92565b92506020840135614ff181615b92565b929592945050506040919091013590565b60008060008060808587031215615017578081fd5b843561502281615b92565b9350602085013561503281615b92565b92506040850135915060608501356001600160401b03811115615053578182fd5b8501601f81018713615063578182fd5b61507287823560208401614ebe565b91505092959194509250565b60008060408385031215615090578182fd5b823561509b81615b92565b91506020830135614fb781615ba7565b600080604083850312156150bd578182fd5b82356150c881615b92565b946020939093013593505050565b6000602082840312156150e7578081fd5b8135610d7c81615ba7565b600060208284031215615103578081fd5b8151610d7c81615ba7565b60006020828403121561511f578081fd5b5035919050565b60008060408385031215615138578182fd5b823591506020830135614fb781615b92565b60006020828403121561515b578081fd5b8135610d7c81615bb5565b600060208284031215615177578081fd5b8151610d7c81615bb5565b600080600080600080600060e0888a03121561519c578485fd5b87356151a781615b92565b965060208801356151b781615b92565b955060408801356151c781615b92565b945060608801356151d781615b92565b93506080880135600381106151ea578384fd5b925060a08801356001600160401b0380821115615205578384fd5b6152118b838c01614f33565b935060c08a0135915080821115615226578283fd5b506152338a828b01614f33565b91505092959891949750929550565b60008060408385031215615254578182fd5b82356001600160401b03811115615269578283fd5b830161010081860312156150c8578283fd5b60006020828403121561528c578081fd5b5051919050565b6000806000806000608086880312156152aa578283fd5b8535945060208601356152bc81615b92565b935060408601356001600160401b03808211156152d7578485fd5b818801915088601f8301126152ea578485fd5b8135818111156152f8578586fd5b896020828501011115615309578586fd5b96999598505060200195606001359392505050565b600080600060608486031215615332578081fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561535e578182fd5b843593506020850135925060408501359150606085013561537e81615ba7565b939692955090935050565b60006020828403121561539a578081fd5b815163ffffffff81168114610d7c578182fd5b6000602082840312156153be578081fd5b815160ff81168114610d7c578182fd5b600081518084526153e6816020860160208601615a67565b601f01601f19169290920160200192915050565b6003811061540a5761540a615b66565b9052565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815461544481615aaa565b8085526020600183811680156154615760018114615475576154a3565b60ff198516888401526040880195506154a3565b866000528260002060005b8581101561549b5781548a8201860152908301908401615480565b890184019650505b505050505092915050565b600081546154bb81615aaa565b600182811680156154d357600181146154e457615513565b60ff19841687528287019450615513565b8560005260208060002060005b8581101561550a5781548a8201529084019082016154f1565b50505082870194505b5050505092915050565b6000825161552f818460208701615a67565b9190910192915050565b6000835161554b818460208801615a67565b83519083019061555f818360208801615a67565b01949350505050565b600061139f61557783866154ae565b846154ae565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516155af816017850160208801615a67565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516155e0816028840160208801615a67565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03878116825286811660208301528516604082015260c06060820181905260009061564e90830186615437565b82810360808401526156608186615437565b91505061405860a08301846153fa565b600060018060a01b03808b168352808a1660208401525087151560408301528660608301528560808301528460a083015260e060c08301526156b660e08301848661540e565b9a9950505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061381f908301846153ce565b6001600160a01b03929092168252602082015260400190565b6020810161066782846153fa565b610100810160048a1061573357615733615b66565b988152602081019790975260408701959095526060860193909352608085019190915260a084015260c083015260e09091015290565b9283526020830191909152604082015260600190565b60208152600061139f60208301848661540e565b602081526000610d7c60208301846153ce565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b92835260208301919091521515604082015260600190565b6000808335601e198436030181126158a6578283fd5b8301803591506001600160401b038211156158bf578283fd5b6020019150368190038213156158d457600080fd5b9250929050565b600082198211156158ee576158ee615b3a565b500190565b60008261590257615902615b50565b500490565b600181815b8085111561594257816000190482111561592857615928615b3a565b8085161561593557918102915b93841c939080029061590c565b509250929050565b6000610d7c838360008261596057506001610667565b8161596d57506000610667565b8160018114615983576002811461598d576159a9565b6001915050610667565b60ff84111561599e5761599e615b3a565b50506001821b610667565b5060208310610133831016604e8410600b84101617156159cc575081810a610667565b6159d68383615907565b80600019048211156159ea576159ea615b3a565b029392505050565b6000816000190483118215151615615a0c57615a0c615b3a565b500290565b60008083128015600160ff1b850184121615615a2f57615a2f615b3a565b6001600160ff1b0384018313811615615a4a57615a4a615b3a565b50500390565b600082821015615a6257615a62615b3a565b500390565b60005b83811015615a82578181015183820152602001615a6a565b838111156115ee5750506000910152565b600081615aa257615aa2615b3a565b506000190190565b600181811c90821680615abe57607f821691505b60208210811415615adf57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615af957615af9615b3a565b5060010190565b600082615b0f57615b0f615b50565b500690565b6000600f82900b60016001607f1b0319811415615b3357615b33615b3a565b9003919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461143c57600080fd5b801515811461143c57600080fd5b6001600160e01b03198116811461143c57600080fdfe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862addf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef7a05a596cb0ce7fdea8a1e1ec73be300bdb35097c944ce1897202f7a13122eb2a2646970667358221220baa27153b0d22f498f336f99213b1321555c64cd4edc99c0e2baac03d5d2708764736f6c63430008040033

Loading