S Price: $0.529975 (-11.22%)

Contract

0x1EEC942Fc7F25D700fDD925f728C834724d93689

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Parent Transaction Hash Block From To
111147672025-03-02 5:02:322 days ago1740891752  Contract Creation0 S
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x5a6D422D...015b5ff37
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Market

Compiler Version
v0.8.22+commit.4fc1097e

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 7 : Market.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./LMSRMath.sol";

contract Market is Ownable, Pausable, ReentrancyGuard {
    // State variables
    address public factory;
    address public feeRecipient;
    address public reporter;
    address public governor;
    address public susdToken;
    uint256 public b;
    uint256 public resolutionDelay;
    uint256 public tradingFee;
    uint256 public disputeBondAmount;
    uint256 public reporterResolutionDeadline;
    uint256 public resolutionTimestamp;
    uint256 public totalVotes;
    uint256 public mostVotedOutcome;
    uint256 public winningOutcome;
    bool public resolved;

    string[] public outcomes;
    mapping(uint256 => uint256) public outcomeShares;
    mapping(address => mapping(uint256 => uint256)) public userShares;
    mapping(address => uint256) public disputeBonds;
    mapping(uint256 => uint256) public disputeVotes;
    mapping(address => bool) public hasVoted;

    uint256 public constant DISPUTE_PERIOD = 7 days;
    uint256 public constant MAX_TRADE_PERCENTAGE = 10;

    // Events
    event Trade(
        address indexed user,
        int256[] amounts,
        uint256[] shareBalances,
        uint256 feesPaid
    );
    event MarketResolved(uint256 indexed outcome);
    event ResolutionProposed(uint256 indexed outcome, uint256 resolutionTimestamp);
    event DisputeSubmitted(
        address indexed disputer,
        uint256 indexed proposedOutcome,
        uint256 bondAmount
    );
    event VoteCast(address indexed voter, uint256 indexed outcome);
    event Payout(address indexed user, uint256 amount);
    event ReporterDeadlineSet(uint256 deadline);
    event EmergencyResolution(uint256 indexed outcome, address resolver);

    struct MarketParams {
        string[] outcomes;
        address feeRecipient;
        uint256 resolutionDelay;
        address reporter;
        address governor;
        uint256 b;
        uint256 tradingFee;
        address susdToken;
        uint256 disputeBondAmount;
    }

    constructor(
        string[] memory _outcomes,
        address _feeRecipient,
        uint256 _resolutionDelay,
        address _reporter,
        address _governor,
        uint256 _b,
        uint256 _tradingFee,
        address _susdToken,
        uint256 _disputeBondAmount
    ) Ownable(_governor) Pausable() ReentrancyGuard() {


        require(_outcomes.length >= 2, "Must have at least 2 outcomes");
        require(_feeRecipient != address(0), "Invalid fee recipient");
        require(_reporter != address(0), "Invalid reporter");
        require(_governor != address(0), "Invalid governor");
        require(_susdToken != address(0), "Invalid SUSD token");
        require(_b > 0, "Invalid liquidity parameter");

        factory = msg.sender;
        feeRecipient = _feeRecipient;
        reporter = _reporter;
        governor = _governor;
        susdToken = _susdToken;
        b = _b;
        resolutionDelay = _resolutionDelay;
        tradingFee = _tradingFee;
        disputeBondAmount = _disputeBondAmount;

        for (uint256 i = 0; i < _outcomes.length; i++) {
            outcomes.push(_outcomes[i]);
            outcomeShares[i] = 1e18;
        }

        reporterResolutionDeadline = block.timestamp + 30 days;
        emit ReporterDeadlineSet(reporterResolutionDeadline);

        _transferOwnership(governor);
    }

    // Modifiers
    modifier onlyReporter() {
        require(msg.sender == reporter, "Only reporter can call this function");
        _;
    }

    modifier onlyGovernor() {
        require(msg.sender == governor, "Only governor can call this function");
        _;
    }

    modifier onlyFactory() {
        require(msg.sender == factory, "Only factory can call this function");
        _;
    }

    // Existing Market contract functions
    function getCurrentShares() public view returns (uint256[] memory) {
        uint256[] memory shares = new uint256[](outcomes.length);
        for (uint256 i = 0; i < outcomes.length; i++) {
            shares[i] = outcomeShares[i];
        }
        return shares;
    }

    function getCost(int256[] memory shareDeltas) public view returns (int256) {
        require(shareDeltas.length == outcomes.length, "Invalid array length");
        
        // Get current shares
        uint256[] memory shares = getCurrentShares();
        
        // Calculate cost using LMSR math
        return LMSRMath.calcCost(shares, shareDeltas, b);
    }

    function getNetCost(int256[] memory shareDeltas) public view returns (uint256) {
        int256 cost = getCost(shareDeltas);
        
        // If cost is negative (selling), return 0 as net cost
        if (cost <= 0) return 0;
        
        // Apply trading fee
        uint256 fee = (uint256(cost) * tradingFee) / 10000;
        return uint256(cost) + fee;
    }

    function getMarginalPrice(uint256 outcomeIndex) public view returns (uint256) {
        require(outcomeIndex < outcomes.length, "Invalid outcome index");
        
        uint256[] memory shares = getCurrentShares();
        return LMSRMath.calcMarginalPrice(outcomeIndex, shares, b);
    }

    function trade(int256[] calldata shareDeltas, uint256 maxCost) external nonReentrant whenNotPaused {
        // CHECKS
        require(!resolved, "Market already resolved");
        require(shareDeltas.length == outcomes.length, "Invalid array length");
        
        // Validate trade size to prevent manipulation
        uint256[] memory shares = getCurrentShares();
        for (uint256 i = 0; i < shareDeltas.length; i++) {
            if (shareDeltas[i] > 0) {
                // Ensure buy orders don't exceed maximum percentage of current market shares
                require(
                    uint256(shareDeltas[i]) <= (shares[i] * MAX_TRADE_PERCENTAGE) / 100,
                    "Trade size too large"
                );
            } else if (shareDeltas[i] < 0) {
                // Ensure sell orders don't exceed user's balance
                require(
                    uint256(-shareDeltas[i]) <= userShares[msg.sender][i],
                    "Insufficient shares"
                );
            }
        }
        
        // Calculate cost using LMSR
        int256 cost = getCost(shareDeltas);
        
        // Apply trading fee (only for buys)
        uint256 fee = 0;
        uint256 tradeTotalCost = 0;
        if (cost > 0) {
            fee = (uint256(cost) * tradingFee) / 10000;
            tradeTotalCost = uint256(cost) + fee;
            
            // Slippage protection
            require(tradeTotalCost <= maxCost, "Slippage exceeded");
        }
        
        // EFFECTS
        // Update state variables
        for (uint256 i = 0; i < shareDeltas.length; i++) {
            if (shareDeltas[i] > 0) {
                outcomeShares[i] += uint256(shareDeltas[i]);
                userShares[msg.sender][i] += uint256(shareDeltas[i]);
            } else if (shareDeltas[i] < 0) {
                outcomeShares[i] -= uint256(-shareDeltas[i]);
                userShares[msg.sender][i] -= uint256(-shareDeltas[i]);
            }
        }
        
        if (cost > 0) {
            // User is buying, transfer SUSD from user
            require(
                IERC20(susdToken).transferFrom(msg.sender, address(this), uint256(cost)),
                "Trade transfer failed"
            );
            
            // Transfer fee
            if (fee > 0) {
                require(
                    IERC20(susdToken).transferFrom(msg.sender, feeRecipient, fee),
                    "Fee transfer failed"
                );
            }
        } else if (cost < 0) {
            // User is selling, transfer SUSD to user
            require(
                IERC20(susdToken).transfer(msg.sender, uint256(-cost)),
                "Payout transfer failed"
            );
        }
        
        // Get updated share balances for the event
        uint256[] memory newBalances = getCurrentShares();
        emit Trade(msg.sender, shareDeltas, newBalances, fee);
    }

    function resolveMarket(uint256 outcome) external onlyReporter {
        require(!resolved, "Market already resolved");
        require(block.timestamp >= reporterResolutionDeadline, "Too early");
        require(outcome < outcomes.length, "Invalid outcome");

        winningOutcome = outcome;
        resolutionTimestamp = block.timestamp;
        resolved = true;

        emit ResolutionProposed(outcome, resolutionTimestamp);
        emit MarketResolved(outcome);
    }

    function overrideResolution(uint256 outcome) external onlyGovernor {
        require(!resolved, "Market already resolved");
        require(block.timestamp < resolutionTimestamp, "Dispute period ended");
        require(outcome < outcomes.length, "Invalid outcome");
        
        resolved = true;
        winningOutcome = outcome;
        resolutionTimestamp = 0;
        
        emit MarketResolved(outcome);
    }

    function payout() external nonReentrant {
        require(resolved, "Market not resolved");
        uint256 shares = userShares[msg.sender][winningOutcome];
        require(shares > 0, "No winning shares");
        
        uint256 payoutAmount = shares;
        userShares[msg.sender][winningOutcome] = 0;
        
        require(IERC20(susdToken).transfer(msg.sender, payoutAmount), "Payout transfer failed");
        
        emit Payout(msg.sender, payoutAmount);
    }
    
    // Dispute mechanism for users
    function submitDispute(uint256 proposedOutcome) external nonReentrant {
        require(!resolved, "Market already resolved");
        require(proposedOutcome < outcomes.length, "Invalid outcome");
        require(!hasVoted[msg.sender], "Already voted");
        require(block.timestamp <= resolutionTimestamp + DISPUTE_PERIOD, "Dispute period ended");
        require(IERC20(susdToken).transferFrom(msg.sender, address(this), disputeBondAmount), "Bond transfer failed");

        disputeBonds[msg.sender] = disputeBondAmount;
        disputeVotes[proposedOutcome] += disputeBondAmount;
        totalVotes += disputeBondAmount;
        hasVoted[msg.sender] = true;

        if (disputeVotes[proposedOutcome] > disputeVotes[mostVotedOutcome]) {
            mostVotedOutcome = proposedOutcome;
        }

        emit DisputeSubmitted(msg.sender, proposedOutcome, disputeBondAmount);
        emit VoteCast(msg.sender, proposedOutcome);
    }
    
    function finalizeDispute() external nonReentrant {
        require(!resolved, "Market already resolved");
        require(block.timestamp > resolutionTimestamp + DISPUTE_PERIOD, "Dispute period not ended");
        require(totalVotes > 0, "No disputes submitted");

        winningOutcome = mostVotedOutcome;
        resolved = true;

        emit MarketResolved(mostVotedOutcome);
    }

    function claimDisputeBond() external nonReentrant {
        require(resolved, "Market not resolved");
        require(disputeBonds[msg.sender] > 0, "No bond to claim");
        require(block.timestamp > resolutionTimestamp + DISPUTE_PERIOD, "Dispute period not ended");

        uint256 bondAmount = disputeBonds[msg.sender];
        disputeBonds[msg.sender] = 0;

        // If voted for winning outcome, get reward from losing votes
        if (hasVoted[msg.sender]) {
            uint256 shareOfWinningVotes = (bondAmount * 1e18) / disputeVotes[winningOutcome];
            bondAmount += (totalVotes - disputeVotes[winningOutcome]) * shareOfWinningVotes / 1e18;
        }

        require(IERC20(susdToken).transfer(msg.sender, bondAmount), "Bond return failed");
    }

    // Emergency resolution if reporter never resolves
    function emergencyResolve() external {
        require(!resolved, "Market already resolved");
        require(block.timestamp > reporterResolutionDeadline, "Reporter deadline not passed");
        
        // If disputes exist, use most voted outcome
        uint256 finalOutcome = totalVotes > 0 ? mostVotedOutcome : 0;
        
        resolved = true;
        winningOutcome = finalOutcome;
        
        emit EmergencyResolution(finalOutcome, msg.sender);
        emit MarketResolved(finalOutcome);
    }
    
    // Allow governor to set a new reporter deadline
    function setReporterDeadline(uint256 newDeadline) external onlyGovernor {
        require(newDeadline > block.timestamp, "Deadline must be in future");
        reporterResolutionDeadline = newDeadline;
        emit ReporterDeadlineSet(newDeadline);
    }
    
    function verifyInitialization(
        string[] calldata _outcomes,
        uint256 _resolutionDelay,
        address _reporter,
        address _governor
    ) external view returns (bool) {
        // Verify that initialization parameters match
        if (_outcomes.length != outcomes.length) return false;
        if (_reporter != reporter) return false;
        if (_governor != governor) return false;
        if (_resolutionDelay != resolutionDelay) return false;
        
        // Verify outcomes match
        for (uint256 i = 0; i < _outcomes.length; i++) {
            if (keccak256(bytes(_outcomes[i])) != keccak256(bytes(outcomes[i]))) {
                return false;
            }
        }
        
        return true;
    }

    // View functions
    function getMarketInfo() external view returns (
        string[] memory,
        uint256[] memory,
        uint256,
        bool,
        uint256
    ) {
        uint256[] memory shares = getCurrentShares();
        return (outcomes, shares, b, resolved, winningOutcome);
    }

    function getResolutionDelay() external view returns (uint256) {
        return resolutionDelay;
    }

    function getProposedOutcome() external view returns (uint256) {
        return winningOutcome;
    }

    function getResolutionTimestamp() external view returns (uint256) {
        return resolutionTimestamp;
    }

    function getReporter() external view returns (address) {
        return reporter;
    }

    function getGovernor() external view returns (address) {
        return governor;
    }

    function getAIAddress() external view returns (address) {
        return address(this);
    }

    function getTradingFee() external view returns (uint256) {
        return tradingFee;
    }

    // Pause/unpause functions
    function pause() external onlyOwner {
        _pause();
    }
    
    function unpause() external onlyOwner {
        _unpause();
    }
}

File 2 of 7 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

File 3 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

File 4 of 7 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 5 of 7 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 6 of 7 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

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

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 7 of 7 : LMSRMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;


library LMSRMath {
    // Fixed point precision
    uint256 constant FIXED_ONE = 1e18;
    
    // Maximum value for exponentiation to avoid overflow
    uint256 constant MAX_EXPONENT = 100e18;
    
    
    function calcCost(
        uint256[] memory outcomeShares,
        int256[] memory shareDeltas,
        uint256 b
    ) internal pure returns (int256) {
        require(outcomeShares.length == shareDeltas.length, "Array length mismatch");
        require(outcomeShares.length > 0, "Empty arrays");
        require(b > 0, "Invalid liquidity parameter");
        
        // Calculate cost before trade
        uint256 costBefore = calcCostFromShares(outcomeShares, b);
        
        // Calculate new outcome shares after trade
        uint256[] memory newShares = new uint256[](outcomeShares.length);
        for (uint256 i = 0; i < outcomeShares.length; i++) {
            if (shareDeltas[i] >= 0) {
                newShares[i] = outcomeShares[i] + uint256(shareDeltas[i]);
            } else {
                require(outcomeShares[i] >= uint256(-shareDeltas[i]), "Insufficient shares");
                newShares[i] = outcomeShares[i] - uint256(-shareDeltas[i]);
            }
        }
        
        // Calculate cost after trade
        uint256 costAfter = calcCostFromShares(newShares, b);
        
        // Return difference in costs
        if (costAfter >= costBefore) {
            return int256(costAfter - costBefore);
        } else {
            return -int256(costBefore - costAfter);
        }
    }
    

    function calcCostFromShares(
        uint256[] memory shares,
        uint256 b
    ) internal pure returns (uint256) {
        uint256 sum = 0;
        
        // Calculate sum of exp(q_i/b) for all outcomes
        for (uint256 i = 0; i < shares.length; i++) {
            // Normalize shares by dividing by b
            uint256 normalizedShares = (shares[i] * FIXED_ONE) / b;
            
            // Prevent overflow by capping the exponent
            if (normalizedShares > MAX_EXPONENT) {
                normalizedShares = MAX_EXPONENT;
            }
            
            // Calculate exp(q_i/b) and add to sum
            sum += exp(normalizedShares);
        }
        
        // Calculate b * ln(sum)
        return (b * ln(sum)) / FIXED_ONE;
    }
    

    function calcMarginalPrice(
        uint256 outcomeIndex,
        uint256[] memory shares,
        uint256 b
    ) internal pure returns (uint256) {
        require(outcomeIndex < shares.length, "Invalid outcome index");
        
        // Calculate sum of exp(q_i/b) for all outcomes
        uint256 sum = 0;
        for (uint256 i = 0; i < shares.length; i++) {
            uint256 normalizedShares = (shares[i] * FIXED_ONE) / b;
            if (normalizedShares > MAX_EXPONENT) {
                normalizedShares = MAX_EXPONENT;
            }
            sum += exp(normalizedShares);
        }
        
        // Calculate exp(q_i/b) for the specific outcome
        uint256 normalizedOutcomeShares = (shares[outcomeIndex] * FIXED_ONE) / b;
        if (normalizedOutcomeShares > MAX_EXPONENT) {
            normalizedOutcomeShares = MAX_EXPONENT;
        }
        uint256 outcomeExp = exp(normalizedOutcomeShares);
        
        // Calculate price = exp(q_i/b) / sum(exp(q_j/b))
        return (outcomeExp * FIXED_ONE) / sum;
    }
    

    function exp(uint256 x) internal pure returns (uint256) {
        // If x is 0, e^0 = 1
        if (x == 0) return FIXED_ONE;
        
        // If x is very large, return maximum value to avoid overflow
        if (x > MAX_EXPONENT) return type(uint256).max;
        
        // Taylor series approximation for e^x
        // e^x = 1 + x + x^2/2! + x^3/3! + ... + x^n/n!
        uint256 result = FIXED_ONE;  // 1
        uint256 term = FIXED_ONE;    // Start with 1
        
        // Add x
        term = (term * x) / FIXED_ONE;
        result += term;
        
        // Add x^2/2!
        term = (term * x) / (2 * FIXED_ONE);
        result += term;
        
        // Add x^3/3!
        term = (term * x) / (3 * FIXED_ONE);
        result += term;
        
        // Add x^4/4!
        term = (term * x) / (4 * FIXED_ONE);
        result += term;
        
        // Add x^5/5!
        term = (term * x) / (5 * FIXED_ONE);
        result += term;
        
        // Add x^6/6!
        term = (term * x) / (6 * FIXED_ONE);
        result += term;
        
        // Add x^7/7!
        term = (term * x) / (7 * FIXED_ONE);
        result += term;
        
        // Add x^8/8!
        term = (term * x) / (8 * FIXED_ONE);
        result += term;
        
        return result;
    }
    

    function ln(uint256 x) internal pure returns (uint256) {
        // If x is 0 or very small, return a very negative number
        // In practice, this should never happen in LMSR
        if (x < FIXED_ONE / 1000) {
            return 0; // Should revert in practice
        }
        
        // If x is 1, ln(1) = 0
        if (x == FIXED_ONE) return 0;
        
        // If x < 1, use ln(x) = -ln(1/x)
        if (x < FIXED_ONE) {
            return type(uint256).max - ln((FIXED_ONE * FIXED_ONE) / x) + 1;
        }
        
        // For x > 1, use binary search to find y such that e^y = x
        uint256 low = 0;
        uint256 high = MAX_EXPONENT;
        uint256 mid;
        uint256 midExp;
        
        // Binary search for 32 iterations (sufficient precision)
        for (uint256 i = 0; i < 32; i++) {
            mid = (low + high) / 2;
            midExp = exp(mid);
            
            if (midExp < x) {
                low = mid;
            } else if (midExp > x) {
                high = mid;
            } else {
                return mid; // Exact match found
            }
        }
        
        // Return the closest approximation
        return (low + high) / 2;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"string[]","name":"_outcomes","type":"string[]"},{"internalType":"address","name":"_feeRecipient","type":"address"},{"internalType":"uint256","name":"_resolutionDelay","type":"uint256"},{"internalType":"address","name":"_reporter","type":"address"},{"internalType":"address","name":"_governor","type":"address"},{"internalType":"uint256","name":"_b","type":"uint256"},{"internalType":"uint256","name":"_tradingFee","type":"uint256"},{"internalType":"address","name":"_susdToken","type":"address"},{"internalType":"uint256","name":"_disputeBondAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"disputer","type":"address"},{"indexed":true,"internalType":"uint256","name":"proposedOutcome","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bondAmount","type":"uint256"}],"name":"DisputeSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"},{"indexed":false,"internalType":"address","name":"resolver","type":"address"}],"name":"EmergencyResolution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"MarketResolved","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":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Payout","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ReporterDeadlineSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"resolutionTimestamp","type":"uint256"}],"name":"ResolutionProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256[]","name":"amounts","type":"int256[]"},{"indexed":false,"internalType":"uint256[]","name":"shareBalances","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"feesPaid","type":"uint256"}],"name":"Trade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"VoteCast","type":"event"},{"inputs":[],"name":"DISPUTE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TRADE_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"b","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimDisputeBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disputeBondAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"disputeBonds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"disputeVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyResolve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalizeDispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAIAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256[]","name":"shareDeltas","type":"int256[]"}],"name":"getCost","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentShares","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGovernor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"outcomeIndex","type":"uint256"}],"name":"getMarginalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMarketInfo","outputs":[{"internalType":"string[]","name":"","type":"string[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256[]","name":"shareDeltas","type":"int256[]"}],"name":"getNetCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProposedOutcome","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReporter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getResolutionDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getResolutionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hasVoted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mostVotedOutcome","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"outcomeShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"outcomes","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"overrideResolution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reporter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reporterResolutionDeadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resolutionDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resolutionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"resolveMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resolved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDeadline","type":"uint256"}],"name":"setReporterDeadline","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposedOutcome","type":"uint256"}],"name":"submitDispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"susdToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256[]","name":"shareDeltas","type":"int256[]"},{"internalType":"uint256","name":"maxCost","type":"uint256"}],"name":"trade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tradingFee","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":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string[]","name":"_outcomes","type":"string[]"},{"internalType":"uint256","name":"_resolutionDelay","type":"uint256"},{"internalType":"address","name":"_reporter","type":"address"},{"internalType":"address","name":"_governor","type":"address"}],"name":"verifyInitialization","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winningOutcome","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060408181526004918236101561001657600080fd5b600092833560e01c918263010ec44114611a795750816304f09b4a1461108d57816309eef43e14611a3b5781630c340a24146115035781630d15fd7714611a1c5781630ff352f5146119415781631bd8db03146114e457816323341a051461180d5781632d844c49146116ae5781633f4ba83a146116405781633f6fa6551461161c5781634020dffc14611574578163469048401461154b5781634df7e3d01461152c5781634fc07d751461150357816356f43352146114e45781635a0e8290146114ac5781635c975abb146114875781635fae63711461146c5781636399d03d1461134c57816363bd1d4a1461121557816370aa268714611046578163715018a6146111bb5781638456cb591461115c57816385af5d351461064e578163882636cb1461113f5781638948261d1461110e5781638da5cb5b146110e65781639236260b146110cb57816397f03f1c146110ac5781639b34ae031461108d5781639da0ae3e14611065578163a0cd655214611046578163a5bbe22b14611028578163ad9914f814611000578163b2e017c714610a77578163bee4f74614610a5b578163c13ebbe614610a3c578163c45a015514610a13578163d3967a6b146107e4578163d8ca24c11461076f578163d92f0810146106f5578163deb8d278146106d6578163e2ae5524146106ae578163e53dc6801461066d578163e62ff3eb1461064e578163ead1df171461044c578163ec77537b14610383578163eed2a1471461030c578163f2fde38b14610281575063f39690e41461025657600080fd5b3461027d578160031936011261027d5760065490516001600160a01b039091168152602090f35b5080fd5b9050346103085760203660031901126103085761029c611a9d565b906102a56122a5565b6001600160a01b039182169283156102f257505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8280fd5b9050823461038057602036600319011261038057813560115481101561027d5761033590611c3a565b92909261036e57835161036a9085610358826103518189611c87565b0383611b2c565b51918291602083526020830190611ab8565b0390f35b634e487b7160e01b8252819052602490fd5b80fd5b90503461030857826003193601126103085761039d6122d1565b601054916103ae60ff841615611d44565b600c5462093a808101809111610439576103c9904211612259565b600d54156103fe5750506001600e549182600f5560ff19161760105560008051602061275d8339815191528280a26001805580f35b906020606492519162461bcd60e51b83528201526015602482015274139bc8191a5cdc1d5d195cc81cdd589b5a5d1d1959605a1b6044820152fd5b634e487b7160e01b855260118352602485fd5b919050346103085782600319360112610308576104676122d1565b61047560ff60105416611f13565b33835260209060148252808420541561061a57600c5462093a808101809111610607576104a3904211612259565b33845260148252838282822082815491556016825260ff8484205416610587575b600654845163a9059cbb60e01b81523388820190815260208101939093529384926001600160a01b039092169183919082906040015b03925af190811561057d578591610550575b501561051a57836001805580f35b5162461bcd60e51b8152918201526012602482015271109bdb99081c995d1d5c9b8819985a5b195960721b604482015260649150fd5b6105709150833d8511610576575b6105688183611b2c565b810190611f55565b3861050c565b503d61055e565b82513d87823e3d90fd5b915050670de0b6b3a76400008082028281048214831517156105f4576105ed879386936105e66104fa946105e16105cc600f5492838b5260158a528b8b205490611e85565b91600d54908a52601589528a8a205490612104565b611e2c565b0490611e9d565b90506104c4565b634e487b7160e01b875260118652602487fd5b634e487b7160e01b855260118452602485fd5b5162461bcd60e51b815291820152601060248201526f4e6f20626f6e6420746f20636c61696d60801b604482015260649150fd5b50503461027d578160031936011261027d57602090600c549051908152f35b50503461027d578060031936011261027d5760209181906001600160a01b03610694611a9d565b168152601384528181206024358252845220549051908152f35b9050346103085760203660031901126103085760209282913581526012845220549051908152f35b50503461027d578160031936011261027d57602090600e549051908152f35b83903461027d57602036600319011261027d573561071e60018060a01b03600554163314611dd4565b600160105461073060ff821615611d44565b61073d600c544210612111565b61074a6011548410611ed5565b60ff19161760105580600f5581600c5560008051602061275d8339815191528280a280f35b9050346103085760803660031901126103085780359067ffffffffffffffff82116107e0576107a091369101611c09565b6001600160a01b03936044359291908584168403610380576064359586168603610380575091602094916107d79360243591612154565b90519015158152f35b8380fd5b91905034610308576020806003193601126107e0578235926108046122d1565b61081360ff6010541615611d44565b6108206011548510611ed5565b3385526016825260ff83862054166109e257600c5462093a8081018091116109cf5761084e90421115612111565b600654600a5484516323b872dd60e01b815233848201908152306020820152604081019290925291849183916001600160a01b03169082908a90829060600103925af19081156109c55786916109a8575b50156109705750907fde5c01453f40d10a9cdeaaa7f2b644609198dabb4cf1d17a1496d1d506e2346d8392600a54338752601482528084882055848752601582526108ee848820918254611e9d565b90556108fe600a54600d54611e9d565b600d5533865260168152828620805460ff191660011790558386526015815282862054600e5487528387205410610967575b600a5492519283523392a3337fa36cc2bebb74db33e9f88110a07ef56e1b31b24b4c4f51b54b1664266e29f45b8380a36001805580f35b83600e55610930565b915162461bcd60e51b8152918201526014602482015273109bdb99081d1c985b9cd9995c8819985a5b195960621b6044820152606490fd5b6109bf9150833d8511610576576105688183611b2c565b3861089f565b84513d88823e3d90fd5b634e487b7160e01b865260118252602486fd5b915162461bcd60e51b815291820152600d60248201526c105b1c9958591e481d9bdd1959609a1b6044820152606490fd5b50503461027d578160031936011261027d5760025490516001600160a01b039091168152602090f35b50503461027d578160031936011261027d57602090600b549051908152f35b50503461027d578160031936011261027d5760209051600a8152f35b905034610308578160031936011261030857803567ffffffffffffffff81116107e057610aa79036908301611c09565b9190602491610ab46122d1565b610abc6124b7565b610acb60ff6010541615611d44565b6011610ada6011548614611fb2565b610ae261205f565b875b868110610f1a57505050610b01610afc368685611b7c565b611ff5565b92869387811380610ebf575b885b878110610dcc575015610d255760065487516323b872dd60e01b808252338683019081523060208281019190915260408201959095526001600160a01b03939192918591839186169082908f90829060600103925af1908115610d1b578b91610cfe575b5015610cc4578680610c0a575b5050505050505b610b8f61205f565b84519380606086016060875252608085019290875b818110610bf45750505081610be391857f3b55ce5afbfa91d536b2a2394b85b42d8abc5fb48daa07088154bb0bc5fa6c00969594036020860152611af8565b938201528033930390a26001805580f35b8235855260209485019490920191600101610ba4565b6006546003548b51938452338885019081529085166001600160a01b03166020820152604081019290925291928492849291169082908d90829060600103925af1908115610cba578991610c9d575b5015610c6757808086610b80565b865162461bcd60e51b81529283015260139082015272119959481d1c985b9cd9995c8819985a5b1959606a1b6044820152606490fd5b610cb49150823d8411610576576105688183611b2c565b38610c59565b88513d8b823e3d90fd5b885162461bcd60e51b815280860184905260158186015274151c985919481d1c985b9cd9995c8819985a5b1959605a1b6044820152606490fd5b610d159150843d8611610576576105688183611b2c565b38610b73565b8a513d8d823e3d90fd5b9050868112610d36575b5050610b87565b600654610d819260209290916001600160a01b031690610d55906120b1565b885163a9059cbb60e01b815233938101938452602084019190915293849283918b918391604090910190565b03925af18015610dc257610d9c918791610da3575b50611f6d565b3880610d2f565b610dbc915060203d602011610576576105688183611b2c565b38610d96565b85513d88823e3d90fd5b808a610ddb6001938b8a6120a1565b351315610e43578a610dee828b8a6120a1565b35828252610e068c6020936012855220918254611e9d565b90558b610e14838c8b6120a1565b336000908152601360205260409020903592908490925252610e3a8b8d20918254611e9d565b90555b01610b0f565b8a610e4f828b8a6120a1565b351215610e3d578a610e6b610e65838c8b6120a1565b356120b1565b828252610e828c6020936012855220918254612104565b90558b610e93610e65848d8c6120a1565b3360009081526013602052604090209092908490925252610eb88b8d20918254612104565b9055610e3d565b9450612710610ed060095483611e2c565b04948235610ede8784611e9d565b1115610b0d57875162461bcd60e51b81526020818601526011818501527014db1a5c1c1859d948195e18d959591959607a1b6044820152606490fd5b88610f268289886120a1565b351315610fb457610f388188876120a1565b35610f43828461204b565b5190600a91828102928184041490151715610fa357606480920410610f6d57506001905b01610ae4565b885162461bcd60e51b81526020818701526014818901527354726164652073697a6520746f6f206c6172676560601b6044820152fd5b634e487b7160e01b8b52848652878bfd5b8089610fc36001938a896120a1565b351215610f6757610ffb610fdb610e65838b8a6120a1565b336000908152601360205260409020838d526020528a8c205410156120c2565b610f67565b9050346103085782600319360112610308575490516001600160a01b03909116815260209150f35b50503461027d578160031936011261027d576020905162093a808152f35b50503461027d578160031936011261027d576020906008549051908152f35b9050346103085760203660031901126103085760209282913581526015845220549051908152f35b50503461027d578160031936011261027d57602090600f549051908152f35b50503461027d578160031936011261027d57602090600a549051908152f35b50503461027d578160031936011261027d5760209051308152f35b50503461027d578160031936011261027d57905490516001600160a01b039091168152602090f35b50503461027d578160031936011261027d5761036a9061112c61205f565b9051918291602083526020830190611af8565b50503461027d57602090611155610afc36611bca565b9051908152f35b50503461027d578160031936011261027d5760207f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589161119a6122a5565b6111a26124b7565b835460ff60a01b1916600160a01b17845551338152a180f35b83346103805780600319360112610380576111d46122a5565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b90503461030857826003193601126103085761122f6122d1565b61123d60ff60105416611f13565b33835260206013815282842091600f5492838652825283852054928315611316573380875260138452858720918752908352848620869055600654855163a9059cbb60e01b815292830191825260208201859052839183916001600160a01b03169082908990829060400103925af190811561130c577f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a69394916112e79187916112f55750611f6d565b519283523392a26001805580f35b610dbc9150843d8611610576576105688183611b2c565b84513d87823e3d90fd5b5060649184519162461bcd60e51b835282015260116024820152704e6f2077696e6e696e672073686172657360781b6044820152fd5b91905034610308576020366003190112610308578154823592906001600160a01b0316330361141e576010549061138660ff831615611d44565b600b5442106113ef57506020839260017fffac1500e5679b3ff6518aa340b377b1b544ffde8e2e1f3a786f8b1fe9f140de936113c56011548710611ed5565b85600f5542600c5560ff19161760105551428152a260008051602061275d8339815191528280a280f35b606490602084519162461bcd60e51b83528201526009602482015268546f6f206561726c7960b81b6044820152fd5b6020608492519162461bcd60e51b83528201526024808201527f4f6e6c79207265706f727465722063616e2063616c6c20746869732066756e636044820152633a34b7b760e11b6064820152fd5b50503461027d5760209061115561148236611bca565b611eaa565b50503461027d578160031936011261027d5760ff6020925460a01c1690519015158152f35b50503461027d57602036600319011261027d5760209181906001600160a01b036114d4611a9d565b1681526014845220549051908152f35b50503461027d578160031936011261027d576020906009549051908152f35b50503461027d578160031936011261027d5760055490516001600160a01b039091168152602090f35b50503461027d578160031936011261027d576020906007549051908152f35b50503461027d578160031936011261027d5760035490516001600160a01b039091168152602090f35b91905034610308576020366003190112610308578135916115a060018060a01b03600554163314611dd4565b428311156115da5750816020917fb78308b2eb98fa00faea36698f56c2389c9bd7c8e76f7c0f7725e33135d4809293600b5551908152a180f35b6020606492519162461bcd60e51b8352820152601a60248201527f446561646c696e65206d75737420626520696e206675747572650000000000006044820152fd5b50503461027d578160031936011261027d5760209060ff6010541690519015158152f35b90503461030857826003193601126103085761165a6122a5565b82549060ff8260a01c16156116a0575060ff60a01b19168255513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa90602090a180f35b8251638dfc202b60e01b8152fd5b90508234610380576020366003190112610380578135916011916116d56011548510611d90565b6116dd61205f565b92600754936116ee81518710611d90565b829683975b825189101561177457611706898461204b565b51670de0b6b3a7640000908181029181830414901517156117625760019161174c6117348a61175294611e85565b68056bc75e2d6310000080821161175a575b506124d8565b90611e9d565b9801976116f3565b90508d611746565b634e487b7160e01b8652848752602486fd5b86856117818a899661204b565b5191670de0b6b3a764000092838102908082048514901517156117fa576117c2916117ab91611e85565b68056bc75e2d631000008082116117f257506124d8565b8281029281840414901517156117df576020846111558585611e85565b634e487b7160e01b815260118552602490fd5b905087611746565b634e487b7160e01b835260118752602483fd5b82843461038057806003193601126103805761182761205f565b9160075460ff60105416600f54916011549561184287611b64565b9561184f86519788611b2c565b878752602096602081019889601184527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6884915b83831061190f575050505086519760a089019160a08a525180925260c0890160c08360051b8b01019a93905b8382106118e2575050505050866118ce91878099036020890152611af8565b938501521515606084015260808301520390f35b909192939a83806119006001938f8f60bf1990830301875251611ab8565b9d0192019201909392916118af565b60018c81928d9e97989e5161192f816119288189611c87565b0382611b2c565b8152019201920191909a94939a611883565b8391503461027d578160031936011261027d576010549061196560ff831615611d44565b600b544211156119d957507fe4d6efcb12aa89dc35692182a18a22bcfd2c5d86dd221420209b7287daab0888602060019394600d5415156000146119d057600e549485945b60ff19161760105583600f5551338152a260008051602061275d8339815191528280a280f35b859485946119aa565b606490602085519162461bcd60e51b8352820152601c60248201527f5265706f7274657220646561646c696e65206e6f7420706173736564000000006044820152fd5b50503461027d578160031936011261027d57602090600d549051908152f35b50503461027d57602036600319011261027d5760209160ff9082906001600160a01b03611a66611a9d565b1681526016855220541690519015158152f35b849134610308578260031936011261030857546001600160a01b0316815260209150f35b600435906001600160a01b0382168203611ab357565b600080fd5b919082519283825260005b848110611ae4575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201611ac3565b90815180825260208080930193019160005b828110611b18575050505090565b835185529381019392810192600101611b0a565b90601f8019910116810190811067ffffffffffffffff821117611b4e57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111611b4e5760051b60200190565b9291611b8782611b64565b91611b956040519384611b2c565b829481845260208094019160051b8101928311611ab357905b828210611bbb5750505050565b81358152908301908301611bae565b6020600319820112611ab3576004359067ffffffffffffffff8211611ab35780602383011215611ab357816024611c0693600401359101611b7c565b90565b9181601f84011215611ab35782359167ffffffffffffffff8311611ab3576020808501948460051b010111611ab357565b601154811015611c715760116000527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c680190600090565b634e487b7160e01b600052603260045260246000fd5b80546000939260018083169383821c938515611d3a575b6020958686108114611d2457858552908115611d055750600114611cc4575b5050505050565b90939495506000929192528360002092846000945b838610611cf157505050500101903880808080611cbd565b805485870183015294019385908201611cd9565b60ff19168685015250505090151560051b010191503880808080611cbd565b634e487b7160e01b600052602260045260246000fd5b93607f1693611c9e565b15611d4b57565b60405162461bcd60e51b815260206004820152601760248201527f4d61726b657420616c7265616479207265736f6c7665640000000000000000006044820152606490fd5b15611d9757565b60405162461bcd60e51b8152602060048201526015602482015274092dcecc2d8d2c840deeae8c6dedaca40d2dcc8caf605b1b6044820152606490fd5b15611ddb57565b60405162461bcd60e51b8152602060048201526024808201527f4f6e6c7920676f7665726e6f722063616e2063616c6c20746869732066756e636044820152633a34b7b760e11b6064820152608490fd5b81810292918115918404141715611e3f57565b634e487b7160e01b600052601160045260246000fd5b8015611e6f576ec097ce7bc90715b34b9f10000000000490565b634e487b7160e01b600052601260045260246000fd5b8115611e6f570490565b9060018201809211611e3f57565b91908201809211611e3f57565b611eb390611ff5565b6000811315611ecf57611c06906127106105e660095483611e2c565b50600090565b15611edc57565b60405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206f7574636f6d6560881b6044820152606490fd5b15611f1a57565b60405162461bcd60e51b815260206004820152601360248201527213585c9ad95d081b9bdd081c995cdbdb1d9959606a1b6044820152606490fd5b90816020910312611ab357518015158103611ab35790565b15611f7457565b60405162461bcd60e51b815260206004820152601660248201527514185e5bdd5d081d1c985b9cd9995c8819985a5b195960521b6044820152606490fd5b15611fb957565b60405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c2e4e4c2f240d8cadccee8d60631b6044820152606490fd5b611c0690612007815160115414611fb2565b61200f61205f565b90600754916122f4565b9061202382611b64565b6120306040519182611b2c565b8281528092612041601f1991611b64565b0190602036910137565b8051821015611c715760209160051b010190565b6011549061206c82612019565b60009260005b818110612080575090925050565b8060019186526012602052604086205461209a828661204b565b5201612072565b9190811015611c715760051b0190565b600160ff1b8114611e3f5760000390565b156120c957565b60405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742073686172657360681b6044820152606490fd5b91908203918211611e3f57565b1561211857565b60405162461bcd60e51b8152602060048201526014602482015273111a5cdc1d5d19481c195c9a5bd908195b99195960621b6044820152606490fd5b92919093601154850361224f576004546001600160a01b03939084169084160361224f57600592806005541691160361223e57600854036122475760005b8381106121a25750505050600190565b80821b830135601e1984360301811215611ab3578301803567ffffffffffffffff8111611ab35760208083018236038113611ab35760409384516121ef84601f19601f8801160182611b2c565b8481528381019184863692010111611ab357600084866103519761222c968637830101525190209361222086611c3a565b50905193848092611c87565b81519101200361223e57600101612192565b50505050600090565b505050600090565b5050505050600090565b1561226057565b60405162461bcd60e51b815260206004820152601860248201527f4469737075746520706572696f64206e6f7420656e64656400000000000000006044820152606490fd5b6000546001600160a01b031633036122b957565b60405163118cdaa760e01b8152336004820152602490fd5b6002600154146122e2576002600155565b604051633ee5aeb560e01b8152600490fd5b9290835181510361247a57835115612446578215612401576123168385612607565b6123208551612019565b9260009160005b87518110156123ce57808461233e6001938861204b565b511261237557612363612351828b61204b565b5161235c838961204b565b5190611e9d565b61236d828961204b565b525b01612327565b61239d612382828b61204b565b51612396612390848a61204b565b516120b1565b11156120c2565b6123be6123aa828b61204b565b516123b8612390848a61204b565b90612104565b6123c8828961204b565b5261236f565b509492509450506123de91612607565b908082106123ef57611c0691612104565b611c06916123fc91612104565b6120b1565b60405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c697175696469747920706172616d6574657200000000006044820152606490fd5b60405162461bcd60e51b815260206004820152600c60248201526b456d7074792061727261797360a01b6044820152606490fd5b60405162461bcd60e51b8152602060048201526015602482015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b6044820152606490fd5b60ff60005460a01c166124c657565b60405163d93c066560e01b8152600490fd5b80156125fa5768056bc75e2d6310000081116125f357670de0b6b3a7640000808281020490818303611e3f57818101809111611e3f5782808080949361251f828096611e2c565b671bc16d674ec800009004908161253591611e9d565b9161253f91611e2c565b6729a2241af62c00009004908161255591611e9d565b9161255f91611e2c565b673782dace9d9000009004908161257591611e9d565b9161257f91611e2c565b674563918244f400009004908161259591611e9d565b9161259f91611e2c565b6753444835ec580000900490816125b591611e9d565b916125bf91611e2c565b676124fee993bc0000900490816125d591611e9d565b916125df91611e2c565b676f05b59d3b2000009004611c0691611e9d565b5060001990565b50670de0b6b3a764000090565b909190600090815b815183101561267757612622838361204b565b51670de0b6b3a764000090818102918183041490151715611e3f5760019161174c6126508861266794611e85565b68056bc75e2d6310000080821161266f57506124d8565b92019161260f565b905038611746565b6126989250670de0b6b3a7640000939491506126929061269c565b90611e2c565b0490565b66038d7ea4c680008110611ecf57670de0b6b3a764000080821461275557811061273a57600068056bc75e2d63100000916000905b602082106126ee575050611c06916126e891611e9d565b60011c90565b90916126fd6126e88583611e9d565b90612707826124d8565b8381101561271d575050600190925b01906126d1565b8391949550116000146127335760019093612716565b9250505090565b61274661274b91611e55565b61269c565b611c069019611e8f565b505060009056fe93608ecbcf057462da63f5aef413ce7f78c5e1b3bb51859d77a40845ece2bfc3a26469706673582212200a744851617aa2abf39fc2b73a8fcf89419e3c7fc39483c450827afea69eca7b64736f6c63430008160033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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