Contract Address Details

0x60013629870058aE0b2fD74bCeBace8a200FD380

Contract Name
ProxyOracle
Creator
0x4cdbdf–3d4270 at 0xa63066–654e35
Balance
0 CHZ ( )
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
23283857
Contract name:
ProxyOracle




Optimization enabled
true
Compiler version
v0.8.16+commit.07a7930e




Optimization runs
2
EVM Version
default




Verified at
2024-07-16T13:29:04.362454Z

contracts/extensions/ProxyOracle.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

import "../interface/IAccess.sol";
import "../interface/ILP.sol";
import "../interface/IPrematchCore.sol";
import "../interface/IProxyOracle.sol";
import "../utils/OwnableUpgradeable.sol";

/**
 * @notice Operation of oracles management tool.
 */
contract ProxyOracle is OwnableUpgradeable, IProxyOracle {
    IAccess public access;
    ILP public lp;
    uint128 reinforcementLimit;

    /**
     * @notice Throw if caller have no access to function with selector `selector`.
     */
    modifier restricted(bytes4 selector) {
        access.checkAccess(msg.sender, address(this), selector);
        _;
    }

    function initialize(
        address access_,
        address lp_
    ) external virtual initializer {
        __Ownable_init();
        access = IAccess(access_);
        lp = ILP(lp_);
        reinforcementLimit = type(uint128).max;
    }

    /**
     * @notice Owner: Change maximum condition reinforcement limit to `reinforcementLimit_`.
     */
    function changeReinforcementLimit(
        uint128 reinforcementLimit_
    ) external onlyOwner {
        reinforcementLimit = reinforcementLimit_;
        emit ReinforcementLimitChanged(reinforcementLimit_);
    }

    /**
     * @notice The batch version of {ILP-createGame}.
     * @param  data an array of input data structures for creating games using {ILP-createGame}
     */
    function createGames(
        CreateGameData[] calldata data
    ) external restricted(this.createGames.selector) {
        for (uint256 i = 0; i < data.length; ++i) {
            lp.createGame(data[i].gameId, data[i].startsAt, data[i].data);
        }
    }

    /**
     * @notice The batch version of {ILP-cancelGame}.
     * @param  gameIds IDs of the games to be canceled
     */
    function cancelGames(
        uint256[] calldata gameIds
    ) external restricted(this.cancelGames.selector) {
        for (uint256 i = 0; i < gameIds.length; ++i) {
            lp.cancelGame(gameIds[i]);
        }
    }

    /**
     * @notice The batch version of {ILP-shiftGame}.
     * @param  data an array of input data structures for changing games start using {ILP-shiftGame}
     */
    function shiftGames(
        ShiftGameData[] calldata data
    ) external restricted(this.shiftGames.selector) {
        for (uint256 i = 0; i < data.length; ++i) {
            lp.shiftGame(data[i].gameId, data[i].startsAt);
        }
    }

    /**
     * @notice The batch version of {IPrematchCore-changeMargin}.
     * @param  core the address of the Core using for creating conditions
     * @param  data an array of input data structures for changing conditions margin using {IPrematchCore-changeMargin}
     */
    function changeMargins(
        address core,
        changeMarginData[] calldata data
    ) external restricted(this.changeMargins.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        for (uint256 i = 0; i < data.length; ++i)
            core_.changeMargin(data[i].conditionId, data[i].margin);
    }

    /**
     * @notice The batch version of {IPrematchCore-changeReinforcement}.
     * @param  core the address of the Core using for creating conditions
     * @param  data an array of input data structures for changing conditions reinforcement using {IPrematchCore-changeReinforcement}
     */
    function changeReinforcements(
        address core,
        changeReinforcementData[] calldata data
    ) external restricted(this.changeReinforcements.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        uint256 reinforcementLimit_ = reinforcementLimit;
        uint128 reinforcement;
        for (uint256 i = 0; i < data.length; ++i) {
            reinforcement = data[i].reinforcement;
            if (reinforcement > reinforcementLimit_)
                revert TooLargeReinforcement();
            core_.changeReinforcement(data[i].conditionId, reinforcement);
        }
    }

    /**
     * @notice Call `changeMargins` and `changeReinforcements` in the same time.
     * @param  core the address of the Core using for creating conditions
     * @param  data an array of input data structures for changing conditions settings
     */
    function changeConditionSettings(
        address core,
        ChangeConditionSettingsData[] calldata data
    ) external restricted(this.changeReinforcements.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        uint256 reinforcementLimit_ = reinforcementLimit;
        for (uint256 i = 0; i < data.length; ++i) {
            uint64 newMargin = data[i].margin;
            uint128 newReinforcement = data[i].reinforcement;
            uint256 conditionId = data[i].conditionId;
            (uint128 reinforcement, uint64 margin) = core_.getConditionSettings(
                conditionId
            );
            if (newReinforcement == reinforcement && newMargin == margin)
                revert NothingChanged();

            if (newReinforcement != reinforcement) {
                if (reinforcement > reinforcementLimit_)
                    revert TooLargeReinforcement();

                core_.changeReinforcement(conditionId, newReinforcement);
            }
            if (newMargin != margin) core_.changeMargin(conditionId, newMargin);
        }
    }

    /**
     * @notice The batch version of {IPrematchCore-createCondition}.
     * @param  core the address of the Core using for creating conditions
     * @param  data an array of input data structures for creating conditions using {IPrematchCore-createCondition}
     */
    function createConditions(
        address core,
        CreateConditionData[] calldata data
    ) external restricted(this.createConditions.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        uint256 reinforcementLimit_ = reinforcementLimit;
        for (uint256 i = 0; i < data.length; ++i) {
            CreateConditionData memory data_ = data[i];

            uint128 reinforcement = data_.reinforcement;
            if (reinforcement > reinforcementLimit_)
                revert TooLargeReinforcement();

            core_.createCondition(
                data_.gameId,
                data_.conditionId,
                data_.odds,
                data_.outcomes,
                reinforcement,
                data_.margin,
                data_.winningOutcomesCount,
                data_.isExpressForbidden,
                data_.data
            );
        }
    }

    /**
     * @notice The batch version of {IPrematchCore-cancelCondition}.
     * @param  core the address of the Core using for canceling conditions
     * @param  conditionIds IDs of the conditions to be canceled
     */
    function cancelConditions(
        address core,
        uint256[] calldata conditionIds
    ) external restricted(this.cancelConditions.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        for (uint256 i = 0; i < conditionIds.length; ++i) {
            core_.cancelCondition(conditionIds[i]);
        }
    }

    /**
     * @notice The batch version of {IPrematchCore-changeOdds}.
     * @param  core the address of the Core using for changing odds
     * @param  data an array of input data structures for changing odds using {IPrematchCore-changeOdds}.
     */
    function changeOdds(
        address core,
        ChangeOddsData[] calldata data
    ) external restricted(this.changeOdds.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        for (uint256 i = 0; i < data.length; ++i) {
            core_.changeOdds(data[i].conditionId, data[i].odds);
        }
    }

    /**
     * @notice The batch version of {IPrematchCore-resolveConditions}.
     * @param  core the address of the Core using for resolving conditions
     * @param  data an array of input data structures for resolving conditions using {IPrematchCore-resolveConditions}.
     */
    function resolveConditions(
        address core,
        ResolveConditionData[] calldata data
    ) external restricted(this.resolveConditions.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        for (uint256 i = 0; i < data.length; ++i) {
            core_.resolveCondition(
                data[i].conditionId,
                data[i].winningOutcomes
            );
        }
    }

    /**
     * @notice The batch version of {IPrematchCore-stopConditions}.
     * @param  core the address of the Core using for stopping conditions
     * @param  data an array of input data structures for stopping conditions using {IPrematchCore-stopConditions}.
     */
    function stopConditions(
        address core,
        StopConditionData[] calldata data
    ) external restricted(this.stopConditions.selector) {
        IPrematchCore core_ = IPrematchCore(core);
        for (uint256 i = 0; i < data.length; ++i) {
            core_.stopCondition(data[i].conditionId, data[i].flag);
        }
    }
}
        

contracts/interface/IBet.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

interface IBet {
    struct BetData {
        address affiliate; // address indicated as an affiliate when placing bet
        uint64 minOdds;
        bytes data; // core-specific customized bet data
    }

    error BetNotExists();
    error SmallOdds();

    /**
     * @notice Register new bet.
     * @param  bettor wallet for emitting bet token
     * @param  amount amount of tokens to bet
     * @param  betData customized bet data
     */
    function putBet(
        address bettor,
        uint128 amount,
        BetData calldata betData
    ) external returns (uint256 tokenId);

    function resolvePayout(
        uint256 tokenId
    ) external returns (address account, uint128 payout);

    function viewPayout(uint256 tokenId) external view returns (uint128 payout);
}
          

contracts/interface/ICondition.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

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

    struct Condition {
        uint256 gameId;
        uint128[] payouts;
        uint128[] virtualFunds;
        uint128 totalNetBets;
        uint128 reinforcement;
        uint128 fund;
        uint64 margin;
        uint64 endsAt;
        uint48 lastDepositId;
        uint8 winningOutcomesCount;
        ConditionState state;
        address oracle;
        bool isExpressForbidden;
    }
}
          

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

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

pragma solidity ^0.8.2;

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

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

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

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}
          

@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
          

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol

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

pragma solidity ^0.8.0;

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

contracts/interface/IAccess.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

import "./IOwnable.sol";

interface IAccess is IOwnable {
    struct RoleData {
        address target; // target contract address
        bytes4 selector; // target function selector
        uint8 roleId; // ID of the role associated with contract-function combination
    }

    event RoleAdded(bytes32 indexed role, uint256 indexed roleId);
    event RoleRenamed(bytes32 indexed role, uint8 indexed roleId);
    event RoleBound(bytes32 indexed funcId, uint8 indexed roleId);
    event RoleUnbound(bytes32 indexed funcId, uint8 indexed roleId);
    event RoleGranted(address indexed user, uint8 indexed roleId);
    event RoleRevoked(address indexed user, uint8 indexed roleId);

    error NotTokenOwner();
    error MaxRolesReached();
    error AccessNotGranted();
    error RoleAlreadyGranted();

    function initialize() external;

    function checkAccess(
        address sender,
        address _contract,
        bytes4 selector
    ) external;
}
          

contracts/interface/IAzuroBet.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

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

interface IAzuroBet is IOwnable, IERC721EnumerableUpgradeable {
    function initialize(address core) external;

    function burn(uint256 id) external;

    function mint(address account) external returns (uint256);

    error OnlyCore();
}
          

contracts/interface/ICoreBase.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

import "./IBet.sol";
import "./ICondition.sol";
import "./ILP.sol";
import "./IOwnable.sol";
import "./IAzuroBet.sol";

interface ICoreBase is ICondition, IOwnable, IBet {
    struct Bet {
        uint256 conditionId;
        uint128 amount;
        uint128 payout;
        uint64 outcome;
        uint64 timestamp;
        bool isPaid;
    }

    struct CoreBetData {
        uint256 conditionId; // The match or game ID
        uint64 outcomeId; // ID of predicted outcome
    }

    event ConditionCreated(
        uint256 indexed gameId,
        uint256 indexed conditionId,
        uint64[] outcomes
    );
    event ConditionResolved(
        uint256 indexed conditionId,
        uint8 state,
        uint64[] winningOutcomes,
        int128 lpProfit
    );
    event ConditionStopped(uint256 indexed conditionId, bool flag);
    event CreatedConditionMetadata(uint256 indexed conditionId, bytes data);

    event ReinforcementChanged(
        uint256 indexed conditionId,
        uint128 newReinforcement
    );
    event MarginChanged(uint256 indexed conditionId, uint64 newMargin);
    event OddsChanged(uint256 indexed conditionId, uint256[] newOdds);

    error OnlyLp();

    error AlreadyPaid();
    error DuplicateOutcomes(uint64 outcome);
    error IncorrectConditionId();
    error IncorrectMargin();
    error IncorrectReinforcement();
    error NothingChanged();
    error IncorrectTimestamp();
    error IncorrectWinningOutcomesCount();
    error IncorrectOutcomesCount();
    error NoPendingReward();
    error OnlyOracle(address);
    error OutcomesAndOddsCountDiffer();
    error StartOutOfRange(uint256 pendingRewardsCount);
    error WrongOutcome();
    error ZeroOdds();

    error CantChangeFlag();
    error ConditionAlreadyCreated();
    error ConditionAlreadyResolved();
    error ConditionNotFinished();
    error ConditionNotExists();
    error ConditionNotRunning();
    error GameAlreadyStarted();
    error InsufficientFund();
    error ResolveTooEarly(uint64 waitTime);

    function lp() external view returns (ILP);

    function azuroBet() external view returns (IAzuroBet);

    function initialize(address azuroBet, address lp) external;

    function calcOdds(
        uint256 conditionId,
        uint128 amount,
        uint64 outcome
    ) external view returns (uint64 odds);

    /**
     * @notice Change the current condition `conditionId` margin.
     */
    function changeMargin(uint256 conditionId, uint64 newMargin) external;

    /**
     * @notice Change the current condition `conditionId` odds.
     */
    function changeOdds(
        uint256 conditionId,
        uint256[] calldata newOdds
    ) external;

    /**
     * @notice Change the current condition `conditionId` reinforcement.
     */
    function changeReinforcement(
        uint256 conditionId,
        uint128 newReinforcement
    ) external;

    function getCondition(
        uint256 conditionId
    ) external view returns (Condition memory);

    /**
     * @notice Get condition's reinforcement and margin by it's ID.
     * @param  conditionId the match or condition ID
     * @return the condition struct
     */
    function getConditionSettings(
        uint256 conditionId
    ) external view returns (uint128, uint64);

    /**
     * @notice Indicate the condition `conditionId` as canceled.
     * @notice The condition creator can always cancel it regardless of granted access tokens.
     */
    function cancelCondition(uint256 conditionId) external;

    /**
     * @notice Indicate the status of condition `conditionId` bet lock.
     * @param  conditionId the match or condition ID
     * @param  flag if stop receiving bets for the condition or not
     */
    function stopCondition(uint256 conditionId, bool flag) external;

    /**
     * @notice Register new condition.
     * @param  gameId the game ID the condition belongs
     * @param  conditionId the match or condition ID according to oracle's internal numbering
     * @param  odds start odds for [team 1, ..., team N]
     * @param  outcomes unique outcomes for the condition [outcome 1, ..., outcome N]
     * @param  reinforcement maximum amount of liquidity intended to condition reinforcement
     * @param  margin bookmaker commission
     * @param  winningOutcomesCount the number of winning outcomes of the Condition
     * @param  isExpressForbidden true - not allowed to use in express bets
     * @param  data the additional data to emit in the `CreatedConditionMetadata` event
     */
    function createCondition(
        uint256 gameId,
        uint256 conditionId,
        uint256[] calldata odds,
        uint64[] calldata outcomes,
        uint128 reinforcement,
        uint64 margin,
        uint8 winningOutcomesCount,
        bool isExpressForbidden,
        bytes calldata data
    ) external;

    function getOutcomeIndex(
        uint256 conditionId,
        uint64 outcome
    ) external view returns (uint256);

    function isOutcomeWinning(
        uint256 conditionId,
        uint64 outcome
    ) external view returns (bool);

    function isConditionCanceled(
        uint256 conditionId
    ) external view returns (bool);
}
          

contracts/interface/ILP.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

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

interface ILP is IOwnable, IERC721EnumerableUpgradeable {
    enum FeeType {
        DAO,
        DATA_PROVIDER,
        AFFILIATES
    }

    enum CoreState {
        UNKNOWN,
        ACTIVE,
        INACTIVE
    }

    struct Condition {
        address core;
        uint256 conditionId;
    }

    struct CoreData {
        CoreState state;
        uint64 reinforcementAbility;
        uint128 minBet;
        uint128 lockedLiquidity;
    }

    struct Game {
        bytes32 unusedVariable;
        uint128 lockedLiquidity;
        uint64 startsAt;
        bool canceled;
    }

    struct Reward {
        int128 amount;
        uint64 claimedAt;
    }

    event CoreSettingsUpdated(
        address indexed core,
        CoreState state,
        uint64 reinforcementAbility,
        uint128 minBet
    );

    event AffiliateChanged(address newAffilaite);
    event BettorWin(
        address indexed core,
        address indexed bettor,
        uint256 tokenId,
        uint256 amount
    );
    event ClaimTimeoutChanged(uint64 newClaimTimeout);
    event DataProviderChanged(address newDataProvider);
    event FeeChanged(FeeType feeType, uint64 fee);
    event GameCanceled(uint256 indexed gameId);
    event GameShifted(uint256 indexed gameId, uint64 newStart);
    event LiquidityAdded(
        address indexed account,
        uint48 indexed depositId,
        uint256 amount
    );
    event LiquidityDonated(
        address indexed account,
        uint48 indexed depositId,
        uint256 amount
    );
    event LiquidityManagerChanged(address newLiquidityManager);
    event LiquidityRemoved(
        address indexed account,
        uint48 indexed depositId,
        uint256 amount
    );
    event MinBetChanged(address core, uint128 newMinBet);
    event MinDepoChanged(uint128 newMinDepo);
    event NewGame(uint256 indexed gameId, uint64 startsAt, bytes data);
    event ReinforcementAbilityChanged(uint128 newReinforcementAbility);
    event WithdrawTimeoutChanged(uint64 newWithdrawTimeout);

    error OnlyFactory();

    error SmallDepo();
    error SmallDonation();

    error BetExpired();
    error CoreNotActive();
    error ClaimTimeout(uint64 waitTime);
    error DepositDoesNotExist();
    error GameAlreadyCanceled();
    error GameAlreadyCreated();
    error GameCanceled_();
    error GameNotExists();
    error IncorrectCoreState();
    error IncorrectFee();
    error IncorrectGameId();
    error IncorrectMinBet();
    error IncorrectMinDepo();
    error IncorrectReinforcementAbility();
    error IncorrectTimestamp();
    error LiquidityNotOwned();
    error LiquidityIsLocked();
    error NoLiquidity();
    error NotEnoughLiquidity();
    error SmallBet();
    error UnknownCore();
    error WithdrawalTimeout(uint64 waitTime);

    function initialize(
        address access,
        address dataProvider,
        address affiliate,
        address token,
        uint128 minDepo,
        uint64 daoFee,
        uint64 dataProviderFee,
        uint64 affiliateFee
    ) external;

    function addCore(address core) external;

    function addLiquidity(
        uint128 amount,
        bytes calldata data
    ) external returns (uint48);

    function withdrawLiquidity(
        uint48 depositId,
        uint40 percent
    ) external returns (uint128);

    function viewPayout(
        address core,
        uint256 tokenId
    ) external view returns (uint128 payout);

    function betFor(
        address bettor,
        address core,
        uint128 amount,
        uint64 expiresAt,
        IBet.BetData calldata betData
    ) external returns (uint256 tokenId);

    /**
     * @notice Make new bet.
     * @notice Emits bet token to `msg.sender`.
     * @param  core address of the Core the bet is intended
     * @param  amount amount of tokens to bet
     * @param  expiresAt the time before which bet should be made
     * @param  betData customized bet data
     */
    function bet(
        address core,
        uint128 amount,
        uint64 expiresAt,
        IBet.BetData calldata betData
    ) external returns (uint256 tokenId);

    function changeDataProvider(address newDataProvider) external;

    function claimReward() external returns (uint128);

    function getReserve() external view returns (uint128);

    function addReserve(
        uint256 gameId,
        uint128 lockedReserve,
        uint128 profitReserve,
        uint48 depositId
    ) external;

    function addCondition(uint256 gameId) external view returns (uint64);

    function withdrawPayout(
        address core,
        uint256 tokenId
    ) external returns (uint128);

    function changeLockedLiquidity(
        uint256 gameId,
        int128 deltaReserve
    ) external;

    /**
     * @notice Indicate the game `gameId` as canceled.
     * @param  gameId the game ID
     */
    function cancelGame(uint256 gameId) external;

    /**
     * @notice Create new game.
     * @param  gameId the match or condition ID according to oracle's internal numbering
     * @param  startsAt timestamp when the game starts
     * @param  data the additional data to emit in the `NewGame` event
     */
    function createGame(
        uint256 gameId,
        uint64 startsAt,
        bytes calldata data
    ) external;

    /**
     * @notice Set `startsAt` as new game `gameId` start time.
     * @param  gameId the game ID
     * @param  startsAt new timestamp when the game starts
     */
    function shiftGame(uint256 gameId, uint64 startsAt) external;

    function getGameInfo(
        uint256 gameId
    ) external view returns (uint64 startsAt, bool canceled);

    function getLockedLiquidityLimit(
        address core
    ) external view returns (uint128);

    function isGameCanceled(
        uint256 gameId
    ) external view returns (bool canceled);

    function checkAccess(
        address account,
        address target,
        bytes4 selector
    ) external;

    function checkCore(address core) external view;

    function getLastDepositId() external view returns (uint48 depositId);

    function isDepositExists(uint256 depositId) external view returns (bool);

    function token() external view returns (address);

    function fees(uint256) external view returns (uint64);
}
          

contracts/interface/IOwnable.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

interface IOwnable {
    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    function owner() external view returns (address);

    function checkOwner(address account) external view;

    function transferOwnership(address newOwner) external;
}
          

contracts/interface/IPrematchCore.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

import "./ICoreBase.sol";

interface IPrematchCore is ICoreBase {
    event NewBet(
        address indexed bettor,
        address indexed affiliate,
        uint256 indexed conditionId,
        uint256 tokenId,
        uint64 outcomeId,
        uint128 amount,
        uint256 odds,
        uint128[] funds
    );

    event NewBetMargin(uint256 indexed betId, uint256 margin);

    /**
     * @notice Indicate outcomes `winningOutcomes` as happened in condition `conditionId`.
     * @notice See {CoreBase-_resolveCondition}.
     */
    function resolveCondition(
        uint256 conditionId,
        uint64[] calldata winningOutcomes
    ) external;
}
          

contracts/interface/IProxyOracle.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

interface IProxyOracle {
    struct ChangeOddsData {
        uint256 conditionId;
        uint256[] odds;
    }

    struct CreateConditionData {
        uint256 gameId;
        uint256 conditionId;
        uint256[] odds;
        uint64[] outcomes;
        uint128 reinforcement;
        uint64 margin;
        uint8 winningOutcomesCount;
        bool isExpressForbidden;
        bytes data;
    }

    struct CreateGameData {
        uint256 gameId;
        uint64 startsAt;
        bytes data;
    }

    struct ResolveConditionData {
        uint256 conditionId;
        uint64[] winningOutcomes;
    }

    struct ShiftGameData {
        uint256 gameId;
        uint64 startsAt;
    }

    struct StopConditionData {
        uint256 conditionId;
        bool flag;
    }

    struct ChangeConditionSettingsData {
        uint256 conditionId;
        uint64 margin;
        uint128 reinforcement;
    }

    struct changeMarginData {
        uint256 conditionId;
        uint64 margin;
    }

    struct changeReinforcementData {
        uint256 conditionId;
        uint128 reinforcement;
    }

    event ReinforcementLimitChanged(uint256);

    error NothingChanged();
    error TooLargeReinforcement();
}
          

contracts/utils/OwnableUpgradeable.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.9;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "../interface/IOwnable.sol";

/**
 * @dev Forked from OpenZeppelin contract:
 * https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/ae03ee04ae226526abad6731cf4024134f46ae28/contracts/access/OwnableUpgradeable.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
    IOwnable,
    Initializable,
    ContextUpgradeable
{
    address private _owner;

    /**
     * @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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        checkOwner(_msgSender());
        _;
    }

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

    /**
     * @dev Throws if the account is not the owner.
     */
    function checkOwner(address account) public view virtual override {
        require(owner() == account, "Ownable: account is not the owner");
    }

    /**
     * @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 override onlyOwner {
        require(
            newOwner != address(0),
            "Ownable: new owner is the zero address"
        );
        _transferOwnership(newOwner);
    }

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

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

Contract ABI

[{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IAccess"}],"name":"access","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelConditions","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"uint256[]","name":"conditionIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelGames","inputs":[{"type":"uint256[]","name":"gameIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeConditionSettings","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.ChangeConditionSettingsData[]","components":[{"type":"uint256"},{"type":"uint64"},{"type":"uint128"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeMargins","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.changeMarginData[]","components":[{"type":"uint256"},{"type":"uint64"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeOdds","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.ChangeOddsData[]","components":[{"type":"uint256"},{"type":"uint256[]"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeReinforcementLimit","inputs":[{"type":"uint128","name":"reinforcementLimit_","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeReinforcements","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.changeReinforcementData[]","components":[{"type":"uint256"},{"type":"uint128"}]}]},{"type":"function","stateMutability":"view","outputs":[],"name":"checkOwner","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createConditions","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.CreateConditionData[]","components":[{"type":"uint256"},{"type":"uint256"},{"type":"uint256[]"},{"type":"uint64[]"},{"type":"uint128"},{"type":"uint64"},{"type":"uint8"},{"type":"bool"},{"type":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createGames","inputs":[{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.CreateGameData[]","components":[{"type":"uint256"},{"type":"uint64"},{"type":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"access_","internalType":"address"},{"type":"address","name":"lp_","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ILP"}],"name":"lp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"resolveConditions","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.ResolveConditionData[]","components":[{"type":"uint256"},{"type":"uint64[]"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"shiftGames","inputs":[{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.ShiftGameData[]","components":[{"type":"uint256"},{"type":"uint64"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stopConditions","inputs":[{"type":"address","name":"core","internalType":"address"},{"type":"tuple[]","name":"data","internalType":"struct IProxyOracle.StopConditionData[]","components":[{"type":"uint256"},{"type":"bool"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false},{"type":"event","name":"ReinforcementLimitChanged","inputs":[{"type":"uint256","name":"","indexed":false}],"anonymous":false},{"type":"error","name":"NothingChanged","inputs":[]},{"type":"error","name":"TooLargeReinforcement","inputs":[]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100e65760003560e01c8063084247b0146100eb5780632740cc5914610100578063313c06a014610113578063485cc95514610142578063711dcfd71461015557806371907f17146101685780637cfccc251461017b578063829b96821461018e5780638da5cb5b146101a157806391e65804146101a9578063954093c4146101bc578063a7d2cc49146101cf578063be918c6b146101e2578063d58cf784146101f5578063d9d0f33814610208578063e0e3671c1461021b578063f2fde38b1461022e578063f3897bfd14610241575b600080fd5b6100fe6100f9366004611600565b610254565b005b6100fe61010e366004611672565b6103e6565b606654610126906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100fe610150366004611696565b610443565b6100fe6101633660046116c9565b6105a4565b606554610126906001600160a01b031681565b6100fe610189366004611792565b6108a0565b6100fe61019c366004611600565b610a14565b610126610b20565b6100fe6101b7366004611600565b610b2f565b6100fe6101ca3660046117d7565b610c71565b6100fe6101dd366004611792565b610da6565b6100fe6101f0366004611792565b610edf565b6100fe610203366004611818565b61100f565b6100fe610216366004611600565b611186565b6100fe61022936600461184d565b6112c8565b6100fe61023c36600461184d565b61133d565b6100fe61024f366004611818565b6113b4565b606554604051636396eb8d60e01b81526284247b60e41b916001600160a01b031690636396eb8d9061028e90339030908690600401611868565b600060405180830381600087803b1580156102a857600080fd5b505af11580156102bc573d6000803e3d6000fd5b50506067548692506001600160801b0316905060005b848110156103dd5760008686838181106102ee576102ee611895565b905060200281019061030091906118ab565b61030990611add565b60808101519091506001600160801b03811684101561033b57604051635b51779f60e01b815260040160405180910390fd5b846001600160a01b031663ffc2c4fa8360000151846020015185604001518660600151868860a001518960c001518a60e001518b61010001516040518a63ffffffff1660e01b815260040161039899989796959493929190611c56565b600060405180830381600087803b1580156103b257600080fd5b505af11580156103c6573d6000803e3d6000fd5b505050505050806103d690611d09565b90506102d2565b50505050505050565b6103ef336112c8565b606780546001600160801b0319166001600160801b0383169081179091556040519081527f26143f330f98a1993f26b8f24e28a62a6a161c6d35b8b2deaa33882390e057949060200160405180910390a150565b600054610100900460ff16158080156104635750600054600160ff909116105b8061047d5750303b15801561047d575060005460ff166001145b6104e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610508576000805461ff0019166101001790555b6105106114b7565b606580546001600160a01b038086166001600160a01b0319928316179092556066805492851692909116919091179055606780546001600160801b0319166001600160801b03179055801561059f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b606554604051636396eb8d60e01b8152637cfccc2560e01b916001600160a01b031690636396eb8d906105df90339030908690600401611868565b600060405180830381600087803b1580156105f957600080fd5b505af115801561060d573d6000803e3d6000fd5b50506067548692506001600160801b0316905060005b848110156103dd57600086868381811061063f5761063f611895565b90506060020160200160208101906106579190611d30565b9050600087878481811061066d5761066d611895565b90506060020160400160208101906106859190611672565b9050600088888581811061069b5761069b611895565b905060600201600001359050600080876001600160a01b031663b527091a846040518263ffffffff1660e01b81526004016106d891815260200190565b6040805180830381865afa1580156106f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107189190611d4d565b91509150816001600160801b0316846001600160801b031614801561074e5750806001600160401b0316856001600160401b0316145b1561076c576040516306923abf60e01b815260040160405180910390fd5b816001600160801b0316846001600160801b0316146108105786826001600160801b031611156107af57604051635b51779f60e01b815260040160405180910390fd5b6040516333c9e2c360e21b81526001600160a01b0389169063cf278b0c906107dd9086908890600401611d87565b600060405180830381600087803b1580156107f757600080fd5b505af115801561080b573d6000803e3d6000fd5b505050505b806001600160401b0316856001600160401b03161461088a576040516356ee77bb60e01b81526001600160a01b038916906356ee77bb906108579086908990600401611d9e565b600060405180830381600087803b15801561087157600080fd5b505af1158015610885573d6000803e3d6000fd5b505050505b50505050508061089990611d09565b9050610623565b606554604051636396eb8d60e01b8152637cfccc2560e01b916001600160a01b031690636396eb8d906108db90339030908690600401611868565b600060405180830381600087803b1580156108f557600080fd5b505af1158015610909573d6000803e3d6000fd5b50506067548692506001600160801b031690506000805b85811015610a0a5786868281811061093a5761093a611895565b90506040020160200160208101906109529190611672565b915082826001600160801b0316111561097e57604051635b51779f60e01b815260040160405180910390fd5b836001600160a01b031663cf278b0c88888481811061099f5761099f611895565b90506040020160000135846040518363ffffffff1660e01b81526004016109c7929190611d87565b600060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b5050505080610a0390611d09565b9050610920565b5050505050505050565b606554604051636396eb8d60e01b815263414dcb4160e11b916001600160a01b031690636396eb8d90610a4f90339030908690600401611868565b600060405180830381600087803b158015610a6957600080fd5b505af1158015610a7d573d6000803e3d6000fd5b5086925060009150505b83811015610b1857816001600160a01b031663bc4925fc868684818110610ab057610ab0611895565b905060200201356040518263ffffffff1660e01b8152600401610ad591815260200190565b600060405180830381600087803b158015610aef57600080fd5b505af1158015610b03573d6000803e3d6000fd5b5050505080610b1190611d09565b9050610a87565b505050505050565b6033546001600160a01b031690565b606554604051636396eb8d60e01b8152632479960160e21b916001600160a01b031690636396eb8d90610b6a90339030908690600401611868565b600060405180830381600087803b158015610b8457600080fd5b505af1158015610b98573d6000803e3d6000fd5b5086925060009150505b83811015610b1857816001600160a01b03166390fb4d48868684818110610bcb57610bcb611895565b9050602002810190610bdd9190611db5565b35878785818110610bf057610bf0611895565b9050602002810190610c029190611db5565b610c10906020810190611dcb565b6040518463ffffffff1660e01b8152600401610c2e93929190611e14565b600060405180830381600087803b158015610c4857600080fd5b505af1158015610c5c573d6000803e3d6000fd5b5050505080610c6a90611d09565b9050610ba2565b606554604051636396eb8d60e01b815263255024f160e21b916001600160a01b031690636396eb8d90610cac90339030908690600401611868565b600060405180830381600087803b158015610cc657600080fd5b505af1158015610cda573d6000803e3d6000fd5b5050505060005b82811015610da0576066546001600160a01b031663a8822061858584818110610d0c57610d0c611895565b90506040020160000135868685818110610d2857610d28611895565b9050604002016020016020810190610d409190611d30565b6040518363ffffffff1660e01b8152600401610d5d929190611d9e565b600060405180830381600087803b158015610d7757600080fd5b505af1158015610d8b573d6000803e3d6000fd5b5050505080610d9990611d09565b9050610ce1565b50505050565b606554604051636396eb8d60e01b815263a7d2cc4960e01b916001600160a01b031690636396eb8d90610de190339030908690600401611868565b600060405180830381600087803b158015610dfb57600080fd5b505af1158015610e0f573d6000803e3d6000fd5b5086925060009150505b83811015610b1857816001600160a01b0316636fea02f0868684818110610e4257610e42611895565b90506040020160000135878785818110610e5e57610e5e611895565b9050604002016020016020810190610e769190611e55565b6040516001600160e01b031960e085901b168152600481019290925215156024820152604401600060405180830381600087803b158015610eb657600080fd5b505af1158015610eca573d6000803e3d6000fd5b5050505080610ed890611d09565b9050610e19565b606554604051636396eb8d60e01b815263be918c6b60e01b916001600160a01b031690636396eb8d90610f1a90339030908690600401611868565b600060405180830381600087803b158015610f3457600080fd5b505af1158015610f48573d6000803e3d6000fd5b5086925060009150505b83811015610b1857816001600160a01b03166356ee77bb868684818110610f7b57610f7b611895565b90506040020160000135878785818110610f9757610f97611895565b9050604002016020016020810190610faf9190611d30565b6040518363ffffffff1660e01b8152600401610fcc929190611d9e565b600060405180830381600087803b158015610fe657600080fd5b505af1158015610ffa573d6000803e3d6000fd5b505050508061100890611d09565b9050610f52565b606554604051636396eb8d60e01b81526335633de160e21b916001600160a01b031690636396eb8d9061104a90339030908690600401611868565b600060405180830381600087803b15801561106457600080fd5b505af1158015611078573d6000803e3d6000fd5b5050505060005b82811015610da0576066546001600160a01b03166387757e318585848181106110aa576110aa611895565b90506020028101906110bc9190611e70565b358686858181106110cf576110cf611895565b90506020028101906110e19190611e70565b6110f2906040810190602001611d30565b87878681811061110457611104611895565b90506020028101906111169190611e70565b611124906040810190611e86565b6040518563ffffffff1660e01b81526004016111439493929190611ecc565b600060405180830381600087803b15801561115d57600080fd5b505af1158015611171573d6000803e3d6000fd5b505050508061117f90611d09565b905061107f565b606554604051636396eb8d60e01b8152631b3a1e6760e31b916001600160a01b031690636396eb8d906111c190339030908690600401611868565b600060405180830381600087803b1580156111db57600080fd5b505af11580156111ef573d6000803e3d6000fd5b5086925060009150505b83811015610b1857816001600160a01b031663a7ba9dc286868481811061122257611222611895565b90506020028101906112349190611db5565b3587878581811061124757611247611895565b90506020028101906112599190611db5565b611267906020810190611dcb565b6040518463ffffffff1660e01b815260040161128593929190611f13565b600060405180830381600087803b15801561129f57600080fd5b505af11580156112b3573d6000803e3d6000fd5b50505050806112c190611d09565b90506111f9565b806001600160a01b03166112da610b20565b6001600160a01b03161461133a5760405162461bcd60e51b815260206004820152602160248201527f4f776e61626c653a206163636f756e74206973206e6f7420746865206f776e656044820152603960f91b60648201526084016104dc565b50565b611346336112c8565b6001600160a01b0381166113ab5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104dc565b61133a816114f0565b606554604051636396eb8d60e01b815263f3897bfd60e01b916001600160a01b031690636396eb8d906113ef90339030908690600401611868565b600060405180830381600087803b15801561140957600080fd5b505af115801561141d573d6000803e3d6000fd5b5050505060005b82811015610da0576066546001600160a01b03166369958ab985858481811061144f5761144f611895565b905060200201356040518263ffffffff1660e01b815260040161147491815260200190565b600060405180830381600087803b15801561148e57600080fd5b505af11580156114a2573d6000803e3d6000fd5b50505050806114b090611d09565b9050611424565b600054610100900460ff166114de5760405162461bcd60e51b81526004016104dc90611f6b565b6114e6611542565b6114ee611569565b565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166114ee5760405162461bcd60e51b81526004016104dc90611f6b565b600054610100900460ff166115905760405162461bcd60e51b81526004016104dc90611f6b565b6114ee336114f0565b80356001600160a01b03811681146115b057600080fd5b919050565b60008083601f8401126115c757600080fd5b5081356001600160401b038111156115de57600080fd5b6020830191508360208260051b85010111156115f957600080fd5b9250929050565b60008060006040848603121561161557600080fd5b61161e84611599565b925060208401356001600160401b0381111561163957600080fd5b611645868287016115b5565b9497909650939450505050565b6001600160801b038116811461133a57600080fd5b80356115b081611652565b60006020828403121561168457600080fd5b813561168f81611652565b9392505050565b600080604083850312156116a957600080fd5b6116b283611599565b91506116c060208401611599565b90509250929050565b6000806000604084860312156116de57600080fd5b6116e784611599565b925060208401356001600160401b038082111561170357600080fd5b818601915086601f83011261171757600080fd5b81358181111561172657600080fd5b87602060608302850101111561173b57600080fd5b6020830194508093505050509250925092565b60008083601f84011261176057600080fd5b5081356001600160401b0381111561177757600080fd5b6020830191508360208260061b85010111156115f957600080fd5b6000806000604084860312156117a757600080fd5b6117b084611599565b925060208401356001600160401b038111156117cb57600080fd5b6116458682870161174e565b600080602083850312156117ea57600080fd5b82356001600160401b0381111561180057600080fd5b61180c8582860161174e565b90969095509350505050565b6000806020838503121561182b57600080fd5b82356001600160401b0381111561184157600080fd5b61180c858286016115b5565b60006020828403121561185f57600080fd5b61168f82611599565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000823561011e198336030181126118c257600080fd5b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b60405161012081016001600160401b0381118282101715611905576119056118cc565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611933576119336118cc565b604052919050565b60006001600160401b03821115611954576119546118cc565b5060051b60200190565b600082601f83011261196f57600080fd5b8135602061198461197f8361193b565b61190b565b82815260059290921b840181019181810190868411156119a357600080fd5b8286015b848110156119be57803583529183019183016119a7565b509695505050505050565b6001600160401b038116811461133a57600080fd5b80356115b0816119c9565b600082601f8301126119fa57600080fd5b81356020611a0a61197f8361193b565b82815260059290921b84018101918181019086841115611a2957600080fd5b8286015b848110156119be578035611a40816119c9565b8352918301918301611a2d565b803560ff811681146115b057600080fd5b803580151581146115b057600080fd5b600082601f830112611a7f57600080fd5b81356001600160401b03811115611a9857611a986118cc565b611aab601f8201601f191660200161190b565b818152846020838601011115611ac057600080fd5b816020850160208301376000918101602001919091529392505050565b60006101208236031215611af057600080fd5b611af86118e2565b823581526020808401359082015260408301356001600160401b0380821115611b2057600080fd5b611b2c3683870161195e565b60408401526060850135915080821115611b4557600080fd5b611b51368387016119e9565b6060840152611b6260808601611667565b6080840152611b7360a086016119de565b60a0840152611b8460c08601611a4d565b60c0840152611b9560e08601611a5e565b60e084015261010091508185013581811115611bb057600080fd5b611bbc36828801611a6e565b8385015250505080915050919050565b600081518084526020808501945080840160005b83811015611c055781516001600160401b031687529582019590820190600101611be0565b509495945050505050565b6000815180845260005b81811015611c3657602081850181015186830182015201611c1a565b506000602082860101526020601f19601f83011685010191505092915050565b89815260208082018a90526101206040830181905289519083018190526000916101408401918b82019190845b81811015611c9f57835185529382019392820192600101611c83565b505050508281036060840152611cb5818a611bcc565b6001600160801b038916608085015290506001600160401b03871660a084015260ff861660c084015284151560e0840152828103610100840152611cf98185611c10565b9c9b505050505050505050505050565b600060018201611d2957634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215611d4257600080fd5b813561168f816119c9565b60008060408385031215611d6057600080fd5b8251611d6b81611652565b6020840151909250611d7c816119c9565b809150509250929050565b9182526001600160801b0316602082015260400190565b9182526001600160401b0316602082015260400190565b60008235603e198336030181126118c257600080fd5b6000808335601e19843603018112611de257600080fd5b8301803591506001600160401b03821115611dfc57600080fd5b6020019150600581901b36038213156115f957600080fd5b838152604060208201819052810182905260006001600160fb1b03831115611e3b57600080fd5b8260051b8085606085013791909101606001949350505050565b600060208284031215611e6757600080fd5b61168f82611a5e565b60008235605e198336030181126118c257600080fd5b6000808335601e19843603018112611e9d57600080fd5b8301803591506001600160401b03821115611eb757600080fd5b6020019150368190038213156115f957600080fd5b8481526001600160401b03841660208201526060604082018190528101829052818360808301376000818301608090810191909152601f909201601f191601019392505050565b83815260406020808301829052908201839052600090849060608401835b86811015611f5f578335611f44816119c9565b6001600160401b031682529282019290820190600101611f31565b50979650505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212206c09c7aad98104b5654996a12543f7a0ce412705e9dce737180a4c14c971daed64736f6c63430008100033