ETH Price: $1,799.67 (+10.71%)

Contract

0xBfCFD6fb89c1fDd0D87c3d24dD8Fc1D371203651

Overview

ETH Balance

0.002920260861503257 ETH

ETH Value

$5.26 (@ $1,799.67/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Execute Round136998132024-06-26 6:58:35301 days ago1719385115IN
0xBfCFD6fb...371203651
0 ETH0.000013410.0389
Execute Round136997162024-06-26 6:53:43301 days ago1719384823IN
0xBfCFD6fb...371203651
0 ETH0.000010090.0334
Start Prediction...136996182024-06-26 6:48:49301 days ago1719384529IN
0xBfCFD6fb...371203651
0 ETH0.000003730.0337
Create Predictio...136995002024-06-26 6:42:53301 days ago1719384173IN
0xBfCFD6fb...371203651
0 ETH0.000011320.026
Un Pause136994852024-06-26 6:42:07301 days ago1719384127IN
0xBfCFD6fb...371203651
0 ETH0.000000640.0266
Pause136994802024-06-26 6:41:52301 days ago1719384112IN
0xBfCFD6fb...371203651
0 ETH0.000006670.0263
Execute Round136984602024-06-26 5:50:30301 days ago1719381030IN
0xBfCFD6fb...371203651
0 ETH0.000009750.0283
Execute Round136983622024-06-26 5:45:36301 days ago1719380736IN
0xBfCFD6fb...371203651
0 ETH0.000007790.0258
Start Prediction...136982512024-06-26 5:40:03301 days ago1719380403IN
0xBfCFD6fb...371203651
0 ETH0.000003570.0323
Create Predictio...136981432024-06-26 5:34:35301 days ago1719380075IN
0xBfCFD6fb...371203651
0 ETH0.000014930.0343
Un Pause136981292024-06-26 5:33:53301 days ago1719380033IN
0xBfCFD6fb...371203651
0 ETH0.000000830.0345
Pause136981232024-06-26 5:33:36301 days ago1719380016IN
0xBfCFD6fb...371203651
0 ETH0.000008750.0345
Set Bhavish SDK136981062024-06-26 5:32:45301 days ago1719379965IN
0xBfCFD6fb...371203651
0 ETH0.000001140.0348
Execute Round136965462024-06-26 4:14:23301 days ago1719375263IN
0xBfCFD6fb...371203651
0 ETH0.000011320.0375
Set Bhavish SDK136965262024-06-26 4:13:23301 days ago1719375203IN
0xBfCFD6fb...371203651
0 ETH0.000001040.0318
Start Prediction...136964462024-06-26 4:09:23301 days ago1719374963IN
0xBfCFD6fb...371203651
0 ETH0.000003580.0324
Create Predictio...136963272024-06-26 4:03:22301 days ago1719374602IN
0xBfCFD6fb...371203651
0 ETH0.000012840.0295
Un Pause136963132024-06-26 4:02:40301 days ago1719374560IN
0xBfCFD6fb...371203651
0 ETH0.000000750.031
Set Min Predict ...136962942024-06-26 4:01:42301 days ago1719374502IN
0xBfCFD6fb...371203651
0 ETH0.000001130.0354
Pause136962762024-06-26 4:00:47301 days ago1719374447IN
0xBfCFD6fb...371203651
0 ETH0.000007520.0278
Create Predictio...136962172024-06-26 3:57:48301 days ago1719374268IN
0xBfCFD6fb...371203651
0 ETH0.000013060.03
Un Pause136961942024-06-26 3:56:38301 days ago1719374198IN
0xBfCFD6fb...371203651
0 ETH0.000000720.0299
Set Round Time136961872024-06-26 3:56:17301 days ago1719374177IN
0xBfCFD6fb...371203651
0 ETH0.000000970.0314
Pause136961732024-06-26 3:55:36301 days ago1719374136IN
0xBfCFD6fb...371203651
0 ETH0.000007790.0288
Create Predictio...136959172024-06-26 3:42:42301 days ago1719373362IN
0xBfCFD6fb...371203651
0 ETH0.000011270.0259
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
136998182024-06-26 6:58:50301 days ago1719385130
0xBfCFD6fb...371203651
0.06208843 ETH
136989542024-06-26 6:15:25301 days ago1719382525
0xBfCFD6fb...371203651
0.679 ETH
136966012024-06-26 4:17:08301 days ago1719375428
0xBfCFD6fb...371203651
0.0001 ETH
68211512023-10-31 23:01:00539 days ago1698793260
0xBfCFD6fb...371203651
0.00138579 ETH
68211512023-10-31 23:01:00539 days ago1698793260
0xBfCFD6fb...371203651
0.00138579 ETH
68211492023-10-31 23:01:00539 days ago1698793260
0xBfCFD6fb...371203651
0.00277159 ETH
68189282023-10-31 21:01:00539 days ago1698786060
0xBfCFD6fb...371203651
0.00138579 ETH
68189282023-10-31 21:01:00539 days ago1698786060
0xBfCFD6fb...371203651
0.00138579 ETH
68189262023-10-31 21:00:50539 days ago1698786050
0xBfCFD6fb...371203651
0.00277159 ETH
68165902023-10-31 19:01:05539 days ago1698778865
0xBfCFD6fb...371203651
0.00138579 ETH
68165902023-10-31 19:01:05539 days ago1698778865
0xBfCFD6fb...371203651
0.00138579 ETH
68165852023-10-31 19:00:55539 days ago1698778855
0xBfCFD6fb...371203651
0.00277159 ETH
68143602023-10-31 17:01:02539 days ago1698771662
0xBfCFD6fb...371203651
0.00138579 ETH
68143602023-10-31 17:01:02539 days ago1698771662
0xBfCFD6fb...371203651
0.00138579 ETH
68143592023-10-31 17:01:02539 days ago1698771662
0xBfCFD6fb...371203651
0.00277159 ETH
68123642023-10-31 15:00:59539 days ago1698764459
0xBfCFD6fb...371203651
0.00138579 ETH
68123642023-10-31 15:00:59539 days ago1698764459
0xBfCFD6fb...371203651
0.00138579 ETH
68123622023-10-31 15:00:59539 days ago1698764459
0xBfCFD6fb...371203651
0.00277159 ETH
68095772023-10-31 13:00:59539 days ago1698757259
0xBfCFD6fb...371203651
0.00138579 ETH
68095772023-10-31 13:00:59539 days ago1698757259
0xBfCFD6fb...371203651
0.00138579 ETH
68095752023-10-31 13:00:59539 days ago1698757259
0xBfCFD6fb...371203651
0.00277159 ETH
68057902023-10-31 11:01:01539 days ago1698750061
0xBfCFD6fb...371203651
0.00138579 ETH
68057902023-10-31 11:01:01539 days ago1698750061
0xBfCFD6fb...371203651
0.00138579 ETH
68057862023-10-31 11:00:51539 days ago1698750051
0xBfCFD6fb...371203651
0.00277159 ETH
68008972023-10-31 9:01:10540 days ago1698742870
0xBfCFD6fb...371203651
0.00138579 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NativeCP

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 19 : NativeCP.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

import { AbstractCP, IBhavishAdministrator, IPriceManager, BhavishPredictionStorage } from "./AbstractCP.sol";
import { AbstractNative, IBhavishSwap } from "../AbstractNative.sol";

/**
 * @title BhavishPrediction
 */
contract NativeCP is AbstractCP, AbstractNative {
    constructor(
        uint256 _minPredictAmount,
        uint256 _treasuryFee,
        IBhavishAdministrator _bhavishAdmin,
        IPriceManager _bhavishPriceManager,
        BhavishPredictionStorage _bhavishPredictionStorage,
        IBhavishSwap _bhavishSwap,
        uint256 _roundTime,
        bytes32 _underlying,
        bytes32 _strike
    )
        AbstractCP(
            _minPredictAmount,
            _treasuryFee,
            _bhavishAdmin,
            _bhavishPriceManager,
            _bhavishPredictionStorage,
            _roundTime,
            _underlying,
            _strike
        )
        AbstractNative(_bhavishSwap)
    {}
}

File 2 of 19 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 19 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 19 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Pausable is Context {
    /**
     * @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.
     */
    constructor() {
        _paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        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());
    }
}

File 5 of 19 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

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 applied 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.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @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 making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 19 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.delegatecall(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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 9 of 19 : IERC165.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 IERC165 {
    /**
     * @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);
}

File 10 of 19 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 11 of 19 : AbstractNative.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

import { AbstractPrediction, Address } from "./AbstractPrediction.sol";
import { IBhavishPredictionNative } from "../../Interface/IBhavishPredictionNative.sol";
import { IBhavishSwap } from "../../Interface/IBhavishSwap.sol";

abstract contract AbstractNative is AbstractPrediction, IBhavishPredictionNative {
    // Implementation for IBhavishPredictionNative methods -------
    using Address for address;

    IBhavishSwap public bhavishSwap;

    constructor(IBhavishSwap _bhavishSwap) {
        require(address(_bhavishSwap).isContract(), "Swapper is not a contract");
        bhavishSwap = _bhavishSwap;
    }

    function predictUp(uint256 _predictRoundId, address _userAddress) external payable whenNotPaused nonReentrant {
        _predictUp(_predictRoundId, _userAddress, msg.value);
    }

    function predictDown(uint256 _predictRoundId, address _userAddress) external payable whenNotPaused nonReentrant {
        _predictDown(_predictRoundId, _userAddress, msg.value);
    }

    function claim(
        uint256[] calldata _roundIds,
        address _userAddress,
        SwapParams memory _swapParams
    ) external nonReentrant returns (uint256 reward) {
        (reward, ) = _claim(_roundIds, _userAddress);
        if (_swapParams.convert && reward > 0) {
            IBhavishSwap.SwapStruct memory swapStruct = IBhavishSwap.SwapStruct({
                deadline: block.timestamp + (roundTime * 2),
                fromAsset: bytes32("MATIC"),
                toAsset: _swapParams.toAsset,
                amountIn: 0
            });
            bhavishSwap.swapExactETHForTokens{ value: reward }(swapStruct, _userAddress, _swapParams.slippage);
        } else if (reward > 0) _amountTransfer(_userAddress, reward);
    }

    function _setAmountDispersed(
        uint256 _roundId,
        address _user,
        uint256 _reward,
        uint256 _betAmount
    ) internal override {
        bhavishPredictionStorage.setBetAmountDispersed(_roundId, _user, _reward);
    }

    // Implementation for Abstract Crupto Prediction virtual methods -------

    function _updateCalculateRewards(uint256 _burn, uint256 _mint) internal override {}

    function _getRoundRewardAmount(Round memory _round) internal pure override returns (uint256 rewardAmount) {
        rewardAmount = _round.totalAmount;
    }

    function _calcRewardsForUser(Round memory _round, BetInfo memory _betInfo)
        internal
        view
        override
        returns (uint256 addedReward, uint256 winningBetAmount)
    {
        //check's for a tie
        if (_round.endPrice == _round.startPrice) {
            uint256 betAmount = _betInfo.upPredictAmount + _betInfo.downPredictAmount;
            if (_refundable(_round)) addedReward = betAmount - ((betAmount * treasuryFee) / 10**decimals);
        } else if (_round.endPrice > _round.startPrice) {
            winningBetAmount = _betInfo.upPredictAmount;
            addedReward = (_betInfo.upPredictAmount * _round.rewardAmount) / _round.rewardBaseCalAmount;
        } else if (_round.endPrice < _round.startPrice) {
            winningBetAmount = _betInfo.downPredictAmount;
            addedReward = (_betInfo.downPredictAmount * _round.rewardAmount) / _round.rewardBaseCalAmount;
        }
    }

    function _amountTransfer(address _user, uint256 _amount) internal override {
        (bool success, ) = _user.call{ value: _amount }("");
        require(success, "TransferHelper: TRANSFER_FAILED");
    }

    function _treasuryFeeTransfer(address _user, uint256 _amount) internal override {
        _amountTransfer(_user, _amount);
    }

    function updateBhavishSwap(IBhavishSwap _swap) external onlyAdmin(msg.sender) {
        bhavishSwap = _swap;
    }
}

File 12 of 19 : AbstractPrediction.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { IBhavishAdministrator } from "../../Interface/IBhavishAdministrator.sol";
import { IPriceManager } from "../../Interface/IPriceManager.sol";
import { IBhavishPrediction } from "../../Interface/IBhavishPrediction.sol";
import { BhavishPredictionStorage, Address } from "./BhavishPredictionStorage.sol";

/**
 * @title BhavishPrediction
 */
abstract contract AbstractPrediction is IBhavishPrediction, AccessControl, Pausable, ReentrancyGuard {
    using Address for address;

    uint256 public currentRoundId;
    uint256 public roundTime; //10 mintues of round
    uint256 public roundzeroStartTimestamp;

    PredictionMarketStatus public marketStatus;

    uint256 public treasuryFee;
    uint256 public vaultDiscountPerc;
    uint256 public constant MAX_TREASURY_FEE = 100; // 10%
    uint256 public minPredictAmount; // minimum prediction amount (denominated in wei)
    uint256 public treasuryAmount; // funds in treasury collected from fee
    uint256 public decimals = 3;
    address public bhavishSDK;

    // State variables for storing the underlying and strike asset names -- Need to revisit this logic in later versions
    AssetPair public assetPair;

    IBhavishAdministrator public bhavishAdmin;
    IPriceManager public bhavishPriceManager;
    BhavishPredictionStorage public bhavishPredictionStorage;
    mapping(address => bool) public isVault;

    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    event PausedMarket(uint256 currentRoundId);
    event UnPausedMarket(uint256 currentRoundId);

    event CreateRound(uint256 indexed roundId);
    event StartRound(uint256 indexed roundId);
    event EndRound(uint256 indexed roundId);
    event CancelRound(uint256 indexed roundId);
    event NewBhvaishSDK(address indexed _sdk);
    event PredictUp(address indexed sender, uint256 indexed roundId, uint256 amount);
    event PredictDown(address indexed sender, uint256 indexed roundId, uint256 amount);
    event RewardsCalculated(
        uint256 indexed roundId,
        uint256 rewardBaseCalAmount,
        uint256 rewardAmount,
        uint256 treasuryAmount
    );
    event Refund(uint256 indexed roundId, address indexed recipient, uint256 refundDispersed, uint256 timestamp);

    event NewMinPredictAmount(uint256 minPredictAmount);
    event NewTreasuryFee(uint256 treasuryFee);
    event NewVaultDiscountPercentage(uint256 vaultDiscountPerc);
    event NewOperator(address indexed operator);
    event NewAdmin(address indexed admin);
    event TransferToAdmin(address indexed bhavishAdmin, uint256 amount);
    event Claim(address indexed sender, uint256 indexed roundId, uint256 amount);

    /**
     * @notice Constructor
     * @param _minPredictAmount minimum bet amounts (in wei)
     * @param _treasuryFee treasury fee (1000 = 10%)
     * @param _bhavishAdmin Bhavish Administrator
     * @param _bhavishPriceManager Price Manager
     * @param _underlying Name of the underlying asset
     * @param _strike Name of the strike asset
     */
    constructor(
        uint256 _minPredictAmount,
        uint256 _treasuryFee,
        IBhavishAdministrator _bhavishAdmin,
        IPriceManager _bhavishPriceManager,
        BhavishPredictionStorage _bhavishPredictionStorage,
        uint256 _roundTime,
        bytes32 _underlying,
        bytes32 _strike
    ) {
        require(_minPredictAmount > 0, "Invalid Min Predict amount");
        require(_treasuryFee > 0 && _treasuryFee < MAX_TREASURY_FEE, "Treasury fee is too high");
        require(0 < _roundTime && _roundTime <= 86400, "Round Time should be between 1 sec to 3600 sec");

        minPredictAmount = _minPredictAmount;
        treasuryFee = _treasuryFee;
        vaultDiscountPerc = 100;
        bhavishAdmin = _bhavishAdmin;
        bhavishPriceManager = _bhavishPriceManager;
        bhavishPredictionStorage = _bhavishPredictionStorage;
        AssetPair memory pair = AssetPair(_underlying, _strike);
        assetPair = pair;
        roundTime = _roundTime;
        currentRoundId = bhavishPredictionStorage.latestRoundId();
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    // Implement virtual methods ---------

    function _getRoundRewardAmount(Round memory _round) internal pure virtual returns (uint256 rewardAmount);

    function _updateCalculateRewards(uint256 _burn, uint256 _mint) internal virtual;

    function _calcRewardsForUser(Round memory _round, BetInfo memory _betInfo)
        internal
        view
        virtual
        returns (uint256 addedReward, uint256 betAmount);

    function _amountTransfer(address _user, uint256 _amount) internal virtual;

    function _treasuryFeeTransfer(address _user, uint256 _amount) internal virtual;

    function _setAmountDispersed(
        uint256 _roundId,
        address _user,
        uint256 _reward,
        uint256 _amount
    ) internal virtual;

    // Modifiers go here --------

    modifier onlyAdmin(address _address) {
        require(hasRole(DEFAULT_ADMIN_ROLE, _address), "Address not an admin");
        _;
    }

    modifier onlyOperator(address _address) {
        require(hasRole(OPERATOR_ROLE, _address), "Address not an operator");
        _;
    }

    modifier validateUser(address _userAddress) {
        if (msg.sender != _userAddress) {
            require(msg.sender == bhavishSDK, "Invalid Caller");
        }
        _;
    }

    // Roles granting goes here --------

    /**
     * @notice Set operator
     * @dev callable by Admin of the contract
     * @param _operator new operator address
     */
    function setOperator(address _operator) external onlyAdmin(msg.sender) {
        require(!address(_operator).isContract(), "Operator cannot be a contract");
        require(_operator != address(0), "Cannot be zero address");
        grantRole(OPERATOR_ROLE, _operator);

        emit NewOperator(_operator);
    }

    /**
     * @notice Set the bhavish administrator
     * @param _bhavishAdministrator Address of the bhavish admin contract
     */
    function setBhavishAdministrator(IBhavishAdministrator _bhavishAdministrator) external onlyAdmin(msg.sender) {
        require(address(_bhavishAdministrator).isContract(), "Not Bhavish Administrator");
        bhavishAdmin = _bhavishAdministrator;
    }

    function addVault(address _vault) external onlyAdmin(msg.sender) {
        require(_vault.isContract(), "invalid vault");
        isVault[_vault] = true;
    }

    /**
     * @notice Remove operator
     * @dev callable by Admin of the contract
     * @param _address current operator
     */
    function removeOperator(address _address) external onlyAdmin(msg.sender) {
        revokeRole(OPERATOR_ROLE, _address);
    }

    // This is need for this contract to accept native currency

    /**
     * @notice Add funds
     */
    receive() external payable {}

    // Pause/Unpause the contract logic goes here --------

    /**
     * @notice Pause the contract
     * @dev Callable by admin
     */
    function pause() external whenNotPaused onlyAdmin(msg.sender) {
        _pause();
        for (
            uint256 tempRoundId = currentRoundId;
            tempRoundId <= bhavishPredictionStorage.latestRoundId();
            tempRoundId++
        ) {
            Round memory round = bhavishPredictionStorage.getPredictionRound(tempRoundId);
            if (round.roundState != RoundState.CANCELLED) {
                _cancelRound(tempRoundId);
            }
        }

        emit PausedMarket(currentRoundId);
    }

    /**
     * @notice Unpuase the contract
     * @dev Callable by admin
     */
    function unPause() external whenPaused onlyAdmin(msg.sender) {
        marketStatus.createPredictionMarketOnce = false;
        marketStatus.startPredictionMarketOnce = false;
        currentRoundId = bhavishPredictionStorage.latestRoundId();
        _unpause();

        emit UnPausedMarket(currentRoundId);
    }

    // Set the min reqs for the contract goes here ---------

    /**
     * @notice Set minPredictAmount
     * @dev Callable by admin
     * @param _minPredictAmount minimum Predict amount to be set
     */
    function setMinPredictAmount(uint256 _minPredictAmount) external whenPaused onlyAdmin(msg.sender) {
        require(_minPredictAmount > 0, "Must be superior to 0");
        minPredictAmount = _minPredictAmount;

        emit NewMinPredictAmount(_minPredictAmount);
    }

    /**
     * @notice Set Treasury Fee
     * @dev Callable by admin
     * @param _treasuryFee new treasury fee
     */
    function setTreasuryFee(uint256 _treasuryFee) external whenPaused onlyAdmin(msg.sender) {
        require(_treasuryFee > 0 && _treasuryFee < MAX_TREASURY_FEE, "Treasury fee is too high");
        treasuryFee = _treasuryFee;

        emit NewTreasuryFee(_treasuryFee);
    }

    /**
     * @notice Set Treasury Fee
     * @dev Callable by admin
     * @param _discountPerc new vault discount percentage
     */
    function setVaultDiscountPerc(uint256 _discountPerc) external whenPaused onlyAdmin(msg.sender) {
        require(_discountPerc <= 100, "Vault discount perc is too high");
        vaultDiscountPerc = _discountPerc;

        emit NewVaultDiscountPercentage(_discountPerc);
    }

    /**
     * @notice Set Bhavish SDK
     * @dev Callable by admin
     * @param _sdk new _sdk
     */
    function setBhavishSDK(address _sdk) external onlyAdmin(msg.sender) {
        require(_sdk.isContract(), "invalid address");
        bhavishSDK = _sdk;

        emit NewBhvaishSDK(_sdk);
    }

    /**
     * @notice Set the round time
     * @dev Callable by operator
     * @param _roundTime round time
     */
    function setRoundTime(uint256 _roundTime) external whenPaused onlyOperator(msg.sender) {
        require(0 < _roundTime && _roundTime <= 86400, "Round Time should be between 1 sec to 3600 sec");
        roundTime = _roundTime;
    }

    // Prediction logic goes here --------

    /**
     * @notice Create Round
     * @param roundId round Id
     * @param _startTimestamp Round start timestamp
     */
    function _createRound(uint256 roundId, uint256 _startTimestamp) internal {
        Round memory round = bhavishPredictionStorage.getPredictionRound(roundId);
        require(round.roundId == 0, "Round already exists");
        require(_startTimestamp - roundTime >= block.timestamp, "Round time is too short");
        round.roundId = roundId;
        round.roundStartTimestamp = _startTimestamp;
        round.roundEndTimestamp = round.roundStartTimestamp + roundTime;
        round.roundState = RoundState.CREATED;

        bhavishPredictionStorage.createPredictionRound(round);

        emit CreateRound(roundId);
    }

    /**
     * @notice Start Round
     * @param _predictRoundId round Id
     * @param _price Price of the asset
     */
    function _startRound(uint256 _predictRoundId, uint256 _price) internal {
        Round memory round = bhavishPredictionStorage.getPredictionRound(_predictRoundId);
        if (_price == 0) {
            _cancelRound(_predictRoundId);
        } else {
            require(round.roundState == RoundState.CREATED, "Round should be created");
            require(round.roundStartTimestamp <= block.timestamp, "Too early to start the round");

            bhavishPredictionStorage.setRoundState(_predictRoundId, RoundState.STARTED, _price, true);

            emit StartRound(_predictRoundId);
        }
    }

    /**
     * @notice Cancel the round
     * @param _predictRoundId Round id of the round that needs to be cancelled
     */
    function _cancelRound(uint256 _predictRoundId) internal {
        Round memory round = bhavishPredictionStorage.getPredictionRound(_predictRoundId);
        require(round.roundState != RoundState.CANCELLED, "Cannot cancel already cancelled round");

        bhavishPredictionStorage.cancelRound(_predictRoundId);
        emit CancelRound(_predictRoundId);
    }

    /**
     * @notice End Round
     * @param _predictRoundId round Id
     * @param _price Price of the asset
     */
    function _endRound(uint256 _predictRoundId, uint256 _price) internal {
        Round memory round = bhavishPredictionStorage.getPredictionRound(_predictRoundId);
        require(round.roundState == RoundState.STARTED, "Round is not started yet");
        require(round.roundEndTimestamp <= block.timestamp, "Too early to end the round");

        bhavishPredictionStorage.setRoundState(_predictRoundId, RoundState.ENDED, _price, false);

        emit EndRound(_predictRoundId);
    }

    /**
     * @notice Calculate Rewards for the round
     * @param _predictRoundId round Id
     */
    function _calculateRewards(uint256 _predictRoundId) internal {
        Round memory round = bhavishPredictionStorage.getPredictionRound(_predictRoundId);
        require(round.roundState == RoundState.ENDED, "Round is not ended");

        uint256 rewardAmount = _getRoundRewardAmount(round);
        uint256 treasuryAmt = (round.totalAmount * treasuryFee) / (10**decimals);

        uint256 rewardBaseCalAmount;
        // Bull wins
        if (round.endPrice > round.startPrice) {
            rewardBaseCalAmount = round.upPredictAmount;
            // reward amount can be zero while treasury can be greater than reward for few cases
            if (rewardAmount > 0 && rewardAmount > treasuryAmt) rewardAmount = rewardAmount - treasuryAmt;
            // case when there are no bets on winning side. loosing side bets should be moved to treasury
            if (rewardBaseCalAmount == 0) {
                treasuryAmt = round.downPredictAmount;
                rewardAmount = 0;
            }
        }
        // Bear wins
        else if (round.endPrice < round.startPrice) {
            rewardBaseCalAmount = round.downPredictAmount;
            if (rewardAmount > 0 && rewardAmount > treasuryAmt) rewardAmount = rewardAmount - treasuryAmt;
            // case when there are no bets on winning side. loosing side bets should be moved to treasury
            if (rewardBaseCalAmount == 0) {
                treasuryAmt = round.upPredictAmount;
                rewardAmount = 0;
            }
        }
        // draw or tie
        else {
            rewardBaseCalAmount = 0;
            rewardAmount = 0;
        }

        treasuryAmount += treasuryAmt;
        bhavishPredictionStorage.setRewardAmountForRound(_predictRoundId, rewardAmount, rewardBaseCalAmount);

        _updateCalculateRewards(rewardAmount + treasuryAmt, treasuryAmt);

        emit RewardsCalculated(_predictRoundId, rewardBaseCalAmount, rewardAmount, treasuryAmt);
    }

    /**
     * @notice Check whether the round is refundable
     * @param _predictRound round details
     */
    function _refundable(Round memory _predictRound) internal pure returns (bool) {
        return
            _predictRound.rewardBaseCalAmount == 0 &&
            _predictRound.rewardAmount == 0 &&
            _predictRound.startPrice == _predictRound.endPrice;
    }

    /**
     * @notice Transfer the funds to bhavish admin contract_predictRound
     * @param _amount Amount to be transfered
     */
    function transferToAdmin(uint256 _amount) external payable nonReentrant onlyAdmin(msg.sender) {
        require(_amount <= treasuryAmount, "Transfer amount is too large");
        treasuryAmount -= _amount;
        address bhavishAdminAddress = address(bhavishAdmin);
        _treasuryFeeTransfer(bhavishAdminAddress, _amount);

        emit TransferToAdmin(bhavishAdminAddress, _amount);
    }

    /**
     * @notice Bet Bull position
     * @param _predictRoundId Round Id
     * @param _userAddress Address of the user
     */
    function _predictUp(
        uint256 _predictRoundId,
        address _userAddress,
        uint256 _amount
    ) internal validateUser(_userAddress) {
        Round memory round = bhavishPredictionStorage.getPredictionRound(_predictRoundId);

        require(round.roundState == RoundState.CREATED && round.roundId != 0, "Bet is too early/late");
        require(block.timestamp <= round.roundStartTimestamp, "round already started");
        require(_amount >= minPredictAmount, "Bet amount must be greater than minBetAmount");
        // Update round data
        bhavishPredictionStorage.setAmount(_predictRoundId, _amount, true);

        BetInfo memory betInfo = bhavishPredictionStorage.getBetInfo(_predictRoundId, _userAddress);
        // Update user data
        if (betInfo.upPredictAmount == 0 && betInfo.downPredictAmount == 0) {
            bhavishPredictionStorage.setLedgerInfo(_userAddress, _predictRoundId);
        }
        bhavishPredictionStorage.setBetInfo(_amount, _predictRoundId, _userAddress, true);

        emit PredictUp(_userAddress, _predictRoundId, _amount);
    }

    /**
     * @notice Bet Bear position
     * @param _predictRoundId Round Id
     * @param _userAddress Address of the user
     */
    function _predictDown(
        uint256 _predictRoundId,
        address _userAddress,
        uint256 _amount
    ) internal validateUser(_userAddress) {
        Round memory round = bhavishPredictionStorage.getPredictionRound(_predictRoundId);

        require(block.timestamp <= round.roundStartTimestamp, "round already started");
        require(round.roundState == RoundState.CREATED && round.roundId != 0, "Bet is too early/late");
        require(_amount >= minPredictAmount, "Bet amount must be greater than minBetAmount");

        // Update round data
        bhavishPredictionStorage.setAmount(_predictRoundId, _amount, false);

        // Update user data
        BetInfo memory betInfo = bhavishPredictionStorage.getBetInfo(_predictRoundId, _userAddress);

        if (betInfo.upPredictAmount == 0 && betInfo.downPredictAmount == 0) {
            bhavishPredictionStorage.setLedgerInfo(_userAddress, _predictRoundId);
        }

        bhavishPredictionStorage.setBetInfo(_amount, _predictRoundId, _userAddress, false);

        emit PredictDown(_userAddress, _predictRoundId, _amount);
    }

    /**
     * @notice Start Zero round
     * @dev callable by Operator
     */
    function startPredictionMarket() external override whenNotPaused onlyOperator(msg.sender) {
        require(marketStatus.createPredictionMarketOnce, "Can only run after roundzeroCreateRound is triggered");
        require(!marketStatus.startPredictionMarketOnce, "Can only run roundzeroStartRound once");

        require(block.timestamp >= roundzeroStartTimestamp, "Round cannot be started early");

        (uint256 price, ) = bhavishPriceManager.getPrice(
            assetPair.underlying,
            assetPair.strike,
            roundzeroStartTimestamp
        );

        _startRound(currentRoundId, price);

        marketStatus.startPredictionMarketOnce = true;
    }

    /**
     * @notice Start Zero round
     * @dev callable by Operator
     */
    function startPredictionMarket(uint256 _price) external override whenNotPaused onlyOperator(msg.sender) {
        require(marketStatus.createPredictionMarketOnce, "Can only run after roundzeroCreateRound is triggered");
        require(!marketStatus.startPredictionMarketOnce, "Can only run roundzeroStartRound once");

        require(block.timestamp >= roundzeroStartTimestamp, "Round cannot be started early");

        _startRound(currentRoundId, _price);

        marketStatus.startPredictionMarketOnce = true;
    }

    /**
     * @notice Get the _claimable stats of specific round id and user account
     * @param _round: round details
     * @param _betInfo: bet info of a user
     */
    function _claimable(Round memory _round, BetInfo memory _betInfo) public pure returns (bool) {
        return
            (_betInfo.upPredictAmount != 0 || _betInfo.downPredictAmount != 0) &&
            _betInfo.amountDispersed == 0 &&
            ((_round.endPrice > _round.startPrice && _betInfo.upPredictAmount != 0) ||
                (_round.endPrice < _round.startPrice && _betInfo.downPredictAmount != 0) ||
                (_round.endPrice == _round.startPrice));
    }

    /**
     * @notice claim reward
     * @param roundIds: round Ids
     */
    function _claim(uint256[] memory roundIds, address userAddress)
        internal
        validateUser(userAddress)
        returns (uint256 reward, uint256 bet)
    {
        for (uint256 i = 0; i < roundIds.length; i++) {
            Round memory round = bhavishPredictionStorage.getPredictionRound(roundIds[i]);
            BetInfo memory betInfo = bhavishPredictionStorage.getBetInfo(roundIds[i], userAddress);

            require(round.roundState == RoundState.ENDED, "Round not eligible for rewards");
            require(round.totalAmount > 0, "No bets in the round");

            if (round.startPrice == round.endPrice) require(_refundable(round), "Not eligible for refund");

            if (_claimable(round, betInfo)) {
                (uint256 addedReward, uint256 betAmount) = _calcRewardsForUser(round, betInfo);

                if (isVault[userAddress]) addedReward = _updateVaultReward(addedReward);
                _setAmountDispersed(round.roundId, userAddress, addedReward, betAmount);
                reward += addedReward;
                bet += betAmount;

                emit Claim(userAddress, roundIds[i], addedReward);
            }
        }
    }

    function _updateVaultReward(uint256 oldReward) private returns (uint256 reward) {
        // if Vault winning 20 Matic and considering 3% protocol fee for ease of calc
        // oldReward will be 19.4
        reward = oldReward;
        // 19.4 / (1 - protocol fee %) provides original winning amount before treasury fee
        // treasury fee can't be more than 10% as defined above
        uint256 oWin = (oldReward * 1e3) / (1e3 - treasuryFee);
        // tFeeCollected = oWin - reward;
        // NOTE: vaultDiscountPerc can't be greater than equal to 100
        // new fee will always be less or equal to old fee. We need to deduct this amount from treasuryFee
        // newDiscountedFee = (oWin * treasuryFee * (100 - vaultDiscountPerc)) / 1e5;
        // eg: 20 - ( 20 * 30 * (100 - 33) / 1e5 )
        reward = oWin - (oWin * treasuryFee * (100 - vaultDiscountPerc)) / 1e5;
        // old reward will always be higher or equal to new reward
        // subtract this new amount from original amount and provide that as addedReward
        if (treasuryAmount > reward - oldReward) treasuryAmount -= reward - oldReward;
        else reward = oldReward; // can't reduce reward as treasury amount is zero
    }

    function getAverageBetAmount(uint256[] calldata roundIds, address userAddress)
        external
        view
        override
        returns (uint256 betAmount)
    {
        for (uint256 i = 0; i < roundIds.length; i++) {
            BetInfo memory betInfo = bhavishPredictionStorage.getBetInfo(roundIds[i], userAddress);
            betAmount += betInfo.downPredictAmount + betInfo.upPredictAmount;
        }
        if (roundIds.length > 0) betAmount /= roundIds.length;
    }

    /**
     * @notice getRewards reward
     * @param roundIds: round Ids
     */
    function getRewards(uint256[] calldata roundIds, address userAddress) public view returns (uint256) {
        uint256 totalReward = 0;
        for (uint256 i = 0; i < roundIds.length; i++) {
            Round memory round = bhavishPredictionStorage.getPredictionRound(roundIds[i]);
            BetInfo memory betInfo = bhavishPredictionStorage.getBetInfo(roundIds[i], userAddress);

            if (!_claimable(round, betInfo)) {
                continue;
            }

            (uint256 reward, ) = _calcRewardsForUser(round, betInfo);
            totalReward += reward;
        }

        return totalReward;
    }

    /**
     * @notice Refund to users if a round is cancelled
     * @param _predictRoundId Round id of the cancelled round
     */
    function refundUsers(uint256 _predictRoundId, address userAddress) public override nonReentrant {
        Round memory round = bhavishPredictionStorage.getPredictionRound(_predictRoundId);
        require(round.roundState == RoundState.CANCELLED, "User not eligible for refund");

        BetInfo memory betInfo = bhavishPredictionStorage.getBetInfo(_predictRoundId, userAddress);
        require(betInfo.amountDispersed == 0, "Refund already claimed");
        uint256 amtInvested = betInfo.upPredictAmount + betInfo.downPredictAmount;
        if (amtInvested > 0) {
            bhavishPredictionStorage.setBetAmountDispersed(_predictRoundId, userAddress, amtInvested);
            _amountTransfer(userAddress, amtInvested);
            emit Refund(_predictRoundId, userAddress, amtInvested, block.timestamp);
        }
    }

    function getCurrentRoundDetails() external view returns (IBhavishPrediction.Round memory round) {
        round = bhavishPredictionStorage.getPredictionRound(currentRoundId);
    }
}

File 13 of 19 : BhavishPredictionStorage.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { IBhavishPrediction } from "../../Interface/IBhavishPrediction.sol";

contract BhavishPredictionStorage is AccessControl {
    using Address for address;
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    mapping(uint256 => IBhavishPrediction.Round) public rounds;
    mapping(uint256 => mapping(address => IBhavishPrediction.BetInfo)) public ledger;
    mapping(address => uint256[]) public userRounds;
    mapping(uint256 => address[]) public usersInRounds;

    uint256 public latestRoundId;

    modifier onlyManager(address _address) {
        require(hasRole(MANAGER_ROLE, _address), "caller has no access to the method");
        _;
    }

    constructor() {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    function setManager(address _address) external {
        require(_address != address(0) && _address.isContract(), "Invalid manager address");
        grantRole(MANAGER_ROLE, _address);
    }

    function createPredictionRound(IBhavishPrediction.Round memory round) external onlyManager(msg.sender) {
        rounds[round.roundId] = round;
        latestRoundId = round.roundId;
    }

    function updatePredictionRound(IBhavishPrediction.Round memory round) external onlyManager(msg.sender) {
        require(rounds[round.roundId].roundId != 0, "Cannot overwrite non existing round");
        rounds[round.roundId] = round;
    }

    function getUsersInRounds(uint256 _predictRoundId) external view returns (address[] memory userAddresses) {
        userAddresses = usersInRounds[_predictRoundId];
    }

    function getPredictionRound(uint256 roundId) external view returns (IBhavishPrediction.Round memory round) {
        round = rounds[roundId];
    }

    function getArrayRounds(uint256 from, uint256 to)
        external
        view
        returns (IBhavishPrediction.Round[] memory arrayOfRounds)
    {
        require(to <= latestRoundId, "Index out of bound");
        require(from < to, "From < To");
        uint256 len = to - from + 1;
        arrayOfRounds = new IBhavishPrediction.Round[](len);

        for (uint256 i = 0; i < len; i++) {
            arrayOfRounds[i] = rounds[from];
            from += 1;
        }
    }

    function setRoundState(
        uint256 roundId,
        IBhavishPrediction.RoundState state,
        uint256 price,
        bool start
    ) external onlyManager(msg.sender) {
        IBhavishPrediction.Round storage round = rounds[roundId];
        round.roundState = state;
        if (start) round.startPrice = price;
        else round.endPrice = price;
    }

    function cancelRound(uint256 roundId) external onlyManager(msg.sender) {
        IBhavishPrediction.Round storage round = rounds[roundId];
        round.roundState = IBhavishPrediction.RoundState.CANCELLED;
    }

    function setRewardAmountForRound(
        uint256 roundId,
        uint256 rewardAmount,
        uint256 rewardBaseCalAmount
    ) external onlyManager(msg.sender) {
        IBhavishPrediction.Round storage round = rounds[roundId];
        round.rewardAmount = rewardAmount;
        round.rewardBaseCalAmount = rewardBaseCalAmount;
    }

    function setAmount(
        uint256 roundId,
        uint256 amount,
        bool directionUp
    ) external onlyManager(msg.sender) {
        IBhavishPrediction.Round storage round = rounds[roundId];
        round.totalAmount = round.totalAmount + amount;
        if (directionUp) round.upPredictAmount += amount;
        else round.downPredictAmount += amount;
    }

    function createBet(
        IBhavishPrediction.BetInfo memory betInfo,
        uint256 roundId,
        address userAddress
    ) external onlyManager(msg.sender) {
        ledger[roundId][userAddress] = betInfo;
    }

    function getBetInfo(uint256 roundId, address userAddress)
        external
        view
        returns (IBhavishPrediction.BetInfo memory betInfo)
    {
        betInfo = ledger[roundId][userAddress];
    }

    function setBetAmountDispersed(
        uint256 roundId,
        address userAddress,
        uint256 amountDispersed
    ) external onlyManager(msg.sender) {
        IBhavishPrediction.BetInfo storage betInfo = ledger[roundId][userAddress];
        betInfo.amountDispersed += amountDispersed;
    }

    function setBetInfo(
        uint256 amount,
        uint256 roundId,
        address userAddress,
        bool directionUp
    ) external onlyManager(msg.sender) {
        IBhavishPrediction.BetInfo storage betInfo = ledger[roundId][userAddress];
        if (directionUp) betInfo.upPredictAmount += amount;
        else betInfo.downPredictAmount += amount;
    }

    function setLedgerInfo(address userAddress, uint256 roundId) external onlyManager(msg.sender) {
        userRounds[userAddress].push(roundId);
        usersInRounds[roundId].push(userAddress);
    }

    function getUserRoundHistory(address userAddress)
        external
        view
        returns (IBhavishPrediction.BetInfo[] memory userRoundHistory)
    {
        userRoundHistory = new IBhavishPrediction.BetInfo[](userRounds[userAddress].length);
        for (uint256 i = 0; i < userRounds[userAddress].length; i++) {
            uint256 roundId = userRounds[userAddress][i];
            userRoundHistory[i] = ledger[roundId][userAddress];
        }
    }

    function getUserRounds(address userAddress) external view returns (uint256[] memory) {
        return userRounds[userAddress];
    }

    function getUserInRounds(uint256 roundId) external view returns (address[] memory) {
        return usersInRounds[roundId];
    }
}

File 14 of 19 : AbstractCP.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

import {
    AbstractPrediction,
    IBhavishAdministrator,
    IPriceManager,
    BhavishPredictionStorage
} from "../AbstractPrediction.sol";

/**
 * @title BhavishPrediction
 */
abstract contract AbstractCP is AbstractPrediction {
    constructor(
        uint256 _minPredictAmount,
        uint256 _treasuryFee,
        IBhavishAdministrator _bhavishAdmin,
        IPriceManager _bhavishPriceManager,
        BhavishPredictionStorage _bhavishPredictionStorage,
        uint256 _roundTime,
        bytes32 _underlying,
        bytes32 _strike
    )
        AbstractPrediction(
            _minPredictAmount,
            _treasuryFee,
            _bhavishAdmin,
            _bhavishPriceManager,
            _bhavishPredictionStorage,
            _roundTime,
            _underlying,
            _strike
        )
    {}

    /**
     * @notice Create Round Zero round
     * @dev callable by Operator
     * @param _roundzeroStartTimestamp round zero round start timestamp
     */
    function createPredictionMarket(uint256 _roundzeroStartTimestamp)
        external
        override
        whenNotPaused
        onlyOperator(msg.sender)
    {
        require(!marketStatus.createPredictionMarketOnce, "Can only run roundzeroCreateRound once");
        currentRoundId = currentRoundId + 1;
        roundzeroStartTimestamp = _roundzeroStartTimestamp;
        _createRound(currentRoundId, _roundzeroStartTimestamp);
        marketStatus.createPredictionMarketOnce = true;

        //create next 3 rounds to be able to bet by users
        _createRound(currentRoundId + 1, roundzeroStartTimestamp + roundTime);
        _createRound(currentRoundId + 2, roundzeroStartTimestamp + roundTime + roundTime);
        _createRound(currentRoundId + 3, roundzeroStartTimestamp + roundTime + roundTime + roundTime);
    }

    /**
     * @notice Execute round
     * @dev Callable by Operator
     */
    function executeRound() external override whenNotPaused {
        require(
            marketStatus.createPredictionMarketOnce && marketStatus.startPredictionMarketOnce,
            "Can only run after roundzeroStartRound"
        );
        Round memory curRound = bhavishPredictionStorage.getPredictionRound(currentRoundId);
        Round memory roundPlusThree = bhavishPredictionStorage.getPredictionRound(currentRoundId + 3);

        // currentRoundId refers to current round n
        // fetch price to end current round and start new round

        (uint256 price, ) = bhavishPriceManager.getPrice(
            assetPair.underlying,
            assetPair.strike,
            curRound.roundEndTimestamp
        );

        // End and Disperse current round
        if (curRound.roundState != RoundState.CANCELLED && price != 0) {
            _endRound(currentRoundId, price);

            _calculateRewards(currentRoundId);
        } else if (curRound.roundState != RoundState.CANCELLED && price == 0) {
            _cancelRound(currentRoundId);
        }

        // Start next round
        _startRound(currentRoundId + 1, price);

        // Create a new round n+3
        _createRound(currentRoundId + 4, roundPlusThree.roundEndTimestamp);

        // Point currentRoundId to next round
        currentRoundId = currentRoundId + 1;
    }

    /**
     * @notice Execute round
     * @dev Callable by Operator
     */
    function executeRound(uint256 _price) external override whenNotPaused onlyOperator(msg.sender) {
        require(
            marketStatus.createPredictionMarketOnce && marketStatus.startPredictionMarketOnce,
            "Can only run after roundzeroStartRound"
        );
        Round memory curRound = bhavishPredictionStorage.getPredictionRound(currentRoundId);
        Round memory roundPlusThree = bhavishPredictionStorage.getPredictionRound(currentRoundId + 3);

        // End and Disperse current round
        if (curRound.roundState != RoundState.CANCELLED && _price != 0) {
            _endRound(currentRoundId, _price);

            _calculateRewards(currentRoundId);
        } else if (curRound.roundState != RoundState.CANCELLED && _price == 0) {
            _cancelRound(currentRoundId);
        }

        // Start next round
        _startRound(currentRoundId + 1, _price);

        // Create a new round n+3
        _createRound(currentRoundId + 4, roundPlusThree.roundEndTimestamp);

        // Point currentRoundId to next round
        currentRoundId = currentRoundId + 1;
    }
}

File 15 of 19 : IBhavishAdministrator.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

/**
 * @title IBhavishAdministrator
 */

interface IBhavishAdministrator {
    /**
     * @dev Emitted when Treasury is claimed by the admin
     * @param admin Address of the admin
     * @param amount Amount claimed by the admin
     */
    event TreasuryClaim(address indexed admin, uint256 amount);

    /**
     * @dev Claim the treasury amount. Can be performed only by admin
     */
    function claimTreasury() external;
}

File 16 of 19 : IBhavishPrediction.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

interface IBhavishPrediction {
    enum RoundState {
        CREATED,
        STARTED,
        ENDED,
        CANCELLED
    }

    struct Round {
        uint256 roundId;
        RoundState roundState;
        uint256 upPredictAmount;
        uint256 downPredictAmount;
        uint256 totalAmount;
        uint256 rewardBaseCalAmount;
        uint256 rewardAmount;
        uint256 startPrice;
        uint256 endPrice;
        uint256 roundStartTimestamp;
        uint256 roundEndTimestamp;
    }

    struct BetInfo {
        uint256 upPredictAmount;
        uint256 downPredictAmount;
        uint256 amountDispersed;
    }

    struct AssetPair {
        bytes32 underlying;
        bytes32 strike;
    }

    struct PredictionMarketStatus {
        bool startPredictionMarketOnce;
        bool createPredictionMarketOnce;
    }

    /**
     * @notice Create Round Zero round
     * @dev callable by Operator
     * @param _roundzeroStartTimestamp: round zero round start timestamp
     */
    function createPredictionMarket(uint256 _roundzeroStartTimestamp) external;

    /**
     * @notice Start Zero round
     * @dev callable by Operator
     */
    function startPredictionMarket() external;

    /**
     * @notice Start Zero round
     * @dev callable by Operator
     */
    function startPredictionMarket(uint256 price) external;

    /**
     * @notice Execute round
     * @dev Callable by Operator
     */
    function executeRound() external;

    /**
     * @notice Execute round
     * @dev Callable by Operator
     */
    function executeRound(uint256 price) external;

    function getCurrentRoundDetails() external view returns (IBhavishPrediction.Round memory);

    function refundUsers(uint256 _predictRoundId, address userAddress) external;

    function getAverageBetAmount(uint256[] calldata roundIds, address userAddress) external returns (uint256);
}

File 17 of 19 : IBhavishPredictionNative.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;
import "./IBhavishPrediction.sol";

interface IBhavishPredictionNative is IBhavishPrediction {
    struct SwapParams {
        uint256 slippage;
        bytes32 toAsset;
        bool convert;
    }

    /**
     * @notice Bet Bull position
     * @param roundId: Round Id
     * @param userAddress: Address of the user
     */
    function predictUp(uint256 roundId, address userAddress) external payable;

    /**
     * @notice Bet Bear position
     * @param roundId: Round Id
     * @param userAddress: Address of the user
     */
    function predictDown(uint256 roundId, address userAddress) external payable;

    function claim(
        uint256[] calldata _roundIds,
        address _userAddress,
        SwapParams memory _swapParams
    ) external returns (uint256);
}

File 18 of 19 : IBhavishSwap.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

interface IBhavishSwap {
    struct SwapStruct {
        uint256 amountIn;
        uint256 deadline;
        bytes32 fromAsset;
        bytes32 toAsset;
    }

    function swapExactETHForTokens(
        SwapStruct memory _swapStruct,
        address to,
        uint256 slippage
    ) external payable returns (uint256[] memory amounts);

    function swapExactTokensForETH(
        SwapStruct memory _swapStruct,
        address to,
        uint256 slippage
    ) external returns (uint256[] memory amounts);
}

File 19 of 19 : IPriceManager.sol
// SPDX-License-Identifier: BSD-4-Clause

pragma solidity ^0.8.13;

interface IPriceManager {
    /**
     * @dev Emitted when the new Oracle aggregator data has been added.
     * @param _underlying Address of the underlying asset.
     * @param _strike Address of the strike asset.
     * @param _bhavishAggregator Address of the bhavish aggregator.
     * @param _aggregator Address of the aggregator.
     */
    event AddAssetPairAggregator(
        bytes32 indexed _underlying,
        bytes32 indexed _strike,
        address _bhavishAggregator,
        address _aggregator
    );

    /**
     * @notice Function to add the price for an underlying, strike asset pair
     * @param _underlying Underlying Asset
     * @param _strike Strike Asset
     * @param _aggregator Address of the aggregator.
     */
    function setPairContract(
        bytes32 _underlying,
        bytes32 _strike,
        address _aggregator
    ) external;

    /**
     * @notice Function to get the price for an underlying asset
     * @param _underlying Underlying Asset
     * @param _strike Strike Asset
     * @param _timestamp    Timestamp
     * @return price asset price
     * @return decimals asset price decimals
     */
    function getPrice(
        bytes32 _underlying,
        bytes32 _strike,
        uint256 _timestamp
    ) external view returns (uint256 price, uint8 decimals);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"uint256","name":"_minPredictAmount","type":"uint256"},{"internalType":"uint256","name":"_treasuryFee","type":"uint256"},{"internalType":"contract IBhavishAdministrator","name":"_bhavishAdmin","type":"address"},{"internalType":"contract IPriceManager","name":"_bhavishPriceManager","type":"address"},{"internalType":"contract BhavishPredictionStorage","name":"_bhavishPredictionStorage","type":"address"},{"internalType":"contract IBhavishSwap","name":"_bhavishSwap","type":"address"},{"internalType":"uint256","name":"_roundTime","type":"uint256"},{"internalType":"bytes32","name":"_underlying","type":"bytes32"},{"internalType":"bytes32","name":"_strike","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"CancelRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"CreateRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"EndRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sdk","type":"address"}],"name":"NewBhvaishSDK","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minPredictAmount","type":"uint256"}],"name":"NewMinPredictAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"}],"name":"NewOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"treasuryFee","type":"uint256"}],"name":"NewTreasuryFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultDiscountPerc","type":"uint256"}],"name":"NewVaultDiscountPercentage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"currentRoundId","type":"uint256"}],"name":"PausedMarket","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PredictDown","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PredictUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"refundDispersed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryAmount","type":"uint256"}],"name":"RewardsCalculated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"StartRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bhavishAdmin","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferToAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"currentRoundId","type":"uint256"}],"name":"UnPausedMarket","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TREASURY_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"roundId","type":"uint256"},{"internalType":"enum IBhavishPrediction.RoundState","name":"roundState","type":"uint8"},{"internalType":"uint256","name":"upPredictAmount","type":"uint256"},{"internalType":"uint256","name":"downPredictAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"startPrice","type":"uint256"},{"internalType":"uint256","name":"endPrice","type":"uint256"},{"internalType":"uint256","name":"roundStartTimestamp","type":"uint256"},{"internalType":"uint256","name":"roundEndTimestamp","type":"uint256"}],"internalType":"struct IBhavishPrediction.Round","name":"_round","type":"tuple"},{"components":[{"internalType":"uint256","name":"upPredictAmount","type":"uint256"},{"internalType":"uint256","name":"downPredictAmount","type":"uint256"},{"internalType":"uint256","name":"amountDispersed","type":"uint256"}],"internalType":"struct IBhavishPrediction.BetInfo","name":"_betInfo","type":"tuple"}],"name":"_claimable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"addVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"assetPair","outputs":[{"internalType":"bytes32","name":"underlying","type":"bytes32"},{"internalType":"bytes32","name":"strike","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bhavishAdmin","outputs":[{"internalType":"contract IBhavishAdministrator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bhavishPredictionStorage","outputs":[{"internalType":"contract BhavishPredictionStorage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bhavishPriceManager","outputs":[{"internalType":"contract IPriceManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bhavishSDK","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bhavishSwap","outputs":[{"internalType":"contract IBhavishSwap","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_roundIds","type":"uint256[]"},{"internalType":"address","name":"_userAddress","type":"address"},{"components":[{"internalType":"uint256","name":"slippage","type":"uint256"},{"internalType":"bytes32","name":"toAsset","type":"bytes32"},{"internalType":"bool","name":"convert","type":"bool"}],"internalType":"struct IBhavishPredictionNative.SwapParams","name":"_swapParams","type":"tuple"}],"name":"claim","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundzeroStartTimestamp","type":"uint256"}],"name":"createPredictionMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentRoundId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"executeRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"executeRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"roundIds","type":"uint256[]"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"getAverageBetAmount","outputs":[{"internalType":"uint256","name":"betAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentRoundDetails","outputs":[{"components":[{"internalType":"uint256","name":"roundId","type":"uint256"},{"internalType":"enum IBhavishPrediction.RoundState","name":"roundState","type":"uint8"},{"internalType":"uint256","name":"upPredictAmount","type":"uint256"},{"internalType":"uint256","name":"downPredictAmount","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"startPrice","type":"uint256"},{"internalType":"uint256","name":"endPrice","type":"uint256"},{"internalType":"uint256","name":"roundStartTimestamp","type":"uint256"},{"internalType":"uint256","name":"roundEndTimestamp","type":"uint256"}],"internalType":"struct IBhavishPrediction.Round","name":"round","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"roundIds","type":"uint256[]"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"getRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isVault","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketStatus","outputs":[{"internalType":"bool","name":"startPredictionMarketOnce","type":"bool"},{"internalType":"bool","name":"createPredictionMarketOnce","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minPredictAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_predictRoundId","type":"uint256"},{"internalType":"address","name":"_userAddress","type":"address"}],"name":"predictDown","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_predictRoundId","type":"uint256"},{"internalType":"address","name":"_userAddress","type":"address"}],"name":"predictUp","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_predictRoundId","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"refundUsers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"roundTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundzeroStartTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBhavishAdministrator","name":"_bhavishAdministrator","type":"address"}],"name":"setBhavishAdministrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sdk","type":"address"}],"name":"setBhavishSDK","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minPredictAmount","type":"uint256"}],"name":"setMinPredictAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundTime","type":"uint256"}],"name":"setRoundTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_treasuryFee","type":"uint256"}],"name":"setTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_discountPerc","type":"uint256"}],"name":"setVaultDiscountPerc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"startPredictionMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPredictionMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferToAdmin","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"treasuryAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBhavishSwap","name":"_swap","type":"address"}],"name":"updateBhavishSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultDiscountPerc","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040526003600b553480156200001657600080fd5b5060405162005117380380620051178339810160408190526200003991620003e3565b6001805460ff19168155600255838989898989888888878787878787878787620000aa5760405162461bcd60e51b815260206004820152601a60248201527f496e76616c6964204d696e205072656469637420616d6f756e7400000000000060448201526064015b60405180910390fd5b600087118015620000bb5750606487105b620001095760405162461bcd60e51b815260206004820152601860248201527f54726561737572792066656520697320746f6f206869676800000000000000006044820152606401620000a1565b8260001080156200011d5750620151808311155b620001825760405162461bcd60e51b815260206004820152602e60248201527f526f756e642054696d652073686f756c64206265206265747765656e2031207360448201526d656320746f20333630302073656360901b6064820152608401620000a1565b600988905560078790556064600855600f80546001600160a01b038089166001600160a01b031992831617909255601080548884169083161790556011805492871692909116821790556040805180820182528481526020808201859052600d869055600e859055600487815583516311a8f41360e01b815293519294936311a8f41393818301939290918290030181865afa15801562000227573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200024d91906200047e565b6003556200025d6000336200030b565b50505050505050505050505050505050506200028d816001600160a01b03166200031b60201b620026031760201c565b620002db5760405162461bcd60e51b815260206004820152601960248201527f53776170706572206973206e6f74206120636f6e7472616374000000000000006044820152606401620000a1565b601380546001600160a01b0319166001600160a01b03929092169190911790555062000498975050505050505050565b6200031782826200032a565b5050565b6001600160a01b03163b151590565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000317576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003863390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b0381168114620003e057600080fd5b50565b60008060008060008060008060006101208a8c0312156200040357600080fd5b8951985060208a0151975060408a01516200041e81620003ca565b60608b01519097506200043181620003ca565b60808b01519096506200044481620003ca565b60a08b01519095506200045781620003ca565b8094505060c08a0151925060e08a015191506101008a015190509295985092959850929598565b6000602082840312156200049157600080fd5b5051919050565b614c6f80620004a86000396000f3fe60806040526004361061031e5760003560e01c80637b3205f5116101ab578063d547741f116100f7578063f2b3c80911610095578063f7b188a51161006f578063f7b188a51461093d578063fa65cb0414610952578063fb2f897a14610972578063fc572b181461099257600080fd5b8063f2b3c809146108e6578063f5032980146108fb578063f5b541a61461091b57600080fd5b8063e8712bd4116100d1578063e8712bd41461085c578063ec87621c1461087c578063ee5f8c8f146108b0578063efc3b2ea146108c657600080fd5b8063d547741f146107ef578063e0e081d71461080f578063e44bb72f1461084957600080fd5b8063a217fddf11610164578063b3ab15fb1161013e578063b3ab15fb14610779578063b6705a5514610799578063bd9de03c146107b9578063cc32d176146107d957600080fd5b8063a217fddf14610724578063a23e988414610739578063ac8a584a1461075957600080fd5b80637b3205f5146106825780638456cb591461069757806391d14854146106ac5780639bb6eb70146106cc5780639cbe5efd146106ee578063a20037341461070457600080fd5b8063445769cd1161026a5780636d27c9db1161022357806377e741c7116101fd57806377e741c71461060c578063783cf3321461062c578063795c29601461064c57806379905dd51461066c57600080fd5b80636d27c9db146105b757806373343620146105d757806377e0181f146105f757600080fd5b8063445769cd146104f95780634b14c3d41461051957806357957f69146105395780635a9aa957146105595780635c975abb1461056f578063652b9b411461058757600080fd5b80632f2ff15d116102d757806335538b69116102b157806335538b691461048357806336568abe146104a3578063368acb09146104c357806340a20138146104d957600080fd5b80632f2ff15d14610415578063313ce56714610435578063325f700e1461044b57600080fd5b806301ffc9a71461032a57806309fffec01461035f57806310082c75146103745780631c389c28146103a4578063248a9ca3146103b7578063256b5a02146103f557600080fd5b3661032557005b600080fd5b34801561033657600080fd5b5061034a61034536600461413c565b6109a8565b60405190151581526020015b60405180910390f35b61037261036d366004614166565b6109df565b005b34801561038057600080fd5b50600d54600e5461038f919082565b60408051928352602083019190915201610356565b6103726103b2366004614194565b610b01565b3480156103c357600080fd5b506103e76103d2366004614166565b60009081526020819052604090206001015490565b604051908152602001610356565b34801561040157600080fd5b506103726104103660046141c4565b610b42565b34801561042157600080fd5b50610372610430366004614194565b610bd6565b34801561044157600080fd5b506103e7600b5481565b34801561045757600080fd5b50600f5461046b906001600160a01b031681565b6040516001600160a01b039091168152602001610356565b34801561048f57600080fd5b5061037261049e366004614166565b610c00565b3480156104af57600080fd5b506103726104be366004614194565b610d5c565b3480156104cf57600080fd5b506103e7600a5481565b3480156104e557600080fd5b506103726104f43660046141c4565b610dd6565b34801561050557600080fd5b50610372610514366004614166565b610e21565b34801561052557600080fd5b5060135461046b906001600160a01b031681565b34801561054557600080fd5b506103e76105543660046142ba565b610ed6565b34801561056557600080fd5b506103e760055481565b34801561057b57600080fd5b5060015460ff1661034a565b34801561059357600080fd5b5061034a6105a23660046141c4565b60126020526000908152604090205460ff1681565b3480156105c357600080fd5b506103726105d2366004614166565b611065565b3480156105e357600080fd5b506103726105f2366004614194565b61115b565b34801561060357600080fd5b506103726113ff565b34801561061857600080fd5b50610372610627366004614166565b61156b565b34801561063857600080fd5b50610372610647366004614166565b61162c565b34801561065857600080fd5b506103e7610667366004614359565b611862565b34801561067857600080fd5b506103e760085481565b34801561068e57600080fd5b5061037261195a565b3480156106a357600080fd5b50610372611be7565b3480156106b857600080fd5b5061034a6106c7366004614194565b611d89565b3480156106d857600080fd5b506106e1611db2565b60405161035691906143e8565b3480156106fa57600080fd5b506103e760035481565b34801561071057600080fd5b5061034a61071f3660046144c2565b611e8c565b34801561073057600080fd5b506103e7600081565b34801561074557600080fd5b506103726107543660046141c4565b611f07565b34801561076557600080fd5b506103726107743660046141c4565b611fa9565b34801561078557600080fd5b506103726107943660046141c4565b611fe9565b3480156107a557600080fd5b506103726107b4366004614166565b612108565b3480156107c557600080fd5b50600c5461046b906001600160a01b031681565b3480156107e557600080fd5b506103e760075481565b3480156107fb57600080fd5b5061037261080a366004614194565b6121be565b34801561081b57600080fd5b506006546108329060ff8082169161010090041682565b604080519215158352901515602083015201610356565b610372610857366004614194565b6121e3565b34801561086857600080fd5b5060115461046b906001600160a01b031681565b34801561088857600080fd5b506103e77f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b3480156108bc57600080fd5b506103e760045481565b3480156108d257600080fd5b5060105461046b906001600160a01b031681565b3480156108f257600080fd5b506103e7606481565b34801561090757600080fd5b506103726109163660046141c4565b61221b565b34801561092757600080fd5b506103e7600080516020614c1a83398151915281565b34801561094957600080fd5b506103726122d7565b34801561095e57600080fd5b5061037261096d366004614166565b6123be565b34801561097e57600080fd5b506103e761098d366004614359565b612477565b34801561099e57600080fd5b506103e760095481565b60006001600160e01b03198216637965db0b60e01b14806109d957506301ffc9a760e01b6001600160e01b03198316145b92915050565b6002805403610a095760405162461bcd60e51b8152600401610a0090614580565b60405180910390fd5b6002805533610a19600082611d89565b610a355760405162461bcd60e51b8152600401610a00906145b7565b600a54821115610a875760405162461bcd60e51b815260206004820152601c60248201527f5472616e7366657220616d6f756e7420697320746f6f206c61726765000000006044820152606401610a00565b81600a6000828254610a9991906145fb565b9091555050600f546001600160a01b0316610ab48184612612565b806001600160a01b03167fc9262544ea8cacb7a3eea4ea7b4023ea10ac8bc73701610edba13308190f9cb184604051610aef91815260200190565b60405180910390a25050600160025550565b610b0961261c565b6002805403610b2a5760405162461bcd60e51b8152600401610a0090614580565b60028055610b39828234612664565b50506001600255565b33610b4e600082611d89565b610b6a5760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b610bb15760405162461bcd60e51b815260206004820152600d60248201526c1a5b9d985b1a59081d985d5b1d609a1b6044820152606401610a00565b506001600160a01b03166000908152601260205260409020805460ff19166001179055565b600082815260208190526040902060010154610bf181612a0c565b610bfb8383612a19565b505050565b610c0861261c565b33610c21600080516020614c1a83398151915282611d89565b610c3d5760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff1615610ca45760405162461bcd60e51b815260206004820152602660248201527f43616e206f6e6c792072756e20726f756e647a65726f437265617465526f756e60448201526564206f6e636560d01b6064820152608401610a00565b600354610cb2906001614649565b60038190556005839055610cc69083612a9d565b6006805461ff001916610100179055600354610cfc90610ce7906001614649565b600454600554610cf79190614649565b612a9d565b610d296003546002610d0e9190614649565b600454600554610d1f908290614649565b610cf79190614649565b610d586003546003610d3b9190614649565b6004546005548190610d4e908290614649565b610d1f9190614649565b5050565b6001600160a01b0381163314610dcc5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a00565b610d588282612c69565b33610de2600082611d89565b610dfe5760405162461bcd60e51b8152600401610a00906145b7565b50601380546001600160a01b0319166001600160a01b0392909216919091179055565b610e29612cce565b33610e35600082611d89565b610e515760405162461bcd60e51b8152600401610a00906145b7565b60008211610e995760405162461bcd60e51b815260206004820152601560248201527404d757374206265207375706572696f7220746f203605c1b6044820152606401610a00565b60098290556040518281527f06a2e1014d8503fc3c899acda61fc50ab1918a70e8f904759a1f72f03bbd9cda906020015b60405180910390a15050565b60006002805403610ef95760405162461bcd60e51b8152600401610a0090614580565b600280556040805160208087028281018201909352868252610f3892889188918291850190849080828437600092019190915250879250612d17915050565b5060408301519091508015610f4d5750600081115b156110485760006040518060800160405280600081526020016004546002610f759190614661565b610f7f9042614649565b8152644d4154494360d81b6020808301919091528581015160409283015260135486518351630c44410b60e41b815285516004820152928501516024840152928401516044830152606084015160648301526001600160a01b03888116608484015260a483019390935292935091169063c44410b090849060c40160006040518083038185885af1158015611018573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526110419190810190614680565b5050611058565b80156110585761105883826130a4565b6001600255949350505050565b61106d61261c565b33611086600080516020614c1a83398151915282611d89565b6110a25760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff166110c95760405162461bcd60e51b8152600401610a0090614726565b60065460ff16156110ec5760405162461bcd60e51b8152600401610a009061477a565b60055442101561113e5760405162461bcd60e51b815260206004820152601d60248201527f526f756e642063616e6e6f742062652073746172746564206561726c790000006044820152606401610a00565b61114a60035483613147565b50506006805460ff19166001179055565b600280540361117c5760405162461bcd60e51b8152600401610a0090614580565b6002805560115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156111cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ef91906147ca565b9050600381602001516003811115611209576112096143b0565b146112565760405162461bcd60e51b815260206004820152601c60248201527f55736572206e6f7420656c696769626c6520666f7220726566756e64000000006044820152606401610a00565b601154604051630736449d60e11b8152600481018590526001600160a01b0384811660248301526000921690630e6c893a90604401606060405180830381865afa1580156112a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112cc9190614864565b9050806040015160001461131b5760405162461bcd60e51b81526020600482015260166024820152751499599d5b9908185b1c9958591e4818db185a5b595960521b6044820152606401610a00565b6020810151815160009161132e91614649565b905080156113f35760115460405163720988c960e11b8152600481018790526001600160a01b038681166024830152604482018490529091169063e413119290606401600060405180830381600087803b15801561138b57600080fd5b505af115801561139f573d6000803e3d6000fd5b505050506113ad84826130a4565b604080518281524260208201526001600160a01b0386169187917faba4210cad11f1112f31ba136a61cdc0f6ab4c2b478da8c93eec1d9769e97a89910160405180910390a35b50506001600255505050565b61140761261c565b33611420600080516020614c1a83398151915282611d89565b61143c5760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff166114635760405162461bcd60e51b8152600401610a0090614726565b60065460ff16156114865760405162461bcd60e51b8152600401610a009061477a565b6005544210156114d85760405162461bcd60e51b815260206004820152601d60248201527f526f756e642063616e6e6f742062652073746172746564206561726c790000006044820152606401610a00565b601054600d54600e546005546040516319f59e5f60e01b81526004810193909352602483019190915260448201526000916001600160a01b0316906319f59e5f906064016040805180830381865afa158015611538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155c91906148c0565b50905061114a60035482613147565b611573612cce565b3361157f600082611d89565b61159b5760405162461bcd60e51b8152600401610a00906145b7565b6000821180156115ab5750606482105b6115f75760405162461bcd60e51b815260206004820152601860248201527f54726561737572792066656520697320746f6f206869676800000000000000006044820152606401610a00565b60078290556040518281527f938d9272b26145999fe14f6124b73f122e1e023fc5de069c74ade1254408a97690602001610eca565b61163461261c565b3361164d600080516020614c1a83398151915282611d89565b6116695760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff168015611682575060065460ff165b61169e5760405162461bcd60e51b8152600401610a00906148eb565b60115460035460405163168a468560e11b815260048101919091526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156116ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171191906147ca565b601154600380549293506000926001600160a01b0390921691632d148d0a9161173a9190614649565b6040518263ffffffff1660e01b815260040161175891815260200190565b61016060405180830381865afa158015611776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179a91906147ca565b90506003826020015160038111156117b4576117b46143b0565b141580156117c157508315155b156117e2576117d26003548561331c565b6117dd6003546134e1565b611816565b6003826020015160038111156117fa576117fa6143b0565b14158015611806575083155b156118165761181660035461376e565b61182e60035460016118289190614649565b85613147565b61184b60035460046118409190614649565b826101400151612a9d565b600354611859906001614649565b60035550505050565b6000805b8381101561193f576011546000906001600160a01b0316630e6c893a87878581811061189457611894614931565b90506020020135866040518363ffffffff1660e01b81526004016118cb9291909182526001600160a01b0316602082015260400190565b606060405180830381865afa1580156118e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190c9190614864565b8051602082015191925061191f91614649565b6119299084614649565b925050808061193790614947565b915050611866565b508215611953576119508382614960565b90505b9392505050565b61196261261c565b600654610100900460ff16801561197b575060065460ff165b6119975760405162461bcd60e51b8152600401610a00906148eb565b60115460035460405163168a468560e11b815260048101919091526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156119e6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0a91906147ca565b601154600380549293506000926001600160a01b0390921691632d148d0a91611a339190614649565b6040518263ffffffff1660e01b8152600401611a5191815260200190565b61016060405180830381865afa158015611a6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9391906147ca565b601054600d54600e546101408601516040516319f59e5f60e01b81526004810193909352602483019190915260448201529192506000916001600160a01b03909116906319f59e5f906064016040805180830381865afa158015611afb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1f91906148c0565b509050600383602001516003811115611b3a57611b3a6143b0565b14158015611b4757508015155b15611b6857611b586003548261331c565b611b636003546134e1565b611b9c565b600383602001516003811115611b8057611b806143b0565b14158015611b8c575080155b15611b9c57611b9c60035461376e565b611bb46003546001611bae9190614649565b82613147565b611bd16003546004611bc69190614649565b836101400151612a9d565b600354611bdf906001614649565b600355505050565b611bef61261c565b33611bfb600082611d89565b611c175760405162461bcd60e51b8152600401610a00906145b7565b611c1f6138df565b6003545b601160009054906101000a90046001600160a01b03166001600160a01b03166311a8f4136040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9a9190614982565b8111611d4a5760115460405163168a468560e11b8152600481018390526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015611ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0f91906147ca565b9050600381602001516003811115611d2957611d296143b0565b14611d3757611d378261376e565b5080611d4281614947565b915050611c23565b507fa382c86dbb1fba726013556ec174337b8f9ddac70b97ddb00d2e79e8b565d4f5600354604051611d7e91815260200190565b60405180910390a150565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b611e106040805161016081019091526000808252602082019081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60115460035460405163168a468560e11b81526001600160a01b0390921691632d148d0a91611e459160040190815260200190565b61016060405180830381865afa158015611e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8791906147ca565b905090565b8051600090151580611ea15750602082015115155b8015611eaf57506040820151155b801561195357508260e00151836101000151118015611ece5750815115155b80611eef57508260e00151836101000151108015611eef5750602082015115155b806119535750505060e0810151610100909101511490565b33611f13600082611d89565b611f2f5760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b611f865760405162461bcd60e51b815260206004820152601960248201527f4e6f7420426861766973682041646d696e6973747261746f72000000000000006044820152606401610a00565b50600f80546001600160a01b0319166001600160a01b0392909216919091179055565b33611fb5600082611d89565b611fd15760405162461bcd60e51b8152600401610a00906145b7565b610d58600080516020614c1a833981519152836121be565b33611ff5600082611d89565b6120115760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b156120695760405162461bcd60e51b815260206004820152601d60248201527f4f70657261746f722063616e6e6f74206265206120636f6e74726163740000006044820152606401610a00565b6001600160a01b0382166120b85760405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606401610a00565b6120d0600080516020614c1a83398151915283610bd6565b6040516001600160a01b038316907fda12ee837e6978172aaf54b16145ffe08414fd8710092ef033c71b8eb6ec189a90600090a25050565b612110612cce565b3361211c600082611d89565b6121385760405162461bcd60e51b8152600401610a00906145b7565b60648211156121895760405162461bcd60e51b815260206004820152601f60248201527f5661756c7420646973636f756e74207065726320697320746f6f2068696768006044820152606401610a00565b60088290556040518281527f1c3d6aca04a9d74c524b053538418e96eafc310c8d049c2a44f001d1b0c03fc390602001610eca565b6000828152602081905260409020600101546121d981612a0c565b610bfb8383612c69565b6121eb61261c565b600280540361220c5760405162461bcd60e51b8152600401610a0090614580565b60028055610b39828234613933565b33612227600082611d89565b6122435760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b61228c5760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b6044820152606401610a00565b600c80546001600160a01b0319166001600160a01b0384169081179091556040517f98902aabfcbed99d0d9769f20db2c97ad70f69f67ca8811518d37b9e590e0e8890600090a25050565b6122df612cce565b336122eb600082611d89565b6123075760405162461bcd60e51b8152600401610a00906145b7565b6006805461ffff19169055601154604080516311a8f41360e01b815290516001600160a01b03909216916311a8f413916004808201926020929091908290030181865afa15801561235c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123809190614982565b60035561238b613ccb565b7f0b0e422893e2219d69c6fba12911d3b270235e96e9753519998fc13013ebb2ae600354604051611d7e91815260200190565b6123c6612cce565b336123df600080516020614c1a83398151915282611d89565b6123fb5760405162461bcd60e51b8152600401610a0090614612565b81600010801561240e5750620151808211155b6124715760405162461bcd60e51b815260206004820152602e60248201527f526f756e642054696d652073686f756c64206265206265747765656e2031207360448201526d656320746f20333630302073656360901b6064820152608401610a00565b50600455565b600080805b848110156125fa576011546000906001600160a01b0316632d148d0a8888858181106124aa576124aa614931565b905060200201356040518263ffffffff1660e01b81526004016124cf91815260200190565b61016060405180830381865afa1580156124ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251191906147ca565b6011549091506000906001600160a01b0316630e6c893a89898681811061253a5761253a614931565b90506020020135886040518363ffffffff1660e01b81526004016125719291909182526001600160a01b0316602082015260400190565b606060405180830381865afa15801561258e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b29190614864565b90506125be8282611e8c565b6125c95750506125e8565b60006125d58383613d04565b5090506125e28186614649565b94505050505b806125f281614947565b91505061247c565b50949350505050565b6001600160a01b03163b151590565b610d5882826130a4565b60015460ff16156126625760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610a00565b565b81336001600160a01b0382161461269f57600c546001600160a01b0316331461269f5760405162461bcd60e51b8152600401610a009061499b565b60115460405163168a468560e11b8152600481018690526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156126ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270e91906147ca565b9050600081602001516003811115612728576127286143b0565b1480156127355750805115155b6127795760405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606401610a00565b8061012001514211156127c65760405162461bcd60e51b81526020600482015260156024820152741c9bdd5b9908185b1c9958591e481cdd185c9d1959605a1b6044820152606401610a00565b6009548310156127e85760405162461bcd60e51b8152600401610a00906149c3565b60115460405163ec4773a760e01b81526004810187905260248101859052600160448201526001600160a01b039091169063ec4773a790606401600060405180830381600087803b15801561283c57600080fd5b505af1158015612850573d6000803e3d6000fd5b5050601154604051630736449d60e11b8152600481018990526001600160a01b038881166024830152600094509091169150630e6c893a90604401606060405180830381865afa1580156128a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128cc9190614864565b80519091501580156128e057506020810151155b1561294c57601154604051634a966a1b60e01b81526001600160a01b0387811660048301526024820189905290911690634a966a1b90604401600060405180830381600087803b15801561293357600080fd5b505af1158015612947573d6000803e3d6000fd5b505050505b6011546040516331e1f08360e11b815260048101869052602481018890526001600160a01b03878116604483015260016064830152909116906363c3e10690608401600060405180830381600087803b1580156129a857600080fd5b505af11580156129bc573d6000803e3d6000fd5b5050505085856001600160a01b03167f0bab430d5cfc26b856f9867d7019c5af92e6fb9f0eef60afadab9f0d53ff1fd3866040516129fc91815260200190565b60405180910390a3505050505050565b612a168133613dea565b50565b612a238282611d89565b610d58576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055612a593390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015612ae8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b0c91906147ca565b805190915015612b555760405162461bcd60e51b8152602060048201526014602482015273526f756e6420616c72656164792065786973747360601b6044820152606401610a00565b4260045483612b6491906145fb565b1015612bb25760405162461bcd60e51b815260206004820152601760248201527f526f756e642074696d6520697320746f6f2073686f72740000000000000000006044820152606401610a00565b8281526101208101829052600454612bca9083614649565b6101408201526000602082015260115460405163ad0197db60e01b81526001600160a01b039091169063ad0197db90612c079084906004016143e8565b600060405180830381600087803b158015612c2157600080fd5b505af1158015612c35573d6000803e3d6000fd5b50506040518592507f257b6e0c207001c05b4f0f88a5bc913e2c47513ab9989881a48ceea263b2a7219150600090a2505050565b612c738282611d89565b15610d58576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60015460ff166126625760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a00565b60008082336001600160a01b03821614612d5557600c546001600160a01b03163314612d555760405162461bcd60e51b8152600401610a009061499b565b60005b855181101561309b5760115486516000916001600160a01b031690632d148d0a90899085908110612d8b57612d8b614931565b60200260200101516040518263ffffffff1660e01b8152600401612db191815260200190565b61016060405180830381865afa158015612dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df391906147ca565b60115488519192506000916001600160a01b0390911690630e6c893a908a9086908110612e2257612e22614931565b6020026020010151896040518363ffffffff1660e01b8152600401612e5a9291909182526001600160a01b0316602082015260400190565b606060405180830381865afa158015612e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9b9190614864565b9050600282602001516003811115612eb557612eb56143b0565b14612f025760405162461bcd60e51b815260206004820152601e60248201527f526f756e64206e6f7420656c696769626c6520666f72207265776172647300006044820152606401610a00565b6000826080015111612f4d5760405162461bcd60e51b8152602060048201526014602482015273139bc818995d1cc81a5b881d1a19481c9bdd5b9960621b6044820152606401610a00565b8161010001518260e0015103612fb257612f6682613e4e565b612fb25760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656c696769626c6520666f7220726566756e640000000000000000006044820152606401610a00565b612fbc8282611e8c565b1561308657600080612fce8484613d04565b6001600160a01b038b16600090815260126020526040902054919350915060ff161561300057612ffd82613e7e565b91505b835161300e908a8484613f2d565b6130188289614649565b97506130248188614649565b965089858151811061303857613038614931565b6020026020010151896001600160a01b03167f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf78460405161307b91815260200190565b60405180910390a350505b5050808061309390614947565b915050612d58565b50509250929050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146130f1576040519150601f19603f3d011682016040523d82523d6000602084013e6130f6565b606091505b5050905080610bfb5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610a00565b60115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015613192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b691906147ca565b9050816000036131c957610bfb8361376e565b6000816020015160038111156131e1576131e16143b0565b1461322e5760405162461bcd60e51b815260206004820152601760248201527f526f756e642073686f756c6420626520637265617465640000000000000000006044820152606401610a00565b4281610120015111156132835760405162461bcd60e51b815260206004820152601c60248201527f546f6f206561726c7920746f2073746172742074686520726f756e64000000006044820152606401610a00565b6011546040516352f3e91960e01b81526001600160a01b03909116906352f3e919906132ba90869060019087908290600401614a0f565b600060405180830381600087803b1580156132d457600080fd5b505af11580156132e8573d6000803e3d6000fd5b50506040518592507f939f42374aa9bf1d8d8cd56d8a9110cb040cd8dfeae44080c6fcf2645e51b4529150600090a2505050565b60115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015613367573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061338b91906147ca565b90506001816020015160038111156133a5576133a56143b0565b146133f25760405162461bcd60e51b815260206004820152601860248201527f526f756e64206973206e6f7420737461727465642079657400000000000000006044820152606401610a00565b4281610140015111156134475760405162461bcd60e51b815260206004820152601a60248201527f546f6f206561726c7920746f20656e642074686520726f756e640000000000006044820152606401610a00565b6011546040516352f3e91960e01b81526001600160a01b03909116906352f3e9199061347f9086906002908790600090600401614a0f565b600060405180830381600087803b15801561349957600080fd5b505af11580156134ad573d6000803e3d6000fd5b50506040518592507f2c46d8d5cabadbc3b7c8644a09e45c97988bd5ee29b298d282a7ef8c1833d9129150600090a2505050565b60115460405163168a468560e11b8152600481018390526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa15801561352c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061355091906147ca565b905060028160200151600381111561356a5761356a6143b0565b146135ac5760405162461bcd60e51b8152602060048201526012602482015271149bdd5b99081a5cc81b9bdd08195b99195960721b6044820152606401610a00565b60006135b9826080015190565b90506000600b54600a6135cc9190614b1e565b60075484608001516135de9190614661565b6135e89190614960565b905060008360e00151846101000151111561363c57506040830151821580159061361157508183115b156136235761362082846145fb565b92505b806000036136375783606001519150600092505b613692565b8360e00151846101000151101561368b57506060830151821580159061366157508183115b156136735761367082846145fb565b92505b80600003613637578360400151915060009250613692565b5060009150815b81600a60008282546136a49190614649565b909155505060115460405163ddae3a7160e01b81526004810187905260248101859052604481018390526001600160a01b039091169063ddae3a7190606401600060405180830381600087803b1580156136fd57600080fd5b505af1158015613711573d6000803e3d6000fd5b505050506137248284612a169190614649565b604080518281526020810185905290810183905285907f6dfdfcb09c8804d0058826cd2539f1acfbe3cb887c9be03d928035bce0f1a58d9060600160405180910390a25050505050565b60115460405163168a468560e11b8152600481018390526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156137b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137dd91906147ca565b90506003816020015160038111156137f7576137f76143b0565b036138525760405162461bcd60e51b815260206004820152602560248201527f43616e6e6f742063616e63656c20616c72656164792063616e63656c6c6564206044820152641c9bdd5b9960da1b6064820152608401610a00565b601154604051637e07ab0960e01b8152600481018490526001600160a01b0390911690637e07ab0990602401600060405180830381600087803b15801561389857600080fd5b505af11580156138ac573d6000803e3d6000fd5b50506040518492507f1316afc2a7dc68d55247ceedbef28ffd97f61bafc159c949278f4b934d448c7b9150600090a25050565b6138e761261c565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b81336001600160a01b0382161461396e57600c546001600160a01b0316331461396e5760405162461bcd60e51b8152600401610a009061499b565b60115460405163168a468560e11b8152600481018690526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156139b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139dd91906147ca565b9050806101200151421115613a2c5760405162461bcd60e51b81526020600482015260156024820152741c9bdd5b9908185b1c9958591e481cdd185c9d1959605a1b6044820152606401610a00565b600081602001516003811115613a4457613a446143b0565b148015613a515750805115155b613a955760405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606401610a00565b600954831015613ab75760405162461bcd60e51b8152600401610a00906149c3565b60115460405163ec4773a760e01b81526004810187905260248101859052600060448201526001600160a01b039091169063ec4773a790606401600060405180830381600087803b158015613b0b57600080fd5b505af1158015613b1f573d6000803e3d6000fd5b5050601154604051630736449d60e11b8152600481018990526001600160a01b038881166024830152600094509091169150630e6c893a90604401606060405180830381865afa158015613b77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b9b9190614864565b8051909150158015613baf57506020810151155b15613c1b57601154604051634a966a1b60e01b81526001600160a01b0387811660048301526024820189905290911690634a966a1b90604401600060405180830381600087803b158015613c0257600080fd5b505af1158015613c16573d6000803e3d6000fd5b505050505b6011546040516331e1f08360e11b815260048101869052602481018890526001600160a01b03878116604483015260006064830152909116906363c3e10690608401600060405180830381600087803b158015613c7757600080fd5b505af1158015613c8b573d6000803e3d6000fd5b5050505085856001600160a01b03167f546f54506a25044de11c4fb0c44fbd0137d87d7e08dfd800944453931428a5ea866040516129fc91815260200190565b613cd3612cce565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33613916565b6000808360e0015184610100015103613d725760208301518351600091613d2a91614649565b9050613d3585613e4e565b15613d6c57600b54613d4890600a614b1e565b600754613d559083614661565b613d5f9190614960565b613d6990826145fb565b92505b50613de3565b8360e001518461010001511115613dab5750815160a084015160c0850151613d9a9083614661565b613da49190614960565b9150613de3565b8360e001518461010001511015613de35750602082015160a084015160c0850151613dd69083614661565b613de09190614960565b91505b9250929050565b613df48282611d89565b610d5857613e0c816001600160a01b03166014613fa0565b613e17836020613fa0565b604051602001613e28929190614b5a565b60408051601f198184030181529082905262461bcd60e51b8252610a0091600401614bcf565b60008160a001516000148015613e66575060c0820151155b80156109d957505061010081015160e0909101511490565b6007548190600090613e92906103e86145fb565b613e9e846103e8614661565b613ea89190614960565b9050620186a06008546064613ebd91906145fb565b600754613eca9084614661565b613ed49190614661565b613ede9190614960565b613ee890826145fb565b9150613ef483836145fb565b600a541115613f2357613f0783836145fb565b600a6000828254613f1891906145fb565b90915550613f279050565b8291505b50919050565b60115460405163720988c960e11b8152600481018690526001600160a01b038581166024830152604482018590529091169063e413119290606401600060405180830381600087803b158015613f8257600080fd5b505af1158015613f96573d6000803e3d6000fd5b5050505050505050565b60606000613faf836002614661565b613fba906002614649565b67ffffffffffffffff811115613fd257613fd2614226565b6040519080825280601f01601f191660200182016040528015613ffc576020820181803683370190505b509050600360fc1b8160008151811061401757614017614931565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061404657614046614931565b60200101906001600160f81b031916908160001a905350600061406a846002614661565b614075906001614649565b90505b60018111156140ed576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106140a9576140a9614931565b1a60f81b8282815181106140bf576140bf614931565b60200101906001600160f81b031916908160001a90535060049490941c936140e681614c02565b9050614078565b5083156119535760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a00565b60006020828403121561414e57600080fd5b81356001600160e01b03198116811461195357600080fd5b60006020828403121561417857600080fd5b5035919050565b6001600160a01b0381168114612a1657600080fd5b600080604083850312156141a757600080fd5b8235915060208301356141b98161417f565b809150509250929050565b6000602082840312156141d657600080fd5b81356119538161417f565b60008083601f8401126141f357600080fd5b50813567ffffffffffffffff81111561420b57600080fd5b6020830191508360208260051b8501011115613de357600080fd5b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff8111828210171561425f5761425f614226565b60405290565b604051610160810167ffffffffffffffff8111828210171561425f5761425f614226565b604051601f8201601f1916810167ffffffffffffffff811182821017156142b2576142b2614226565b604052919050565b60008060008084860360a08112156142d157600080fd5b853567ffffffffffffffff8111156142e857600080fd5b6142f4888289016141e1565b90965094505060208601356143088161417f565b92506060603f198201121561431c57600080fd5b5061432561423c565b60408601358152606086013560208201526080860135801515811461434957600080fd5b6040820152939692955090935050565b60008060006040848603121561436e57600080fd5b833567ffffffffffffffff81111561438557600080fd5b614391868287016141e1565b90945092505060208401356143a58161417f565b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b600481106143e457634e487b7160e01b600052602160045260246000fd5b9052565b81518152602080830151610160830191614404908401826143c6565b5060408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151818401525061014080840151818401525092915050565b60048110612a1657600080fd5b80356144838161446b565b919050565b60006060828403121561449a57600080fd5b6144a261423c565b905081358152602082013560208201526040820135604082015292915050565b6000808284036101c08112156144d757600080fd5b610160808212156144e757600080fd5b6144ef614265565b91508435825261450160208601614478565b602083015260408501356040830152606085013560608301526080850135608083015260a085013560a083015260c085013560c083015260e085013560e083015261010080860135818401525061012080860135818401525061014080860135818401525081935061457586828701614488565b925050509250929050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526014908201527320b2323932b9b9903737ba1030b71030b236b4b760611b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561460d5761460d6145e5565b500390565b60208082526017908201527f41646472657373206e6f7420616e206f70657261746f72000000000000000000604082015260600190565b6000821982111561465c5761465c6145e5565b500190565b600081600019048311821515161561467b5761467b6145e5565b500290565b6000602080838503121561469357600080fd5b825167ffffffffffffffff808211156146ab57600080fd5b818501915085601f8301126146bf57600080fd5b8151818111156146d1576146d1614226565b8060051b91506146e2848301614289565b81815291830184019184810190888411156146fc57600080fd5b938501935b8385101561471a57845182529385019390850190614701565b98975050505050505050565b60208082526034908201527f43616e206f6e6c792072756e20616674657220726f756e647a65726f437265616040820152731d19549bdd5b99081a5cc81d1c9a59d9d95c995960621b606082015260800190565b60208082526025908201527f43616e206f6e6c792072756e20726f756e647a65726f5374617274526f756e64604082015264206f6e636560d81b606082015260800190565b80516144838161446b565b600061016082840312156147dd57600080fd5b6147e5614265565b825181526147f5602084016147bf565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152506101408084015181830152508091505092915050565b60006060828403121561487657600080fd5b6040516060810181811067ffffffffffffffff8211171561489957614899614226565b80604052508251815260208301516020820152604083015160408201528091505092915050565b600080604083850312156148d357600080fd5b82519150602083015160ff811681146141b957600080fd5b60208082526026908201527f43616e206f6e6c792072756e20616674657220726f756e647a65726f537461726040820152651d149bdd5b9960d21b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600060018201614959576149596145e5565b5060010190565b60008261497d57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561499457600080fd5b5051919050565b6020808252600e908201526d24b73b30b634b21021b0b63632b960911b604082015260600190565b6020808252602c908201527f42657420616d6f756e74206d7573742062652067726561746572207468616e2060408201526b1b5a5b90995d105b5bdd5b9d60a21b606082015260800190565b84815260808101614a2360208301866143c6565b836040830152821515606083015295945050505050565b600181815b80851115614a75578160001904821115614a5b57614a5b6145e5565b80851615614a6857918102915b93841c9390800290614a3f565b509250929050565b600082614a8c575060016109d9565b81614a99575060006109d9565b8160018114614aaf5760028114614ab957614ad5565b60019150506109d9565b60ff841115614aca57614aca6145e5565b50506001821b6109d9565b5060208310610133831016604e8410600b8410161715614af8575081810a6109d9565b614b028383614a3a565b8060001904821115614b1657614b166145e5565b029392505050565b60006119538383614a7d565b60005b83811015614b45578181015183820152602001614b2d565b83811115614b54576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614b92816017850160208801614b2a565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614bc3816028840160208801614b2a565b01602801949350505050565b6020815260008251806020840152614bee816040850160208701614b2a565b601f01601f19169190910160400192915050565b600081614c1157614c116145e5565b50600019019056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220c65b8ddce90379cac2dfda2075a83dfa54f60801fa07c79276e63365e31b4bf964736f6c634300080d003300000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000002416b806ceb7dab5852cfb967e095a6ed8aea6700000000000000000000000004ba5833eb046367049d7b0d3bb96ce63d8973e9c00000000000000000000000048aeef61673b64848f5e2b65e728da2b7e76429c000000000000000000000000c54f1c84d33421f878c59f00a04fb833cc8f1adf000000000000000000000000000000000000000000000000000000000000038445544800000000000000000000000000000000000000000000000000000000005553440000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061031e5760003560e01c80637b3205f5116101ab578063d547741f116100f7578063f2b3c80911610095578063f7b188a51161006f578063f7b188a51461093d578063fa65cb0414610952578063fb2f897a14610972578063fc572b181461099257600080fd5b8063f2b3c809146108e6578063f5032980146108fb578063f5b541a61461091b57600080fd5b8063e8712bd4116100d1578063e8712bd41461085c578063ec87621c1461087c578063ee5f8c8f146108b0578063efc3b2ea146108c657600080fd5b8063d547741f146107ef578063e0e081d71461080f578063e44bb72f1461084957600080fd5b8063a217fddf11610164578063b3ab15fb1161013e578063b3ab15fb14610779578063b6705a5514610799578063bd9de03c146107b9578063cc32d176146107d957600080fd5b8063a217fddf14610724578063a23e988414610739578063ac8a584a1461075957600080fd5b80637b3205f5146106825780638456cb591461069757806391d14854146106ac5780639bb6eb70146106cc5780639cbe5efd146106ee578063a20037341461070457600080fd5b8063445769cd1161026a5780636d27c9db1161022357806377e741c7116101fd57806377e741c71461060c578063783cf3321461062c578063795c29601461064c57806379905dd51461066c57600080fd5b80636d27c9db146105b757806373343620146105d757806377e0181f146105f757600080fd5b8063445769cd146104f95780634b14c3d41461051957806357957f69146105395780635a9aa957146105595780635c975abb1461056f578063652b9b411461058757600080fd5b80632f2ff15d116102d757806335538b69116102b157806335538b691461048357806336568abe146104a3578063368acb09146104c357806340a20138146104d957600080fd5b80632f2ff15d14610415578063313ce56714610435578063325f700e1461044b57600080fd5b806301ffc9a71461032a57806309fffec01461035f57806310082c75146103745780631c389c28146103a4578063248a9ca3146103b7578063256b5a02146103f557600080fd5b3661032557005b600080fd5b34801561033657600080fd5b5061034a61034536600461413c565b6109a8565b60405190151581526020015b60405180910390f35b61037261036d366004614166565b6109df565b005b34801561038057600080fd5b50600d54600e5461038f919082565b60408051928352602083019190915201610356565b6103726103b2366004614194565b610b01565b3480156103c357600080fd5b506103e76103d2366004614166565b60009081526020819052604090206001015490565b604051908152602001610356565b34801561040157600080fd5b506103726104103660046141c4565b610b42565b34801561042157600080fd5b50610372610430366004614194565b610bd6565b34801561044157600080fd5b506103e7600b5481565b34801561045757600080fd5b50600f5461046b906001600160a01b031681565b6040516001600160a01b039091168152602001610356565b34801561048f57600080fd5b5061037261049e366004614166565b610c00565b3480156104af57600080fd5b506103726104be366004614194565b610d5c565b3480156104cf57600080fd5b506103e7600a5481565b3480156104e557600080fd5b506103726104f43660046141c4565b610dd6565b34801561050557600080fd5b50610372610514366004614166565b610e21565b34801561052557600080fd5b5060135461046b906001600160a01b031681565b34801561054557600080fd5b506103e76105543660046142ba565b610ed6565b34801561056557600080fd5b506103e760055481565b34801561057b57600080fd5b5060015460ff1661034a565b34801561059357600080fd5b5061034a6105a23660046141c4565b60126020526000908152604090205460ff1681565b3480156105c357600080fd5b506103726105d2366004614166565b611065565b3480156105e357600080fd5b506103726105f2366004614194565b61115b565b34801561060357600080fd5b506103726113ff565b34801561061857600080fd5b50610372610627366004614166565b61156b565b34801561063857600080fd5b50610372610647366004614166565b61162c565b34801561065857600080fd5b506103e7610667366004614359565b611862565b34801561067857600080fd5b506103e760085481565b34801561068e57600080fd5b5061037261195a565b3480156106a357600080fd5b50610372611be7565b3480156106b857600080fd5b5061034a6106c7366004614194565b611d89565b3480156106d857600080fd5b506106e1611db2565b60405161035691906143e8565b3480156106fa57600080fd5b506103e760035481565b34801561071057600080fd5b5061034a61071f3660046144c2565b611e8c565b34801561073057600080fd5b506103e7600081565b34801561074557600080fd5b506103726107543660046141c4565b611f07565b34801561076557600080fd5b506103726107743660046141c4565b611fa9565b34801561078557600080fd5b506103726107943660046141c4565b611fe9565b3480156107a557600080fd5b506103726107b4366004614166565b612108565b3480156107c557600080fd5b50600c5461046b906001600160a01b031681565b3480156107e557600080fd5b506103e760075481565b3480156107fb57600080fd5b5061037261080a366004614194565b6121be565b34801561081b57600080fd5b506006546108329060ff8082169161010090041682565b604080519215158352901515602083015201610356565b610372610857366004614194565b6121e3565b34801561086857600080fd5b5060115461046b906001600160a01b031681565b34801561088857600080fd5b506103e77f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b3480156108bc57600080fd5b506103e760045481565b3480156108d257600080fd5b5060105461046b906001600160a01b031681565b3480156108f257600080fd5b506103e7606481565b34801561090757600080fd5b506103726109163660046141c4565b61221b565b34801561092757600080fd5b506103e7600080516020614c1a83398151915281565b34801561094957600080fd5b506103726122d7565b34801561095e57600080fd5b5061037261096d366004614166565b6123be565b34801561097e57600080fd5b506103e761098d366004614359565b612477565b34801561099e57600080fd5b506103e760095481565b60006001600160e01b03198216637965db0b60e01b14806109d957506301ffc9a760e01b6001600160e01b03198316145b92915050565b6002805403610a095760405162461bcd60e51b8152600401610a0090614580565b60405180910390fd5b6002805533610a19600082611d89565b610a355760405162461bcd60e51b8152600401610a00906145b7565b600a54821115610a875760405162461bcd60e51b815260206004820152601c60248201527f5472616e7366657220616d6f756e7420697320746f6f206c61726765000000006044820152606401610a00565b81600a6000828254610a9991906145fb565b9091555050600f546001600160a01b0316610ab48184612612565b806001600160a01b03167fc9262544ea8cacb7a3eea4ea7b4023ea10ac8bc73701610edba13308190f9cb184604051610aef91815260200190565b60405180910390a25050600160025550565b610b0961261c565b6002805403610b2a5760405162461bcd60e51b8152600401610a0090614580565b60028055610b39828234612664565b50506001600255565b33610b4e600082611d89565b610b6a5760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b610bb15760405162461bcd60e51b815260206004820152600d60248201526c1a5b9d985b1a59081d985d5b1d609a1b6044820152606401610a00565b506001600160a01b03166000908152601260205260409020805460ff19166001179055565b600082815260208190526040902060010154610bf181612a0c565b610bfb8383612a19565b505050565b610c0861261c565b33610c21600080516020614c1a83398151915282611d89565b610c3d5760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff1615610ca45760405162461bcd60e51b815260206004820152602660248201527f43616e206f6e6c792072756e20726f756e647a65726f437265617465526f756e60448201526564206f6e636560d01b6064820152608401610a00565b600354610cb2906001614649565b60038190556005839055610cc69083612a9d565b6006805461ff001916610100179055600354610cfc90610ce7906001614649565b600454600554610cf79190614649565b612a9d565b610d296003546002610d0e9190614649565b600454600554610d1f908290614649565b610cf79190614649565b610d586003546003610d3b9190614649565b6004546005548190610d4e908290614649565b610d1f9190614649565b5050565b6001600160a01b0381163314610dcc5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a00565b610d588282612c69565b33610de2600082611d89565b610dfe5760405162461bcd60e51b8152600401610a00906145b7565b50601380546001600160a01b0319166001600160a01b0392909216919091179055565b610e29612cce565b33610e35600082611d89565b610e515760405162461bcd60e51b8152600401610a00906145b7565b60008211610e995760405162461bcd60e51b815260206004820152601560248201527404d757374206265207375706572696f7220746f203605c1b6044820152606401610a00565b60098290556040518281527f06a2e1014d8503fc3c899acda61fc50ab1918a70e8f904759a1f72f03bbd9cda906020015b60405180910390a15050565b60006002805403610ef95760405162461bcd60e51b8152600401610a0090614580565b600280556040805160208087028281018201909352868252610f3892889188918291850190849080828437600092019190915250879250612d17915050565b5060408301519091508015610f4d5750600081115b156110485760006040518060800160405280600081526020016004546002610f759190614661565b610f7f9042614649565b8152644d4154494360d81b6020808301919091528581015160409283015260135486518351630c44410b60e41b815285516004820152928501516024840152928401516044830152606084015160648301526001600160a01b03888116608484015260a483019390935292935091169063c44410b090849060c40160006040518083038185885af1158015611018573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526110419190810190614680565b5050611058565b80156110585761105883826130a4565b6001600255949350505050565b61106d61261c565b33611086600080516020614c1a83398151915282611d89565b6110a25760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff166110c95760405162461bcd60e51b8152600401610a0090614726565b60065460ff16156110ec5760405162461bcd60e51b8152600401610a009061477a565b60055442101561113e5760405162461bcd60e51b815260206004820152601d60248201527f526f756e642063616e6e6f742062652073746172746564206561726c790000006044820152606401610a00565b61114a60035483613147565b50506006805460ff19166001179055565b600280540361117c5760405162461bcd60e51b8152600401610a0090614580565b6002805560115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156111cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ef91906147ca565b9050600381602001516003811115611209576112096143b0565b146112565760405162461bcd60e51b815260206004820152601c60248201527f55736572206e6f7420656c696769626c6520666f7220726566756e64000000006044820152606401610a00565b601154604051630736449d60e11b8152600481018590526001600160a01b0384811660248301526000921690630e6c893a90604401606060405180830381865afa1580156112a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112cc9190614864565b9050806040015160001461131b5760405162461bcd60e51b81526020600482015260166024820152751499599d5b9908185b1c9958591e4818db185a5b595960521b6044820152606401610a00565b6020810151815160009161132e91614649565b905080156113f35760115460405163720988c960e11b8152600481018790526001600160a01b038681166024830152604482018490529091169063e413119290606401600060405180830381600087803b15801561138b57600080fd5b505af115801561139f573d6000803e3d6000fd5b505050506113ad84826130a4565b604080518281524260208201526001600160a01b0386169187917faba4210cad11f1112f31ba136a61cdc0f6ab4c2b478da8c93eec1d9769e97a89910160405180910390a35b50506001600255505050565b61140761261c565b33611420600080516020614c1a83398151915282611d89565b61143c5760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff166114635760405162461bcd60e51b8152600401610a0090614726565b60065460ff16156114865760405162461bcd60e51b8152600401610a009061477a565b6005544210156114d85760405162461bcd60e51b815260206004820152601d60248201527f526f756e642063616e6e6f742062652073746172746564206561726c790000006044820152606401610a00565b601054600d54600e546005546040516319f59e5f60e01b81526004810193909352602483019190915260448201526000916001600160a01b0316906319f59e5f906064016040805180830381865afa158015611538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155c91906148c0565b50905061114a60035482613147565b611573612cce565b3361157f600082611d89565b61159b5760405162461bcd60e51b8152600401610a00906145b7565b6000821180156115ab5750606482105b6115f75760405162461bcd60e51b815260206004820152601860248201527f54726561737572792066656520697320746f6f206869676800000000000000006044820152606401610a00565b60078290556040518281527f938d9272b26145999fe14f6124b73f122e1e023fc5de069c74ade1254408a97690602001610eca565b61163461261c565b3361164d600080516020614c1a83398151915282611d89565b6116695760405162461bcd60e51b8152600401610a0090614612565b600654610100900460ff168015611682575060065460ff165b61169e5760405162461bcd60e51b8152600401610a00906148eb565b60115460035460405163168a468560e11b815260048101919091526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156116ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171191906147ca565b601154600380549293506000926001600160a01b0390921691632d148d0a9161173a9190614649565b6040518263ffffffff1660e01b815260040161175891815260200190565b61016060405180830381865afa158015611776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179a91906147ca565b90506003826020015160038111156117b4576117b46143b0565b141580156117c157508315155b156117e2576117d26003548561331c565b6117dd6003546134e1565b611816565b6003826020015160038111156117fa576117fa6143b0565b14158015611806575083155b156118165761181660035461376e565b61182e60035460016118289190614649565b85613147565b61184b60035460046118409190614649565b826101400151612a9d565b600354611859906001614649565b60035550505050565b6000805b8381101561193f576011546000906001600160a01b0316630e6c893a87878581811061189457611894614931565b90506020020135866040518363ffffffff1660e01b81526004016118cb9291909182526001600160a01b0316602082015260400190565b606060405180830381865afa1580156118e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190c9190614864565b8051602082015191925061191f91614649565b6119299084614649565b925050808061193790614947565b915050611866565b508215611953576119508382614960565b90505b9392505050565b61196261261c565b600654610100900460ff16801561197b575060065460ff165b6119975760405162461bcd60e51b8152600401610a00906148eb565b60115460035460405163168a468560e11b815260048101919091526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156119e6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0a91906147ca565b601154600380549293506000926001600160a01b0390921691632d148d0a91611a339190614649565b6040518263ffffffff1660e01b8152600401611a5191815260200190565b61016060405180830381865afa158015611a6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9391906147ca565b601054600d54600e546101408601516040516319f59e5f60e01b81526004810193909352602483019190915260448201529192506000916001600160a01b03909116906319f59e5f906064016040805180830381865afa158015611afb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1f91906148c0565b509050600383602001516003811115611b3a57611b3a6143b0565b14158015611b4757508015155b15611b6857611b586003548261331c565b611b636003546134e1565b611b9c565b600383602001516003811115611b8057611b806143b0565b14158015611b8c575080155b15611b9c57611b9c60035461376e565b611bb46003546001611bae9190614649565b82613147565b611bd16003546004611bc69190614649565b836101400151612a9d565b600354611bdf906001614649565b600355505050565b611bef61261c565b33611bfb600082611d89565b611c175760405162461bcd60e51b8152600401610a00906145b7565b611c1f6138df565b6003545b601160009054906101000a90046001600160a01b03166001600160a01b03166311a8f4136040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9a9190614982565b8111611d4a5760115460405163168a468560e11b8152600481018390526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015611ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0f91906147ca565b9050600381602001516003811115611d2957611d296143b0565b14611d3757611d378261376e565b5080611d4281614947565b915050611c23565b507fa382c86dbb1fba726013556ec174337b8f9ddac70b97ddb00d2e79e8b565d4f5600354604051611d7e91815260200190565b60405180910390a150565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b611e106040805161016081019091526000808252602082019081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60115460035460405163168a468560e11b81526001600160a01b0390921691632d148d0a91611e459160040190815260200190565b61016060405180830381865afa158015611e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8791906147ca565b905090565b8051600090151580611ea15750602082015115155b8015611eaf57506040820151155b801561195357508260e00151836101000151118015611ece5750815115155b80611eef57508260e00151836101000151108015611eef5750602082015115155b806119535750505060e0810151610100909101511490565b33611f13600082611d89565b611f2f5760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b611f865760405162461bcd60e51b815260206004820152601960248201527f4e6f7420426861766973682041646d696e6973747261746f72000000000000006044820152606401610a00565b50600f80546001600160a01b0319166001600160a01b0392909216919091179055565b33611fb5600082611d89565b611fd15760405162461bcd60e51b8152600401610a00906145b7565b610d58600080516020614c1a833981519152836121be565b33611ff5600082611d89565b6120115760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b156120695760405162461bcd60e51b815260206004820152601d60248201527f4f70657261746f722063616e6e6f74206265206120636f6e74726163740000006044820152606401610a00565b6001600160a01b0382166120b85760405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606401610a00565b6120d0600080516020614c1a83398151915283610bd6565b6040516001600160a01b038316907fda12ee837e6978172aaf54b16145ffe08414fd8710092ef033c71b8eb6ec189a90600090a25050565b612110612cce565b3361211c600082611d89565b6121385760405162461bcd60e51b8152600401610a00906145b7565b60648211156121895760405162461bcd60e51b815260206004820152601f60248201527f5661756c7420646973636f756e74207065726320697320746f6f2068696768006044820152606401610a00565b60088290556040518281527f1c3d6aca04a9d74c524b053538418e96eafc310c8d049c2a44f001d1b0c03fc390602001610eca565b6000828152602081905260409020600101546121d981612a0c565b610bfb8383612c69565b6121eb61261c565b600280540361220c5760405162461bcd60e51b8152600401610a0090614580565b60028055610b39828234613933565b33612227600082611d89565b6122435760405162461bcd60e51b8152600401610a00906145b7565b6001600160a01b0382163b61228c5760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b6044820152606401610a00565b600c80546001600160a01b0319166001600160a01b0384169081179091556040517f98902aabfcbed99d0d9769f20db2c97ad70f69f67ca8811518d37b9e590e0e8890600090a25050565b6122df612cce565b336122eb600082611d89565b6123075760405162461bcd60e51b8152600401610a00906145b7565b6006805461ffff19169055601154604080516311a8f41360e01b815290516001600160a01b03909216916311a8f413916004808201926020929091908290030181865afa15801561235c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123809190614982565b60035561238b613ccb565b7f0b0e422893e2219d69c6fba12911d3b270235e96e9753519998fc13013ebb2ae600354604051611d7e91815260200190565b6123c6612cce565b336123df600080516020614c1a83398151915282611d89565b6123fb5760405162461bcd60e51b8152600401610a0090614612565b81600010801561240e5750620151808211155b6124715760405162461bcd60e51b815260206004820152602e60248201527f526f756e642054696d652073686f756c64206265206265747765656e2031207360448201526d656320746f20333630302073656360901b6064820152608401610a00565b50600455565b600080805b848110156125fa576011546000906001600160a01b0316632d148d0a8888858181106124aa576124aa614931565b905060200201356040518263ffffffff1660e01b81526004016124cf91815260200190565b61016060405180830381865afa1580156124ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251191906147ca565b6011549091506000906001600160a01b0316630e6c893a89898681811061253a5761253a614931565b90506020020135886040518363ffffffff1660e01b81526004016125719291909182526001600160a01b0316602082015260400190565b606060405180830381865afa15801561258e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b29190614864565b90506125be8282611e8c565b6125c95750506125e8565b60006125d58383613d04565b5090506125e28186614649565b94505050505b806125f281614947565b91505061247c565b50949350505050565b6001600160a01b03163b151590565b610d5882826130a4565b60015460ff16156126625760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610a00565b565b81336001600160a01b0382161461269f57600c546001600160a01b0316331461269f5760405162461bcd60e51b8152600401610a009061499b565b60115460405163168a468560e11b8152600481018690526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156126ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270e91906147ca565b9050600081602001516003811115612728576127286143b0565b1480156127355750805115155b6127795760405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606401610a00565b8061012001514211156127c65760405162461bcd60e51b81526020600482015260156024820152741c9bdd5b9908185b1c9958591e481cdd185c9d1959605a1b6044820152606401610a00565b6009548310156127e85760405162461bcd60e51b8152600401610a00906149c3565b60115460405163ec4773a760e01b81526004810187905260248101859052600160448201526001600160a01b039091169063ec4773a790606401600060405180830381600087803b15801561283c57600080fd5b505af1158015612850573d6000803e3d6000fd5b5050601154604051630736449d60e11b8152600481018990526001600160a01b038881166024830152600094509091169150630e6c893a90604401606060405180830381865afa1580156128a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128cc9190614864565b80519091501580156128e057506020810151155b1561294c57601154604051634a966a1b60e01b81526001600160a01b0387811660048301526024820189905290911690634a966a1b90604401600060405180830381600087803b15801561293357600080fd5b505af1158015612947573d6000803e3d6000fd5b505050505b6011546040516331e1f08360e11b815260048101869052602481018890526001600160a01b03878116604483015260016064830152909116906363c3e10690608401600060405180830381600087803b1580156129a857600080fd5b505af11580156129bc573d6000803e3d6000fd5b5050505085856001600160a01b03167f0bab430d5cfc26b856f9867d7019c5af92e6fb9f0eef60afadab9f0d53ff1fd3866040516129fc91815260200190565b60405180910390a3505050505050565b612a168133613dea565b50565b612a238282611d89565b610d58576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055612a593390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015612ae8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b0c91906147ca565b805190915015612b555760405162461bcd60e51b8152602060048201526014602482015273526f756e6420616c72656164792065786973747360601b6044820152606401610a00565b4260045483612b6491906145fb565b1015612bb25760405162461bcd60e51b815260206004820152601760248201527f526f756e642074696d6520697320746f6f2073686f72740000000000000000006044820152606401610a00565b8281526101208101829052600454612bca9083614649565b6101408201526000602082015260115460405163ad0197db60e01b81526001600160a01b039091169063ad0197db90612c079084906004016143e8565b600060405180830381600087803b158015612c2157600080fd5b505af1158015612c35573d6000803e3d6000fd5b50506040518592507f257b6e0c207001c05b4f0f88a5bc913e2c47513ab9989881a48ceea263b2a7219150600090a2505050565b612c738282611d89565b15610d58576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60015460ff166126625760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a00565b60008082336001600160a01b03821614612d5557600c546001600160a01b03163314612d555760405162461bcd60e51b8152600401610a009061499b565b60005b855181101561309b5760115486516000916001600160a01b031690632d148d0a90899085908110612d8b57612d8b614931565b60200260200101516040518263ffffffff1660e01b8152600401612db191815260200190565b61016060405180830381865afa158015612dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df391906147ca565b60115488519192506000916001600160a01b0390911690630e6c893a908a9086908110612e2257612e22614931565b6020026020010151896040518363ffffffff1660e01b8152600401612e5a9291909182526001600160a01b0316602082015260400190565b606060405180830381865afa158015612e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e9b9190614864565b9050600282602001516003811115612eb557612eb56143b0565b14612f025760405162461bcd60e51b815260206004820152601e60248201527f526f756e64206e6f7420656c696769626c6520666f72207265776172647300006044820152606401610a00565b6000826080015111612f4d5760405162461bcd60e51b8152602060048201526014602482015273139bc818995d1cc81a5b881d1a19481c9bdd5b9960621b6044820152606401610a00565b8161010001518260e0015103612fb257612f6682613e4e565b612fb25760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656c696769626c6520666f7220726566756e640000000000000000006044820152606401610a00565b612fbc8282611e8c565b1561308657600080612fce8484613d04565b6001600160a01b038b16600090815260126020526040902054919350915060ff161561300057612ffd82613e7e565b91505b835161300e908a8484613f2d565b6130188289614649565b97506130248188614649565b965089858151811061303857613038614931565b6020026020010151896001600160a01b03167f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf78460405161307b91815260200190565b60405180910390a350505b5050808061309390614947565b915050612d58565b50509250929050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146130f1576040519150601f19603f3d011682016040523d82523d6000602084013e6130f6565b606091505b5050905080610bfb5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610a00565b60115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015613192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b691906147ca565b9050816000036131c957610bfb8361376e565b6000816020015160038111156131e1576131e16143b0565b1461322e5760405162461bcd60e51b815260206004820152601760248201527f526f756e642073686f756c6420626520637265617465640000000000000000006044820152606401610a00565b4281610120015111156132835760405162461bcd60e51b815260206004820152601c60248201527f546f6f206561726c7920746f2073746172742074686520726f756e64000000006044820152606401610a00565b6011546040516352f3e91960e01b81526001600160a01b03909116906352f3e919906132ba90869060019087908290600401614a0f565b600060405180830381600087803b1580156132d457600080fd5b505af11580156132e8573d6000803e3d6000fd5b50506040518592507f939f42374aa9bf1d8d8cd56d8a9110cb040cd8dfeae44080c6fcf2645e51b4529150600090a2505050565b60115460405163168a468560e11b8152600481018490526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa158015613367573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061338b91906147ca565b90506001816020015160038111156133a5576133a56143b0565b146133f25760405162461bcd60e51b815260206004820152601860248201527f526f756e64206973206e6f7420737461727465642079657400000000000000006044820152606401610a00565b4281610140015111156134475760405162461bcd60e51b815260206004820152601a60248201527f546f6f206561726c7920746f20656e642074686520726f756e640000000000006044820152606401610a00565b6011546040516352f3e91960e01b81526001600160a01b03909116906352f3e9199061347f9086906002908790600090600401614a0f565b600060405180830381600087803b15801561349957600080fd5b505af11580156134ad573d6000803e3d6000fd5b50506040518592507f2c46d8d5cabadbc3b7c8644a09e45c97988bd5ee29b298d282a7ef8c1833d9129150600090a2505050565b60115460405163168a468560e11b8152600481018390526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa15801561352c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061355091906147ca565b905060028160200151600381111561356a5761356a6143b0565b146135ac5760405162461bcd60e51b8152602060048201526012602482015271149bdd5b99081a5cc81b9bdd08195b99195960721b6044820152606401610a00565b60006135b9826080015190565b90506000600b54600a6135cc9190614b1e565b60075484608001516135de9190614661565b6135e89190614960565b905060008360e00151846101000151111561363c57506040830151821580159061361157508183115b156136235761362082846145fb565b92505b806000036136375783606001519150600092505b613692565b8360e00151846101000151101561368b57506060830151821580159061366157508183115b156136735761367082846145fb565b92505b80600003613637578360400151915060009250613692565b5060009150815b81600a60008282546136a49190614649565b909155505060115460405163ddae3a7160e01b81526004810187905260248101859052604481018390526001600160a01b039091169063ddae3a7190606401600060405180830381600087803b1580156136fd57600080fd5b505af1158015613711573d6000803e3d6000fd5b505050506137248284612a169190614649565b604080518281526020810185905290810183905285907f6dfdfcb09c8804d0058826cd2539f1acfbe3cb887c9be03d928035bce0f1a58d9060600160405180910390a25050505050565b60115460405163168a468560e11b8152600481018390526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156137b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137dd91906147ca565b90506003816020015160038111156137f7576137f76143b0565b036138525760405162461bcd60e51b815260206004820152602560248201527f43616e6e6f742063616e63656c20616c72656164792063616e63656c6c6564206044820152641c9bdd5b9960da1b6064820152608401610a00565b601154604051637e07ab0960e01b8152600481018490526001600160a01b0390911690637e07ab0990602401600060405180830381600087803b15801561389857600080fd5b505af11580156138ac573d6000803e3d6000fd5b50506040518492507f1316afc2a7dc68d55247ceedbef28ffd97f61bafc159c949278f4b934d448c7b9150600090a25050565b6138e761261c565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a1565b81336001600160a01b0382161461396e57600c546001600160a01b0316331461396e5760405162461bcd60e51b8152600401610a009061499b565b60115460405163168a468560e11b8152600481018690526000916001600160a01b031690632d148d0a9060240161016060405180830381865afa1580156139b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139dd91906147ca565b9050806101200151421115613a2c5760405162461bcd60e51b81526020600482015260156024820152741c9bdd5b9908185b1c9958591e481cdd185c9d1959605a1b6044820152606401610a00565b600081602001516003811115613a4457613a446143b0565b148015613a515750805115155b613a955760405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606401610a00565b600954831015613ab75760405162461bcd60e51b8152600401610a00906149c3565b60115460405163ec4773a760e01b81526004810187905260248101859052600060448201526001600160a01b039091169063ec4773a790606401600060405180830381600087803b158015613b0b57600080fd5b505af1158015613b1f573d6000803e3d6000fd5b5050601154604051630736449d60e11b8152600481018990526001600160a01b038881166024830152600094509091169150630e6c893a90604401606060405180830381865afa158015613b77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b9b9190614864565b8051909150158015613baf57506020810151155b15613c1b57601154604051634a966a1b60e01b81526001600160a01b0387811660048301526024820189905290911690634a966a1b90604401600060405180830381600087803b158015613c0257600080fd5b505af1158015613c16573d6000803e3d6000fd5b505050505b6011546040516331e1f08360e11b815260048101869052602481018890526001600160a01b03878116604483015260006064830152909116906363c3e10690608401600060405180830381600087803b158015613c7757600080fd5b505af1158015613c8b573d6000803e3d6000fd5b5050505085856001600160a01b03167f546f54506a25044de11c4fb0c44fbd0137d87d7e08dfd800944453931428a5ea866040516129fc91815260200190565b613cd3612cce565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33613916565b6000808360e0015184610100015103613d725760208301518351600091613d2a91614649565b9050613d3585613e4e565b15613d6c57600b54613d4890600a614b1e565b600754613d559083614661565b613d5f9190614960565b613d6990826145fb565b92505b50613de3565b8360e001518461010001511115613dab5750815160a084015160c0850151613d9a9083614661565b613da49190614960565b9150613de3565b8360e001518461010001511015613de35750602082015160a084015160c0850151613dd69083614661565b613de09190614960565b91505b9250929050565b613df48282611d89565b610d5857613e0c816001600160a01b03166014613fa0565b613e17836020613fa0565b604051602001613e28929190614b5a565b60408051601f198184030181529082905262461bcd60e51b8252610a0091600401614bcf565b60008160a001516000148015613e66575060c0820151155b80156109d957505061010081015160e0909101511490565b6007548190600090613e92906103e86145fb565b613e9e846103e8614661565b613ea89190614960565b9050620186a06008546064613ebd91906145fb565b600754613eca9084614661565b613ed49190614661565b613ede9190614960565b613ee890826145fb565b9150613ef483836145fb565b600a541115613f2357613f0783836145fb565b600a6000828254613f1891906145fb565b90915550613f279050565b8291505b50919050565b60115460405163720988c960e11b8152600481018690526001600160a01b038581166024830152604482018590529091169063e413119290606401600060405180830381600087803b158015613f8257600080fd5b505af1158015613f96573d6000803e3d6000fd5b5050505050505050565b60606000613faf836002614661565b613fba906002614649565b67ffffffffffffffff811115613fd257613fd2614226565b6040519080825280601f01601f191660200182016040528015613ffc576020820181803683370190505b509050600360fc1b8160008151811061401757614017614931565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061404657614046614931565b60200101906001600160f81b031916908160001a905350600061406a846002614661565b614075906001614649565b90505b60018111156140ed576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106140a9576140a9614931565b1a60f81b8282815181106140bf576140bf614931565b60200101906001600160f81b031916908160001a90535060049490941c936140e681614c02565b9050614078565b5083156119535760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a00565b60006020828403121561414e57600080fd5b81356001600160e01b03198116811461195357600080fd5b60006020828403121561417857600080fd5b5035919050565b6001600160a01b0381168114612a1657600080fd5b600080604083850312156141a757600080fd5b8235915060208301356141b98161417f565b809150509250929050565b6000602082840312156141d657600080fd5b81356119538161417f565b60008083601f8401126141f357600080fd5b50813567ffffffffffffffff81111561420b57600080fd5b6020830191508360208260051b8501011115613de357600080fd5b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff8111828210171561425f5761425f614226565b60405290565b604051610160810167ffffffffffffffff8111828210171561425f5761425f614226565b604051601f8201601f1916810167ffffffffffffffff811182821017156142b2576142b2614226565b604052919050565b60008060008084860360a08112156142d157600080fd5b853567ffffffffffffffff8111156142e857600080fd5b6142f4888289016141e1565b90965094505060208601356143088161417f565b92506060603f198201121561431c57600080fd5b5061432561423c565b60408601358152606086013560208201526080860135801515811461434957600080fd5b6040820152939692955090935050565b60008060006040848603121561436e57600080fd5b833567ffffffffffffffff81111561438557600080fd5b614391868287016141e1565b90945092505060208401356143a58161417f565b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b600481106143e457634e487b7160e01b600052602160045260246000fd5b9052565b81518152602080830151610160830191614404908401826143c6565b5060408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151818401525061014080840151818401525092915050565b60048110612a1657600080fd5b80356144838161446b565b919050565b60006060828403121561449a57600080fd5b6144a261423c565b905081358152602082013560208201526040820135604082015292915050565b6000808284036101c08112156144d757600080fd5b610160808212156144e757600080fd5b6144ef614265565b91508435825261450160208601614478565b602083015260408501356040830152606085013560608301526080850135608083015260a085013560a083015260c085013560c083015260e085013560e083015261010080860135818401525061012080860135818401525061014080860135818401525081935061457586828701614488565b925050509250929050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526014908201527320b2323932b9b9903737ba1030b71030b236b4b760611b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561460d5761460d6145e5565b500390565b60208082526017908201527f41646472657373206e6f7420616e206f70657261746f72000000000000000000604082015260600190565b6000821982111561465c5761465c6145e5565b500190565b600081600019048311821515161561467b5761467b6145e5565b500290565b6000602080838503121561469357600080fd5b825167ffffffffffffffff808211156146ab57600080fd5b818501915085601f8301126146bf57600080fd5b8151818111156146d1576146d1614226565b8060051b91506146e2848301614289565b81815291830184019184810190888411156146fc57600080fd5b938501935b8385101561471a57845182529385019390850190614701565b98975050505050505050565b60208082526034908201527f43616e206f6e6c792072756e20616674657220726f756e647a65726f437265616040820152731d19549bdd5b99081a5cc81d1c9a59d9d95c995960621b606082015260800190565b60208082526025908201527f43616e206f6e6c792072756e20726f756e647a65726f5374617274526f756e64604082015264206f6e636560d81b606082015260800190565b80516144838161446b565b600061016082840312156147dd57600080fd5b6147e5614265565b825181526147f5602084016147bf565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152506101408084015181830152508091505092915050565b60006060828403121561487657600080fd5b6040516060810181811067ffffffffffffffff8211171561489957614899614226565b80604052508251815260208301516020820152604083015160408201528091505092915050565b600080604083850312156148d357600080fd5b82519150602083015160ff811681146141b957600080fd5b60208082526026908201527f43616e206f6e6c792072756e20616674657220726f756e647a65726f537461726040820152651d149bdd5b9960d21b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600060018201614959576149596145e5565b5060010190565b60008261497d57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561499457600080fd5b5051919050565b6020808252600e908201526d24b73b30b634b21021b0b63632b960911b604082015260600190565b6020808252602c908201527f42657420616d6f756e74206d7573742062652067726561746572207468616e2060408201526b1b5a5b90995d105b5bdd5b9d60a21b606082015260800190565b84815260808101614a2360208301866143c6565b836040830152821515606083015295945050505050565b600181815b80851115614a75578160001904821115614a5b57614a5b6145e5565b80851615614a6857918102915b93841c9390800290614a3f565b509250929050565b600082614a8c575060016109d9565b81614a99575060006109d9565b8160018114614aaf5760028114614ab957614ad5565b60019150506109d9565b60ff841115614aca57614aca6145e5565b50506001821b6109d9565b5060208310610133831016604e8410600b8410161715614af8575081810a6109d9565b614b028383614a3a565b8060001904821115614b1657614b166145e5565b029392505050565b60006119538383614a7d565b60005b83811015614b45578181015183820152602001614b2d565b83811115614b54576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614b92816017850160208801614b2a565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614bc3816028840160208801614b2a565b01602801949350505050565b6020815260008251806020840152614bee816040850160208701614b2a565b601f01601f19169190910160400192915050565b600081614c1157614c116145e5565b50600019019056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220c65b8ddce90379cac2dfda2075a83dfa54f60801fa07c79276e63365e31b4bf964736f6c634300080d0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000002416b806ceb7dab5852cfb967e095a6ed8aea6700000000000000000000000004ba5833eb046367049d7b0d3bb96ce63d8973e9c00000000000000000000000048aeef61673b64848f5e2b65e728da2b7e76429c000000000000000000000000c54f1c84d33421f878c59f00a04fb833cc8f1adf000000000000000000000000000000000000000000000000000000000000038445544800000000000000000000000000000000000000000000000000000000005553440000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _minPredictAmount (uint256): 1000000000000000
Arg [1] : _treasuryFee (uint256): 30
Arg [2] : _bhavishAdmin (address): 0x2416b806ceB7daB5852CFB967E095A6ed8AEA670
Arg [3] : _bhavishPriceManager (address): 0x4BA5833eB046367049d7b0d3bb96ce63d8973e9c
Arg [4] : _bhavishPredictionStorage (address): 0x48aEEf61673B64848f5E2B65e728DA2b7E76429c
Arg [5] : _bhavishSwap (address): 0xC54F1C84d33421f878c59F00A04Fb833CC8f1ADF
Arg [6] : _roundTime (uint256): 900
Arg [7] : _underlying (bytes32): 0x4554480000000000000000000000000000000000000000000000000000000000
Arg [8] : _strike (bytes32): 0x5553440000000000000000000000000000000000000000000000000000000000

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000038d7ea4c68000
Arg [1] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [2] : 0000000000000000000000002416b806ceb7dab5852cfb967e095a6ed8aea670
Arg [3] : 0000000000000000000000004ba5833eb046367049d7b0d3bb96ce63d8973e9c
Arg [4] : 00000000000000000000000048aeef61673b64848f5e2b65e728da2b7e76429c
Arg [5] : 000000000000000000000000c54f1c84d33421f878c59f00a04fb833cc8f1adf
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000384
Arg [7] : 4554480000000000000000000000000000000000000000000000000000000000
Arg [8] : 5553440000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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