Contract 0x01e0e3c22f6Ff60282aE9F0066C9e8F230666DE1 1

 
Txn Hash Method
Block
From
To
Value
0x73322b20efbfeb4508816451a1cff4c39f2cac02082314243fd4a2d2fe2ad8140x6080604039970332023-09-15 13:10:1315 days 3 hrs ago0x625796b2869d94de2d11841288789663005c080f IN  Create: SportAMMRiskManager0 ETH0.0032789969451
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SportAMMRiskManager

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

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

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

// internal
import "../utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol";
import "../utils/proxy/solidity-0.8.0/ProxyOwned.sol";

// interface
import "../interfaces/ISportPositionalMarketManager.sol";

/// @title Sports AMM Risk contract
/// @author gruja
contract SportAMMRiskManager is Initializable, ProxyOwned, PausableUpgradeable, ProxyReentrancyGuard {
    /* ========== RISK MANAGER CONST VARIABLES ========== */
    uint public constant MIN_TAG_NUMBER = 9000;
    uint public constant MIN_CHILD_NUMBER = 10000;
    uint public constant MIN_PLAYER_PROPS_NUMBER = 11000;

    /* ========== RISK MANAGER STATE VARIABLES ========== */
    address public manager;
    uint public defaultCapPerGame;
    mapping(uint => uint) public capPerSport;
    mapping(uint => mapping(uint => uint)) public capPerSportAndChild;
    mapping(address => uint) public capPerMarket;

    uint public defaultRiskMultiplier;
    mapping(uint => uint) public riskMultiplierForSport;
    mapping(address => uint) public riskMultiplierPerMarket;

    uint public maxCap;
    uint public maxRiskMultiplier;

    mapping(uint => bool) public isMarketForSportOnePositional;
    mapping(uint => bool) public isMarketForPlayerPropsOnePositional;

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

    function initialize(
        address _owner,
        address _manager,
        uint _defaultCapPerGame,
        uint[] memory _sportIds,
        uint[] memory _capsPerSport,
        uint[] memory _sportIdsForChilds,
        uint[] memory _childsIds,
        uint[] memory _capsForChilds,
        uint _defaultRiskMultiplier,
        uint[] memory _sportIdsForMultiplier,
        uint[] memory _riskMultiplierPerSport
    ) public initializer {
        setOwner(_owner);
        initNonReentrant();
        defaultCapPerGame = _defaultCapPerGame;
        defaultRiskMultiplier = _defaultRiskMultiplier;
        manager = _manager;

        for (uint i; i < _sportIds.length; i++) {
            capPerSport[_sportIds[i]] = _capsPerSport[i];
        }

        for (uint i; i < _sportIdsForChilds.length; i++) {
            capPerSportAndChild[_sportIdsForChilds[i]][_childsIds[i]] = _capsForChilds[i];
        }

        for (uint i; i < _sportIdsForMultiplier.length; i++) {
            riskMultiplierForSport[_sportIdsForMultiplier[i]] = _riskMultiplierPerSport[i];
        }
    }

    /* ========== VIEW FUNCTIONS ========== */

    /// @notice calculate which cap needs to be applied to the given market
    /// @param _market to get cap for
    /// @return toReturn cap to use
    function calculateCapToBeUsed(address _market) external view returns (uint toReturn) {
        return _calculateCapToBeUsed(_market);
    }

    /// @notice returns if market is in to much of a risk
    /// @param _totalSpent total spent on market
    /// @param _market for which is calculation done
    /// @return _isNotRisky true/false
    function isTotalSpendingLessThanTotalRisk(uint _totalSpent, address _market) external view returns (bool _isNotRisky) {
        uint capPerMarket = _calculateCapToBeUsed(_market);
        uint riskMultiplier = _calculateRiskMultiplier(_market);
        return _totalSpent <= capPerMarket * riskMultiplier;
    }

    /* ========== INTERNALS ========== */

    function _calculateRiskMultiplier(address market) internal view returns (uint toReturn) {
        uint marketRisk = riskMultiplierPerMarket[market];

        if (marketRisk == 0) {
            (uint tag1, ) = _getTagsForMarket(market);
            uint riskPerTag = riskMultiplierForSport[tag1];
            marketRisk = riskPerTag > 0 ? riskPerTag : defaultRiskMultiplier;
        }

        toReturn = marketRisk;
    }

    function _calculateCapToBeUsed(address market) internal view returns (uint toReturn) {
        toReturn = capPerMarket[market];
        if (toReturn == 0) {
            (uint tag1, uint tag2) = _getTagsForMarket(market);
            uint capFirstTag = capPerSport[tag1];
            capFirstTag = capFirstTag > 0 ? capFirstTag : defaultCapPerGame;
            toReturn = capFirstTag;

            if (tag2 > 0) {
                uint capSecondTag = capPerSportAndChild[tag1][tag2];
                toReturn = capSecondTag > 0 ? capSecondTag : capFirstTag / 2;
            }
        }
    }

    function _getTagsForMarket(address _market) internal view returns (uint tag1, uint tag2) {
        ISportPositionalMarket sportMarket = ISportPositionalMarket(_market);
        tag1 = sportMarket.tags(0);
        tag2 = sportMarket.isChild() ? sportMarket.tags(1) : 0;
    }

    /* ========== CONTRACT MANAGEMENT ========== */

    /// @notice Setting the Cap per spec. market
    /// @param _markets market addresses
    /// @param _capPerMarket The cap amount used for the specific markets
    function setCapPerMarket(address[] memory _markets, uint _capPerMarket) external {
        require(
            msg.sender == owner || ISportPositionalMarketManager(manager).isWhitelistedAddress(msg.sender),
            "Invalid sender"
        );
        require(_capPerMarket <= maxCap, "Invalid cap");
        for (uint i; i < _markets.length; i++) {
            require(_markets[i] != address(0), "Invalid address");
            capPerMarket[_markets[i]] = _capPerMarket;
            emit SetCapPerMarket(_markets[i], _capPerMarket);
        }
    }

    /// @notice Setting the Cap per Sport ID
    /// @param _sportID The tagID used for sport (9004)
    /// @param _childID The tagID used for childid (10002)
    /// @param _capPerChild The cap amount used for the sportID
    function setCapPerSportAndChild(
        uint _sportID,
        uint _childID,
        uint _capPerChild
    ) external onlyOwner {
        uint currentCapPerSport = capPerSport[_sportID] > 0 ? capPerSport[_sportID] : defaultCapPerGame;
        require(_capPerChild <= currentCapPerSport, "Invalid cap");
        require(_sportID > MIN_TAG_NUMBER, "Invalid tag for sport");
        require(_childID > MIN_CHILD_NUMBER, "Invalid tag for child");
        capPerSportAndChild[_sportID][_childID] = _capPerChild;
        emit SetCapPerSportAndChild(_sportID, _childID, _capPerChild);
    }

    /// @notice Setting the Cap per Sport ID
    /// @param _sportID The tagID used for each market
    /// @param _capPerSport The cap amount used for the sportID
    function setCapPerSport(uint _sportID, uint _capPerSport) external onlyOwner {
        require(_sportID > MIN_TAG_NUMBER, "Invalid tag for sport");
        require(_capPerSport <= maxCap, "Invalid cap");
        capPerSport[_sportID] = _capPerSport;
        emit SetCapPerSport(_sportID, _capPerSport);
    }

    /// @notice Setting the Cap per game default value
    /// @param _capPerGame default cap
    function setDefaultCapPerGame(uint _capPerGame) external onlyOwner {
        require(_capPerGame <= maxCap, "Invalid cap");
        defaultCapPerGame = _capPerGame;
        emit SetDefaultCapPerGame(_capPerGame);
    }

    /// @notice default risk multiplier
    /// @param _riskMultiplier risk multiplier
    function setDefaultRiskMultiplier(uint _riskMultiplier) external onlyOwner {
        require(_riskMultiplier <= maxRiskMultiplier, "Invalid multiplier");
        defaultRiskMultiplier = _riskMultiplier;
        emit SetDefaultRiskMultiplier(_riskMultiplier);
    }

    /// @notice Setting the risk multiplier per Sport ID
    /// @param _sportID The tagID used for each market
    /// @param _riskMultiplier The risk multiplier amount used for the sportID
    function setRiskMultiplierPerSport(uint _sportID, uint _riskMultiplier) external onlyOwner {
        require(_sportID > MIN_TAG_NUMBER, "Invalid tag for sport");
        require(_riskMultiplier <= maxRiskMultiplier, "Invalid multiplier");
        riskMultiplierForSport[_sportID] = _riskMultiplier;
        emit SetRiskMultiplierPerSport(_sportID, _riskMultiplier);
    }

    /// @notice Setting the risk multiplier per spec. market
    /// @param _markets market addresses
    /// @param _riskMultiplier The risk multiplier used for the specific markets
    function setRiskMultiplierMarket(address[] memory _markets, uint _riskMultiplier) external {
        require(
            msg.sender == owner || ISportPositionalMarketManager(manager).isWhitelistedAddress(msg.sender),
            "Invalid sender"
        );
        require(_riskMultiplier <= maxRiskMultiplier, "Invalid multiplier");
        for (uint i; i < _markets.length; i++) {
            require(_markets[i] != address(0), "Invalid address");
            riskMultiplierPerMarket[_markets[i]] = _riskMultiplier;
            emit SetRiskMultiplierPerMarket(_markets[i], _riskMultiplier);
        }
    }

    /// @notice Setting the Sport Positional Manager contract address
    /// @param _manager Address of Staking contract
    function setSportsPositionalMarketManager(address _manager) external onlyOwner {
        require(_manager != address(0), "Invalid address");
        manager = _manager;
        emit SetSportsPositionalMarketManager(_manager);
    }

    /// @notice Setting the max cap and risk per market
    /// @param _maxCap max cap per market
    /// @param _maxRisk max risk multiplier
    function setMaxCapAndRisk(uint _maxCap, uint _maxRisk) external onlyOwner {
        require(_maxCap > defaultCapPerGame && _maxRisk > defaultRiskMultiplier, "Invalid input");
        maxCap = _maxCap;
        maxRiskMultiplier = _maxRisk;
        emit SetMaxCapAndRisk(_maxCap, _maxRisk);
    }

    /// @notice setting one positional sport
    /// @param _sportID tag id for sport
    /// @param _flag is one positional sport flag
    function setSportOnePositional(uint _sportID, bool _flag) external onlyOwner {
        require(_sportID > MIN_TAG_NUMBER, "Invalid tag for sport");
        require(isMarketForSportOnePositional[_sportID] != _flag, "Invalid flag");
        isMarketForSportOnePositional[_sportID] = _flag;
        emit SetSportOnePositional(_sportID, _flag);
    }

    /// @notice setting one positional sport
    /// @param _playerPropsOptionTag tag id for PP
    /// @param _flag is one positional sport flag
    function setPlayerPropsOnePositional(uint _playerPropsOptionTag, bool _flag) external onlyOwner {
        require(_playerPropsOptionTag > MIN_PLAYER_PROPS_NUMBER, "Invalid tag for player props");
        require(isMarketForPlayerPropsOnePositional[_playerPropsOptionTag] != _flag, "Invalid flag");
        isMarketForPlayerPropsOnePositional[_playerPropsOptionTag] = _flag;
        emit SetPlayerPropsOnePositional(_playerPropsOptionTag, _flag);
    }

    /* ========== MODIFIERS ========== */
    /* ========== EVENTS ========== */
    event SetCapPerSport(uint _sport, uint _cap);
    event SetCapPerMarket(address _market, uint _cap);
    event SetCapPerSportAndChild(uint _sport, uint _child, uint _cap);
    event SetSportsPositionalMarketManager(address _manager);
    event SetDefaultCapPerGame(uint _cap);
    event SetDefaultRiskMultiplier(uint _riskMultiplier);
    event SetRiskMultiplierPerSport(uint _sport, uint _riskMultiplier);
    event SetRiskMultiplierPerMarket(address _market, uint _riskMultiplier);
    event SetMaxCapAndRisk(uint _maxCap, uint _maxRisk);
    event SetSportOnePositional(uint _sport, bool _flag);
    event SetPlayerPropsOnePositional(uint _playerPropsOptionTag, bool _flag);
}

File 2 of 13 : 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 3 of 13 : 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 4 of 13 : 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 5 of 13 : 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 6 of 13 : ISportPositionalMarketManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

interface ISportPositionalMarketManager {
    /* ========== VIEWS / VARIABLES ========== */

    function marketCreationEnabled() external view returns (bool);

    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 isDoubleChanceMarket(address candidate) external view returns (bool);

    function isDoubleChanceSupported() external view returns (bool);

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

    function getActiveMarketAddress(uint _index) external view returns (address);

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

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

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

    function expiryDuration() external view returns (uint);

    function isWhitelistedAddress(address _address) external view returns (bool);

    function getOddsObtainer() external view returns (address obtainer);

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

    function createMarket(
        bytes32 gameId,
        string memory gameLabel,
        uint maturity,
        uint initialMint, // initial sUSD to mint options for,
        uint positionCount,
        uint[] memory tags,
        bool isChild,
        address parentMarket
    ) external returns (ISportPositionalMarket);

    function setMarketPaused(address _market, bool _paused) external;

    function updateDatesForMarket(address _market, uint256 _newStartTime) external;

    function resolveMarket(address market, uint outcome) external;

    function expireMarkets(address[] calldata market) external;

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

    function queryMintsAndMaturityStatusForPlayerProps(address[] memory _playerPropsMarkets)
        external
        view
        returns (
            bool[] memory _hasAnyMintsArray,
            bool[] memory _isMaturedArray,
            bool[] memory _isResolvedArray
        );
}

File 7 of 13 : 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 8 of 13 : 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 9 of 13 : 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 13 : 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 11 of 13 : 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 12 of 13 : 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 13 of 13 : 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":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_market","type":"address"},{"indexed":false,"internalType":"uint256","name":"_cap","type":"uint256"}],"name":"SetCapPerMarket","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_sport","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_cap","type":"uint256"}],"name":"SetCapPerSport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_sport","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_child","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_cap","type":"uint256"}],"name":"SetCapPerSportAndChild","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_cap","type":"uint256"}],"name":"SetDefaultCapPerGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_riskMultiplier","type":"uint256"}],"name":"SetDefaultRiskMultiplier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_maxRisk","type":"uint256"}],"name":"SetMaxCapAndRisk","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_playerPropsOptionTag","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_flag","type":"bool"}],"name":"SetPlayerPropsOnePositional","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_market","type":"address"},{"indexed":false,"internalType":"uint256","name":"_riskMultiplier","type":"uint256"}],"name":"SetRiskMultiplierPerMarket","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_sport","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_riskMultiplier","type":"uint256"}],"name":"SetRiskMultiplierPerSport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_sport","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_flag","type":"bool"}],"name":"SetSportOnePositional","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_manager","type":"address"}],"name":"SetSportsPositionalMarketManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MIN_CHILD_NUMBER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_PLAYER_PROPS_NUMBER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_TAG_NUMBER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"}],"name":"calculateCapToBeUsed","outputs":[{"internalType":"uint256","name":"toReturn","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"capPerMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"capPerSport","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"capPerSportAndChild","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultCapPerGame","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultRiskMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initNonReentrant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_manager","type":"address"},{"internalType":"uint256","name":"_defaultCapPerGame","type":"uint256"},{"internalType":"uint256[]","name":"_sportIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_capsPerSport","type":"uint256[]"},{"internalType":"uint256[]","name":"_sportIdsForChilds","type":"uint256[]"},{"internalType":"uint256[]","name":"_childsIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_capsForChilds","type":"uint256[]"},{"internalType":"uint256","name":"_defaultRiskMultiplier","type":"uint256"},{"internalType":"uint256[]","name":"_sportIdsForMultiplier","type":"uint256[]"},{"internalType":"uint256[]","name":"_riskMultiplierPerSport","type":"uint256[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isMarketForPlayerPropsOnePositional","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isMarketForSportOnePositional","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalSpent","type":"uint256"},{"internalType":"address","name":"_market","type":"address"}],"name":"isTotalSpendingLessThanTotalRisk","outputs":[{"internalType":"bool","name":"_isNotRisky","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRiskMultiplier","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"riskMultiplierForSport","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"riskMultiplierPerMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_markets","type":"address[]"},{"internalType":"uint256","name":"_capPerMarket","type":"uint256"}],"name":"setCapPerMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sportID","type":"uint256"},{"internalType":"uint256","name":"_capPerSport","type":"uint256"}],"name":"setCapPerSport","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sportID","type":"uint256"},{"internalType":"uint256","name":"_childID","type":"uint256"},{"internalType":"uint256","name":"_capPerChild","type":"uint256"}],"name":"setCapPerSportAndChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_capPerGame","type":"uint256"}],"name":"setDefaultCapPerGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_riskMultiplier","type":"uint256"}],"name":"setDefaultRiskMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxCap","type":"uint256"},{"internalType":"uint256","name":"_maxRisk","type":"uint256"}],"name":"setMaxCapAndRisk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_playerPropsOptionTag","type":"uint256"},{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setPlayerPropsOnePositional","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_markets","type":"address[]"},{"internalType":"uint256","name":"_riskMultiplier","type":"uint256"}],"name":"setRiskMultiplierMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sportID","type":"uint256"},{"internalType":"uint256","name":"_riskMultiplier","type":"uint256"}],"name":"setRiskMultiplierPerSport","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sportID","type":"uint256"},{"internalType":"bool","name":"_flag","type":"bool"}],"name":"setSportOnePositional","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"setSportsPositionalMarketManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50611ecf806100206000396000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c80635c975abb116101305780639bfa23dc116100b8578063ebc797721161007c578063ebc79772146104cd578063ecc71685146104d5578063f2c69934146104f5578063f88b757114610515578063f9f211ae1461052857600080fd5b80639bfa23dc1461046a578063aa0f0bb014610473578063b4cb26de1461047c578063ba0ed4ed146104a7578063c3b83f5f146104ba57600080fd5b8063771927d8116100ff578063771927d81461040057806379ba509714610413578063857bfa681461041b5780638da5cb5b1461042e5780638dfd117e1461044757600080fd5b80635c975abb146103b95780635d6a738c146103c4578063691824dd146103e45780636ff5f440146103ed57600080fd5b8063429386c4116101b35780634b28fb05116101825780634b28fb05146103645780634c7976c9146103775780634dfbc89c1461038a5780634f2cc14a1461039357806353a47bb7146103a657600080fd5b8063429386c41461030557806343b8a12d1461030e578063481c6a751461032157806348ad44f81461035157600080fd5b80631afed5cc116101fa5780631afed5cc1461029a57806323548b8b146102a3578063275b6ac6146102ac57806338347e12146102df5780633c30ac76146102f257600080fd5b80630c49d79b1461022c57806313af4035146102415780631627540c146102545780631a930f7614610267575b600080fd5b61023f61023a366004611cb8565b61053b565b005b61023f61024f3660046119fc565b6105df565b61023f6102623660046119fc565b61071a565b6102876102753660046119fc565b606b6020526000908152604090205481565b6040519081526020015b60405180910390f35b61028761232881565b610287606f5481565b6102cf6102ba366004611c2e565b60726020526000908152604090205460ff1681565b6040519015158152602001610291565b61023f6102ed366004611cd9565b610770565b61023f610300366004611b72565b610890565b61028760685481565b61023f61031c366004611c2e565b610aca565b6067546103399061010090046001600160a01b031681565b6040516001600160a01b039091168152602001610291565b61023f61035f366004611c2e565b610b29565b61023f610372366004611a1d565b610b88565b61023f610385366004611b72565b610e51565b61028760705481565b6102876103a13660046119fc565b611086565b600154610339906001600160a01b031681565b60345460ff166102cf565b6102876103d2366004611c2e565b60696020526000908152604090205481565b610287612af881565b61023f6103fb366004611cb8565b611097565b61023f61040e366004611cb8565b61112a565b61023f6111c0565b61023f610429366004611c89565b6112bd565b600054610339906201000090046001600160a01b031681565b6102cf610455366004611c2e565b60716020526000908152604090205460ff1681565b61028761271081565b610287606c5481565b61028761048a366004611cb8565b606a60209081526000928352604080842090915290825290205481565b6102cf6104b5366004611c5e565b6113bc565b61023f6104c83660046119fc565b6113ed565b61023f6114e4565b6102876104e33660046119fc565b606e6020526000908152604090205481565b610287610503366004611c2e565b606d6020526000908152604090205481565b61023f6105233660046119fc565b611542565b61023f610536366004611c89565b6115c6565b610543611695565b612328821161056d5760405162461bcd60e51b815260040161056490611d59565b60405180910390fd5b60705481111561058f5760405162461bcd60e51b815260040161056490611d04565b6000828152606d602090815260409182902083905581518481529081018390527fbc374ebda39a7586f4916c1911f82c2b045a44439acc485b4097428bf24ab9f991015b60405180910390a15050565b6001600160a01b0381166106355760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f742062652030000000000000006044820152606401610564565b600154600160a01b900460ff16156106a15760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610564565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610722611695565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229060200161070f565b610778611695565b600083815260696020526040812054610793576068546107a3565b6000848152606960205260409020545b9050808211156107c55760405162461bcd60e51b815260040161056490611d88565b61232884116107e65760405162461bcd60e51b815260040161056490611d59565b612710831161082f5760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a59081d1859c8199bdc8818da1a5b19605a1b6044820152606401610564565b6000848152606a6020908152604080832086845282529182902084905581518681529081018590529081018390527fc2b787ecc817a49494dd17cf35e456f8e9ee45d2d3841f15b8b27c9cf0e38c2e9060600160405180910390a150505050565b6000546201000090046001600160a01b03163314806109295750606754604051632fd702bb60e11b81523360048201526101009091046001600160a01b031690635fae05769060240160206040518083038186803b1580156108f157600080fd5b505afa158015610905573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109299190611c12565b6109665760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b2b73232b960911b6044820152606401610564565b606f548111156109885760405162461bcd60e51b815260040161056490611d88565b60005b8251811015610ac55760006001600160a01b03168382815181106109bf57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156109ee5760405162461bcd60e51b815260040161056490611d30565b81606b6000858481518110610a1357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f4af79f840a87acdf2b8b0488af1ede97e28e3d7a90e84a80606780b4a7bcaf25838281518110610a8057634e487b7160e01b600052603260045260246000fd5b602002602001015183604051610aab9291906001600160a01b03929092168252602082015260400190565b60405180910390a180610abd81611e41565b91505061098b565b505050565b610ad2611695565b607054811115610af45760405162461bcd60e51b815260040161056490611d04565b606c8190556040518181527fa62b41709b2bfcafa1ac4f8210b069163514fac8d10d5ab82425fc56dba772209060200161070f565b610b31611695565b606f54811115610b535760405162461bcd60e51b815260040161056490611d88565b60688190556040518181527f53b46e874b12d8436d1ddd17fad23fc2d1bf244839714ba05f4dc3a772094a429060200161070f565b600054610100900460ff16610ba35760005460ff1615610ba7565b303b155b610c0a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610564565b600054610100900460ff16158015610c2c576000805461ffff19166101011790555b610c358c6105df565b610c3d6114e4565b60688a9055606c84905560678054610100600160a81b0319166101006001600160a01b038e160217905560005b8951811015610cec57888181518110610c9357634e487b7160e01b600052603260045260246000fd5b6020026020010151606960008c8481518110610cbf57634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020819055508080610ce490611e41565b915050610c6a565b5060005b8751811015610daa57858181518110610d1957634e487b7160e01b600052603260045260246000fd5b6020026020010151606a60008a8481518110610d4557634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000206000898481518110610d7d57634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020819055508080610da290611e41565b915050610cf0565b5060005b8351811015610e3057828181518110610dd757634e487b7160e01b600052603260045260246000fd5b6020026020010151606d6000868481518110610e0357634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020819055508080610e2890611e41565b915050610dae565b508015610e43576000805461ff00191690555b505050505050505050505050565b6000546201000090046001600160a01b0316331480610eea5750606754604051632fd702bb60e11b81523360048201526101009091046001600160a01b031690635fae05769060240160206040518083038186803b158015610eb257600080fd5b505afa158015610ec6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eea9190611c12565b610f275760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b2b73232b960911b6044820152606401610564565b607054811115610f495760405162461bcd60e51b815260040161056490611d04565b60005b8251811015610ac55760006001600160a01b0316838281518110610f8057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415610faf5760405162461bcd60e51b815260040161056490611d30565b81606e6000858481518110610fd457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f0666fbd74a2734b7994bc0921440912f46e0e82eea322eefb5f637af35bafc8483828151811061104157634e487b7160e01b600052603260045260246000fd5b60200260200101518360405161106c9291906001600160a01b03929092168252602082015260400190565b60405180910390a18061107e81611e41565b915050610f4c565b60006110918261170f565b92915050565b61109f611695565b61232882116110c05760405162461bcd60e51b815260040161056490611d59565b606f548111156110e25760405162461bcd60e51b815260040161056490611d88565b60008281526069602090815260409182902083905581518481529081018390527fdd336d23e5a148c17f76389d3ac4d0ab595ec1bc30e226f1d6ee3cd7714dd6f891016105d3565b611132611695565b606854821180156111445750606c5481115b6111805760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610564565b606f829055607081905560408051838152602081018390527faee5893610936166f6b866698dc8074fa7278f39a43971179f1679565e40433191016105d3565b6001546001600160a01b031633146112385760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610564565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b6112c5611695565b612af882116113165760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642074616720666f7220706c617965722070726f7073000000006044820152606401610564565b60008281526072602052604090205460ff161515811515141561136a5760405162461bcd60e51b815260206004820152600c60248201526b496e76616c696420666c616760a01b6044820152606401610564565b600082815260726020908152604091829020805460ff19168415159081179091558251858152918201527f55f31caa03e942f489a3937429669e9560deae1f3641bb2b0bcb7f27046ac12391016105d3565b6000806113c88361170f565b905060006113d5846117a5565b90506113e18183611e22565b90941115949350505050565b6113f5611695565b6001600160a01b03811661141b5760405162461bcd60e51b815260040161056490611d30565b600154600160a81b900460ff161561146b5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610564565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910161070f565b60675460ff161561152d5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610564565b6067805460ff19166001908117909155606655565b61154a611695565b6001600160a01b0381166115705760405162461bcd60e51b815260040161056490611d30565b60678054610100600160a81b0319166101006001600160a01b038416908102919091179091556040519081527f1f728ba0a73bcdf17f9e0f260b7db049043dfa6b907980f715e30767d36bc7069060200161070f565b6115ce611695565b61232882116115ef5760405162461bcd60e51b815260040161056490611d59565b60008281526071602052604090205460ff16151581151514156116435760405162461bcd60e51b815260206004820152600c60248201526b496e76616c696420666c616760a01b6044820152606401610564565b600082815260716020908152604091829020805460ff19168415159081179091558251858152918201527fafe707b2c4a7c26188d0cf21a3e5a465a7a270670e11a2ca8cab34053a1cd3a291016105d3565b6000546201000090046001600160a01b0316331461170d5760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610564565b565b6001600160a01b0381166000908152606b6020526040902054806117a057600080611739846117f9565b60008281526069602052604090205491935091508061175a5760685461175c565b805b9350839050811561179c576000838152606a602090815260408083208584529091529020548061179657611791600283611e02565b611798565b805b9450505b5050505b919050565b6001600160a01b0381166000908152606e6020526040812054806110915760006117ce846117f9565b506000818152606d6020526040902054909150806117ee57606c546117f0565b805b95945050505050565b6040516308208aaf60e21b815260006004820181905290819083906001600160a01b038216906320822abc9060240160206040518083038186803b15801561184057600080fd5b505afa158015611854573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118789190611c46565b9250806001600160a01b03166311f2d4946040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b357600080fd5b505afa1580156118c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118eb9190611c12565b6118f657600061196e565b6040516308208aaf60e21b8152600160048201526001600160a01b038216906320822abc9060240160206040518083038186803b15801561193657600080fd5b505afa15801561194a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196e9190611c46565b915050915091565b80356001600160a01b03811681146117a057600080fd5b600082601f83011261199d578081fd5b813560206119b26119ad83611dde565b611dad565b80838252828201915082860187848660051b89010111156119d1578586fd5b855b858110156119ef578135845292840192908401906001016119d3565b5090979650505050505050565b600060208284031215611a0d578081fd5b611a1682611976565b9392505050565b60008060008060008060008060008060006101608c8e031215611a3e578687fd5b611a478c611976565b9a50611a5560208d01611976565b995060408c0135985067ffffffffffffffff8060608e01351115611a77578788fd5b611a878e60608f01358f0161198d565b98508060808e01351115611a99578788fd5b611aa98e60808f01358f0161198d565b97508060a08e01351115611abb578687fd5b611acb8e60a08f01358f0161198d565b96508060c08e01351115611add578586fd5b611aed8e60c08f01358f0161198d565b95508060e08e01351115611aff578485fd5b611b0f8e60e08f01358f0161198d565b94506101008d01359350806101208e01351115611b2a578283fd5b611b3b8e6101208f01358f0161198d565b9250806101408e01351115611b4e578182fd5b50611b608d6101408e01358e0161198d565b90509295989b509295989b9093969950565b60008060408385031215611b84578182fd5b823567ffffffffffffffff811115611b9a578283fd5b8301601f81018513611baa578283fd5b80356020611bba6119ad83611dde565b80838252828201915082850189848660051b8801011115611bd9578788fd5b8795505b84861015611c0257611bee81611976565b835260019590950194918301918301611bdd565b5098969091013596505050505050565b600060208284031215611c23578081fd5b8151611a1681611e88565b600060208284031215611c3f578081fd5b5035919050565b600060208284031215611c57578081fd5b5051919050565b60008060408385031215611c70578182fd5b82359150611c8060208401611976565b90509250929050565b60008060408385031215611c9b578182fd5b823591506020830135611cad81611e88565b809150509250929050565b60008060408385031215611cca578182fd5b50508035926020909101359150565b600080600060608486031215611ced578283fd5b505081359360208301359350604090920135919050565b60208082526012908201527124b73b30b634b21036bab63a34b83634b2b960711b604082015260600190565b6020808252600f908201526e496e76616c6964206164647265737360881b604082015260600190565b602080825260159082015274125b9d985b1a59081d1859c8199bdc881cdc1bdc9d605a1b604082015260600190565b6020808252600b908201526a0496e76616c6964206361760ac1b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff81118282101715611dd657611dd6611e72565b604052919050565b600067ffffffffffffffff821115611df857611df8611e72565b5060051b60200190565b600082611e1d57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e3c57611e3c611e5c565b500290565b6000600019821415611e5557611e55611e5c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611e9657600080fd5b5056fea26469706673582212203fc5410649f5e127cf80a1742cf6b5516db57ff51964d0330b9be005fffddb0064736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.