Contract 0x3A8c96C496ACe0Fa6aB3E8eD632C1092d53ff84A

  Note: Our ETH balance display is temporarily unavailable. Please check back later.

Contract Overview

Balance:
Txn Hash Method
Block
From
To
Value
0x5228c8e8a4f738f8b71c8cae9d76115918772c6f30934b300a78aee500cdf9ea0x60806040179521622023-11-30 8:19:52139 days 3 hrs ago0xd866b2332d4383c1bf719732177e2d9109c99dbc IN  Create: SportAMMLiquidityPool0 ETH0.0000000500780.00001
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
SportAMMLiquidityPool

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : SportAMMLiquidityPool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

import "../../utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol";
import "../../utils/proxy/solidity-0.8.0/ProxyOwned.sol";
import "@openzeppelin/contracts-4.4.1/proxy/Clones.sol";

import "../../interfaces/ISportsAMM.sol";
import "../../interfaces/ISportPositionalMarket.sol";
import "../../interfaces/IStakingThales.sol";

import "./SportAMMLiquidityPoolRound.sol";

contract SportAMMLiquidityPool is Initializable, ProxyOwned, PausableUpgradeable, ProxyReentrancyGuard {
    /* ========== LIBRARIES ========== */
    using SafeERC20Upgradeable for IERC20Upgradeable;

    struct InitParams {
        address _owner;
        ISportsAMM _sportsAmm;
        IERC20Upgradeable _sUSD;
        uint _roundLength;
        uint _maxAllowedDeposit;
        uint _minDepositAmount;
        uint _maxAllowedUsers;
        bool _needsTransformingCollateral;
    }

    /* ========== CONSTANTS ========== */
    uint private constant HUNDRED = 1e20;
    uint private constant ONE = 1e18;
    uint private constant ONE_PERCENT = 1e16;

    /* ========== STATE VARIABLES ========== */

    ISportsAMM public sportsAMM;
    IERC20Upgradeable public sUSD;

    bool public started;

    uint public round;
    uint public roundLength;
    uint public firstRoundStartTime;

    mapping(uint => address) public roundPools;

    mapping(uint => address[]) public usersPerRound;
    mapping(uint => mapping(address => bool)) public userInRound;

    mapping(uint => mapping(address => uint)) public balancesPerRound;
    mapping(uint => uint) public allocationPerRound;

    mapping(address => bool) public withdrawalRequested;

    mapping(uint => address[]) public tradingMarketsPerRound;
    mapping(uint => mapping(address => bool)) public isTradingMarketInARound;

    mapping(uint => uint) public profitAndLossPerRound;
    mapping(uint => uint) public cumulativeProfitAndLoss;

    uint public maxAllowedDeposit;
    uint public minDepositAmount;
    uint public maxAllowedUsers;
    uint public usersCurrentlyInPool;

    address public defaultLiquidityProvider;

    IStakingThales public stakingThales;

    uint public stakedThalesMultiplier;

    address public poolRoundMastercopy;

    mapping(address => bool) public whitelistedDeposits;

    uint public totalDeposited;

    bool public onlyWhitelistedStakersAllowed;

    mapping(address => bool) public whitelistedStakers;

    bool public needsTransformingCollateral;

    mapping(uint => mapping(address => bool)) public marketAlreadyExercisedInRound;

    bool public roundClosingPrepared;

    uint public usersProcessedInRound;

    mapping(address => uint) public withdrawalShare;

    uint public utilizationRate;

    address public safeBox;
    uint public safeBoxImpact;

    /* ========== CONSTRUCTOR ========== */

    function initialize(InitParams calldata params) external initializer {
        setOwner(params._owner);
        initNonReentrant();
        sportsAMM = ISportsAMM(params._sportsAmm);

        sUSD = params._sUSD;
        roundLength = params._roundLength;
        maxAllowedDeposit = params._maxAllowedDeposit;
        minDepositAmount = params._minDepositAmount;
        maxAllowedUsers = params._maxAllowedUsers;

        needsTransformingCollateral = params._needsTransformingCollateral;

        sUSD.approve(address(sportsAMM), type(uint256).max);
    }

    /// @notice Start pool and begin round #1
    function start() external onlyOwner {
        require(!started, "Liquidity pool has already started");
        require(allocationPerRound[1] > 0, "can not start with 0 deposits");

        firstRoundStartTime = block.timestamp;
        round = 1;

        address roundPool = _getOrCreateRoundPool(1);
        SportAMMLiquidityPoolRound(roundPool).updateRoundTimes(firstRoundStartTime, getRoundEndTime(1));

        started = true;
        emit PoolStarted();
    }

    /// @notice Deposit funds from user into pool for the next round
    /// @param amount Value to be deposited
    function deposit(uint amount) external canDeposit(amount) nonReentrant whenNotPaused roundClosingNotPrepared {
        uint nextRound = round + 1;
        address roundPool = _getOrCreateRoundPool(nextRound);
        sUSD.safeTransferFrom(msg.sender, roundPool, amount);

        if (!whitelistedDeposits[msg.sender]) {
            require(!onlyWhitelistedStakersAllowed || whitelistedStakers[msg.sender], "Only whitelisted stakers allowed");
            require(address(stakingThales) != address(0), "Staking Thales not set");
            require(
                (balancesPerRound[round][msg.sender] + amount + balancesPerRound[nextRound][msg.sender]) <=
                    _transformCollateral((stakingThales.stakedBalanceOf(msg.sender) * stakedThalesMultiplier) / ONE),
                "Not enough staked THALES"
            );
        }

        require(msg.sender != defaultLiquidityProvider, "Can't deposit directly as default liquidity provider");

        // new user enters the pool
        if (balancesPerRound[round][msg.sender] == 0 && balancesPerRound[nextRound][msg.sender] == 0) {
            require(usersCurrentlyInPool < maxAllowedUsers, "Max amount of users reached");
            usersPerRound[nextRound].push(msg.sender);
            usersCurrentlyInPool = usersCurrentlyInPool + 1;
        }

        balancesPerRound[nextRound][msg.sender] += amount;

        allocationPerRound[nextRound] += amount;
        totalDeposited += amount;

        if (address(stakingThales) != address(0)) {
            stakingThales.updateVolume(msg.sender, amount);
        }

        emit Deposited(msg.sender, amount, round);
    }

    /// @notice get sUSD to mint for buy and store market as trading in the round
    /// @param market to trade
    /// @param amountToMint amount to get for mint
    function commitTrade(address market, uint amountToMint)
        external
        nonReentrant
        whenNotPaused
        onlyAMM
        roundClosingNotPrepared
    {
        require(started, "Pool has not started");
        require(amountToMint > 0, "Can't commit a zero trade");

        amountToMint = _transformCollateral(amountToMint);
        // add 1e-6 due to rounding issue, will be sent back to AMM at the end
        amountToMint = needsTransformingCollateral ? amountToMint + 1 : amountToMint;

        uint marketRound = getMarketRound(market);
        address liquidityPoolRound = _getOrCreateRoundPool(marketRound);

        if (marketRound == round) {
            sUSD.safeTransferFrom(liquidityPoolRound, address(sportsAMM), amountToMint);
            require(
                sUSD.balanceOf(liquidityPoolRound) >=
                    (allocationPerRound[round] - ((allocationPerRound[round] * utilizationRate) / ONE)),
                "Amount exceeds available utilization for round"
            );
        } else {
            uint poolBalance = sUSD.balanceOf(liquidityPoolRound);
            if (poolBalance >= amountToMint) {
                sUSD.safeTransferFrom(liquidityPoolRound, address(sportsAMM), amountToMint);
            } else {
                uint differenceToLPAsDefault = amountToMint - poolBalance;
                _depositAsDefault(differenceToLPAsDefault, liquidityPoolRound, marketRound);
                sUSD.safeTransferFrom(liquidityPoolRound, address(sportsAMM), amountToMint);
            }
        }

        if (!isTradingMarketInARound[marketRound][market]) {
            tradingMarketsPerRound[marketRound].push(market);
            isTradingMarketInARound[marketRound][market] = true;
        }
    }

    /// @notice get options that are in the LP into the AMM for the buy tx
    /// @param market to get options for
    /// @param optionsAmount to get options for
    /// @param position to get options for
    function getOptionsForBuy(
        address market,
        uint optionsAmount,
        ISportsAMM.Position position
    ) external nonReentrant whenNotPaused onlyAMM roundClosingNotPrepared {
        if (optionsAmount > 0) {
            require(started, "Pool has not started");

            uint marketRound = getMarketRound(market);
            address liquidityPoolRound = _getOrCreateRoundPool(marketRound);

            (IPosition home, IPosition away, IPosition draw) = ISportPositionalMarket(market).getOptions();
            require(address(home) != address(0), "0A");
            IPosition target = position == ISportsAMM.Position.Home ? home : away;
            if (ISportPositionalMarket(market).optionsCount() > 2 && position != ISportsAMM.Position.Home) {
                target = position == ISportsAMM.Position.Away ? away : draw;
            }

            SportAMMLiquidityPoolRound(liquidityPoolRound).moveOptions(
                IERC20Upgradeable(address(target)),
                optionsAmount,
                address(sportsAMM)
            );
        }
    }

    /// @notice get options that are in the LP into the AMM for the buy tx
    /// @param market to get options for
    /// @param optionsAmount to get options for
    /// @param position to get options for
    function getOptionsForBuyByAddress(
        address market,
        uint optionsAmount,
        address position
    ) external nonReentrant whenNotPaused onlyAMM roundClosingNotPrepared {
        if (optionsAmount > 0) {
            require(started, "Pool has not started");

            uint marketRound = getMarketRound(market);
            address liquidityPoolRound = _getOrCreateRoundPool(marketRound);

            SportAMMLiquidityPoolRound(liquidityPoolRound).moveOptions(
                IERC20Upgradeable(position),
                optionsAmount,
                address(sportsAMM)
            );
        }
    }

    /// @notice Create a round pool by market maturity date if it doesnt already exist
    /// @param market to use
    /// @return roundPool the pool for the passed market
    function getOrCreateMarketPool(address market)
        external
        onlyAMM
        nonReentrant
        whenNotPaused
        roundClosingNotPrepared
        returns (address roundPool)
    {
        uint marketRound = getMarketRound(market);
        roundPool = _getOrCreateRoundPool(marketRound);
    }

    /// @notice request withdrawal from the LP
    function withdrawalRequest() external nonReentrant canWithdraw whenNotPaused roundClosingNotPrepared {
        if (totalDeposited > balancesPerRound[round][msg.sender]) {
            totalDeposited -= balancesPerRound[round][msg.sender];
        } else {
            totalDeposited = 0;
        }

        usersCurrentlyInPool = usersCurrentlyInPool - 1;
        withdrawalRequested[msg.sender] = true;
        emit WithdrawalRequested(msg.sender);
    }

    /// @notice request partial withdrawal from the LP.
    /// @param share the percentage the user is wihdrawing from his total deposit
    function partialWithdrawalRequest(uint share) external nonReentrant canWithdraw whenNotPaused roundClosingNotPrepared {
        require(share >= ONE_PERCENT * 10 && share <= ONE_PERCENT * 90, "Share has to be between 10% and 90%");

        uint toWithdraw = (balancesPerRound[round][msg.sender] * share) / ONE;
        if (totalDeposited > toWithdraw) {
            totalDeposited -= toWithdraw;
        } else {
            totalDeposited = 0;
        }

        withdrawalRequested[msg.sender] = true;
        withdrawalShare[msg.sender] = share;
        emit WithdrawalRequested(msg.sender);
    }

    /// @notice Prepare round closing
    /// excercise options of trading markets and ensure there are no markets left unresolved
    function prepareRoundClosing() external nonReentrant whenNotPaused roundClosingNotPrepared {
        require(canCloseCurrentRound(), "Can't close current round");
        // excercise market options
        exerciseMarketsReadyToExercised();

        address roundPool = roundPools[round];
        // final balance is the final amount of sUSD in the round pool
        uint currentBalance = sUSD.balanceOf(roundPool);

        // send profit reserved for SafeBox if positive round
        if (currentBalance > allocationPerRound[round]) {
            uint safeBoxAmount = ((currentBalance - allocationPerRound[round]) * safeBoxImpact) / ONE;
            sUSD.safeTransferFrom(roundPool, safeBox, safeBoxAmount);
            currentBalance = currentBalance - safeBoxAmount;
            emit SafeBoxSharePaid(safeBoxImpact, safeBoxAmount);
        }

        // calculate PnL

        // if no allocation for current round
        if (allocationPerRound[round] == 0) {
            profitAndLossPerRound[round] = 1;
        } else {
            profitAndLossPerRound[round] = (currentBalance * ONE) / allocationPerRound[round];
        }

        roundClosingPrepared = true;

        emit RoundClosingPrepared(round);
    }

    /// @notice Prepare round closing
    /// excercise options of trading markets and ensure there are no markets left unresolved
    function processRoundClosingBatch(uint batchSize) external nonReentrant whenNotPaused {
        require(roundClosingPrepared, "Round closing not prepared");
        require(usersProcessedInRound < usersPerRound[round].length, "All users already processed");
        require(batchSize > 0, "batchSize has to be greater than 0");

        address roundPool = roundPools[round];

        uint endCursor = usersProcessedInRound + batchSize;
        if (endCursor > usersPerRound[round].length) {
            endCursor = usersPerRound[round].length;
        }

        for (uint i = usersProcessedInRound; i < endCursor; i++) {
            address user = usersPerRound[round][i];
            uint balanceAfterCurRound = (balancesPerRound[round][user] * profitAndLossPerRound[round]) / ONE;
            if (!withdrawalRequested[user] && (profitAndLossPerRound[round] > 0)) {
                balancesPerRound[round + 1][user] = balancesPerRound[round + 1][user] + balanceAfterCurRound;
                usersPerRound[round + 1].push(user);
                if (address(stakingThales) != address(0)) {
                    stakingThales.updateVolume(user, balanceAfterCurRound);
                }
            } else {
                if (withdrawalShare[user] > 0) {
                    uint amountToClaim = (balanceAfterCurRound * withdrawalShare[user]) / ONE;
                    sUSD.safeTransferFrom(roundPool, user, amountToClaim);
                    emit Claimed(user, amountToClaim);
                    withdrawalRequested[user] = false;
                    withdrawalShare[user] = 0;
                    usersPerRound[round + 1].push(user);
                    balancesPerRound[round + 1][user] = balanceAfterCurRound - amountToClaim;
                } else {
                    balancesPerRound[round + 1][user] = 0;
                    sUSD.safeTransferFrom(roundPool, user, balanceAfterCurRound);
                    withdrawalRequested[user] = false;
                    emit Claimed(user, balanceAfterCurRound);
                }
            }
            usersProcessedInRound = usersProcessedInRound + 1;
        }

        emit RoundClosingBatchProcessed(round, batchSize);
    }

    /// @notice Close current round and begin next round,
    /// calculate profit and loss and process withdrawals
    function closeRound() external nonReentrant whenNotPaused {
        require(roundClosingPrepared, "Round closing not prepared");
        require(usersProcessedInRound == usersPerRound[round].length, "Not all users processed yet");
        // set for next round to false
        roundClosingPrepared = false;

        address roundPool = roundPools[round];

        //always claim for defaultLiquidityProvider
        if (balancesPerRound[round][defaultLiquidityProvider] > 0) {
            uint balanceAfterCurRound = (balancesPerRound[round][defaultLiquidityProvider] * profitAndLossPerRound[round]) /
                ONE;
            sUSD.safeTransferFrom(roundPool, defaultLiquidityProvider, balanceAfterCurRound);
            emit Claimed(defaultLiquidityProvider, balanceAfterCurRound);
        }

        if (round == 1) {
            cumulativeProfitAndLoss[round] = profitAndLossPerRound[round];
        } else {
            cumulativeProfitAndLoss[round] = (cumulativeProfitAndLoss[round - 1] * profitAndLossPerRound[round]) / ONE;
        }

        // start next round
        round += 1;

        //add all carried over sUSD
        allocationPerRound[round] += sUSD.balanceOf(roundPool);

        totalDeposited = allocationPerRound[round] - balancesPerRound[round][defaultLiquidityProvider];

        address roundPoolNewRound = _getOrCreateRoundPool(round);

        sUSD.safeTransferFrom(roundPool, roundPoolNewRound, sUSD.balanceOf(roundPool));

        usersProcessedInRound = 0;

        emit RoundClosed(round - 1, profitAndLossPerRound[round - 1]);
    }

    /// @notice Iterate all markets in the current round and exercise those ready to be exercised
    function exerciseMarketsReadyToExercised() public whenNotPaused roundClosingNotPrepared {
        SportAMMLiquidityPoolRound poolRound = SportAMMLiquidityPoolRound(roundPools[round]);
        ISportPositionalMarket market;
        for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) {
            address marketAddress = tradingMarketsPerRound[round][i];
            if (!marketAlreadyExercisedInRound[round][marketAddress]) {
                market = ISportPositionalMarket(marketAddress);
                if (market.resolved()) {
                    poolRound.exerciseMarketReadyToExercised(market);
                    marketAlreadyExercisedInRound[round][marketAddress] = true;
                }
            }
        }
    }

    /// @notice Exercises markets in a round
    /// @param batchSize number of markets to be processed
    function exerciseMarketsReadyToExercisedBatch(uint batchSize)
        external
        nonReentrant
        whenNotPaused
        roundClosingNotPrepared
    {
        require(batchSize > 0, "batchSize has to be greater than 0");

        SportAMMLiquidityPoolRound poolRound = SportAMMLiquidityPoolRound(roundPools[round]);
        uint count = 0;
        ISportPositionalMarket market;
        for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) {
            if (count == batchSize) break;
            address marketAddress = tradingMarketsPerRound[round][i];
            if (!marketAlreadyExercisedInRound[round][marketAddress]) {
                market = ISportPositionalMarket(marketAddress);
                if (market.resolved()) {
                    poolRound.exerciseMarketReadyToExercised(market);
                    marketAlreadyExercisedInRound[round][marketAddress] = true;
                    count += 1;
                }
            }
        }
    }

    /* ========== VIEWS ========== */

    /// @notice whether the user is currently LPing
    /// @param user to check
    /// @return isUserInLP whether the user is currently LPing
    function isUserLPing(address user) external view returns (bool isUserInLP) {
        isUserInLP =
            (balancesPerRound[round][user] > 0 || balancesPerRound[round + 1][user] > 0) &&
            (!withdrawalRequested[user] || withdrawalShare[user] > 0);
    }

    /// @notice Return the maximum amount the user can deposit now
    /// @param user address to check
    /// @return maxDepositForUser the maximum amount the user can deposit in total including already deposited
    /// @return availableToDepositForUser the maximum amount the user can deposit now
    /// @return stakedThalesForUser how much THALES the user has staked
    function getMaxAvailableDepositForUser(address user)
        external
        view
        returns (
            uint maxDepositForUser,
            uint availableToDepositForUser,
            uint stakedThalesForUser
        )
    {
        uint nextRound = round + 1;
        stakedThalesForUser = stakingThales.stakedBalanceOf(user);
        maxDepositForUser = _transformCollateral((stakedThalesForUser * stakedThalesMultiplier) / ONE);
        availableToDepositForUser = maxDepositForUser > (balancesPerRound[round][user] + balancesPerRound[nextRound][user])
            ? (maxDepositForUser - balancesPerRound[round][user] - balancesPerRound[nextRound][user])
            : 0;
    }

    //deprecated User can now withdraw at any time
    /// @notice Return how much the user needs to have staked to withdraw
    /// @param user address to check
    /// @return neededStaked how much the user needs to have staked to withdraw
    function getNeededStakedThalesToWithdrawForUser(address user) external view returns (uint neededStaked) {
        uint nextRound = round + 1;
        neededStaked =
            _reverseTransformCollateral((balancesPerRound[round][user] + balancesPerRound[nextRound][user]) * ONE) /
            stakedThalesMultiplier;
    }

    /// @notice get the pool address for the market
    /// @param market to check
    /// @return roundPool the pool address for the market
    function getMarketPool(address market) external view returns (address roundPool) {
        roundPool = roundPools[getMarketRound(market)];
    }

    /// @notice Checks if all conditions are met to close the round
    /// @return bool
    function canCloseCurrentRound() public view returns (bool) {
        if (!started || block.timestamp < getRoundEndTime(round)) {
            return false;
        }
        ISportPositionalMarket market;
        for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) {
            address marketAddress = tradingMarketsPerRound[round][i];
            if (!marketAlreadyExercisedInRound[round][marketAddress]) {
                market = ISportPositionalMarket(marketAddress);
                if (!market.resolved()) {
                    return false;
                }
            }
        }
        return true;
    }

    /// @notice Iterate all markets in the current round and return true if at least one can be exercised
    function hasMarketsReadyToBeExercised() public view returns (bool) {
        SportAMMLiquidityPoolRound poolRound = SportAMMLiquidityPoolRound(roundPools[round]);
        ISportPositionalMarket market;
        for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) {
            address marketAddress = tradingMarketsPerRound[round][i];
            if (!marketAlreadyExercisedInRound[round][marketAddress]) {
                market = ISportPositionalMarket(marketAddress);
                if (market.resolved()) {
                    (uint homeBalance, uint awayBalance, uint drawBalance) = market.balancesOf(address(poolRound));
                    if (homeBalance > 0 || awayBalance > 0 || drawBalance > 0) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    /// @notice Return multiplied PnLs between rounds
    /// @param roundA Round number from
    /// @param roundB Round number to
    /// @return uint
    function cumulativePnLBetweenRounds(uint roundA, uint roundB) public view returns (uint) {
        return (cumulativeProfitAndLoss[roundB] * profitAndLossPerRound[roundA]) / cumulativeProfitAndLoss[roundA];
    }

    /// @notice Return the start time of the passed round
    /// @param _round number
    /// @return uint the start time of the given round
    function getRoundStartTime(uint _round) public view returns (uint) {
        return firstRoundStartTime + (_round - 1) * roundLength;
    }

    /// @notice Return the end time of the passed round
    /// @param _round number
    /// @return uint the end time of the given round
    function getRoundEndTime(uint _round) public view returns (uint) {
        return firstRoundStartTime + _round * roundLength;
    }

    /// @notice Return the round to which a market belongs to
    /// @param market to get the round for
    /// @return _round the round which the market belongs to
    function getMarketRound(address market) public view returns (uint _round) {
        ISportPositionalMarket marketContract = ISportPositionalMarket(market);
        (uint maturity, ) = marketContract.times();
        if (maturity > firstRoundStartTime) {
            _round = (maturity - firstRoundStartTime) / roundLength + 1;
        } else {
            _round = 1;
        }
    }

    /// @notice Return the count of users in current round
    /// @return _the count of users in current round
    function getUsersCountInCurrentRound() external view returns (uint) {
        return usersPerRound[round].length;
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function _transformCollateral(uint value) internal view returns (uint) {
        if (needsTransformingCollateral) {
            return value / 1e12;
        } else {
            return value;
        }
    }

    function _reverseTransformCollateral(uint value) internal view returns (uint) {
        if (needsTransformingCollateral) {
            return value * 1e12;
        } else {
            return value;
        }
    }

    function _depositAsDefault(
        uint amount,
        address roundPool,
        uint _round
    ) internal {
        require(defaultLiquidityProvider != address(0), "default liquidity provider not set");

        sUSD.safeTransferFrom(defaultLiquidityProvider, roundPool, amount);

        balancesPerRound[_round][defaultLiquidityProvider] += amount;
        allocationPerRound[_round] += amount;

        emit Deposited(defaultLiquidityProvider, amount, _round);
    }

    function _getOrCreateRoundPool(uint _round) internal returns (address roundPool) {
        roundPool = roundPools[_round];
        if (roundPool == address(0)) {
            require(poolRoundMastercopy != address(0), "Round pool mastercopy not set");
            SportAMMLiquidityPoolRound newRoundPool = SportAMMLiquidityPoolRound(Clones.clone(poolRoundMastercopy));
            newRoundPool.initialize(address(this), sUSD, _round, getRoundEndTime(_round - 1), getRoundEndTime(_round));
            roundPool = address(newRoundPool);
            roundPools[_round] = roundPool;
            emit RoundPoolCreated(_round, roundPool);
        }
    }

    /* ========== SETTERS ========== */

    function setPaused(bool _setPausing) external onlyOwner {
        _setPausing ? _pause() : _unpause();
    }

    /// @notice Set onlyWhitelistedStakersAllowed variable
    /// @param flagToSet self explanatory
    function setOnlyWhitelistedStakersAllowed(bool flagToSet) external onlyOwner {
        onlyWhitelistedStakersAllowed = flagToSet;
        emit SetOnlyWhitelistedStakersAllowed(flagToSet);
    }

    /// @notice Set setNeedsTransformingCollateral variable
    /// @param _needsTransformingCollateral self explanatory
    function setNeedsTransformingCollateral(bool _needsTransformingCollateral) external onlyOwner {
        needsTransformingCollateral = _needsTransformingCollateral;
        emit SetNeedsTransformingCollateral(_needsTransformingCollateral);
    }

    /// @notice Set _poolRoundMastercopy
    /// @param _poolRoundMastercopy to clone round pools from
    function setPoolRoundMastercopy(address _poolRoundMastercopy) external onlyOwner {
        require(_poolRoundMastercopy != address(0), "Can not set a zero address!");
        poolRoundMastercopy = _poolRoundMastercopy;
        emit PoolRoundMastercopyChanged(poolRoundMastercopy);
    }

    /// @notice Set _stakedThalesMultiplier
    /// @param _stakedThalesMultiplier the number of sUSD one can deposit per THALES staked
    function setStakedThalesMultiplier(uint _stakedThalesMultiplier) external onlyOwner {
        stakedThalesMultiplier = _stakedThalesMultiplier;
        emit StakedThalesMultiplierChanged(_stakedThalesMultiplier);
    }

    /// @notice Set IStakingThales contract
    /// @param _stakingThales IStakingThales address
    function setStakingThales(IStakingThales _stakingThales) external onlyOwner {
        require(address(_stakingThales) != address(0), "Can not set a zero address!");
        stakingThales = _stakingThales;
        emit StakingThalesChanged(address(_stakingThales));
    }

    /// @notice Set max allowed deposit
    /// @param _maxAllowedDeposit Deposit value
    function setMaxAllowedDeposit(uint _maxAllowedDeposit) external onlyOwner {
        maxAllowedDeposit = _maxAllowedDeposit;
        emit MaxAllowedDepositChanged(_maxAllowedDeposit);
    }

    /// @notice Set min allowed deposit
    /// @param _minDepositAmount Deposit value
    function setMinAllowedDeposit(uint _minDepositAmount) external onlyOwner {
        minDepositAmount = _minDepositAmount;
        emit MinAllowedDepositChanged(_minDepositAmount);
    }

    /// @notice Set _maxAllowedUsers
    /// @param _maxAllowedUsers Deposit value
    function setMaxAllowedUsers(uint _maxAllowedUsers) external onlyOwner {
        maxAllowedUsers = _maxAllowedUsers;
        emit MaxAllowedUsersChanged(_maxAllowedUsers);
    }

    /// @notice Set ThalesAMM contract
    /// @param _sportAMM ThalesAMM address
    function setSportAmm(ISportsAMM _sportAMM) external onlyOwner {
        require(address(_sportAMM) != address(0), "Can not set a zero address!");
        sportsAMM = _sportAMM;
        sUSD.approve(address(sportsAMM), type(uint256).max);
        emit SportAMMChanged(address(_sportAMM));
    }

    /// @notice Set defaultLiquidityProvider wallet
    /// @param _defaultLiquidityProvider default liquidity provider
    function setDefaultLiquidityProvider(address _defaultLiquidityProvider) external onlyOwner {
        require(_defaultLiquidityProvider != address(0), "Can not set a zero address!");
        defaultLiquidityProvider = _defaultLiquidityProvider;
        emit DefaultLiquidityProviderChanged(_defaultLiquidityProvider);
    }

    /// @notice Set length of rounds
    /// @param _roundLength Length of a round in miliseconds
    function setRoundLength(uint _roundLength) external onlyOwner {
        require(!started, "Can't change round length after start");
        roundLength = _roundLength;
        emit RoundLengthChanged(_roundLength);
    }

    /// @notice set addresses which can deposit into the AMM bypassing the staking checks
    /// @param _whitelistedAddresses Addresses to set the whitelist flag for
    /// @param _flag to set
    function setWhitelistedAddresses(address[] calldata _whitelistedAddresses, bool _flag) external onlyOwner {
        require(_whitelistedAddresses.length > 0, "Whitelisted addresses cannot be empty");
        for (uint256 index = 0; index < _whitelistedAddresses.length; index++) {
            // only if current flag is different, if same skip it
            if (whitelistedDeposits[_whitelistedAddresses[index]] != _flag) {
                whitelistedDeposits[_whitelistedAddresses[index]] = _flag;
                emit AddedIntoWhitelist(_whitelistedAddresses[index], _flag);
            }
        }
    }

    /// @notice set addresses which can deposit into the AMM when only whitelisted stakers are allowed
    /// @param _whitelistedAddresses Addresses to set the whitelist flag for
    /// @param _flag to set
    function setWhitelistedStakerAddresses(address[] calldata _whitelistedAddresses, bool _flag) external onlyOwner {
        require(_whitelistedAddresses.length > 0, "Whitelisted addresses cannot be empty");
        for (uint256 index = 0; index < _whitelistedAddresses.length; index++) {
            // only if current flag is different, if same skip it
            if (whitelistedStakers[_whitelistedAddresses[index]] != _flag) {
                whitelistedStakers[_whitelistedAddresses[index]] = _flag;
                emit AddedIntoWhitelistStaker(_whitelistedAddresses[index], _flag);
            }
        }
    }

    /// @notice set utilization rate parameter
    /// @param _utilizationRate value as percentage
    function setUtilizationRate(uint _utilizationRate) external onlyOwner {
        utilizationRate = _utilizationRate;
        emit UtilizationRateChanged(_utilizationRate);
    }

    /// @notice set SafeBox params
    /// @param _safeBox where to send a profit reserved for protocol from each round
    /// @param _safeBoxImpact how much is the SafeBox percentage
    function setSafeBoxParams(address _safeBox, uint _safeBoxImpact) external onlyOwner {
        safeBox = _safeBox;
        safeBoxImpact = _safeBoxImpact;
        emit SetSafeBoxParams(_safeBox, _safeBoxImpact);
    }

    /* ========== MODIFIERS ========== */

    modifier canDeposit(uint amount) {
        require(!withdrawalRequested[msg.sender], "Withdrawal is requested, cannot deposit");
        require(totalDeposited + amount <= maxAllowedDeposit, "Deposit amount exceeds AMM LP cap");
        if (balancesPerRound[round][msg.sender] == 0 && balancesPerRound[round + 1][msg.sender] == 0) {
            require(amount >= minDepositAmount, "Amount less than minDepositAmount");
        }
        _;
    }

    modifier canWithdraw() {
        require(started, "Pool has not started");
        require(!withdrawalRequested[msg.sender], "Withdrawal already requested");
        require(balancesPerRound[round][msg.sender] > 0, "Nothing to withdraw");
        require(balancesPerRound[round + 1][msg.sender] == 0, "Can't withdraw as you already deposited for next round");
        _;
    }

    modifier onlyAMM() {
        require(msg.sender == address(sportsAMM), "only the AMM may perform these methods");
        _;
    }

    modifier roundClosingNotPrepared() {
        require(!roundClosingPrepared, "Not allowed during roundClosingPrepared");
        _;
    }

    /* ========== EVENTS ========== */
    event PoolStarted();
    event Deposited(address user, uint amount, uint round);
    event WithdrawalRequested(address user);
    event RoundClosed(uint round, uint roundPnL);
    event Claimed(address user, uint amount);
    event RoundPoolCreated(uint _round, address roundPool);
    event PoolRoundMastercopyChanged(address newMastercopy);
    event StakedThalesMultiplierChanged(uint _stakedThalesMultiplier);
    event StakingThalesChanged(address stakingThales);
    event MaxAllowedDepositChanged(uint maxAllowedDeposit);
    event MinAllowedDepositChanged(uint minAllowedDeposit);
    event MaxAllowedUsersChanged(uint MaxAllowedUsersChanged);
    event SportAMMChanged(address sportAMM);
    event DefaultLiquidityProviderChanged(address newProvider);
    event AddedIntoWhitelist(address _whitelistAddress, bool _flag);
    event AddedIntoWhitelistStaker(address _whitelistAddress, bool _flag);
    event RoundLengthChanged(uint roundLength);
    event SetOnlyWhitelistedStakersAllowed(bool flagToSet);
    event RoundClosingPrepared(uint round);
    event RoundClosingBatchProcessed(uint round, uint batchSize);
    event UtilizationRateChanged(uint utilizationRate);
    event SetSafeBoxParams(address safeBox, uint safeBoxImpact);
    event SafeBoxSharePaid(uint safeBoxShare, uint safeBoxAmount);
    event SetNeedsTransformingCollateral(bool needs);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 3 of 20 : 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 {
        __Context_init_unchained();
        __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);
    }
    uint256[49] private __gap;
}

File 4 of 20 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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 a proxied contract can't have 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.
 *
 * 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 initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // 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, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 5 of 20 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

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

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

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

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

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

File 6 of 20 : ProxyReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the `nonReentrant` modifier
 * available, which can be aplied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 */
contract ProxyReentrancyGuard {
    /// @dev counter to allow mutex lock with only one SSTORE operation
    uint256 private _guardCounter;
    bool private _initialized;

    function initNonReentrant() public {
        require(!_initialized, "Already initialized");
        _initialized = true;
        _guardCounter = 1;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _guardCounter += 1;
        uint256 localCounter = _guardCounter;
        _;
        require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
    }
}

File 7 of 20 : ProxyOwned.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// Clone of syntetix contract without constructor
contract ProxyOwned {
    address public owner;
    address public nominatedOwner;
    bool private _initialized;
    bool private _transferredAtInit;

    function setOwner(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        require(!_initialized, "Already initialized, use nominateNewOwner");
        _initialized = true;
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    function transferOwnershipAtInit(address proxyAddress) external onlyOwner {
        require(proxyAddress != address(0), "Invalid address");
        require(!_transferredAtInit, "Already transferred");
        owner = proxyAddress;
        _transferredAtInit = true;
        emit OwnerChanged(owner, proxyAddress);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}

File 8 of 20 : Clones.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol)

pragma solidity ^0.8.0;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library Clones {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create2(0, ptr, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
            mstore(add(ptr, 0x38), shl(0x60, deployer))
            mstore(add(ptr, 0x4c), salt)
            mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
            predicted := keccak256(add(ptr, 0x37), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(address implementation, bytes32 salt)
        internal
        view
        returns (address predicted)
    {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

File 9 of 20 : ISportsAMM.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../interfaces/ISportAMMRiskManager.sol";

interface ISportsAMM {
    /* ========== VIEWS / VARIABLES ========== */

    enum Position {
        Home,
        Away,
        Draw
    }

    struct SellRequirements {
        address user;
        address market;
        Position position;
        uint amount;
        uint expectedPayout;
        uint additionalSlippage;
    }

    function theRundownConsumer() external view returns (address);

    function riskManager() external view returns (ISportAMMRiskManager riskManager);

    function getMarketDefaultOdds(address _market, bool isSell) external view returns (uint[] memory);

    function isMarketInAMMTrading(address _market) external view returns (bool);

    function isMarketForSportOnePositional(uint _tag) external view returns (bool);

    function availableToBuyFromAMM(address market, Position position) external view returns (uint _available);

    function parlayAMM() external view returns (address);

    function minSupportedOdds() external view returns (uint);

    function maxSupportedOdds() external view returns (uint);

    function minSupportedOddsPerSport(uint) external view returns (uint);

    function min_spread() external view returns (uint);

    function max_spread() external view returns (uint);

    function minimalTimeLeftToMaturity() external view returns (uint);

    function getSpentOnGame(address market) external view returns (uint);

    function safeBoxImpact() external view returns (uint);

    function manager() external view returns (address);

    function getLiquidityPool() external view returns (address);

    function buyFromAMM(
        address market,
        Position position,
        uint amount,
        uint expectedPayout,
        uint additionalSlippage
    ) external;

    function buyFromAmmQuote(
        address market,
        Position position,
        uint amount
    ) external view returns (uint);

    function buyFromAmmQuoteForParlayAMM(
        address market,
        Position position,
        uint amount
    ) external view returns (uint);

    function updateParlayVolume(address _account, uint _amount) external;

    function buyPriceImpact(
        address market,
        ISportsAMM.Position position,
        uint amount
    ) external view returns (int impact);

    function obtainOdds(address _market, ISportsAMM.Position _position) external view returns (uint oddsToReturn);

    function buyFromAmmQuoteWithDifferentCollateral(
        address market,
        ISportsAMM.Position position,
        uint amount,
        address collateral
    ) external view returns (uint collateralQuote, uint sUSDToPay);

    function availableToBuyFromAMMWithBaseOdds(
        address market,
        ISportsAMM.Position position,
        uint baseOdds,
        uint balance,
        bool useBalance
    ) external view returns (uint availableAmount);

    function floorBaseOdds(uint baseOdds, address market) external view returns (uint);
}

File 10 of 20 : ISportPositionalMarket.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16;

import "../interfaces/IPositionalMarketManager.sol";
import "../interfaces/IPosition.sol";
import "../interfaces/IPriceFeed.sol";

interface ISportPositionalMarket {
    /* ========== TYPES ========== */

    enum Phase {
        Trading,
        Maturity,
        Expiry
    }
    enum Side {
        Cancelled,
        Home,
        Away,
        Draw
    }

    /* ========== VIEWS / VARIABLES ========== */

    function getOptions()
        external
        view
        returns (
            IPosition home,
            IPosition away,
            IPosition draw
        );

    function times() external view returns (uint maturity, uint destruction);

    function initialMint() external view returns (uint);

    function getGameDetails() external view returns (bytes32 gameId, string memory gameLabel);

    function getGameId() external view returns (bytes32);

    function deposited() external view returns (uint);

    function optionsCount() external view returns (uint);

    function creator() external view returns (address);

    function resolved() external view returns (bool);

    function cancelled() external view returns (bool);

    function paused() external view returns (bool);

    function phase() external view returns (Phase);

    function canResolve() external view returns (bool);

    function result() external view returns (Side);

    function isChild() external view returns (bool);

    function optionsInitialized() external view returns (bool);

    function tags(uint idx) external view returns (uint);

    function getTags() external view returns (uint tag1, uint tag2);

    function getTagsLength() external view returns (uint tagsLength);

    function getParentMarketPositions() external view returns (IPosition position1, IPosition position2);

    function getParentMarketPositionsUint() external view returns (uint position1, uint position2);

    function getStampedOdds()
        external
        view
        returns (
            uint,
            uint,
            uint
        );

    function balancesOf(address account)
        external
        view
        returns (
            uint home,
            uint away,
            uint draw
        );

    function totalSupplies()
        external
        view
        returns (
            uint home,
            uint away,
            uint draw
        );

    function isDoubleChance() external view returns (bool);

    function parentMarket() external view returns (ISportPositionalMarket);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function setPaused(bool _paused) external;

    function updateDates(uint256 _maturity, uint256 _expiry) external;

    function mint(uint value) external;

    function exerciseOptions() external;

    function restoreInvalidOdds(
        uint _homeOdds,
        uint _awayOdds,
        uint _drawOdds
    ) external;
}

File 11 of 20 : IStakingThales.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

interface IStakingThales {
    function updateVolume(address account, uint amount) external;

    /* ========== VIEWS / VARIABLES ==========  */
    function totalStakedAmount() external view returns (uint);

    function stakedBalanceOf(address account) external view returns (uint);

    function currentPeriodRewards() external view returns (uint);

    function currentPeriodFees() external view returns (uint);

    function getLastPeriodOfClaimedRewards(address account) external view returns (uint);

    function getRewardsAvailable(address account) external view returns (uint);

    function getRewardFeesAvailable(address account) external view returns (uint);

    function getAlreadyClaimedRewards(address account) external view returns (uint);

    function getContractRewardFunds() external view returns (uint);

    function getContractFeeFunds() external view returns (uint);

    function getAMMVolume(address account) external view returns (uint);
}

File 12 of 20 : SportAMMLiquidityPoolRound.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";

import "../../interfaces/ISportPositionalMarket.sol";

import "./SportAMMLiquidityPool.sol";

contract SportAMMLiquidityPoolRound {
    /* ========== LIBRARIES ========== */
    using SafeERC20Upgradeable for IERC20Upgradeable;

    /* ========== STATE VARIABLES ========== */

    SportAMMLiquidityPool public liquidityPool;
    IERC20Upgradeable public sUSD;

    uint public round;
    uint public roundStartTime;
    uint public roundEndTime;

    /* ========== CONSTRUCTOR ========== */

    bool public initialized;

    function initialize(
        address _liquidityPool,
        IERC20Upgradeable _sUSD,
        uint _round,
        uint _roundStartTime,
        uint _roundEndTime
    ) external {
        require(!initialized, "Already initialized");
        initialized = true;
        liquidityPool = SportAMMLiquidityPool(_liquidityPool);
        sUSD = _sUSD;
        round = _round;
        roundStartTime = _roundStartTime;
        roundEndTime = _roundEndTime;
        sUSD.approve(_liquidityPool, type(uint256).max);
    }

    function updateRoundTimes(uint _roundStartTime, uint _roundEndTime) external onlyLiquidityPool {
        roundStartTime = _roundStartTime;
        roundEndTime = _roundEndTime;
        emit RoundTimesUpdated(_roundStartTime, _roundEndTime);
    }

    function exerciseMarketReadyToExercised(ISportPositionalMarket market) external onlyLiquidityPool {
        if (market.resolved()) {
            (uint homeBalance, uint awayBalance, uint drawBalance) = market.balancesOf(address(this));
            if (homeBalance > 0 || awayBalance > 0 || drawBalance > 0) {
                market.exerciseOptions();
            }
        }
    }

    function moveOptions(
        IERC20Upgradeable option,
        uint optionsAmount,
        address destination
    ) external onlyLiquidityPool {
        option.safeTransfer(destination, optionsAmount);
    }

    modifier onlyLiquidityPool() {
        require(msg.sender == address(liquidityPool), "only the Pool manager may perform these methods");
        _;
    }

    event RoundTimesUpdated(uint _roundStartTime, uint _roundEndTime);
}

File 13 of 20 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 14 of 20 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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);
            }
        }
    }
}

File 15 of 20 : 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 {
        __Context_init_unchained();
    }

    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;
    }
    uint256[50] private __gap;
}

File 16 of 20 : ISportAMMRiskManager.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface ISportAMMRiskManager {
    function calculateCapToBeUsed(address _market) external view returns (uint toReturn);

    function isTotalSpendingLessThanTotalRisk(uint _totalSpent, address _market) external view returns (bool _isNotRisky);

    function isMarketForSportOnePositional(uint _tag) external view returns (bool);

    function isMarketForPlayerPropsOnePositional(uint _tag) external view returns (bool);

    function minSupportedOddsPerSport(uint tag) external view returns (uint);

    function minSpreadPerSport(uint tag1, uint tag2) external view returns (uint);

    function maxSpreadPerSport(uint tag) external view returns (uint);

    function getMinSpreadToUse(
        bool useDefaultMinSpread,
        address market,
        uint min_spread,
        uint min_spreadPerAddress
    ) external view returns (uint);

    function getMaxSpreadForMarket(address _market, uint max_spread) external view returns (uint);

    function getMinOddsForMarket(address _market, uint minSupportedOdds) external view returns (uint minOdds);
}

File 17 of 20 : IPositionalMarketManager.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "../interfaces/IPositionalMarket.sol";

interface IPositionalMarketManager {
    /* ========== VIEWS / VARIABLES ========== */

    function durations() external view returns (uint expiryDuration, uint maxTimeToMaturity);

    function capitalRequirement() external view returns (uint);

    function marketCreationEnabled() external view returns (bool);

    function onlyAMMMintingAndBurning() external view returns (bool);

    function transformCollateral(uint value) external view returns (uint);

    function reverseTransformCollateral(uint value) external view returns (uint);

    function totalDeposited() external view returns (uint);

    function numActiveMarkets() external view returns (uint);

    function activeMarkets(uint index, uint pageSize) external view returns (address[] memory);

    function numMaturedMarkets() external view returns (uint);

    function maturedMarkets(uint index, uint pageSize) external view returns (address[] memory);

    function isActiveMarket(address candidate) external view returns (bool);

    function isKnownMarket(address candidate) external view returns (bool);

    function getThalesAMM() external view returns (address);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function createMarket(
        bytes32 oracleKey,
        uint strikePrice,
        uint maturity,
        uint initialMint // initial sUSD to mint options for,
    ) external returns (IPositionalMarket);

    function resolveMarket(address market) external;

    function expireMarkets(address[] calldata market) external;

    function transferSusdTo(
        address sender,
        address receiver,
        uint amount
    ) external;
}

File 18 of 20 : IPosition.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "./IPositionalMarket.sol";

interface IPosition {
    /* ========== VIEWS / VARIABLES ========== */

    function getBalanceOf(address account) external view returns (uint);

    function getTotalSupply() external view returns (uint);

    function exerciseWithAmount(address claimant, uint amount) external;
}

File 19 of 20 : IPriceFeed.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

interface IPriceFeed {
    // Structs
    struct RateAndUpdatedTime {
        uint216 rate;
        uint40 time;
    }

    // Mutative functions
    function addAggregator(bytes32 currencyKey, address aggregatorAddress) external;

    function removeAggregator(bytes32 currencyKey) external;

    // Views

    function rateForCurrency(bytes32 currencyKey) external view returns (uint);

    function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time);

    function getRates() external view returns (uint[] memory);

    function getCurrencies() external view returns (bytes32[] memory);
}

File 20 of 20 : IPositionalMarket.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

import "../interfaces/IPositionalMarketManager.sol";
import "../interfaces/IPosition.sol";
import "../interfaces/IPriceFeed.sol";

interface IPositionalMarket {
    /* ========== TYPES ========== */

    enum Phase {
        Trading,
        Maturity,
        Expiry
    }
    enum Side {
        Up,
        Down
    }

    /* ========== VIEWS / VARIABLES ========== */

    function getOptions() external view returns (IPosition up, IPosition down);

    function times() external view returns (uint maturity, uint destructino);

    function getOracleDetails()
        external
        view
        returns (
            bytes32 key,
            uint strikePrice,
            uint finalPrice
        );

    function fees() external view returns (uint poolFee, uint creatorFee);

    function deposited() external view returns (uint);

    function creator() external view returns (address);

    function resolved() external view returns (bool);

    function phase() external view returns (Phase);

    function oraclePrice() external view returns (uint);

    function oraclePriceAndTimestamp() external view returns (uint price, uint updatedAt);

    function canResolve() external view returns (bool);

    function result() external view returns (Side);

    function balancesOf(address account) external view returns (uint up, uint down);

    function totalSupplies() external view returns (uint up, uint down);

    function getMaximumBurnable(address account) external view returns (uint amount);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function mint(uint value) external;

    function exerciseOptions() external returns (uint);

    function burnOptions(uint amount) external;

    function burnOptionsMaximum() external;
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_whitelistAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"_flag","type":"bool"}],"name":"AddedIntoWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_whitelistAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"_flag","type":"bool"}],"name":"AddedIntoWhitelistStaker","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newProvider","type":"address"}],"name":"DefaultLiquidityProviderChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxAllowedDeposit","type":"uint256"}],"name":"MaxAllowedDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"MaxAllowedUsersChanged","type":"uint256"}],"name":"MaxAllowedUsersChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minAllowedDeposit","type":"uint256"}],"name":"MinAllowedDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newMastercopy","type":"address"}],"name":"PoolRoundMastercopyChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"PoolStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roundPnL","type":"uint256"}],"name":"RoundClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"batchSize","type":"uint256"}],"name":"RoundClosingBatchProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"RoundClosingPrepared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"roundLength","type":"uint256"}],"name":"RoundLengthChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_round","type":"uint256"},{"indexed":false,"internalType":"address","name":"roundPool","type":"address"}],"name":"RoundPoolCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"safeBoxShare","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"safeBoxAmount","type":"uint256"}],"name":"SafeBoxSharePaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"needs","type":"bool"}],"name":"SetNeedsTransformingCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"flagToSet","type":"bool"}],"name":"SetOnlyWhitelistedStakersAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"safeBox","type":"address"},{"indexed":false,"internalType":"uint256","name":"safeBoxImpact","type":"uint256"}],"name":"SetSafeBoxParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sportAMM","type":"address"}],"name":"SportAMMChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_stakedThalesMultiplier","type":"uint256"}],"name":"StakedThalesMultiplierChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"stakingThales","type":"address"}],"name":"StakingThalesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"utilizationRate","type":"uint256"}],"name":"UtilizationRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"}],"name":"WithdrawalRequested","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allocationPerRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"balancesPerRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canCloseCurrentRound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"closeRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"amountToMint","type":"uint256"}],"name":"commitTrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundA","type":"uint256"},{"internalType":"uint256","name":"roundB","type":"uint256"}],"name":"cumulativePnLBetweenRounds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cumulativeProfitAndLoss","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultLiquidityProvider","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exerciseMarketsReadyToExercised","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchSize","type":"uint256"}],"name":"exerciseMarketsReadyToExercisedBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"firstRoundStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getMarketPool","outputs":[{"internalType":"address","name":"roundPool","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getMarketRound","outputs":[{"internalType":"uint256","name":"_round","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getMaxAvailableDepositForUser","outputs":[{"internalType":"uint256","name":"maxDepositForUser","type":"uint256"},{"internalType":"uint256","name":"availableToDepositForUser","type":"uint256"},{"internalType":"uint256","name":"stakedThalesForUser","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNeededStakedThalesToWithdrawForUser","outputs":[{"internalType":"uint256","name":"neededStaked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"optionsAmount","type":"uint256"},{"internalType":"enum ISportsAMM.Position","name":"position","type":"uint8"}],"name":"getOptionsForBuy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"optionsAmount","type":"uint256"},{"internalType":"address","name":"position","type":"address"}],"name":"getOptionsForBuyByAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getOrCreateMarketPool","outputs":[{"internalType":"address","name":"roundPool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_round","type":"uint256"}],"name":"getRoundEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_round","type":"uint256"}],"name":"getRoundStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUsersCountInCurrentRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasMarketsReadyToBeExercised","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initNonReentrant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract ISportsAMM","name":"_sportsAmm","type":"address"},{"internalType":"contract IERC20Upgradeable","name":"_sUSD","type":"address"},{"internalType":"uint256","name":"_roundLength","type":"uint256"},{"internalType":"uint256","name":"_maxAllowedDeposit","type":"uint256"},{"internalType":"uint256","name":"_minDepositAmount","type":"uint256"},{"internalType":"uint256","name":"_maxAllowedUsers","type":"uint256"},{"internalType":"bool","name":"_needsTransformingCollateral","type":"bool"}],"internalType":"struct SportAMMLiquidityPool.InitParams","name":"params","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"isTradingMarketInARound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isUserLPing","outputs":[{"internalType":"bool","name":"isUserInLP","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"marketAlreadyExercisedInRound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAllowedDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAllowedUsers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"needsTransformingCollateral","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onlyWhitelistedStakersAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"name":"partialWithdrawalRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolRoundMastercopy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prepareRoundClosing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchSize","type":"uint256"}],"name":"processRoundClosingBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"profitAndLossPerRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"round","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundClosingPrepared","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"roundPools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sUSD","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"safeBox","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"safeBoxImpact","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_defaultLiquidityProvider","type":"address"}],"name":"setDefaultLiquidityProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAllowedDeposit","type":"uint256"}],"name":"setMaxAllowedDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAllowedUsers","type":"uint256"}],"name":"setMaxAllowedUsers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minDepositAmount","type":"uint256"}],"name":"setMinAllowedDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_needsTransformingCollateral","type":"bool"}],"name":"setNeedsTransformingCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"flagToSet","type":"bool"}],"name":"setOnlyWhitelistedStakersAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_setPausing","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolRoundMastercopy","type":"address"}],"name":"setPoolRoundMastercopy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundLength","type":"uint256"}],"name":"setRoundLength","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_safeBox","type":"address"},{"internalType":"uint256","name":"_safeBoxImpact","type":"uint256"}],"name":"setSafeBoxParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISportsAMM","name":"_sportAMM","type":"address"}],"name":"setSportAmm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakedThalesMultiplier","type":"uint256"}],"name":"setStakedThalesMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IStakingThales","name":"_stakingThales","type":"address"}],"name":"setStakingThales","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_utilizationRate","type":"uint256"}],"name":"setUtilizationRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_whitelistedAddresses","type":"address[]"},{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setWhitelistedAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_whitelistedAddresses","type":"address[]"},{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setWhitelistedStakerAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sportsAMM","outputs":[{"internalType":"contract ISportsAMM","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedThalesMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingThales","outputs":[{"internalType":"contract IStakingThales","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"start","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"started","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tradingMarketsPerRound","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInRound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usersCurrentlyInPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"usersPerRound","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usersProcessedInRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"utilizationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedDeposits","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedStakers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawalRequested","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawalShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061599680620000216000396000f3fe608060405234801561001057600080fd5b50600436106104b75760003560e01c806374094edd11610278578063be9a65551161015c578063e278fe6f116100ce578063f475f13b11610092578063f475f13b14610adc578063f61fcb8b14610aef578063fab44cbb14610b0f578063fd8a8cc614610b22578063fdaf17f014610b35578063ff50abdc14610b5857600080fd5b8063e278fe6f14610aa9578063e3041fd914610ab1578063e45b2e8814610ab9578063ebc7977214610acc578063ee161cce14610ad457600080fd5b8063d27c079711610120578063d27c079714610a4b578063d69fb66814610a54578063d95ad45c14610a5d578063db7f92d414610a70578063ddc6ac2314610a83578063ddcc8fe914610a9657600080fd5b8063be9a6555146109f2578063c2edfc73146109fa578063c3b83f5f14610a0d578063c992528814610a20578063c9f4ff4614610a3857600080fd5b8063930102f2116101f5578063afbbb80a116101b9578063afbbb80a14610995578063b6b55f25146109a8578063b745abe3146109bb578063b9b1be8b146109c3578063bcfa8937146109d6578063bdcc22e9146109e957600080fd5b8063930102f2146109465780639324cac71461094f5780639bd2e61b146109625780639faf680214610975578063a8df539f1461098857600080fd5b8063828fce881161023c578063828fce88146108fc5780638b649b941461090f5780638b844412146109185780638da5cb5b146109205780638fe812b41461093957600080fd5b806374094edd1461088b57806379ba5097146108ab5780637a1e0aa8146108b35780637f7b8c50146108c65780637f852582146108e957600080fd5b806340774ff61161039f5780635c975abb1161031c57806365e0e725116102e057806365e0e725146108045780636685fdc214610817578063681312f51461082e5780636c321c8a1461084157806371143ab91461084a5780637261b81a1461087857600080fd5b80635c975abb1461078e5780635ddd3e8314610799578063610589e1146107c4578063634e0d97146107cd578063645006ca146107fb57600080fd5b806352129e481161036357806352129e4814610739578063523e43521461074c57806353a47bb71461075f57806358c09cc0146107725780635c7b396e1461078557600080fd5b806340774ff6146106b75780634651f080146106ca57806348663e95146106f35780634ae7937f146107065780634d549a421461072657600080fd5b8063175e670011610438578063202ffce8116103fc578063202ffce8146106435780632f893de714610656578063311c56df14610669578063336d30ed14610671578063343e4f9f146106915780633b92d758146106a457600080fd5b8063175e6700146105c25780631b2a52d8146105f05780631baa8856146106035780631daae1731461060c5780631f2698ab1461062f57600080fd5b806312b19a131161047f57806312b19a131461056d57806313af403514610580578063146ca531146105935780631627540c1461059c57806316c38b3c146105af57600080fd5b806301b3eccf146104bc5780630263779e146104e257806302f97b0c146104f7578063042047cf14610535578063082f9fd414610542575b600080fd5b6104cf6104ca366004615361565b610b61565b6040519081526020015b60405180910390f35b6104f56104f0366004615422565b610bed565b005b610525610505366004615553565b608360209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016104d9565b6080546105259060ff1681565b610555610550366004615582565b610d78565b6040516001600160a01b0390911681526020016104d9565b6104cf61057b366004615523565b610db0565b6104f561058e366004615361565b610dd3565b6104cf60695481565b6104f56105aa366004615361565b610f0e565b6104f56105bd366004615498565b610f64565b6105d56105d0366004615361565b610f84565b604080519384526020840192909252908201526060016104d9565b6104f56105fe366004615523565b6110ee565b6104cf606b5481565b61052561061a366004615361565b60716020526000908152604090205460ff1681565b60685461052590600160a01b900460ff1681565b6104f5610651366004615523565b61173c565b6104f5610664366004615422565b611779565b6104f56118f6565b6104cf61067f366004615523565b60756020526000908152604090205481565b61055561069f366004615582565b611b75565b607a54610555906001600160a01b031681565b6104f56106c5366004615523565b611b91565b6105556106d8366004615523565b606c602052600090815260409020546001600160a01b031681565b608854610555906001600160a01b031681565b6104cf610714366004615523565b60706020526000908152604090205481565b6104f5610734366004615361565b611bce565b6104f56107473660046153a8565b611c4a565b6104f561075a366004615523565b611dba565b600154610555906001600160a01b031681565b6104f561078036600461537d565b611df7565b6104cf60855481565b60345460ff16610525565b6104cf6107a7366004615553565b606f60209081526000928352604080842090915290825290205481565b6104cf60785481565b6105256107db366004615553565b606e60209081526000928352604080842090915290825290205460ff1681565b6104cf60775481565b6104f5610812366004615361565b612245565b6069546000908152606d60205260409020546104cf565b6104f561083c366004615523565b6122c1565b6104cf60875481565b610525610858366004615553565b607360209081526000928352604080842090915290825290205460ff1681565b6104f5610886366004615511565b612366565b6104cf610899366004615523565b60746020526000908152604090205481565b6104f5612571565b6104f56108c136600461537d565b61266e565b6105256108d4366004615361565b607e6020526000908152604090205460ff1681565b6104f56108f7366004615361565b6126d6565b6104f561090a3660046153e9565b612752565b6104cf606a5481565b6104f5612a86565b600054610555906201000090046001600160a01b031681565b6082546105259060ff1681565b6104cf607c5481565b606854610555906001600160a01b031681565b6104f5610970366004615523565b612d7d565b6104cf610983366004615361565b613083565b6084546105259060ff1681565b6104f56109a3366004615498565b613140565b6104f56109b6366004615523565b613189565b610525613850565b607d54610555906001600160a01b031681565b6104f56109e4366004615523565b613a41565b6104cf60795481565b6104f5613cc0565b610555610a08366004615361565b613e6f565b6104f5610a1b366004615361565b613e9e565b6067546105559061010090046001600160a01b031681565b6104cf610a46366004615582565b613fb7565b6104cf60765481565b6104cf60895481565b610525610a6b366004615361565b613fe6565b6104f5610a7e366004615523565b6140a5565b6104cf610a91366004615523565b6140e2565b6104f5610aa4366004615523565b6140fd565b6104f561413a565b6104f56145cb565b6104f5610ac7366004615361565b6147cc565b6104f56148dc565b61052561493a565b610555610aea366004615361565b614a91565b6104cf610afd366004615361565b60866020526000908152604090205481565b6104f5610b1d366004615498565b614b64565b607b54610555906001600160a01b031681565b610525610b43366004615361565b60816020526000908152604090205460ff1681565b6104cf607f5481565b6000806069546001610b739190615872565b607c546000828152606f602081815260408084206001600160a01b038a16808652908352818520546069548652938352818520908552909152909120549293509091610bdc91670de0b6b3a764000091610bcd9190615872565b610bd791906158aa565b614bad565b610be6919061588a565b9392505050565b610bf5614bd3565b81610c1b5760405162461bcd60e51b8152600401610c12906156b6565b60405180910390fd5b60005b82811015610d725781151560816000868685818110610c4d57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c629190615361565b6001600160a01b0316815260208101919091526040016000205460ff16151514610d60578160816000868685818110610cab57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610cc09190615361565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557ed58274bc6f4c60713f698246a052760eef650a94f38d07d09a83be0e220b37848483818110610d2857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d3d9190615361565b604080516001600160a01b03909216825284151560208301520160405180910390a15b80610d6a8161590c565b915050610c1e565b50505050565b60726020528160005260406000208181548110610d9457600080fd5b6000918252602090912001546001600160a01b03169150829050565b6000606a5482610dc091906158aa565b606b54610dcd9190615872565b92915050565b6001600160a01b038116610e295760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f742062652030000000000000006044820152606401610c12565b600154600160a01b900460ff1615610e955760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610c12565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610f16614bd3565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610f03565b610f6c614bd3565b80610f7c57610f79614c4d565b50565b610f79614ce0565b6000806000806069546001610f999190615872565b607b54604051631676539160e01b81526001600160a01b03888116600483015292935091169063167653919060240160206040518083038186803b158015610fe057600080fd5b505afa158015610ff4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611018919061553b565b9150611043670de0b6b3a7640000607c548461103491906158aa565b61103e919061588a565b614d38565b6000828152606f602081815260408084206001600160a01b038b168086529083528185205460695486529383528185209085529091529091205491955061108991615872565b84116110965760006110e4565b6000818152606f602081815260408084206001600160a01b038a16808652908352818520546069548652938352818520908552909152909120546110da90866158c9565b6110e491906158c9565b9250509193909250565b6001606660008282546111019190615872565b909155505060665460345460ff161561112c5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1661117e5760405162461bcd60e51b815260206004820152601a60248201527f526f756e6420636c6f73696e67206e6f742070726570617265640000000000006044820152606401610c12565b6069546000908152606d6020526040902054608554106111e05760405162461bcd60e51b815260206004820152601b60248201527f416c6c20757365727320616c72656164792070726f63657373656400000000006044820152606401610c12565b600082116112005760405162461bcd60e51b8152600401610c12906157c2565b6069546000908152606c60205260408120546085546001600160a01b03909116919061122d908590615872565b6069546000908152606d602052604090205490915081111561125d57506069546000908152606d60205260409020545b6085545b818110156116d8576069546000908152606d6020526040812080548390811061129a57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910154606954835260748252604080842054606f84528185206001600160a01b0390931680865292909352832054909350670de0b6b3a7640000916112e9916158aa565b6112f3919061588a565b6001600160a01b03831660009081526071602052604090205490915060ff1615801561132f575060695460009081526074602052604090205415155b156114945780606f600060695460016113489190615872565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020546113849190615872565b606f600060695460016113979190615872565b81526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002081905550606d600060695460016113df9190615872565b8152602080820192909252604001600090812080546001810182559082529190200180546001600160a01b0319166001600160a01b0384811691909117909155607b54161561148f57607b546040516302c7739b60e01b81526001600160a01b03848116600483015260248201849052909116906302c7739b90604401600060405180830381600087803b15801561147657600080fd5b505af115801561148a573d6000803e3d6000fd5b505050505b6116b2565b6001600160a01b0382166000908152608660205260409020541561160a576001600160a01b038216600090815260866020526040812054670de0b6b3a7640000906114df90846158aa565b6114e9919061588a565b606854909150611504906001600160a01b0316878584614d55565b604080516001600160a01b0385168152602081018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a16001600160a01b0383166000908152607160209081526040808320805460ff1916905560869091528120819055606954606d9190611585906001615872565b8152602080820192909252604001600090812080546001810182559082529190200180546001600160a01b0319166001600160a01b0385161790556115ca81836158c9565b606f600060695460016115dd9190615872565b8152602080820192909252604090810160009081206001600160a01b0388168252909252902055506116b2565b6000606f6000606954600161161f9190615872565b8152602080820192909252604090810160009081206001600160a01b038088168352935220919091556068546116589116868484614d55565b6001600160a01b038216600081815260716020908152604091829020805460ff19169055815192835282018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a15b6085546116c0906001615872565b608555508190506116d08161590c565b915050611261565b5060695460408051918252602082018690527f2e692c8fcabe33ba22535323e79dcb54ef22dccdb8e4ebdd9f2a7ffb1a28856c910160405180910390a1505060665481146117385760405162461bcd60e51b8152600401610c1290615804565b5050565b611744614bd3565b60788190556040518181527fe7c2c09f66c8b970b4a99250f4d0844e1496b9d51d4760a17b0134ddd52023e190602001610f03565b611781614bd3565b8161179e5760405162461bcd60e51b8152600401610c12906156b6565b60005b82811015610d7257811515607e60008686858181106117d057634e487b7160e01b600052603260045260246000fd5b90506020020160208101906117e59190615361565b6001600160a01b0316815260208101919091526040016000205460ff161515146118e45781607e600086868581811061182e57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906118439190615361565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f58d7a3ccc34541e162fcfc87b84be7b78c34d1e1e7f15de6e4dd67d0fe70aecd8484838181106118ac57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906118c19190615361565b604080516001600160a01b03909216825284151560208301520160405180910390a15b806118ee8161590c565b9150506117a1565b6001606660008282546119099190615872565b9091555050606654606854600160a01b900460ff1661193a5760405162461bcd60e51b8152600401610c1290615642565b3360009081526071602052604090205460ff161561199a5760405162461bcd60e51b815260206004820152601c60248201527f5769746864726177616c20616c726561647920726571756573746564000000006044820152606401610c12565b6069546000908152606f602090815260408083203384529091529020546119f95760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b6044820152606401610c12565b606f60006069546001611a0c9190615872565b81526020808201929092526040908101600090812033825290925290205415611a475760405162461bcd60e51b8152600401610c129061576c565b60345460ff1615611a6a5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615611a8d5760405162461bcd60e51b8152600401610c1290615725565b6069546000908152606f60209081526040808320338452909152902054607f541115611aee576069546000908152606f60209081526040808320338452909152812054607f805491929091611ae39084906158c9565b90915550611af49050565b6000607f555b6001607954611b0391906158c9565b60795533600081815260716020908152604091829020805460ff1916600117905590519182527fe5892ff2a8b08efb903ffbba1f0514c1d3e22eea34dd5b89cf30aabce03dde5a910160405180910390a16066548114610f795760405162461bcd60e51b8152600401610c1290615804565b606d6020528160005260406000208181548110610d9457600080fd5b611b99614bd3565b60878190556040518181527fc117ccf765672707ebe3c1606037488c1e27dc1f42b5266e3d6b496db7d4209e90602001610f03565b611bd6614bd3565b6001600160a01b038116611bfc5760405162461bcd60e51b8152600401610c129061583b565b607d80546001600160a01b0319166001600160a01b0383169081179091556040519081527fa65a5aa86bb6f8e75752296da3ebda45474c8a302fc640c3b62868793862a03390602001610f03565b600160666000828254611c5d9190615872565b909155505060665460345460ff1615611c885760405162461bcd60e51b8152600401610c12906156fb565b60675461010090046001600160a01b03163314611cb75760405162461bcd60e51b8152600401610c1290615670565b60845460ff1615611cda5760405162461bcd60e51b8152600401610c1290615725565b8215611d9957606854600160a01b900460ff16611d095760405162461bcd60e51b8152600401610c1290615642565b6000611d1485613083565b90506000611d2182614daf565b606754604051633cf57f7560e21b81526001600160a01b038781166004830152602482018990526101009092048216604482015291925082169063f3d5fdd490606401600060405180830381600087803b158015611d7e57600080fd5b505af1158015611d92573d6000803e3d6000fd5b5050505050505b6066548114610d725760405162461bcd60e51b8152600401610c1290615804565b611dc2614bd3565b607c8190556040518181527f0ab181347eaf5a96cb64bea3472557f6289756307e58cda5e2a81911b4e7689e90602001610f03565b600160666000828254611e0a9190615872565b909155505060665460345460ff1615611e355760405162461bcd60e51b8152600401610c12906156fb565b60675461010090046001600160a01b03163314611e645760405162461bcd60e51b8152600401610c1290615670565b60845460ff1615611e875760405162461bcd60e51b8152600401610c1290615725565b606854600160a01b900460ff16611eb05760405162461bcd60e51b8152600401610c1290615642565b60008211611f005760405162461bcd60e51b815260206004820152601960248201527f43616e277420636f6d6d69742061207a65726f207472616465000000000000006044820152606401610c12565b611f0982614d38565b60825490925060ff16611f1c5781611f27565b611f27826001615872565b91506000611f3484613083565b90506000611f4182614daf565b90506069548214156120a657606754606854611f71916001600160a01b0391821691849161010090041687614d55565b608754606954600090815260706020526040902054670de0b6b3a764000091611f99916158aa565b611fa3919061588a565b606954600090815260706020526040902054611fbf91906158c9565b6068546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a082319060240160206040518083038186803b15801561200457600080fd5b505afa158015612018573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203c919061553b565b10156120a15760405162461bcd60e51b815260206004820152602e60248201527f416d6f756e74206578636565647320617661696c61626c65207574696c697a6160448201526d1d1a5bdb88199bdc881c9bdd5b9960921b6064820152608401610c12565b612197565b6068546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a082319060240160206040518083038186803b1580156120ec57600080fd5b505afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612124919061553b565b905084811061215657606754606854612151916001600160a01b0391821691859161010090041688614d55565b612195565b600061216282876158c9565b905061216f818486614f50565b606754606854612193916001600160a01b0391821691869161010090041689614d55565b505b505b60008281526073602090815260408083206001600160a01b038916845290915290205460ff1661221d5760008281526072602090815260408083208054600180820183559185528385200180546001600160a01b0319166001600160a01b038b1690811790915586855260738452828520908552909252909120805460ff191690911790555b505060665481146122405760405162461bcd60e51b8152600401610c1290615804565b505050565b61224d614bd3565b6001600160a01b0381166122735760405162461bcd60e51b8152600401610c129061583b565b607a80546001600160a01b0319166001600160a01b0383169081179091556040519081527faaf6f0738515c3cf390f1b3faec649d2dacb169d024089afc43bbe2fe66cd2d890602001610f03565b6122c9614bd3565b606854600160a01b900460ff16156123315760405162461bcd60e51b815260206004820152602560248201527f43616e2774206368616e676520726f756e64206c656e677468206166746572206044820152641cdd185c9d60da1b6064820152608401610c12565b606a8190556040518181527f1d1fb7111c3779798bd4aefb2daea07ee8257a13c7eaceba89b4b1ccd405050d90602001610f03565b600054610100900460ff166123815760005460ff1615612385565b303b155b6123e85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c12565b600054610100900460ff1615801561240a576000805461ffff19166101011790555b61241a61058e6020840184615361565b6124226148dc565b6124326040830160208401615361565b606780546001600160a01b039290921661010002610100600160a81b03199092169190911790556124696060830160408401615361565b606880546001600160a01b0319166001600160a01b03929092169190911790556060820135606a55608082013560765560a082013560775560c08201356078556124ba610100830160e08401615498565b6082805460ff191691151591909117905560685460675460405163095ea7b360e01b81526101009091046001600160a01b03908116600483015260001960248301529091169063095ea7b390604401602060405180830381600087803b15801561252357600080fd5b505af1158015612537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255b91906154b4565b508015611738576000805461ff00191690555050565b6001546001600160a01b031633146125e95760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610c12565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b612676614bd3565b608880546001600160a01b0319166001600160a01b038416908117909155608982905560408051918252602082018390527fa1a8623472ca4e2879372be60dfd1ff0675778e49f7379eedd98ca57cf36b21a910160405180910390a15050565b6126de614bd3565b6001600160a01b0381166127045760405162461bcd60e51b8152600401610c129061583b565b607b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f3c7faa500efbd341aedbf1ee7ebd52ea36d226dda76bc01dd39b43d46f55b8d390602001610f03565b6001606660008282546127659190615872565b909155505060665460345460ff16156127905760405162461bcd60e51b8152600401610c12906156fb565b60675461010090046001600160a01b031633146127bf5760405162461bcd60e51b8152600401610c1290615670565b60845460ff16156127e25760405162461bcd60e51b8152600401610c1290615725565b8215611d9957606854600160a01b900460ff166128115760405162461bcd60e51b8152600401610c1290615642565b600061281c85613083565b9050600061282982614daf565b90506000806000886001600160a01b031663cc2ee1966040518163ffffffff1660e01b815260040160606040518083038186803b15801561286957600080fd5b505afa15801561287d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a191906154d0565b919450925090506001600160a01b0383166128e35760405162461bcd60e51b8152602060048201526002602482015261304160f01b6044820152606401610c12565b60008088600281111561290657634e487b7160e01b600052602160045260246000fd5b146129115782612913565b835b905060028a6001600160a01b0316631a1dbabb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561295057600080fd5b505afa158015612964573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612988919061553b565b1180156129b5575060008860028111156129b257634e487b7160e01b600052602160045260246000fd5b14155b156129ec5760018860028111156129dc57634e487b7160e01b600052602160045260246000fd5b146129e757816129e9565b825b90505b606754604051633cf57f7560e21b81526001600160a01b038381166004830152602482018c9052610100909204821660448201529086169063f3d5fdd490606401600060405180830381600087803b158015612a4757600080fd5b505af1158015612a5b573d6000803e3d6000fd5b505050505050505050506066548114610d725760405162461bcd60e51b8152600401610c1290615804565b600160666000828254612a999190615872565b909155505060665460345460ff1615612ac45760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615612ae75760405162461bcd60e51b8152600401610c1290615725565b612aef61493a565b612b3b5760405162461bcd60e51b815260206004820152601960248201527f43616e277420636c6f73652063757272656e7420726f756e64000000000000006044820152606401610c12565b612b436145cb565b6069546000908152606c60205260408082205460685491516370a0823160e01b81526001600160a01b0391821660048201819052939291909116906370a082319060240160206040518083038186803b158015612b9f57600080fd5b505afa158015612bb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd7919061553b565b606954600090815260706020526040902054909150811115612c9f576089546069546000908152607060205260408120549091670de0b6b3a764000091612c1e90856158c9565b612c2891906158aa565b612c32919061588a565b608854606854919250612c54916001600160a01b039081169186911684614d55565b612c5e81836158c9565b60895460408051918252602082018490529193507fb8379d05082aa2dd32963972d72cc2d46257811133341855b63bb2fddda6ca3e910160405180910390a1505b606954600090815260706020526040902054612ccf57606954600090815260746020526040902060019055612d10565b606954600090815260706020526040902054612cf3670de0b6b3a7640000836158aa565b612cfd919061588a565b6069546000908152607460205260409020555b6084805460ff191660011790556069546040517fa224cce482b24082d1d3128437615f7f5ce87b97453a11114846ea442a10027291612d529190815260200190565b60405180910390a150506066548114610f795760405162461bcd60e51b8152600401610c1290615804565b600160666000828254612d909190615872565b9091555050606654606854600160a01b900460ff16612dc15760405162461bcd60e51b8152600401610c1290615642565b3360009081526071602052604090205460ff1615612e215760405162461bcd60e51b815260206004820152601c60248201527f5769746864726177616c20616c726561647920726571756573746564000000006044820152606401610c12565b6069546000908152606f60209081526040808320338452909152902054612e805760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b6044820152606401610c12565b606f60006069546001612e939190615872565b81526020808201929092526040908101600090812033825290925290205415612ece5760405162461bcd60e51b8152600401610c129061576c565b60345460ff1615612ef15760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615612f145760405162461bcd60e51b8152600401610c1290615725565b612f26662386f26fc10000600a6158aa565b8210158015612f465750612f42662386f26fc10000605a6158aa565b8211155b612f9e5760405162461bcd60e51b815260206004820152602360248201527f53686172652068617320746f206265206265747765656e2031302520616e642060448201526239302560e81b6064820152608401610c12565b6069546000908152606f60209081526040808320338452909152812054670de0b6b3a764000090612fd09085906158aa565b612fda919061588a565b905080607f5411156130035780607f6000828254612ff891906158c9565b909155506130099050565b6000607f555b336000818152607160209081526040808320805460ff19166001179055608682529182902086905590519182527fe5892ff2a8b08efb903ffbba1f0514c1d3e22eea34dd5b89cf30aabce03dde5a910160405180910390a15060665481146117385760405162461bcd60e51b8152600401610c1290615804565b6000808290506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b1580156130c357600080fd5b505afa1580156130d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fb91906155a3565b509050606b5481111561313457606a54606b5461311890836158c9565b613122919061588a565b61312d906001615872565b9250613139565b600192505b5050919050565b613148614bd3565b6080805460ff19168215159081179091556040519081527fce63b353cbe0da11fd36f2a8c159a473f677194eac2cdd7bd5291d281d77ce7d90602001610f03565b33600090815260716020526040902054819060ff16156131fb5760405162461bcd60e51b815260206004820152602760248201527f5769746864726177616c206973207265717565737465642c2063616e6e6f742060448201526619195c1bdcda5d60ca1b6064820152608401610c12565b60765481607f5461320c9190615872565b11156132645760405162461bcd60e51b815260206004820152602160248201527f4465706f73697420616d6f756e74206578636565647320414d4d204c502063616044820152600760fc1b6064820152608401610c12565b6069546000908152606f602090815260408083203384529091529020541580156132bc5750606f6000606954600161329c9190615872565b815260208082019290925260409081016000908120338252909252902054155b1561331d5760775481101561331d5760405162461bcd60e51b815260206004820152602160248201527f416d6f756e74206c657373207468616e206d696e4465706f736974416d6f756e6044820152601d60fa1b6064820152608401610c12565b6001606660008282546133309190615872565b909155505060665460345460ff161561335b5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff161561337e5760405162461bcd60e51b8152600401610c1290615725565b6000606954600161338f9190615872565b9050600061339c82614daf565b6068549091506133b7906001600160a01b0316338388614d55565b336000908152607e602052604090205460ff166135b85760805460ff1615806133ef57503360009081526081602052604090205460ff165b61343b5760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792077686974656c6973746564207374616b65727320616c6c6f7765646044820152606401610c12565b607b546001600160a01b031661348c5760405162461bcd60e51b815260206004820152601660248201527514dd185ada5b99c8151a185b195cc81b9bdd081cd95d60521b6044820152606401610c12565b607c54607b54604051631676539160e01b815233600482015261352492670de0b6b3a76400009290916001600160a01b039091169063167653919060240160206040518083038186803b1580156134e257600080fd5b505afa1580156134f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061351a919061553b565b61103491906158aa565b6000838152606f602081815260408084203380865290835281852054606954865293835281852090855290915290912054613560908890615872565b61356a9190615872565b11156135b85760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f756768207374616b6564205448414c455300000000000000006044820152606401610c12565b607a546001600160a01b03163314156136305760405162461bcd60e51b815260206004820152603460248201527f43616e2774206465706f736974206469726563746c792061732064656661756c6044820152733a103634b8bab4b234ba3c90383937bb34b232b960611b6064820152608401610c12565b6069546000908152606f6020908152604080832033845290915290205415801561367157506000828152606f60209081526040808320338452909152902054155b1561370a57607854607954106136c95760405162461bcd60e51b815260206004820152601b60248201527f4d617820616d6f756e74206f66207573657273207265616368656400000000006044820152606401610c12565b6000828152606d602090815260408220805460018181018355918452919092200180546001600160a01b0319163317905560795461370691615872565b6079555b6000828152606f6020908152604080832033845290915281208054879290613733908490615872565b909155505060008281526070602052604081208054879290613756908490615872565b9250508190555084607f600082825461376f9190615872565b9091555050607b546001600160a01b0316156137ea57607b546040516302c7739b60e01b8152336004820152602481018790526001600160a01b03909116906302c7739b90604401600060405180830381600087803b1580156137d157600080fd5b505af11580156137e5573d6000803e3d6000fd5b505050505b606954604080513381526020810188905280820192909252517f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca9181900360600190a1505060665481146122405760405162461bcd60e51b8152600401610c1290615804565b6069546000908152606c60205260408120546001600160a01b031681805b606954600090815260726020526040902054811015613a375760695460009081526072602052604081208054839081106138b857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff16613a2457809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561392f57600080fd5b505afa158015613943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061396791906154b4565b15613a2457604051636392a51f60e01b81526001600160a01b0385811660048301526000918291829190871690636392a51f9060240160606040518083038186803b1580156139b557600080fd5b505afa1580156139c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ed91906155c6565b9250925092506000831180613a025750600082115b80613a0d5750600081115b15613a2057600197505050505050505090565b5050505b5080613a2f8161590c565b91505061386e565b5060009250505090565b600160666000828254613a549190615872565b909155505060665460345460ff1615613a7f5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615613aa25760405162461bcd60e51b8152600401610c1290615725565b60008211613ac25760405162461bcd60e51b8152600401610c12906157c2565b6069546000908152606c60205260408120546001600160a01b03169080805b606954600090815260726020526040902054811015613c9b5785831415613b0757613c9b565b6069546000908152607260205260408120805483908110613b3857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff16613c8857809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b158015613baf57600080fd5b505afa158015613bc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613be791906154b4565b15613c885760405163bb580fbb60e01b81526001600160a01b03848116600483015286169063bb580fbb90602401600060405180830381600087803b158015613c2f57600080fd5b505af1158015613c43573d6000803e3d6000fd5b505060695460009081526083602090815260408083206001600160a01b03871684529091529020805460ff19166001908117909155613c859250905085615872565b93505b5080613c938161590c565b915050613ae1565b5050505060665481146117385760405162461bcd60e51b8152600401610c1290615804565b613cc8614bd3565b606854600160a01b900460ff1615613d2d5760405162461bcd60e51b815260206004820152602260248201527f4c697175696469747920706f6f6c2068617320616c7265616479207374617274604482015261195960f21b6064820152608401610c12565b600160005260706020527fb1a24bae1e5047fbb0cf526090cbec15c09a4036896111a8964a155b1c4771a154613da55760405162461bcd60e51b815260206004820152601d60248201527f63616e206e6f7420737461727420776974682030206465706f736974730000006044820152606401610c12565b42606b5560016069819055600090613dbc90614daf565b9050806001600160a01b0316637d3de7ce606b54613dda6001610db0565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b158015613e1857600080fd5b505af1158015613e2c573d6000803e3d6000fd5b50506068805460ff60a01b1916600160a01b17905550506040517f960682678fca98f3ed131eaf165e59544bcd738e948f0b3c64f58fa9e1c65e6090600090a150565b6000606c6000613e7e84613083565b81526020810191909152604001600020546001600160a01b031692915050565b613ea6614bd3565b6001600160a01b038116613eee5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610c12565b600154600160a81b900460ff1615613f3e5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610c12565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610f03565b6000828152607560208181526040808420546074835281852054868652939092528320549091610bdc916158aa565b6069546000908152606f602090815260408083206001600160a01b038516845290915281205415158061405d57506000606f600060695460016140299190615872565b81526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002054115b8015610dcd57506001600160a01b03821660009081526071602052604090205460ff161580610dcd5750506001600160a01b0316600090815260866020526040902054151590565b6140ad614bd3565b60778190556040518181527f990717cc219e5348c1b88bb0ff530d804f0b6f54f3b03844a2bfbe4eb1e9c5d690602001610f03565b606a546000906140f36001846158c9565b610dc091906158aa565b614105614bd3565b60768190556040518181527f8c43aa02599ac8f8bab4724621ceea5e7a06b07bbbfaf3b7bd0386cbe481ea3c90602001610f03565b60016066600082825461414d9190615872565b909155505060665460345460ff16156141785760405162461bcd60e51b8152600401610c12906156fb565b60845460ff166141ca5760405162461bcd60e51b815260206004820152601a60248201527f526f756e6420636c6f73696e67206e6f742070726570617265640000000000006044820152606401610c12565b6069546000908152606d60205260409020546085541461422c5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420616c6c2075736572732070726f6365737365642079657400000000006044820152606401610c12565b6084805460ff191690556069546000908152606c6020908152604080832054606f8352818420607a546001600160a01b03908116865293529220549116901561432657606954600090815260746020908152604080832054606f8352818420607a546001600160a01b03168552909252822054670de0b6b3a7640000916142b2916158aa565b6142bc919061588a565b607a546068549192506142de916001600160a01b039081169185911684614d55565b607a54604080516001600160a01b039092168252602082018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a1505b60695460011415614354576069546000908152607460209081526040808320546075909252909120556143b7565b606954600081815260746020526040812054670de0b6b3a7640000929091607591614381906001906158c9565b81526020019081526020016000205461439a91906158aa565b6143a4919061588a565b6069546000908152607560205260409020555b6001606960008282546143ca9190615872565b90915550506068546040516370a0823160e01b81526001600160a01b038381166004830152909116906370a082319060240160206040518083038186803b15801561441457600080fd5b505afa158015614428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061444c919061553b565b6069546000908152607060205260408120805490919061446d908490615872565b90915550506069546000818152606f60209081526040808320607a546001600160a01b0316845282528083205493835260709091529020546144af91906158c9565b607f556069546000906144c190614daf565b6068546040516370a0823160e01b81526001600160a01b03808616600483015292935061455c92859285929116906370a082319060240160206040518083038186803b15801561451057600080fd5b505afa158015614524573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614548919061553b565b6068546001600160a01b0316929190614d55565b60006085556069547fc67dda8e11f1aa941c7e74466b1859a07a32f46aaf641d29b83be348424d93cd90614592906001906158c9565b6074600060016069546145a591906158c9565b815260200190815260200160002054604051612d52929190918252602082015260400190565b60345460ff16156145ee5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff16156146115760405162461bcd60e51b8152600401610c1290615725565b6069546000908152606c60205260408120546001600160a01b031690805b60695460009081526072602052604090205481101561224057606954600090815260726020526040812080548390811061467957634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff166147b957809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b1580156146f057600080fd5b505afa158015614704573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061472891906154b4565b156147b95760405163bb580fbb60e01b81526001600160a01b03848116600483015285169063bb580fbb90602401600060405180830381600087803b15801561477057600080fd5b505af1158015614784573d6000803e3d6000fd5b505060695460009081526083602090815260408083206001600160a01b03871684529091529020805460ff1916600117905550505b50806147c48161590c565b91505061462f565b6147d4614bd3565b6001600160a01b0381166147fa5760405162461bcd60e51b8152600401610c129061583b565b60678054610100600160a81b0319166101006001600160a01b038481168202929092179283905560685460405163095ea7b360e01b81529190930482166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561486a57600080fd5b505af115801561487e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148a291906154b4565b506040516001600160a01b03821681527f576297e5fcc8cd907ee80b240284865eb3d821bdc5232e6ee9e4d78a12531c0990602001610f03565b60675460ff16156149255760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610c12565b6067805460ff19166001908117909155606655565b606854600090600160a01b900460ff16158061495f575061495c606954610db0565b42105b1561496a5750600090565b6000805b606954600090815260726020526040902054811015614a885760695460009081526072602052604081208054839081106149b857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff16614a7557809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b158015614a2f57600080fd5b505afa158015614a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a6791906154b4565b614a75576000935050505090565b5080614a808161590c565b91505061496e565b50600191505090565b60675460009061010090046001600160a01b03163314614ac35760405162461bcd60e51b8152600401610c1290615670565b600160666000828254614ad69190615872565b909155505060665460345460ff1615614b015760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615614b245760405162461bcd60e51b8152600401610c1290615725565b6000614b2f84613083565b9050614b3a81614daf565b9250506066548114614b5e5760405162461bcd60e51b8152600401610c1290615804565b50919050565b614b6c614bd3565b6082805460ff19168215159081179091556040519081527f3a29a049ec4616dc818362d5757e4a4d73bea0c4976a777f49fac773624ed9e590602001610f03565b60825460009060ff1615614bca57610dcd8264e8d4a510006158aa565b5090565b919050565b6000546201000090046001600160a01b03163314614c4b5760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610c12565b565b60345460ff16614c965760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c12565b6034805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60345460ff1615614d035760405162461bcd60e51b8152600401610c12906156fb565b6034805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614cc33390565b60825460009060ff1615614bca57610dcd64e8d4a510008361588a565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610d7290859061507f565b6000818152606c60205260409020546001600160a01b031680614bce57607d546001600160a01b0316614e245760405162461bcd60e51b815260206004820152601d60248201527f526f756e6420706f6f6c206d6173746572636f7079206e6f74207365740000006044820152606401610c12565b607d54600090614e3c906001600160a01b0316615151565b6068549091506001600160a01b038083169163d13f90b49130911686614e6661057b6001836158c9565b614e6f89610db0565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015260448401919091526064830152608482015260a401600060405180830381600087803b158015614ecb57600080fd5b505af1158015614edf573d6000803e3d6000fd5b5050506000848152606c602090815260409182902080546001600160a01b0319166001600160a01b03861690811790915582518781529182015292935083927f24c1b21b902a85b5039d7d72427d9376657229eea77880ec9e62031dc950f6ba92500160405180910390a150919050565b607a546001600160a01b0316614fb35760405162461bcd60e51b815260206004820152602260248201527f64656661756c74206c69717569646974792070726f7669646572206e6f742073604482015261195d60f21b6064820152608401610c12565b607a54606854614fd1916001600160a01b0391821691168486614d55565b6000818152606f60209081526040808320607a546001600160a01b0316845290915281208054859290615005908490615872565b909155505060008181526070602052604081208054859290615028908490615872565b9091555050607a54604080516001600160a01b0390921682526020820185905281018290527f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca9060600160405180910390a1505050565b60006150d4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166151e99092919063ffffffff16565b80519091501561224057808060200190518101906150f291906154b4565b6122405760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c12565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116614bce5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610c12565b60606151f88484600085615200565b949350505050565b6060824710156152615760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c12565b843b6152af5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c12565b600080866001600160a01b031685876040516152cb91906155f3565b60006040518083038185875af1925050503d8060008114615308576040519150601f19603f3d011682016040523d82523d6000602084013e61530d565b606091505b509150915061531d828286615328565b979650505050505050565b60608315615337575081610be6565b8251156153475782518084602001fd5b8160405162461bcd60e51b8152600401610c12919061560f565b600060208284031215615372578081fd5b8135610be68161593d565b6000806040838503121561538f578081fd5b823561539a8161593d565b946020939093013593505050565b6000806000606084860312156153bc578081fd5b83356153c78161593d565b92506020840135915060408401356153de8161593d565b809150509250925092565b6000806000606084860312156153fd578283fd5b83356154088161593d565b9250602084013591506040840135600381106153de578182fd5b600080600060408486031215615436578283fd5b833567ffffffffffffffff8082111561544d578485fd5b818601915086601f830112615460578485fd5b81358181111561546e578586fd5b8760208260051b8501011115615482578586fd5b602092830195509350508401356153de81615952565b6000602082840312156154a9578081fd5b8135610be681615952565b6000602082840312156154c5578081fd5b8151610be681615952565b6000806000606084860312156154e4578283fd5b83516154ef8161593d565b60208501519093506155008161593d565b60408501519092506153de8161593d565b60006101008284031215614b5e578081fd5b600060208284031215615534578081fd5b5035919050565b60006020828403121561554c578081fd5b5051919050565b60008060408385031215615565578182fd5b8235915060208301356155778161593d565b809150509250929050565b60008060408385031215615594578182fd5b50508035926020909101359150565b600080604083850312156155b5578182fd5b505080516020909101519092909150565b6000806000606084860312156155da578081fd5b8351925060208401519150604084015190509250925092565b600082516156058184602087016158e0565b9190910192915050565b602081526000825180602084015261562e8160408501602087016158e0565b601f01601f19169190910160400192915050565b602080825260149082015273141bdbdb081a185cc81b9bdd081cdd185c9d195960621b604082015260600190565b60208082526026908201527f6f6e6c792074686520414d4d206d617920706572666f726d207468657365206d6040820152656574686f647360d01b606082015260800190565b60208082526025908201527f57686974656c6973746564206164647265737365732063616e6e6f7420626520604082015264656d70747960d81b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526027908201527f4e6f7420616c6c6f77656420647572696e6720726f756e64436c6f73696e67506040820152661c995c185c995960ca1b606082015260800190565b60208082526036908201527f43616e277420776974686472617720617320796f7520616c72656164792064656040820152751c1bdcda5d195908199bdc881b995e1d081c9bdd5b9960521b606082015260800190565b60208082526022908201527f626174636853697a652068617320746f2062652067726561746572207468616e604082015261020360f41b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601b908201527f43616e206e6f74207365742061207a65726f2061646472657373210000000000604082015260600190565b6000821982111561588557615885615927565b500190565b6000826158a557634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156158c4576158c4615927565b500290565b6000828210156158db576158db615927565b500390565b60005b838110156158fb5781810151838201526020016158e3565b83811115610d725750506000910152565b600060001982141561592057615920615927565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610f7957600080fd5b8015158114610f7957600080fdfea2646970667358221220d2bf733f5c42a0876e576e0efe7c7be0386c7ca60838655bd40c1d0e803bfc7b64736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106104b75760003560e01c806374094edd11610278578063be9a65551161015c578063e278fe6f116100ce578063f475f13b11610092578063f475f13b14610adc578063f61fcb8b14610aef578063fab44cbb14610b0f578063fd8a8cc614610b22578063fdaf17f014610b35578063ff50abdc14610b5857600080fd5b8063e278fe6f14610aa9578063e3041fd914610ab1578063e45b2e8814610ab9578063ebc7977214610acc578063ee161cce14610ad457600080fd5b8063d27c079711610120578063d27c079714610a4b578063d69fb66814610a54578063d95ad45c14610a5d578063db7f92d414610a70578063ddc6ac2314610a83578063ddcc8fe914610a9657600080fd5b8063be9a6555146109f2578063c2edfc73146109fa578063c3b83f5f14610a0d578063c992528814610a20578063c9f4ff4614610a3857600080fd5b8063930102f2116101f5578063afbbb80a116101b9578063afbbb80a14610995578063b6b55f25146109a8578063b745abe3146109bb578063b9b1be8b146109c3578063bcfa8937146109d6578063bdcc22e9146109e957600080fd5b8063930102f2146109465780639324cac71461094f5780639bd2e61b146109625780639faf680214610975578063a8df539f1461098857600080fd5b8063828fce881161023c578063828fce88146108fc5780638b649b941461090f5780638b844412146109185780638da5cb5b146109205780638fe812b41461093957600080fd5b806374094edd1461088b57806379ba5097146108ab5780637a1e0aa8146108b35780637f7b8c50146108c65780637f852582146108e957600080fd5b806340774ff61161039f5780635c975abb1161031c57806365e0e725116102e057806365e0e725146108045780636685fdc214610817578063681312f51461082e5780636c321c8a1461084157806371143ab91461084a5780637261b81a1461087857600080fd5b80635c975abb1461078e5780635ddd3e8314610799578063610589e1146107c4578063634e0d97146107cd578063645006ca146107fb57600080fd5b806352129e481161036357806352129e4814610739578063523e43521461074c57806353a47bb71461075f57806358c09cc0146107725780635c7b396e1461078557600080fd5b806340774ff6146106b75780634651f080146106ca57806348663e95146106f35780634ae7937f146107065780634d549a421461072657600080fd5b8063175e670011610438578063202ffce8116103fc578063202ffce8146106435780632f893de714610656578063311c56df14610669578063336d30ed14610671578063343e4f9f146106915780633b92d758146106a457600080fd5b8063175e6700146105c25780631b2a52d8146105f05780631baa8856146106035780631daae1731461060c5780631f2698ab1461062f57600080fd5b806312b19a131161047f57806312b19a131461056d57806313af403514610580578063146ca531146105935780631627540c1461059c57806316c38b3c146105af57600080fd5b806301b3eccf146104bc5780630263779e146104e257806302f97b0c146104f7578063042047cf14610535578063082f9fd414610542575b600080fd5b6104cf6104ca366004615361565b610b61565b6040519081526020015b60405180910390f35b6104f56104f0366004615422565b610bed565b005b610525610505366004615553565b608360209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016104d9565b6080546105259060ff1681565b610555610550366004615582565b610d78565b6040516001600160a01b0390911681526020016104d9565b6104cf61057b366004615523565b610db0565b6104f561058e366004615361565b610dd3565b6104cf60695481565b6104f56105aa366004615361565b610f0e565b6104f56105bd366004615498565b610f64565b6105d56105d0366004615361565b610f84565b604080519384526020840192909252908201526060016104d9565b6104f56105fe366004615523565b6110ee565b6104cf606b5481565b61052561061a366004615361565b60716020526000908152604090205460ff1681565b60685461052590600160a01b900460ff1681565b6104f5610651366004615523565b61173c565b6104f5610664366004615422565b611779565b6104f56118f6565b6104cf61067f366004615523565b60756020526000908152604090205481565b61055561069f366004615582565b611b75565b607a54610555906001600160a01b031681565b6104f56106c5366004615523565b611b91565b6105556106d8366004615523565b606c602052600090815260409020546001600160a01b031681565b608854610555906001600160a01b031681565b6104cf610714366004615523565b60706020526000908152604090205481565b6104f5610734366004615361565b611bce565b6104f56107473660046153a8565b611c4a565b6104f561075a366004615523565b611dba565b600154610555906001600160a01b031681565b6104f561078036600461537d565b611df7565b6104cf60855481565b60345460ff16610525565b6104cf6107a7366004615553565b606f60209081526000928352604080842090915290825290205481565b6104cf60785481565b6105256107db366004615553565b606e60209081526000928352604080842090915290825290205460ff1681565b6104cf60775481565b6104f5610812366004615361565b612245565b6069546000908152606d60205260409020546104cf565b6104f561083c366004615523565b6122c1565b6104cf60875481565b610525610858366004615553565b607360209081526000928352604080842090915290825290205460ff1681565b6104f5610886366004615511565b612366565b6104cf610899366004615523565b60746020526000908152604090205481565b6104f5612571565b6104f56108c136600461537d565b61266e565b6105256108d4366004615361565b607e6020526000908152604090205460ff1681565b6104f56108f7366004615361565b6126d6565b6104f561090a3660046153e9565b612752565b6104cf606a5481565b6104f5612a86565b600054610555906201000090046001600160a01b031681565b6082546105259060ff1681565b6104cf607c5481565b606854610555906001600160a01b031681565b6104f5610970366004615523565b612d7d565b6104cf610983366004615361565b613083565b6084546105259060ff1681565b6104f56109a3366004615498565b613140565b6104f56109b6366004615523565b613189565b610525613850565b607d54610555906001600160a01b031681565b6104f56109e4366004615523565b613a41565b6104cf60795481565b6104f5613cc0565b610555610a08366004615361565b613e6f565b6104f5610a1b366004615361565b613e9e565b6067546105559061010090046001600160a01b031681565b6104cf610a46366004615582565b613fb7565b6104cf60765481565b6104cf60895481565b610525610a6b366004615361565b613fe6565b6104f5610a7e366004615523565b6140a5565b6104cf610a91366004615523565b6140e2565b6104f5610aa4366004615523565b6140fd565b6104f561413a565b6104f56145cb565b6104f5610ac7366004615361565b6147cc565b6104f56148dc565b61052561493a565b610555610aea366004615361565b614a91565b6104cf610afd366004615361565b60866020526000908152604090205481565b6104f5610b1d366004615498565b614b64565b607b54610555906001600160a01b031681565b610525610b43366004615361565b60816020526000908152604090205460ff1681565b6104cf607f5481565b6000806069546001610b739190615872565b607c546000828152606f602081815260408084206001600160a01b038a16808652908352818520546069548652938352818520908552909152909120549293509091610bdc91670de0b6b3a764000091610bcd9190615872565b610bd791906158aa565b614bad565b610be6919061588a565b9392505050565b610bf5614bd3565b81610c1b5760405162461bcd60e51b8152600401610c12906156b6565b60405180910390fd5b60005b82811015610d725781151560816000868685818110610c4d57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c629190615361565b6001600160a01b0316815260208101919091526040016000205460ff16151514610d60578160816000868685818110610cab57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610cc09190615361565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557ed58274bc6f4c60713f698246a052760eef650a94f38d07d09a83be0e220b37848483818110610d2857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d3d9190615361565b604080516001600160a01b03909216825284151560208301520160405180910390a15b80610d6a8161590c565b915050610c1e565b50505050565b60726020528160005260406000208181548110610d9457600080fd5b6000918252602090912001546001600160a01b03169150829050565b6000606a5482610dc091906158aa565b606b54610dcd9190615872565b92915050565b6001600160a01b038116610e295760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f742062652030000000000000006044820152606401610c12565b600154600160a01b900460ff1615610e955760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610c12565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610f16614bd3565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610f03565b610f6c614bd3565b80610f7c57610f79614c4d565b50565b610f79614ce0565b6000806000806069546001610f999190615872565b607b54604051631676539160e01b81526001600160a01b03888116600483015292935091169063167653919060240160206040518083038186803b158015610fe057600080fd5b505afa158015610ff4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611018919061553b565b9150611043670de0b6b3a7640000607c548461103491906158aa565b61103e919061588a565b614d38565b6000828152606f602081815260408084206001600160a01b038b168086529083528185205460695486529383528185209085529091529091205491955061108991615872565b84116110965760006110e4565b6000818152606f602081815260408084206001600160a01b038a16808652908352818520546069548652938352818520908552909152909120546110da90866158c9565b6110e491906158c9565b9250509193909250565b6001606660008282546111019190615872565b909155505060665460345460ff161561112c5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1661117e5760405162461bcd60e51b815260206004820152601a60248201527f526f756e6420636c6f73696e67206e6f742070726570617265640000000000006044820152606401610c12565b6069546000908152606d6020526040902054608554106111e05760405162461bcd60e51b815260206004820152601b60248201527f416c6c20757365727320616c72656164792070726f63657373656400000000006044820152606401610c12565b600082116112005760405162461bcd60e51b8152600401610c12906157c2565b6069546000908152606c60205260408120546085546001600160a01b03909116919061122d908590615872565b6069546000908152606d602052604090205490915081111561125d57506069546000908152606d60205260409020545b6085545b818110156116d8576069546000908152606d6020526040812080548390811061129a57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910154606954835260748252604080842054606f84528185206001600160a01b0390931680865292909352832054909350670de0b6b3a7640000916112e9916158aa565b6112f3919061588a565b6001600160a01b03831660009081526071602052604090205490915060ff1615801561132f575060695460009081526074602052604090205415155b156114945780606f600060695460016113489190615872565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020546113849190615872565b606f600060695460016113979190615872565b81526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002081905550606d600060695460016113df9190615872565b8152602080820192909252604001600090812080546001810182559082529190200180546001600160a01b0319166001600160a01b0384811691909117909155607b54161561148f57607b546040516302c7739b60e01b81526001600160a01b03848116600483015260248201849052909116906302c7739b90604401600060405180830381600087803b15801561147657600080fd5b505af115801561148a573d6000803e3d6000fd5b505050505b6116b2565b6001600160a01b0382166000908152608660205260409020541561160a576001600160a01b038216600090815260866020526040812054670de0b6b3a7640000906114df90846158aa565b6114e9919061588a565b606854909150611504906001600160a01b0316878584614d55565b604080516001600160a01b0385168152602081018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a16001600160a01b0383166000908152607160209081526040808320805460ff1916905560869091528120819055606954606d9190611585906001615872565b8152602080820192909252604001600090812080546001810182559082529190200180546001600160a01b0319166001600160a01b0385161790556115ca81836158c9565b606f600060695460016115dd9190615872565b8152602080820192909252604090810160009081206001600160a01b0388168252909252902055506116b2565b6000606f6000606954600161161f9190615872565b8152602080820192909252604090810160009081206001600160a01b038088168352935220919091556068546116589116868484614d55565b6001600160a01b038216600081815260716020908152604091829020805460ff19169055815192835282018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a15b6085546116c0906001615872565b608555508190506116d08161590c565b915050611261565b5060695460408051918252602082018690527f2e692c8fcabe33ba22535323e79dcb54ef22dccdb8e4ebdd9f2a7ffb1a28856c910160405180910390a1505060665481146117385760405162461bcd60e51b8152600401610c1290615804565b5050565b611744614bd3565b60788190556040518181527fe7c2c09f66c8b970b4a99250f4d0844e1496b9d51d4760a17b0134ddd52023e190602001610f03565b611781614bd3565b8161179e5760405162461bcd60e51b8152600401610c12906156b6565b60005b82811015610d7257811515607e60008686858181106117d057634e487b7160e01b600052603260045260246000fd5b90506020020160208101906117e59190615361565b6001600160a01b0316815260208101919091526040016000205460ff161515146118e45781607e600086868581811061182e57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906118439190615361565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f58d7a3ccc34541e162fcfc87b84be7b78c34d1e1e7f15de6e4dd67d0fe70aecd8484838181106118ac57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906118c19190615361565b604080516001600160a01b03909216825284151560208301520160405180910390a15b806118ee8161590c565b9150506117a1565b6001606660008282546119099190615872565b9091555050606654606854600160a01b900460ff1661193a5760405162461bcd60e51b8152600401610c1290615642565b3360009081526071602052604090205460ff161561199a5760405162461bcd60e51b815260206004820152601c60248201527f5769746864726177616c20616c726561647920726571756573746564000000006044820152606401610c12565b6069546000908152606f602090815260408083203384529091529020546119f95760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b6044820152606401610c12565b606f60006069546001611a0c9190615872565b81526020808201929092526040908101600090812033825290925290205415611a475760405162461bcd60e51b8152600401610c129061576c565b60345460ff1615611a6a5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615611a8d5760405162461bcd60e51b8152600401610c1290615725565b6069546000908152606f60209081526040808320338452909152902054607f541115611aee576069546000908152606f60209081526040808320338452909152812054607f805491929091611ae39084906158c9565b90915550611af49050565b6000607f555b6001607954611b0391906158c9565b60795533600081815260716020908152604091829020805460ff1916600117905590519182527fe5892ff2a8b08efb903ffbba1f0514c1d3e22eea34dd5b89cf30aabce03dde5a910160405180910390a16066548114610f795760405162461bcd60e51b8152600401610c1290615804565b606d6020528160005260406000208181548110610d9457600080fd5b611b99614bd3565b60878190556040518181527fc117ccf765672707ebe3c1606037488c1e27dc1f42b5266e3d6b496db7d4209e90602001610f03565b611bd6614bd3565b6001600160a01b038116611bfc5760405162461bcd60e51b8152600401610c129061583b565b607d80546001600160a01b0319166001600160a01b0383169081179091556040519081527fa65a5aa86bb6f8e75752296da3ebda45474c8a302fc640c3b62868793862a03390602001610f03565b600160666000828254611c5d9190615872565b909155505060665460345460ff1615611c885760405162461bcd60e51b8152600401610c12906156fb565b60675461010090046001600160a01b03163314611cb75760405162461bcd60e51b8152600401610c1290615670565b60845460ff1615611cda5760405162461bcd60e51b8152600401610c1290615725565b8215611d9957606854600160a01b900460ff16611d095760405162461bcd60e51b8152600401610c1290615642565b6000611d1485613083565b90506000611d2182614daf565b606754604051633cf57f7560e21b81526001600160a01b038781166004830152602482018990526101009092048216604482015291925082169063f3d5fdd490606401600060405180830381600087803b158015611d7e57600080fd5b505af1158015611d92573d6000803e3d6000fd5b5050505050505b6066548114610d725760405162461bcd60e51b8152600401610c1290615804565b611dc2614bd3565b607c8190556040518181527f0ab181347eaf5a96cb64bea3472557f6289756307e58cda5e2a81911b4e7689e90602001610f03565b600160666000828254611e0a9190615872565b909155505060665460345460ff1615611e355760405162461bcd60e51b8152600401610c12906156fb565b60675461010090046001600160a01b03163314611e645760405162461bcd60e51b8152600401610c1290615670565b60845460ff1615611e875760405162461bcd60e51b8152600401610c1290615725565b606854600160a01b900460ff16611eb05760405162461bcd60e51b8152600401610c1290615642565b60008211611f005760405162461bcd60e51b815260206004820152601960248201527f43616e277420636f6d6d69742061207a65726f207472616465000000000000006044820152606401610c12565b611f0982614d38565b60825490925060ff16611f1c5781611f27565b611f27826001615872565b91506000611f3484613083565b90506000611f4182614daf565b90506069548214156120a657606754606854611f71916001600160a01b0391821691849161010090041687614d55565b608754606954600090815260706020526040902054670de0b6b3a764000091611f99916158aa565b611fa3919061588a565b606954600090815260706020526040902054611fbf91906158c9565b6068546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a082319060240160206040518083038186803b15801561200457600080fd5b505afa158015612018573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203c919061553b565b10156120a15760405162461bcd60e51b815260206004820152602e60248201527f416d6f756e74206578636565647320617661696c61626c65207574696c697a6160448201526d1d1a5bdb88199bdc881c9bdd5b9960921b6064820152608401610c12565b612197565b6068546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a082319060240160206040518083038186803b1580156120ec57600080fd5b505afa158015612100573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612124919061553b565b905084811061215657606754606854612151916001600160a01b0391821691859161010090041688614d55565b612195565b600061216282876158c9565b905061216f818486614f50565b606754606854612193916001600160a01b0391821691869161010090041689614d55565b505b505b60008281526073602090815260408083206001600160a01b038916845290915290205460ff1661221d5760008281526072602090815260408083208054600180820183559185528385200180546001600160a01b0319166001600160a01b038b1690811790915586855260738452828520908552909252909120805460ff191690911790555b505060665481146122405760405162461bcd60e51b8152600401610c1290615804565b505050565b61224d614bd3565b6001600160a01b0381166122735760405162461bcd60e51b8152600401610c129061583b565b607a80546001600160a01b0319166001600160a01b0383169081179091556040519081527faaf6f0738515c3cf390f1b3faec649d2dacb169d024089afc43bbe2fe66cd2d890602001610f03565b6122c9614bd3565b606854600160a01b900460ff16156123315760405162461bcd60e51b815260206004820152602560248201527f43616e2774206368616e676520726f756e64206c656e677468206166746572206044820152641cdd185c9d60da1b6064820152608401610c12565b606a8190556040518181527f1d1fb7111c3779798bd4aefb2daea07ee8257a13c7eaceba89b4b1ccd405050d90602001610f03565b600054610100900460ff166123815760005460ff1615612385565b303b155b6123e85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c12565b600054610100900460ff1615801561240a576000805461ffff19166101011790555b61241a61058e6020840184615361565b6124226148dc565b6124326040830160208401615361565b606780546001600160a01b039290921661010002610100600160a81b03199092169190911790556124696060830160408401615361565b606880546001600160a01b0319166001600160a01b03929092169190911790556060820135606a55608082013560765560a082013560775560c08201356078556124ba610100830160e08401615498565b6082805460ff191691151591909117905560685460675460405163095ea7b360e01b81526101009091046001600160a01b03908116600483015260001960248301529091169063095ea7b390604401602060405180830381600087803b15801561252357600080fd5b505af1158015612537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255b91906154b4565b508015611738576000805461ff00191690555050565b6001546001600160a01b031633146125e95760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610c12565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b612676614bd3565b608880546001600160a01b0319166001600160a01b038416908117909155608982905560408051918252602082018390527fa1a8623472ca4e2879372be60dfd1ff0675778e49f7379eedd98ca57cf36b21a910160405180910390a15050565b6126de614bd3565b6001600160a01b0381166127045760405162461bcd60e51b8152600401610c129061583b565b607b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f3c7faa500efbd341aedbf1ee7ebd52ea36d226dda76bc01dd39b43d46f55b8d390602001610f03565b6001606660008282546127659190615872565b909155505060665460345460ff16156127905760405162461bcd60e51b8152600401610c12906156fb565b60675461010090046001600160a01b031633146127bf5760405162461bcd60e51b8152600401610c1290615670565b60845460ff16156127e25760405162461bcd60e51b8152600401610c1290615725565b8215611d9957606854600160a01b900460ff166128115760405162461bcd60e51b8152600401610c1290615642565b600061281c85613083565b9050600061282982614daf565b90506000806000886001600160a01b031663cc2ee1966040518163ffffffff1660e01b815260040160606040518083038186803b15801561286957600080fd5b505afa15801561287d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a191906154d0565b919450925090506001600160a01b0383166128e35760405162461bcd60e51b8152602060048201526002602482015261304160f01b6044820152606401610c12565b60008088600281111561290657634e487b7160e01b600052602160045260246000fd5b146129115782612913565b835b905060028a6001600160a01b0316631a1dbabb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561295057600080fd5b505afa158015612964573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612988919061553b565b1180156129b5575060008860028111156129b257634e487b7160e01b600052602160045260246000fd5b14155b156129ec5760018860028111156129dc57634e487b7160e01b600052602160045260246000fd5b146129e757816129e9565b825b90505b606754604051633cf57f7560e21b81526001600160a01b038381166004830152602482018c9052610100909204821660448201529086169063f3d5fdd490606401600060405180830381600087803b158015612a4757600080fd5b505af1158015612a5b573d6000803e3d6000fd5b505050505050505050506066548114610d725760405162461bcd60e51b8152600401610c1290615804565b600160666000828254612a999190615872565b909155505060665460345460ff1615612ac45760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615612ae75760405162461bcd60e51b8152600401610c1290615725565b612aef61493a565b612b3b5760405162461bcd60e51b815260206004820152601960248201527f43616e277420636c6f73652063757272656e7420726f756e64000000000000006044820152606401610c12565b612b436145cb565b6069546000908152606c60205260408082205460685491516370a0823160e01b81526001600160a01b0391821660048201819052939291909116906370a082319060240160206040518083038186803b158015612b9f57600080fd5b505afa158015612bb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd7919061553b565b606954600090815260706020526040902054909150811115612c9f576089546069546000908152607060205260408120549091670de0b6b3a764000091612c1e90856158c9565b612c2891906158aa565b612c32919061588a565b608854606854919250612c54916001600160a01b039081169186911684614d55565b612c5e81836158c9565b60895460408051918252602082018490529193507fb8379d05082aa2dd32963972d72cc2d46257811133341855b63bb2fddda6ca3e910160405180910390a1505b606954600090815260706020526040902054612ccf57606954600090815260746020526040902060019055612d10565b606954600090815260706020526040902054612cf3670de0b6b3a7640000836158aa565b612cfd919061588a565b6069546000908152607460205260409020555b6084805460ff191660011790556069546040517fa224cce482b24082d1d3128437615f7f5ce87b97453a11114846ea442a10027291612d529190815260200190565b60405180910390a150506066548114610f795760405162461bcd60e51b8152600401610c1290615804565b600160666000828254612d909190615872565b9091555050606654606854600160a01b900460ff16612dc15760405162461bcd60e51b8152600401610c1290615642565b3360009081526071602052604090205460ff1615612e215760405162461bcd60e51b815260206004820152601c60248201527f5769746864726177616c20616c726561647920726571756573746564000000006044820152606401610c12565b6069546000908152606f60209081526040808320338452909152902054612e805760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b6044820152606401610c12565b606f60006069546001612e939190615872565b81526020808201929092526040908101600090812033825290925290205415612ece5760405162461bcd60e51b8152600401610c129061576c565b60345460ff1615612ef15760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615612f145760405162461bcd60e51b8152600401610c1290615725565b612f26662386f26fc10000600a6158aa565b8210158015612f465750612f42662386f26fc10000605a6158aa565b8211155b612f9e5760405162461bcd60e51b815260206004820152602360248201527f53686172652068617320746f206265206265747765656e2031302520616e642060448201526239302560e81b6064820152608401610c12565b6069546000908152606f60209081526040808320338452909152812054670de0b6b3a764000090612fd09085906158aa565b612fda919061588a565b905080607f5411156130035780607f6000828254612ff891906158c9565b909155506130099050565b6000607f555b336000818152607160209081526040808320805460ff19166001179055608682529182902086905590519182527fe5892ff2a8b08efb903ffbba1f0514c1d3e22eea34dd5b89cf30aabce03dde5a910160405180910390a15060665481146117385760405162461bcd60e51b8152600401610c1290615804565b6000808290506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b1580156130c357600080fd5b505afa1580156130d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fb91906155a3565b509050606b5481111561313457606a54606b5461311890836158c9565b613122919061588a565b61312d906001615872565b9250613139565b600192505b5050919050565b613148614bd3565b6080805460ff19168215159081179091556040519081527fce63b353cbe0da11fd36f2a8c159a473f677194eac2cdd7bd5291d281d77ce7d90602001610f03565b33600090815260716020526040902054819060ff16156131fb5760405162461bcd60e51b815260206004820152602760248201527f5769746864726177616c206973207265717565737465642c2063616e6e6f742060448201526619195c1bdcda5d60ca1b6064820152608401610c12565b60765481607f5461320c9190615872565b11156132645760405162461bcd60e51b815260206004820152602160248201527f4465706f73697420616d6f756e74206578636565647320414d4d204c502063616044820152600760fc1b6064820152608401610c12565b6069546000908152606f602090815260408083203384529091529020541580156132bc5750606f6000606954600161329c9190615872565b815260208082019290925260409081016000908120338252909252902054155b1561331d5760775481101561331d5760405162461bcd60e51b815260206004820152602160248201527f416d6f756e74206c657373207468616e206d696e4465706f736974416d6f756e6044820152601d60fa1b6064820152608401610c12565b6001606660008282546133309190615872565b909155505060665460345460ff161561335b5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff161561337e5760405162461bcd60e51b8152600401610c1290615725565b6000606954600161338f9190615872565b9050600061339c82614daf565b6068549091506133b7906001600160a01b0316338388614d55565b336000908152607e602052604090205460ff166135b85760805460ff1615806133ef57503360009081526081602052604090205460ff165b61343b5760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792077686974656c6973746564207374616b65727320616c6c6f7765646044820152606401610c12565b607b546001600160a01b031661348c5760405162461bcd60e51b815260206004820152601660248201527514dd185ada5b99c8151a185b195cc81b9bdd081cd95d60521b6044820152606401610c12565b607c54607b54604051631676539160e01b815233600482015261352492670de0b6b3a76400009290916001600160a01b039091169063167653919060240160206040518083038186803b1580156134e257600080fd5b505afa1580156134f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061351a919061553b565b61103491906158aa565b6000838152606f602081815260408084203380865290835281852054606954865293835281852090855290915290912054613560908890615872565b61356a9190615872565b11156135b85760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f756768207374616b6564205448414c455300000000000000006044820152606401610c12565b607a546001600160a01b03163314156136305760405162461bcd60e51b815260206004820152603460248201527f43616e2774206465706f736974206469726563746c792061732064656661756c6044820152733a103634b8bab4b234ba3c90383937bb34b232b960611b6064820152608401610c12565b6069546000908152606f6020908152604080832033845290915290205415801561367157506000828152606f60209081526040808320338452909152902054155b1561370a57607854607954106136c95760405162461bcd60e51b815260206004820152601b60248201527f4d617820616d6f756e74206f66207573657273207265616368656400000000006044820152606401610c12565b6000828152606d602090815260408220805460018181018355918452919092200180546001600160a01b0319163317905560795461370691615872565b6079555b6000828152606f6020908152604080832033845290915281208054879290613733908490615872565b909155505060008281526070602052604081208054879290613756908490615872565b9250508190555084607f600082825461376f9190615872565b9091555050607b546001600160a01b0316156137ea57607b546040516302c7739b60e01b8152336004820152602481018790526001600160a01b03909116906302c7739b90604401600060405180830381600087803b1580156137d157600080fd5b505af11580156137e5573d6000803e3d6000fd5b505050505b606954604080513381526020810188905280820192909252517f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca9181900360600190a1505060665481146122405760405162461bcd60e51b8152600401610c1290615804565b6069546000908152606c60205260408120546001600160a01b031681805b606954600090815260726020526040902054811015613a375760695460009081526072602052604081208054839081106138b857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff16613a2457809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561392f57600080fd5b505afa158015613943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061396791906154b4565b15613a2457604051636392a51f60e01b81526001600160a01b0385811660048301526000918291829190871690636392a51f9060240160606040518083038186803b1580156139b557600080fd5b505afa1580156139c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ed91906155c6565b9250925092506000831180613a025750600082115b80613a0d5750600081115b15613a2057600197505050505050505090565b5050505b5080613a2f8161590c565b91505061386e565b5060009250505090565b600160666000828254613a549190615872565b909155505060665460345460ff1615613a7f5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615613aa25760405162461bcd60e51b8152600401610c1290615725565b60008211613ac25760405162461bcd60e51b8152600401610c12906157c2565b6069546000908152606c60205260408120546001600160a01b03169080805b606954600090815260726020526040902054811015613c9b5785831415613b0757613c9b565b6069546000908152607260205260408120805483908110613b3857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff16613c8857809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b158015613baf57600080fd5b505afa158015613bc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613be791906154b4565b15613c885760405163bb580fbb60e01b81526001600160a01b03848116600483015286169063bb580fbb90602401600060405180830381600087803b158015613c2f57600080fd5b505af1158015613c43573d6000803e3d6000fd5b505060695460009081526083602090815260408083206001600160a01b03871684529091529020805460ff19166001908117909155613c859250905085615872565b93505b5080613c938161590c565b915050613ae1565b5050505060665481146117385760405162461bcd60e51b8152600401610c1290615804565b613cc8614bd3565b606854600160a01b900460ff1615613d2d5760405162461bcd60e51b815260206004820152602260248201527f4c697175696469747920706f6f6c2068617320616c7265616479207374617274604482015261195960f21b6064820152608401610c12565b600160005260706020527fb1a24bae1e5047fbb0cf526090cbec15c09a4036896111a8964a155b1c4771a154613da55760405162461bcd60e51b815260206004820152601d60248201527f63616e206e6f7420737461727420776974682030206465706f736974730000006044820152606401610c12565b42606b5560016069819055600090613dbc90614daf565b9050806001600160a01b0316637d3de7ce606b54613dda6001610db0565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b158015613e1857600080fd5b505af1158015613e2c573d6000803e3d6000fd5b50506068805460ff60a01b1916600160a01b17905550506040517f960682678fca98f3ed131eaf165e59544bcd738e948f0b3c64f58fa9e1c65e6090600090a150565b6000606c6000613e7e84613083565b81526020810191909152604001600020546001600160a01b031692915050565b613ea6614bd3565b6001600160a01b038116613eee5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610c12565b600154600160a81b900460ff1615613f3e5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610c12565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610f03565b6000828152607560208181526040808420546074835281852054868652939092528320549091610bdc916158aa565b6069546000908152606f602090815260408083206001600160a01b038516845290915281205415158061405d57506000606f600060695460016140299190615872565b81526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002054115b8015610dcd57506001600160a01b03821660009081526071602052604090205460ff161580610dcd5750506001600160a01b0316600090815260866020526040902054151590565b6140ad614bd3565b60778190556040518181527f990717cc219e5348c1b88bb0ff530d804f0b6f54f3b03844a2bfbe4eb1e9c5d690602001610f03565b606a546000906140f36001846158c9565b610dc091906158aa565b614105614bd3565b60768190556040518181527f8c43aa02599ac8f8bab4724621ceea5e7a06b07bbbfaf3b7bd0386cbe481ea3c90602001610f03565b60016066600082825461414d9190615872565b909155505060665460345460ff16156141785760405162461bcd60e51b8152600401610c12906156fb565b60845460ff166141ca5760405162461bcd60e51b815260206004820152601a60248201527f526f756e6420636c6f73696e67206e6f742070726570617265640000000000006044820152606401610c12565b6069546000908152606d60205260409020546085541461422c5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420616c6c2075736572732070726f6365737365642079657400000000006044820152606401610c12565b6084805460ff191690556069546000908152606c6020908152604080832054606f8352818420607a546001600160a01b03908116865293529220549116901561432657606954600090815260746020908152604080832054606f8352818420607a546001600160a01b03168552909252822054670de0b6b3a7640000916142b2916158aa565b6142bc919061588a565b607a546068549192506142de916001600160a01b039081169185911684614d55565b607a54604080516001600160a01b039092168252602082018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a1505b60695460011415614354576069546000908152607460209081526040808320546075909252909120556143b7565b606954600081815260746020526040812054670de0b6b3a7640000929091607591614381906001906158c9565b81526020019081526020016000205461439a91906158aa565b6143a4919061588a565b6069546000908152607560205260409020555b6001606960008282546143ca9190615872565b90915550506068546040516370a0823160e01b81526001600160a01b038381166004830152909116906370a082319060240160206040518083038186803b15801561441457600080fd5b505afa158015614428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061444c919061553b565b6069546000908152607060205260408120805490919061446d908490615872565b90915550506069546000818152606f60209081526040808320607a546001600160a01b0316845282528083205493835260709091529020546144af91906158c9565b607f556069546000906144c190614daf565b6068546040516370a0823160e01b81526001600160a01b03808616600483015292935061455c92859285929116906370a082319060240160206040518083038186803b15801561451057600080fd5b505afa158015614524573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614548919061553b565b6068546001600160a01b0316929190614d55565b60006085556069547fc67dda8e11f1aa941c7e74466b1859a07a32f46aaf641d29b83be348424d93cd90614592906001906158c9565b6074600060016069546145a591906158c9565b815260200190815260200160002054604051612d52929190918252602082015260400190565b60345460ff16156145ee5760405162461bcd60e51b8152600401610c12906156fb565b60845460ff16156146115760405162461bcd60e51b8152600401610c1290615725565b6069546000908152606c60205260408120546001600160a01b031690805b60695460009081526072602052604090205481101561224057606954600090815260726020526040812080548390811061467957634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff166147b957809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b1580156146f057600080fd5b505afa158015614704573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061472891906154b4565b156147b95760405163bb580fbb60e01b81526001600160a01b03848116600483015285169063bb580fbb90602401600060405180830381600087803b15801561477057600080fd5b505af1158015614784573d6000803e3d6000fd5b505060695460009081526083602090815260408083206001600160a01b03871684529091529020805460ff1916600117905550505b50806147c48161590c565b91505061462f565b6147d4614bd3565b6001600160a01b0381166147fa5760405162461bcd60e51b8152600401610c129061583b565b60678054610100600160a81b0319166101006001600160a01b038481168202929092179283905560685460405163095ea7b360e01b81529190930482166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561486a57600080fd5b505af115801561487e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148a291906154b4565b506040516001600160a01b03821681527f576297e5fcc8cd907ee80b240284865eb3d821bdc5232e6ee9e4d78a12531c0990602001610f03565b60675460ff16156149255760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610c12565b6067805460ff19166001908117909155606655565b606854600090600160a01b900460ff16158061495f575061495c606954610db0565b42105b1561496a5750600090565b6000805b606954600090815260726020526040902054811015614a885760695460009081526072602052604081208054839081106149b857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015460695483526083825260408084206001600160a01b039092168085529190925291205490915060ff16614a7557809250826001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b158015614a2f57600080fd5b505afa158015614a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a6791906154b4565b614a75576000935050505090565b5080614a808161590c565b91505061496e565b50600191505090565b60675460009061010090046001600160a01b03163314614ac35760405162461bcd60e51b8152600401610c1290615670565b600160666000828254614ad69190615872565b909155505060665460345460ff1615614b015760405162461bcd60e51b8152600401610c12906156fb565b60845460ff1615614b245760405162461bcd60e51b8152600401610c1290615725565b6000614b2f84613083565b9050614b3a81614daf565b9250506066548114614b5e5760405162461bcd60e51b8152600401610c1290615804565b50919050565b614b6c614bd3565b6082805460ff19168215159081179091556040519081527f3a29a049ec4616dc818362d5757e4a4d73bea0c4976a777f49fac773624ed9e590602001610f03565b60825460009060ff1615614bca57610dcd8264e8d4a510006158aa565b5090565b919050565b6000546201000090046001600160a01b03163314614c4b5760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610c12565b565b60345460ff16614c965760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c12565b6034805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60345460ff1615614d035760405162461bcd60e51b8152600401610c12906156fb565b6034805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614cc33390565b60825460009060ff1615614bca57610dcd64e8d4a510008361588a565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610d7290859061507f565b6000818152606c60205260409020546001600160a01b031680614bce57607d546001600160a01b0316614e245760405162461bcd60e51b815260206004820152601d60248201527f526f756e6420706f6f6c206d6173746572636f7079206e6f74207365740000006044820152606401610c12565b607d54600090614e3c906001600160a01b0316615151565b6068549091506001600160a01b038083169163d13f90b49130911686614e6661057b6001836158c9565b614e6f89610db0565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015260448401919091526064830152608482015260a401600060405180830381600087803b158015614ecb57600080fd5b505af1158015614edf573d6000803e3d6000fd5b5050506000848152606c602090815260409182902080546001600160a01b0319166001600160a01b03861690811790915582518781529182015292935083927f24c1b21b902a85b5039d7d72427d9376657229eea77880ec9e62031dc950f6ba92500160405180910390a150919050565b607a546001600160a01b0316614fb35760405162461bcd60e51b815260206004820152602260248201527f64656661756c74206c69717569646974792070726f7669646572206e6f742073604482015261195d60f21b6064820152608401610c12565b607a54606854614fd1916001600160a01b0391821691168486614d55565b6000818152606f60209081526040808320607a546001600160a01b0316845290915281208054859290615005908490615872565b909155505060008181526070602052604081208054859290615028908490615872565b9091555050607a54604080516001600160a01b0390921682526020820185905281018290527f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca9060600160405180910390a1505050565b60006150d4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166151e99092919063ffffffff16565b80519091501561224057808060200190518101906150f291906154b4565b6122405760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c12565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116614bce5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610c12565b60606151f88484600085615200565b949350505050565b6060824710156152615760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c12565b843b6152af5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c12565b600080866001600160a01b031685876040516152cb91906155f3565b60006040518083038185875af1925050503d8060008114615308576040519150601f19603f3d011682016040523d82523d6000602084013e61530d565b606091505b509150915061531d828286615328565b979650505050505050565b60608315615337575081610be6565b8251156153475782518084602001fd5b8160405162461bcd60e51b8152600401610c12919061560f565b600060208284031215615372578081fd5b8135610be68161593d565b6000806040838503121561538f578081fd5b823561539a8161593d565b946020939093013593505050565b6000806000606084860312156153bc578081fd5b83356153c78161593d565b92506020840135915060408401356153de8161593d565b809150509250925092565b6000806000606084860312156153fd578283fd5b83356154088161593d565b9250602084013591506040840135600381106153de578182fd5b600080600060408486031215615436578283fd5b833567ffffffffffffffff8082111561544d578485fd5b818601915086601f830112615460578485fd5b81358181111561546e578586fd5b8760208260051b8501011115615482578586fd5b602092830195509350508401356153de81615952565b6000602082840312156154a9578081fd5b8135610be681615952565b6000602082840312156154c5578081fd5b8151610be681615952565b6000806000606084860312156154e4578283fd5b83516154ef8161593d565b60208501519093506155008161593d565b60408501519092506153de8161593d565b60006101008284031215614b5e578081fd5b600060208284031215615534578081fd5b5035919050565b60006020828403121561554c578081fd5b5051919050565b60008060408385031215615565578182fd5b8235915060208301356155778161593d565b809150509250929050565b60008060408385031215615594578182fd5b50508035926020909101359150565b600080604083850312156155b5578182fd5b505080516020909101519092909150565b6000806000606084860312156155da578081fd5b8351925060208401519150604084015190509250925092565b600082516156058184602087016158e0565b9190910192915050565b602081526000825180602084015261562e8160408501602087016158e0565b601f01601f19169190910160400192915050565b602080825260149082015273141bdbdb081a185cc81b9bdd081cdd185c9d195960621b604082015260600190565b60208082526026908201527f6f6e6c792074686520414d4d206d617920706572666f726d207468657365206d6040820152656574686f647360d01b606082015260800190565b60208082526025908201527f57686974656c6973746564206164647265737365732063616e6e6f7420626520604082015264656d70747960d81b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526027908201527f4e6f7420616c6c6f77656420647572696e6720726f756e64436c6f73696e67506040820152661c995c185c995960ca1b606082015260800190565b60208082526036908201527f43616e277420776974686472617720617320796f7520616c72656164792064656040820152751c1bdcda5d195908199bdc881b995e1d081c9bdd5b9960521b606082015260800190565b60208082526022908201527f626174636853697a652068617320746f2062652067726561746572207468616e604082015261020360f41b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601b908201527f43616e206e6f74207365742061207a65726f2061646472657373210000000000604082015260600190565b6000821982111561588557615885615927565b500190565b6000826158a557634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156158c4576158c4615927565b500290565b6000828210156158db576158db615927565b500390565b60005b838110156158fb5781810151838201526020016158e3565b83811115610d725750506000910152565b600060001982141561592057615920615927565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610f7957600080fd5b8015158114610f7957600080fdfea2646970667358221220d2bf733f5c42a0876e576e0efe7c7be0386c7ca60838655bd40c1d0e803bfc7b64736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading