false
false
The Sokol Testnet is currently lacking validators. Please consider using Goerli or Mumbai for testing purposes.

Contract Address Details
contract

0x2076224734Fd79CBa3FaCcbA6778CD71DAebbf60

Contract Name
LP
Creator
0x2c33fe–5584a1 at 0xb928f7–061d5e
Balance
0 SPOA
Tokens
Fetching tokens...
Transactions
1 Transactions
Transfers
0 Transfers
Gas Used
207,483
Last Balance Update
27655401
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
LP




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
2
EVM Version
istanbul




Verified at
2022-08-12T15:54:54.762364Z

contracts/LP.sol

Sol2uml
new
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.4;

import "@uniswap/lib/contracts/libraries/TransferHelper.sol";
import "./interface/ILP.sol";
import "./interface/ICore.sol";
import "./interface/IWNative.sol";
import "./interface/IAzuroBet.sol";
import "./utils/LiquidityTree.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";

/// @title Azuro liquidity pool
contract LP is
    LiquidityTree,
    OwnableUpgradeable,
    ERC721EnumerableUpgradeable,
    ILP
{
    uint128 public lockedLiquidity; // liquidity reserved by conditions (initial reinforcement)
    uint128 public totalDaoRewards; // deprecated DAO profit counter

    uint128 public oracleFee;
    uint128 public daoFee;

    uint128 public reinforcementAbility; // should be 50%
    uint64 public multiplier;
    address public token;
    ICore public core;
    IAzuroBet public azuroBet;

    uint128 public minDepo; // minimum deposit amount
    uint64 public withdrawTimeout; // Deposit - Withdraw Timeout

    mapping(uint48 => uint64) public withdrawals; // withdrawals[depNum] = withdrawal time

    // DAO profit and loss counter
    int128 public realDaoRewards;

    // ORACLE profit and loss counter
    int128 public realOracleRewards;

    // Reward claim Timeout
    uint64 public claimTimeout;

    // last claim
    uint64 public lastClaimDao;
    uint64 public lastClaimOracle;

    /**
     * @notice Only permits calls if the deadline is not yet due.
     * @param  deadline time after which the call is not allowed
     */
    modifier ensure(uint256 deadline) {
        if (block.timestamp >= deadline) revert ConditionStarted();
        _;
    }

    /**
     * @notice Only permits calls by Core.
     */
    modifier onlyCore() {
        if (msg.sender != address(core)) revert OnlyCore();
        _;
    }

    receive() external payable {
        assert(msg.sender == token); // only accept native tokens via fallback from the WETH contract
    }

    /**
     * @notice Owner: Set `newCore` as Core address.
     * @param  newCore new Core contract address
     */
    function changeCore(address newCore) external override onlyOwner {
        if (address(core) != address(0) && core.getLockedPayout() != 0)
            revert PaymentLocked();

        core = ICore(newCore);
    }

    /**
     * @notice Owner: Set `newOracleFee` as oracles fee.
     */
    function changeOracleReward(uint128 newOracleFee) external onlyOwner {
        oracleFee = newOracleFee;
        emit OracleRewardChanged(newOracleFee);
    }

    /**
     * @notice Owner: Set `newDaoFee` as DAO fee.
     */
    function changeDaoReward(uint128 newDaoFee) external onlyOwner {
        daoFee = newDaoFee;
        emit DaoRewardChanged(newDaoFee);
    }

    /**
     * @notice Owner: Set `newAzuroBet` as AzuroBet address.
     * @param  newAzuroBet new AzuroBet contract address
     */
    function changeAzuroBet(address newAzuroBet) external onlyOwner {
        azuroBet = IAzuroBet(newAzuroBet);
        emit AzuroBetChanged(newAzuroBet);
    }

    /**
     * @notice Owner: Set `minDepo` as newMinDepo value.
     * @param  newMinDepo new minDepo value
     */
    function changeMinDepo(uint128 newMinDepo) external onlyOwner {
        minDepo = newMinDepo;
        emit MinDepoChanged(newMinDepo);
    }

    function changeReinforcementAbility(uint128 newReinforcementAbility)
        external
        onlyOwner
    {
        reinforcementAbility = newReinforcementAbility;
        emit ReinforcementAbilityChanged(newReinforcementAbility);
    }

    /**
     * @notice Owner: Set `withdrawTimeout` as newWithdrawTimeout value.
     * @param  newWithdrawTimeout new withdrawTimeout value
     */
    function changeWithdrawTimeout(uint64 newWithdrawTimeout)
        external
        onlyOwner
    {
        withdrawTimeout = newWithdrawTimeout;
        emit WithdrawTimeoutChanged(newWithdrawTimeout);
    }

    /**
     * @notice Owner: Set `claimTimeout` as newClaimTimeout value.
     * @param  newClaimTimeout new claimTimeout value
     */
    function changeClaimTimeout(uint64 newClaimTimeout) external onlyOwner {
        claimTimeout = newClaimTimeout;
        emit ClaimTimeoutChanged(newClaimTimeout);
    }

    function initialize(address token_, address azuroBetAddress)
        external
        virtual
        initializer
    {
        if (token_ == address(0)) revert WrongToken();
        __Ownable_init_unchained();
        __ERC721_init("Azuro LP NFT token", "LP-AZR");
        __liquidityTree_init();
        token = token_;
        azuroBet = IAzuroBet(azuroBetAddress);
        multiplier = 1e9;
        oracleFee = 1e7; // 1%
        daoFee = 9 * 1e7; // 9%
        reinforcementAbility = multiplier / 2; // 50%
    }

    /**
     * @notice Add some liquidity in pool in exchange for LPNFT tokens
     * @param  amount token's amount to swap
     */
    function addLiquidity(uint128 amount) external override {
        TransferHelper.safeTransferFrom(
            token,
            msg.sender,
            address(this),
            amount
        );
        _addLiquidity(amount);
    }

    /**
     * @notice Add some liquidity in pool sending native tokens with msg.value in exchange for LPNFT tokens
     */
    function addLiquidityNative() external payable override {
        IWNative(token).deposit{value: msg.value}();
        _addLiquidity(uint128(msg.value));
    }

    /**
     * @notice Add some liquidity in pool in exchange for LPNFT tokens
     * @param  amount token's amount to swap
     */
    function _addLiquidity(uint128 amount) internal {
        if (amount < minDepo) revert AmountNotSufficient();

        uint48 leaf = nodeAddLiquidity(amount);

        // make NFT
        _mint(msg.sender, leaf);
        withdrawals[leaf] = uint64(block.timestamp);
        emit LiquidityAdded(msg.sender, amount, leaf);
    }

    /**
     * @notice Withdraw liquidity for some NFT deposite #.
     * @param depNum - NFT with deposite number
     * @param percent - percent of leaf amount 1*10^12 is 100%, 5*10^11 is 50%
     */
    function withdrawLiquidity(uint48 depNum, uint40 percent)
        external
        override
    {
        uint128 withdrawValue = _withdrawLiquidity(depNum, percent);
        TransferHelper.safeTransfer(token, msg.sender, withdrawValue);
    }

    /**
     * @notice Withdraw liquidity for some NFT deposite #.
     * @param depNum - NFT with deposite number
     * @param percent - percent of leaf amount 1*10^12 is 100%, 5*10^11 is 50%
     */
    function withdrawLiquidityNative(uint48 depNum, uint40 percent)
        external
        override
    {
        uint128 withdrawValue = _withdrawLiquidity(depNum, percent);
        IWNative(token).withdraw(withdrawValue);
        TransferHelper.safeTransferETH(msg.sender, withdrawValue);
    }

    /**
     * @notice Withdraw liquidity for some NFT deposite #.
     * @param depNum - NFT with deposite number
     * @param percent - percent of leaf amount 1*10^12 is 100%, 5*10^11 is 50%
     */
    function _withdrawLiquidity(uint48 depNum, uint40 percent)
        internal
        returns (uint128 withdrawValue)
    {
        uint64 _time = uint64(block.timestamp);
        uint64 _withdrawTime = withdrawals[depNum] + withdrawTimeout;
        if (_time < _withdrawTime)
            revert WithdrawalTimeout(_withdrawTime - _time);
        if (msg.sender != ownerOf(depNum)) revert LiquidityNotOwned();

        withdrawals[depNum] = _time;
        uint128 topNodeAmount = treeNode[1].amount;

        // reduce liquidity tree by percent
        withdrawValue = nodeWithdrawPercent(depNum, percent);

        if (withdrawValue == 0) revert NoLiquidity();

        // check withdrawValue allowed in ("node #1" - "active condition reinforcements")
        if (withdrawValue > (topNodeAmount - lockedLiquidity))
            revert LiquidityIsLocked();
        emit LiquidityRemoved(msg.sender, depNum, withdrawValue);
    }

    /**
     * @notice Call Core to get AzuroBet token `tokenId` payout.
     * @param  tokenId AzuroBet token ID
     * @return if the payout is successfully resolved
     * @return the amount of winnings of the owner of the token
     */
    function viewPayout(uint256 tokenId)
        external
        view
        override
        returns (bool, uint128)
    {
        return (ICore(azuroBet.getCoreByToken(tokenId)).viewPayout(tokenId));
    }

    /**
     * @notice Withdraw payout based on bet with AzuroBet token `tokenId` in finished or cancelled condition.
     * @param  tokenId AzuroBet token ID withdraw payout to
     */
    function withdrawPayout(uint256 tokenId) external override {
        uint128 amount = _withdrawPayout(tokenId);
        TransferHelper.safeTransfer(token, msg.sender, amount);
    }

    /**
     * @notice Withdraw payout based on bet with AzuroBet token `tokenId` in finished or cancelled condition.
     * @param  tokenId AzuroBet token ID withdraw payout to
     */
    function withdrawPayoutNative(uint256 tokenId) external override {
        uint128 amount = _withdrawPayout(tokenId);
        IWNative(token).withdraw(amount);
        TransferHelper.safeTransferETH(msg.sender, amount);
    }

    /**
     * @notice Withdraw payout based on bet with AzuroBet token `tokenId` in finished or cancelled condition.
     * @param  tokenId AzuroBet token ID withdraw payout to
     */
    function _withdrawPayout(uint256 tokenId) internal returns (uint128) {
        if (azuroBet.ownerOf(tokenId) != msg.sender) revert OnlyBetOwner();

        (bool success, uint128 amount) = ICore(azuroBet.getCoreByToken(tokenId))
            .resolvePayout(tokenId);

        if (!success) revert NoWinNoPrize();

        emit BetterWin(msg.sender, tokenId, amount);

        return amount;
    }

    /**
     * @notice Reward contract owner (DAO) with total amount of charged fees.
     */
    function claimDaoReward() external {
        // if totalDaoRewards - move it to realDaoRewards
        if (totalDaoRewards > 0) {
            realDaoRewards += int128(totalDaoRewards);
            totalDaoRewards = 0;
        }

        if (realDaoRewards <= 0) revert NoDaoReward();
        if ((block.timestamp - lastClaimDao) < claimTimeout)
            revert ClaimTimeout(lastClaimDao + claimTimeout);

        TransferHelper.safeTransfer(token, owner(), uint128(realDaoRewards));
        realDaoRewards = 0;
        lastClaimDao = uint64(block.timestamp);
    }

    /**
     * @notice Reward contract Oracle with total amount of charged fees.
     */
    function claimOracleReward(address oracle) external override onlyCore {
        if (realOracleRewards <= 0) revert NoOracleReward();

        if ((block.timestamp - lastClaimOracle) < claimTimeout)
            revert ClaimTimeout(lastClaimOracle + claimTimeout);

        TransferHelper.safeTransfer(token, oracle, uint128(realOracleRewards));
        realOracleRewards = 0;
        lastClaimOracle = uint64(block.timestamp);
    }

    /**
     * @notice Make new bet in exchange of AzuroBet token for bettor
     * @param  bettor wallet to bet for
     * @param  conditionId the match or game ID
     * @param  amount amount of tokens to bet
     * @param  outcomeId ID of predicted outcome
     * @param  deadline the time before which bet should be made
     * @param  minOdds minimum allowed bet odds
     * @return tokenId ID of bet's AzuroBet token.
     */

    function betFor(
        address bettor,
        uint256 conditionId,
        uint128 amount,
        uint64 outcomeId,
        uint64 deadline,
        uint64 minOdds
    ) external override returns (uint256) {
        TransferHelper.safeTransferFrom(
            token,
            msg.sender,
            address(this),
            amount
        );
        return _bet(bettor, conditionId, amount, outcomeId, deadline, minOdds);
    }

    /**
     * @notice Make new bet in exchange of AzuroBet token.
     * @param  conditionId the match or game ID
     * @param  amount amount of tokens to bet
     * @param  outcomeId ID of predicted outcome
     * @param  deadline the time before which bet should be made
     * @param  minOdds minimum allowed bet odds
     * @return tokenId ID of bet's AzuroBet token.
     */
    function bet(
        uint256 conditionId,
        uint128 amount,
        uint64 outcomeId,
        uint64 deadline,
        uint64 minOdds
    ) external override returns (uint256) {
        TransferHelper.safeTransferFrom(
            token,
            msg.sender,
            address(this),
            amount
        );
        return
            _bet(msg.sender, conditionId, amount, outcomeId, deadline, minOdds);
    }

    /**
     * @notice Make new bet in exchange of AzuroBet token.
     * @param  conditionId the match or game ID
     * @param  outcomeId ID of predicted outcome
     * @param  deadline the time before which bet should be made
     * @param  minOdds minimum allowed bet odds
     * @return tokenId ID of bet's AzuroBet token.
     */
    function betNative(
        uint256 conditionId,
        uint64 outcomeId,
        uint64 deadline,
        uint64 minOdds
    ) external payable override returns (uint256) {
        IWNative(token).deposit{value: msg.value}();
        return
            _bet(
                msg.sender,
                conditionId,
                uint128(msg.value),
                outcomeId,
                deadline,
                minOdds
            );
    }

    /**
     * @notice Make new bet in exchange of AzuroBet token.
     * @param  conditionId the match or game ID
     * @param  amount amount of tokens to bet
     * @param  outcomeId ID of predicted outcome
     * @param  deadline the time before which bet should be made
     * @param  minOdds minimum allowed bet odds
     * @return ID of bet's AzuroBet token.
     */
    function _bet(
        address bettor,
        uint256 conditionId,
        uint128 amount,
        uint64 outcomeId,
        uint64 deadline,
        uint64 minOdds
    ) internal ensure(deadline) returns (uint256) {
        if (amount == 0) revert AmountMustNotBeZero();

        azuroBet.mint(bettor, address(core));
        uint256 tokenId = azuroBet.totalSupply();

        (uint256 odds, uint128 fund1, uint128 fund2) = core.putBet(
            conditionId,
            tokenId,
            amount,
            outcomeId,
            minOdds
        );
        emit NewBet(
            bettor,
            tokenId,
            conditionId,
            outcomeId,
            amount,
            odds,
            fund1,
            fund2
        );
        return tokenId;
    }

    /**
     * @notice Core: Change amount of reserved by conditions funds.
     * @param  initReserve reinforcement of the condition.
     * @param  finalReserve amount of reserves that was not demand according to the condition results, when condition is canceling passed value is 0
     */
    function addReserve(
        uint128 initReserve,
        uint128 finalReserve,
        uint48 leaf
    ) external override onlyCore {
        if (finalReserve > initReserve) {
            // pool win
            uint128 profit = finalReserve - initReserve;

            // calc oracle rewards
            uint128 oracleRewards = (profit * oracleFee) / multiplier;
            // calc DAO rewards
            uint128 daoRewards = (profit * daoFee) / multiplier;

            // add profit to liquidity (reduced by oracle/dao's rewards)
            addLimit(
                profit -
                    (_addDelta(realOracleRewards, oracleRewards) +
                        _addDelta(realDaoRewards, daoRewards)),
                leaf
            );
            realOracleRewards += int128(oracleRewards);
            realDaoRewards += int128(daoRewards);
        } else {
            // remove all loss from segmentTree and separately reduce DAO, Oracle excluding canceled conditions (when finalReserve = initReserve)
            if (initReserve - finalReserve > 0) {
                uint128 loss = initReserve - finalReserve;

                // reduce oracle loss
                uint128 oracleLoss = (loss * oracleFee) / multiplier;
                // reduce DAO rewards
                uint128 daoLoss = (loss * daoFee) / multiplier;

                // remove all loss (reduced by oracle/dao's losses) from liquidity
                remove(
                    loss -
                        (_reduceDelta(realOracleRewards, oracleLoss) +
                            _reduceDelta(realDaoRewards, daoLoss))
                );
                realOracleRewards -= int128(oracleLoss);
                realDaoRewards -= int128(daoLoss);
            }
        }
        // send back locked reinforcement
        lockedLiquidity = lockedLiquidity - initReserve;
    }

    /**
     * @notice internal calculate liquidity changing delta in case win
     * @notice returned delta when real reward is positive or become positive after change
     * @param  real amount of real reward
     * @param  change change amount of changing
     * @return delta for liquidity correction
     */
    function _addDelta(int128 real, uint128 change)
        internal
        pure
        returns (uint128)
    {
        // + win
        if (real < 0) {
            int128 realChanged = real + int128(change);
            return (realChanged > 0) ? uint128(realChanged) : 0;
        } else return change;
    }

    /**
     * @notice internal calculate liquidity changing delta in case loss
     * @notice returned delta when real reward is positive or become positive after change
     * @param  real amount of real reward
     * @param  change change amount of changing
     * @return delta for liquidity correction
     */
    function _reduceDelta(int128 real, uint128 change)
        internal
        pure
        returns (uint128)
    {
        // loss
        return (
            real < 0 ? 0 : (real > int128(change) ? change : uint128(real))
        );
    }

    /**
     * @notice Core: Indicate `amount` of reserve as locked.
     * @param  amount reserves to lock
     */
    function lockReserve(uint128 amount) external override onlyCore {
        lockedLiquidity += amount;
        if (lockedLiquidity > treeNode[1].amount) revert NotEnoughReserves();
    }

    /**
     * @notice Get total reserved funds.
     */
    function getReserve() external view override returns (uint128 reserve) {
        return treeNode[1].amount;
    }

    /**
     * @notice Check if it is possible to use `reinforcementAmount` of tokens as condition reinforcement.
     * @param  reinforcementAmount amount of tokens intended to be used as condition reinforcement.
     * @return status if now it is possible
     */
    function getPossibilityOfReinforcement(uint128 reinforcementAmount)
        external
        view
        override
        returns (bool status)
    {
        return (lockedLiquidity + reinforcementAmount <=
            (reinforcementAbility * treeNode[1].amount) / multiplier);
    }

    /**
     * @dev get segment tree last added leaf
     */
    function getLeaf() external view override returns (uint48 leaf) {
        return (nextNode - 1);
    }
}
        

/contracts/utils/LiquidityTree.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;

contract LiquidityTree {
    struct Node {
        uint64 updateId; // last update number
        uint128 amount; // node amount
    }

    uint40 constant DECIMALS = 10**12;
    uint48 constant LIQUIDITYNODES = 1_099_511_627_776; // begining of data nodes (top at node #1)
    uint48 constant LIQUIDITYLASTNODE = LIQUIDITYNODES * 2 - 1;

    uint48 public nextNode; // next unused node number for adding liquidity

    uint64 public updateId; // update number, used instead of timestamp for splitting changes time on the same nodes

    // liquidity (segment) tree
    mapping(uint48 => Node) public treeNode;

    error LeafNotExist();
    error IncorrectPercent();
    error ChangeError(uint48 node, uint128 amount);
    error ErrorRightBranch(uint48 node, uint48 begin, uint48 end, uint48 l, uint48 r, uint128 amount, uint128 forLeftAmount);
    error ErrorLeavesAmount(uint48 node, uint48 begin, uint48 end, uint48 l, uint48 r);

    /**
     * @dev initializing LIQUIDITYNODES and nextNode. 
     * @dev LIQUIDITYNODES is count of liquidity (segment) tree leaves contains single liquidity addings
     * @dev liquidity (segment) tree build as array of 2*LIQUIDITYNODES count, top node has id #1 (id #0 not used)
     * @dev liquidity (segment) tree leaves is array [LIQUIDITYNODES, 2*LIQUIDITYNODES-1]
     * @dev liquidity (segment) tree node index N has left child index 2*N and right child index 2N+1
     * @dev +--------------------------------------------+
            |                  1 (top node)              |
            +------------------------+-------------------+
            |             2          |         3         |
            +-------------+----------+---------+---------+
            | 4 (nextNode)|     5    |    6    |    7    |
            +-------------+----------+---------+---------+
     */
    function __liquidityTree_init() internal {
        nextNode = LIQUIDITYNODES;
        updateId++; // start from non zero
    }

    /**
     * @dev add liquidity amount from the leaf up to top node
     * @param amount - adding amount
     */
    function nodeAddLiquidity(uint128 amount)
        internal
        returns (uint48 resNode)
    {
        updateUp(nextNode, amount, false, ++updateId);
        resNode = nextNode;
        nextNode++;
    }

    /**
     * @dev leaf withdraw preview, emulates push value from updated node to leaf
     * @param leaf - withdrawing leaf
     */
    function nodeWithdrawView(uint48 leaf)
        public
        view
        returns (uint128 withdrawAmount)
    {
        if (leaf < LIQUIDITYNODES || leaf > LIQUIDITYLASTNODE) return 0;
        if (treeNode[leaf].updateId == 0) return 0;

        // get last-updated top node
        (uint48 updatedNode, uint48 begin, uint48 end) = getUpdatedNode(
            1,
            treeNode[1].updateId,
            LIQUIDITYNODES,
            LIQUIDITYLASTNODE,
            1,
            LIQUIDITYNODES,
            LIQUIDITYLASTNODE,
            leaf
        );

        return
            pushView(
                updatedNode,
                begin,
                end,
                leaf,
                treeNode[updatedNode].amount
            );
    }

    /**
     * @dev withdraw part of liquidity from the leaf, due possible many changes in leafe's parent nodes
     * @dev it is needed firstly to update its amount and then withdraw
     * @dev used steps:
     * @dev 1 - get last updated parent most near to the leaf
     * @dev 2 - push all changes from found parent doen to the leaf - that updates leaf's amount
     * @dev 3 - execute withdraw of leaf amount and update amount changing up to top parents
     * @param leaf -
     * @param percent - percent of leaf amount 1*10^12 is 100%, 5*10^11 is 50%
     */
    function nodeWithdrawPercent(uint48 leaf, uint40 percent)
        internal
        returns (uint128 withdrawAmount)
    {
        if (treeNode[leaf].updateId == 0) revert LeafNotExist();
        if (percent > DECIMALS) revert IncorrectPercent();

        // get last-updated top node
        (uint48 updatedNode, uint48 begin, uint48 end) = getUpdatedNode(
            1,
            treeNode[1].updateId,
            LIQUIDITYNODES,
            LIQUIDITYLASTNODE,
            1,
            LIQUIDITYNODES,
            LIQUIDITYLASTNODE,
            leaf
        );
        // push changes from last-updated node down to the leaf, if leaf is not up to date
        push(updatedNode, begin, end, leaf, ++updateId);

        // remove amount (percent of amount) from leaf to it's parents
        withdrawAmount = (treeNode[leaf].amount * percent) / DECIMALS;

        updateUp(leaf, withdrawAmount, true, ++updateId);
    }

    /**
     * @dev top node is ever most updated, trying to find lower node not older then top node
     * @dev get nearest to leaf (lowest) last-updated node from the parents, runing down from top to leaf
     * @param parent top node
     * @param parentUpdate top node update
     * @param parentBegin top node most left leaf
     * @param parentEnd top node most right leaf
     * @param node node parent for the leaf
     * @param begin node most left leaf
     * @param end node most right leaf
     * @param leaf target leaf
     * @return resParent found most updated leaf parent
     * @return resBegin found parent most left leaf
     * @return resEnd found parent most right leaf
     */
    function getUpdatedNode(
        uint48 parent,
        uint64 parentUpdate,
        uint48 parentBegin,
        uint48 parentEnd,
        uint48 node,
        uint48 begin,
        uint48 end,
        uint48 leaf
    )
        internal
        view
        returns (
            uint48 resParent,
            uint48 resBegin,
            uint48 resEnd
        )
    {
        // if node is older than it's parent, stop and return parent
        if (treeNode[node].updateId < parentUpdate) {
            return (parent, parentBegin, parentEnd);
        }
        if (node == leaf) {
            return (leaf, begin, end);
        }

        uint48 mid = (begin + end) / 2;

        if (begin <= leaf && leaf <= mid) {
            // work on left child
            (resParent, resBegin, resEnd) = getUpdatedNode(
                node,
                parentUpdate,
                begin,
                end,
                node * 2,
                begin,
                mid,
                leaf
            );
        } else {
            // work on right child
            (resParent, resBegin, resEnd) = getUpdatedNode(
                node,
                parentUpdate,
                begin,
                end,
                node * 2 + 1,
                mid + 1,
                end,
                leaf
            );
        }
    }

    /**
     * @dev update up amounts from leaf up to top node #1, used in adding/removing values on leaves
     * @param child node for update
     * @param amount value for update
     * @param isSub true - reduce, false - add
     * @param updateId_ update number
     */
    function updateUp(
        uint48 child,
        uint128 amount,
        bool isSub,
        uint64 updateId_
    ) internal {
        changeAmount(child, amount, isSub, updateId_);
        // if not top parent
        if (child != 1) {
            updateUp(getParent(child), amount, isSub, updateId_);
        }
    }

    /**
     * @dev add amount only for limited leaves in tree [first_leaf, leaf]
     * @param amount value to add
     */
    function addLimit(uint128 amount, uint48 leaf) internal {
        // get last-updated top node
        (uint48 updatedNode, uint48 begin, uint48 end) = getUpdatedNode(
            1,
            treeNode[1].updateId,
            LIQUIDITYNODES,
            LIQUIDITYLASTNODE,
            1,
            LIQUIDITYNODES,
            LIQUIDITYLASTNODE,
            leaf
        );

        // push changes from last-updated node down to the leaf, if leaf is not up to date
        push(updatedNode, begin, end, leaf, ++updateId);

        pushLazy(
            1,
            LIQUIDITYNODES,
            LIQUIDITYLASTNODE,
            LIQUIDITYNODES,
            leaf,
            amount,
            false,
            ++updateId
        );
    }

    /**
     * @dev remove amount only for limited leaves in tree [first_leaf, leaf]
     * @param amount value to remove
     */
    function removeLimit(uint128 amount, uint48 leaf) internal {
        if (treeNode[1].amount >= amount) {
            // get last-updated top node
            (uint48 updatedNode, uint48 begin, uint48 end) = getUpdatedNode(
                1,
                treeNode[1].updateId,
                LIQUIDITYNODES,
                LIQUIDITYLASTNODE,
                1,
                LIQUIDITYNODES,
                LIQUIDITYLASTNODE,
                leaf
            );

            // push changes from last-updated node down to the leaf, if leaf is not up to date
            push(updatedNode, begin, end, leaf, ++updateId);

            pushLazy(
                1,
                LIQUIDITYNODES,
                LIQUIDITYLASTNODE,
                LIQUIDITYNODES,
                leaf,
                amount,
                true,
                ++updateId
            );
        }
    }

    /**
     * @dev remove amount from whole tree, starting from top node #1
     * @param amount value to remove
     */
    function remove(uint128 amount) internal {
        if (treeNode[1].amount >= amount) {
            pushLazy(
                1,
                LIQUIDITYNODES,
                LIQUIDITYLASTNODE,
                LIQUIDITYNODES,
                nextNode - 1,
                amount,
                true,
                ++updateId
            );
        }
    }

    /**
     * @dev push changes from last "lazy update" down to leaf
     * @param node - last node from lazy update
     * @param begin - leaf search start
     * @param end - leaf search end
     * @param leaf - last node to update
     * @param updateId_ update number
     */
    function push(
        uint48 node,
        uint48 begin,
        uint48 end,
        uint48 leaf,
        uint64 updateId_
    ) internal {
        // if node is leaf, stop
        if (node == leaf) {
            return;
        }
        uint48 lChild = node * 2;
        uint48 rChild = node * 2 + 1;
        uint128 amount = treeNode[node].amount;
        uint256 lAmount = treeNode[lChild].amount;
        uint256 rAmount = treeNode[rChild].amount;
        uint256 sumAmounts = lAmount + rAmount;
        if (sumAmounts == 0) return;
        uint128 setLAmount = uint128((amount * lAmount) / sumAmounts);

        // update left and right child
        setAmount(lChild, setLAmount, updateId_);
        setAmount(rChild, amount - setLAmount, updateId_);

        uint48 mid = (begin + end) / 2;

        if (begin <= leaf && leaf <= mid) {
            push(lChild, begin, mid, leaf, updateId_);
        } else {
            push(rChild, mid + 1, end, leaf, updateId_);
        }
    }

    /**
     * @dev push changes from last "lazy update" down to leaf
     * @param node - last node from lazy update
     * @param begin - leaf search start
     * @param end - leaf search end
     * @param leaf - last node to update
     * @param amount - pushed (calced) amount for the node
     */
    function pushView(
        uint48 node,
        uint48 begin,
        uint48 end,
        uint48 leaf,
        uint128 amount
    ) internal view returns (uint128 withdrawAmount) {
        // if node is leaf, stop
        if (node == leaf) {
            return amount;
        }

        uint48 lChild = node * 2;
        uint48 rChild = node * 2 + 1;
        uint256 lAmount = treeNode[lChild].amount;
        uint256 sumAmounts = lAmount + treeNode[rChild].amount;
        if (sumAmounts == 0) return 0;
        uint128 setLAmount = uint128((amount * lAmount) / sumAmounts);

        uint48 mid = (begin + end) / 2;

        if (begin <= leaf && leaf <= mid) {
            return pushView(lChild, begin, mid, leaf, setLAmount);
        } else {
            return pushView(rChild, mid + 1, end, leaf, amount - setLAmount);
        }
    }

    /**
     * @dev push lazy (lazy propagation) amount value from top node to child nodes contained leafs from 0 to r
     * @param node - start from node
     * @param begin - node left element
     * @param end - node right element
     * @param l - left leaf child
     * @param r - right leaf child
     * @param amount - amount to add/reduce stored amounts
     * @param isSub - true means negative to reduce
     * @param updateId_ update number
     */
    function pushLazy(
        uint48 node,
        uint48 begin,
        uint48 end,
        uint48 l,
        uint48 r,
        uint128 amount,
        bool isSub,
        uint64 updateId_
    ) internal {
        if ((begin == l && end == r) || (begin == end)) {
            // if node leafs equal to leaf interval then stop
            changeAmount(node, amount, isSub, updateId_);
            return;
        }

        uint48 mid = (begin + end) / 2;

        if (begin <= l && l <= mid) {
            if (begin <= r && r <= mid) {
                // [l,r] in [begin,mid] - all leafs in left child
                pushLazy(node * 2, begin, mid, l, r, amount, isSub, updateId_);
            } else {
                uint128 lAmount = treeNode[node * 2].amount;
                uint128 _getLeavesAmount = !isSub
                            ? getLeavesAmount(
                                node * 2 + 1,
                                mid + 1,
                                end,
                                r + 1,
                                end
                            )
                            : 0;
                if (_getLeavesAmount > treeNode[node * 2 + 1].amount) 
                    revert ErrorLeavesAmount(node, begin, end, l, r);

                // get right amount excluding unused leaves when adding amounts
                uint128 rAmount = treeNode[node * 2 + 1].amount - _getLeavesAmount
                    /* (
                        !isSub
                            ? getLeavesAmount(
                                node * 2 + 1,
                                mid + 1,
                                end,
                                r + 1,
                                end
                            )
                            : 0
                    ) */;
                uint128 sumAmounts = lAmount + rAmount;
                if (sumAmounts == 0) return;
                uint128 forLeftAmount = (amount *
                    ((lAmount * DECIMALS) / sumAmounts)) / DECIMALS;

                // l in [begin,mid] - part in left child
                pushLazy(
                    node * 2,
                    begin,
                    mid,
                    l,
                    mid,
                    forLeftAmount,
                    isSub,
                    updateId_
                );

                if (forLeftAmount > amount) revert ErrorRightBranch(node, begin, end, l, r, amount, forLeftAmount);
                // r in [mid+1,end] - part in right child
                pushLazy(
                    node * 2 + 1,
                    mid + 1,
                    end,
                    mid + 1,
                    r,
                    amount - forLeftAmount,
                    isSub,
                    updateId_
                );
            }
        } else {
            // [l,r] in [mid+1,end] - all leafs in right child
            pushLazy(
                node * 2 + 1,
                mid + 1,
                end,
                l,
                r,
                amount,
                isSub,
                updateId_
            );
        }
        changeAmount(node, amount, isSub, updateId_);
    }

    /**
     * @dev change amount by adding value or reducing value
     * @param node - node for changing
     * @param amount - amount value for changing
     * @param isSub - true - reduce by amount, true - add by amount
     * @param updateId_ - update number
     */
    function changeAmount(
        uint48 node,
        uint128 amount,
        bool isSub,
        uint64 updateId_
    ) internal {
        treeNode[node].updateId = updateId_;
        if (isSub) {
            if (amount > treeNode[node].amount) revert ChangeError(node, amount);
            treeNode[node].amount -= amount;
        } else {
            treeNode[node].amount += amount;
        }
    }

    /**
     * @dev reset node amount, used in push
     * @param node for set
     * @param amount value
     * @param updateId_ update number
     */
    function setAmount(
        uint48 node,
        uint128 amount,
        uint64 updateId_
    ) internal {
        if (treeNode[node].amount != amount) {
            treeNode[node].updateId = updateId_;
            treeNode[node].amount = amount;
        }
    }

    /**
     * @dev parent N has left child 2N and right child 2N+1getLeavesAmount
     * @param fromNumber - get parent from some child
     * @return parentNumber - found parent
     */
    function getParent(uint48 fromNumber)
        public
        pure
        returns (uint48 parentNumber)
    {
        // if requested from top
        if (fromNumber == 1) {
            return 1;
        }
        return fromNumber / 2;
    }

    /**
     * @dev for current node get sum amount of exact leaves list
     * @param node node to get sum amount
     * @param begin - node left element
     * @param end - node right element
     * @param l - left leaf of the list
     * @param r - right leaf of the list
     * @return amount sum of leaves list
     */
    function getLeavesAmount(
        uint48 node,
        uint48 begin,
        uint48 end,
        uint48 l,
        uint48 r
    ) public view returns (uint128 amount) {
        if ((begin == l && end == r) || (begin == end)) {
            // if node leafs equal to leaf interval then stop and return amount value
            return (treeNode[node].amount);
        }

        uint48 mid = (begin + end) / 2;

        if (begin <= l && l <= mid) {
            if (begin <= r && r <= mid) {
                amount += getLeavesAmount(node * 2, begin, mid, l, r);
            } else {
                amount += getLeavesAmount(node * 2, begin, mid, l, mid);
                amount += getLeavesAmount(
                    node * 2 + 1,
                    mid + 1,
                    end,
                    mid + 1,
                    r
                );
            }
        } else {
            amount += getLeavesAmount(node * 2 + 1, mid + 1, end, l, r);
        }

        return amount;
    }
}
          

/contracts/interface/IWNative.sol

// SPDX-License-Identifier: GPL-3.0
/**
 * @dev interrface for canonical wrapped native contract vbased on WETH9.sol
 */
pragma solidity ^0.8.4;

interface IWNative {
    function deposit() external payable;

    function transfer(address to, uint256 value) external returns (bool);

    function withdraw(uint256) external;
}
          

/_openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @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);
}
          

/contracts/interface/ILP.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.4;

interface ILP {
    event NewBet(
        address indexed owner,
        uint256 indexed betId,
        uint256 indexed conditionId,
        uint64 outcomeId,
        uint128 amount,
        uint256 odds,
        uint128 fund1,
        uint128 fund2
    );

    event BetterWin(address indexed better, uint256 tokenId, uint256 amount);
    event LiquidityAdded(address indexed account, uint256 amount, uint48 leaf);
    event LiquidityRemoved(
        address indexed account,
        uint48 indexed leaf,
        uint256 amount
    );
    event LiquidityRequested(
        address indexed requestWallet,
        uint256 requestedValueLp
    );

    event OracleRewardChanged(uint128 newOracleFee);
    event DaoRewardChanged(uint128 newDaoFee);
    event AzuroBetChanged(address newAzuroBet);
    event PeriodChanged(uint64 newPeriod);
    event MinDepoChanged(uint128 newMinDepo);
    event WithdrawTimeoutChanged(uint64 newWithdrawTimeout);
    event ClaimTimeoutChanged(uint64 newClaimTimeout);
    event ReinforcementAbilityChanged(uint128 newReinforcementAbility);

    error OnlyBetOwner();
    error OnlyCore();

    error AmountMustNotBeZero();
    error AmountNotSufficient();
    error NoDaoReward();
    error NoOracleReward();
    error NoWinNoPrize();
    error LiquidityNotOwned();
    error LiquidityIsLocked();
    error NoLiquidity();
    error PaymentLocked();
    error WrongToken();
    error ConditionStarted();
    error NotEnoughReserves();
    error WithdrawalTimeout(uint64 waitTime);
    error ClaimTimeout(uint64 waitTime);

    function changeCore(address newCore) external;

    function addLiquidity(uint128 amount) external;

    function addLiquidityNative() external payable;

    function withdrawLiquidity(uint48 depNum, uint40 percent) external;

    function withdrawLiquidityNative(uint48 depNum, uint40 percent) external;

    function claimOracleReward(address oracle) external;

    function viewPayout(uint256 tokenId) external view returns (bool, uint128);

    function bet(
        uint256 conditionId,
        uint128 amount,
        uint64 outcomeId,
        uint64 deadline,
        uint64 minOdds
    ) external returns (uint256);

    function getReserve() external view returns (uint128);

    function lockReserve(uint128 amount) external;

    function addReserve(
        uint128 initReserve,
        uint128 profitReserve,
        uint48 leaf
    ) external;

    function withdrawPayout(uint256 tokenId) external;

    function withdrawPayoutNative(uint256 tokenId) external;

    function getPossibilityOfReinforcement(uint128 reinforcementAmount)
        external
        view
        returns (bool);

    function getLeaf() external view returns (uint48 leaf);

    function betNative(
        uint256 conditionId,
        uint64 outcomeId,
        uint64 deadline,
        uint64 minOdds
    ) external payable returns (uint256);

    function betFor(
        address bettor,
        uint256 conditionId,
        uint128 amount,
        uint64 outcomeId,
        uint64 deadline,
        uint64 minOdds
    ) external returns (uint256);
}
          

/contracts/interface/ICore.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.4;

interface ICore {
    enum ConditionState {
        CREATED,
        RESOLVED,
        CANCELED,
        PAUSED
    }

    struct Bet {
        uint256 conditionId;
        uint128 amount;
        uint64 outcome;
        uint64 createdAt;
        uint64 odds;
        bool payed;
    }

    struct Condition {
        uint128[2] fundBank;
        uint128[2] payouts;
        uint128[2] totalNetBets;
        uint128 reinforcement;
        uint128 margin;
        bytes32 ipfsHash;
        uint64[2] outcomes; // unique outcomes for the condition
        uint128 scopeId;
        uint64 outcomeWin;
        uint64 timestamp; // after this time user cant put bet on condition
        ConditionState state;
        uint48 leaf;
    }

    event ConditionCreated(
        uint256 indexed oracleConditionId,
        uint256 indexed conditionId,
        uint64 timestamp
    );
    event ConditionResolved(
        uint256 indexed oracleConditionId,
        uint256 indexed conditionId,
        uint64 outcomeWin,
        uint8 state,
        uint256 amountForLp
    );
    event LpChanged(address indexed newLp);
    event MaxBanksRatioChanged(uint64 newRatio);
    event MaintainerUpdated(address indexed maintainer, bool active);
    event OracleAdded(address indexed newOracle);
    event OracleRenounced(address indexed oracle);
    event AllConditionsStopped(bool flag);
    event ConditionStopped(uint256 indexed conditionId, bool flag);
    event ConditionShifted(
        uint256 oracleCondId,
        uint256 conditionId,
        uint64 newTimestamp
    );

    error OnlyLp();
    error OnlyMaintainer();
    error OnlyOracle();

    error FlagAlreadySet();
    error CantChangeFlag();
    error IncorrectTimestamp();
    error SameOutcomes();
    error SmallBet();
    error SmallOdds();
    error WrongDataFormat();
    error WrongOutcome();
    error ZeroOdds();

    error ConditionNotExists();
    error ConditionNotStarted();
    error ResolveTooEarly(uint64 waitTime);
    error ConditionStarted();
    error ConditionAlreadyCreated();
    error ConditionAlreadyResolved();
    error BetNotAllowed();

    error BigDifference();
    error CantAcceptBet();
    error NotEnoughLiquidity();

    function getLockedPayout() external view returns (uint256);

    function createCondition(
        uint256 oracleConditionId,
        uint128 scopeId,
        uint64[2] memory odds,
        uint64[2] memory outcomes,
        uint64 timestamp,
        bytes32 ipfsHash
    ) external;

    function resolveCondition(uint256 conditionId, uint64 outcomeWin) external;

    function viewPayout(uint256 tokenId) external view returns (bool, uint128);

    function resolvePayout(uint256 tokenId) external returns (bool, uint128);

    function setLp(address lp) external;

    function putBet(
        uint256 conditionId,
        uint256 tokenId,
        uint128 amount,
        uint64 outcome,
        uint64 minOdds
    )
        external
        returns (
            uint64,
            uint128,
            uint128
        );

    function getBetInfo(uint256 betId)
        external
        view
        returns (
            uint128 amount,
            uint64 odds,
            uint64 createdAt
        );

    function isOracle(address oracle) external view returns (bool);
}
          

/contracts/interface/IAzuroBet.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";

interface IAzuroBet is IERC721EnumerableUpgradeable {
    function ownerOf(uint256 tokenId) external view override returns (address);

    function burn(uint256 id) external;

    function mint(address account, address core) external;

    function setLp(address lp) external;

    function getCoreByToken(uint256 tokenId)
        external
        view
        returns (address core);

    event LpChanged(address lp);

    error OnlyLp();
}
          

/_openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}
          

/_uniswap/lib/contracts/libraries/TransferHelper.sol

// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeApprove: approve failed'
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeTransfer: transfer failed'
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::transferFrom: transferFrom failed'
        );
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
    }
}
          

/_openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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);
}
          

/_openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

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

/_openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

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

/_openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

/_openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721Upgradeable.sol";
import "./IERC721EnumerableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {
    function __ERC721Enumerable_init() internal onlyInitializing {
    }

    function __ERC721Enumerable_init_unchained() internal onlyInitializing {
    }
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

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

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @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` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * 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 override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721Upgradeable.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }

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

/_openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

/_openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {
    /**
     * @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);
}
          

/_openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable 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.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        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: owner query for nonexistent token");
        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) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        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 = ERC721Upgradeable.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        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: transfer caller is not 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: transfer caller is not 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) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721Upgradeable.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 = ERC721Upgradeable.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(ERC721Upgradeable.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 a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {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 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    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 {}

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

/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(1);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(version);
        }
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !AddressUpgradeable.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

Contract ABI

[{"type":"error","name":"AmountMustNotBeZero","inputs":[]},{"type":"error","name":"AmountNotSufficient","inputs":[]},{"type":"error","name":"ChangeError","inputs":[{"type":"uint48","name":"node","internalType":"uint48"},{"type":"uint128","name":"amount","internalType":"uint128"}]},{"type":"error","name":"ClaimTimeout","inputs":[{"type":"uint64","name":"waitTime","internalType":"uint64"}]},{"type":"error","name":"ConditionStarted","inputs":[]},{"type":"error","name":"ErrorLeavesAmount","inputs":[{"type":"uint48","name":"node","internalType":"uint48"},{"type":"uint48","name":"begin","internalType":"uint48"},{"type":"uint48","name":"end","internalType":"uint48"},{"type":"uint48","name":"l","internalType":"uint48"},{"type":"uint48","name":"r","internalType":"uint48"}]},{"type":"error","name":"ErrorRightBranch","inputs":[{"type":"uint48","name":"node","internalType":"uint48"},{"type":"uint48","name":"begin","internalType":"uint48"},{"type":"uint48","name":"end","internalType":"uint48"},{"type":"uint48","name":"l","internalType":"uint48"},{"type":"uint48","name":"r","internalType":"uint48"},{"type":"uint128","name":"amount","internalType":"uint128"},{"type":"uint128","name":"forLeftAmount","internalType":"uint128"}]},{"type":"error","name":"IncorrectPercent","inputs":[]},{"type":"error","name":"LeafNotExist","inputs":[]},{"type":"error","name":"LiquidityIsLocked","inputs":[]},{"type":"error","name":"LiquidityNotOwned","inputs":[]},{"type":"error","name":"NoDaoReward","inputs":[]},{"type":"error","name":"NoLiquidity","inputs":[]},{"type":"error","name":"NoOracleReward","inputs":[]},{"type":"error","name":"NoWinNoPrize","inputs":[]},{"type":"error","name":"NotEnoughReserves","inputs":[]},{"type":"error","name":"OnlyBetOwner","inputs":[]},{"type":"error","name":"OnlyCore","inputs":[]},{"type":"error","name":"PaymentLocked","inputs":[]},{"type":"error","name":"WithdrawalTimeout","inputs":[{"type":"uint64","name":"waitTime","internalType":"uint64"}]},{"type":"error","name":"WrongToken","inputs":[]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"AzuroBetChanged","inputs":[{"type":"address","name":"newAzuroBet","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BetterWin","inputs":[{"type":"address","name":"better","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ClaimTimeoutChanged","inputs":[{"type":"uint64","name":"newClaimTimeout","internalType":"uint64","indexed":false}],"anonymous":false},{"type":"event","name":"DaoRewardChanged","inputs":[{"type":"uint128","name":"newDaoFee","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"LiquidityAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint48","name":"leaf","internalType":"uint48","indexed":false}],"anonymous":false},{"type":"event","name":"LiquidityRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"uint48","name":"leaf","internalType":"uint48","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LiquidityRequested","inputs":[{"type":"address","name":"requestWallet","internalType":"address","indexed":true},{"type":"uint256","name":"requestedValueLp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"MinDepoChanged","inputs":[{"type":"uint128","name":"newMinDepo","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"NewBet","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"uint256","name":"betId","internalType":"uint256","indexed":true},{"type":"uint256","name":"conditionId","internalType":"uint256","indexed":true},{"type":"uint64","name":"outcomeId","internalType":"uint64","indexed":false},{"type":"uint128","name":"amount","internalType":"uint128","indexed":false},{"type":"uint256","name":"odds","internalType":"uint256","indexed":false},{"type":"uint128","name":"fund1","internalType":"uint128","indexed":false},{"type":"uint128","name":"fund2","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"OracleRewardChanged","inputs":[{"type":"uint128","name":"newOracleFee","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PeriodChanged","inputs":[{"type":"uint64","name":"newPeriod","internalType":"uint64","indexed":false}],"anonymous":false},{"type":"event","name":"ReinforcementAbilityChanged","inputs":[{"type":"uint128","name":"newReinforcementAbility","internalType":"uint128","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"WithdrawTimeoutChanged","inputs":[{"type":"uint64","name":"newWithdrawTimeout","internalType":"uint64","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addLiquidity","inputs":[{"type":"uint128","name":"amount","internalType":"uint128"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"addLiquidityNative","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addReserve","inputs":[{"type":"uint128","name":"initReserve","internalType":"uint128"},{"type":"uint128","name":"finalReserve","internalType":"uint128"},{"type":"uint48","name":"leaf","internalType":"uint48"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IAzuroBet"}],"name":"azuroBet","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"bet","inputs":[{"type":"uint256","name":"conditionId","internalType":"uint256"},{"type":"uint128","name":"amount","internalType":"uint128"},{"type":"uint64","name":"outcomeId","internalType":"uint64"},{"type":"uint64","name":"deadline","internalType":"uint64"},{"type":"uint64","name":"minOdds","internalType":"uint64"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"betFor","inputs":[{"type":"address","name":"bettor","internalType":"address"},{"type":"uint256","name":"conditionId","internalType":"uint256"},{"type":"uint128","name":"amount","internalType":"uint128"},{"type":"uint64","name":"outcomeId","internalType":"uint64"},{"type":"uint64","name":"deadline","internalType":"uint64"},{"type":"uint64","name":"minOdds","internalType":"uint64"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"betNative","inputs":[{"type":"uint256","name":"conditionId","internalType":"uint256"},{"type":"uint64","name":"outcomeId","internalType":"uint64"},{"type":"uint64","name":"deadline","internalType":"uint64"},{"type":"uint64","name":"minOdds","internalType":"uint64"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeAzuroBet","inputs":[{"type":"address","name":"newAzuroBet","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeClaimTimeout","inputs":[{"type":"uint64","name":"newClaimTimeout","internalType":"uint64"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeCore","inputs":[{"type":"address","name":"newCore","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeDaoReward","inputs":[{"type":"uint128","name":"newDaoFee","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeMinDepo","inputs":[{"type":"uint128","name":"newMinDepo","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeOracleReward","inputs":[{"type":"uint128","name":"newOracleFee","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeReinforcementAbility","inputs":[{"type":"uint128","name":"newReinforcementAbility","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeWithdrawTimeout","inputs":[{"type":"uint64","name":"newWithdrawTimeout","internalType":"uint64"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimDaoReward","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimOracleReward","inputs":[{"type":"address","name":"oracle","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"claimTimeout","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ICore"}],"name":"core","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"daoFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint48","name":"leaf","internalType":"uint48"}],"name":"getLeaf","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"amount","internalType":"uint128"}],"name":"getLeavesAmount","inputs":[{"type":"uint48","name":"node","internalType":"uint48"},{"type":"uint48","name":"begin","internalType":"uint48"},{"type":"uint48","name":"end","internalType":"uint48"},{"type":"uint48","name":"l","internalType":"uint48"},{"type":"uint48","name":"r","internalType":"uint48"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint48","name":"parentNumber","internalType":"uint48"}],"name":"getParent","inputs":[{"type":"uint48","name":"fromNumber","internalType":"uint48"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"status","internalType":"bool"}],"name":"getPossibilityOfReinforcement","inputs":[{"type":"uint128","name":"reinforcementAmount","internalType":"uint128"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"reserve","internalType":"uint128"}],"name":"getReserve","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"token_","internalType":"address"},{"type":"address","name":"azuroBetAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"lastClaimDao","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"lastClaimOracle","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lockReserve","inputs":[{"type":"uint128","name":"amount","internalType":"uint128"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"lockedLiquidity","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"minDepo","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"multiplier","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint48","name":"","internalType":"uint48"}],"name":"nextNode","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"withdrawAmount","internalType":"uint128"}],"name":"nodeWithdrawView","inputs":[{"type":"uint48","name":"leaf","internalType":"uint48"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"oracleFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"int128","name":"","internalType":"int128"}],"name":"realDaoRewards","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"int128","name":"","internalType":"int128"}],"name":"realOracleRewards","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"reinforcementAbility","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"totalDaoRewards","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"updateId","internalType":"uint64"},{"type":"uint128","name":"amount","internalType":"uint128"}],"name":"treeNode","inputs":[{"type":"uint48","name":"","internalType":"uint48"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"updateId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"},{"type":"uint128","name":"","internalType":"uint128"}],"name":"viewPayout","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawLiquidity","inputs":[{"type":"uint48","name":"depNum","internalType":"uint48"},{"type":"uint40","name":"percent","internalType":"uint40"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawLiquidityNative","inputs":[{"type":"uint48","name":"depNum","internalType":"uint48"},{"type":"uint40","name":"percent","internalType":"uint40"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawPayout","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawPayoutNative","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"withdrawTimeout","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"withdrawals","inputs":[{"type":"uint48","name":"","internalType":"uint48"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b506159d480620000216000396000f3fe6080604052600436106103035760003560e01c806301ffc9a714610338578063038befa21461036d57806306fdde031461038d578063081812fc146103af578063095222a8146103dc578063095ea7b3146104105780630e1da6c31461043057806312a948ca1461045e57806318160ddd1461047e5780631b3ed7221461049d57806323b872dd146104c45780632589867d146104e45780632957b839146105235780632f745c591461054a57806337030c521461056a5780633df036701461058a57806341f25124146105b257806342842e0e146105da578063485cc955146105fa5780634f6ccce71461061a57806350b87a4e1461063a57806359bf5d391461065a5780635b4e08e5146106965780636333edae146106b65780636352211e146106d657806365715c56146106f65780636b4264961461072c578063709e99521461074157806370a0823114610761578063715018a6146107815780637580bff11461079657806375fcb1b3146107b65780637adb4a7f146107be5780637f4270c1146107d15780638164b4d6146107f15780638cceabb6146108115780638da5cb5b146108315780638e426460146108465780638e8dc736146108665780638f34393d146108865780639207c4af146108a657806395d89b41146108c75780639acbb4f9146108dc5780639c15d1a2146109115780639d7f4f2614610939578063a22cb46514610954578063ae9f987b14610974578063b21c793514610994578063b2cf4612146109b4578063b4398244146109d4578063b88d4fde146109f4578063be559f7a14610a14578063bfcf04cf14610a29578063c39f75c114610a50578063c87b56dd14610a70578063cbe2882314610a90578063cd6072e614610ab0578063d2a382b214610b1f578063d66add0614610b3f578063e7324cc214610b5f578063e985e9c514610b7f578063f021b78414610b9f578063f075274014610bc0578063f1eb984014610bf7578063f2f4eb2614610c17578063f2fde38b14610c38578063f9cd3ceb14610c58578063fc0c546a14610c7857600080fd5b3661033357610100546001600160a01b0316331461033157634e487b7160e01b600052600160045260246000fd5b005b600080fd5b34801561034457600080fd5b5061035861035336600461505d565b610c99565b60405190151581526020015b60405180910390f35b34801561037957600080fd5b50610331610388366004614dbb565b610cc4565b34801561039957600080fd5b506103a2610d53565b60405161036491906153b8565b3480156103bb57600080fd5b506103cf6103ca3660046150f7565b610de5565b6040516103649190615371565b3480156103e857600080fd5b5060fd5461040390600160801b90046001600160801b031681565b604051610364919061553c565b34801561041c57600080fd5b5061033161042b366004614f70565b610e6d565b34801561043c57600080fd5b5061010654610451906001600160401b031681565b6040516103649190615550565b34801561046a57600080fd5b5060ff54610403906001600160801b031681565b34801561048a57600080fd5b5060cd545b604051908152602001610364565b3480156104a957600080fd5b5060ff5461045190600160801b90046001600160401b031681565b3480156104d057600080fd5b506103316104df366004614e2b565b610f7e565b3480156104f057600080fd5b506105046104ff3660046150f7565b610faf565b6040805192151583526001600160801b03909116602083015201610364565b34801561052f57600080fd5b5060fe5461040390600160801b90046001600160801b031681565b34801561055657600080fd5b5061048f610565366004614f70565b6110b6565b34801561057657600080fd5b506103316105853660046150b1565b61114c565b34801561059657600080fd5b506101065461045190600160401b90046001600160401b031681565b3480156105be57600080fd5b506101065461045190600160801b90046001600160401b031681565b3480156105e657600080fd5b506103316105f5366004614e2b565b6114aa565b34801561060657600080fd5b50610331610615366004614df3565b6114c5565b34801561062657600080fd5b5061048f6106353660046150f7565b611658565b34801561064657600080fd5b506103316106553660046151fa565b6116f9565b34801561066657600080fd5b506001600081905260205260008051602061595f83398151915254600160401b90046001600160801b0316610403565b3480156106a257600080fd5b506103586106b1366004615095565b61177c565b3480156106c257600080fd5b506103316106d1366004614dbb565b611802565b3480156106e257600080fd5b506103cf6106f13660046150f7565b61192d565b34801561070257600080fd5b506000546107159065ffffffffffff1681565b60405165ffffffffffff9091168152602001610364565b34801561073857600080fd5b506103316119a4565b34801561074d57600080fd5b5061033161075c366004615095565b611af3565b34801561076d57600080fd5b5061048f61077c366004614dbb565b611b21565b34801561078d57600080fd5b50610331611ba8565b3480156107a257600080fd5b506103316107b1366004615095565b611be3565b610331611c5c565b61048f6107cc36600461518e565b611ccf565b3480156107dd57600080fd5b506104036107ec3660046151e0565b611d54565b3480156107fd57600080fd5b5061033161080c366004615095565b611e8a565b34801561081d57600080fd5b5061071561082c3660046151e0565b611f05565b34801561083d57600080fd5b506103cf611f2b565b34801561085257600080fd5b50610331610861366004614dbb565b611f3a565b34801561087257600080fd5b50610331610881366004615292565b61204a565b34801561089257600080fd5b506103316108a13660046150f7565b6120ce565b3480156108b257600080fd5b5061010354610403906001600160801b031681565b3480156108d357600080fd5b506103a2612154565b3480156108e857600080fd5b50610105546108fe90600160801b9004600f0b81565b604051600f9190910b8152602001610364565b34801561091d57600080fd5b506101035461045190600160801b90046001600160401b031681565b34801561094557600080fd5b50610105546108fe90600f0b81565b34801561096057600080fd5b5061033161096f366004614f43565b612163565b34801561098057600080fd5b5061048f61098f366004614f9b565b61216e565b3480156109a057600080fd5b506103316109af3660046150f7565b6121ac565b3480156109c057600080fd5b5061048f6109cf366004615127565b6121db565b3480156109e057600080fd5b5060fd54610403906001600160801b031681565b348015610a0057600080fd5b50610331610a0f366004614e6b565b612218565b348015610a2057600080fd5b50610715612250565b348015610a3557600080fd5b5060005461045190600160301b90046001600160401b031681565b348015610a5c57600080fd5b50610331610a6b366004615095565b61226d565b348015610a7c57600080fd5b506103a2610a8b3660046150f7565b6122e7565b348015610a9c57600080fd5b50610403610aab36600461522e565b6123bf565b348015610abc57600080fd5b50610af8610acb3660046151e0565b6001602052600090815260409020546001600160401b03811690600160401b90046001600160801b031682565b604080516001600160401b0390931683526001600160801b03909116602083015201610364565b348015610b2b57600080fd5b50610331610b3a366004615292565b612584565b348015610b4b57600080fd5b50610331610b5a366004615095565b6125ff565b348015610b6b57600080fd5b50610331610b7a3660046151fa565b612679565b348015610b8b57600080fd5b50610358610b9a366004614df3565b6126a9565b348015610bab57600080fd5b50610102546103cf906001600160a01b031681565b348015610bcc57600080fd5b50610451610bdb3660046151e0565b610104602052600090815260409020546001600160401b031681565b348015610c0357600080fd5b50610331610c12366004615095565b6126d7565b348015610c2357600080fd5b50610101546103cf906001600160a01b031681565b348015610c4457600080fd5b50610331610c53366004614dbb565b61278b565b348015610c6457600080fd5b5060fe54610403906001600160801b031681565b348015610c8457600080fd5b50610100546103cf906001600160a01b031681565b60006001600160e01b0319821663780e9d6360e01b1480610cbe5750610cbe82612828565b92915050565b33610ccd611f2b565b6001600160a01b031614610cfc5760405162461bcd60e51b8152600401610cf39061546b565b60405180910390fd5b61010280546001600160a01b0319166001600160a01b0383161790556040517f1337ea29b8a93bfba10fa82a7a5db3c29932a92f4b6ecc34fe6d9888e0525f8e90610d48908390615371565b60405180910390a150565b606060998054610d629061580c565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8e9061580c565b8015610ddb5780601f10610db057610100808354040283529160200191610ddb565b820191906000526020600020905b815481529060010190602001808311610dbe57829003601f168201915b5050505050905090565b6000610df082612878565b610e515760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610cf3565b506000908152609d60205260409020546001600160a01b031690565b6000610e788261192d565b9050806001600160a01b0316836001600160a01b03161415610ee65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610cf3565b336001600160a01b0382161480610f025750610f0281336126a9565b610f6f5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610cf3565b610f798383612895565b505050565b610f883382612903565b610fa45760405162461bcd60e51b8152600401610cf3906154a0565b610f798383836129cc565b61010254604051634bcf7bd160e01b81526004810183905260009182916001600160a01b0390911690634bcf7bd19060240160206040518083038186803b158015610ff957600080fd5b505afa15801561100d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110319190614dd7565b6001600160a01b0316632589867d846040518263ffffffff1660e01b815260040161105e91815260200190565b604080518083038186803b15801561107557600080fd5b505afa158015611089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ad919061502f565b91509150915091565b60006110c183611b21565b82106111235760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610cf3565b506001600160a01b0391909116600090815260cb60209081526040808320938352929052205490565b610101546001600160a01b0316331461117857604051636e4b6fef60e11b815260040160405180910390fd5b826001600160801b0316826001600160801b031611156112f557600061119e8484615762565b60ff5460fe54919250600091600160801b9091046001600160401b0316906111cf906001600160801b03168461569f565b6111d99190615632565b60ff5460fe54919250600091600160801b918290046001600160401b03169161120c91046001600160801b03168561569f565b6112169190615632565b610105549091506112609061122e90600f0b83612b61565b6101055461124690600160801b9004600f0b85612b61565b61125091906155b5565b61125a9085615762565b85612b9f565b6101058054839190601090611280908490600160801b9004600f0b615564565b92506101000a8154816001600160801b030219169083600f0b6001600160801b031602179055508061010560008282829054906101000a9004600f0b6112c69190615564565b92506101000a8154816001600160801b030219169083600f0b6001600160801b0316021790555050505061146e565b60006113018385615762565b6001600160801b0316111561146e57600061131c8385615762565b60ff5460fe54919250600091600160801b9091046001600160401b03169061134d906001600160801b03168461569f565b6113579190615632565b60ff5460fe54919250600091600160801b918290046001600160401b03169161138a91046001600160801b03168561569f565b6113949190615632565b610105549091506113dd906113ac90600f0b83612cda565b610105546113c490600160801b9004600f0b85612cda565b6113ce91906155b5565b6113d89085615762565b612d08565b61010580548391906010906113fd908490600160801b9004600f0b615712565b92506101000a8154816001600160801b030219169083600f0b6001600160801b031602179055508061010560008282829054906101000a9004600f0b6114439190615712565b92506101000a8154816001600160801b030219169083600f0b6001600160801b031602179055505050505b60fd546114859084906001600160801b0316615762565b60fd80546001600160801b0319166001600160801b0392909216919091179055505050565b610f7983838360405180602001604052806000815250612218565b60006114d16001612d9c565b905080156114e9576002805461ff0019166101001790555b6001600160a01b03831661151057604051635079ff7560e11b815260040160405180910390fd5b611518612e32565b61156a6040518060400160405280601281526020017120bd3ab9379026281027232a103a37b5b2b760711b81525060405180604001604052806006815260200165262816a0ad2960d11b815250612e62565b611572612e93565b61010080546001600160a01b038086166001600160a01b03199283161790925561010280549285169290911691909117905560ff8054621dcd6560891b600160801b600160c01b0319909116179081905562989680620aba9560871b0160fe556115ee90600290600160801b90046001600160401b0316615685565b60ff80546001600160801b0319166001600160401b03929092169190911790558015610f79576002805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b600061166360cd5490565b82106116c65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610cf3565b60cd82815481106116e757634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b60006117058383612eed565b61010054604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d9061173790849060040161553c565b600060405180830381600087803b15801561175157600080fd5b505af1158015611765573d6000803e3d6000fd5b50505050610f7933826001600160801b03166130d7565b60ff546001600081815260209190915260008051602061595f8339815191525490916001600160401b03600160801b820416916117cc916001600160801b03600160401b9092048216911661569f565b6117d69190615632565b60fd546001600160801b03918216916117f1918591166155b5565b6001600160801b0316111592915050565b610101546001600160a01b0316331461182e57604051636e4b6fef60e11b815260040160405180910390fd5b610105546000600160801b909104600f90810b900b136118615760405163063440c760e51b815260040160405180910390fd5b610106546001600160401b038082169161188491600160801b909104164261578a565b10156118c557610106546118ab906001600160401b0380821691600160801b900416615610565b6040516318789e3d60e21b8152600401610cf39190615550565b61010054610105546118f5916001600160a01b0316908390600160801b9004600f0b6001600160801b03166131b1565b5061010580546001600160801b031690556101068054600160801b600160c01b031916600160801b426001600160401b031602179055565b6000818152609b60205260408120546001600160a01b031680610cbe5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610cf3565b60fd54600160801b90046001600160801b031615611a175760fd546101058054600160801b9092046001600160801b0316916000906119e7908490600f0b615564565b82546101009290920a6001600160801b0381810219909316600f9290920b8316021790915560fd80549091169055505b610105546000600f91820b90910b13611a4357604051633609559b60e01b815260040160405180910390fd5b610106546001600160401b0380821691611a6691600160401b909104164261578a565b1015611a8d57610106546118ab906001600160401b0380821691600160401b900416615610565b61010054611abb906001600160a01b0316611aa6611f2b565b61010554600f0b6001600160801b03166131b1565b61010580546001600160801b03191690556101068054600160401b600160801b031916600160401b426001600160401b031602179055565b61010054611b15906001600160a01b031633306001600160801b0385166132db565b611b1e81613419565b50565b60006001600160a01b038216611b8c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610cf3565b506001600160a01b03166000908152609c602052604090205490565b33611bb1611f2b565b6001600160a01b031614611bd75760405162461bcd60e51b8152600401610cf39061546b565b611be160006134e4565b565b33611bec611f2b565b6001600160a01b031614611c125760405162461bcd60e51b8152600401610cf39061546b565b60fe80546001600160801b03808416600160801b0291161790556040517f1c083321f81cfff52c5813078d0f9eb48d6dcea0e8b6fe917ccd6f10e0eb1b4890610d4890839061553c565b61010060009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611cad57600080fd5b505af1158015611cc1573d6000803e3d6000fd5b5050505050611be134613419565b600061010060009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b5050505050611d49338634878787613536565b90505b949350505050565b6000600160281b65ffffffffffff83161080611d9957506001611d7c600160281b60026156ed565b611d8691906157a1565b65ffffffffffff168265ffffffffffff16115b15611da657506000919050565b65ffffffffffff82166000908152600160205260409020546001600160401b0316611dd357506000919050565b60016000818152602082905260008051602061595f83398151915254909182918291611e40916001600160401b0316600160281b82611e138260026156ed565b611e1d91906157a1565b6001600160281b81611e308260026156ed565b611e3a91906157a1565b8c6137d1565b65ffffffffffff83166000908152600160205260409020549295509093509150611e81908490849084908990600160401b90046001600160801b03166138ee565b95945050505050565b33611e93611f2b565b6001600160a01b031614611eb95760405162461bcd60e51b8152600401610cf39061546b565b61010380546001600160801b0319166001600160801b0383161790556040517f483032c7f41f1ba71455a09f574b92ba07ae933719975978f96f457d4c1c98d390610d4890839061553c565b60008165ffffffffffff1660011415611f2057506001919050565b610cbe60028361566c565b6035546001600160a01b031690565b33611f43611f2b565b6001600160a01b031614611f695760405162461bcd60e51b8152600401610cf39061546b565b610101546001600160a01b031615801590612009575061010160009054906101000a90046001600160a01b03166001600160a01b0316634108fdf06040518163ffffffff1660e01b815260040160206040518083038186803b158015611fce57600080fd5b505afa158015611fe2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612006919061510f565b15155b156120275760405163ccb0a51b60e01b815260040160405180910390fd5b61010180546001600160a01b0319166001600160a01b0392909216919091179055565b33612053611f2b565b6001600160a01b0316146120795760405162461bcd60e51b8152600401610cf39061546b565b6101038054600160801b600160c01b031916600160801b6001600160401b038416021790556040517f527dd140711eb0a9177d62725055c7fe5eb62351eabf406fd3f80886ba57ea3090610d48908390615550565b60006120d982613a3c565b61010054604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d9061210b90849060040161553c565b600060405180830381600087803b15801561212557600080fd5b505af1158015612139573d6000803e3d6000fd5b5050505061215033826001600160801b03166130d7565b5050565b6060609a8054610d629061580c565b612150338383613c51565b61010054600090612193906001600160a01b031633306001600160801b0389166132db565b6121a1878787878787613536565b979650505050505050565b60006121b782613a3c565b61010054909150612150906001600160a01b0316336001600160801b0384166131b1565b61010054600090612200906001600160a01b031633306001600160801b0389166132db565b61220e338787878787613536565b9695505050505050565b6122223383612903565b61223e5760405162461bcd60e51b8152600401610cf3906154a0565b61224a84848484613d1c565b50505050565b600080546122689060019065ffffffffffff166157a1565b905090565b33612276611f2b565b6001600160a01b03161461229c5760405162461bcd60e51b8152600401610cf39061546b565b60fe80546001600160801b0319166001600160801b0383161790556040517f7d845f2c3b711085c4075e46d135e9072fd7b01eb4696591029422109d91f99990610d4890839061553c565b60606122f282612878565b6123565760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610cf3565b600061236d60408051602081019091526000815290565b9050600081511161238d57604051806020016040528060008152506123b8565b8061239784613d4f565b6040516020016123a8929190615342565b6040516020818303038152906040525b9392505050565b60008265ffffffffffff168565ffffffffffff161480156123ef57508165ffffffffffff168465ffffffffffff16145b8061240957508365ffffffffffff168565ffffffffffff16145b1561243c575065ffffffffffff8516600090815260016020526040902054600160401b90046001600160801b0316611e81565b6000600261244a86886155ef565b612454919061566c565b90508365ffffffffffff168665ffffffffffff161115801561248657508065ffffffffffff168465ffffffffffff1611155b15612541578265ffffffffffff168665ffffffffffff16111580156124bb57508065ffffffffffff168365ffffffffffff1611155b156124e8576124d76124ce8860026156ed565b878387876123bf565b6124e190836155b5565b915061257a565b6124ff6124f68860026156ed565b878387856123bf565b61250990836155b5565b91506124d76125198860026156ed565b6125249060016155ef565b61252f8360016155ef565b8761253b8560016155ef565b876123bf565b61256d61254f8860026156ed565b61255a9060016155ef565b6125658360016155ef565b8787876123bf565b61257790836155b5565b91505b5095945050505050565b3361258d611f2b565b6001600160a01b0316146125b35760405162461bcd60e51b8152600401610cf39061546b565b61010680546001600160401b0319166001600160401b0383161790556040517f27cd37fc700f6b98651e78d699d1bcc11b859e18a8ab4948c58dbfa51572e0c990610d48908390615550565b33612608611f2b565b6001600160a01b03161461262e5760405162461bcd60e51b8152600401610cf39061546b565b60ff80546001600160801b0319166001600160801b0383161790556040517fb487f1ce89894e59e154350ff5aa3ec4c41baf284cafd0baae6d3d1113c3b65090610d4890839061553c565b60006126858383612eed565b61010054909150610f79906001600160a01b0316336001600160801b0384166131b1565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b610101546001600160a01b0316331461270357604051636e4b6fef60e11b815260040160405180910390fd5b60fd80548291906000906127219084906001600160801b03166155b5565b82546101009290920a6001600160801b038181021990931691831602179091556001600081905260205260008051602061595f8339815191525460fd54600160401b9091048216911611159050611b1e5760405163c6c13aa760e01b815260040160405180910390fd5b33612794611f2b565b6001600160a01b0316146127ba5760405162461bcd60e51b8152600401610cf39061546b565b6001600160a01b03811661281f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610cf3565b611b1e816134e4565b60006001600160e01b031982166380ac58cd60e01b148061285957506001600160e01b03198216635b5e139f60e01b145b80610cbe57506301ffc9a760e01b6001600160e01b0319831614610cbe565b6000908152609b60205260409020546001600160a01b0316151590565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906128ca8261192d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061290e82612878565b61296f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610cf3565b600061297a8361192d565b9050806001600160a01b0316846001600160a01b031614806129a157506129a181856126a9565b80611d4c5750836001600160a01b03166129ba84610de5565b6001600160a01b031614949350505050565b826001600160a01b03166129df8261192d565b6001600160a01b031614612a435760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610cf3565b6001600160a01b038216612aa55760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610cf3565b612ab0838383613e68565b612abb600082612895565b6001600160a01b0383166000908152609c60205260408120805460019290612ae490849061578a565b90915550506001600160a01b0382166000908152609c60205260408120805460019290612b129084906155d7565b90915550506000818152609b602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061597f83398151915291a4505050565b60008083600f0b1215612b98576000612b7a8385615564565b9050600081600f0b13612b8e576000612b90565b805b915050610cbe565b5080610cbe565b60016000818152602082905260008051602061595f83398151915254909182918291612c0c916001600160401b0316600160281b82612bdf8260026156ed565b612be991906157a1565b6001600160281b81612bfc8260026156ed565b612c0691906157a1565b8b6137d1565b925092509250612c62838383876000600681819054906101000a90046001600160401b0316612c3a90615888565b91906101000a8154816001600160401b0302191690836001600160401b031602179055613f20565b612cd36001600160281b81612c788260026156ed565b612c8291906157a1565b600160281b888a600080600681819054906101000a90046001600160401b0316612cab90615888565b91906101000a8154816001600160401b0302191690836001600160401b031602179055614098565b5050505050565b60008083600f0b12612cff5781600f0b83600f0b13612cf957826123b8565b816123b8565b60009392505050565b6001600081905260205260008051602061595f833981519152546001600160801b03808316600160401b9092041610611b1e57611b1e6001600160281b81612d518260026156ed565b612d5b91906157a1565b600054600160281b90612d789060019065ffffffffffff166157a1565b8660016000600681819054906101000a90046001600160401b0316612cab90615888565b600254600090610100900460ff1615612dec578160ff166001148015612dc85750612dc63061448b565b155b612de45760405162461bcd60e51b8152600401610cf39061541d565b506000919050565b60025460ff808416911610612e135760405162461bcd60e51b8152600401610cf39061541d565b506002805460ff191660ff92909216919091179055600190565b919050565b600254610100900460ff16612e595760405162461bcd60e51b8152600401610cf3906154f1565b611be1336134e4565b600254610100900460ff16612e895760405162461bcd60e51b8152600401610cf3906154f1565b612150828261449a565b6000805465ffffffffffff1916600160281b178082556001600160401b03600160301b90910416906006612ec683615888565b91906101000a8154816001600160401b0302191690836001600160401b0316021790555050565b6101035465ffffffffffff831660009081526101046020526040812054909142918391612f2d916001600160401b03600160801b90920482169116615610565b9050806001600160401b0316826001600160401b03161015612f6d57612f5382826157c0565b604051633ca8f33960e11b8152600401610cf39190615550565b612f7e8565ffffffffffff1661192d565b6001600160a01b0316336001600160a01b031614612faf57604051633ce20b5960e11b815260040160405180910390fd5b65ffffffffffff8516600090815261010460209081526040822080546001600160401b0319166001600160401b0386161790556001918290525260008051602061595f83398151915254600160401b90046001600160801b031661301386866144e8565b93506001600160801b03841661303c57604051636180f03f60e11b815260040160405180910390fd5b60fd54613052906001600160801b031682615762565b6001600160801b0316846001600160801b0316111561308457604051636bac637f60e01b815260040160405180910390fd5b8565ffffffffffff16336001600160a01b03167f6cf9643c04552344f0a92825c122b0a19d0b217bbeec89f3444755e3899f854f866040516130c6919061553c565b60405180910390a350505092915050565b604080516000808252602082019092526001600160a01b0384169083906040516131019190615326565b60006040518083038185875af1925050503d806000811461313e576040519150601f19603f3d011682016040523d82523d6000602084013e613143565b606091505b5050905080610f795760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527308115512081d1c985b9cd9995c8819985a5b195960621b6064820152608401610cf3565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161320d9190615326565b6000604051808303816000865af19150503d806000811461324a576040519150601f19603f3d011682016040523d82523d6000602084013e61324f565b606091505b50915091508180156132795750805115806132795750808060200190518101906132799190615013565b612cd35760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201526c185b9cd9995c8819985a5b1959609a1b6064820152608401610cf3565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161333f9190615326565b6000604051808303816000865af19150503d806000811461337c576040519150601f19603f3d011682016040523d82523d6000602084013e613381565b606091505b50915091508180156133ab5750805115806133ab5750808060200190518101906133ab9190615013565b6134115760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604482015270185b9cd9995c919c9bdb4819985a5b1959607a1b6064820152608401610cf3565b505050505050565b610103546001600160801b03908116908216101561344a5760405163020dc2e560e11b815260040160405180910390fd5b600061345582614694565b9050613469338265ffffffffffff1661470a565b65ffffffffffff81166000818152610104602090815260409182902080546001600160401b031916426001600160401b031617905581516001600160801b03861681529081019290925233917f129b895f2d5ffd9cbe0e6ba0d46321043480cd64a12b74e27837e1996f2022c8910160405180910390a25050565b603580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000826001600160401b03168042106135625760405163d01b5e3360e01b815260040160405180910390fd5b6001600160801b03861661358957604051632d5f81b160e01b815260040160405180910390fd5b610102546101015460405163ee1fe2ad60e01b81526001600160a01b038b81166004830152918216602482015291169063ee1fe2ad90604401600060405180830381600087803b1580156135dc57600080fd5b505af11580156135f0573d6000803e3d6000fd5b50505050600061010260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561364557600080fd5b505afa158015613659573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061367d919061510f565b61010154604051630ab27d9d60e21b8152600481018b9052602481018390526001600160801b038a1660448201526001600160401b03808a16606483015287166084820152919250600091829182916001600160a01b0390911690632ac9f6749060a401606060405180830381600087803b1580156136fb57600080fd5b505af115801561370f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061373391906152ae565b925092506001600160401b031692508a848d6001600160a01b03167f0e82274c3d8662554689088578b0d17b20df89fa575433945eb7a3692261d7598c8e8888886040516137b99594939291906001600160401b039590951685526001600160801b03938416602086015260408501929092528216606084015216608082015260a00190565b60405180910390a450919a9950505050505050505050565b65ffffffffffff8416600090815260016020526040812054819081906001600160401b03808c169116101561380d5750899150879050866138e0565b8365ffffffffffff168765ffffffffffff1614156138325750829150849050836138e0565b6000600261384087896155ef565b61384a919061566c565b90508465ffffffffffff168765ffffffffffff161115801561387c57508065ffffffffffff168565ffffffffffff1611155b156138a75761389b888c89896138938460026156ed565b8c878c6137d1565b919550935091506138de565b6138d6888c89896138b98460026156ed565b6138c49060016155ef565b6138cf8760016155ef565b8c8c6137d1565b919550935091505b505b985098509895505050505050565b60008265ffffffffffff168665ffffffffffff16141561390f575080611e81565b600061391c8760026156ed565b9050600061392b8860026156ed565b6139369060016155ef565b65ffffffffffff8084166000908152600160205260408082205492841682528120549293506001600160801b03600160401b92839004811693919261397d920416836155d7565b905080613991576000945050505050611e81565b6000816139a7846001600160801b038a166156ce565b6139b19190615658565b9050600060026139c18b8d6155ef565b6139cb919061566c565b90508865ffffffffffff168b65ffffffffffff16111580156139fd57508065ffffffffffff168965ffffffffffff1611155b15613a1c57613a0f868c838c866138ee565b9650505050505050611e81565b613a0f85613a2b8360016155ef565b8c8c613a37878e615762565b6138ee565b610102546040516331a9108f60e11b81526004810183905260009133916001600160a01b0390911690636352211e9060240160206040518083038186803b158015613a8657600080fd5b505afa158015613a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613abe9190614dd7565b6001600160a01b031614613ae55760405163a2719f8360e01b815260040160405180910390fd5b61010254604051634bcf7bd160e01b81526004810184905260009182916001600160a01b0390911690634bcf7bd19060240160206040518083038186803b158015613b2f57600080fd5b505afa158015613b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b679190614dd7565b6001600160a01b031663fc8196d6856040518263ffffffff1660e01b8152600401613b9491815260200190565b6040805180830381600087803b158015613bad57600080fd5b505af1158015613bc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613be5919061502f565b9150915081613c0757604051630cd4fa1560e31b815260040160405180910390fd5b604080518581526001600160801b038316602082015233917fcdd174d2946f5f13d4bdf907373a5e731e1662bf10f0b65306ea360144a36a22910160405180910390a29392505050565b816001600160a01b0316836001600160a01b03161415613caf5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610cf3565b6001600160a01b038381166000818152609e6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613d278484846129cc565b613d3384848484614836565b61224a5760405162461bcd60e51b8152600401610cf3906153cb565b606081613d735750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613d9d5780613d8781615847565b9150613d969050600a83615658565b9150613d77565b6000816001600160401b03811115613dc557634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613def576020820181803683370190505b5090505b8415611d4c57613e0460018361578a565b9150613e11600a866158a5565b613e1c9060306155d7565b60f81b818381518110613e3f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350613e61600a86615658565b9450613df3565b6001600160a01b038316613ec357613ebe8160cd8054600083815260ce60205260408120829055600182018355919091527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0155565b613ee6565b816001600160a01b0316836001600160a01b031614613ee657613ee68382614947565b6001600160a01b038216613efd57610f79816149e4565b826001600160a01b0316826001600160a01b031614610f7957610f798282614abd565b8165ffffffffffff168565ffffffffffff161415613f3d57612cd3565b6000613f4a8660026156ed565b90506000613f598760026156ed565b613f649060016155ef565b65ffffffffffff808916600090815260016020526040808220548684168352818320549385168352908220549394506001600160801b03600160401b9182900481169493829004811693919091041690613fbe82846155d7565b905080613fd057505050505050612cd3565b600081613fe6856001600160801b0388166156ce565b613ff09190615658565b9050613ffd87828a614b01565b6140118661400b8388615762565b8a614b01565b6000600261401f8c8e6155ef565b614029919061566c565b90508965ffffffffffff168c65ffffffffffff161115801561405b57508065ffffffffffff168a65ffffffffffff1611155b156140725761406d888d838d8d613f20565b614089565b614089876140818360016155ef565b8d8d8d613f20565b50505050505050505050505050565b8465ffffffffffff168765ffffffffffff161480156140c657508365ffffffffffff168665ffffffffffff16145b806140e057508565ffffffffffff168765ffffffffffff16145b156140f6576140f188848484614b7a565b614481565b60006002614104888a6155ef565b61410e919061566c565b90508565ffffffffffff168865ffffffffffff161115801561414057508065ffffffffffff168665ffffffffffff1611155b15614444578465ffffffffffff168865ffffffffffff161115801561417557508065ffffffffffff168565ffffffffffff1611155b15614199576141946141888a60026156ed565b89838989898989614098565b614473565b60006001816141a98c60026156ed565b65ffffffffffff1681526020810191909152604001600090812054600160401b90046001600160801b0316915084156141e3576000614219565b6142196141f18c60026156ed565b6141fc9060016155ef565b6142078560016155ef565b8b6142138b60016155ef565b8d6123bf565b90506001600061422a8d60026156ed565b6142359060016155ef565b65ffffffffffff1681526020810191909152604001600020546001600160801b03600160401b909104811690821611156142ac5760405163251bd40f60e11b815265ffffffffffff808d166004830152808c166024830152808b166044830152808a1660648301528816608482015260a401610cf3565b6000816001826142bd8f60026156ed565b6142c89060016155ef565b65ffffffffffff1681526020810191909152604001600020546142fb9190600160401b90046001600160801b0316615762565b9050600061430982856155b5565b90506001600160801b038116614323575050505050614481565b600064e8d4a5100082614336828861569f565b6143409190615632565b61434a908b61569f565b6143549190615632565b90506143706143648f60026156ed565b8e888e8a868e8e614098565b886001600160801b0316816001600160801b031611156143f6578d8d8d8d8d8d866040516310eae2eb60e01b8152600401610cf3979695949392919065ffffffffffff978816815295871660208701529386166040860152918516606085015290931660808301526001600160801b0392831660a083015290911660c082015260e00190565b61443a6144048f60026156ed565b61440f9060016155ef565b61441a8860016155ef565b8e6144268a60016155ef565b8e868f6144339190615762565b8e8e614098565b5050505050614473565b6144736144528a60026156ed565b61445d9060016155ef565b6144688360016155ef565b898989898989614098565b61447f89858585614b7a565b505b5050505050505050565b6001600160a01b03163b151590565b600254610100900460ff166144c15760405162461bcd60e51b8152600401610cf3906154f1565b81516144d4906099906020850190614d0c565b508051610f7990609a906020840190614d0c565b65ffffffffffff82166000908152600160205260408120546001600160401b031661452657604051631b2862ff60e21b815260040160405180910390fd5b64e8d4a5100064ffffffffff8316111561455357604051635a60b01360e01b815260040160405180910390fd5b60016000818152602082905260008051602061595f833981519152549091829182916145c0916001600160401b0316600160281b826145938260026156ed565b61459d91906157a1565b6001600160281b816145b08260026156ed565b6145ba91906157a1565b8d6137d1565b9250925092506145ee838383896000600681819054906101000a90046001600160401b0316612c3a90615888565b65ffffffffffff861660009081526001602052604090205464e8d4a510009061462f9064ffffffffff881690600160401b90046001600160801b031661569f565b6146399190615632565b935061468b868560016000600681819054906101000a90046001600160401b031661466390615888565b91906101000a8154816001600160401b0302191690836001600160401b031602179055614cdc565b50505092915050565b600080546146c89065ffffffffffff81169084908490819060069061466390600160301b90046001600160401b0316615888565b506000805465ffffffffffff16908190806146e283615862565b91906101000a81548165ffffffffffff021916908365ffffffffffff16021790555050919050565b6001600160a01b0382166147605760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610cf3565b61476981612878565b156147b55760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610cf3565b6147c160008383613e68565b6001600160a01b0382166000908152609c602052604081208054600192906147ea9084906155d7565b90915550506000818152609b602052604080822080546001600160a01b0319166001600160a01b038616908117909155905183929060008051602061597f833981519152908290a45050565b600061484a846001600160a01b031661448b565b1561493f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614881903390899088908890600401615385565b602060405180830381600087803b15801561489b57600080fd5b505af19250505080156148cb575060408051601f3d908101601f191682019092526148c891810190615079565b60015b614925573d8080156148f9576040519150601f19603f3d011682016040523d82523d6000602084013e6148fe565b606091505b50805161491d5760405162461bcd60e51b8152600401610cf3906153cb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611d4c565b506001611d4c565b6000600161495484611b21565b61495e919061578a565b600083815260cc60205260409020549091508082146149b1576001600160a01b038416600090815260cb60209081526040808320858452825280832054848452818420819055835260cc90915290208190555b50600091825260cc602090815260408084208490556001600160a01b03909416835260cb81528383209183525290812055565b60cd546000906149f69060019061578a565b600083815260ce602052604081205460cd8054939450909284908110614a2c57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060cd8381548110614a5b57634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260ce909152604080822084905585825281205560cd805480614aa157634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000614ac883611b21565b6001600160a01b03909316600090815260cb60209081526040808320868452825280832085905593825260cc9052919091209190915550565b65ffffffffffff83166000908152600160205260409020546001600160801b03838116600160401b9092041614610f795765ffffffffffff8316600090815260016020526040902080546001600160801b038416600160401b026001600160c01b03199091166001600160401b03841617179055505050565b65ffffffffffff8416600090815260016020526040902080546001600160401b0319166001600160401b0383161790558115614c785765ffffffffffff84166000908152600160205260409020546001600160801b03600160401b90910481169084161115614c1557604051633de77d9960e11b815265ffffffffffff851660048201526001600160801b0384166024820152604401610cf3565b65ffffffffffff841660009081526001602052604090208054849190600890614c4f908490600160401b90046001600160801b0316615762565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555061224a565b65ffffffffffff841660009081526001602052604090208054849190600890614cb2908490600160401b90046001600160801b03166155b5565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555050505050565b614ce884848484614b7a565b8365ffffffffffff1660011461224a5761224a614d0485611f05565b848484614cdc565b828054614d189061580c565b90600052602060002090601f016020900481019282614d3a5760008555614d80565b82601f10614d5357805160ff1916838001178555614d80565b82800160010185558215614d80579182015b82811115614d80578251825591602001919060010190614d65565b50614d8c929150614d90565b5090565b5b80821115614d8c5760008155600101614d91565b803565ffffffffffff81168114612e2d57600080fd5b600060208284031215614dcc578081fd5b81356123b8816158fb565b600060208284031215614de8578081fd5b81516123b8816158fb565b60008060408385031215614e05578081fd5b8235614e10816158fb565b91506020830135614e20816158fb565b809150509250929050565b600080600060608486031215614e3f578081fd5b8335614e4a816158fb565b92506020840135614e5a816158fb565b929592945050506040919091013590565b60008060008060808587031215614e80578081fd5b8435614e8b816158fb565b93506020850135614e9b816158fb565b92506040850135915060608501356001600160401b0380821115614ebd578283fd5b818701915087601f830112614ed0578283fd5b813581811115614ee257614ee26158e5565b604051601f8201601f19908116603f01168101908382118183101715614f0a57614f0a6158e5565b816040528281528a6020848701011115614f22578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060408385031215614f55578182fd5b8235614f60816158fb565b91506020830135614e2081615910565b60008060408385031215614f82578182fd5b8235614f8d816158fb565b946020939093013593505050565b60008060008060008060c08789031215614fb3578182fd5b8635614fbe816158fb565b9550602087013594506040870135614fd581615934565b93506060870135614fe581615949565b92506080870135614ff581615949565b915060a087013561500581615949565b809150509295509295509295565b600060208284031215615024578081fd5b81516123b881615910565b60008060408385031215615041578182fd5b825161504c81615910565b6020840151909250614e2081615934565b60006020828403121561506e578081fd5b81356123b88161591e565b60006020828403121561508a578081fd5b81516123b88161591e565b6000602082840312156150a6578081fd5b81356123b881615934565b6000806000606084860312156150c5578081fd5b83356150d081615934565b925060208401356150e081615934565b91506150ee60408501614da5565b90509250925092565b600060208284031215615108578081fd5b5035919050565b600060208284031215615120578081fd5b5051919050565b600080600080600060a0868803121561513e578283fd5b85359450602086013561515081615934565b9350604086013561516081615949565b9250606086013561517081615949565b9150608086013561518081615949565b809150509295509295909350565b600080600080608085870312156151a3578182fd5b8435935060208501356151b581615949565b925060408501356151c581615949565b915060608501356151d581615949565b939692955090935050565b6000602082840312156151f1578081fd5b6123b882614da5565b6000806040838503121561520c578182fd5b61521583614da5565b9150602083013564ffffffffff81168114614e20578182fd5b600080600080600060a08688031215615245578283fd5b61524e86614da5565b945061525c60208701614da5565b935061526a60408701614da5565b925061527860608701614da5565b915061528660808701614da5565b90509295509295909350565b6000602082840312156152a3578081fd5b81356123b881615949565b6000806000606084860312156152c2578081fd5b83516152cd81615949565b60208501519093506152de81615934565b60408501519092506152ef81615934565b809150509250925092565b600081518084526153128160208601602086016157e0565b601f01601f19169290920160200192915050565b600082516153388184602087016157e0565b9190910192915050565b600083516153548184602088016157e0565b8351908301906153688183602088016157e0565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061220e908301846152fa565b6020815260006123b860208301846152fa565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160801b0391909116815260200190565b6001600160401b0391909116815260200190565b6000600f82810b9084900b828212801560016001607f1b038490038313161561558f5761558f6158b9565b60016001607f1b031983900382128116156155ac576155ac6158b9565b50019392505050565b60006001600160801b03828116848216808303821115615368576153686158b9565b600082198211156155ea576155ea6158b9565b500190565b600065ffffffffffff808316818516808303821115615368576153686158b9565b60006001600160401b03828116848216808303821115615368576153686158b9565b60006001600160801b038381168061564c5761564c6158cf565b92169190910492915050565b600082615667576156676158cf565b500490565b600065ffffffffffff8084168061564c5761564c6158cf565b60006001600160401b038381168061564c5761564c6158cf565b60006001600160801b03828116848216811515828404821116156156c5576156c56158b9565b02949350505050565b60008160001904831182151516156156e8576156e86158b9565b500290565b600065ffffffffffff808316818516818304811182151516156156c5576156c56158b9565b6000600f82810b9084900b828112801560016001607f1b031983018412161561573d5761573d6158b9565b60016001607f1b0382018313811615615758576157586158b9565b5090039392505050565b60006001600160801b0383811690831681811015615782576157826158b9565b039392505050565b60008282101561579c5761579c6158b9565b500390565b600065ffffffffffff83811690831681811015615782576157826158b9565b60006001600160401b0383811690831681811015615782576157826158b9565b60005b838110156157fb5781810151838201526020016157e3565b8381111561224a5750506000910152565b600181811c9082168061582057607f821691505b6020821081141561584157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561585b5761585b6158b9565b5060010190565b600065ffffffffffff8083168181141561587e5761587e6158b9565b6001019392505050565b60006001600160401b038281168082141561587e5761587e6158b9565b6000826158b4576158b46158cf565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611b1e57600080fd5b8015158114611b1e57600080fd5b6001600160e01b031981168114611b1e57600080fd5b6001600160801b0381168114611b1e57600080fd5b6001600160401b0381168114611b1e57600080fdfecc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220fd647c6a653f9e5e38d35004c73d6627381883fc4daa2468d4ae34787148113464736f6c63430008040033

Deployed ByteCode

0x6080604052600436106103035760003560e01c806301ffc9a714610338578063038befa21461036d57806306fdde031461038d578063081812fc146103af578063095222a8146103dc578063095ea7b3146104105780630e1da6c31461043057806312a948ca1461045e57806318160ddd1461047e5780631b3ed7221461049d57806323b872dd146104c45780632589867d146104e45780632957b839146105235780632f745c591461054a57806337030c521461056a5780633df036701461058a57806341f25124146105b257806342842e0e146105da578063485cc955146105fa5780634f6ccce71461061a57806350b87a4e1461063a57806359bf5d391461065a5780635b4e08e5146106965780636333edae146106b65780636352211e146106d657806365715c56146106f65780636b4264961461072c578063709e99521461074157806370a0823114610761578063715018a6146107815780637580bff11461079657806375fcb1b3146107b65780637adb4a7f146107be5780637f4270c1146107d15780638164b4d6146107f15780638cceabb6146108115780638da5cb5b146108315780638e426460146108465780638e8dc736146108665780638f34393d146108865780639207c4af146108a657806395d89b41146108c75780639acbb4f9146108dc5780639c15d1a2146109115780639d7f4f2614610939578063a22cb46514610954578063ae9f987b14610974578063b21c793514610994578063b2cf4612146109b4578063b4398244146109d4578063b88d4fde146109f4578063be559f7a14610a14578063bfcf04cf14610a29578063c39f75c114610a50578063c87b56dd14610a70578063cbe2882314610a90578063cd6072e614610ab0578063d2a382b214610b1f578063d66add0614610b3f578063e7324cc214610b5f578063e985e9c514610b7f578063f021b78414610b9f578063f075274014610bc0578063f1eb984014610bf7578063f2f4eb2614610c17578063f2fde38b14610c38578063f9cd3ceb14610c58578063fc0c546a14610c7857600080fd5b3661033357610100546001600160a01b0316331461033157634e487b7160e01b600052600160045260246000fd5b005b600080fd5b34801561034457600080fd5b5061035861035336600461505d565b610c99565b60405190151581526020015b60405180910390f35b34801561037957600080fd5b50610331610388366004614dbb565b610cc4565b34801561039957600080fd5b506103a2610d53565b60405161036491906153b8565b3480156103bb57600080fd5b506103cf6103ca3660046150f7565b610de5565b6040516103649190615371565b3480156103e857600080fd5b5060fd5461040390600160801b90046001600160801b031681565b604051610364919061553c565b34801561041c57600080fd5b5061033161042b366004614f70565b610e6d565b34801561043c57600080fd5b5061010654610451906001600160401b031681565b6040516103649190615550565b34801561046a57600080fd5b5060ff54610403906001600160801b031681565b34801561048a57600080fd5b5060cd545b604051908152602001610364565b3480156104a957600080fd5b5060ff5461045190600160801b90046001600160401b031681565b3480156104d057600080fd5b506103316104df366004614e2b565b610f7e565b3480156104f057600080fd5b506105046104ff3660046150f7565b610faf565b6040805192151583526001600160801b03909116602083015201610364565b34801561052f57600080fd5b5060fe5461040390600160801b90046001600160801b031681565b34801561055657600080fd5b5061048f610565366004614f70565b6110b6565b34801561057657600080fd5b506103316105853660046150b1565b61114c565b34801561059657600080fd5b506101065461045190600160401b90046001600160401b031681565b3480156105be57600080fd5b506101065461045190600160801b90046001600160401b031681565b3480156105e657600080fd5b506103316105f5366004614e2b565b6114aa565b34801561060657600080fd5b50610331610615366004614df3565b6114c5565b34801561062657600080fd5b5061048f6106353660046150f7565b611658565b34801561064657600080fd5b506103316106553660046151fa565b6116f9565b34801561066657600080fd5b506001600081905260205260008051602061595f83398151915254600160401b90046001600160801b0316610403565b3480156106a257600080fd5b506103586106b1366004615095565b61177c565b3480156106c257600080fd5b506103316106d1366004614dbb565b611802565b3480156106e257600080fd5b506103cf6106f13660046150f7565b61192d565b34801561070257600080fd5b506000546107159065ffffffffffff1681565b60405165ffffffffffff9091168152602001610364565b34801561073857600080fd5b506103316119a4565b34801561074d57600080fd5b5061033161075c366004615095565b611af3565b34801561076d57600080fd5b5061048f61077c366004614dbb565b611b21565b34801561078d57600080fd5b50610331611ba8565b3480156107a257600080fd5b506103316107b1366004615095565b611be3565b610331611c5c565b61048f6107cc36600461518e565b611ccf565b3480156107dd57600080fd5b506104036107ec3660046151e0565b611d54565b3480156107fd57600080fd5b5061033161080c366004615095565b611e8a565b34801561081d57600080fd5b5061071561082c3660046151e0565b611f05565b34801561083d57600080fd5b506103cf611f2b565b34801561085257600080fd5b50610331610861366004614dbb565b611f3a565b34801561087257600080fd5b50610331610881366004615292565b61204a565b34801561089257600080fd5b506103316108a13660046150f7565b6120ce565b3480156108b257600080fd5b5061010354610403906001600160801b031681565b3480156108d357600080fd5b506103a2612154565b3480156108e857600080fd5b50610105546108fe90600160801b9004600f0b81565b604051600f9190910b8152602001610364565b34801561091d57600080fd5b506101035461045190600160801b90046001600160401b031681565b34801561094557600080fd5b50610105546108fe90600f0b81565b34801561096057600080fd5b5061033161096f366004614f43565b612163565b34801561098057600080fd5b5061048f61098f366004614f9b565b61216e565b3480156109a057600080fd5b506103316109af3660046150f7565b6121ac565b3480156109c057600080fd5b5061048f6109cf366004615127565b6121db565b3480156109e057600080fd5b5060fd54610403906001600160801b031681565b348015610a0057600080fd5b50610331610a0f366004614e6b565b612218565b348015610a2057600080fd5b50610715612250565b348015610a3557600080fd5b5060005461045190600160301b90046001600160401b031681565b348015610a5c57600080fd5b50610331610a6b366004615095565b61226d565b348015610a7c57600080fd5b506103a2610a8b3660046150f7565b6122e7565b348015610a9c57600080fd5b50610403610aab36600461522e565b6123bf565b348015610abc57600080fd5b50610af8610acb3660046151e0565b6001602052600090815260409020546001600160401b03811690600160401b90046001600160801b031682565b604080516001600160401b0390931683526001600160801b03909116602083015201610364565b348015610b2b57600080fd5b50610331610b3a366004615292565b612584565b348015610b4b57600080fd5b50610331610b5a366004615095565b6125ff565b348015610b6b57600080fd5b50610331610b7a3660046151fa565b612679565b348015610b8b57600080fd5b50610358610b9a366004614df3565b6126a9565b348015610bab57600080fd5b50610102546103cf906001600160a01b031681565b348015610bcc57600080fd5b50610451610bdb3660046151e0565b610104602052600090815260409020546001600160401b031681565b348015610c0357600080fd5b50610331610c12366004615095565b6126d7565b348015610c2357600080fd5b50610101546103cf906001600160a01b031681565b348015610c4457600080fd5b50610331610c53366004614dbb565b61278b565b348015610c6457600080fd5b5060fe54610403906001600160801b031681565b348015610c8457600080fd5b50610100546103cf906001600160a01b031681565b60006001600160e01b0319821663780e9d6360e01b1480610cbe5750610cbe82612828565b92915050565b33610ccd611f2b565b6001600160a01b031614610cfc5760405162461bcd60e51b8152600401610cf39061546b565b60405180910390fd5b61010280546001600160a01b0319166001600160a01b0383161790556040517f1337ea29b8a93bfba10fa82a7a5db3c29932a92f4b6ecc34fe6d9888e0525f8e90610d48908390615371565b60405180910390a150565b606060998054610d629061580c565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8e9061580c565b8015610ddb5780601f10610db057610100808354040283529160200191610ddb565b820191906000526020600020905b815481529060010190602001808311610dbe57829003601f168201915b5050505050905090565b6000610df082612878565b610e515760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610cf3565b506000908152609d60205260409020546001600160a01b031690565b6000610e788261192d565b9050806001600160a01b0316836001600160a01b03161415610ee65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610cf3565b336001600160a01b0382161480610f025750610f0281336126a9565b610f6f5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610cf3565b610f798383612895565b505050565b610f883382612903565b610fa45760405162461bcd60e51b8152600401610cf3906154a0565b610f798383836129cc565b61010254604051634bcf7bd160e01b81526004810183905260009182916001600160a01b0390911690634bcf7bd19060240160206040518083038186803b158015610ff957600080fd5b505afa15801561100d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110319190614dd7565b6001600160a01b0316632589867d846040518263ffffffff1660e01b815260040161105e91815260200190565b604080518083038186803b15801561107557600080fd5b505afa158015611089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ad919061502f565b91509150915091565b60006110c183611b21565b82106111235760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610cf3565b506001600160a01b0391909116600090815260cb60209081526040808320938352929052205490565b610101546001600160a01b0316331461117857604051636e4b6fef60e11b815260040160405180910390fd5b826001600160801b0316826001600160801b031611156112f557600061119e8484615762565b60ff5460fe54919250600091600160801b9091046001600160401b0316906111cf906001600160801b03168461569f565b6111d99190615632565b60ff5460fe54919250600091600160801b918290046001600160401b03169161120c91046001600160801b03168561569f565b6112169190615632565b610105549091506112609061122e90600f0b83612b61565b6101055461124690600160801b9004600f0b85612b61565b61125091906155b5565b61125a9085615762565b85612b9f565b6101058054839190601090611280908490600160801b9004600f0b615564565b92506101000a8154816001600160801b030219169083600f0b6001600160801b031602179055508061010560008282829054906101000a9004600f0b6112c69190615564565b92506101000a8154816001600160801b030219169083600f0b6001600160801b0316021790555050505061146e565b60006113018385615762565b6001600160801b0316111561146e57600061131c8385615762565b60ff5460fe54919250600091600160801b9091046001600160401b03169061134d906001600160801b03168461569f565b6113579190615632565b60ff5460fe54919250600091600160801b918290046001600160401b03169161138a91046001600160801b03168561569f565b6113949190615632565b610105549091506113dd906113ac90600f0b83612cda565b610105546113c490600160801b9004600f0b85612cda565b6113ce91906155b5565b6113d89085615762565b612d08565b61010580548391906010906113fd908490600160801b9004600f0b615712565b92506101000a8154816001600160801b030219169083600f0b6001600160801b031602179055508061010560008282829054906101000a9004600f0b6114439190615712565b92506101000a8154816001600160801b030219169083600f0b6001600160801b031602179055505050505b60fd546114859084906001600160801b0316615762565b60fd80546001600160801b0319166001600160801b0392909216919091179055505050565b610f7983838360405180602001604052806000815250612218565b60006114d16001612d9c565b905080156114e9576002805461ff0019166101001790555b6001600160a01b03831661151057604051635079ff7560e11b815260040160405180910390fd5b611518612e32565b61156a6040518060400160405280601281526020017120bd3ab9379026281027232a103a37b5b2b760711b81525060405180604001604052806006815260200165262816a0ad2960d11b815250612e62565b611572612e93565b61010080546001600160a01b038086166001600160a01b03199283161790925561010280549285169290911691909117905560ff8054621dcd6560891b600160801b600160c01b0319909116179081905562989680620aba9560871b0160fe556115ee90600290600160801b90046001600160401b0316615685565b60ff80546001600160801b0319166001600160401b03929092169190911790558015610f79576002805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b600061166360cd5490565b82106116c65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610cf3565b60cd82815481106116e757634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b60006117058383612eed565b61010054604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d9061173790849060040161553c565b600060405180830381600087803b15801561175157600080fd5b505af1158015611765573d6000803e3d6000fd5b50505050610f7933826001600160801b03166130d7565b60ff546001600081815260209190915260008051602061595f8339815191525490916001600160401b03600160801b820416916117cc916001600160801b03600160401b9092048216911661569f565b6117d69190615632565b60fd546001600160801b03918216916117f1918591166155b5565b6001600160801b0316111592915050565b610101546001600160a01b0316331461182e57604051636e4b6fef60e11b815260040160405180910390fd5b610105546000600160801b909104600f90810b900b136118615760405163063440c760e51b815260040160405180910390fd5b610106546001600160401b038082169161188491600160801b909104164261578a565b10156118c557610106546118ab906001600160401b0380821691600160801b900416615610565b6040516318789e3d60e21b8152600401610cf39190615550565b61010054610105546118f5916001600160a01b0316908390600160801b9004600f0b6001600160801b03166131b1565b5061010580546001600160801b031690556101068054600160801b600160c01b031916600160801b426001600160401b031602179055565b6000818152609b60205260408120546001600160a01b031680610cbe5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610cf3565b60fd54600160801b90046001600160801b031615611a175760fd546101058054600160801b9092046001600160801b0316916000906119e7908490600f0b615564565b82546101009290920a6001600160801b0381810219909316600f9290920b8316021790915560fd80549091169055505b610105546000600f91820b90910b13611a4357604051633609559b60e01b815260040160405180910390fd5b610106546001600160401b0380821691611a6691600160401b909104164261578a565b1015611a8d57610106546118ab906001600160401b0380821691600160401b900416615610565b61010054611abb906001600160a01b0316611aa6611f2b565b61010554600f0b6001600160801b03166131b1565b61010580546001600160801b03191690556101068054600160401b600160801b031916600160401b426001600160401b031602179055565b61010054611b15906001600160a01b031633306001600160801b0385166132db565b611b1e81613419565b50565b60006001600160a01b038216611b8c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610cf3565b506001600160a01b03166000908152609c602052604090205490565b33611bb1611f2b565b6001600160a01b031614611bd75760405162461bcd60e51b8152600401610cf39061546b565b611be160006134e4565b565b33611bec611f2b565b6001600160a01b031614611c125760405162461bcd60e51b8152600401610cf39061546b565b60fe80546001600160801b03808416600160801b0291161790556040517f1c083321f81cfff52c5813078d0f9eb48d6dcea0e8b6fe917ccd6f10e0eb1b4890610d4890839061553c565b61010060009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611cad57600080fd5b505af1158015611cc1573d6000803e3d6000fd5b5050505050611be134613419565b600061010060009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b5050505050611d49338634878787613536565b90505b949350505050565b6000600160281b65ffffffffffff83161080611d9957506001611d7c600160281b60026156ed565b611d8691906157a1565b65ffffffffffff168265ffffffffffff16115b15611da657506000919050565b65ffffffffffff82166000908152600160205260409020546001600160401b0316611dd357506000919050565b60016000818152602082905260008051602061595f83398151915254909182918291611e40916001600160401b0316600160281b82611e138260026156ed565b611e1d91906157a1565b6001600160281b81611e308260026156ed565b611e3a91906157a1565b8c6137d1565b65ffffffffffff83166000908152600160205260409020549295509093509150611e81908490849084908990600160401b90046001600160801b03166138ee565b95945050505050565b33611e93611f2b565b6001600160a01b031614611eb95760405162461bcd60e51b8152600401610cf39061546b565b61010380546001600160801b0319166001600160801b0383161790556040517f483032c7f41f1ba71455a09f574b92ba07ae933719975978f96f457d4c1c98d390610d4890839061553c565b60008165ffffffffffff1660011415611f2057506001919050565b610cbe60028361566c565b6035546001600160a01b031690565b33611f43611f2b565b6001600160a01b031614611f695760405162461bcd60e51b8152600401610cf39061546b565b610101546001600160a01b031615801590612009575061010160009054906101000a90046001600160a01b03166001600160a01b0316634108fdf06040518163ffffffff1660e01b815260040160206040518083038186803b158015611fce57600080fd5b505afa158015611fe2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612006919061510f565b15155b156120275760405163ccb0a51b60e01b815260040160405180910390fd5b61010180546001600160a01b0319166001600160a01b0392909216919091179055565b33612053611f2b565b6001600160a01b0316146120795760405162461bcd60e51b8152600401610cf39061546b565b6101038054600160801b600160c01b031916600160801b6001600160401b038416021790556040517f527dd140711eb0a9177d62725055c7fe5eb62351eabf406fd3f80886ba57ea3090610d48908390615550565b60006120d982613a3c565b61010054604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d9061210b90849060040161553c565b600060405180830381600087803b15801561212557600080fd5b505af1158015612139573d6000803e3d6000fd5b5050505061215033826001600160801b03166130d7565b5050565b6060609a8054610d629061580c565b612150338383613c51565b61010054600090612193906001600160a01b031633306001600160801b0389166132db565b6121a1878787878787613536565b979650505050505050565b60006121b782613a3c565b61010054909150612150906001600160a01b0316336001600160801b0384166131b1565b61010054600090612200906001600160a01b031633306001600160801b0389166132db565b61220e338787878787613536565b9695505050505050565b6122223383612903565b61223e5760405162461bcd60e51b8152600401610cf3906154a0565b61224a84848484613d1c565b50505050565b600080546122689060019065ffffffffffff166157a1565b905090565b33612276611f2b565b6001600160a01b03161461229c5760405162461bcd60e51b8152600401610cf39061546b565b60fe80546001600160801b0319166001600160801b0383161790556040517f7d845f2c3b711085c4075e46d135e9072fd7b01eb4696591029422109d91f99990610d4890839061553c565b60606122f282612878565b6123565760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610cf3565b600061236d60408051602081019091526000815290565b9050600081511161238d57604051806020016040528060008152506123b8565b8061239784613d4f565b6040516020016123a8929190615342565b6040516020818303038152906040525b9392505050565b60008265ffffffffffff168565ffffffffffff161480156123ef57508165ffffffffffff168465ffffffffffff16145b8061240957508365ffffffffffff168565ffffffffffff16145b1561243c575065ffffffffffff8516600090815260016020526040902054600160401b90046001600160801b0316611e81565b6000600261244a86886155ef565b612454919061566c565b90508365ffffffffffff168665ffffffffffff161115801561248657508065ffffffffffff168465ffffffffffff1611155b15612541578265ffffffffffff168665ffffffffffff16111580156124bb57508065ffffffffffff168365ffffffffffff1611155b156124e8576124d76124ce8860026156ed565b878387876123bf565b6124e190836155b5565b915061257a565b6124ff6124f68860026156ed565b878387856123bf565b61250990836155b5565b91506124d76125198860026156ed565b6125249060016155ef565b61252f8360016155ef565b8761253b8560016155ef565b876123bf565b61256d61254f8860026156ed565b61255a9060016155ef565b6125658360016155ef565b8787876123bf565b61257790836155b5565b91505b5095945050505050565b3361258d611f2b565b6001600160a01b0316146125b35760405162461bcd60e51b8152600401610cf39061546b565b61010680546001600160401b0319166001600160401b0383161790556040517f27cd37fc700f6b98651e78d699d1bcc11b859e18a8ab4948c58dbfa51572e0c990610d48908390615550565b33612608611f2b565b6001600160a01b03161461262e5760405162461bcd60e51b8152600401610cf39061546b565b60ff80546001600160801b0319166001600160801b0383161790556040517fb487f1ce89894e59e154350ff5aa3ec4c41baf284cafd0baae6d3d1113c3b65090610d4890839061553c565b60006126858383612eed565b61010054909150610f79906001600160a01b0316336001600160801b0384166131b1565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b610101546001600160a01b0316331461270357604051636e4b6fef60e11b815260040160405180910390fd5b60fd80548291906000906127219084906001600160801b03166155b5565b82546101009290920a6001600160801b038181021990931691831602179091556001600081905260205260008051602061595f8339815191525460fd54600160401b9091048216911611159050611b1e5760405163c6c13aa760e01b815260040160405180910390fd5b33612794611f2b565b6001600160a01b0316146127ba5760405162461bcd60e51b8152600401610cf39061546b565b6001600160a01b03811661281f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610cf3565b611b1e816134e4565b60006001600160e01b031982166380ac58cd60e01b148061285957506001600160e01b03198216635b5e139f60e01b145b80610cbe57506301ffc9a760e01b6001600160e01b0319831614610cbe565b6000908152609b60205260409020546001600160a01b0316151590565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906128ca8261192d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061290e82612878565b61296f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610cf3565b600061297a8361192d565b9050806001600160a01b0316846001600160a01b031614806129a157506129a181856126a9565b80611d4c5750836001600160a01b03166129ba84610de5565b6001600160a01b031614949350505050565b826001600160a01b03166129df8261192d565b6001600160a01b031614612a435760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610cf3565b6001600160a01b038216612aa55760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610cf3565b612ab0838383613e68565b612abb600082612895565b6001600160a01b0383166000908152609c60205260408120805460019290612ae490849061578a565b90915550506001600160a01b0382166000908152609c60205260408120805460019290612b129084906155d7565b90915550506000818152609b602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061597f83398151915291a4505050565b60008083600f0b1215612b98576000612b7a8385615564565b9050600081600f0b13612b8e576000612b90565b805b915050610cbe565b5080610cbe565b60016000818152602082905260008051602061595f83398151915254909182918291612c0c916001600160401b0316600160281b82612bdf8260026156ed565b612be991906157a1565b6001600160281b81612bfc8260026156ed565b612c0691906157a1565b8b6137d1565b925092509250612c62838383876000600681819054906101000a90046001600160401b0316612c3a90615888565b91906101000a8154816001600160401b0302191690836001600160401b031602179055613f20565b612cd36001600160281b81612c788260026156ed565b612c8291906157a1565b600160281b888a600080600681819054906101000a90046001600160401b0316612cab90615888565b91906101000a8154816001600160401b0302191690836001600160401b031602179055614098565b5050505050565b60008083600f0b12612cff5781600f0b83600f0b13612cf957826123b8565b816123b8565b60009392505050565b6001600081905260205260008051602061595f833981519152546001600160801b03808316600160401b9092041610611b1e57611b1e6001600160281b81612d518260026156ed565b612d5b91906157a1565b600054600160281b90612d789060019065ffffffffffff166157a1565b8660016000600681819054906101000a90046001600160401b0316612cab90615888565b600254600090610100900460ff1615612dec578160ff166001148015612dc85750612dc63061448b565b155b612de45760405162461bcd60e51b8152600401610cf39061541d565b506000919050565b60025460ff808416911610612e135760405162461bcd60e51b8152600401610cf39061541d565b506002805460ff191660ff92909216919091179055600190565b919050565b600254610100900460ff16612e595760405162461bcd60e51b8152600401610cf3906154f1565b611be1336134e4565b600254610100900460ff16612e895760405162461bcd60e51b8152600401610cf3906154f1565b612150828261449a565b6000805465ffffffffffff1916600160281b178082556001600160401b03600160301b90910416906006612ec683615888565b91906101000a8154816001600160401b0302191690836001600160401b0316021790555050565b6101035465ffffffffffff831660009081526101046020526040812054909142918391612f2d916001600160401b03600160801b90920482169116615610565b9050806001600160401b0316826001600160401b03161015612f6d57612f5382826157c0565b604051633ca8f33960e11b8152600401610cf39190615550565b612f7e8565ffffffffffff1661192d565b6001600160a01b0316336001600160a01b031614612faf57604051633ce20b5960e11b815260040160405180910390fd5b65ffffffffffff8516600090815261010460209081526040822080546001600160401b0319166001600160401b0386161790556001918290525260008051602061595f83398151915254600160401b90046001600160801b031661301386866144e8565b93506001600160801b03841661303c57604051636180f03f60e11b815260040160405180910390fd5b60fd54613052906001600160801b031682615762565b6001600160801b0316846001600160801b0316111561308457604051636bac637f60e01b815260040160405180910390fd5b8565ffffffffffff16336001600160a01b03167f6cf9643c04552344f0a92825c122b0a19d0b217bbeec89f3444755e3899f854f866040516130c6919061553c565b60405180910390a350505092915050565b604080516000808252602082019092526001600160a01b0384169083906040516131019190615326565b60006040518083038185875af1925050503d806000811461313e576040519150601f19603f3d011682016040523d82523d6000602084013e613143565b606091505b5050905080610f795760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527308115512081d1c985b9cd9995c8819985a5b195960621b6064820152608401610cf3565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283929087169161320d9190615326565b6000604051808303816000865af19150503d806000811461324a576040519150601f19603f3d011682016040523d82523d6000602084013e61324f565b606091505b50915091508180156132795750805115806132795750808060200190518101906132799190615013565b612cd35760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201526c185b9cd9995c8819985a5b1959609a1b6064820152608401610cf3565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161333f9190615326565b6000604051808303816000865af19150503d806000811461337c576040519150601f19603f3d011682016040523d82523d6000602084013e613381565b606091505b50915091508180156133ab5750805115806133ab5750808060200190518101906133ab9190615013565b6134115760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604482015270185b9cd9995c919c9bdb4819985a5b1959607a1b6064820152608401610cf3565b505050505050565b610103546001600160801b03908116908216101561344a5760405163020dc2e560e11b815260040160405180910390fd5b600061345582614694565b9050613469338265ffffffffffff1661470a565b65ffffffffffff81166000818152610104602090815260409182902080546001600160401b031916426001600160401b031617905581516001600160801b03861681529081019290925233917f129b895f2d5ffd9cbe0e6ba0d46321043480cd64a12b74e27837e1996f2022c8910160405180910390a25050565b603580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000826001600160401b03168042106135625760405163d01b5e3360e01b815260040160405180910390fd5b6001600160801b03861661358957604051632d5f81b160e01b815260040160405180910390fd5b610102546101015460405163ee1fe2ad60e01b81526001600160a01b038b81166004830152918216602482015291169063ee1fe2ad90604401600060405180830381600087803b1580156135dc57600080fd5b505af11580156135f0573d6000803e3d6000fd5b50505050600061010260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561364557600080fd5b505afa158015613659573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061367d919061510f565b61010154604051630ab27d9d60e21b8152600481018b9052602481018390526001600160801b038a1660448201526001600160401b03808a16606483015287166084820152919250600091829182916001600160a01b0390911690632ac9f6749060a401606060405180830381600087803b1580156136fb57600080fd5b505af115801561370f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061373391906152ae565b925092506001600160401b031692508a848d6001600160a01b03167f0e82274c3d8662554689088578b0d17b20df89fa575433945eb7a3692261d7598c8e8888886040516137b99594939291906001600160401b039590951685526001600160801b03938416602086015260408501929092528216606084015216608082015260a00190565b60405180910390a450919a9950505050505050505050565b65ffffffffffff8416600090815260016020526040812054819081906001600160401b03808c169116101561380d5750899150879050866138e0565b8365ffffffffffff168765ffffffffffff1614156138325750829150849050836138e0565b6000600261384087896155ef565b61384a919061566c565b90508465ffffffffffff168765ffffffffffff161115801561387c57508065ffffffffffff168565ffffffffffff1611155b156138a75761389b888c89896138938460026156ed565b8c878c6137d1565b919550935091506138de565b6138d6888c89896138b98460026156ed565b6138c49060016155ef565b6138cf8760016155ef565b8c8c6137d1565b919550935091505b505b985098509895505050505050565b60008265ffffffffffff168665ffffffffffff16141561390f575080611e81565b600061391c8760026156ed565b9050600061392b8860026156ed565b6139369060016155ef565b65ffffffffffff8084166000908152600160205260408082205492841682528120549293506001600160801b03600160401b92839004811693919261397d920416836155d7565b905080613991576000945050505050611e81565b6000816139a7846001600160801b038a166156ce565b6139b19190615658565b9050600060026139c18b8d6155ef565b6139cb919061566c565b90508865ffffffffffff168b65ffffffffffff16111580156139fd57508065ffffffffffff168965ffffffffffff1611155b15613a1c57613a0f868c838c866138ee565b9650505050505050611e81565b613a0f85613a2b8360016155ef565b8c8c613a37878e615762565b6138ee565b610102546040516331a9108f60e11b81526004810183905260009133916001600160a01b0390911690636352211e9060240160206040518083038186803b158015613a8657600080fd5b505afa158015613a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613abe9190614dd7565b6001600160a01b031614613ae55760405163a2719f8360e01b815260040160405180910390fd5b61010254604051634bcf7bd160e01b81526004810184905260009182916001600160a01b0390911690634bcf7bd19060240160206040518083038186803b158015613b2f57600080fd5b505afa158015613b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b679190614dd7565b6001600160a01b031663fc8196d6856040518263ffffffff1660e01b8152600401613b9491815260200190565b6040805180830381600087803b158015613bad57600080fd5b505af1158015613bc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613be5919061502f565b9150915081613c0757604051630cd4fa1560e31b815260040160405180910390fd5b604080518581526001600160801b038316602082015233917fcdd174d2946f5f13d4bdf907373a5e731e1662bf10f0b65306ea360144a36a22910160405180910390a29392505050565b816001600160a01b0316836001600160a01b03161415613caf5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610cf3565b6001600160a01b038381166000818152609e6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613d278484846129cc565b613d3384848484614836565b61224a5760405162461bcd60e51b8152600401610cf3906153cb565b606081613d735750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613d9d5780613d8781615847565b9150613d969050600a83615658565b9150613d77565b6000816001600160401b03811115613dc557634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613def576020820181803683370190505b5090505b8415611d4c57613e0460018361578a565b9150613e11600a866158a5565b613e1c9060306155d7565b60f81b818381518110613e3f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350613e61600a86615658565b9450613df3565b6001600160a01b038316613ec357613ebe8160cd8054600083815260ce60205260408120829055600182018355919091527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0155565b613ee6565b816001600160a01b0316836001600160a01b031614613ee657613ee68382614947565b6001600160a01b038216613efd57610f79816149e4565b826001600160a01b0316826001600160a01b031614610f7957610f798282614abd565b8165ffffffffffff168565ffffffffffff161415613f3d57612cd3565b6000613f4a8660026156ed565b90506000613f598760026156ed565b613f649060016155ef565b65ffffffffffff808916600090815260016020526040808220548684168352818320549385168352908220549394506001600160801b03600160401b9182900481169493829004811693919091041690613fbe82846155d7565b905080613fd057505050505050612cd3565b600081613fe6856001600160801b0388166156ce565b613ff09190615658565b9050613ffd87828a614b01565b6140118661400b8388615762565b8a614b01565b6000600261401f8c8e6155ef565b614029919061566c565b90508965ffffffffffff168c65ffffffffffff161115801561405b57508065ffffffffffff168a65ffffffffffff1611155b156140725761406d888d838d8d613f20565b614089565b614089876140818360016155ef565b8d8d8d613f20565b50505050505050505050505050565b8465ffffffffffff168765ffffffffffff161480156140c657508365ffffffffffff168665ffffffffffff16145b806140e057508565ffffffffffff168765ffffffffffff16145b156140f6576140f188848484614b7a565b614481565b60006002614104888a6155ef565b61410e919061566c565b90508565ffffffffffff168865ffffffffffff161115801561414057508065ffffffffffff168665ffffffffffff1611155b15614444578465ffffffffffff168865ffffffffffff161115801561417557508065ffffffffffff168565ffffffffffff1611155b15614199576141946141888a60026156ed565b89838989898989614098565b614473565b60006001816141a98c60026156ed565b65ffffffffffff1681526020810191909152604001600090812054600160401b90046001600160801b0316915084156141e3576000614219565b6142196141f18c60026156ed565b6141fc9060016155ef565b6142078560016155ef565b8b6142138b60016155ef565b8d6123bf565b90506001600061422a8d60026156ed565b6142359060016155ef565b65ffffffffffff1681526020810191909152604001600020546001600160801b03600160401b909104811690821611156142ac5760405163251bd40f60e11b815265ffffffffffff808d166004830152808c166024830152808b166044830152808a1660648301528816608482015260a401610cf3565b6000816001826142bd8f60026156ed565b6142c89060016155ef565b65ffffffffffff1681526020810191909152604001600020546142fb9190600160401b90046001600160801b0316615762565b9050600061430982856155b5565b90506001600160801b038116614323575050505050614481565b600064e8d4a5100082614336828861569f565b6143409190615632565b61434a908b61569f565b6143549190615632565b90506143706143648f60026156ed565b8e888e8a868e8e614098565b886001600160801b0316816001600160801b031611156143f6578d8d8d8d8d8d866040516310eae2eb60e01b8152600401610cf3979695949392919065ffffffffffff978816815295871660208701529386166040860152918516606085015290931660808301526001600160801b0392831660a083015290911660c082015260e00190565b61443a6144048f60026156ed565b61440f9060016155ef565b61441a8860016155ef565b8e6144268a60016155ef565b8e868f6144339190615762565b8e8e614098565b5050505050614473565b6144736144528a60026156ed565b61445d9060016155ef565b6144688360016155ef565b898989898989614098565b61447f89858585614b7a565b505b5050505050505050565b6001600160a01b03163b151590565b600254610100900460ff166144c15760405162461bcd60e51b8152600401610cf3906154f1565b81516144d4906099906020850190614d0c565b508051610f7990609a906020840190614d0c565b65ffffffffffff82166000908152600160205260408120546001600160401b031661452657604051631b2862ff60e21b815260040160405180910390fd5b64e8d4a5100064ffffffffff8316111561455357604051635a60b01360e01b815260040160405180910390fd5b60016000818152602082905260008051602061595f833981519152549091829182916145c0916001600160401b0316600160281b826145938260026156ed565b61459d91906157a1565b6001600160281b816145b08260026156ed565b6145ba91906157a1565b8d6137d1565b9250925092506145ee838383896000600681819054906101000a90046001600160401b0316612c3a90615888565b65ffffffffffff861660009081526001602052604090205464e8d4a510009061462f9064ffffffffff881690600160401b90046001600160801b031661569f565b6146399190615632565b935061468b868560016000600681819054906101000a90046001600160401b031661466390615888565b91906101000a8154816001600160401b0302191690836001600160401b031602179055614cdc565b50505092915050565b600080546146c89065ffffffffffff81169084908490819060069061466390600160301b90046001600160401b0316615888565b506000805465ffffffffffff16908190806146e283615862565b91906101000a81548165ffffffffffff021916908365ffffffffffff16021790555050919050565b6001600160a01b0382166147605760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610cf3565b61476981612878565b156147b55760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610cf3565b6147c160008383613e68565b6001600160a01b0382166000908152609c602052604081208054600192906147ea9084906155d7565b90915550506000818152609b602052604080822080546001600160a01b0319166001600160a01b038616908117909155905183929060008051602061597f833981519152908290a45050565b600061484a846001600160a01b031661448b565b1561493f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614881903390899088908890600401615385565b602060405180830381600087803b15801561489b57600080fd5b505af19250505080156148cb575060408051601f3d908101601f191682019092526148c891810190615079565b60015b614925573d8080156148f9576040519150601f19603f3d011682016040523d82523d6000602084013e6148fe565b606091505b50805161491d5760405162461bcd60e51b8152600401610cf3906153cb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611d4c565b506001611d4c565b6000600161495484611b21565b61495e919061578a565b600083815260cc60205260409020549091508082146149b1576001600160a01b038416600090815260cb60209081526040808320858452825280832054848452818420819055835260cc90915290208190555b50600091825260cc602090815260408084208490556001600160a01b03909416835260cb81528383209183525290812055565b60cd546000906149f69060019061578a565b600083815260ce602052604081205460cd8054939450909284908110614a2c57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060cd8381548110614a5b57634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260ce909152604080822084905585825281205560cd805480614aa157634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000614ac883611b21565b6001600160a01b03909316600090815260cb60209081526040808320868452825280832085905593825260cc9052919091209190915550565b65ffffffffffff83166000908152600160205260409020546001600160801b03838116600160401b9092041614610f795765ffffffffffff8316600090815260016020526040902080546001600160801b038416600160401b026001600160c01b03199091166001600160401b03841617179055505050565b65ffffffffffff8416600090815260016020526040902080546001600160401b0319166001600160401b0383161790558115614c785765ffffffffffff84166000908152600160205260409020546001600160801b03600160401b90910481169084161115614c1557604051633de77d9960e11b815265ffffffffffff851660048201526001600160801b0384166024820152604401610cf3565b65ffffffffffff841660009081526001602052604090208054849190600890614c4f908490600160401b90046001600160801b0316615762565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555061224a565b65ffffffffffff841660009081526001602052604090208054849190600890614cb2908490600160401b90046001600160801b03166155b5565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555050505050565b614ce884848484614b7a565b8365ffffffffffff1660011461224a5761224a614d0485611f05565b848484614cdc565b828054614d189061580c565b90600052602060002090601f016020900481019282614d3a5760008555614d80565b82601f10614d5357805160ff1916838001178555614d80565b82800160010185558215614d80579182015b82811115614d80578251825591602001919060010190614d65565b50614d8c929150614d90565b5090565b5b80821115614d8c5760008155600101614d91565b803565ffffffffffff81168114612e2d57600080fd5b600060208284031215614dcc578081fd5b81356123b8816158fb565b600060208284031215614de8578081fd5b81516123b8816158fb565b60008060408385031215614e05578081fd5b8235614e10816158fb565b91506020830135614e20816158fb565b809150509250929050565b600080600060608486031215614e3f578081fd5b8335614e4a816158fb565b92506020840135614e5a816158fb565b929592945050506040919091013590565b60008060008060808587031215614e80578081fd5b8435614e8b816158fb565b93506020850135614e9b816158fb565b92506040850135915060608501356001600160401b0380821115614ebd578283fd5b818701915087601f830112614ed0578283fd5b813581811115614ee257614ee26158e5565b604051601f8201601f19908116603f01168101908382118183101715614f0a57614f0a6158e5565b816040528281528a6020848701011115614f22578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060408385031215614f55578182fd5b8235614f60816158fb565b91506020830135614e2081615910565b60008060408385031215614f82578182fd5b8235614f8d816158fb565b946020939093013593505050565b60008060008060008060c08789031215614fb3578182fd5b8635614fbe816158fb565b9550602087013594506040870135614fd581615934565b93506060870135614fe581615949565b92506080870135614ff581615949565b915060a087013561500581615949565b809150509295509295509295565b600060208284031215615024578081fd5b81516123b881615910565b60008060408385031215615041578182fd5b825161504c81615910565b6020840151909250614e2081615934565b60006020828403121561506e578081fd5b81356123b88161591e565b60006020828403121561508a578081fd5b81516123b88161591e565b6000602082840312156150a6578081fd5b81356123b881615934565b6000806000606084860312156150c5578081fd5b83356150d081615934565b925060208401356150e081615934565b91506150ee60408501614da5565b90509250925092565b600060208284031215615108578081fd5b5035919050565b600060208284031215615120578081fd5b5051919050565b600080600080600060a0868803121561513e578283fd5b85359450602086013561515081615934565b9350604086013561516081615949565b9250606086013561517081615949565b9150608086013561518081615949565b809150509295509295909350565b600080600080608085870312156151a3578182fd5b8435935060208501356151b581615949565b925060408501356151c581615949565b915060608501356151d581615949565b939692955090935050565b6000602082840312156151f1578081fd5b6123b882614da5565b6000806040838503121561520c578182fd5b61521583614da5565b9150602083013564ffffffffff81168114614e20578182fd5b600080600080600060a08688031215615245578283fd5b61524e86614da5565b945061525c60208701614da5565b935061526a60408701614da5565b925061527860608701614da5565b915061528660808701614da5565b90509295509295909350565b6000602082840312156152a3578081fd5b81356123b881615949565b6000806000606084860312156152c2578081fd5b83516152cd81615949565b60208501519093506152de81615934565b60408501519092506152ef81615934565b809150509250925092565b600081518084526153128160208601602086016157e0565b601f01601f19169290920160200192915050565b600082516153388184602087016157e0565b9190910192915050565b600083516153548184602088016157e0565b8351908301906153688183602088016157e0565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061220e908301846152fa565b6020815260006123b860208301846152fa565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160801b0391909116815260200190565b6001600160401b0391909116815260200190565b6000600f82810b9084900b828212801560016001607f1b038490038313161561558f5761558f6158b9565b60016001607f1b031983900382128116156155ac576155ac6158b9565b50019392505050565b60006001600160801b03828116848216808303821115615368576153686158b9565b600082198211156155ea576155ea6158b9565b500190565b600065ffffffffffff808316818516808303821115615368576153686158b9565b60006001600160401b03828116848216808303821115615368576153686158b9565b60006001600160801b038381168061564c5761564c6158cf565b92169190910492915050565b600082615667576156676158cf565b500490565b600065ffffffffffff8084168061564c5761564c6158cf565b60006001600160401b038381168061564c5761564c6158cf565b60006001600160801b03828116848216811515828404821116156156c5576156c56158b9565b02949350505050565b60008160001904831182151516156156e8576156e86158b9565b500290565b600065ffffffffffff808316818516818304811182151516156156c5576156c56158b9565b6000600f82810b9084900b828112801560016001607f1b031983018412161561573d5761573d6158b9565b60016001607f1b0382018313811615615758576157586158b9565b5090039392505050565b60006001600160801b0383811690831681811015615782576157826158b9565b039392505050565b60008282101561579c5761579c6158b9565b500390565b600065ffffffffffff83811690831681811015615782576157826158b9565b60006001600160401b0383811690831681811015615782576157826158b9565b60005b838110156157fb5781810151838201526020016157e3565b8381111561224a5750506000910152565b600181811c9082168061582057607f821691505b6020821081141561584157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561585b5761585b6158b9565b5060010190565b600065ffffffffffff8083168181141561587e5761587e6158b9565b6001019392505050565b60006001600160401b038281168082141561587e5761587e6158b9565b6000826158b4576158b46158cf565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611b1e57600080fd5b8015158114611b1e57600080fd5b6001600160e01b031981168114611b1e57600080fd5b6001600160801b0381168114611b1e57600080fd5b6001600160401b0381168114611b1e57600080fdfecc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220fd647c6a653f9e5e38d35004c73d6627381883fc4daa2468d4ae34787148113464736f6c63430008040033