Contract 0x93450623fdc065cba2bbc2004f1f186204bb2d68

Contract Overview

Balance:
0 BNB
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xac846097f37de43db50c36a0a7fec6dfb00989bf85b0cd745ee2dec0533d2a650x6080604091782342021-05-26 11:31:52187 days 19 hrs ago0x2ee51f0bcc1ece7b94091e5e250b08e8276256d9 IN  Contract Creation0 BNB0.0566214
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xe0af4a18b9cd35cd06c370d854a1e2f7c500d1ea7925f3f745573a4cd91650db91785002021-05-26 11:45:10187 days 18 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x1e2b89a173d7cff7d013055deb3dfb7b6075b4e32bd57168a6b63f125edd816591784852021-05-26 11:44:25187 days 18 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x3d091bba9c9ebf25297d8448a14b81eefdbda2b0984c4bbb6e242d4506a4bcb691784672021-05-26 11:43:31187 days 18 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0xe10ba4672dde0403f33d31d6a36221447bb8960b278aa452201bee81cea7438491784482021-05-26 11:42:34187 days 18 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x18614fcd8fcfc7959b76fbd911518bd68500816799aa2e37bccbe1b9ee9c712691784302021-05-26 11:41:40187 days 18 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x31a6274a4b43a76a68bbcf65f6d42c0d402feb0e50986931f659a97da64557c991784132021-05-26 11:40:49187 days 18 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0xb3e51b64a7a784f7e77385f763b4a885f76085ad9cf62500941b20e6e8bfca5691783962021-05-26 11:39:58187 days 18 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x81f85a5fb4472a6e8b11c7f0879ba044143e3b22eb97fa4385fbdaac6c6a1d0a91783782021-05-26 11:39:04187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x18ee0f90732f8f2764b2145f4113a49bd8ae7e19699f9121bba70843dc65a0d691783622021-05-26 11:38:16187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x015cc678b6c612882ad6d528bb4829a7c1c559ecb0ff08a34583d386249d0be991783462021-05-26 11:37:28187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0xac383a9d9c47b0e670576de3b101db9797da9fa2b03e5f404f299ee54ecf49fb91783282021-05-26 11:36:34187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x0b338318909793de91d5b2ce4554fc7c2c932aa8f6833fe26c759a13744b7e1391783122021-05-26 11:35:46187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x26f3c605df7ef8d28f51347ff1bf7cb9ea1ed67a86f6dee11d5253ac2009f9df91783032021-05-26 11:35:19187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x1547c65945247eb4baa863202c3c310f48b6888a533964f99df4689a8f49cc7c91783002021-05-26 11:35:10187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x56a874e4a7bdbfa31aa194d4a69c83c41a3530bdfcd058bd0c102e7610572e5c91782962021-05-26 11:34:58187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0xbe387401ca3951ecd52265a2ef9ecb0a28af2574b2db44ff26b58ec5c468405d91782922021-05-26 11:34:46187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x6c233f590fa1592fcf97fbc9ea61cef60c27e7538be622dcd138d30f05231abd91782882021-05-26 11:34:34187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x5d1c030f3b7f6ed0a028c40ab28ce7ac288bf0ab7c7c6d5c2ea6d62a8613350c91782832021-05-26 11:34:19187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x0d3754995550611d7163a69f0727ac068667dd4dd25c19bee53fadbc0a8d172b91782772021-05-26 11:34:01187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x77fd60cafdcbf045ca1ef7a734a120efca727cba00d41ee0e1d20af96af0716991782742021-05-26 11:33:52187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0xd8440ec4a1963a486d39d197bf0dea335515c7a2928c2668d447a3da94ce048491782702021-05-26 11:33:40187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x32ab0eb3f2a8cf2ff5be0e12360148dee223850692b4b194546221242afaf3e691782662021-05-26 11:33:28187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0xb19d0e10a17d9a2fd3a9222f209ffcf09276d759bfb069419549cc8cbb29449191782622021-05-26 11:33:16187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x7c814011480d11bcfd032c6df5d8a28e4b025bed290519fe0c31cd508cb4d4ee91782582021-05-26 11:33:04187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
0x94de1b32378bcba196a74253d8d388f98a1450351fc9cf241240e344061f692d91782542021-05-26 11:32:52187 days 19 hrs ago 0xaa50f087c31b8901db4d7d7b5086ed6b6ff21c3b 0x93450623fdc065cba2bbc2004f1f186204bb2d680 BNB
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Register

Compiler Version
v0.8.2+commit.661d1103

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 30 : Register.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./dependencies/libraries/InitializableAdminUpgradeabilityProxy.sol";

import "./interfaces/IRegister.sol";
import "./MarsPredictionMarket.sol";
import "./MarsERC20OutcomeToken.sol";
import "./MarsPredictionMarketFactory.sol";
import "./Settlement.sol";
import "./Parameters.sol";

import "./libraries/Market.sol";

contract Register is IRegister, Initializable, OwnableUpgradeable {
    CategoryInfo[] categories;
    MilestoneInfo[] milestones;
    PredictionInfo[] predictionMarkets;
    OutcomeInfo[] outcomes;

    Settlement settlement;
    Parameters parameters;

    mapping(bytes16 => uint256) public slot;

    function initialize(address _settlement, address _parameters) external initializer {
        __Ownable_init();

        settlement = Settlement(_settlement);
        parameters = Parameters(_parameters);
    }

    function updateCategory(
        bytes16 uuid,
        uint8 position,
        string calldata name,
        string calldata description
    ) external override onlyOwner {
        CategoryInfo memory category;
        category.id = uuid;
        category.position = position;
        category.name = name;
        category.description = description;

        categories.push(category);
        slot[uuid] = categories.length - 1;

        emit CategoryUpdatedEvent(uuid, position, name, description);
    }

    function updateMilestone(
        bytes16 uuid,
        bytes16 categoryUuid,
        uint8 position,
        string calldata name,
        string calldata description,
        MilestoneStatus status
    ) external override onlyOwner {
        MilestoneInfo memory milestone;
        milestone.id = uuid;
        milestone.category = categoryUuid;
        milestone.position = position;
        milestone.name = name;
        milestone.description = description;
        milestone.status = status;

        milestones.push(milestone);
        slot[uuid] = milestones.length - 1;

        emit MilestoneUpdatedEvent(uuid, categoryUuid, position, name, description, status);
    }

    function registerMarket(
        address addr,
        bytes16 milestoneUuid,
        uint8 position,
        string calldata name,
        string calldata description,
        address token,
        uint256 dueDate,
        uint256 predictionTimeEnd,
        Market.Outcome[] calldata outcomes
    ) external override onlyOwner returns (address) {
        require(dueDate > block.timestamp, "MARS: Invalid prediction market due date");

        PredictionInfo memory market;

        market.id = addr;
        market.milestone = milestoneUuid;
        market.position = position;
        market.name = name;
        market.description = description;
        market.token = token;
        market.dueDate = dueDate;

        predictionMarkets.push(market);
        emit PredictionMarketRegisteredEvent(milestoneUuid, position, name, description, token, dueDate, market.id);

        for (uint256 i = 0; i < outcomes.length; i++) addOutcome(market.id, outcomes[i].uuid, outcomes[i].position, outcomes[i].name);

        return market.id;
    }

    function addOutcome(
        address prediction,
        bytes16 id,
        uint8 position,
        string calldata name
    ) public onlyOwner {
        OutcomeInfo memory outcome;
        outcome.id = id;
        outcome.prediction = prediction;
        outcome.position = position;
        outcome.name = name;

        outcomes.push(outcome);
        slot[id] = outcomes.length - 1;

        emit OutcomeChangedEvent(id, prediction, position, name);
    }

    function getPredictionData(uint256 _currentTime)
        external
        view
        override
        returns (
            CategoryInfo[] memory,
            MilestoneInfo[] memory,
            PredictionInfo[] memory,
            OutcomeInfo[] memory
        )
    {
        PredictionInfo[] memory pred = new PredictionInfo[](predictionMarkets.length);
        OutcomeInfo[] memory out = new OutcomeInfo[](outcomes.length);

        uint256 oracleSettlementTimeout = parameters.getOracleSettlementPeriod();
        uint256 disputeTimeout = parameters.getDisputePeriod();

        for (uint256 i = 0; i < predictionMarkets.length; i++) {
            pred[i] = predictionMarkets[i];

            uint256 predictionTimeEnd = MarsPredictionMarket(pred[i].id).getPredictionTimeEnd();

            if (
                MarsPredictionMarket(pred[i].id).winningOutcome() != bytes16(0) ||
                (pred[i].dueDate + oracleSettlementTimeout + disputeTimeout < _currentTime && settlement.reachedConsensus(pred[i].id))
            ) pred[i].state = PredictionMarketState.Closed;
            else if (predictionTimeEnd < _currentTime && _currentTime < pred[i].dueDate) pred[i].state = PredictionMarketState.Waiting;
            else if (predictionTimeEnd > _currentTime) pred[i].state = PredictionMarketState.Open;
            else pred[i].state = PredictionMarketState.Settlement;

            pred[i].predictorsNumber = MarsPredictionMarket(pred[i].id).predictorsNumber();
            pred[i].predictionTimeEnd = predictionTimeEnd;
        }

        for (uint256 i = 0; i < outcomes.length; i++) {
            out[i] = outcomes[i];

            out[i].stakedAmount = MarsERC20OutcomeToken(MarsPredictionMarket(outcomes[i].prediction).tokenOutcomeAddress(outcomes[i].id))
                .totalStakedAmount();
            out[i].winning = MarsPredictionMarket(outcomes[i].prediction).winningOutcome() == outcomes[i].id ? 1 : 0;
        }

        return (categories, milestones, pred, out);
    }
}

File 2 of 30 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal initializer {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
    uint256[49] private __gap;
}

File 3 of 30 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 4 of 30 : InitializableAdminUpgradeabilityProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "./BaseAdminUpgradeabilityProxy.sol";
import "./InitializableUpgradeabilityProxy.sol";

/**
 * @title InitializableAdminUpgradeabilityProxy
 * @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for
 * initializing the implementation, admin, and init data.
 */
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy {
    /**
     * Contract initializer.
     * @param _logic address of the initial implementation.
     * @param _admin Address of the proxy administrator.
     * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
     * It should include the signature and the parameters of the function to be called, as described in
     * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
     * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
     */
    function initialize(
        address _logic,
        address _admin,
        bytes memory _data
    ) public payable {
        require(_implementation() == address(0));
        InitializableUpgradeabilityProxy.initialize(_logic, _data);
        assert(ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
        _setAdmin(_admin);
    }

    function _willFallback() internal virtual override(BaseAdminUpgradeabilityProxy, Proxy) {
        super._willFallback();
    }
}

File 5 of 30 : IRegister.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "../libraries/Market.sol";

interface IRegister {
    enum MilestoneStatus {Historical, Current, Future}
    enum PredictionMarketState {Open, Settlement, Closed, Waiting}

    struct CategoryInfo {
        bytes16 id;
        uint256 position;
        string name;
        string description;
    }

    struct MilestoneInfo {
        bytes16 id;
        bytes16 category;
        uint256 position;
        string name;
        string description;
        MilestoneStatus status;
    }

    struct PredictionInfo {
        address id;
        bytes16 milestone;
        uint256 position;
        string name;
        string description;
        PredictionMarketState state;
        address token;
        uint256 dueDate;
        uint256 predictionTimeEnd;
        uint256 predictorsNumber;
    }

    struct OutcomeInfo {
        bytes16 id;
        address prediction;
        uint256 position;
        string name;
        uint256 stakedAmount;
        uint8 winning;
    }

    event CategoryUpdatedEvent(bytes16 uuid, uint8 position, string name, string description);

    event MilestoneUpdatedEvent(
        bytes16 uuid,
        bytes16 categoryUuid,
        uint8 position,
        string name,
        string description,
        MilestoneStatus status
    );
    event PredictionMarketRegisteredEvent(
        bytes16 milestoneUuid,
        uint8 position,
        string name,
        string description,
        address token,
        uint256 dueDate,
        address contractAddress
    );
    event OutcomeChangedEvent(bytes16 uuid, address predictionMarket, uint8 position, string name);

    function updateCategory(
        bytes16 uuid,
        uint8 position,
        string calldata name,
        string calldata description
    ) external;

    function updateMilestone(
        bytes16 uuid,
        bytes16 categoryUuid,
        uint8 position,
        string calldata name,
        string calldata description,
        MilestoneStatus status
    ) external;

    function registerMarket(
        address addr,
        bytes16 milestoneUuid,
        uint8 position,
        string calldata name,
        string calldata description,
        address token,
        uint256 dueDate,
        uint256 predictionTimeEnd,
        Market.Outcome[] calldata outcomes
    ) external returns (address);

    function getPredictionData(uint256 _currentTime)
        external
        view
        returns (
            CategoryInfo[] memory,
            MilestoneInfo[] memory,
            PredictionInfo[] memory,
            OutcomeInfo[] memory
        );
}

File 6 of 30 : MarsPredictionMarket.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import "./MarsERC20OutcomeToken.sol";
import "./interfaces/IPredictionMarket.sol";
import "./libraries/Market.sol";
import "./Parameters.sol";
import "./interfaces/ISettlement.sol";

contract MarsPredictionMarket is IPredictionMarket, Initializable, OwnableUpgradeable {
    bytes16[] outcomes;

    uint256 public predictionTimeStart;
    uint256 public predictionTimeEnd;
    uint256 public predictorsNumber;

    uint256 public startSharePrice;
    uint256 public endSharePrice;

    IERC20 public token; //ERC20 token used to buy shares for outcomes
    bytes16 public winningOutcome;

    uint256 public oracleFeeAccumulated;
    uint256 public protocolFeeAccumulated;

    mapping(bytes16 => address) public tokenOutcomeAddress;
    //outcome => address of token
    uint256 public totalPredicted;
    //sum from all predictors on all outcomes
    mapping(address => bool) public claimed;

    ISettlement settlement;
    Parameters parameters;

    function initialize(
        address _token,
        uint256 _predictionTimeEnd,
        Market.Outcome[] memory outcomes,
        address owner,
        uint256 _startSharePrice,
        uint256 _endSharePrice
    ) external initializer {
        __Ownable_init();
        transferOwnership(owner);

        predictionTimeStart = block.timestamp;
        predictionTimeEnd = _predictionTimeEnd;

        require(predictionTimeEnd > predictionTimeStart, "Endtime has to be more then start time");

        for (uint256 i = 0; i < outcomes.length; i++) {
            _addOutcome(outcomes[i].uuid, outcomes[i].position, outcomes[i].name);
        }

        // settlement = ISettlement(_settlement);
        token = IERC20(_token);

        startSharePrice = _startSharePrice;
        endSharePrice = _endSharePrice;
    }

    function roundWeek(uint256 _date) internal pure returns (uint256) {
        return (_date / 7 days) * 7 days;
    }

    function getSharePrice(uint256 _currentTime) external view override returns (uint256) {
        return _getSharePrice(_currentTime);
    }

    function _getSharePrice(uint256 _currentTime) internal view returns (uint256) {
        if (_currentTime > predictionTimeEnd || _currentTime < predictionTimeStart) return 0;
        return (((endSharePrice - startSharePrice) / (predictionTimeEnd - predictionTimeStart)) *
            (roundWeek(_currentTime - predictionTimeStart)) +
            startSharePrice);
    }

    function getUserPredictionState(address _wallet, uint256 _currentTime)
        external
        view
        override
        returns (Market.UserOutcomeInfo[] memory)
    {
        Market.UserOutcomeInfo[] memory app = new Market.UserOutcomeInfo[](outcomes.length);

        uint256 protocolFee = parameters.getProtocolFee();
        uint256 oracleFee = parameters.getOracleFee();
        uint256 divisor = parameters.getDivisor();
        uint256 notFee = divisor - protocolFee - oracleFee;

        for (uint256 i = 0; i < outcomes.length; i++) {
            bytes16 outcomesId = outcomes[i];
            address outcome = tokenOutcomeAddress[outcomesId];

            app[i].outcomeUuid = outcomesId;
            app[i].stakeAmount = MarsERC20OutcomeToken(outcome).stakedAmount(_wallet);
            uint256 totalSupply = MarsERC20OutcomeToken(outcome).totalSupply();
            if (totalSupply != 0) {
                if (winningOutcome == bytes16(0) || winningOutcome == outcomesId)
                    app[i].currentReward = (MarsERC20OutcomeToken(outcome).balanceOf(_wallet) * totalPredicted) / totalSupply;
            }
            //else app[i].currentReward = 0, but that goes by default
            app[i].rewardReceived = outcomesId == winningOutcome ? claimed[_wallet] : false;

            uint256 _outcomeBalance = MarsERC20OutcomeToken(outcome).totalSupply();
            app[i].outcomeBalance = _outcomeBalance;
            _outcomeBalance = _outcomeBalance == 0 ? 1 : _outcomeBalance;

            app[i].suspended = _currentTime > predictionTimeEnd ||
                _currentTime < predictionTimeStart ||
                !_isPredictionProfitable(outcomesId, _currentTime, notFee, divisor)
                ? true
                : false;
            app[i].sharePrice = _getSharePrice(_currentTime);
        }
        return app;
    }

    function addOutcome(
        bytes16 uuid,
        uint8 position,
        string memory name
    ) external override onlyOwner {
        _addOutcome(uuid, position, name);
    }

    function _addOutcome(
        bytes16 uuid,
        uint8 position,
        string memory name
    ) internal {
        outcomes.push(uuid);

        MarsERC20OutcomeToken newToken = new MarsERC20OutcomeToken("Mars Economy outcome token", 18, "MPO", owner());
        tokenOutcomeAddress[uuid] = address(newToken);
    }

    function collectOracleFee() external override {
        require(settlement.oracleCorrectlyVoted(address(this), msg.sender));

        uint256 correctlyVoted = settlement.getCorrectlyVotedCount(address(this));

        require(token.transfer(msg.sender, oracleFeeAccumulated / correctlyVoted), "Failed to transfer amount");
    }

    function collectProtocolFee() external override onlyOwner {
        if (settlement.getCorrectlyVotedCount(address(this)) == 0 && winningOutcome != bytes16(0)) {
            require(token.transfer(parameters.getReceiver(), oracleFeeAccumulated + protocolFeeAccumulated), "Failed to transfer amount");
            oracleFeeAccumulated = 0;
        } else require(token.transfer(parameters.getReceiver(), protocolFeeAccumulated), "Failed to transfer amount");
        protocolFeeAccumulated = 0;
    }

    function getReward() external override {
        bytes16 _winningOutcome = winningOutcome;
        if (_winningOutcome == bytes16(0)) {
            _winningOutcome = settlement.getWinningOutcome(address(this));
            winningOutcome = _winningOutcome;
        }

        require(claimed[msg.sender] == false, "User already claimed");

        claimed[msg.sender] = true;

        uint256 userOutcomeTokens = MarsERC20OutcomeToken(tokenOutcomeAddress[_winningOutcome]).balanceOf(msg.sender);
        uint256 outcomeBalance = MarsERC20OutcomeToken(tokenOutcomeAddress[_winningOutcome]).totalSupply();

        outcomeBalance = outcomeBalance == 0 ? 1 : outcomeBalance;

        uint256 reward = (userOutcomeTokens * totalPredicted) / outcomeBalance;
        //amount of tokens the owner put on the winning outcome * amount of tokens put by all owners on all outcomes
        // / amount of tokens all owners put on the winning outcome

        require(
            MarsERC20OutcomeToken(tokenOutcomeAddress[_winningOutcome]).transferFrom(msg.sender, address(this), userOutcomeTokens),
            "MARS: Failed to transfer from buyer"
        );

        require(token.transfer(msg.sender, reward), "MARS: Failed to transfer to buyer");
    }

    function setPredictionTimeEnd(uint256 _newValue) external override onlyOwner {
        require(_newValue < predictionTimeEnd, "MARKET: CAN ONLY DECREASE predictionTimeEnd");
        require(predictionTimeEnd > predictionTimeStart, "Endtime has to be more then start time");
        predictionTimeEnd = _newValue;
    }

    function getNumberOfOutcomes() external view override returns (uint256) {
        return outcomes.length;
    }

    function getPredictionTimeEnd() external view override returns (uint256) {
        return predictionTimeEnd;
    }

    function predict(bytes16 _outcome, uint256 _amount) external override outcomeDefined(_outcome) {
        require(block.timestamp < predictionTimeEnd, "MARS: Prediction time has passed");
        require(token.transferFrom(msg.sender, address(this), _amount), "MARS: Failed to transfer from buyer");

        uint256 protocolFee = parameters.getProtocolFee();
        uint256 oracleFee = parameters.getOracleFee();
        uint256 divisor = parameters.getDivisor();

        uint256 notFee = divisor - protocolFee - oracleFee;

        uint256 _amountWithFee = (_amount * notFee * 1_000_000) / divisor / _getSharePrice(block.timestamp);
        oracleFeeAccumulated += (_amount * oracleFee) / divisor;
        protocolFeeAccumulated += (_amount * protocolFee) / divisor;

        require(
            MarsERC20OutcomeToken(tokenOutcomeAddress[_outcome]).mint(msg.sender, _amountWithFee, (_amount * notFee) / divisor),
            "MARS: Failed to transfer to buyer"
        );

        predictorsNumber += 1;
        totalPredicted += (_amount * notFee) / divisor;

        require(_isPredictionProfitable(_outcome, block.timestamp, notFee, divisor), "Prediction is not profitable");
        emit PredictionEvent(msg.sender, _outcome, _amountWithFee);
    }

    function isPredictionProfitable(
        bytes16 _outcome,
        uint256 _currentTime,
        uint256 notFee,
        uint256 feeDivisor
    ) external view override returns (bool) {
        return _isPredictionProfitable(_outcome, _currentTime, notFee, feeDivisor);
    }

    function _isPredictionProfitable(
        bytes16 _outcome,
        uint256 _currentTime,
        uint256 notFee,
        uint256 feeDivisor
    ) internal view returns (bool) {
        uint256 outcomeBalance = MarsERC20OutcomeToken(tokenOutcomeAddress[_outcome]).totalSupply();

        if (outcomeBalance != 0)
            return !((_getSharePrice(_currentTime) * notFee) / feeDivisor > (totalPredicted * 1_000_000) / outcomeBalance + 1); //+1 in case of rounding
        return true;
    }

    modifier outcomeDefined(bytes16 _outcome) {
        require(tokenOutcomeAddress[_outcome] != address(0), "Mars: outcome not defined");
        _;
    }

    function setSettlement(address _newSettlement) external override onlyOwner {
        settlement = ISettlement(_newSettlement);
    }

    function getTokenOutcomeAddress(bytes16 outcomeUuid) external view override returns (address) {
        return tokenOutcomeAddress[outcomeUuid];
    }

    function setParameters(address _newParameters) external override onlyOwner {
        parameters = Parameters(_newParameters);
    }
}

File 7 of 30 : MarsERC20OutcomeToken.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MarsERC20OutcomeToken is ERC20, Ownable {
    mapping(address => uint256) stakeAmount;
    uint256 public totalStakedAmount;

    constructor(
        string memory _tokenName,
        uint8 _decimalUnits,
        string memory _tokenSymbol,
        address owner
    ) ERC20(_tokenName, _tokenSymbol) {
        // transferOwnership(owner);
    }

    // function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
    //     if (from == address(0) || to == address(0))
    //         require(msg.sender == owner());
    // }

    function mint(
        address _account,
        uint256 _amount,
        uint256 _stakeAmount
    ) external onlyOwner returns (bool) {
        stakeAmount[_account] += _stakeAmount;
        totalStakedAmount += _stakeAmount;
        _mint(_account, _amount);

        return true;
    }

    function transferStakeShare(
        address _sender,
        address _recipient,
        uint256 _amount
    ) internal {
        uint256 balance = balanceOf(_sender);
        uint256 _stakedAmount;
        if (balance != 0) {
            _stakedAmount = (_amount * stakeAmount[_sender]) / balanceOf(_sender);

            stakeAmount[_sender] -= _stakedAmount;
            stakeAmount[_recipient] += _stakedAmount;
        }
    }

    function transfer(address recipient, uint256 amount) public override returns (bool) {
        transferStakeShare(msg.sender, recipient, amount);
        super.transfer(recipient, amount);

        return true;
    }

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public override returns (bool) {
        transferStakeShare(sender, recipient, amount);
        super.transferFrom(sender, recipient, amount);

        return true;
    }

    function stakedAmount(address _wallet) external view returns (uint256) {
        return stakeAmount[_wallet];
    }
}

File 8 of 30 : MarsPredictionMarketFactory.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

// import "./dependencies/libraries/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
// import "./dependencies/libraries/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./dependencies/libraries/InitializableAdminUpgradeabilityProxy.sol";

import "./interfaces/IPredictionMarketFactory.sol";
import "./interfaces/IAddressResolver.sol";
import "./MarsPredictionMarket.sol";
import "./libraries/Market.sol";

import "hardhat/console.sol"; //TODO: REMOVE

contract MarsPredictionMarketFactory is IPredictionMarketFactory, Initializable, OwnableUpgradeable {
    address public settlement;

    function initialize(address _settlement) external initializer {
        __Ownable_init();

        settlement = _settlement;
    }

    function createMarket(
        address token,
        uint256 predictionTimeEnd,
        Market.Outcome[] calldata outcomes,
        uint256 startSharePrice,
        uint256 endSharePrice
    ) external override onlyOwner returns (address) {
        require(predictionTimeEnd > block.timestamp, "MARS: Invalid prediction market due date");

        MarsPredictionMarket predictionMarket =
            MarsPredictionMarket(_createMarketContract(token, predictionTimeEnd, outcomes, owner(), startSharePrice, endSharePrice));

        emit PredictionMarketCreatedEvent(address(predictionMarket));

        return address(predictionMarket);
    }

    function _createMarketContract(
        address token,
        uint256 predictionTimeEnd,
        Market.Outcome[] calldata outcomes,
        address owner,
        uint256 startSharePrice,
        uint256 endSharePrice
    ) internal returns (address) {
        bytes memory data =
            abi.encodeWithSelector(
                MarsPredictionMarket.initialize.selector,
                token,
                predictionTimeEnd,
                outcomes,
                owner,
                startSharePrice,
                endSharePrice
            );
        InitializableAdminUpgradeabilityProxy proxy = new InitializableAdminUpgradeabilityProxy();
        proxy.initialize(getOrCreateImplementation(type(MarsPredictionMarket).creationCode, "MARS"), address(this), data);
        return address(proxy);
    }

    function getOrCreateImplementation(bytes memory bytecode, bytes32 salt) internal returns (address implementation) {
        bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), salt, keccak256(bytecode)));
        implementation = address(uint160(uint256(hash)));

        if (isContract(implementation)) {
            return implementation;
        }
        assembly {
            implementation := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
    }

    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }
}

File 9 of 30 : Settlement.sol
// SPDX-License-Identifier: MIT
// pragma solidity >=0.8.0 <0.9.0;

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

import "./dependencies/libraries/StructuredLinkedList.sol";
import "./MarsPredictionMarket.sol";
import "./Parameters.sol";
import "./interfaces/ISettlement.sol";

import "hardhat/console.sol";

contract Settlement is ISettlement, Initializable, OwnableUpgradeable {
    using StructuredLinkedList for StructuredLinkedList.List;
    StructuredLinkedList.List list;

    //uint = 1 -> added and not staked,
    //uint > 1 -> accepted and staked,
    //uint == 0 -> not added
    mapping(address => uint256) public staked; //how much a oracle has staked,
    mapping(address => mapping(address => bytes16)) public oracleOutcome; //oracle => prediction => outcome
    mapping(address => MarketStatus) public marketStatus;

    address[] oracles;
    IERC20 marsToken;
    Parameters parameters;

    function initialize(address _marsToken, address _parameters) external initializer {
        __Ownable_init();

        marsToken = IERC20(_marsToken);
        parameters = Parameters(_parameters);
    }

    function isSettlementProcess(uint256 _currentTime) internal view returns (bool) {
        uint256 _dueDate = list.getFirstDate();

        if (_dueDate == 0 || _dueDate > _currentTime) return false;
        return true;
    }

    function registerMarket(address _predictionMarket, uint256 _dueDate) external override onlyOwner {
        list.pushSorted(_dueDate, _predictionMarket);

        marketStatus[_predictionMarket].dueDate = _dueDate;
    }

    function addOracle(address _newOracle) external override onlyOwner {
        require(staked[_newOracle] == 0, "Oracle adlready added");

        staked[_newOracle] = 1;
        emit PotentialOracleEvent(_newOracle);
    }

    function findOracle(address value) internal returns (uint256) {
        uint256 i = 0;
        while (i < oracles.length && oracles[i] != value) {
            i++;
        }
        return i;
    }

    function _removeOracle(address oracle) internal {
        uint256 index = findOracle(oracle);
        oracles[index] = oracles[oracles.length - 1];
        oracles.pop();
    }

    function removeOracle(address oracle) external override onlyOwner {
        require(!isSettlementProcess(block.timestamp), "Active disputes in progress");

        uint256 amount = staked[oracle];
        require(amount > 0, "Oracle not added");
        staked[oracle] = 0;

        if (amount > 1) marsToken.transfer(oracle, amount);

        _removeOracle(oracle);
    }

    function acceptAndStake() external override {
        uint256 stakedAmount = staked[msg.sender];
        require(stakedAmount != 0, "Not added by governance");
        uint256 oracleAcceptanceAmount = parameters.getOracleAcceptanceAmount();

        if (stakedAmount == 1) {
            require(!isSettlementProcess(block.timestamp), "Active disputes in progress");
            require(marsToken.transferFrom(msg.sender, address(this), oracleAcceptanceAmount), "Failed to transfer amount");
            emit OracleAcceptedEvent(msg.sender);
            oracles.push(msg.sender);
        } else if (stakedAmount < oracleAcceptanceAmount)
            require(marsToken.transferFrom(msg.sender, address(this), oracleAcceptanceAmount - stakedAmount), "Failed to transfer amount");
        else require(marsToken.transfer(msg.sender, stakedAmount - oracleAcceptanceAmount), "Failed to transfer amount");

        staked[msg.sender] = oracleAcceptanceAmount;
    }

    function voteWinningOutcome(address _predictionMarket, bytes16 _outcome) external override {
        uint256 dueDate = marketStatus[_predictionMarket].dueDate;
        require(dueDate != 0, "Market not registered");

        uint256 oracleAcceptanceAmount = parameters.getOracleAcceptanceAmount();
        require(staked[msg.sender] >= oracleAcceptanceAmount, "Only staked oracles can vote");
        require(oracleOutcome[msg.sender][_predictionMarket] == bytes16(0), "Oracle has already voted");

        require(MarsPredictionMarket(_predictionMarket).tokenOutcomeAddress(_outcome) != address(0), "Outcome not defined");

        uint256 votingPeriod = parameters.getVotingPeriod();
        require(block.timestamp >= dueDate, "Due date hasn't come yet");
        require(block.timestamp < dueDate + votingPeriod, "Oracle voting has ended");

        marketStatus[_predictionMarket].oraclesVoted = marketStatus[_predictionMarket].oraclesVoted + 1;
        marketStatus[_predictionMarket].oraclesCountAtStart = oracles.length; //find a better place for this
        
        oracleOutcome[msg.sender][_predictionMarket] = _outcome;
        emit OracleVotedEvent(msg.sender, _predictionMarket, _outcome);
    }

    function openDispute(address _predictionMarket) external override {
        uint256 votingPeriod = parameters.getVotingPeriod();
        uint256 disputeTimeout = parameters.getDisputePeriod();
        uint256 dueDate = marketStatus[_predictionMarket].dueDate;
        require(block.timestamp >= dueDate + votingPeriod, "Still early to open dispute");
        require(block.timestamp < dueDate + votingPeriod + disputeTimeout, "Time to open dispute has passed");
        require(marketStatus[_predictionMarket].finalized == false, "Prediction is finalized");
        require(marketStatus[_predictionMarket].startedDispute == false, "Dispute has started");

        require(_reachedConsensus(_predictionMarket), "Consensus has not been reached");

        uint256 disputeFeeAmount = parameters.getDisputeFeeAmount();
        marketStatus[_predictionMarket].startedDispute = true;
        marketStatus[_predictionMarket].disputeOpenner = msg.sender;
        marketStatus[_predictionMarket].disputeStake = disputeFeeAmount;

        require(marsToken.transferFrom(msg.sender, address(this), disputeFeeAmount), "Failed to transfer amount");

        // IMarsGovernance(owner()).changeOutcome(_predictionMarket, marketStatus[_predictionMarket].outcomes);
    }

    function startVoting(address _predictionMarket) external override {
        uint256 votingPeriod = parameters.getVotingPeriod();
        require(block.timestamp >= marketStatus[_predictionMarket].dueDate + votingPeriod, "Still early to start voting");
        require(marketStatus[_predictionMarket].finalized == false, "Prediction is finalized");
        require(marketStatus[_predictionMarket].startedDispute == false, "Dispute has started");

        require(!_reachedConsensus(_predictionMarket), "Consensus has been reached");

        marketStatus[_predictionMarket].startedDispute = true;

        // IMarsGovernance(owner()).changeOutcome(_predictionMarket, marketStatus[_predictionMarket].outcomes);
    }

    function reachedConsensus(address _predictionMarket) external view override returns (bool) {
        return _reachedConsensus(_predictionMarket);
    }

    function _reachedConsensus(address _predictionMarket) internal view returns (bool) {
        uint256 count = marketStatus[_predictionMarket].oraclesVoted;
        if (count < marketStatus[_predictionMarket].oraclesCountAtStart) return false;
        if (count == 0) return false;

        for (uint256 i = 1; i < count; i++)
            if (oracleOutcome[oracles[i - 1]][_predictionMarket] != oracleOutcome[oracles[i]][_predictionMarket]) return false;

        return true;
    }

    function punishAndRewardOracles(address _predictionMarket, bytes16 _trueOutcome) internal {
        uint256 punished;
        address[] memory correctlyVoted = new address[](oracles.length);
        uint256 count;

        for (uint256 i = 0; i < oracles.length; i++)
            if (oracleOutcome[oracles[i]][_predictionMarket] != marketStatus[_predictionMarket].winningOutcome) {
                punished += staked[oracles[i]];
                staked[oracles[i]] = 0;

                uint256 index = findOracle(oracles[i]);
                oracles[index] = oracles[oracles.length - 1];
                oracles.pop();
            } else {
                correctlyVoted[count] = oracles[i];
                count += 1;
            }

        //20% of mars tokens stay on Settlement
        punished = (punished * 8) / 10; //80%
        marketStatus[_predictionMarket].rewardForDisputeOpener = (punished * 1) / 10; //10%
        marketStatus[_predictionMarket].correctlyVotedCount = count;

        for (uint256 i = 0; i < count; i++) {
            marketStatus[_predictionMarket].correctlyVoted[correctlyVoted[i]] = true;

            marsToken.transfer(correctlyVoted[i], punished / count);

            // (x / y) == (x- (x/ y)) / (y-1)
            // punished -= punished / count;
            // count -= 1;
        }
    }

    function withdraw() external override {
        require(!isSettlementProcess(block.timestamp), "Active disputes in progress");
        require(oracles.length > 1, "Last oracle can't leave");
        uint256 amount = staked[msg.sender];
        require(amount > 1, "No tokens to withdraw");

        staked[msg.sender] = 1;

        require(marsToken.transfer(msg.sender, amount), "Failed to transfer amount");

        uint256 index = findOracle(msg.sender);
        oracles[index] = oracles[oracles.length - 1];
        oracles.pop();
    }

    function setWinningOutcomeByGovernance(address _predictionMarket, bytes16 _outcome) external override onlyOwner {
        if (marketStatus[_predictionMarket].finalized == true) {
            return;
        }

        marketStatus[_predictionMarket].winningOutcome = _outcome;
        marketStatus[_predictionMarket].finalized = true;

        emit OutcomeDefinedEvent(_predictionMarket, _outcome);

        punishAndRewardOracles(_predictionMarket, marketStatus[_predictionMarket].winningOutcome);

        if (marketStatus[_predictionMarket].startedDispute == true) {
            marketStatus[_predictionMarket].startedDispute = false;
        }

        rewardDisputeOpener(_predictionMarket);
        list.deleteByAddress(_predictionMarket);
    }

    function finalizeOutcome(address _predictionMarket) internal {
        if (marketStatus[_predictionMarket].finalized == true) return;

        uint256 settlementPeriod = parameters.getOracleSettlementPeriod();
        uint256 disputePeriod = parameters.getDisputePeriod();

        if (
            marketStatus[_predictionMarket].dueDate + settlementPeriod + disputePeriod < block.timestamp &&
            marketStatus[_predictionMarket].startedDispute == false &&
            _reachedConsensus(_predictionMarket)
        ) {
            marketStatus[_predictionMarket].finalized = true;
            marketStatus[_predictionMarket].winningOutcome = oracleOutcome[oracles[0]][_predictionMarket];

            emit OutcomeDefinedEvent(_predictionMarket, oracleOutcome[oracles[0]][_predictionMarket]);

            marketStatus[_predictionMarket].correctlyVotedCount = oracles.length;

            for (uint256 i = 0; i < oracles.length; i++) {
                marketStatus[_predictionMarket].correctlyVoted[oracles[i]] = true;
            }

            list.deleteByAddress(_predictionMarket);
        }
    }

    function rewardDisputeOpener(address _predictionMarket) private {
        MarketStatus storage ms = marketStatus[_predictionMarket];

        if (ms.disputeOpenner != address(0)) marsToken.transfer(ms.disputeOpenner, ms.disputeStake + ms.rewardForDisputeOpener);
    }

    function getWinningOutcome(address _predictionMarket) external override returns (bytes16) {
        finalizeOutcome(_predictionMarket);
        require(marketStatus[_predictionMarket].finalized == true, "Prediction is not yet concluded");
        return marketStatus[_predictionMarket].winningOutcome;
    }

    function oracleCorrectlyVoted(address _predictionMarket, address _oracle) external override returns (bool) {
        require(marketStatus[_predictionMarket].finalized == true, "To early to collect");
        require(msg.sender == _predictionMarket && marketStatus[_predictionMarket].dueDate != 0, "Only markets can call this method");
        require(marketStatus[_predictionMarket].hasCollected[_oracle] == false, "Oracle has already colected");

        marketStatus[_predictionMarket].hasCollected[_oracle] = true;
        marketStatus[_predictionMarket].collected += 1;
        return marketStatus[_predictionMarket].correctlyVoted[_oracle];
    }

    function getOracles() external view override returns (address[] memory) {
        return oracles;
    }

    function getCorrectlyVotedCount(address _market) external view override returns (uint256) {
        return marketStatus[_market].correctlyVotedCount;
    }
}

File 10 of 30 : Parameters.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./interfaces/IParameters.sol";

contract Parameters is IParameters, Initializable, OwnableUpgradeable {
    address receiver; //wallet that receives protocol fee

    uint256 protocolFee;
    uint256 oracleFee;
    uint256 divisor;

    uint256 oracleSettlementPeriod;
    uint256 disputePeriod;
    uint256 votingPeriod;

    uint256 oracleAcceptanceAmount;
    uint256 proposalSubmitPrice;
    uint256 disputeFeeAmount;
    uint256 quorum;

    function initialize(
        address _receiver,
        uint256 _protocolFee,
        uint256 _oracleFee,
        uint256 _divisor,
        uint256 _oracleSettlementPeriod,
        uint256 _disputePeriod,
        uint256 _votingPeriod,
        uint256 _oracleAcceptanceAmount,
        uint256 _disputeFeeAmount,
        uint256 _proposalSubmitPrice,
        uint256 _quorum
    ) external initializer {
        __Ownable_init();

        receiver = _receiver;
        protocolFee = _protocolFee;
        oracleFee = _oracleFee;
        divisor = _divisor;

        oracleSettlementPeriod = _oracleSettlementPeriod;
        disputePeriod = _disputePeriod;
        votingPeriod = _votingPeriod;

        oracleAcceptanceAmount = oracleAcceptanceAmount;
        disputeFeeAmount = disputeFeeAmount;
        proposalSubmitPrice = proposalSubmitPrice;
        quorum = _quorum;
    }

    function getReceiver() external view override returns (address) {
        return receiver;
    }

    function getProtocolFee() external view override returns (uint256) {
        return protocolFee;
    }

    function getOracleFee() external view override returns (uint256) {
        return oracleFee;
    }

    function getDivisor() external view override returns (uint256) {
        return divisor;
    }

    function getOracleSettlementPeriod() external view override returns (uint256) {
        return oracleSettlementPeriod;
    }

    function getDisputePeriod() external view override returns (uint256) {
        return disputePeriod;
    }

    function getVotingPeriod() external view override returns (uint256) {
        return votingPeriod;
    }

    function getOracleAcceptanceAmount() external view override returns (uint256) {
        return oracleAcceptanceAmount;
    }

    function getDisputeFeeAmount() external view override returns (uint256) {
        return disputeFeeAmount;
    }

    function getProposalSubmitPrice() external view override returns (uint256) {
        return proposalSubmitPrice;
    }

    function getQuorum() external view override returns (uint256) {
        return quorum;
    }

    function setReceiver(address _newValue) external override onlyOwner {
        receiver = _newValue;
    }

    function setProtocolFee(uint256 _newValue) external override onlyOwner {
        protocolFee = _newValue;
    }

    function setOracleFee(uint256 _newValue) external override onlyOwner {
        oracleFee = _newValue;
    }

    function setDivisor(uint256 _newValue) external override onlyOwner {
        divisor = _newValue;
    }

    function setOracleSettlementPeriod(uint256 _newValue) external override onlyOwner {
        oracleSettlementPeriod = _newValue;
    }

    function setDisputePeriod(uint256 _newValue) external override onlyOwner {
        disputePeriod = _newValue;
    }

    function setVotingPeriod(uint256 _newValue) external override onlyOwner {
        votingPeriod = _newValue;
    }

    function setOracleAcceptanceAmount(uint256 _newValue) external override onlyOwner {
        oracleAcceptanceAmount = _newValue;
    }

    function setDisputeFeeAmount(uint256 _newValue) external override onlyOwner {
        disputeFeeAmount = _newValue;
    }

    function setProposalSubmitPrice(uint256 _newValue) external override onlyOwner {
        proposalSubmitPrice = _newValue;
    }

    function setQuorum(uint256 _newValue) external override onlyOwner {
        quorum = _newValue;
    }
}

File 11 of 30 : Market.sol
// SPDX-License-Identifier: MIT

library Market {
    struct UserOutcomeInfo {
        bytes16 outcomeUuid;
        bool suspended;
        uint256 stakeAmount;
        uint256 currentReward;
        bool rewardReceived;
        uint256 sharePrice;
        uint256 outcomeBalance;
    }

    struct Outcome {
        bytes16 uuid;
        uint8 position;
        string name;
    }
}

File 12 of 30 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
    uint256[50] private __gap;
}

File 13 of 30 : BaseAdminUpgradeabilityProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "./UpgradeabilityProxy.sol";

/**
 * @title BaseAdminUpgradeabilityProxy
 * @dev This contract combines an upgradeability proxy with an authorization
 * mechanism for administrative tasks.
 * All external functions in this contract must be guarded by the
 * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
 * feature proposal that would enable this to be done automatically.
 */
contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
    /**
     * @dev Emitted when the administration has been transferred.
     * @param previousAdmin Address of the previous admin.
     * @param newAdmin Address of the new admin.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */

    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Modifier to check whether the `msg.sender` is the admin.
     * If it is, it will run the function. Otherwise, it will delegate the call
     * to the implementation.
     */
    modifier ifAdmin() {
        if (msg.sender == _admin()) {
            _;
        } else {
            _fallback();
        }
    }

    /**
     * @return The address of the proxy admin.
     */
    function admin() external ifAdmin returns (address) {
        return _admin();
    }

    /**
     * @return The address of the implementation.
     */
    function implementation() external ifAdmin returns (address) {
        return _implementation();
    }

    /**
     * @dev Changes the admin of the proxy.
     * Only the current admin can call this function.
     * @param newAdmin Address to transfer proxy administration to.
     */
    function changeAdmin(address newAdmin) external ifAdmin {
        require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
        emit AdminChanged(_admin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev Upgrade the backing implementation of the proxy.
     * Only the admin can call this function.
     * @param newImplementation Address of the new implementation.
     */
    function upgradeTo(address newImplementation) external ifAdmin {
        _upgradeTo(newImplementation);
    }

    /**
     * @dev Upgrade the backing implementation of the proxy and call a function
     * on the new implementation.
     * This is useful to initialize the proxied contract.
     * @param newImplementation Address of the new implementation.
     * @param data Data to send as msg.data in the low level call.
     * It should include the signature and the parameters of the function to be called, as described in
     * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
     */
    function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
        _upgradeTo(newImplementation);
        (bool success, ) = newImplementation.delegatecall(data);
        require(success);
    }

    /**
     * @return adm The admin slot.
     */
    function _admin() internal view returns (address adm) {
        bytes32 slot = ADMIN_SLOT;
        assembly {
            adm := sload(slot)
        }
    }

    /**
     * @dev Sets the address of the proxy admin.
     * @param newAdmin Address of the new proxy admin.
     */
    function _setAdmin(address newAdmin) internal {
        bytes32 slot = ADMIN_SLOT;

        assembly {
            sstore(slot, newAdmin)
        }
    }

    /**
     * @dev Only fall back when the sender is not the admin.
     */
    function _willFallback() internal virtual override {
        require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
        super._willFallback();
    }
}

File 14 of 30 : InitializableUpgradeabilityProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "./BaseUpgradeabilityProxy.sol";

/**
 * @title InitializableUpgradeabilityProxy
 * @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
 * implementation and init data.
 */
contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
    /**
     * @dev Contract initializer.
     * @param _logic Address of the initial implementation.
     * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
     * It should include the signature and the parameters of the function to be called, as described in
     * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
     * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
     */
    function initialize(address _logic, bytes memory _data) public payable {
        require(_implementation() == address(0));
        assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
        _setImplementation(_logic);
        if (_data.length > 0) {
            (bool success, ) = _logic.delegatecall(_data);
            require(success);
        }
    }
}

File 15 of 30 : UpgradeabilityProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "./BaseUpgradeabilityProxy.sol";

/**
 * @title UpgradeabilityProxy
 * @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
 * implementation and init data.
 */
contract UpgradeabilityProxy is BaseUpgradeabilityProxy {
    /**
     * @dev Contract constructor.
     * @param _logic Address of the initial implementation.
     * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
     * It should include the signature and the parameters of the function to be called, as described in
     * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
     * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
     */
    constructor(address _logic, bytes memory _data) public payable {
        assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
        _setImplementation(_logic);
        if (_data.length > 0) {
            (bool success, ) = _logic.delegatecall(_data);
            require(success);
        }
    }
}

File 16 of 30 : BaseUpgradeabilityProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "./Proxy.sol";
import "./Address.sol";

/**
 * @title BaseUpgradeabilityProxy
 * @dev This contract implements a proxy that allows to change the
 * implementation address to which it will delegate.
 * Such a change is called an implementation upgrade.
 */
contract BaseUpgradeabilityProxy is Proxy {
    /**
     * @dev Emitted when the implementation is upgraded.
     * @param implementation Address of the new implementation.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Returns the current implementation.
     * @return impl Address of the current implementation
     */
    function _implementation() internal view override returns (address impl) {
        bytes32 slot = IMPLEMENTATION_SLOT;
        assembly {
            impl := sload(slot)
        }
    }

    /**
     * @dev Upgrades the proxy to a new implementation.
     * @param newImplementation Address of the new implementation.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Sets the implementation address of the proxy.
     * @param newImplementation Address of the new implementation.
     */
    function _setImplementation(address newImplementation) internal {
        require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");

        bytes32 slot = IMPLEMENTATION_SLOT;

        assembly {
            sstore(slot, newImplementation)
        }
    }
}

File 17 of 30 : Proxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

/**
 * @title Proxy
 * @dev Implements delegation of calls to other contracts, with proper
 * forwarding of return values and bubbling of failures.
 * It defines a fallback function that delegates all calls to the address
 * returned by the abstract _implementation() internal function.
 */
abstract contract Proxy {
    /**
     * @dev Fallback function.
     * Implemented entirely in `_fallback`.
     */
    fallback() external payable {
        _fallback();
    }

    receive() external payable {
        _fallback();
    }

    /**
     * @return The Address of the implementation.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates execution to an implementation contract.
     * This is a low level function that doesn't return to its internal call site.
     * It will return to the external caller whatever the implementation returns.
     * @param implementation Address to delegate.
     */
    function _delegate(address implementation) internal {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
                // delegatecall returns 0 on error.
                case 0 {
                    revert(0, returndatasize())
                }
                default {
                    return(0, returndatasize())
                }
        }
    }

    /**
     * @dev Function that is run as the first thing in the fallback function.
     * Can be redefined in derived contracts to add functionality.
     * Redefinitions must call super._willFallback().
     */
    function _willFallback() internal virtual {}

    /**
     * @dev fallback implementation.
     * Extracted to enable manual triggering.
     */
    function _fallback() internal {
        _willFallback();
        _delegate(_implementation());
    }
}

File 18 of 30 : Address.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

/**
 * Utility library of inline functions on addresses
 *
 * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
 * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
 * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
 * build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
 */
library OpenZeppelinUpgradesAddress {
    /**
     * Returns whether the target address is a contract
     * @dev This function will return false if invoked during the constructor of a contract,
     * as the code is not actually created until after the constructor finishes.
     * @param account address of the account to check
     * @return whether the target address is a contract
     */
    function isContract(address account) internal view returns (bool) {
        uint256 size;
        // XXX Currently there is no better way to check if there is a contract in an address
        // than to check the size of the code at that address.
        // See https://ethereum.stackexchange.com/a/14016/36603
        // for more details about how this works.
        // TODO Check this again before the Serenity release, because all addresses will be
        // contracts then.
        // solhint-disable-next-line no-inline-assembly
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }
}

File 19 of 30 : IPredictionMarket.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

import "../libraries/Market.sol";

interface IPredictionMarket {
    event PredictionEvent(address indexed _account, bytes16 _outcome, uint256 _amount);

    function getNumberOfOutcomes() external view returns (uint256);

    function getPredictionTimeEnd() external view returns (uint256);

    function addOutcome(
        bytes16 uuid,
        uint8 position,
        string memory name
    ) external;

    function predict(bytes16 _outcome, uint256 _amount) external;

    function getUserPredictionState(address _wallet, uint256 _currentTime) external view returns (Market.UserOutcomeInfo[] memory);

    function getReward() external;

    function setSettlement(address _newSettlement) external;

    function getTokenOutcomeAddress(bytes16 outcomeUuid) external view returns (address);

    function collectOracleFee() external;

    function collectProtocolFee() external;

    function setParameters(address _newParameters) external;

    function setPredictionTimeEnd(uint256 _newValue) external;

    function getSharePrice(uint256 _currentTime) external view returns (uint256);

    function isPredictionProfitable(
        bytes16 _outcome,
        uint256 _currentTime,
        uint256 notFee,
        uint256 feeDivisor
    ) external view returns (bool);
}

File 20 of 30 : ISettlement.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

interface ISettlement {
    event PotentialOracleEvent(address _newOracle);
    event OracleAcceptedEvent(address _newOracle);
    event OracleVotedEvent(address indexed _oracle, address indexed _predictionMarket, bytes16 _outcome);
    event OutcomeDefinedEvent(address indexed _predictionMarket, bytes16 _outcome);

    struct MarketStatus {
        uint256 dueDate;
        uint256 oraclesVoted;
        bytes16 winningOutcome;
        bool finalized;
        bool startedDispute;
        address disputeOpenner;
        uint256 disputeStake;
        uint256 rewardForDisputeOpener;
        mapping(address => bool) correctlyVoted;
        uint256 correctlyVotedCount;
        mapping(address => bool) hasCollected;
        uint256 collected;

        uint256 oraclesCountAtStart;
    }

    function reachedConsensus(address _predictionMarket) external view returns (bool);

    function registerMarket(address _predictionMarket, uint256 _dueDate) external;

    function addOracle(address _newOracle) external;

    function removeOracle(address oracle) external;

    function acceptAndStake() external;

    function voteWinningOutcome(address _predictionMarket, bytes16 _outcome) external;

    function openDispute(address _predictionMarket) external;

    function startVoting(address _predictionMarket) external;

    function withdraw() external;

    // function reachedConsensus(address _predictionMarket) public view returns (bool);

    function setWinningOutcomeByGovernance(address _predictionMarket, bytes16 _outcome) external;

    // function finalizeOutcome(address _predictionMarket) public;

    function getWinningOutcome(address _predictionMarket) external returns (bytes16);

    function getOracles() external view returns (address[] memory);

    function oracleCorrectlyVoted(address _predictionMarket, address _oracle) external returns (bool);

    function getCorrectlyVotedCount(address _market) external view returns (uint256);
}

File 21 of 30 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 22 of 30 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The defaut value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        _approve(sender, _msgSender(), currentAllowance - amount);

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        _approve(_msgSender(), spender, currentAllowance - subtractedValue);

        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        _balances[sender] = senderBalance - amount;
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        _balances[account] = accountBalance - amount;
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

File 23 of 30 : Context.sol
// SPDX-License-Identifier: MIT

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) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 24 of 30 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 25 of 30 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 26 of 30 : IParameters.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

interface IParameters {
    function getReceiver() external view returns (address);

    function getProtocolFee() external view returns (uint256);

    function getOracleFee() external view returns (uint256);

    function getDivisor() external view returns (uint256);

    function getOracleSettlementPeriod() external view returns (uint256);

    function getDisputePeriod() external view returns (uint256);

    function getVotingPeriod() external view returns (uint256);

    function getOracleAcceptanceAmount() external view returns (uint256);

    function getDisputeFeeAmount() external view returns (uint256);

    function getProposalSubmitPrice() external view returns (uint256);

    function getQuorum() external view returns (uint256);

    function setReceiver(address _newValue) external;

    function setProtocolFee(uint256 _newValue) external;

    function setOracleFee(uint256 _newValue) external;

    function setDivisor(uint256 _newValue) external;

    function setOracleSettlementPeriod(uint256 _newValue) external;

    function setDisputePeriod(uint256 _newValue) external;

    function setVotingPeriod(uint256 _newValue) external;

    function setOracleAcceptanceAmount(uint256 _newValue) external;

    function setDisputeFeeAmount(uint256 _newValue) external;

    function setProposalSubmitPrice(uint256 _newValue) external;

    function setQuorum(uint256 _newValue) external;
}

File 27 of 30 : IPredictionMarketFactory.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

import "../libraries/Market.sol";

interface IPredictionMarketFactory {
    event PredictionMarketCreatedEvent(address _market);

    function createMarket(
        address token,
        uint256 predictionTimeEnd,
        Market.Outcome[] calldata outcomes,
        uint256 startSharePrice,
        uint256 endSharePrice
    ) external returns (address);
}

File 28 of 30 : IAddressResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

interface IAddressResolver {
    event ContractRegistered(bytes32 name, address contractAddress);

    function getAddress(bytes32 name) external view returns (address);

    function requireAddress(bytes32 name, string calldata errorMessage) external view returns (address);
}

File 29 of 30 : console.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.4.22 <0.9.0;

library console {
	address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);

	function _sendLogPayload(bytes memory payload) private view {
		uint256 payloadLength = payload.length;
		address consoleAddress = CONSOLE_ADDRESS;
		assembly {
			let payloadStart := add(payload, 32)
			let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)
		}
	}

	function log() internal view {
		_sendLogPayload(abi.encodeWithSignature("log()"));
	}

	function logInt(int p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(int)", p0));
	}

	function logUint(uint p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
	}

	function logString(string memory p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
	}

	function logBool(bool p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
	}

	function logAddress(address p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
	}

	function logBytes(bytes memory p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes)", p0));
	}

	function logBytes1(bytes1 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0));
	}

	function logBytes2(bytes2 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0));
	}

	function logBytes3(bytes3 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0));
	}

	function logBytes4(bytes4 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0));
	}

	function logBytes5(bytes5 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0));
	}

	function logBytes6(bytes6 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0));
	}

	function logBytes7(bytes7 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0));
	}

	function logBytes8(bytes8 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0));
	}

	function logBytes9(bytes9 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0));
	}

	function logBytes10(bytes10 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0));
	}

	function logBytes11(bytes11 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0));
	}

	function logBytes12(bytes12 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0));
	}

	function logBytes13(bytes13 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0));
	}

	function logBytes14(bytes14 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0));
	}

	function logBytes15(bytes15 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0));
	}

	function logBytes16(bytes16 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0));
	}

	function logBytes17(bytes17 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0));
	}

	function logBytes18(bytes18 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0));
	}

	function logBytes19(bytes19 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0));
	}

	function logBytes20(bytes20 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0));
	}

	function logBytes21(bytes21 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0));
	}

	function logBytes22(bytes22 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0));
	}

	function logBytes23(bytes23 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0));
	}

	function logBytes24(bytes24 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0));
	}

	function logBytes25(bytes25 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0));
	}

	function logBytes26(bytes26 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0));
	}

	function logBytes27(bytes27 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0));
	}

	function logBytes28(bytes28 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0));
	}

	function logBytes29(bytes29 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0));
	}

	function logBytes30(bytes30 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0));
	}

	function logBytes31(bytes31 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0));
	}

	function logBytes32(bytes32 p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0));
	}

	function log(uint p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
	}

	function log(string memory p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
	}

	function log(bool p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
	}

	function log(address p0) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
	}

	function log(uint p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1));
	}

	function log(uint p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1));
	}

	function log(uint p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1));
	}

	function log(uint p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1));
	}

	function log(string memory p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1));
	}

	function log(string memory p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1));
	}

	function log(string memory p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1));
	}

	function log(string memory p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1));
	}

	function log(bool p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1));
	}

	function log(bool p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1));
	}

	function log(bool p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1));
	}

	function log(bool p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1));
	}

	function log(address p0, uint p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1));
	}

	function log(address p0, string memory p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1));
	}

	function log(address p0, bool p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1));
	}

	function log(address p0, address p1) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1));
	}

	function log(uint p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2));
	}

	function log(uint p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2));
	}

	function log(uint p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2));
	}

	function log(uint p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2));
	}

	function log(uint p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2));
	}

	function log(uint p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2));
	}

	function log(uint p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2));
	}

	function log(uint p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2));
	}

	function log(uint p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2));
	}

	function log(uint p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2));
	}

	function log(uint p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2));
	}

	function log(uint p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2));
	}

	function log(uint p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2));
	}

	function log(string memory p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2));
	}

	function log(string memory p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2));
	}

	function log(string memory p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2));
	}

	function log(string memory p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2));
	}

	function log(string memory p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2));
	}

	function log(string memory p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2));
	}

	function log(string memory p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2));
	}

	function log(bool p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2));
	}

	function log(bool p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2));
	}

	function log(bool p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2));
	}

	function log(bool p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2));
	}

	function log(bool p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2));
	}

	function log(bool p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2));
	}

	function log(bool p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2));
	}

	function log(bool p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2));
	}

	function log(bool p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2));
	}

	function log(bool p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2));
	}

	function log(bool p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2));
	}

	function log(bool p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2));
	}

	function log(bool p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2));
	}

	function log(address p0, uint p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2));
	}

	function log(address p0, uint p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2));
	}

	function log(address p0, uint p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2));
	}

	function log(address p0, uint p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2));
	}

	function log(address p0, string memory p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2));
	}

	function log(address p0, string memory p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2));
	}

	function log(address p0, string memory p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2));
	}

	function log(address p0, string memory p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2));
	}

	function log(address p0, bool p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2));
	}

	function log(address p0, bool p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2));
	}

	function log(address p0, bool p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2));
	}

	function log(address p0, bool p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2));
	}

	function log(address p0, address p1, uint p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2));
	}

	function log(address p0, address p1, string memory p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2));
	}

	function log(address p0, address p1, bool p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2));
	}

	function log(address p0, address p1, address p2) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2));
	}

	function log(uint p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3));
	}

	function log(uint p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3));
	}

	function log(string memory p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3));
	}

	function log(bool p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, uint p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, string memory p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, bool p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, uint p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, string memory p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, bool p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, uint p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, string memory p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, bool p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3));
	}

	function log(address p0, address p1, address p2, address p3) internal view {
		_sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3));
	}

}

File 30 of 30 : StructuredLinkedList.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "hardhat/console.sol";

library StructuredLinkedList {
    struct Node {
        uint256 dueDate;
        address market;
        uint256 next;
    }

    struct List {
        mapping(uint256 => Node) nodes;
        uint256 nodeNumber; // TODO: combine to one uint
        uint256 count;
        uint256 firstNodeNext; //= count;
    }

    function pushFront(
        List storage self,
        uint256 _date,
        address _market
    ) internal {
        self.count += 1;
        uint256 _count = self.count;
        self.nodes[_count] = Node(_date, _market, self.nodes[0].next);

        self.nodes[0].next = _count;
        self.nodeNumber = _count;
    }

    function pushSorted(
        List storage self,
        uint256 _date,
        address _market
    ) internal {
        uint256 id;
        uint256 lastId;
        Node memory tmp;

        while (true) {
            lastId = id;
            id = self.nodes[id].next;
            tmp = self.nodes[id];

            if (tmp.dueDate > _date || tmp.next == 0) {
                self.count += 1;
                uint256 _count = self.count;
                self.nodes[_count] = Node(_date, _market, self.nodes[lastId].next);
                self.nodes[lastId].next = _count;
                self.nodeNumber = _count;
                break;
            }
        }
    }

    function getFirstDate(List storage self) internal view returns (uint256) {
        uint256 id = self.nodes[0].next;
        return self.nodes[id].dueDate;
    }

    function deleteByAddress(List storage self, address _addr) internal {
        uint256 id;
        uint256 lastId;
        Node memory tmp;

        while (true) {
            lastId = id;
            id = self.nodes[id].next;

            if (id == 0) break;

            tmp = self.nodes[id];

            if (tmp.market == _addr) {
                self.count -= 1;
                self.nodeNumber = self.nodeNumber - 1;

                self.nodes[lastId].next = tmp.next;
                delete self.nodes[id];

                break;
            }
        }
    }

    //for debugging
    function printStack(List storage self) internal view {
        uint256 id = self.nodes[0].next;
        Node memory tmp = self.nodes[id];
        while (tmp.next != 0) {
            console.log("date", tmp.dueDate);
            // console.log("next", tmp.next);
            tmp = self.nodes[tmp.next];
        }
        console.log("date", tmp.dueDate);
    }
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes16","name":"uuid","type":"bytes16"},{"indexed":false,"internalType":"uint8","name":"position","type":"uint8"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"CategoryUpdatedEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes16","name":"uuid","type":"bytes16"},{"indexed":false,"internalType":"bytes16","name":"categoryUuid","type":"bytes16"},{"indexed":false,"internalType":"uint8","name":"position","type":"uint8"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"description","type":"string"},{"indexed":false,"internalType":"enum IRegister.MilestoneStatus","name":"status","type":"uint8"}],"name":"MilestoneUpdatedEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes16","name":"uuid","type":"bytes16"},{"indexed":false,"internalType":"address","name":"predictionMarket","type":"address"},{"indexed":false,"internalType":"uint8","name":"position","type":"uint8"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"OutcomeChangedEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes16","name":"milestoneUuid","type":"bytes16"},{"indexed":false,"internalType":"uint8","name":"position","type":"uint8"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"description","type":"string"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"dueDate","type":"uint256"},{"indexed":false,"internalType":"address","name":"contractAddress","type":"address"}],"name":"PredictionMarketRegisteredEvent","type":"event"},{"inputs":[{"internalType":"address","name":"prediction","type":"address"},{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"string","name":"name","type":"string"}],"name":"addOutcome","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_currentTime","type":"uint256"}],"name":"getPredictionData","outputs":[{"components":[{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"uint256","name":"position","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct IRegister.CategoryInfo[]","name":"","type":"tuple[]"},{"components":[{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"bytes16","name":"category","type":"bytes16"},{"internalType":"uint256","name":"position","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"enum IRegister.MilestoneStatus","name":"status","type":"uint8"}],"internalType":"struct IRegister.MilestoneInfo[]","name":"","type":"tuple[]"},{"components":[{"internalType":"address","name":"id","type":"address"},{"internalType":"bytes16","name":"milestone","type":"bytes16"},{"internalType":"uint256","name":"position","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"enum IRegister.PredictionMarketState","name":"state","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"dueDate","type":"uint256"},{"internalType":"uint256","name":"predictionTimeEnd","type":"uint256"},{"internalType":"uint256","name":"predictorsNumber","type":"uint256"}],"internalType":"struct IRegister.PredictionInfo[]","name":"","type":"tuple[]"},{"components":[{"internalType":"bytes16","name":"id","type":"bytes16"},{"internalType":"address","name":"prediction","type":"address"},{"internalType":"uint256","name":"position","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint8","name":"winning","type":"uint8"}],"internalType":"struct IRegister.OutcomeInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_settlement","type":"address"},{"internalType":"address","name":"_parameters","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bytes16","name":"milestoneUuid","type":"bytes16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"dueDate","type":"uint256"},{"internalType":"uint256","name":"predictionTimeEnd","type":"uint256"},{"components":[{"internalType":"bytes16","name":"uuid","type":"bytes16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"string","name":"name","type":"string"}],"internalType":"struct Market.Outcome[]","name":"outcomes","type":"tuple[]"}],"name":"registerMarket","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"name":"slot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"uuid","type":"bytes16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"}],"name":"updateCategory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"uuid","type":"bytes16"},{"internalType":"bytes16","name":"categoryUuid","type":"bytes16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"enum IRegister.MilestoneStatus","name":"status","type":"uint8"}],"name":"updateMilestone","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061324e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80637f26b23b116100765780639f5a34081161005b5780639f5a340814610189578063edd55edf1461019c578063f2fde38b146101af576100be565b80637f26b23b1461014d5780638da5cb5b14610178576100be565b8063562b3e09116100a7578063562b3e09146100eb578063715018a61461011757806374b36bd31461011f576100be565b80631ca76def146100c3578063485cc955146100d8575b600080fd5b6100d66100d13660046129dd565b6101c2565b005b6100d66100e63660046127d4565b6104ed565b6100fe6100f9366004612b26565b6105ff565b60405161010e9493929190612e4a565b60405180910390f35b6100d661181a565b61013f61012d3660046129a5565b606b6020526000908152604090205481565b60405190815260200161010e565b61016061015b366004612884565b6118cb565b6040516001600160a01b03909116815260200161010e565b6033546001600160a01b0316610160565b6100d6610197366004612a96565b611d8e565b6100d66101aa36600461280c565b611fd4565b6100d66101bd366004612795565b61224a565b6033546001600160a01b031633146102215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102566040805160c081018252600080825260208201819052918101829052606080820181905260808201529060a082015290565b6001600160801b0319808a168252881660208083019190915260ff88166040808401919091528051601f88018390048302810183019091528681529087908790819084018382808284376000920191909152505050506060820152604080516020601f8601819004810282018101909252848152908590859081908401838280828437600092019190915250505050608082015260a0810182600281111561030e57634e487b7160e01b600052602160045260246000fd5b9081600281111561032f57634e487b7160e01b600052602160045260246000fd5b90525060668054600181018255600091909152815160059091027f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e9435481018054602080860151608090811c7001000000000000000000000000000000000295901c6001600160801b0319909216919091176fffffffffffffffffffffffffffffffff1693909317815560408401517f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94355830155606084015180518594929361041b937f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94356909101920190612647565b5060808201518051610437916003840191602090910190612647565b5060a082015160048201805460ff1916600183600281111561046957634e487b7160e01b600052602160045260246000fd5b02179055505060665461047f9150600190613154565b6001600160801b03198a166000908152606b60205260409081902091909155517f97cb6f21bba4326123eb05c550830ca034704506c45171b654d35448a8e27ce7906104da908b908b908b908b908b908b908b908b90612f86565b60405180910390a1505050505050505050565b600054610100900460ff1680610506575060005460ff16155b6105785760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610218565b600054610100900460ff161580156105a3576000805460ff1961ff0019909116610100171660011790555b6105ab612389565b606980546001600160a01b0380861673ffffffffffffffffffffffffffffffffffffffff1992831617909255606a80549285169290911691909117905580156105fa576000805461ff00191690555b505050565b606080606080600060678054905067ffffffffffffffff81111561063357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156106c257816020015b6106af6040805161014081018252600080825260208201819052918101829052606080820181905260808201529060a0820190815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b8152602001906001900390816106515790505b5060685490915060009067ffffffffffffffff8111156106f257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561075157816020015b6040805160c081018252600080825260208083018290529282018190526060808301526080820181905260a082015282526000199092019101816107105790505b5090506000606a60009054906101000a90046001600160a01b03166001600160a01b03166312260f0f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a457600080fd5b505afa1580156107b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dc9190612b3e565b90506000606a60009054906101000a90046001600160a01b03166001600160a01b0316635aea0ec46040518163ffffffff1660e01b815260040160206040518083038186803b15801561082e57600080fd5b505afa158015610842573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108669190612b3e565b905060005b606754811015610fbb576067818154811061089657634e487b7160e01b600052603260045260246000fd5b6000918252602091829020604080516101408101825260099390930290910180546001600160a01b03168352600181015460801b6001600160801b031916938301939093526002830154908201526003820180549192916060840191906108fc9061316b565b80601f01602080910402602001604051908101604052809291908181526020018280546109289061316b565b80156109755780601f1061094a57610100808354040283529160200191610975565b820191906000526020600020905b81548152906001019060200180831161095857829003601f168201915b5050505050815260200160048201805461098e9061316b565b80601f01602080910402602001604051908101604052809291908181526020018280546109ba9061316b565b8015610a075780601f106109dc57610100808354040283529160200191610a07565b820191906000526020600020905b8154815290600101906020018083116109ea57829003601f168201915b5050509183525050600582015460209091019060ff166003811115610a3c57634e487b7160e01b600052602160045260246000fd5b6003811115610a5b57634e487b7160e01b600052602160045260246000fd5b8152600582015461010090046001600160a01b0316602082015260068201546040820152600782015460608201526008909101546080909101528551869083908110610ab757634e487b7160e01b600052603260045260246000fd5b60200260200101819052506000858281518110610ae457634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b031663358fac1c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2857600080fd5b505afa158015610b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b609190612b3e565b8651909150600090879084908110610b8857634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b0316639b34ae036040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcc57600080fd5b505afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0491906129c1565b6001600160801b031916141580610d3357508a8385888581518110610c3957634e487b7160e01b600052603260045260246000fd5b602002602001015160e00151610c4f919061313c565b610c59919061313c565b108015610d33575060695486516001600160a01b03909116906327a3fc0b90889085908110610c9857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151516040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015610cfb57600080fd5b505afa158015610d0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d339190612985565b15610dae576002868381518110610d5a57634e487b7160e01b600052603260045260246000fd5b602002602001015160a001906003811115610d8557634e487b7160e01b600052602160045260246000fd5b90816003811115610da657634e487b7160e01b600052602160045260246000fd5b905250610eaa565b8a81108015610de75750858281518110610dd857634e487b7160e01b600052603260045260246000fd5b602002602001015160e001518b105b15610e0e576003868381518110610d5a57634e487b7160e01b600052603260045260246000fd5b8a811115610e38576000868381518110610d5a57634e487b7160e01b600052603260045260246000fd5b6001868381518110610e5a57634e487b7160e01b600052603260045260246000fd5b602002602001015160a001906003811115610e8557634e487b7160e01b600052602160045260246000fd5b90816003811115610ea657634e487b7160e01b600052602160045260246000fd5b9052505b858281518110610eca57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516001600160a01b031663be1c4a2d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0e57600080fd5b505afa158015610f22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f469190612b3e565b868381518110610f6657634e487b7160e01b600052603260045260246000fd5b602002602001015161012001818152505080868381518110610f9857634e487b7160e01b600052603260045260246000fd5b602090810291909101015161010001525080610fb3816131a6565b91505061086b565b5060005b60685481101561144f5760688181548110610fea57634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160c081018252600693909302909101805460801b6001600160801b031916835260018101546001600160a01b03169383019390935260028301549082015260038201805491929160608401919061104f9061316b565b80601f016020809104026020016040519081016040528092919081815260200182805461107b9061316b565b80156110c85780601f1061109d576101008083540402835291602001916110c8565b820191906000526020600020905b8154815290600101906020018083116110ab57829003601f168201915b50505091835250506004820154602082015260059091015460ff16604090910152845185908390811061110b57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506068818154811061113757634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020160010160009054906101000a90046001600160a01b03166001600160a01b03166372bcc3836068838154811061118b57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600690910201546040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526111e89160801b906004016001600160801b031991909116815260200190565b60206040518083038186803b15801561120057600080fd5b505afa158015611214573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123891906127b8565b6001600160a01b031663567e98f96040518163ffffffff1660e01b815260040160206040518083038186803b15801561127057600080fd5b505afa158015611284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a89190612b3e565b8482815181106112c857634e487b7160e01b600052603260045260246000fd5b60200260200101516080018181525050606881815481106112f957634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020160000160009054906101000a900460801b6fffffffffffffffffffffffffffffffff19166068828154811061134c57634e487b7160e01b600052603260045260246000fd5b600091825260209182902060016006909202010154604080517f9b34ae0300000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921692639b34ae0392600480840193829003018186803b1580156113b657600080fd5b505afa1580156113ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ee91906129c1565b6001600160801b03191614611404576000611407565b60015b84828151811061142757634e487b7160e01b600052603260045260246000fd5b602090810291909101015160ff90911660a09091015280611447816131a6565b915050610fbf565b5060656066858583805480602002602001604051908101604052809291908181526020016000905b828210156115ef576000848152602090819020604080516080808201835260048702909301805490931b6001600160801b0319168152600183015493810193909352600282018054918401916114cc9061316b565b80601f01602080910402602001604051908101604052809291908181526020018280546114f89061316b565b80156115455780601f1061151a57610100808354040283529160200191611545565b820191906000526020600020905b81548152906001019060200180831161152857829003601f168201915b5050505050815260200160038201805461155e9061316b565b80601f016020809104026020016040519081016040528092919081815260200182805461158a9061316b565b80156115d75780601f106115ac576101008083540402835291602001916115d7565b820191906000526020600020905b8154815290600101906020018083116115ba57829003601f168201915b50505050508152505081526020019060010190611477565b50505050935082805480602002602001604051908101604052809291908181526020016000905b828210156118015760008481526020908190206040805160c0810182526005860290920180546001600160801b0319608082811b8216865270010000000000000000000000000000000090920490911b169383019390935260018301549082015260028201805491929160608401919061168f9061316b565b80601f01602080910402602001604051908101604052809291908181526020018280546116bb9061316b565b80156117085780601f106116dd57610100808354040283529160200191611708565b820191906000526020600020905b8154815290600101906020018083116116eb57829003601f168201915b505050505081526020016003820180546117219061316b565b80601f016020809104026020016040519081016040528092919081815260200182805461174d9061316b565b801561179a5780601f1061176f5761010080835404028352916020019161179a565b820191906000526020600020905b81548152906001019060200180831161177d57829003601f168201915b5050509183525050600482015460209091019060ff1660028111156117cf57634e487b7160e01b600052602160045260246000fd5b60028111156117ee57634e487b7160e01b600052602160045260246000fd5b8152505081526020019060010190611616565b5050505092509750975097509750505050509193509193565b6033546001600160a01b031633146118745760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610218565b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36033805473ffffffffffffffffffffffffffffffffffffffff19169055565b6033546000906001600160a01b031633146119285760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610218565b42851161199d5760405162461bcd60e51b815260206004820152602860248201527f4d4152533a20496e76616c69642070726564696374696f6e206d61726b65742060448201527f64756520646174650000000000000000000000000000000000000000000000006064820152608401610218565b6119fb6040805161014081018252600080825260208201819052918101829052606080820181905260808201529060a0820190815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b6001600160a01b038e1681526001600160801b03198d1660208083019190915260ff8d166040808401919091528051601f8d018390048302810183019091528b8152908c908c90819084018382808284376000920191909152505050506060820152604080516020601f8b01819004810282018101909252898152908a908a908190840183828082843760009201829052506080868101959095526001600160a01b038c811660c088015260e087018c905260678054600181018255925286517f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae6009909302928301805473ffffffffffffffffffffffffffffffffffffffff1916919092161781556020808801517f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6af840180546001600160801b0319169190981c1790965560408701517f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6b0830155606087015180518897929650611ba895507f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6b190930193500190612647565b5060808201518051611bc4916004840191602090910190612647565b5060a082015160058201805460ff19166001836003811115611bf657634e487b7160e01b600052602160045260246000fd5b021790555060c08201518160050160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060e082015181600601556101008201518160070155610120820151816008015550507f482b2eb46e5ccdfe01463353ff1bcebf7fab16be16dff18cc71091c7bb4ac28c8d8d8d8d8d8d8d8d8960000151604051611c8d9998979695949392919061302d565b60405180910390a160005b83811015611d7b578151611d6990868684818110611cc657634e487b7160e01b600052603260045260246000fd5b9050602002810190611cd891906130ff565b611ce69060208101906129a5565b878785818110611d0657634e487b7160e01b600052603260045260246000fd5b9050602002810190611d1891906130ff565b611d29906040810190602001612b56565b888886818110611d4957634e487b7160e01b600052603260045260246000fd5b9050602002810190611d5b91906130ff565b6101aa90604081019061309c565b80611d73816131a6565b915050611c98565b50519d9c50505050505050505050505050565b6033546001600160a01b03163314611de85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610218565b604080516080810182526060818301819052808201526001600160801b03198816815260ff87166020808301919091528251601f8701829004820281018201909352858352909190869086908190840183828082843760009201919091525050505060408083019190915280516020601f85018190048102820181019092528381529084908490819084018382808284376000920182905250606086019490945250506065805460018101825592525081517f8ff97419363ffd7000167f130ef7168fbea05faf9251824ca5043f113cc6a7c7600490920291820180546001600160801b03191660809290921c9190911781556020808401517f8ff97419363ffd7000167f130ef7168fbea05faf9251824ca5043f113cc6a7c8840155604084015180518594611f3e937f8ff97419363ffd7000167f130ef7168fbea05faf9251824ca5043f113cc6a7c9909101920190612647565b5060608201518051611f5a916003840191602090910190612647565b5050606554611f6c9150600190613154565b6001600160801b031988166000908152606b60205260409081902091909155517f46221b6add3bce22aaeafeb439ab5a44b0d1f8f12d18d49533b0dcf95734e4a390611fc390899089908990899089908990612fed565b60405180910390a150505050505050565b6033546001600160a01b0316331461202e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610218565b6040805160c08101825260608082015260006080820181905260a08201526001600160801b0319861681526001600160a01b03871660208083019190915260ff8616828401528251601f8501829004820281018201909352838352909190849084908190840183828082843760009201829052506060860194855260688054600181018255915285517fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c22097753600690920291820180546001600160801b03191660809290921c9190911781556020808801517fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977548401805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117905560408801517fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977558401559551805188979296506121af95507fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c2209775690930193500190612647565b506080820151600482015560a0909101516005909101805460ff191660ff9092169190911790556068546121e590600190613154565b6001600160801b031986166000908152606b60205260409081902091909155517fcd9d3cae03c2df21bc101125f0a030e027ebf1fee4c8e71291e0be1638220a1e9061223a9087908990889088908890612f4a565b60405180910390a1505050505050565b6033546001600160a01b031633146122a45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610218565b6001600160a01b0381166123205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610218565b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600054610100900460ff16806123a2575060005460ff16155b6124145760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610218565b600054610100900460ff1615801561243f576000805460ff1961ff0019909116610100171660011790555b612447612464565b61244f61252d565b8015612461576000805461ff00191690555b50565b600054610100900460ff168061247d575060005460ff16155b6124ef5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610218565b600054610100900460ff1615801561244f576000805460ff1961ff0019909116610100171660011790558015612461576000805461ff001916905550565b600054610100900460ff1680612546575060005460ff16155b6125b85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610218565b600054610100900460ff161580156125e3576000805460ff1961ff0019909116610100171660011790555b6033805473ffffffffffffffffffffffffffffffffffffffff19163390811790915560405181906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015612461576000805461ff001916905550565b8280546126539061316b565b90600052602060002090601f01602090048101928261267557600085556126bb565b82601f1061268e57805160ff19168380011785556126bb565b828001600101855582156126bb579182015b828111156126bb5782518255916020019190600101906126a0565b506126c79291506126cb565b5090565b5b808211156126c757600081556001016126cc565b80356126eb816131ed565b919050565b60008083601f840112612701578182fd5b50813567ffffffffffffffff811115612718578182fd5b602083019150836020808302850101111561273257600080fd5b9250929050565b80356126eb81613202565b60008083601f840112612755578182fd5b50813567ffffffffffffffff81111561276c578182fd5b60208301915083602082850101111561273257600080fd5b803560ff811681146126eb57600080fd5b6000602082840312156127a6578081fd5b81356127b1816131ed565b9392505050565b6000602082840312156127c9578081fd5b81516127b1816131ed565b600080604083850312156127e6578081fd5b82356127f1816131ed565b91506020830135612801816131ed565b809150509250929050565b600080600080600060808688031215612823578081fd5b853561282e816131ed565b9450602086013561283e81613202565b935061284c60408701612784565b9250606086013567ffffffffffffffff811115612867578182fd5b61287388828901612744565b969995985093965092949392505050565b6000806000806000806000806000806000806101208d8f0312156128a6578687fd5b6128af8d6126e0565b9b506128bd60208e01612739565b9a506128cb60408e01612784565b995067ffffffffffffffff60608e013511156128e5578687fd5b6128f58e60608f01358f01612744565b909950975067ffffffffffffffff60808e01351115612912578687fd5b6129228e60808f01358f01612744565b909750955061293360a08e016126e0565b945060c08d0135935060e08d0135925067ffffffffffffffff6101008e0135111561295c578081fd5b61296d8e6101008f01358f016126f0565b81935080925050509295989b509295989b509295989b565b600060208284031215612996578081fd5b815180151581146127b1578182fd5b6000602082840312156129b6578081fd5b81356127b181613202565b6000602082840312156129d2578081fd5b81516127b181613202565b60008060008060008060008060c0898b0312156129f8578384fd5b8835612a0381613202565b97506020890135612a1381613202565b9650612a2160408a01612784565b9550606089013567ffffffffffffffff80821115612a3d578586fd5b612a498c838d01612744565b909750955060808b0135915080821115612a61578485fd5b50612a6e8b828c01612744565b90945092505060a089013560038110612a85578182fd5b809150509295985092959890939650565b60008060008060008060808789031215612aae578182fd5b8635612ab981613202565b9550612ac760208801612784565b9450604087013567ffffffffffffffff80821115612ae3578384fd5b612aef8a838b01612744565b90965094506060890135915080821115612b07578384fd5b50612b1489828a01612744565b979a9699509497509295939492505050565b600060208284031215612b37578081fd5b5035919050565b600060208284031215612b4f578081fd5b5051919050565b600060208284031215612b67578081fd5b6127b182612784565b6000815180845260208085018081965082840281019150828601855b85811015612c20578284038952815160c06001600160801b0319808351168752808884015116888801525060408083015181880152506060808301518282890152612bd983890182612dff565b9250505060808083015187830382890152612bf48382612dff565b9250505060a0808301519250612c0c81880184612db1565b509986019994505090840190600101612b8c565b5091979650505050505050565b6000815180845260208085018081965082840281019150828601855b85811015612c20578284038952815160c06001600160801b031982511686526001600160a01b0387830151168787015260408083015181880152506060808301518282890152612c9b83890182612dff565b608085810151908a015260a09485015160ff1694909801939093525050509784019790840190600101612c49565b6000815180845260208085018081965082840281019150828601855b85811015612c20578284038952815180516001600160a01b03168552610140818701516001600160801b03198116878901525060408083015181880152506060808301518282890152612d3a83890182612dff565b9250505060808083015187830382890152612d558382612dff565b9250505060a080830151612d6b82890182612dc5565b505060c0828101516001600160a01b03169087015260e0808301519087015261010080830151908701526101209182015191909501529784019790840190600101612ce5565b60038110612dc157612dc16131d7565b9052565b60048110612dc157612dc16131d7565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452815b81811015612e2457602081850181015186830182015201612e08565b81811115612e355782602083870101525b50601f01601f19169290920160200192915050565b6000608080830181845280885180835260a0860191506020925060a0838202870101838b01865b83811015612f00577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6089840301855281516001600160801b0319815116845286810151878501526040808201518982870152612ecf8a870182612dff565b91505060608083015192508582038187015250612eec8183612dff565b968801969450505090850190600101612e71565b505086810384880152612f13818b612b70565b9450505050508281036040840152612f2b8186612cc9565b90508281036060840152612f3f8185612c2d565b979650505050505050565b60006001600160801b0319871682526001600160a01b038616602083015260ff8516604083015260806060830152612f3f608083018486612dd5565b60006001600160801b0319808b168352808a1660208401525060ff8816604083015260c06060830152612fbd60c083018789612dd5565b8281036080840152612fd0818688612dd5565b915050612fe060a0830184612db1565b9998505050505050505050565b60006001600160801b03198816825260ff871660208301526080604083015261301a608083018688612dd5565b8281036060840152612fe0818587612dd5565b60006001600160801b03198b16825260ff8a16602083015260e0604083015261305a60e08301898b612dd5565b828103606084015261306d81888a612dd5565b6001600160a01b03968716608085015260a08401959095525050921660c0909201919091529695505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126130d0578283fd5b83018035915067ffffffffffffffff8211156130ea578283fd5b60200191503681900382131561273257600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa1833603018112613132578182fd5b9190910192915050565b6000821982111561314f5761314f6131c1565b500190565b600082821015613166576131666131c1565b500390565b60028104600182168061317f57607f821691505b602082108114156131a057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156131ba576131ba6131c1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b6001600160a01b038116811461246157600080fd5b6001600160801b03198116811461246157600080fdfea264697066735822122004851b723b180b335e8787256fe8c4e84b2a5bf819e5d3b83b05d81513f9b69b64736f6c63430008020033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading