ETH Price: $3,604.89 (-0.49%)

Contract

0x14f9520d6e038FE4c3B69E00a32b89a52596c405

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SportVault

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : SportVault.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 "../interfaces/ISportsAMM.sol";
import "../interfaces/ISportPositionalMarket.sol";
import "../interfaces/IStakingThales.sol";

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

    struct DepositReceipt {
        uint round;
        uint amount;
    }

    struct InitParams {
        address _owner;
        ISportsAMM _sportsAmm;
        IERC20Upgradeable _sUSD;
        uint _roundLength;
        uint _priceLowerLimit;
        uint _priceUpperLimit;
        int _skewImpactLimit;
        uint _allocationLimitsPerMarketPerRound;
        uint _maxAllowedDeposit;
        uint _utilizationRate;
        uint _minDepositAmount;
        uint _maxAllowedUsers;
        uint _minTradeAmount;
    }

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

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

    ISportsAMM public sportsAMM;
    IERC20Upgradeable public sUSD;

    bool public vaultStarted;

    uint public round;
    uint public roundLength;
    mapping(uint => uint) public roundStartTime;

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

    mapping(uint => mapping(address => uint)) public balancesPerRound;
    mapping(address => bool) public withdrawalRequested;
    mapping(address => DepositReceipt) public depositReceipts;

    mapping(uint => uint) public allocationPerRound;

    mapping(uint => address[]) public tradingMarketsPerRound;
    mapping(uint => mapping(address => ISportsAMM.Position)) public tradingMarketPositionPerRound;
    mapping(uint => mapping(address => bool)) public isTradingMarketInARound;

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

    uint public maxAllowedDeposit;
    uint public utilizationRate;

    mapping(uint => uint) public capPerRound;

    uint public minDepositAmount;

    uint public maxAllowedUsers;
    uint public usersCurrentlyInVault;

    uint public allocationLimitsPerMarketPerRound;

    mapping(uint => mapping(address => uint)) public allocationSpentPerRound;

    uint public priceLowerLimit;
    uint public priceUpperLimit;
    int public skewImpactLimit;

    uint public minTradeAmount;

    /// @return The address of the Staking contract
    IStakingThales public stakingThales;

    mapping(uint => uint) public allocationSpentInARound;

    address public safeBox;
    uint public safeBoxImpact;

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

    function __BaseSportVault_init(
        address _owner,
        ISportsAMM _sportAmm,
        IERC20Upgradeable _sUSD,
        uint _roundLength,
        uint _maxAllowedDeposit,
        uint _utilizationRate,
        uint _minDepositAmount,
        uint _maxAllowedUsers
    ) internal onlyInitializing {
        setOwner(_owner);
        initNonReentrant();
        sportsAMM = ISportsAMM(_sportAmm);

        sUSD = _sUSD;
        roundLength = _roundLength;
        maxAllowedDeposit = _maxAllowedDeposit;
        utilizationRate = _utilizationRate;
        minDepositAmount = _minDepositAmount;
        maxAllowedUsers = _maxAllowedUsers;

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

    function initialize(InitParams calldata params) external initializer {
        __BaseSportVault_init(
            params._owner,
            params._sportsAmm,
            params._sUSD,
            params._roundLength,
            params._maxAllowedDeposit,
            params._utilizationRate,
            params._minDepositAmount,
            params._maxAllowedUsers
        );
        priceLowerLimit = params._priceLowerLimit;
        priceUpperLimit = params._priceUpperLimit;
        skewImpactLimit = params._skewImpactLimit;
        allocationLimitsPerMarketPerRound = params._allocationLimitsPerMarketPerRound;
        minTradeAmount = params._minTradeAmount;
    }

    /// @notice Start vault and begin round #1
    function startVault() external onlyOwner {
        require(!vaultStarted, "Vault has already started");
        round = 1;

        roundStartTime[round] = block.timestamp;

        vaultStarted = true;

        capPerRound[2] = capPerRound[1];

        emit VaultStarted();
    }

    /// @notice Close current round and begin next round,
    /// excercise options of trading markets and calculate profit and loss
    function closeRound() external nonReentrant whenNotPaused {
        require(canCloseCurrentRound(), "Can't close current round");
        // excercise market options
        _exerciseMarketsReadyToExercised();

        // balance in next round does not affect PnL in a current round
        uint currentVaultBalance = sUSD.balanceOf(address(this)) - allocationPerRound[round + 1];
        // calculate PnL

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

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

        for (uint i = 0; i < usersPerRound[round].length; i++) {
            address user = usersPerRound[round][i];
            uint balanceAfterCurRound = (balancesPerRound[round][user] * profitAndLossPerRound[round]) / ONE;
            if (userInRound[round][user]) {
                if (!withdrawalRequested[user]) {
                    balancesPerRound[round + 1][user] = balancesPerRound[round + 1][user] + balanceAfterCurRound;
                    userInRound[round + 1][user] = true;
                    usersPerRound[round + 1].push(user);
                    if (address(stakingThales) != address(0)) {
                        stakingThales.updateVolume(user, balanceAfterCurRound);
                    }
                } else {
                    balancesPerRound[round + 1][user] = 0;
                    sUSD.safeTransfer(user, balanceAfterCurRound);
                    withdrawalRequested[user] = false;
                    userInRound[round + 1][user] = false;
                    emit Claimed(user, balanceAfterCurRound);
                }
            }
        }

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

        // start next round
        round += 1;

        roundStartTime[round] = block.timestamp;

        // allocation for next round doesn't include withdrawal queue share from previous round
        allocationPerRound[round] = sUSD.balanceOf(address(this));
        capPerRound[round + 1] = allocationPerRound[round];

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

    /// @notice Deposit funds from user into vault for the next round
    /// @param amount Value to be deposited
    function deposit(uint amount) external canDeposit(amount) nonReentrant whenNotPaused {
        sUSD.safeTransferFrom(msg.sender, address(this), amount);

        uint nextRound = round + 1;

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

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

        // update deposit state of a user
        depositReceipts[msg.sender] = DepositReceipt(nextRound, balancesPerRound[nextRound][msg.sender]);

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

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

        emit Deposited(msg.sender, amount);
    }

    function withdrawalRequest() external nonReentrant whenNotPaused {
        require(vaultStarted, "Vault 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");

        uint nextRound = round + 1;
        if (capPerRound[nextRound] > balancesPerRound[round][msg.sender]) {
            capPerRound[nextRound] -= balancesPerRound[round][msg.sender];
        }

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

    /// @notice Buy market options from Thales AMM
    /// @param market address of a market
    /// @param amount number of options to be bought
    /// @param position to buy options for
    function trade(
        address market,
        uint amount,
        ISportsAMM.Position position
    ) external nonReentrant whenNotPaused {
        require(vaultStarted, "Vault has not started");
        require(amount >= minTradeAmount, "Amount less than minimum");

        ISportPositionalMarket marketContract = ISportPositionalMarket(market);
        (uint maturity, ) = marketContract.times();
        require(maturity < (roundStartTime[round] + roundLength), "Market time not valid");

        uint basePricePosition = sportsAMM.obtainOdds(address(market), position);
        require(basePricePosition > 0, "Price not more than 0");

        int pricePositionImpact = sportsAMM.buyPriceImpact(address(market), position, amount);

        require(basePricePosition >= priceLowerLimit && basePricePosition <= priceUpperLimit, "Market price not valid");
        require(pricePositionImpact < skewImpactLimit, "Skew impact too high");
        _buyFromAmm(market, position, amount);

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

    /// @notice Set length of rounds
    /// @param _roundLength Length of a round in miliseconds
    function setRoundLength(uint _roundLength) external onlyOwner {
        roundLength = _roundLength;
        emit RoundLengthChanged(_roundLength);
    }

    /// @notice Set ThalesAMM contract
    /// @param _sportAMM ThalesAMM address
    function setSportAmm(ISportsAMM _sportAMM) external onlyOwner {
        sportsAMM = _sportAMM;
        sUSD.approve(address(sportsAMM), type(uint256).max);
        emit SportAMMChanged(address(_sportAMM));
    }

    /// @notice Set IStakingThales contract
    /// @param _stakingThales IStakingThales address
    function setStakingThales(IStakingThales _stakingThales) external onlyOwner {
        stakingThales = _stakingThales;
        emit StakingThalesChanged(address(_stakingThales));
    }

    /// @notice Set utilization rate parameter
    /// @param _utilizationRate Value in percents
    function setUtilizationRate(uint _utilizationRate) external onlyOwner {
        utilizationRate = _utilizationRate;
        emit UtilizationRateChanged(_utilizationRate);
    }

    /// @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 allocation limits for assets to be spent in one round
    /// @param _allocationLimitsPerMarketPerRound allocation per market in percent
    function setAllocationLimits(uint _allocationLimitsPerMarketPerRound) external onlyOwner {
        require(_allocationLimitsPerMarketPerRound < HUNDRED, "Invalid allocation limit values");
        allocationLimitsPerMarketPerRound = _allocationLimitsPerMarketPerRound;
        emit SetAllocationLimits(allocationLimitsPerMarketPerRound);
    }

    /// @notice Set price limit for options to be bought from AMM
    /// @param _priceLowerLimit lower limit
    /// @param _priceUpperLimit upper limit
    function setPriceLimits(uint _priceLowerLimit, uint _priceUpperLimit) external onlyOwner {
        require(_priceLowerLimit < _priceUpperLimit, "Invalid price limit values");
        priceLowerLimit = _priceLowerLimit;
        priceUpperLimit = _priceUpperLimit;
        emit SetPriceLimits(_priceLowerLimit, _priceUpperLimit);
    }

    /// @notice Set skew impact limit for AMM
    /// @param _skewImpactLimit limit in percents
    function setSkewImpactLimit(int _skewImpactLimit) external onlyOwner {
        skewImpactLimit = _skewImpactLimit;
        emit SetSkewImpactLimit(_skewImpactLimit);
    }

    /// @notice Set _minTradeAmount
    /// @param _minTradeAmount limit in percents
    function setMinTradeAmount(uint _minTradeAmount) external onlyOwner {
        minTradeAmount = _minTradeAmount;
        emit SetMinTradeAmount(_minTradeAmount);
    }

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

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

    function _exerciseMarketsReadyToExercised() internal {
        ISportPositionalMarket market;
        for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) {
            market = ISportPositionalMarket(tradingMarketsPerRound[round][i]);
            if (!market.paused() && market.resolved()) {
                (uint homeBalance, uint awayBalance, uint drawBalance) = market.balancesOf(address(this));
                if (homeBalance > 0 || awayBalance > 0 || drawBalance > 0) {
                    market.exerciseOptions();
                }
            }
        }
    }

    /// @notice Buy options from AMM
    /// @param market address of a market
    /// @param position position to be bought
    /// @param amount amount of positions to be bought
    function _buyFromAmm(
        address market,
        ISportsAMM.Position position,
        uint amount
    ) internal {
        uint quote = sportsAMM.buyFromAmmQuote(market, position, amount);
        require(quote < (tradingAllocation() - allocationSpentInARound[round]), "Amount exceeds available allocation");

        uint allocationAsset = (tradingAllocation() * allocationLimitsPerMarketPerRound) / HUNDRED;
        require(
            (quote + allocationSpentPerRound[round][market]) < allocationAsset,
            "Amount exceeds available allocation for asset"
        );

        uint balanceBeforeTrade = sUSD.balanceOf(address(this));

        sportsAMM.buyFromAMM(market, position, amount, quote, 0);

        uint balanceAfterTrade = sUSD.balanceOf(address(this));

        allocationSpentInARound[round] += quote;
        allocationSpentPerRound[round][market] += quote;
        tradingMarketPositionPerRound[round][market] = position;

        emit TradeExecuted(market, position, amount, quote);
    }

    /// @notice Return trading allocation in current round based on utilization rate param
    /// @return uint
    function tradingAllocation() public view returns (uint) {
        return (allocationPerRound[round] * utilizationRate) / ONE;
    }

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

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

    /// @notice Get available amount to spend on an asset in a round
    /// @param market to fetch available allocation for
    /// @return uint
    function getAvailableAllocationForMarket(address market) external view returns (uint) {
        uint allocationMarket = (tradingAllocation() * allocationLimitsPerMarketPerRound) / HUNDRED;
        uint remainingAvailable = allocationMarket - allocationSpentPerRound[round][market];

        return
            remainingAvailable < (tradingAllocation() - allocationSpentInARound[round])
                ? remainingAvailable
                : (tradingAllocation() - allocationSpentInARound[round]);
    }

    /// @notice Return user balance in a round
    /// @param _round Round number
    /// @param user Address of the user
    /// @return uint
    function getBalancesPerRound(uint _round, address user) external view returns (uint) {
        return balancesPerRound[_round][user];
    }

    /// @notice Return available to deposit
    /// @return returned how much more users can deposit
    function getAvailableToDeposit() external view returns (uint returned) {
        if (capPerRound[round + 1] < maxAllowedDeposit) {
            returned = maxAllowedDeposit - capPerRound[round + 1];
        }
    }

    /// @notice end of current round
    /// @return uint
    function getCurrentRoundEnd() external view returns (uint) {
        return roundStartTime[round] + roundLength;
    }

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

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

    modifier canDeposit(uint amount) {
        require(!withdrawalRequested[msg.sender], "Withdrawal is requested, cannot deposit");
        require(amount >= minDepositAmount, "Invalid amount");
        require(capPerRound[round + 1] + amount <= maxAllowedDeposit, "Deposit amount exceeds vault cap");
        _;
    }

    /* ========== EVENTS ========== */

    event VaultStarted();
    event RoundClosed(uint round, uint roundPnL);
    event RoundLengthChanged(uint roundLength);
    event SportAMMChanged(address thalesAmm);
    event StakingThalesChanged(address stakingThales);
    event SetSUSD(address sUSD);
    event Deposited(address user, uint amount);
    event Claimed(address user, uint amount);
    event WithdrawalRequested(address user);
    event UtilizationRateChanged(uint utilizationRate);
    event MaxAllowedDepositChanged(uint maxAllowedDeposit);
    event MinAllowedDepositChanged(uint minAllowedDeposit);
    event MaxAllowedUsersChanged(uint MaxAllowedUsersChanged);
    event SetAllocationLimits(uint allocationLimitsPerMarketPerRound);
    event SetPriceLimits(uint priceLowerLimit, uint priceUpperLimit);
    event SetSkewImpactLimit(int skewImpact);
    event SetMinTradeAmount(uint SetMinTradeAmount);
    event TradeExecuted(address market, ISportsAMM.Position position, uint amount, uint quote);
    event SetSafeBoxParams(address safeBox, uint safeBoxImpact);
    event SafeBoxSharePaid(uint safeBoxShare, uint safeBoxAmount);
}

File 2 of 18 : 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 18 : 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 18 : 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 18 : 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 18 : 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 18 : 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 18 : 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);
}

File 9 of 18 : 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 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 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 10 of 18 : 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 11 of 18 : 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 12 of 18 : 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 13 of 18 : 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 14 of 18 : 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);
}

File 15 of 18 : 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 16 of 18 : 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 17 of 18 : 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 18 of 18 : 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 Security Audit

Contract ABI

[{"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":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","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":"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":"roundLength","type":"uint256"}],"name":"RoundLengthChanged","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":"uint256","name":"allocationLimitsPerMarketPerRound","type":"uint256"}],"name":"SetAllocationLimits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"SetMinTradeAmount","type":"uint256"}],"name":"SetMinTradeAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"priceLowerLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceUpperLimit","type":"uint256"}],"name":"SetPriceLimits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sUSD","type":"address"}],"name":"SetSUSD","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":"int256","name":"skewImpact","type":"int256"}],"name":"SetSkewImpactLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"thalesAmm","type":"address"}],"name":"SportAMMChanged","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":"market","type":"address"},{"indexed":false,"internalType":"enum ISportsAMM.Position","name":"position","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quote","type":"uint256"}],"name":"TradeExecuted","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":[],"name":"VaultStarted","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":[],"name":"allocationLimitsPerMarketPerRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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"}],"name":"allocationSpentInARound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"allocationSpentPerRound","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"capPerRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"closeRound","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":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositReceipts","outputs":[{"internalType":"uint256","name":"round","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getAvailableAllocationForMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableToDeposit","outputs":[{"internalType":"uint256","name":"returned","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_round","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getBalancesPerRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentRoundEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_priceLowerLimit","type":"uint256"},{"internalType":"uint256","name":"_priceUpperLimit","type":"uint256"},{"internalType":"int256","name":"_skewImpactLimit","type":"int256"},{"internalType":"uint256","name":"_allocationLimitsPerMarketPerRound","type":"uint256"},{"internalType":"uint256","name":"_maxAllowedDeposit","type":"uint256"},{"internalType":"uint256","name":"_utilizationRate","type":"uint256"},{"internalType":"uint256","name":"_minDepositAmount","type":"uint256"},{"internalType":"uint256","name":"_maxAllowedUsers","type":"uint256"},{"internalType":"uint256","name":"_minTradeAmount","type":"uint256"}],"internalType":"struct SportVault.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":[],"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":"minTradeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceLowerLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceUpperLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"roundLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"roundStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"_allocationLimitsPerMarketPerRound","type":"uint256"}],"name":"setAllocationLimits","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":"uint256","name":"_minTradeAmount","type":"uint256"}],"name":"setMinTradeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_priceLowerLimit","type":"uint256"},{"internalType":"uint256","name":"_priceUpperLimit","type":"uint256"}],"name":"setPriceLimits","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":"int256","name":"_skewImpactLimit","type":"int256"}],"name":"setSkewImpactLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISportsAMM","name":"_sportAMM","type":"address"}],"name":"setSportAmm","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":[],"name":"skewImpactLimit","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sportsAMM","outputs":[{"internalType":"contract ISportsAMM","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingThales","outputs":[{"internalType":"contract IStakingThales","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum ISportsAMM.Position","name":"position","type":"uint8"}],"name":"trade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tradingAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"tradingMarketPositionPerRound","outputs":[{"internalType":"enum ISportsAMM.Position","name":"","type":"uint8"}],"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":"usersCurrentlyInVault","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":"utilizationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultStarted","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"}]

608060405234801561001057600080fd5b50613ad0806100206000396000f3fe608060405234801561001057600080fd5b50600436106103e65760003560e01c806374094edd1161020a578063c992528811610125578063ddcc8fe9116100b8578063e75c93d911610087578063e75c93d914610903578063e76a02791461090c578063ebc797721461091f578063ee161cce14610927578063fd8a8cc61461092f57600080fd5b8063ddcc8fe9146108b5578063e278fe6f146108c8578063e45b2e88146108d0578063e48a694b146108e357600080fd5b8063d69fb668116100f4578063d69fb66814610888578063db7f92d414610891578063dd636bc7146108a4578063dda9046f146108ac57600080fd5b8063c992528814610840578063c9f4ff4614610858578063cee73a761461086b578063d27c07971461087f57600080fd5b8063942f53571161019d578063b6b55f251161016c578063b6b55f25146107f1578063be805e3c14610804578063c137a60f1461080d578063c3b83f5f1461082d57600080fd5b8063942f53571461076f57806395ba9a70146107aa578063a250badb146107d5578063a9050d4d146107e857600080fd5b806387117630116101d957806387117630146107275780638b649b941461073a5780638da5cb5b146107435780639324cac71461075c57600080fd5b806374094edd146106d957806379ba5097146106f95780637a1e0aa8146107015780637f8525821461071457600080fd5b806340774ff6116103055780635ddd3e83116102985780636719b2ee116102675780636719b2ee1461064b578063681312f5146106875780636c321c8a1461069a57806371143ab9146106a357806371bb4b47146106d157600080fd5b80635ddd3e83146105e0578063610589e11461060b578063634e0d9714610614578063645006ca1461064257600080fd5b806353a47bb7116102d457806353a47bb7146105a757806356991791146105ba5780635c975abb146105cd5780635d1c236d146105d857600080fd5b806340774ff614610558578063456ff7881461056b57806348663e95146105745780634ae7937f1461058757600080fd5b806325a663951161037d578063336d30ed1161034c578063336d30ed146104ff578063343e4f9f1461051f578063370faeb014610532578063384e631c1461054557600080fd5b806325a66395146104bb5780632ef04761146104db578063311c56df146104ee578063322ce77a146104f657600080fd5b80631627540c116103b95780631627540c1461045a5780631daae1731461046d5780631e922460146104a0578063202ffce8146104a857600080fd5b806306d1fb3c146103eb578063082f9fd41461041157806313af40351461043c578063146ca53114610451575b600080fd5b6103fe6103f936600461378a565b610942565b6040519081526020015b60405180910390f35b61042461041f3660046137b9565b61096c565b6040516001600160a01b039091168152602001610408565b61044f61044a366004613697565b6109a4565b005b6103fe60695481565b61044f610468366004613697565b610ae4565b61049061047b366004613697565b606f6020526000908152604090205460ff1681565b6040519015158152602001610408565b6103fe610b3a565b61044f6104b6366004613742565b610b74565b6103fe6104c9366004613742565b60796020526000908152604090205481565b61044f6104e9366004613742565b610bb1565b61044f610bee565b6103fe607c5481565b6103fe61050d366004613742565b60766020526000908152604090205481565b61042461052d3660046137b9565b610ee0565b61044f6105403660046137b9565b610efc565b61044f610553366004613772565b610f9b565b61044f610566366004613742565b6110d0565b6103fe60815481565b608554610424906001600160a01b031681565b6103fe610595366004613742565b60716020526000908152604090205481565b600154610424906001600160a01b031681565b61044f6105c83660046136de565b61110d565b60345460ff16610490565b61044f611590565b6103fe6105ee36600461378a565b606e60209081526000928352604080842090915290825290205481565b6103fe607b5481565b61049061062236600461378a565b606d60209081526000928352604080842090915290825290205460ff1681565b6103fe607a5481565b610672610659366004613697565b6070602052600090815260409020805460019091015482565b60408051928352602083019190915201610408565b61044f610695366004613742565b6116a9565b6103fe60785481565b6104906106b136600461378a565b607460209081526000928352604080842090915290825290205460ff1681565b6103fe6116e6565b6103fe6106e7366004613742565b60756020526000908152604090205481565b61044f611706565b61044f61070f3660046136b3565b611803565b61044f610722366004613697565b611864565b61044f610735366004613742565b6118ba565b6103fe606a5481565b600054610424906201000090046001600160a01b031681565b606854610424906001600160a01b031681565b61079d61077d36600461378a565b607360209081526000928352604080842090915290825290205460ff1681565b6040516104089190613918565b6103fe6107b836600461378a565b607e60209081526000928352604080842090915290825290205481565b6103fe6107e3366004613697565b61194f565b6103fe607d5481565b61044f6107ff366004613742565b611a0f565b6103fe60805481565b6103fe61081b366004613742565b606b6020526000908152604090205481565b61044f61083b366004613697565b611e31565b6067546104249061010090046001600160a01b031681565b6103fe6108663660046137b9565b611f4a565b60685461049090600160a01b900460ff1681565b6103fe60775481565b6103fe60865481565b61044f61089f366004613742565b611f8a565b6103fe611fc7565b6103fe60825481565b61044f6108c3366004613742565b612026565b61044f612063565b61044f6108de366004613697565b612879565b6103fe6108f1366004613742565b60846020526000908152604090205481565b6103fe607f5481565b61044f61091a366004613742565b612963565b61044f6129a0565b6104906129fe565b608354610424906001600160a01b031681565b6000828152606e602090815260408083206001600160a01b03851684529091529020545b92915050565b6072602052816000526040600020818154811061098857600080fd5b6000918252602090912001546001600160a01b03169150829050565b6001600160a01b0381166109ff5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff1615610a6b5760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b60648201526084016109f6565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610aec612bb4565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610ad9565b6078546069546000908152607160205260408120549091670de0b6b3a764000091610b6591906139f2565b610b6f91906139d2565b905090565b610b7c612bb4565b607b8190556040518181527fe7c2c09f66c8b970b4a99250f4d0844e1496b9d51d4760a17b0134ddd52023e190602001610ad9565b610bb9612bb4565b60818190556040518181527f137f353e194da87258fd6c2b78eb1cfb9f2ce996f3466729d2464eccb7ce612990602001610ad9565b600160666000828254610c0191906139ba565b909155505060665460345460ff1615610c2c5760405162461bcd60e51b81526004016109f690613959565b606854600160a01b900460ff16610c7d5760405162461bcd60e51b815260206004820152601560248201527415985d5b1d081a185cc81b9bdd081cdd185c9d1959605a1b60448201526064016109f6565b336000908152606f602052604090205460ff1615610cdd5760405162461bcd60e51b815260206004820152601c60248201527f5769746864726177616c20616c7265616479207265717565737465640000000060448201526064016109f6565b6069546000908152606e60209081526040808320338452909152902054610d3c5760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b60448201526064016109f6565b606e60006069546001610d4f91906139ba565b81526020808201929092526040908101600090812033825290925290205415610dd95760405162461bcd60e51b815260206004820152603660248201527f43616e277420776974686472617720617320796f7520616c72656164792064656044820152751c1bdcda5d195908199bdc881b995e1d081c9bdd5b9960521b60648201526084016109f6565b60006069546001610dea91906139ba565b6069546000908152606e602090815260408083203384528252808320548484526079909252909120549192501015610e5a576069546000908152606e6020908152604080832033845282528083205484845260799092528220805491929091610e54908490613a11565b90915550505b6001607c54610e699190613a11565b607c55336000818152606f6020908152604091829020805460ff1916600117905590519182527fe5892ff2a8b08efb903ffbba1f0514c1d3e22eea34dd5b89cf30aabce03dde5a91015b60405180910390a1506066548114610edd5760405162461bcd60e51b81526004016109f690613983565b50565b606c602052816000526040600020818154811061098857600080fd5b610f04612bb4565b808210610f535760405162461bcd60e51b815260206004820152601a60248201527f496e76616c6964207072696365206c696d69742076616c75657300000000000060448201526064016109f6565b607f829055608081905560408051838152602081018390527f34b23d671026520e294c1060acc36120677e8c9bd073a8f6577a6f241785b1a691015b60405180910390a15050565b600054610100900460ff16610fb65760005460ff1615610fba565b303b155b61101d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109f6565b600054610100900460ff1615801561103f576000805461ffff19166101011790555b61109161104f6020840184613697565b61105f6040850160208601613697565b61106f6060860160408701613697565b8560600135866101000135876101200135886101400135896101600135612c2e565b608080830135607f5560a0830135905560c082013560815560e0820135607d5561018082013560825580156110cc576000805461ff00191690555b5050565b6110d8612bb4565b60788190556040518181527fc117ccf765672707ebe3c1606037488c1e27dc1f42b5266e3d6b496db7d4209e90602001610ad9565b60016066600082825461112091906139ba565b909155505060665460345460ff161561114b5760405162461bcd60e51b81526004016109f690613959565b606854600160a01b900460ff1661119c5760405162461bcd60e51b815260206004820152601560248201527415985d5b1d081a185cc81b9bdd081cdd185c9d1959605a1b60448201526064016109f6565b6082548310156111ee5760405162461bcd60e51b815260206004820152601860248201527f416d6f756e74206c657373207468616e206d696e696d756d000000000000000060448201526064016109f6565b60008490506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126591906137da565b50606a546069546000908152606b6020526040902054919250611287916139ba565b81106112cd5760405162461bcd60e51b815260206004820152601560248201527413585c9ad95d081d1a5b59481b9bdd081d985b1a59605a1b60448201526064016109f6565b6067546040516350d851a160e01b815260009161010090046001600160a01b0316906350d851a190611305908a908990600401613868565b60206040518083038186803b15801561131d57600080fd5b505afa158015611331573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611355919061375a565b90506000811161139f5760405162461bcd60e51b815260206004820152601560248201527405072696365206e6f74206d6f7265207468616e203605c1b60448201526064016109f6565b606754604051632fd1b02d60e21b815260009161010090046001600160a01b03169063bf46c0b4906113d9908b908a908c90600401613885565b60206040518083038186803b1580156113f157600080fd5b505afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611429919061375a565b9050607f54821015801561143f57506080548211155b6114845760405162461bcd60e51b815260206004820152601660248201527513585c9ad95d081c1c9a58d9481b9bdd081d985b1a5960521b60448201526064016109f6565b60815481126114cc5760405162461bcd60e51b81526020600482015260146024820152730a6d6caee40d2dae0c2c6e840e8dede40d0d2ced60631b60448201526064016109f6565b6114d7888789612d88565b60695460009081526074602090815260408083206001600160a01b038c16845290915290205460ff16611565576069805460009081526072602090815260408083208054600180820183559185528385200180546001600160a01b0319166001600160a01b038f169081179091559454845260748352818420948452939091529020805460ff191690911790555b50505050606654811461158a5760405162461bcd60e51b81526004016109f690613983565b50505050565b611598612bb4565b606854600160a01b900460ff16156115f25760405162461bcd60e51b815260206004820152601960248201527f5661756c742068617320616c726561647920737461727465640000000000000060448201526064016109f6565b6001606955427fa775687211c2b3346a0f5a2a0e7590e6c1838453e3785e6dd2a8efd6265ddf15556068805460ff60a01b1916600160a01b17905560796020527fdf6d6ad01a16c6118cfd605fcb55ad218b43517981ef4cc6d63a492cf34990d954600260009081527f7d4d2b02426547888e9185e69135196c4ed1edbc114060100a6ef94f8b5f60df919091556040517f59760ad83ef06d1a0bc439d8b39a42a870493f0cd3bc3d53bbd3e7c6991f494f9190a1565b6116b1612bb4565b606a8190556040518181527f1d1fb7111c3779798bd4aefb2daea07ee8257a13c7eaceba89b4b1ccd405050d90602001610ad9565b606a546069546000908152606b60205260408120549091610b6f916139ba565b6001546001600160a01b0316331461177e5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b60648201526084016109f6565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b61180b612bb4565b608580546001600160a01b0319166001600160a01b038416908117909155608682905560408051918252602082018390527fa1a8623472ca4e2879372be60dfd1ff0675778e49f7379eedd98ca57cf36b21a9101610f8f565b61186c612bb4565b608380546001600160a01b0319166001600160a01b0383169081179091556040519081527f3c7faa500efbd341aedbf1ee7ebd52ea36d226dda76bc01dd39b43d46f55b8d390602001610ad9565b6118c2612bb4565b68056bc75e2d63100000811061191a5760405162461bcd60e51b815260206004820152601f60248201527f496e76616c696420616c6c6f636174696f6e206c696d69742076616c7565730060448201526064016109f6565b607d8190556040518181527f9fb019ef2cdd86e0c7772694b935b2fd45131410802474ef0a8bf0afff94a40390602001610ad9565b60008068056bc75e2d63100000607d54611967610b3a565b61197191906139f2565b61197b91906139d2565b6069546000908152607e602090815260408083206001600160a01b0388168452909152812054919250906119af9083613a11565b6069546000908152608460205260409020549091506119cc610b3a565b6119d69190613a11565b8110611a05576069546000908152608460205260409020546119f6610b3a565b611a009190613a11565b611a07565b805b949350505050565b336000908152606f6020526040902054819060ff1615611a815760405162461bcd60e51b815260206004820152602760248201527f5769746864726177616c206973207265717565737465642c2063616e6e6f742060448201526619195c1bdcda5d60ca1b60648201526084016109f6565b607a54811015611ac45760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b60448201526064016109f6565b60775481607960006069546001611adb91906139ba565b815260200190815260200160002054611af491906139ba565b1115611b425760405162461bcd60e51b815260206004820181905260248201527f4465706f73697420616d6f756e742065786365656473207661756c742063617060448201526064016109f6565b600160666000828254611b5591906139ba565b909155505060665460345460ff1615611b805760405162461bcd60e51b81526004016109f690613959565b606854611b98906001600160a01b03163330866131c2565b60006069546001611ba991906139ba565b6069546000908152606e60209081526040808320338452909152902054909150158015611bed57506000818152606e60209081526040808320338452909152902054155b15611ca657607b54607c5410611c455760405162461bcd60e51b815260206004820152601b60248201527f4d617820616d6f756e74206f662075736572732072656163686564000000000060448201526064016109f6565b6000818152606c602090815260408083208054600181810183559185528385200180546001600160a01b03191633908117909155858552606d8452828520908552909252909120805460ff191682179055607c54611ca2916139ba565b607c555b6000818152606e6020908152604080832033845290915281208054869290611ccf9084906139ba565b90915550506040805180820182528281526000838152606e6020908152838220338084529082528483205482850190815290835260708252848320935184555160019093019290925583815260719091529081208054869290611d339084906139ba565b909155505060008181526079602052604081208054869290611d569084906139ba565b90915550506083546001600160a01b031615611dd1576083546040516302c7739b60e01b8152336004820152602481018690526001600160a01b03909116906302c7739b90604401600060405180830381600087803b158015611db857600080fd5b505af1158015611dcc573d6000803e3d6000fd5b505050505b60408051338152602081018690527f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4910160405180910390a1506066548114611e2c5760405162461bcd60e51b81526004016109f690613983565b505050565b611e39612bb4565b6001600160a01b038116611e815760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064016109f6565b600154600160a81b900460ff1615611ed15760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b60448201526064016109f6565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610ad9565b6000828152607660208181526040808420546075835281852054868652939092528320549091611f79916139f2565b611f8391906139d2565b9392505050565b611f92612bb4565b607a8190556040518181527f990717cc219e5348c1b88bb0ff530d804f0b6f54f3b03844a2bfbe4eb1e9c5d690602001610ad9565b6000607754607960006069546001611fdf91906139ba565b81526020019081526020016000205410156120235760796000606954600161200791906139ba565b815260200190815260200160002054607754610b6f9190613a11565b90565b61202e612bb4565b60778190556040518181527f8c43aa02599ac8f8bab4724621ceea5e7a06b07bbbfaf3b7bd0386cbe481ea3c90602001610ad9565b60016066600082825461207691906139ba565b909155505060665460345460ff16156120a15760405162461bcd60e51b81526004016109f690613959565b6120a96129fe565b6120f55760405162461bcd60e51b815260206004820152601960248201527f43616e277420636c6f73652063757272656e7420726f756e640000000000000060448201526064016109f6565b6120fd61322d565b600060716000606954600161211291906139ba565b8152602081019190915260409081016000205460685491516370a0823160e01b815230600482015290916001600160a01b0316906370a082319060240160206040518083038186803b15801561216757600080fd5b505afa15801561217b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219f919061375a565b6121a99190613a11565b606954600090815260716020526040902054909150811180156121ce57506000608654115b1561227d576086546069546000908152607160205260408120549091670de0b6b3a7640000916121fe9085613a11565b61220891906139f2565b61221291906139d2565b608554606854919250612232916001600160a01b0390811691168361348a565b61223c8183613a11565b60865460408051918252602082018490529193507fb8379d05082aa2dd32963972d72cc2d46257811133341855b63bb2fddda6ca3e910160405180910390a1505b6069546000908152607160205260409020546122ad576069546000908152607560205260409020600190556122ee565b6069546000908152607160205260409020546122d1670de0b6b3a7640000836139f2565b6122db91906139d2565b6069546000908152607560205260409020555b60005b6069546000908152606c6020526040902054811015612694576069546000908152606c6020526040812080548390811061233b57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910154606954835260758252604080842054606e84528185206001600160a01b0390931680865292909352832054909350670de0b6b3a76400009161238a916139f2565b61239491906139d2565b6069546000908152606d602090815260408083206001600160a01b038716845290915290205490915060ff161561267f576001600160a01b0382166000908152606f602052604090205460ff1661258f5780606e600060695460016123f991906139ba565b81526020019081526020016000206000846001600160a01b03166001600160a01b031681526020019081526020016000205461243591906139ba565b606e6000606954600161244891906139ba565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020819055506001606d6000606954600161249291906139ba565b8152602080820192909252604090810160009081206001600160a01b03871682529092528120805460ff191692151592909217909155606954606c91906124da9060016139ba565b8152602080820192909252604001600090812080546001810182559082529190200180546001600160a01b0319166001600160a01b0384811691909117909155608354161561258a576083546040516302c7739b60e01b81526001600160a01b03848116600483015260248201849052909116906302c7739b90604401600060405180830381600087803b15801561257157600080fd5b505af1158015612585573d6000803e3d6000fd5b505050505b61267f565b6000606e600060695460016125a491906139ba565b8152602080820192909252604090810160009081206001600160a01b038088168352935220919091556068546125dc9116838361348a565b6001600160a01b0382166000908152606f60205260408120805460ff19169055606954606d90829061260f9060016139ba565b8152602080820192909252604090810160009081206001600160a01b03871680835290845290829020805460ff19169415159490941790935580519283529082018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a15b5050808061268c90613a54565b9150506122f1565b50606954600114156126c357606954600090815260756020908152604080832054607690925290912055612726565b606954600081815260756020526040812054670de0b6b3a76400009290916076916126f090600190613a11565b81526020019081526020016000205461270991906139f2565b61271391906139d2565b6069546000908152607660205260409020555b60016069600082825461273991906139ba565b90915550506069546000908152606b60205260409081902042905560685490516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561279657600080fd5b505afa1580156127aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ce919061375a565b606980546000908152607160205260408082209390935590548082529181205491607991906127fe9060016139ba565b8152602001908152602001600020819055507fc67dda8e11f1aa941c7e74466b1859a07a32f46aaf641d29b83be348424d93cd60016069546128409190613a11565b6075600060016069546128539190613a11565b815260200190815260200160002054604051610eb3929190918252602082015260400190565b612881612bb4565b60678054610100600160a81b0319166101006001600160a01b038481168202929092179283905560685460405163095ea7b360e01b81529190930482166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b1580156128f157600080fd5b505af1158015612905573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129299190613722565b506040516001600160a01b03821681527f576297e5fcc8cd907ee80b240284865eb3d821bdc5232e6ee9e4d78a12531c0990602001610ad9565b61296b612bb4565b60828190556040518181527f26ea09cdab135064e784e44516fc5b3d619360d241ae64bff47153b2e5ee610e90602001610ad9565b60675460ff16156129e95760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016109f6565b6067805460ff19166001908117909155606655565b606854600090600160a01b900460ff161580612a375750606a546069546000908152606b6020526040902054612a3491906139ba565b42105b15612a425750600090565b60005b606954600090815260726020526040902054811015612bac576069546000908152607260205260408120805483908110612a8f57634e487b7160e01b600052603260045260246000fd5b6000918252602091829020015460408051633f6fa65560e01b815290516001600160a01b0390921693508392633f6fa65592600480840193829003018186803b158015612adb57600080fd5b505afa158015612aef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b139190613722565b1580612b8b5750806001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015612b5357600080fd5b505afa158015612b67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8b9190613722565b15612b995760009250505090565b5080612ba481613a54565b915050612a45565b506001905090565b6000546201000090046001600160a01b03163314612c2c5760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084016109f6565b565b600054610100900460ff16612c995760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016109f6565b612ca2886109a4565b612caa6129a0565b60678054610100600160a81b0319166101006001600160a01b038a811682029290921792839055606880546001600160a01b0319168a8416908117909155606a89905560778890556078879055607a869055607b85905560405163095ea7b360e01b8152919093049091166004820152600019602482015263095ea7b390604401602060405180830381600087803b158015612d4557600080fd5b505af1158015612d59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7d9190613722565b505050505050505050565b60675460405163270e13ef60e01b815260009161010090046001600160a01b03169063270e13ef90612dc290879087908790600401613885565b60206040518083038186803b158015612dda57600080fd5b505afa158015612dee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e12919061375a565b606954600090815260846020526040902054909150612e2f610b3a565b612e399190613a11565b8110612e935760405162461bcd60e51b815260206004820152602360248201527f416d6f756e74206578636565647320617661696c61626c6520616c6c6f63617460448201526234b7b760e91b60648201526084016109f6565b600068056bc75e2d63100000607d54612eaa610b3a565b612eb491906139f2565b612ebe91906139d2565b6069546000908152607e602090815260408083206001600160a01b038a1684529091529020549091508190612ef390846139ba565b10612f565760405162461bcd60e51b815260206004820152602d60248201527f416d6f756e74206578636565647320617661696c61626c6520616c6c6f63617460448201526c1a5bdb88199bdc88185cdcd95d609a1b60648201526084016109f6565b6068546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015612f9a57600080fd5b505afa158015612fae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd2919061375a565b60675460405163221d7ae160e21b815291925061010090046001600160a01b031690638875eb84906130119089908990899089906000906004016138df565b600060405180830381600087803b15801561302b57600080fd5b505af115801561303f573d6000803e3d6000fd5b50506068546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a082319060240160206040518083038186803b15801561308957600080fd5b505afa15801561309d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c1919061375a565b90508360846000606954815260200190815260200160002060008282546130e891906139ba565b90915550506069546000908152607e602090815260408083206001600160a01b038b168452909152812080548692906131229084906139ba565b909155505060695460009081526073602090815260408083206001600160a01b038b1684529091529020805487919060ff1916600183600281111561317757634e487b7160e01b600052602160045260246000fd5b02179055507fd1fc86fd7e2808fb6a4d745c0f26983bd36784721df1e29a27a28ce3fcdc7416878787876040516131b194939291906138b0565b60405180910390a150505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261158a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134ba565b6000805b6069546000908152607260205260409020548110156110cc57606954600090815260726020526040902080548290811061327b57634e487b7160e01b600052603260045260246000fd5b6000918252602091829020015460408051635c975abb60e01b815290516001600160a01b0390921694508492635c975abb92600480840193829003018186803b1580156132c757600080fd5b505afa1580156132db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132ff9190613722565b1580156133785750816001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561334057600080fd5b505afa158015613354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133789190613722565b1561347857604051636392a51f60e01b8152306004820152600090819081906001600160a01b03861690636392a51f9060240160606040518083038186803b1580156133c357600080fd5b505afa1580156133d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133fb91906137fd565b92509250925060008311806134105750600082115b8061341b5750600081115b1561347457846001600160a01b031663851492586040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561345b57600080fd5b505af115801561346f573d6000803e3d6000fd5b505050505b5050505b8061348281613a54565b915050613231565b6040516001600160a01b038316602482015260448101829052611e2c90849063a9059cbb60e01b906064016131f6565b600061350f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661358c9092919063ffffffff16565b805190915015611e2c578080602001905181019061352d9190613722565b611e2c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109f6565b6060611a07848460008585843b6135e55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109f6565b600080866001600160a01b03168587604051613601919061384c565b60006040518083038185875af1925050503d806000811461363e576040519150601f19603f3d011682016040523d82523d6000602084013e613643565b606091505b509150915061365382828661365e565b979650505050505050565b6060831561366d575081611f83565b82511561367d5782518084602001fd5b8160405162461bcd60e51b81526004016109f69190613926565b6000602082840312156136a8578081fd5b8135611f8381613a85565b600080604083850312156136c5578081fd5b82356136d081613a85565b946020939093013593505050565b6000806000606084860312156136f2578081fd5b83356136fd81613a85565b925060208401359150604084013560038110613717578182fd5b809150509250925092565b600060208284031215613733578081fd5b81518015158114611f83578182fd5b600060208284031215613753578081fd5b5035919050565b60006020828403121561376b578081fd5b5051919050565b60006101a08284031215613784578081fd5b50919050565b6000806040838503121561379c578182fd5b8235915060208301356137ae81613a85565b809150509250929050565b600080604083850312156137cb578182fd5b50508035926020909101359150565b600080604083850312156137ec578182fd5b505080516020909101519092909150565b600080600060608486031215613811578081fd5b8351925060208401519150604084015190509250925092565b6003811061384857634e487b7160e01b600052602160045260246000fd5b9052565b6000825161385e818460208701613a28565b9190910192915050565b6001600160a01b038316815260408101611f83602083018461382a565b6001600160a01b0384168152606081016138a2602083018561382a565b826040830152949350505050565b6001600160a01b0385168152608081016138cd602083018661382a565b60408201939093526060015292915050565b6001600160a01b038616815260a081016138fc602083018761382a565b8460408301528360608301528260808301529695505050505050565b60208101610966828461382a565b6020815260008251806020840152613945816040850160208701613a28565b601f01601f19169190910160400192915050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600082198211156139cd576139cd613a6f565b500190565b6000826139ed57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615613a0c57613a0c613a6f565b500290565b600082821015613a2357613a23613a6f565b500390565b60005b83811015613a43578181015183820152602001613a2b565b8381111561158a5750506000910152565b6000600019821415613a6857613a68613a6f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610edd57600080fdfea2646970667358221220363152295d7882e7bdc8557ba340a35972ff88195301601d6c988e2f5894c53264736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103e65760003560e01c806374094edd1161020a578063c992528811610125578063ddcc8fe9116100b8578063e75c93d911610087578063e75c93d914610903578063e76a02791461090c578063ebc797721461091f578063ee161cce14610927578063fd8a8cc61461092f57600080fd5b8063ddcc8fe9146108b5578063e278fe6f146108c8578063e45b2e88146108d0578063e48a694b146108e357600080fd5b8063d69fb668116100f4578063d69fb66814610888578063db7f92d414610891578063dd636bc7146108a4578063dda9046f146108ac57600080fd5b8063c992528814610840578063c9f4ff4614610858578063cee73a761461086b578063d27c07971461087f57600080fd5b8063942f53571161019d578063b6b55f251161016c578063b6b55f25146107f1578063be805e3c14610804578063c137a60f1461080d578063c3b83f5f1461082d57600080fd5b8063942f53571461076f57806395ba9a70146107aa578063a250badb146107d5578063a9050d4d146107e857600080fd5b806387117630116101d957806387117630146107275780638b649b941461073a5780638da5cb5b146107435780639324cac71461075c57600080fd5b806374094edd146106d957806379ba5097146106f95780637a1e0aa8146107015780637f8525821461071457600080fd5b806340774ff6116103055780635ddd3e83116102985780636719b2ee116102675780636719b2ee1461064b578063681312f5146106875780636c321c8a1461069a57806371143ab9146106a357806371bb4b47146106d157600080fd5b80635ddd3e83146105e0578063610589e11461060b578063634e0d9714610614578063645006ca1461064257600080fd5b806353a47bb7116102d457806353a47bb7146105a757806356991791146105ba5780635c975abb146105cd5780635d1c236d146105d857600080fd5b806340774ff614610558578063456ff7881461056b57806348663e95146105745780634ae7937f1461058757600080fd5b806325a663951161037d578063336d30ed1161034c578063336d30ed146104ff578063343e4f9f1461051f578063370faeb014610532578063384e631c1461054557600080fd5b806325a66395146104bb5780632ef04761146104db578063311c56df146104ee578063322ce77a146104f657600080fd5b80631627540c116103b95780631627540c1461045a5780631daae1731461046d5780631e922460146104a0578063202ffce8146104a857600080fd5b806306d1fb3c146103eb578063082f9fd41461041157806313af40351461043c578063146ca53114610451575b600080fd5b6103fe6103f936600461378a565b610942565b6040519081526020015b60405180910390f35b61042461041f3660046137b9565b61096c565b6040516001600160a01b039091168152602001610408565b61044f61044a366004613697565b6109a4565b005b6103fe60695481565b61044f610468366004613697565b610ae4565b61049061047b366004613697565b606f6020526000908152604090205460ff1681565b6040519015158152602001610408565b6103fe610b3a565b61044f6104b6366004613742565b610b74565b6103fe6104c9366004613742565b60796020526000908152604090205481565b61044f6104e9366004613742565b610bb1565b61044f610bee565b6103fe607c5481565b6103fe61050d366004613742565b60766020526000908152604090205481565b61042461052d3660046137b9565b610ee0565b61044f6105403660046137b9565b610efc565b61044f610553366004613772565b610f9b565b61044f610566366004613742565b6110d0565b6103fe60815481565b608554610424906001600160a01b031681565b6103fe610595366004613742565b60716020526000908152604090205481565b600154610424906001600160a01b031681565b61044f6105c83660046136de565b61110d565b60345460ff16610490565b61044f611590565b6103fe6105ee36600461378a565b606e60209081526000928352604080842090915290825290205481565b6103fe607b5481565b61049061062236600461378a565b606d60209081526000928352604080842090915290825290205460ff1681565b6103fe607a5481565b610672610659366004613697565b6070602052600090815260409020805460019091015482565b60408051928352602083019190915201610408565b61044f610695366004613742565b6116a9565b6103fe60785481565b6104906106b136600461378a565b607460209081526000928352604080842090915290825290205460ff1681565b6103fe6116e6565b6103fe6106e7366004613742565b60756020526000908152604090205481565b61044f611706565b61044f61070f3660046136b3565b611803565b61044f610722366004613697565b611864565b61044f610735366004613742565b6118ba565b6103fe606a5481565b600054610424906201000090046001600160a01b031681565b606854610424906001600160a01b031681565b61079d61077d36600461378a565b607360209081526000928352604080842090915290825290205460ff1681565b6040516104089190613918565b6103fe6107b836600461378a565b607e60209081526000928352604080842090915290825290205481565b6103fe6107e3366004613697565b61194f565b6103fe607d5481565b61044f6107ff366004613742565b611a0f565b6103fe60805481565b6103fe61081b366004613742565b606b6020526000908152604090205481565b61044f61083b366004613697565b611e31565b6067546104249061010090046001600160a01b031681565b6103fe6108663660046137b9565b611f4a565b60685461049090600160a01b900460ff1681565b6103fe60775481565b6103fe60865481565b61044f61089f366004613742565b611f8a565b6103fe611fc7565b6103fe60825481565b61044f6108c3366004613742565b612026565b61044f612063565b61044f6108de366004613697565b612879565b6103fe6108f1366004613742565b60846020526000908152604090205481565b6103fe607f5481565b61044f61091a366004613742565b612963565b61044f6129a0565b6104906129fe565b608354610424906001600160a01b031681565b6000828152606e602090815260408083206001600160a01b03851684529091529020545b92915050565b6072602052816000526040600020818154811061098857600080fd5b6000918252602090912001546001600160a01b03169150829050565b6001600160a01b0381166109ff5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff1615610a6b5760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b60648201526084016109f6565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610aec612bb4565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610ad9565b6078546069546000908152607160205260408120549091670de0b6b3a764000091610b6591906139f2565b610b6f91906139d2565b905090565b610b7c612bb4565b607b8190556040518181527fe7c2c09f66c8b970b4a99250f4d0844e1496b9d51d4760a17b0134ddd52023e190602001610ad9565b610bb9612bb4565b60818190556040518181527f137f353e194da87258fd6c2b78eb1cfb9f2ce996f3466729d2464eccb7ce612990602001610ad9565b600160666000828254610c0191906139ba565b909155505060665460345460ff1615610c2c5760405162461bcd60e51b81526004016109f690613959565b606854600160a01b900460ff16610c7d5760405162461bcd60e51b815260206004820152601560248201527415985d5b1d081a185cc81b9bdd081cdd185c9d1959605a1b60448201526064016109f6565b336000908152606f602052604090205460ff1615610cdd5760405162461bcd60e51b815260206004820152601c60248201527f5769746864726177616c20616c7265616479207265717565737465640000000060448201526064016109f6565b6069546000908152606e60209081526040808320338452909152902054610d3c5760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b60448201526064016109f6565b606e60006069546001610d4f91906139ba565b81526020808201929092526040908101600090812033825290925290205415610dd95760405162461bcd60e51b815260206004820152603660248201527f43616e277420776974686472617720617320796f7520616c72656164792064656044820152751c1bdcda5d195908199bdc881b995e1d081c9bdd5b9960521b60648201526084016109f6565b60006069546001610dea91906139ba565b6069546000908152606e602090815260408083203384528252808320548484526079909252909120549192501015610e5a576069546000908152606e6020908152604080832033845282528083205484845260799092528220805491929091610e54908490613a11565b90915550505b6001607c54610e699190613a11565b607c55336000818152606f6020908152604091829020805460ff1916600117905590519182527fe5892ff2a8b08efb903ffbba1f0514c1d3e22eea34dd5b89cf30aabce03dde5a91015b60405180910390a1506066548114610edd5760405162461bcd60e51b81526004016109f690613983565b50565b606c602052816000526040600020818154811061098857600080fd5b610f04612bb4565b808210610f535760405162461bcd60e51b815260206004820152601a60248201527f496e76616c6964207072696365206c696d69742076616c75657300000000000060448201526064016109f6565b607f829055608081905560408051838152602081018390527f34b23d671026520e294c1060acc36120677e8c9bd073a8f6577a6f241785b1a691015b60405180910390a15050565b600054610100900460ff16610fb65760005460ff1615610fba565b303b155b61101d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109f6565b600054610100900460ff1615801561103f576000805461ffff19166101011790555b61109161104f6020840184613697565b61105f6040850160208601613697565b61106f6060860160408701613697565b8560600135866101000135876101200135886101400135896101600135612c2e565b608080830135607f5560a0830135905560c082013560815560e0820135607d5561018082013560825580156110cc576000805461ff00191690555b5050565b6110d8612bb4565b60788190556040518181527fc117ccf765672707ebe3c1606037488c1e27dc1f42b5266e3d6b496db7d4209e90602001610ad9565b60016066600082825461112091906139ba565b909155505060665460345460ff161561114b5760405162461bcd60e51b81526004016109f690613959565b606854600160a01b900460ff1661119c5760405162461bcd60e51b815260206004820152601560248201527415985d5b1d081a185cc81b9bdd081cdd185c9d1959605a1b60448201526064016109f6565b6082548310156111ee5760405162461bcd60e51b815260206004820152601860248201527f416d6f756e74206c657373207468616e206d696e696d756d000000000000000060448201526064016109f6565b60008490506000816001600160a01b0316639e3b34bf6040518163ffffffff1660e01b8152600401604080518083038186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126591906137da565b50606a546069546000908152606b6020526040902054919250611287916139ba565b81106112cd5760405162461bcd60e51b815260206004820152601560248201527413585c9ad95d081d1a5b59481b9bdd081d985b1a59605a1b60448201526064016109f6565b6067546040516350d851a160e01b815260009161010090046001600160a01b0316906350d851a190611305908a908990600401613868565b60206040518083038186803b15801561131d57600080fd5b505afa158015611331573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611355919061375a565b90506000811161139f5760405162461bcd60e51b815260206004820152601560248201527405072696365206e6f74206d6f7265207468616e203605c1b60448201526064016109f6565b606754604051632fd1b02d60e21b815260009161010090046001600160a01b03169063bf46c0b4906113d9908b908a908c90600401613885565b60206040518083038186803b1580156113f157600080fd5b505afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611429919061375a565b9050607f54821015801561143f57506080548211155b6114845760405162461bcd60e51b815260206004820152601660248201527513585c9ad95d081c1c9a58d9481b9bdd081d985b1a5960521b60448201526064016109f6565b60815481126114cc5760405162461bcd60e51b81526020600482015260146024820152730a6d6caee40d2dae0c2c6e840e8dede40d0d2ced60631b60448201526064016109f6565b6114d7888789612d88565b60695460009081526074602090815260408083206001600160a01b038c16845290915290205460ff16611565576069805460009081526072602090815260408083208054600180820183559185528385200180546001600160a01b0319166001600160a01b038f169081179091559454845260748352818420948452939091529020805460ff191690911790555b50505050606654811461158a5760405162461bcd60e51b81526004016109f690613983565b50505050565b611598612bb4565b606854600160a01b900460ff16156115f25760405162461bcd60e51b815260206004820152601960248201527f5661756c742068617320616c726561647920737461727465640000000000000060448201526064016109f6565b6001606955427fa775687211c2b3346a0f5a2a0e7590e6c1838453e3785e6dd2a8efd6265ddf15556068805460ff60a01b1916600160a01b17905560796020527fdf6d6ad01a16c6118cfd605fcb55ad218b43517981ef4cc6d63a492cf34990d954600260009081527f7d4d2b02426547888e9185e69135196c4ed1edbc114060100a6ef94f8b5f60df919091556040517f59760ad83ef06d1a0bc439d8b39a42a870493f0cd3bc3d53bbd3e7c6991f494f9190a1565b6116b1612bb4565b606a8190556040518181527f1d1fb7111c3779798bd4aefb2daea07ee8257a13c7eaceba89b4b1ccd405050d90602001610ad9565b606a546069546000908152606b60205260408120549091610b6f916139ba565b6001546001600160a01b0316331461177e5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b60648201526084016109f6565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b61180b612bb4565b608580546001600160a01b0319166001600160a01b038416908117909155608682905560408051918252602082018390527fa1a8623472ca4e2879372be60dfd1ff0675778e49f7379eedd98ca57cf36b21a9101610f8f565b61186c612bb4565b608380546001600160a01b0319166001600160a01b0383169081179091556040519081527f3c7faa500efbd341aedbf1ee7ebd52ea36d226dda76bc01dd39b43d46f55b8d390602001610ad9565b6118c2612bb4565b68056bc75e2d63100000811061191a5760405162461bcd60e51b815260206004820152601f60248201527f496e76616c696420616c6c6f636174696f6e206c696d69742076616c7565730060448201526064016109f6565b607d8190556040518181527f9fb019ef2cdd86e0c7772694b935b2fd45131410802474ef0a8bf0afff94a40390602001610ad9565b60008068056bc75e2d63100000607d54611967610b3a565b61197191906139f2565b61197b91906139d2565b6069546000908152607e602090815260408083206001600160a01b0388168452909152812054919250906119af9083613a11565b6069546000908152608460205260409020549091506119cc610b3a565b6119d69190613a11565b8110611a05576069546000908152608460205260409020546119f6610b3a565b611a009190613a11565b611a07565b805b949350505050565b336000908152606f6020526040902054819060ff1615611a815760405162461bcd60e51b815260206004820152602760248201527f5769746864726177616c206973207265717565737465642c2063616e6e6f742060448201526619195c1bdcda5d60ca1b60648201526084016109f6565b607a54811015611ac45760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b60448201526064016109f6565b60775481607960006069546001611adb91906139ba565b815260200190815260200160002054611af491906139ba565b1115611b425760405162461bcd60e51b815260206004820181905260248201527f4465706f73697420616d6f756e742065786365656473207661756c742063617060448201526064016109f6565b600160666000828254611b5591906139ba565b909155505060665460345460ff1615611b805760405162461bcd60e51b81526004016109f690613959565b606854611b98906001600160a01b03163330866131c2565b60006069546001611ba991906139ba565b6069546000908152606e60209081526040808320338452909152902054909150158015611bed57506000818152606e60209081526040808320338452909152902054155b15611ca657607b54607c5410611c455760405162461bcd60e51b815260206004820152601b60248201527f4d617820616d6f756e74206f662075736572732072656163686564000000000060448201526064016109f6565b6000818152606c602090815260408083208054600181810183559185528385200180546001600160a01b03191633908117909155858552606d8452828520908552909252909120805460ff191682179055607c54611ca2916139ba565b607c555b6000818152606e6020908152604080832033845290915281208054869290611ccf9084906139ba565b90915550506040805180820182528281526000838152606e6020908152838220338084529082528483205482850190815290835260708252848320935184555160019093019290925583815260719091529081208054869290611d339084906139ba565b909155505060008181526079602052604081208054869290611d569084906139ba565b90915550506083546001600160a01b031615611dd1576083546040516302c7739b60e01b8152336004820152602481018690526001600160a01b03909116906302c7739b90604401600060405180830381600087803b158015611db857600080fd5b505af1158015611dcc573d6000803e3d6000fd5b505050505b60408051338152602081018690527f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4910160405180910390a1506066548114611e2c5760405162461bcd60e51b81526004016109f690613983565b505050565b611e39612bb4565b6001600160a01b038116611e815760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064016109f6565b600154600160a81b900460ff1615611ed15760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b60448201526064016109f6565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610ad9565b6000828152607660208181526040808420546075835281852054868652939092528320549091611f79916139f2565b611f8391906139d2565b9392505050565b611f92612bb4565b607a8190556040518181527f990717cc219e5348c1b88bb0ff530d804f0b6f54f3b03844a2bfbe4eb1e9c5d690602001610ad9565b6000607754607960006069546001611fdf91906139ba565b81526020019081526020016000205410156120235760796000606954600161200791906139ba565b815260200190815260200160002054607754610b6f9190613a11565b90565b61202e612bb4565b60778190556040518181527f8c43aa02599ac8f8bab4724621ceea5e7a06b07bbbfaf3b7bd0386cbe481ea3c90602001610ad9565b60016066600082825461207691906139ba565b909155505060665460345460ff16156120a15760405162461bcd60e51b81526004016109f690613959565b6120a96129fe565b6120f55760405162461bcd60e51b815260206004820152601960248201527f43616e277420636c6f73652063757272656e7420726f756e640000000000000060448201526064016109f6565b6120fd61322d565b600060716000606954600161211291906139ba565b8152602081019190915260409081016000205460685491516370a0823160e01b815230600482015290916001600160a01b0316906370a082319060240160206040518083038186803b15801561216757600080fd5b505afa15801561217b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219f919061375a565b6121a99190613a11565b606954600090815260716020526040902054909150811180156121ce57506000608654115b1561227d576086546069546000908152607160205260408120549091670de0b6b3a7640000916121fe9085613a11565b61220891906139f2565b61221291906139d2565b608554606854919250612232916001600160a01b0390811691168361348a565b61223c8183613a11565b60865460408051918252602082018490529193507fb8379d05082aa2dd32963972d72cc2d46257811133341855b63bb2fddda6ca3e910160405180910390a1505b6069546000908152607160205260409020546122ad576069546000908152607560205260409020600190556122ee565b6069546000908152607160205260409020546122d1670de0b6b3a7640000836139f2565b6122db91906139d2565b6069546000908152607560205260409020555b60005b6069546000908152606c6020526040902054811015612694576069546000908152606c6020526040812080548390811061233b57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910154606954835260758252604080842054606e84528185206001600160a01b0390931680865292909352832054909350670de0b6b3a76400009161238a916139f2565b61239491906139d2565b6069546000908152606d602090815260408083206001600160a01b038716845290915290205490915060ff161561267f576001600160a01b0382166000908152606f602052604090205460ff1661258f5780606e600060695460016123f991906139ba565b81526020019081526020016000206000846001600160a01b03166001600160a01b031681526020019081526020016000205461243591906139ba565b606e6000606954600161244891906139ba565b81526020019081526020016000206000846001600160a01b03166001600160a01b03168152602001908152602001600020819055506001606d6000606954600161249291906139ba565b8152602080820192909252604090810160009081206001600160a01b03871682529092528120805460ff191692151592909217909155606954606c91906124da9060016139ba565b8152602080820192909252604001600090812080546001810182559082529190200180546001600160a01b0319166001600160a01b0384811691909117909155608354161561258a576083546040516302c7739b60e01b81526001600160a01b03848116600483015260248201849052909116906302c7739b90604401600060405180830381600087803b15801561257157600080fd5b505af1158015612585573d6000803e3d6000fd5b505050505b61267f565b6000606e600060695460016125a491906139ba565b8152602080820192909252604090810160009081206001600160a01b038088168352935220919091556068546125dc9116838361348a565b6001600160a01b0382166000908152606f60205260408120805460ff19169055606954606d90829061260f9060016139ba565b8152602080820192909252604090810160009081206001600160a01b03871680835290845290829020805460ff19169415159490941790935580519283529082018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a15b5050808061268c90613a54565b9150506122f1565b50606954600114156126c357606954600090815260756020908152604080832054607690925290912055612726565b606954600081815260756020526040812054670de0b6b3a76400009290916076916126f090600190613a11565b81526020019081526020016000205461270991906139f2565b61271391906139d2565b6069546000908152607660205260409020555b60016069600082825461273991906139ba565b90915550506069546000908152606b60205260409081902042905560685490516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561279657600080fd5b505afa1580156127aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ce919061375a565b606980546000908152607160205260408082209390935590548082529181205491607991906127fe9060016139ba565b8152602001908152602001600020819055507fc67dda8e11f1aa941c7e74466b1859a07a32f46aaf641d29b83be348424d93cd60016069546128409190613a11565b6075600060016069546128539190613a11565b815260200190815260200160002054604051610eb3929190918252602082015260400190565b612881612bb4565b60678054610100600160a81b0319166101006001600160a01b038481168202929092179283905560685460405163095ea7b360e01b81529190930482166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b1580156128f157600080fd5b505af1158015612905573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129299190613722565b506040516001600160a01b03821681527f576297e5fcc8cd907ee80b240284865eb3d821bdc5232e6ee9e4d78a12531c0990602001610ad9565b61296b612bb4565b60828190556040518181527f26ea09cdab135064e784e44516fc5b3d619360d241ae64bff47153b2e5ee610e90602001610ad9565b60675460ff16156129e95760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064016109f6565b6067805460ff19166001908117909155606655565b606854600090600160a01b900460ff161580612a375750606a546069546000908152606b6020526040902054612a3491906139ba565b42105b15612a425750600090565b60005b606954600090815260726020526040902054811015612bac576069546000908152607260205260408120805483908110612a8f57634e487b7160e01b600052603260045260246000fd5b6000918252602091829020015460408051633f6fa65560e01b815290516001600160a01b0390921693508392633f6fa65592600480840193829003018186803b158015612adb57600080fd5b505afa158015612aef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b139190613722565b1580612b8b5750806001600160a01b0316635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015612b5357600080fd5b505afa158015612b67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8b9190613722565b15612b995760009250505090565b5080612ba481613a54565b915050612a45565b506001905090565b6000546201000090046001600160a01b03163314612c2c5760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084016109f6565b565b600054610100900460ff16612c995760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016109f6565b612ca2886109a4565b612caa6129a0565b60678054610100600160a81b0319166101006001600160a01b038a811682029290921792839055606880546001600160a01b0319168a8416908117909155606a89905560778890556078879055607a869055607b85905560405163095ea7b360e01b8152919093049091166004820152600019602482015263095ea7b390604401602060405180830381600087803b158015612d4557600080fd5b505af1158015612d59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d7d9190613722565b505050505050505050565b60675460405163270e13ef60e01b815260009161010090046001600160a01b03169063270e13ef90612dc290879087908790600401613885565b60206040518083038186803b158015612dda57600080fd5b505afa158015612dee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e12919061375a565b606954600090815260846020526040902054909150612e2f610b3a565b612e399190613a11565b8110612e935760405162461bcd60e51b815260206004820152602360248201527f416d6f756e74206578636565647320617661696c61626c6520616c6c6f63617460448201526234b7b760e91b60648201526084016109f6565b600068056bc75e2d63100000607d54612eaa610b3a565b612eb491906139f2565b612ebe91906139d2565b6069546000908152607e602090815260408083206001600160a01b038a1684529091529020549091508190612ef390846139ba565b10612f565760405162461bcd60e51b815260206004820152602d60248201527f416d6f756e74206578636565647320617661696c61626c6520616c6c6f63617460448201526c1a5bdb88199bdc88185cdcd95d609a1b60648201526084016109f6565b6068546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015612f9a57600080fd5b505afa158015612fae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd2919061375a565b60675460405163221d7ae160e21b815291925061010090046001600160a01b031690638875eb84906130119089908990899089906000906004016138df565b600060405180830381600087803b15801561302b57600080fd5b505af115801561303f573d6000803e3d6000fd5b50506068546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a082319060240160206040518083038186803b15801561308957600080fd5b505afa15801561309d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c1919061375a565b90508360846000606954815260200190815260200160002060008282546130e891906139ba565b90915550506069546000908152607e602090815260408083206001600160a01b038b168452909152812080548692906131229084906139ba565b909155505060695460009081526073602090815260408083206001600160a01b038b1684529091529020805487919060ff1916600183600281111561317757634e487b7160e01b600052602160045260246000fd5b02179055507fd1fc86fd7e2808fb6a4d745c0f26983bd36784721df1e29a27a28ce3fcdc7416878787876040516131b194939291906138b0565b60405180910390a150505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261158a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134ba565b6000805b6069546000908152607260205260409020548110156110cc57606954600090815260726020526040902080548290811061327b57634e487b7160e01b600052603260045260246000fd5b6000918252602091829020015460408051635c975abb60e01b815290516001600160a01b0390921694508492635c975abb92600480840193829003018186803b1580156132c757600080fd5b505afa1580156132db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132ff9190613722565b1580156133785750816001600160a01b0316633f6fa6556040518163ffffffff1660e01b815260040160206040518083038186803b15801561334057600080fd5b505afa158015613354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133789190613722565b1561347857604051636392a51f60e01b8152306004820152600090819081906001600160a01b03861690636392a51f9060240160606040518083038186803b1580156133c357600080fd5b505afa1580156133d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133fb91906137fd565b92509250925060008311806134105750600082115b8061341b5750600081115b1561347457846001600160a01b031663851492586040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561345b57600080fd5b505af115801561346f573d6000803e3d6000fd5b505050505b5050505b8061348281613a54565b915050613231565b6040516001600160a01b038316602482015260448101829052611e2c90849063a9059cbb60e01b906064016131f6565b600061350f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661358c9092919063ffffffff16565b805190915015611e2c578080602001905181019061352d9190613722565b611e2c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109f6565b6060611a07848460008585843b6135e55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109f6565b600080866001600160a01b03168587604051613601919061384c565b60006040518083038185875af1925050503d806000811461363e576040519150601f19603f3d011682016040523d82523d6000602084013e613643565b606091505b509150915061365382828661365e565b979650505050505050565b6060831561366d575081611f83565b82511561367d5782518084602001fd5b8160405162461bcd60e51b81526004016109f69190613926565b6000602082840312156136a8578081fd5b8135611f8381613a85565b600080604083850312156136c5578081fd5b82356136d081613a85565b946020939093013593505050565b6000806000606084860312156136f2578081fd5b83356136fd81613a85565b925060208401359150604084013560038110613717578182fd5b809150509250925092565b600060208284031215613733578081fd5b81518015158114611f83578182fd5b600060208284031215613753578081fd5b5035919050565b60006020828403121561376b578081fd5b5051919050565b60006101a08284031215613784578081fd5b50919050565b6000806040838503121561379c578182fd5b8235915060208301356137ae81613a85565b809150509250929050565b600080604083850312156137cb578182fd5b50508035926020909101359150565b600080604083850312156137ec578182fd5b505080516020909101519092909150565b600080600060608486031215613811578081fd5b8351925060208401519150604084015190509250925092565b6003811061384857634e487b7160e01b600052602160045260246000fd5b9052565b6000825161385e818460208701613a28565b9190910192915050565b6001600160a01b038316815260408101611f83602083018461382a565b6001600160a01b0384168152606081016138a2602083018561382a565b826040830152949350505050565b6001600160a01b0385168152608081016138cd602083018661382a565b60408201939093526060015292915050565b6001600160a01b038616815260a081016138fc602083018761382a565b8460408301528360608301528260808301529695505050505050565b60208101610966828461382a565b6020815260008251806020840152613945816040850160208701613a28565b601f01601f19169190910160400192915050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600082198211156139cd576139cd613a6f565b500190565b6000826139ed57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615613a0c57613a0c613a6f565b500290565b600082821015613a2357613a23613a6f565b500390565b60005b83811015613a43578181015183820152602001613a2b565b8381111561158a5750506000910152565b6000600019821415613a6857613a68613a6f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610edd57600080fdfea2646970667358221220363152295d7882e7bdc8557ba340a35972ff88195301601d6c988e2f5894c53264736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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