ETH Price: $3,169.87 (-8.67%)

Contract

0x26881E8C452928A889654e4a8BaFBf205dD87812

Overview

ETH Balance

0 ETH

ETH Value

$0.00
Transaction Hash
Method
Block
From
To
0x60806040934174902023-05-22 23:21:07429 days ago1684797667IN
 Contract Creation
0 ETH0.001719940.1

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

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

Contract Name:
RaffleChef

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 11 : RaffleChef.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.18;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {TypeAndVersion} from "./interfaces/TypeAndVersion.sol";
import {IRaffleChef} from "./interfaces/IRaffleChef.sol";
import {FeistelShuffleOptimised} from "./vendor/FeistelShuffleOptimised.sol";
import {Withdrawable} from "./vendor/Withdrawable.sol";

/// @title RaffleChef
/// @author kevincharm
/// @notice RaffleChef is the master of raffles. He can make raffles and he is a fair guy.
///     RaffleChef does NOT record whether a winner has claimed their win; this is upto an
///     external raffle consumer to handle. Take care not to double-spend a raffle, unless
///     that is your intent.
contract RaffleChef is IRaffleChef, TypeAndVersion, Ownable, Withdrawable {
    /// @notice ID of next created raffle
    uint256 public nextRaffleId;

    /// @dev Mapping of raffleId => Raffle data
    mapping(uint256 => Raffle) private raffles;

    constructor(uint256 startingRaffleId) Ownable() {
        if (startingRaffleId == 0) {
            revert StartingRaffleIdTooLow(startingRaffleId);
        }
        nextRaffleId = startingRaffleId;
    }

    /// @notice See {TypeAndVersion-typeAndVersion}
    function typeAndVersion() external pure override returns (string memory) {
        return "RaffleChef 2.0.0";
    }

    function _authoriseWithdrawal() internal virtual override onlyOwner {}

    /// @notice Get a raffle, asserting that it's finalised
    /// @param raffleId ID of raffle
    function getFinalisedRaffle(uint256 raffleId)
        internal
        view
        returns (Raffle memory raffle)
    {
        raffle = raffles[raffleId];
        if (raffle.randomSeed == 0) {
            revert RaffleNotRolled(raffleId);
        }
    }

    /// @notice Get an existing raffle
    /// @param raffleId ID of raffle to get
    /// @return raffle data, if it exists
    function getRaffle(uint256 raffleId) public view returns (Raffle memory) {
        return raffles[raffleId];
    }

    /// @notice Get the current state of raffle, given a `raffleId`
    /// @param raffleId ID of raffle to get
    /// @return See {IRaffleChef-RaffleState} enum
    function getRaffleState(uint256 raffleId)
        public
        view
        returns (RaffleState)
    {
        Raffle memory raffle = getRaffle(raffleId);
        if (
            raffle.participantsMerkleRoot != bytes32(0) &&
            raffle.nWinners > 0 &&
            raffle.randomSeed != 0 &&
            bytes(raffle.provenance).length > 0
        ) {
            return RaffleState.Committed;
        } else {
            return RaffleState.Unknown;
        }
    }

    /// @notice See {IRaffleChef-commit}
    function commit(
        bytes32 participantsMerkleRoot,
        uint256 nParticipants,
        uint256 nWinners,
        string calldata provenance,
        uint256 randomness
    ) external returns (uint256) {
        uint256 raffleId = nextRaffleId;
        nextRaffleId += 1;

        // NB: Validity of provenance is not actually checked
        if (
            participantsMerkleRoot == 0 ||
            nParticipants == 0 ||
            nWinners > nParticipants ||
            randomness == 0 ||
            bytes(provenance).length == 0
        ) {
            revert InvalidCommitment(
                raffleId,
                participantsMerkleRoot,
                nParticipants,
                nWinners,
                randomness,
                provenance
            );
        }

        Raffle memory raffle = Raffle({
            participantsMerkleRoot: participantsMerkleRoot,
            nParticipants: nParticipants,
            nWinners: nWinners,
            randomSeed: randomness,
            owner: msg.sender,
            provenance: provenance
        });
        raffles[raffleId] = raffle;

        emit RaffleCommitted(raffleId);

        return raffleId;
    }

    /// @notice See {IRaffleChef-getNthWinner}
    function getNthWinner(uint256 raffleId, uint256 n)
        external
        view
        returns (uint256)
    {
        Raffle memory raffle = getFinalisedRaffle(raffleId);
        return
            FeistelShuffleOptimised.deshuffle(
                n,
                raffle.nParticipants,
                raffle.randomSeed,
                4
            );
    }

    error InvalidPaginationParameters(
        uint256 from,
        uint256 to,
        uint256 nWinners
    );

    /// @notice See {IRaffleChef-getWinners}
    function getWinners(
        uint256 raffleId,
        uint256 from,
        uint256 to
    ) external view returns (uint256[] memory winners) {
        Raffle memory raffle = getFinalisedRaffle(raffleId);
        if (from > to || to > raffle.nWinners) {
            revert InvalidPaginationParameters(from, to, raffle.nWinners);
        }

        winners = new uint256[](to - from);
        for (uint256 i = from; i < to; ++i) {
            winners[i - from] = FeistelShuffleOptimised.deshuffle(
                i,
                raffle.nParticipants,
                raffle.randomSeed,
                4
            );
        }
    }

    /// @notice See {IRaffleChef-verifyWinner}
    function verifyWinner(
        uint256 raffleId,
        bytes32 leafHash,
        bytes32[] calldata proof,
        uint256 merkleIndex
    ) external view returns (bool isWinner, uint256 permutedIndex) {
        Raffle memory raffle = getFinalisedRaffle(raffleId);

        // Verify that the merkle proof is correct.
        // This proves that `account` is a member of the participants list,
        // at the given `index` (as derived from the merkle proof's path
        // indices).
        bool isValidProof = verifyMerkleProof(
            raffle.participantsMerkleRoot,
            leafHash,
            proof,
            merkleIndex
        );
        if (!isValidProof) {
            revert InvalidProof(leafHash, proof);
        }

        // Compute the shuffled index using a stateless shuffle that
        // bijectively maps over the domain of P -> P with a permutation
        // determined by the random seed.
        permutedIndex = FeistelShuffleOptimised.shuffle(
            merkleIndex,
            raffle.nParticipants,
            raffle.randomSeed,
            4
        );

        // A winner is defined as any account having an original index that
        // maps to a shuffled index that is less than the total number of
        // winners.
        isWinner = permutedIndex < raffle.nWinners;

        return (isWinner, permutedIndex);
    }

    /// @notice Verify a merkle proof given a merkle root.
    /// @param merkleRoot Root of the merkle tree to verify against
    /// @param leafHash Hash of leaf element
    /// @param proof Hashes of leaf siblings required to construct the root
    /// @param index leaf index in merkle tree
    /// @return isValid true if proof is valid for supplied leaf
    function verifyMerkleProof(
        bytes32 merkleRoot,
        bytes32 leafHash,
        bytes32[] calldata proof,
        uint256 index
    ) internal pure returns (bool isValid) {
        bytes32 computedHash = leafHash;
        for (uint256 i = 0; i < proof.length; ++i) {
            computedHash = hashMerklePair(
                computedHash,
                proof[i],
                (index >> i) & 1 == 1
            );
        }
        return computedHash == merkleRoot;
    }

    /// @notice Hash a merkle pair -> keccak256(left,right)
    /// @param a left value
    /// @param b right value
    /// @param reverse if true, reverses the order of left and right
    /// @return h Hash of merkle pair, constructing a parent node
    function hashMerklePair(
        bytes32 a,
        bytes32 b,
        bool reverse
    ) internal pure returns (bytes32 h) {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            // Use scratch space [0, 0x40)
            // h <- keccak256(reverse ? b : a, reverse ? a : b)
            let rev := and(reverse, 0x1)
            mstore(mul(rev, 0x20), a)
            mstore(mul(iszero(rev), 0x20), b)
            h := keccak256(0, 0x40)
        }
    }
}

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

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() {
        _transferOwnership(_msgSender());
    }

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

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

File 3 of 11 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 4 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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 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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 5 of 11 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

File 8 of 11 : IRaffleChef.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.18;

interface IRaffleChef {
    event RaffleCreated(uint256 indexed raffleId);
    event RaffleCommitted(uint256 indexed raffleId);

    error RaffleNotRolled(uint256 raffleId);
    error InvalidCommitment(
        uint256 raffleId,
        bytes32 merkleRoot,
        uint256 nParticipants,
        uint256 nWinners,
        uint256 randomness,
        string provenance
    );
    error Unauthorised(address unauthorisedUser);
    error StartingRaffleIdTooLow(uint256 raffleId);
    error InvalidProof(bytes32 leaf, bytes32[] proof);

    /// @dev Descriptive state of a raffle based on its variables that are set/unset
    enum RaffleState {
        /// @dev Default state
        Unknown,
        /// @dev Done
        Committed
    }

    /// @notice Structure of every raffle; presence of certain elements indicate the raffle state
    struct Raffle {
        bytes32 participantsMerkleRoot;
        uint256 nParticipants;
        uint256 nWinners;
        uint256 randomSeed;
        address owner;
        string provenance;
    }

    /// @notice Publish a commitment (the merkle root of the finalised participants list, and
    ///     the number of winners to draw, and the random seed). Only call this function once
    ///     the random seed and list of raffle participants has finished being collected.
    /// @param participantsMerkleRoot Merkle root constructed from finalised participants list
    /// @param nWinners Number of winners to draw
    /// @param provenance IPFS CID of this raffle's provenance including full participants list
    /// @param randomness Random seed for the raffle
    /// @return Raffle ID that can be used to lookup the raffle results, when
    ///     the raffle is finalised.
    function commit(
        bytes32 participantsMerkleRoot,
        uint256 nParticipants,
        uint256 nWinners,
        string calldata provenance,
        uint256 randomness
    ) external returns (uint256);

    /// @notice Get the nth-drawn winner of the raffle with raffleId.
    ///     NB: 0-based.
    /// @param raffleId ID of the raffle to check
    /// @param n nth winner
    function getNthWinner(uint256 raffleId, uint256 n)
        external
        view
        returns (uint256);

    /// @notice Get a list of winners in a range.
    /// @param raffleId ID of the raffle to check
    /// @param from Winner index to start from (0-based)
    /// @param to Winner index to stop at (exclusive)
    function getWinners(
        uint256 raffleId,
        uint256 from,
        uint256 to
    ) external view returns (uint256[] memory);

    /// @notice Verify that an account is in the winners list for a specific raffle
    ///     using a merkle proof and the raffle's previous public commitments. This is
    ///     a view-only function that does not record if a winner has already claimed
    ///     their win; that is left up to the caller to handle.
    /// @param raffleId ID of the raffle to check against
    /// @param leafHash Hash of the leaf value that represents the participant
    /// @param proof Merkle subproof (hashes)
    /// @param originalIndex Original leaf index in merkle tree, part of merkle proof
    /// @return isWinner true if claiming account is indeed a winner
    /// @return permutedIndex winning (shuffled) index
    function verifyWinner(
        uint256 raffleId,
        bytes32 leafHash,
        bytes32[] calldata proof,
        uint256 originalIndex
    ) external view returns (bool isWinner, uint256 permutedIndex);

    /// @notice Get an existing raffle
    /// @param raffleId ID of raffle to get
    /// @return raffle data, if it exists
    function getRaffle(uint256 raffleId) external view returns (Raffle memory);

    /// @notice Get the current state of raffle, given a `raffleId`
    /// @param raffleId ID of raffle to get
    /// @return See {RaffleState} enum
    function getRaffleState(uint256 raffleId)
        external
        view
        returns (RaffleState);
}

File 9 of 11 : TypeAndVersion.sol
// SPDX-License-Identifier: MIT
/**
    The MIT License (MIT)

    Copyright (c) 2018 SmartContract ChainLink, Ltd.

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
*/

pragma solidity ^0.8;

abstract contract TypeAndVersion {
    function typeAndVersion() external pure virtual returns (string memory);
}

File 10 of 11 : FeistelShuffleOptimised.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8;

/// @title FeistelShuffleOptimised
/// @author kevincharm
/// @notice Feistel shuffle implemented in Yul.
library FeistelShuffleOptimised {
    error InvalidInputs();

    /// @notice Compute a Feistel shuffle mapping for index `x`
    /// @param x index of element in the list
    /// @param domain Number of elements in the list
    /// @param seed Random seed; determines the permutation
    /// @param rounds Number of Feistel rounds to perform
    /// @return resulting shuffled index
    function shuffle(
        uint256 x,
        uint256 domain,
        uint256 seed,
        uint256 rounds
    ) internal pure returns (uint256) {
        // (domain != 0): domain must be non-zero (value of 1 also doesn't really make sense)
        // (xPrime < domain): index to be permuted must lie within the domain of [0, domain)
        // (rounds is even): we only handle even rounds to make the code simpler
        if (domain == 0 || x >= domain || rounds & 1 == 1) {
            revert InvalidInputs();
        }

        assembly {
            // Calculate sqrt(s) using Babylonian method
            function sqrt(s) -> z {
                switch gt(s, 3)
                // if (s > 3)
                case 1 {
                    z := s
                    let r := add(div(s, 2), 1)
                    for {

                    } lt(r, z) {

                    } {
                        z := r
                        r := div(add(div(s, r), r), 2)
                    }
                }
                default {
                    if and(not(iszero(s)), 1) {
                        // else if (s != 0)
                        z := 1
                    }
                }
            }

            // nps <- nextPerfectSquare(domain)
            let sqrtN := sqrt(domain)
            let nps
            switch eq(exp(sqrtN, 2), domain)
            case 1 {
                nps := domain
            }
            default {
                let sqrtN1 := add(sqrtN, 1)
                // pre-check for square overflow
                if gt(sqrtN1, sub(exp(2, 128), 1)) {
                    // overflow
                    revert(0, 0)
                }
                nps := exp(sqrtN1, 2)
            }
            // h <- sqrt(nps)
            let h := sqrt(nps)
            // Allocate scratch memory for inputs to keccak256
            let packed := mload(0x40)
            mstore(0x40, add(packed, 0x80)) // 128B
            // When calculating hashes for Feistel rounds, seed and domain
            // do not change. So we can set them here just once.
            mstore(add(packed, 0x40), seed)
            mstore(add(packed, 0x60), domain)
            // Loop until x < domain
            for {

            } 1 {

            } {
                let L := mod(x, h)
                let R := div(x, h)
                // Loop for desired number of rounds
                for {
                    let i := 0
                } lt(i, rounds) {
                    i := add(i, 1)
                } {
                    // Load R and i for next keccak256 round
                    mstore(packed, R)
                    mstore(add(packed, 0x20), i)
                    // roundHash <- keccak256([R, i, seed, domain])
                    let roundHash := keccak256(packed, 0x80)
                    // nextR <- (L + roundHash) % h
                    let nextR := mod(add(L, roundHash), h)
                    L := R
                    R := nextR
                }
                // x <- h * R + L
                x := add(mul(h, R), L)
                if lt(x, domain) {
                    break
                }
            }
        }
        return x;
    }

    /// @notice Compute the inverse Feistel shuffle mapping for the shuffled
    ///     index `xPrime`
    /// @param xPrime shuffled index of element in the list
    /// @param domain Number of elements in the list
    /// @param seed Random seed; determines the permutation
    /// @param rounds Number of Feistel rounds that was performed in the
    ///     original shuffle.
    /// @return resulting shuffled index
    function deshuffle(
        uint256 xPrime,
        uint256 domain,
        uint256 seed,
        uint256 rounds
    ) internal pure returns (uint256) {
        // (domain != 0): domain must be non-zero (value of 1 also doesn't really make sense)
        // (xPrime < domain): index to be permuted must lie within the domain of [0, domain)
        // (rounds is even): we only handle even rounds to make the code simpler
        if (domain == 0 || xPrime >= domain || rounds & 1 == 1) {
            revert InvalidInputs();
        }

        assembly {
            // Calculate sqrt(s) using Babylonian method
            function sqrt(s) -> z {
                switch gt(s, 3)
                // if (s > 3)
                case 1 {
                    z := s
                    let r := add(div(s, 2), 1)
                    for {

                    } lt(r, z) {

                    } {
                        z := r
                        r := div(add(div(s, r), r), 2)
                    }
                }
                default {
                    if and(not(iszero(s)), 1) {
                        // else if (s != 0)
                        z := 1
                    }
                }
            }

            // nps <- nextPerfectSquare(domain)
            let sqrtN := sqrt(domain)
            let nps
            switch eq(exp(sqrtN, 2), domain)
            case 1 {
                nps := domain
            }
            default {
                let sqrtN1 := add(sqrtN, 1)
                // pre-check for square overflow
                if gt(sqrtN1, sub(exp(2, 128), 1)) {
                    // overflow
                    revert(0, 0)
                }
                nps := exp(sqrtN1, 2)
            }
            // h <- sqrt(nps)
            let h := sqrt(nps)
            // Allocate scratch memory for inputs to keccak256
            let packed := mload(0x40)
            mstore(0x40, add(packed, 0x80)) // 128B
            // When calculating hashes for Feistel rounds, seed and domain
            // do not change. So we can set them here just once.
            mstore(add(packed, 0x40), seed)
            mstore(add(packed, 0x60), domain)
            // Loop until x < domain
            for {

            } 1 {

            } {
                let L := mod(xPrime, h)
                let R := div(xPrime, h)
                // Loop for desired number of rounds
                for {
                    let i := 0
                } lt(i, rounds) {
                    i := add(i, 1)
                } {
                    // Load L and i for next keccak256 round
                    mstore(packed, L)
                    mstore(add(packed, 0x20), sub(sub(rounds, i), 1))
                    // roundHash <- keccak256([L, rounds - i - 1, seed, domain])
                    // NB: extra arithmetic to avoid underflow
                    let roundHash := mod(keccak256(packed, 0x80), h)
                    // nextL <- (R - roundHash) % h
                    // NB: extra arithmetic to avoid underflow
                    let nextL := mod(sub(add(R, h), roundHash), h)
                    R := L
                    L := nextL
                }
                // x <- h * R + L
                xPrime := add(mul(h, R), L)
                if lt(xPrime, domain) {
                    break
                }
            }
        }
        return xPrime;
    }
}

File 11 of 11 : Withdrawable.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

/// @title Withdrawable
/// @author kevincharm
abstract contract Withdrawable {
    event ETHWithdrawn(address to, uint256 amount);
    event ERC20Withdrawn(address to, address token, uint256 amount);
    event ERC721Withdrawn(address to, address token, uint256 tokenId);
    event ERC1155Withdrawn(
        address to,
        address token,
        uint256 tokenId,
        uint256 amount
    );

    function _authoriseWithdrawal() internal virtual;

    function withdrawETH(address to, uint256 amount) external {
        _authoriseWithdrawal();
        payable(to).transfer(amount);
        emit ETHWithdrawn(to, amount);
    }

    function withdrawERC20(address token, address to, uint256 amount) external {
        _authoriseWithdrawal();
        IERC20(token).transfer(to, amount);
        emit ERC20Withdrawn(to, token, amount);
    }

    function withdrawERC721(
        address token,
        address to,
        uint256 tokenId
    ) external {
        _authoriseWithdrawal();
        IERC721(token).safeTransferFrom(address(this), to, tokenId);
        emit ERC721Withdrawn(to, token, tokenId);
    }

    function withdrawERC1155(
        address token,
        address to,
        uint256 tokenId,
        uint256 amount
    ) external {
        _authoriseWithdrawal();
        IERC1155(token).safeTransferFrom(
            address(this),
            to,
            tokenId,
            amount,
            bytes("")
        );
        emit ERC1155Withdrawn(to, token, tokenId, amount);
    }
}

Settings
{
  "viaIR": false,
  "optimizer": {
    "enabled": true,
    "runs": 1000,
    "details": {
      "yul": false
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"startingRaffleId","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"nParticipants","type":"uint256"},{"internalType":"uint256","name":"nWinners","type":"uint256"},{"internalType":"uint256","name":"randomness","type":"uint256"},{"internalType":"string","name":"provenance","type":"string"}],"name":"InvalidCommitment","type":"error"},{"inputs":[],"name":"InvalidInputs","type":"error"},{"inputs":[{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"to","type":"uint256"},{"internalType":"uint256","name":"nWinners","type":"uint256"}],"name":"InvalidPaginationParameters","type":"error"},{"inputs":[{"internalType":"bytes32","name":"leaf","type":"bytes32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"InvalidProof","type":"error"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"RaffleNotRolled","type":"error"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"StartingRaffleIdTooLow","type":"error"},{"inputs":[{"internalType":"address","name":"unauthorisedUser","type":"address"}],"name":"Unauthorised","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC1155Withdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20Withdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721Withdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ETHWithdrawn","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":true,"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"RaffleCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"RaffleCreated","type":"event"},{"inputs":[{"internalType":"bytes32","name":"participantsMerkleRoot","type":"bytes32"},{"internalType":"uint256","name":"nParticipants","type":"uint256"},{"internalType":"uint256","name":"nWinners","type":"uint256"},{"internalType":"string","name":"provenance","type":"string"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"commit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"getNthWinner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"getRaffle","outputs":[{"components":[{"internalType":"bytes32","name":"participantsMerkleRoot","type":"bytes32"},{"internalType":"uint256","name":"nParticipants","type":"uint256"},{"internalType":"uint256","name":"nWinners","type":"uint256"},{"internalType":"uint256","name":"randomSeed","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"string","name":"provenance","type":"string"}],"internalType":"struct IRaffleChef.Raffle","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"}],"name":"getRaffleState","outputs":[{"internalType":"enum IRaffleChef.RaffleState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"to","type":"uint256"}],"name":"getWinners","outputs":[{"internalType":"uint256[]","name":"winners","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextRaffleId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"raffleId","type":"uint256"},{"internalType":"bytes32","name":"leafHash","type":"bytes32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"merkleIndex","type":"uint256"}],"name":"verifyWinner","outputs":[{"internalType":"bool","name":"isWinner","type":"bool"},{"internalType":"uint256","name":"permutedIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063bcbbacab11610066578063bcbbacab14610228578063c6faa9751461023b578063e4dafec91461024e578063f2fde38b1461026e57600080fd5b8063715018a6146101de5780638458e3e4146101e65780638da5cb5b146101fc578063a0edb48b1461021557600080fd5b806344004cc1116100d357806344004cc1146101775780634782f7791461018a578063566777cc1461019d5780635eb9a473146101bd57600080fd5b806301938425146100fa578063181f5a77146101235780634025feb214610162575b600080fd5b61010d610108366004610f94565b610281565b60405161011a9190611049565b60405180910390f35b604080518082018252601081527f526166666c654368656620322e302e30000000000000000000000000000000006020820152905161011a91906110b9565b6101756101703660046110ef565b610397565b005b6101756101853660046110ef565b61045a565b610175610198366004611124565b610520565b6101b06101ab366004611161565b61059c565b60405161011a91906111c6565b6101d06101cb366004611226565b6105fc565b60405161011a9291906112b2565b61017561068a565b6101ef60015481565b60405161011a91906112cd565b6000546001600160a01b031660405161011a91906112e4565b6101756102233660046112f2565b61069e565b6101ef610236366004611356565b610774565b6101ef6102493660046113c3565b6107a1565b61026161025c366004611161565b610949565b60405161011a91906114d1565b61017561027c3660046114e2565b610a7e565b6060600061028e85610ab8565b9050828411806102a15750806040015183115b156102eb57838382604001516040517f92db53e50000000000000000000000000000000000000000000000000000000081526004016102e293929190611503565b60405180910390fd5b6102f58484611541565b67ffffffffffffffff81111561030d5761030d611554565b604051908082528060200260200182016040528015610336578160200160208202803683370190505b509150835b8381101561038e5761035881836020015184606001516004610c2d565b836103638784611541565b815181106103735761037361156a565b602090810291909101015261038781611580565b905061033b565b50509392505050565b61039f610d8c565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081526001600160a01b038416906342842e0e906103e89030908690869060040161159a565b600060405180830381600087803b15801561040257600080fd5b505af1158015610416573d6000803e3d6000fd5b505050507feea167c0d54572a80626f5fd092a7c1f7b5d8e309533747e7e7d77b0558d6cf182848360405161044d9392919061159a565b60405180910390a1505050565b610462610d8c565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063a9059cbb906104a990859085906004016115b5565b6020604051808303816000875af11580156104c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec91906115d6565b507fbfed55bdcd242e3dd0f60ddd7d1e87c67f61c34cd9527b3e6455d841b102536282848360405161044d9392919061159a565b610528610d8c565b6040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561055e573d6000803e3d6000fd5b507f94b2de810873337ed265c5f8cf98c9cffefa06b8607f9a2f1fbaebdfbcfbef1c82826040516105909291906115b5565b60405180910390a15050565b6000806105a883610949565b8051909150158015906105bf575060008160400151115b80156105ce5750606081015115155b80156105df575060008160a0015151115b156105ed5750600192915050565b50600092915050565b50919050565b600080600061060a88610ab8565b9050600061061f826000015189898989610d94565b90508061065e578787876040517f4a5db0320000000000000000000000000000000000000000000000000000000081526004016102e293929190611652565b61067385836020015184606001516004610e02565b925081604001518310935050509550959350505050565b610692610ef5565b61069c6000610f1f565b565b6106a6610d8c565b604080516020810182526000815290517ff242432a0000000000000000000000000000000000000000000000000000000081526001600160a01b0386169163f242432a916106ff91309188918891889190600401611673565b600060405180830381600087803b15801561071957600080fd5b505af115801561072d573d6000803e3d6000fd5b505050507fd4591c66399adca9b87b95d00144abee6c7dfe740c088c94106e50bb7e9d77dc8385848460405161076694939291906116c5565b60405180910390a150505050565b60008061078084610ab8565b905061079783826020015183606001516004610c2d565b9150505b92915050565b6001805460009180836107b482856116fa565b90915550508715806107c4575086155b806107ce57508686115b806107d7575082155b806107e0575083155b1561082557808888888689896040517fd5594ca70000000000000000000000000000000000000000000000000000000081526004016102e2979695949392919061173c565b60006040518060c001604052808a8152602001898152602001888152602001858152602001336001600160a01b0316815260200187878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509390945250508481526002602081815260409283902085518155908501516001820155918401519082015560608301516003820155608083015160048201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117905560a08301519293508392909150600582019061090f908261187e565b50506040518391507fb19acb6a74dfd7653004494a08911b006b9d31f7f1007d567a2f22469c42bd1d90600090a250979650505050505050565b61098e6040518060c001604052806000801916815260200160008152602001600081526020016000815260200160006001600160a01b03168152602001606081525090565b600082815260026020818152604092839020835160c0810185528154815260018201549281019290925291820154928101929092526003810154606083015260048101546001600160a01b0316608083015260058101805460a0840191906109f5906117b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610a21906117b4565b8015610a6e5780601f10610a4357610100808354040283529160200191610a6e565b820191906000526020600020905b815481529060010190602001808311610a5157829003601f168201915b5050505050815250509050919050565b610a86610ef5565b6001600160a01b038116610aac5760405162461bcd60e51b81526004016102e290611942565b610ab581610f1f565b50565b610afd6040518060c001604052806000801916815260200160008152602001600081526020016000815260200160006001600160a01b03168152602001606081525090565b600082815260026020818152604092839020835160c0810185528154815260018201549281019290925291820154928101929092526003810154606083015260048101546001600160a01b0316608083015260058101805460a084019190610b64906117b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610b90906117b4565b8015610bdd5780601f10610bb257610100808354040283529160200191610bdd565b820191906000526020600020905b815481529060010190602001808311610bc057829003601f168201915b50505050508152505090508060600151600003610c2857816040517f1596f2da0000000000000000000000000000000000000000000000000000000081526004016102e291906112cd565b919050565b6000831580610c3c5750838510155b80610c4a5750816001166001145b15610c68576040516379a67d5b60e11b815260040160405180910390fd5b610cb9565b60006003821160018114610c905760018315191615610c8b57600191505b6105f6565b829150600160028404015b82811015610cb25791506002828404830104610c9b565b5050919050565b610cc284610c6d565b6000856002830a1460018114610cfe57600183016fffffffffffffffffffffffffffffffff811115610cf357600080fd5b6002900a9150610d02565b8691505b50610d0c81610c6d565b604051608081016040528660408201528760608201525b818906828a0460005b88811015610d5e57828452600019818a0301602085015260808420859006918501919091038490069190600101610d2c565b5081818502019a50898b1015610d75575050610d7c565b5050610d23565b505050508490505b949350505050565b61069c610ef5565b600084815b84811015610df357610de182878784818110610db757610db761156a565b600189871c8116811416602081810295909552908402929092013591159092025250604060002090565b9150610dec81611580565b9050610d99565b50861490505b95945050505050565b6000831580610e115750838510155b80610e1f5750816001166001145b15610e3d576040516379a67d5b60e11b815260040160405180910390fd5b610e4684610c6d565b6000856002830a1460018114610e8257600183016fffffffffffffffffffffffffffffffff811115610e7757600080fd5b6002900a9150610e86565b8691505b50610e9081610c6d565b604051608081016040528660408201528760608201525b818906828a0460005b88811015610ed7578184526020840181905260808420919290910184900690600101610eb0565b5081818502019a50898b1015610eee575050610d7c565b5050610ea7565b6000546001600160a01b0316331461069c5760405162461bcd60e51b81526004016102e2906119a3565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805b8114610ab557600080fd5b803561079b81610f7c565b600080600060608486031215610fac57610fac600080fd5b6000610fb88686610f89565b9350506020610fc986828701610f89565b9250506040610fda86828701610f89565b9150509250925092565b805b82525050565b6000610ff88383610fe4565b505060200190565b600061100a825190565b80845260209384019383018060005b8381101561103e57815161102d8882610fec565b975060208301925050600101611019565b509495945050505050565b6020808252810161105a8184611000565b9392505050565b60005b8381101561107c578181015183820152602001611064565b50506000910152565b600061108f825190565b8084526020840193506110a6818560208601611061565b601f19601f8201165b9093019392505050565b6020808252810161105a8184611085565b60006001600160a01b03821661079b565b610f7e816110ca565b803561079b816110db565b60008060006060848603121561110757611107600080fd5b600061111386866110e4565b9350506020610fc9868287016110e4565b6000806040838503121561113a5761113a600080fd5b600061114685856110e4565b925050602061115785828601610f89565b9150509250929050565b60006020828403121561117657611176600080fd5b60006107978484610f89565b634e487b7160e01b600052602160045260246000fd5b60028110610ab557610ab5611182565b80610c2881611198565b600061079b826111a8565b610fe6816111b2565b6020810161079b82846111bd565b60008083601f8401126111e9576111e9600080fd5b50813567ffffffffffffffff81111561120457611204600080fd5b60208301915083602082028301111561121f5761121f600080fd5b9250929050565b60008060008060006080868803121561124157611241600080fd5b600061124d8888610f89565b955050602061125e88828901610f89565b945050604086013567ffffffffffffffff81111561127e5761127e600080fd5b61128a888289016111d4565b9350935050606061129d88828901610f89565b9150509295509295909350565b801515610fe6565b604081016112c082856112aa565b61105a6020830184610fe4565b6020810161079b8284610fe4565b610fe6816110ca565b6020810161079b82846112db565b6000806000806080858703121561130b5761130b600080fd5b600061131787876110e4565b9450506020611328878288016110e4565b935050604061133987828801610f89565b925050606061134a87828801610f89565b91505092959194509250565b6000806040838503121561136c5761136c600080fd5b60006111468585610f89565b60008083601f84011261138d5761138d600080fd5b50813567ffffffffffffffff8111156113a8576113a8600080fd5b60208301915083600182028301111561121f5761121f600080fd5b60008060008060008060a087890312156113df576113df600080fd5b60006113eb8989610f89565b96505060206113fc89828a01610f89565b955050604061140d89828a01610f89565b945050606087013567ffffffffffffffff81111561142d5761142d600080fd5b61143989828a01611378565b9350935050608061144c89828a01610f89565b9150509295509295509295565b805160009060c084019061146d8582610fe4565b5060208301516114806020860182610fe4565b5060408301516114936040860182610fe4565b5060608301516114a66060860182610fe4565b5060808301516114b960808601826112db565b5060a083015184820360a0860152610df98282611085565b6020808252810161105a8184611459565b6000602082840312156114f7576114f7600080fd5b600061079784846110e4565b606081016115118286610fe4565b61151e6020830185610fe4565b610d846040830184610fe4565b634e487b7160e01b600052601160045260246000fd5b8181038181111561079b5761079b61152b565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060001982036115935761159361152b565b5060010190565b606081016115a882866112db565b61151e60208301856112db565b604081016112c082856112db565b801515610f7e565b805161079b816115c3565b6000602082840312156115eb576115eb600080fd5b600061079784846115cb565b82818337505050565b81835260006020840193507f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561163b5761163b600080fd5b60208302925061164c8385846115f7565b50500190565b604081016116608286610fe4565b8181036020830152610df9818486611600565b60a0810161168182886112db565b61168e60208301876112db565b61169b6040830186610fe4565b6116a86060830185610fe4565b81810360808301526116ba8184611085565b979650505050505050565b608081016116d382876112db565b6116e060208301866112db565b6116ed6040830185610fe4565b610df96060830184610fe4565b8082018082111561079b5761079b61152b565b82818337506000910152565b818352600060208401935061172f83858461170d565b601f19601f8401166110af565b60c0810161174a828a610fe4565b6117576020830189610fe4565b6117646040830188610fe4565b6117716060830187610fe4565b61177e6080830186610fe4565b81810360a0830152611791818486611719565b9998505050505050505050565b634e487b7160e01b600052602260045260246000fd5b6002810460018216806117c857607f821691505b6020821081036105f6576105f661179e565b600061079b6117e68381565b90565b6117f2836117da565b815460001960089490940293841b1916921b91909117905550565b600061181a8184846117e9565b505050565b8181101561183a5761183260008261180d565b60010161181f565b5050565b601f82111561181a576000818152602090206020601f850104810160208510156118655750805b6118776020601f86010483018261181f565b5050505050565b815167ffffffffffffffff81111561189857611898611554565b6118a282546117b4565b6118ad82828561183e565b6020601f8311600181146118e157600084156118c95750858201515b600019600886021c198116600286021786555061193a565b600085815260208120601f198616915b8281101561191157888501518255602094850194600190920191016118f1565b8683101561192d5784890151600019601f89166008021c191682555b6001600288020188555050505b505050505050565b6020808252810161079b81602681527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160208201527f6464726573730000000000000000000000000000000000000000000000000000604082015260600190565b60208082528181019081527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408301526060820161079b56fea264697066735822122042cf459be52f375bc8673d86087d27f23a6ca25c8d8bcb66746564b0bf20a7e864736f6c63430008120033

Block Transaction Difficulty 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.