ETH Price: $3,281.27 (+0.81%)
Gas: 6 Gwei

Contract

0x30BA9743a384D2b81172acCaf608456341fBdE2b
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040188491172023-12-23 14:30:23217 days ago1703341823IN
 Create: Lucky8DAO
0 ETH0.1977443240

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Lucky8DAO

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
No with 200 runs

Other Settings:
paris EvmVersion
File 1 of 41 : Lucky8DAO.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./Bonding.sol";
import "./Govern.sol";

contract Lucky8DAO is State, Bonding, Govern {
    event Advance(uint256 indexed epoch, uint256 block, uint256 timestamp);
    event Incentivization(address indexed account, uint256 amount);

    // perform state migrations, always have initializer
    function initialize() initializer override public {
        
    }

    function advance() external {
        // initiate draw and reward distribution
        initiateDrawAndRewards();

        // increase bonding epoch
        step();

        emit Advance(epoch(), block.number, blockTimestamp());
    }
}

File 2 of 41 : 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 41 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 4 of 41 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.20;

import {IERC1155} from "./IERC1155.sol";
import {IERC1155Receiver} from "./IERC1155Receiver.sol";
import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol";
import {Context} from "../../utils/Context.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {Arrays} from "../../utils/Arrays.sol";
import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 */
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
    using Arrays for uint256[];
    using Arrays for address[];

    mapping(uint256 id => mapping(address account => uint256)) private _balances;

    mapping(address account => mapping(address operator => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256 /* id */) public view virtual returns (string memory) {
        return _uri;
    }

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

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    ) public view virtual returns (uint256[] memory) {
        if (accounts.length != ids.length) {
            revert ERC1155InvalidArrayLength(ids.length, accounts.length);
        }

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i));
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
        address sender = _msgSender();
        if (from != sender && !isApprovedForAll(from, sender)) {
            revert ERC1155MissingApprovalForAll(sender, from);
        }
        _safeTransferFrom(from, to, id, value, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) public virtual {
        address sender = _msgSender();
        if (from != sender && !isApprovedForAll(from, sender)) {
            revert ERC1155MissingApprovalForAll(sender, from);
        }
        _safeBatchTransferFrom(from, to, ids, values, data);
    }

    /**
     * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
     * (or `to`) is the zero address.
     *
     * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
     *   or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
     * - `ids` and `values` must have the same length.
     *
     * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
     */
    function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
        if (ids.length != values.length) {
            revert ERC1155InvalidArrayLength(ids.length, values.length);
        }

        address operator = _msgSender();

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids.unsafeMemoryAccess(i);
            uint256 value = values.unsafeMemoryAccess(i);

            if (from != address(0)) {
                uint256 fromBalance = _balances[id][from];
                if (fromBalance < value) {
                    revert ERC1155InsufficientBalance(from, fromBalance, value, id);
                }
                unchecked {
                    // Overflow not possible: value <= fromBalance
                    _balances[id][from] = fromBalance - value;
                }
            }

            if (to != address(0)) {
                _balances[id][to] += value;
            }
        }

        if (ids.length == 1) {
            uint256 id = ids.unsafeMemoryAccess(0);
            uint256 value = values.unsafeMemoryAccess(0);
            emit TransferSingle(operator, from, to, id, value);
        } else {
            emit TransferBatch(operator, from, to, ids, values);
        }
    }

    /**
     * @dev Version of {_update} that performs the token acceptance check by calling
     * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
     * contains code (eg. is a smart contract at the moment of execution).
     *
     * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
     * update to the contract state after this function would break the check-effect-interaction pattern. Consider
     * overriding {_update} instead.
     */
    function _updateWithAcceptanceCheck(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal virtual {
        _update(from, to, ids, values);
        if (to != address(0)) {
            address operator = _msgSender();
            if (ids.length == 1) {
                uint256 id = ids.unsafeMemoryAccess(0);
                uint256 value = values.unsafeMemoryAccess(0);
                _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data);
            } else {
                _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data);
            }
        }
    }

    /**
     * @dev Transfers a `value` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `value` 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 value, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(from, to, ids, values, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     * - `ids` and `values` must have the same length.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        _updateWithAcceptanceCheck(from, to, ids, values, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the values in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(address(0), to, ids, values, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `values` must have the same length.
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        _updateWithAcceptanceCheck(address(0), to, ids, values, data);
    }

    /**
     * @dev Destroys a `value` amount of tokens of type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `value` amount of tokens of type `id`.
     */
    function _burn(address from, uint256 id, uint256 value) internal {
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(from, address(0), ids, values, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `value` amount of tokens of type `id`.
     * - `ids` and `values` must have the same length.
     */
    function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        _updateWithAcceptanceCheck(from, address(0), ids, values, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the zero address.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        if (operator == address(0)) {
            revert ERC1155InvalidOperator(address(0));
        }
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address
     * if it contains code at the moment of execution.
     */
    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 value,
        bytes memory data
    ) private {
        if (to.code.length > 0) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    // Tokens rejected
                    revert ERC1155InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    // non-ERC1155Receiver implementer
                    revert ERC1155InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }

    /**
     * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address
     * if it contains code at the moment of execution.
     */
    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) private {
        if (to.code.length > 0) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    // Tokens rejected
                    revert ERC1155InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    // non-ERC1155Receiver implementer
                    revert ERC1155InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }

    /**
     * @dev Creates an array in memory with only one value for each of the elements provided.
     */
    function _asSingletonArrays(
        uint256 element1,
        uint256 element2
    ) private pure returns (uint256[] memory array1, uint256[] memory array2) {
        /// @solidity memory-safe-assembly
        assembly {
            // Load the free memory pointer
            array1 := mload(0x40)
            // Set array length to 1
            mstore(array1, 1)
            // Store the single element at the next word after the length (where content starts)
            mstore(add(array1, 0x20), element1)

            // Repeat for next array locating it right after the first array
            array2 := add(array1, 0x40)
            mstore(array2, 1)
            mstore(add(array2, 0x20), element2)

            // Update the free memory pointer by pointing after the second array
            mstore(0x40, add(array2, 0x40))
        }
    }
}

File 5 of 41 : ERC1155Supply.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol)

pragma solidity ^0.8.20;

import {ERC1155} from "../ERC1155.sol";

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 *
 * NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens
 * that can be minted.
 *
 * CAUTION: This extension should not be added in an upgrade to an already deployed contract.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 id => uint256) private _totalSupply;
    uint256 private _totalSupplyAll;

    /**
     * @dev Total value of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Total value of tokens.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupplyAll;
    }

    /**
     * @dev Indicates whether any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_update}.
     */
    function _update(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values
    ) internal virtual override {
        super._update(from, to, ids, values);

        if (from == address(0)) {
            uint256 totalMintValue = 0;
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 value = values[i];
                // Overflow check required: The rest of the code assumes that totalSupply never overflows
                _totalSupply[ids[i]] += value;
                totalMintValue += value;
            }
            // Overflow check required: The rest of the code assumes that totalSupplyAll never overflows
            _totalSupplyAll += totalMintValue;
        }

        if (to == address(0)) {
            uint256 totalBurnValue = 0;
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 value = values[i];

                unchecked {
                    // Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i])
                    _totalSupply[ids[i]] -= value;
                    // Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
                    totalBurnValue += value;
                }
            }
            unchecked {
                // Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
                _totalSupplyAll -= totalBurnValue;
            }
        }
    }
}

File 6 of 41 : ERC1155URIStorage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)

pragma solidity ^0.8.20;

import {Strings} from "../../../utils/Strings.sol";
import {ERC1155} from "../ERC1155.sol";

/**
 * @dev ERC1155 token with storage based token URI management.
 * Inspired by the ERC721URIStorage extension
 */
abstract contract ERC1155URIStorage is ERC1155 {
    using Strings for uint256;

    // Optional base URI
    string private _baseURI = "";

    // Optional mapping for token URIs
    mapping(uint256 tokenId => string) private _tokenURIs;

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the concatenation of the `_baseURI`
     * and the token-specific uri if the latter is set
     *
     * This enables the following behaviors:
     *
     * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation
     *   of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`
     *   is empty per default);
     *
     * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`
     *   which in most cases will contain `ERC1155._uri`;
     *
     * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a
     *   uri value set, then the result is empty.
     */
    function uri(uint256 tokenId) public view virtual override returns (string memory) {
        string memory tokenURI = _tokenURIs[tokenId];

        // If token URI is set, concatenate base URI and tokenURI (via string.concat).
        return bytes(tokenURI).length > 0 ? string.concat(_baseURI, tokenURI) : super.uri(tokenId);
    }

    /**
     * @dev Sets `tokenURI` as the tokenURI of `tokenId`.
     */
    function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {
        _tokenURIs[tokenId] = tokenURI;
        emit URI(uri(tokenId), tokenId);
    }

    /**
     * @dev Sets `baseURI` as the `_baseURI` for all tokens
     */
    function _setBaseURI(string memory baseURI) internal virtual {
        _baseURI = baseURI;
    }
}

File 7 of 41 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.20;

import {IERC1155} from "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 8 of 41 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` amount of tokens of 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 value 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 a `value` amount of tokens of type `id` from `from` to `to`.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155Received} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * 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 `value` 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 value, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
     *
     * Requirements:
     *
     * - `ids` and `values` 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 values,
        bytes calldata data
    ) external;
}

File 9 of 41 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Interface that must be implemented by smart contracts in order to receive
 * ERC-1155 token transfers.
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 10 of 41 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

File 11 of 41 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

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

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

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

File 12 of 41 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 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 13 of 41 : Arrays.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol)

pragma solidity ^0.8.20;

import {StorageSlot} from "./StorageSlot.sol";
import {Math} from "./math/Math.sol";

/**
 * @dev Collection of functions related to array types.
 */
library Arrays {
    using StorageSlot for bytes32;

    /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * `array` is expected to be sorted in ascending order, and to contain no
     * repeated elements.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeAccess(array, mid).value > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && unsafeAccess(array, low - 1).value == element) {
            return low - 1;
        } else {
            return low;
        }
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getAddressSlot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getBytes32Slot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getUint256Slot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }
}

File 14 of 41 : 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 15 of 41 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

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

File 16 of 41 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @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 17 of 41 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 18 of 41 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 19 of 41 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 20 of 41 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 21 of 41 : Constants.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "./external/Decimal.sol";
import "./token/IToken.sol";

contract Constants {
    /* Chain */
    uint256 private constant CHAIN_ID = 1; // Mainnet
    address private constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);

    /* Bonding */
    uint256 private constant INITIAL_STAKE_MULTIPLE = 1; // 1 888 -> 1 s888


    /* Epoch */
    struct EpochStrategy {
        uint256 offset;
        uint256 start;
        uint256 period;
    }

    // we start in epoch 0 and CURRENT_EPOCH_START allows to advance to epoch 1, starting the first draw
    uint256 private constant CURRENT_EPOCH_OFFSET = 1;
    // the timestamp when the first draw should happen
    // eg Fri Dec 22 2023 15:00:00 GMT+0000
    uint256 private constant CURRENT_EPOCH_START = 1703257200; 
    uint256 private constant CURRENT_EPOCH_PERIOD = 86400; // a draw every 24 hours

    /* Governance */
    uint256 private constant GOVERNANCE_PERIOD = 3; // 3 epochs
    uint256 private constant GOVERNANCE_EXPIRATION = 2; // 2 + 1 epochs
    uint256 private constant GOVERNANCE_QUORUM = 25e16; // 25%
    uint256 private constant GOVERNANCE_PROPOSAL_THRESHOLD = 15e15; // 1,5%
    uint256 private constant GOVERNANCE_SUPER_MAJORITY = 40e16; // 40%
    uint256 private constant GOVERNANCE_EMERGENCY_DELAY = 3; // 3 epochs

    /* DAO */
    uint256 private constant DAO_EXIT_LOCKUP_EPOCHS = 2; // 2 epochs fluid

    /* Lottery */
    uint256 private constant DISTRICUTION_PER_EPOCH  = 10e16; // 10% distribution per epoch
    uint256 private constant WINNINGTICKETS  = 3; // 3 winners per epoch

    /* Chainlink */
    address private constant VRF_COORDINATOR = address(0x271682DEB8C4E0901D1a1550aD2e64D568E69909);
    bytes32 private constant VRF_KEYHASH = 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef; // 200 gwei
    uint64 private constant CHAINLINK_SUBID = 888;

    /**
     * Getters
     */
    function getCurrentEpochStrategy() internal pure returns (EpochStrategy memory) {
        return EpochStrategy({
            offset: CURRENT_EPOCH_OFFSET,
            start: CURRENT_EPOCH_START,
            period: CURRENT_EPOCH_PERIOD
        });
    }

    function getUsdc() internal pure returns (address) {
        return USDC;
    }

    function VRFKeyhash() public view returns (bytes32) {
        return VRF_KEYHASH;
    }

    function VRFCoordinator() public view returns (address) {
        return VRF_COORDINATOR;
    }

    function ChainlinkSubId() public view returns (uint64) {
        return CHAINLINK_SUBID;
    }

    function getInitialStakeMultiple() internal pure returns (uint256) {
        return INITIAL_STAKE_MULTIPLE;
    }

    function getGovernancePeriod() internal pure returns (uint256) {
        return GOVERNANCE_PERIOD;
    }

    function getGovernanceExpiration() internal pure returns (uint256) {
        return GOVERNANCE_EXPIRATION;
    }

    function getGovernanceQuorum() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: GOVERNANCE_QUORUM});
    }

    function getGovernanceProposalThreshold() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: GOVERNANCE_PROPOSAL_THRESHOLD});
    }

    function getGovernanceSuperMajority() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: GOVERNANCE_SUPER_MAJORITY});
    }

    function getGovernanceEmergencyDelay() internal pure returns (uint256) {
        return GOVERNANCE_EMERGENCY_DELAY;
    }

    function getDAOExitLockupEpochs() internal pure returns (uint256) {
        return DAO_EXIT_LOCKUP_EPOCHS;
    }

    function getDistributionPerEpoch() internal pure returns (Decimal.D256 memory) {
        return Decimal.D256({value: DISTRICUTION_PER_EPOCH});
    }

    function getWinningTickets() internal pure returns (uint256) {
        return WINNINGTICKETS;
    }

    function getChainId() internal pure returns (uint256) {
        return CHAIN_ID;
    }
}

File 22 of 41 : Bonding.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "./Setters.sol";
import "./Permission.sol";
import "./Lottery.sol";
import "../external/Require.sol";
import "../Constants.sol";

contract Bonding is Lottery, Permission {
    bytes32 private constant FILE = "Bonding";

    event Deposit(address indexed account, uint256 value);
    event Withdraw(address indexed account, uint256 value);
    event Bond(address indexed account, uint256 start, uint256 value, uint256 valueUnderlying);
    event Unbond(address indexed account, uint256 start, uint256 value, uint256 valueUnderlying);

    function step() internal {
        Require.that(
            epochTime() > epoch(),
            FILE,
            "Still current epoch"
        );

        snapshotTotalBonded();
        incrementEpoch();
    }

    function deposit(uint256 value) public {
        token().transferFrom(msg.sender, address(this), value);
        incrementBalanceOfStaged(msg.sender, value);

        emit Deposit(msg.sender, value);
    }

    function withdraw(uint256 value) external onlyFrozenOrLocked(msg.sender) {
        token().transfer(msg.sender, value);
        decrementBalanceOfStaged(msg.sender, value);

        emit Withdraw(msg.sender, value);
    }

    function bond(uint256 value) public onlyFrozenOrFluid(msg.sender) {
        uint256 balance = totalBonded() == 0 ?
            value * (getInitialStakeMultiple()) :
            value * totalSupply() / totalBonded();
        incrementBalanceOf(msg.sender, balance);
        incrementTotalBonded(value);
        decrementBalanceOfStaged(msg.sender, value);

        emit Bond(msg.sender, epoch() + 1, balance, value);
    }

    function depositAndBond(uint256 value) external {
        deposit(value);
        bond(value);
    }

    function unbond(uint256 value) external onlyFrozenOrFluid(msg.sender) {
        unfreeze(msg.sender);

        uint256 staged = value * balanceOfBonded(msg.sender) / balanceOf(msg.sender);
        incrementBalanceOfStaged(msg.sender, staged);
        decrementTotalBonded(staged);
        decrementBalanceOf(msg.sender, value);

        emit Unbond(msg.sender, epoch() + 1, value, staged);
    }

    function unbondUnderlying(uint256 value) external onlyFrozenOrFluid(msg.sender) {
        unfreeze(msg.sender);

        uint256 balance = value * totalSupply() / totalBonded();
        incrementBalanceOfStaged(msg.sender, value);
        decrementTotalBonded(value);
        decrementBalanceOf(msg.sender, balance);

        emit Unbond(msg.sender, epoch() + 1, balance, value);
    }
}

File 23 of 41 : Getters.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "./State.sol";
import "../Constants.sol";
import "../token/ITickets.sol";

contract Getters is State {
    using Decimal for Decimal.D256;

    bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * ERC20 Interface
     */

    function name() public view returns (string memory) {
        return "Lucky8 Staked Tokens";
    }

    function symbol() public view returns (string memory) {
        return "s888";
    }

    function decimals() public view returns (uint8) {
        return 18;
    }

    function balanceOf(address account) public view returns (uint256) {
        return _state.accounts[account].balance;
    }

    function totalSupply() public view returns (uint256) {
        return _state.balance.supply;
    }

    function allowance(address owner, address spender) external view returns (uint256) {
        return 0;
    }

    /**
     * Global
     */

    function token() public view returns (IToken) {
        return _state.provider.token;
    }

    function tickets() public view returns (ITickets) {
        return _state.provider.tickets;
    }

    function usdc() public view returns (IToken) {
        return IToken(getUsdc());
    }

    function totalBonded() public view returns (uint256) {
        return _state.balance.bonded;
    }

    function totalStaged() public view returns (uint256) {
        return _state.balance.staged;
    }

    function totalUserTokenClaims() public view returns (uint256) {
        return totalBonded() + totalStaged();
    }

    function userUSDCClaims() public view returns (uint256) {
        return _state.balance.userUSDCClaims;
    }

    function totalTokenRewards() public view returns (uint256) {
        return token().balanceOf(address(this)) - totalUserTokenClaims();
    }

    function thisEpochsTokenRewards() public view returns (uint256) {
        return Decimal.D256(totalTokenRewards()).mul(getDistributionPerEpoch()).value;
    }

    function totalPrizePool() public view returns (uint256) {
        uint pool = usdc().balanceOf(address(this)) - userUSDCClaims();
        return pool / getWinningTickets() * getWinningTickets();
    }

    function thisEpochsPrizePool() public view returns (uint256) {
        return Decimal.D256(totalPrizePool()).mul(getDistributionPerEpoch()).value;
    }

    /**
     * Account
     */

    function balanceOfStaged(address account) public view returns (uint256) {
        return _state.accounts[account].staged;
    }

    function balanceOfBonded(address account) public view returns (uint256) {
        uint256 totalSupply = totalSupply();
        if (totalSupply == 0) {
            return 0;
        }
        return (totalBonded() * balanceOf(account)) / (totalSupply);
    }

    function statusOf(address account) public view returns (Account.Status) {
        if (_state.accounts[account].lockedUntil > epoch()) {
            return Account.Status.Locked;
        }

        return epoch() >= _state.accounts[account].fluidUntil ? Account.Status.Frozen : Account.Status.Fluid;
    }

    function fluidUntil(address account) public view returns (uint) {
        return _state.accounts[account].fluidUntil;
    }

    /**
     * Epoch
     */

    function epoch() public view returns (uint256) {
        return _state.epoch.current;
    }

    function epochTime() public view returns (uint256) {
        EpochStrategy memory strategy = getCurrentEpochStrategy();
        if (blockTimestamp() < strategy.start) {
            return 0;
        }

        return ((blockTimestamp() - strategy.start) / strategy.period) + strategy.offset;
    }

    // Overridable for testing
    function blockTimestamp() internal view returns (uint256) {
        return block.timestamp;
    }

    function totalBondedAt(uint256 epoch) public view returns (uint256) {
        return _state.epochs[epoch].bonded;
    }

    /**
     * Lottery
     */

    function winnersAt(uint256 epoch) public view returns (uint256) {
        return _state.epochs[epoch].winningTickets.length;
    }

    function winningTickets(uint256 epoch) public view returns (uint256[] memory) {
        return _state.epochs[epoch].winningTickets;
    }

    function chainLinkRequestId(uint256 epoch) public view returns (uint256) {
        return _state.epochs[epoch].chainLinkRequestId;
    }

    function prizePerTicket(uint256 epoch) public view returns (uint256) {
        return _state.epochs[epoch].prizePerTicket;
    }

    function chainlinkRequestId(uint256 epoch) public view returns (uint256) {
        return _state.epochs[epoch].prizePerTicket;
    }

    function userTicketRange(address user, uint256 epoch) public view returns (uint start, uint end) {
        return (
            _state.epochs[epoch].userTicketRange[user].start,
            _state.epochs[epoch].userTicketRange[user].end
        );
    }

    function userPrizeClaimed(uint256 epoch, address user) public view returns (bool) {
        return _state.epochs[epoch].userPrizeClaimed[user];
    }

    function epochForRequestId(uint256 requestId) public view returns (uint) {
        return _state.chainlinkRequestIds[requestId];
    }

    function drawExecuted(uint256 epoch) public view returns (bool) {
        return _state.epochs[epoch].drawExecuted;
    }

    /**
     * Governance
     */

    function recordedVote(address account, address candidate) public view returns (Candidate.Vote) {
        return _state.candidates[candidate].votes[account];
    }

    function startFor(address candidate) public view returns (uint256) {
        return _state.candidates[candidate].start;
    }

    function periodFor(address candidate) public view returns (uint256) {
        return _state.candidates[candidate].period;
    }

    function approveFor(address candidate) public view returns (uint256) {
        return _state.candidates[candidate].approve;
    }

    function rejectFor(address candidate) public view returns (uint256) {
        return _state.candidates[candidate].reject;
    }

    function votesFor(address candidate) public view returns (uint256) {
        return approveFor(candidate) + (rejectFor(candidate));
    }

    function isNominated(address candidate) public view returns (bool) {
        return _state.candidates[candidate].start > 0;
    }

    function isInitialized(address candidate) public view returns (bool) {
        return _state.candidates[candidate].initialized;
    }

    function implementation() public view returns (address impl) {
        bytes32 slot = IMPLEMENTATION_SLOT;
        assembly {
            impl := sload(slot)
        }
    }
}

File 24 of 41 : Govern.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import "./Setters.sol";
import "./Permission.sol";
import "./Upgradeable.sol";
import "../external/Require.sol";
import "../external/Decimal.sol";
import "../Constants.sol";

abstract contract Govern is Setters, Permission, Upgradeable {
    using Math for uint256;
    using Decimal for Decimal.D256;

    bytes32 private constant FILE = "Govern";

    event Proposal(address indexed candidate, address indexed account, uint256 indexed start, uint256 period);
    event Vote(address indexed account, address indexed candidate, Candidate.Vote vote, uint256 bonded);
    event Commit(address indexed account, address indexed candidate);

    function vote(address candidate, Candidate.Vote vote) external onlyFrozenOrLocked(msg.sender) {
        Require.that(
            balanceOf(msg.sender) > 0,
            FILE,
            "Must have stake"
        );

        if (!isNominated(candidate)) {
            Require.that(
                canPropose(msg.sender),
                FILE,
                "Not enough stake to propose"
            );

            createCandidate(candidate, getGovernancePeriod());
            emit Proposal(candidate, msg.sender, epoch(), getGovernancePeriod());
        }

        Require.that(
            epoch() < startFor(candidate) + (periodFor(candidate)),
            FILE,
            "Ended"
        );

        uint256 bonded = balanceOf(msg.sender);
        Candidate.Vote recordedVote = recordedVote(msg.sender, candidate);
        if (vote == recordedVote) {
            return;
        }

        if (recordedVote == Candidate.Vote.REJECT) {
            decrementRejectFor(candidate, bonded);
        }
        if (recordedVote == Candidate.Vote.APPROVE) {
            decrementApproveFor(candidate, bonded);
        }
        if (vote == Candidate.Vote.REJECT) {
            incrementRejectFor(candidate, bonded);
        }
        if (vote == Candidate.Vote.APPROVE) {
            incrementApproveFor(candidate, bonded);
        }

        recordVote(msg.sender, candidate, vote);
        placeLock(msg.sender, candidate);

        emit Vote(msg.sender, candidate, vote, bonded);
    }

    function commit(address candidate) external {
        Require.that(
            isNominated(candidate),
            FILE,
            "Not nominated"
        );

        uint256 endsAfter = startFor(candidate) + (periodFor(candidate)) - (1);

        Require.that(
            epoch() > endsAfter,
            FILE,
            "Not ended"
        );

        Require.that(
            epoch() <= endsAfter + 1 + getGovernanceExpiration(),
            FILE,
            "Expired"
        );

        Require.that(
            Decimal.ratio(votesFor(candidate), totalBondedAt(endsAfter)).greaterThan(getGovernanceQuorum()),
            FILE,
            "Must have quorom"
        );

        Require.that(
            approveFor(candidate) > rejectFor(candidate),
            FILE,
            "Not approved"
        );

        upgradeTo(candidate);

        emit Commit(msg.sender, candidate);
    }

    function emergencyCommit(address candidate) external {
        Require.that(
            isNominated(candidate),
            FILE,
            "Not nominated"
        );

        Require.that(
            epochTime() > epoch() + getGovernanceEmergencyDelay(),
            FILE,
            "Epoch synced"
        );

        Require.that(
            Decimal.ratio(approveFor(candidate), totalSupply()).greaterThan(getGovernanceSuperMajority()),
            FILE,
            "Must have super majority"
        );

        Require.that(
            approveFor(candidate) > rejectFor(candidate),
            FILE,
            "Not approved"
        );

        upgradeTo(candidate);

        emit Commit(msg.sender, candidate);
    }

    function canPropose(address account) private view returns (bool) {
        if (totalBonded() == 0) {
            return false;
        }

        Decimal.D256 memory stake = Decimal.ratio(balanceOf(account), totalSupply());
        return stake.greaterThan(getGovernanceProposalThreshold());
    }
}

File 25 of 41 : Lottery.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "./Setters.sol";
import "../Constants.sol";
import "../external/Require.sol";
import "../external/Decimal.sol";
import { VRFCoordinatorV2Interface } from "../external/chainlink/VRFCoordinatorV2Interface.sol";

contract Lottery is Setters {
    using Decimal for Decimal.D256;

    bytes32 private constant FILE = "Lottery";

    event TicketsMinted(address indexed account, uint256 round, uint256 amount);
    event PrizeClaimed(address indexed account, uint256 round, uint256 amount);
    event LotteryDrawStarted(uint256 round, uint timestamp, uint256 totalTickets, uint prizePool, uint winnningTickets);
    event LotteryDrawFinished(uint256 round, uint timestamp);

    /// @dev Payout this epochs rewards and trigger the lottery draw with chainlink VRF
    function initiateDrawAndRewards() internal {
        // pay out accrued 888 rewards to stakers
        uint bondedRewards = thisEpochsTokenRewards();

        // rewards to bonders
        incrementTotalBonded(bondedRewards);

        // trigger Lottery draw
        uint prizePool = thisEpochsPrizePool();
        incrementUserUSDCClaims(prizePool);

        // save draw state
        setPrizePerTicket(epoch(), prizePool / getWinningTickets());
        initWinningTicketsArray(epoch(), getWinningTickets());

        // Use the Chainlink VRF to get a random number.
        // This will initiate the request but we will need to wait for the request to be fulfilled.
        // See the method `fulfillRandomWords` for the callback.
        uint256 requestId = VRFCoordinatorV2Interface(VRFCoordinator()).requestRandomWords(
            VRFKeyhash(), // keyHash
            ChainlinkSubId(),
            3, // minimumRequestConfirmations
            1_000_000, // callbackGasLimit
            uint32(getWinningTickets()) // numWords
        );

        // Store chainlink request id
        setChainlinkRequestId(epoch(), requestId);

        emit LotteryDrawStarted(epoch(), blockTimestamp(), tickets().totalSupply(epoch()), prizePool, getWinningTickets());
    }

    /// @dev Internalise the chainlink VRFConsumerBaseV2 method with required checks to keep state layout clean
    function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
        require(msg.sender == VRFCoordinator(), "only VRF Coordinator can fulfill");

        uint epoch = epochForRequestId(requestId);
        require(chainLinkRequestId(epoch) == requestId, "invalid epoch");
        require(drawExecuted(epoch) == false, "draw already executed");

        require(randomWords.length == winningTickets(epoch).length);

        // Iterate over the random words and get the winning numbers.
        uint ticketSupply = tickets().totalSupply(epoch);
        for (uint256 i = 0; i < randomWords.length; i++) {
            setWinningTicket(epoch, i, randomWords[i] % ticketSupply);
        }

        setDrawExecuted(epoch, true);

        emit LotteryDrawFinished(epoch, blockTimestamp());
    }


    /// @dev Method used to mint raffle tickets.
    function mintTickets() external returns (uint256) {
        require(tickets().balanceOf(msg.sender, epoch()) == 0, "Lottery: already minted tickets for this epoch");

        // mint tickets
        uint mintableTickets = balanceOfBonded(msg.sender) / 1 ether;
        require(tickets().balanceOf(msg.sender, epoch()) == 0, "Lottery: Not enough bonded balance");

        uint256 totalSupplyBeforeMinting = tickets().totalSupply(epoch());
        tickets().mint(msg.sender, epoch(), mintableTickets);
        uint256 totalSupplyAfterMinting = tickets().totalSupply(epoch());

        // Update the user tickets ranges.
        setUserTicketRange(msg.sender, epoch(), totalSupplyBeforeMinting, totalSupplyAfterMinting - 1);

        // Emit `TicketsMinted` event.
        emit TicketsMinted(msg.sender, epoch(), mintableTickets);

        return mintableTickets;
    }

    /// @dev Method used to claim the prize.
    function claimPrize(uint epoch) external returns (uint256) {
        require(userPrizeClaimed(epoch, msg.sender) == false, "Lottery: Prize already claimed");
        require(drawExecuted(epoch), "Lottery: Draw not yet resolved by chainlink vrf");

        (uint userTicketStart, uint userTicketEnd) = userTicketRange(msg.sender, epoch);

        // Check if the user has won.
        uint256[] memory winningNumbers = winningTickets(epoch);

        // Initialize the amount of winning tickets.
        uint256 winningTickets;
        for (uint256 i = 0; i < winningNumbers.length; i++) {
            // Check if the winning number is in the user ticket range.
            if (winningNumbers[i] >= userTicketStart && winningNumbers[i] <= userTicketEnd) {
                // Add the amount of winning tickets and the prize.
                winningTickets += 1;
            }
        }

        // Check if the user has won.
        require(winningTickets > 0, "Lottery: no winning tickets");

        // set prize as claimed
        setUserPrizeClaimed(epoch, msg.sender, true);

        uint prize = winningTickets * prizePerTicket(epoch);

        // Transfer the prize to the user.
        decrementUserUSDCClaims(prize);
        usdc().transfer(msg.sender, prize);

        // Emit `PrizeClaimed` event.
        emit PrizeClaimed(msg.sender, epoch, prize);

        return prize;
    }
}

File 26 of 41 : Permission.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "./Setters.sol";
import "../external/Require.sol";

contract Permission is Setters {

    bytes32 private constant FILE = "Permission";

    // Can modify account state
    modifier onlyFrozenOrFluid(address account) {
        Require.that(
            statusOf(account) != Account.Status.Locked,
            FILE,
            "Not frozen or fluid"
        );

        _;
    }

    // Can participate in balance-dependant activities
    modifier onlyFrozenOrLocked(address account) {
        Require.that(
            statusOf(account) != Account.Status.Fluid,
            FILE,
            "Not frozen or locked"
        );

        _;
    }

    modifier initializer() {
        Require.that(
            !isInitialized(implementation()),
            FILE,
            "Already initialized"
        );

        initialized(implementation());

        _;
    }
}

File 27 of 41 : Setters.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "./State.sol";
import "./Getters.sol";

contract Setters is State, Getters {

    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * ERC20 Interface
     */

    function transfer(address recipient, uint256 amount) external returns (bool) {
        return false;
    }

    function approve(address spender, uint256 amount) external returns (bool) {
        return false;
    }

    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
        return false;
    }

    /**
     * Global
     */

    function incrementTotalBonded(uint256 amount) internal {
        _state.balance.bonded = _state.balance.bonded + amount;
    }

    function decrementTotalBonded(uint256 amount) internal {
        _state.balance.bonded = _state.balance.bonded - amount;
    }

    function incrementUserUSDCClaims(uint256 amount) internal {
        _state.balance.userUSDCClaims = _state.balance.userUSDCClaims + amount;
    }

    function decrementUserUSDCClaims(uint256 amount) internal {
        _state.balance.userUSDCClaims = _state.balance.userUSDCClaims - amount;
    }

    /**
     * Account
     */

    function incrementBalanceOf(address account, uint256 amount) internal {
        _state.accounts[account].balance = _state.accounts[account].balance + amount;
        _state.balance.supply = _state.balance.supply + amount;

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

    function decrementBalanceOf(address account, uint256 amount) internal {
        _state.accounts[account].balance = _state.accounts[account].balance - amount;
        _state.balance.supply = _state.balance.supply - amount;

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

    function incrementBalanceOfStaged(address account, uint256 amount) internal {
        _state.accounts[account].staged = _state.accounts[account].staged + amount;
        _state.balance.staged = _state.balance.staged + amount;
    }

    function decrementBalanceOfStaged(address account, uint256 amount) internal {
        _state.accounts[account].staged = _state.accounts[account].staged - amount;
        _state.balance.staged = _state.balance.staged - amount;
    }

    function unfreeze(address account) internal {
        _state.accounts[account].fluidUntil = epoch() + getDAOExitLockupEpochs();
    }

    /**
     * Epoch
     */

    function incrementEpoch() internal {
        _state.epoch.current = _state.epoch.current + (1);
    }

    function snapshotTotalBonded() internal {
        _state.epochs[epoch()].bonded = totalBonded();
    }

    /**
     * Lottery
     */
    
    function setUserTicketRange(address user, uint256 epoch, uint start, uint end) internal {
        _state.epochs[epoch].userTicketRange[user].start = start;
        _state.epochs[epoch].userTicketRange[user].end = end;
    }

    function setPrizePerTicket(uint epoch, uint prize) internal {
        _state.epochs[epoch].prizePerTicket = prize;
    }

    function setUserPrizeClaimed(uint epoch, address user, bool value) internal {
        _state.epochs[epoch].userPrizeClaimed[user] = value;
    }

    function initWinningTicketsArray(uint epoch, uint winningTickets) internal {
        _state.epochs[epoch].winningTickets = new uint256[](winningTickets);
    }

    function setDrawExecuted(uint epoch, bool) internal {
        _state.epochs[epoch].drawExecuted = true;
    }

    function setWinningTicket(uint epoch, uint index, uint value) internal {
        _state.epochs[epoch].winningTickets[index] = value;
    }

    function setChainlinkRequestId(uint epoch, uint requestId) internal {
        _state.epochs[epoch].chainLinkRequestId = requestId;
        _state.chainlinkRequestIds[requestId] = epoch;
    }


    /**
     * Governance
     */

    function createCandidate(address candidate, uint256 period) internal {
        _state.candidates[candidate].start = epoch();
        _state.candidates[candidate].period = period;
    }

    function recordVote(address account, address candidate, Candidate.Vote vote) internal {
        _state.candidates[candidate].votes[account] = vote;
    }

    function incrementApproveFor(address candidate, uint256 amount) internal {
        _state.candidates[candidate].approve = _state.candidates[candidate].approve + amount;
    }

    function decrementApproveFor(address candidate, uint256 amount) internal {
        _state.candidates[candidate].approve = _state.candidates[candidate].approve - amount;
    }

    function incrementRejectFor(address candidate, uint256 amount) internal {
        _state.candidates[candidate].reject = _state.candidates[candidate].reject + amount;
    }

    function decrementRejectFor(address candidate, uint256 amount) internal {
        _state.candidates[candidate].reject = _state.candidates[candidate].reject - amount;
    }

    function placeLock(address account, address candidate) internal {
        uint256 currentLock = _state.accounts[account].lockedUntil;
        uint256 newLock = startFor(candidate) + (periodFor(candidate));
        if (newLock > currentLock) {
            _state.accounts[account].lockedUntil = newLock;
        }
    }

    function initialized(address candidate) internal {
        _state.candidates[candidate].initialized = true;
    }
}

File 28 of 41 : State.sol
/*
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import '../external/IUniswapV2Pair.sol';
import "../token/IToken.sol";
import "../token/ITickets.sol";
import "../external/Decimal.sol";
import "../Constants.sol";

contract Account {
    enum Status {
        Frozen,
        Fluid,
        Locked
    }

    struct State {
        uint256 staged;
        uint256 balance;
        uint256 fluidUntil;
        uint256 lockedUntil;
    }
}

contract Epoch {
    struct Global {
        uint256 current;
    }

    struct TicketRage {
        uint256 start;
        uint256 end;
    }

    struct State {
        uint256 bonded;

        uint256 prizePerTicket;
        uint256[] winningTickets;
        
        mapping(address => TicketRage) userTicketRange;
        mapping(address => bool) userPrizeClaimed;

        uint chainLinkRequestId;
        bool drawExecuted;
    }
}

contract Candidate {
    enum Vote {
        UNDECIDED,
        APPROVE,
        REJECT
    }

    struct State {
        uint256 start;
        uint256 period;
        uint256 approve;
        uint256 reject;
        mapping(address => Vote) votes;
        bool initialized;
    }
}

contract Storage {
    struct Provider {
        IToken token;
        ITickets tickets;
    }

    struct Balance {
        uint256 supply;
        uint256 bonded;
        uint256 staged;
        uint256 userUSDCClaims;
    }

    struct State {
        Epoch.Global epoch;
        Balance balance;
        Provider provider;

        mapping(address => Account.State) accounts;
        mapping(uint256 => Epoch.State) epochs;
        mapping(uint256 => uint256) chainlinkRequestIds; // req id to epoch mapping
        mapping(address => Candidate.State) candidates;
    }
}

contract State is Constants {
    Storage.State _state;
}

File 29 of 41 : Upgradeable.sol
/*
    Copyright 2018-2019 zOS Global Limited
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "../external/Address.sol";
import "./State.sol";

/**
 * Based off of, and designed to interface with, openzeppelin/upgrades package
 */
abstract contract Upgradeable is State {
    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     * @param implementation Address of the new implementation.
     */
    event Upgraded(address indexed implementation);

    function initialize() virtual public;

    /**
     * @dev Upgrades the proxy to a new implementation.
     * @param newImplementation Address of the new implementation.
     */
    function upgradeTo(address newImplementation) internal {
        setImplementation(newImplementation);

        (bool success, bytes memory reason) = newImplementation.delegatecall(abi.encodeWithSignature("initialize()"));
        require(success, string(reason));

        emit Upgraded(newImplementation);
    }

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

        bytes32 slot = IMPLEMENTATION_SLOT;

        assembly {
            sstore(slot, newImplementation)
        }
    }
}

File 30 of 41 : Address.sol
pragma solidity ^0.8.20;

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

File 31 of 41 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFCoordinatorV2Interface {
    /**
     * @notice Get configuration relevant for making requests
     * @return minimumRequestConfirmations global min for request confirmations
     * @return maxGasLimit global max for request gas limit
     * @return s_provingKeyHashes list of registered key hashes
     */
    function getRequestConfig() external view returns (uint16, uint32, bytes32[] memory);

    /**
     * @notice Request a set of random words.
     * @param keyHash - Corresponds to a particular oracle job which uses
     * that key for generating the VRF proof. Different keyHash's have different gas price
     * ceilings, so you can select a specific one to bound your maximum per request cost.
     * @param subId  - The ID of the VRF subscription. Must be funded
     * with the minimum subscription balance required for the selected keyHash.
     * @param minimumRequestConfirmations - How many blocks you'd like the
     * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
     * for why you may want to request more. The acceptable range is
     * [minimumRequestBlockConfirmations, 200].
     * @param callbackGasLimit - How much gas you'd like to receive in your
     * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
     * may be slightly less than this amount because of gas used calling the function
     * (argument decoding etc.), so you may need to request slightly more than you expect
     * to have inside fulfillRandomWords. The acceptable range is
     * [0, maxGasLimit]
     * @param numWords - The number of uint256 random values you'd like to receive
     * in your fulfillRandomWords callback. Note these numbers are expanded in a
     * secure way by the VRFCoordinator from a single random value supplied by the oracle.
     * @return requestId - A unique identifier of the request. Can be used to match
     * a request to a response in fulfillRandomWords.
     */
    function requestRandomWords(
        bytes32 keyHash,
        uint64 subId,
        uint16 minimumRequestConfirmations,
        uint32 callbackGasLimit,
        uint32 numWords
    )
        external
        returns (uint256 requestId);

    /**
     * @notice Create a VRF subscription.
     * @return subId - A unique subscription id.
     * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
     * @dev Note to fund the subscription, use transferAndCall. For example
     * @dev  LINKTOKEN.transferAndCall(
     * @dev    address(COORDINATOR),
     * @dev    amount,
     * @dev    abi.encode(subId));
     */
    function createSubscription() external returns (uint64 subId);

    /**
     * @notice Get a VRF subscription.
     * @param subId - ID of the subscription
     * @return balance - LINK balance of the subscription in juels.
     * @return reqCount - number of requests for this subscription, determines fee tier.
     * @return owner - owner of the subscription.
     * @return consumers - list of consumer address which are able to use this subscription.
     */
    function getSubscription(uint64 subId)
        external
        view
        returns (uint96 balance, uint64 reqCount, address owner, address[] memory consumers);

    /**
     * @notice Request subscription owner transfer.
     * @param subId - ID of the subscription
     * @param newOwner - proposed new owner of the subscription
     */
    function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

    /**
     * @notice Request subscription owner transfer.
     * @param subId - ID of the subscription
     * @dev will revert if original owner of subId has
     * not requested that msg.sender become the new owner.
     */
    function acceptSubscriptionOwnerTransfer(uint64 subId) external;

    /**
     * @notice Add a consumer to a VRF subscription.
     * @param subId - ID of the subscription
     * @param consumer - New consumer which can use the subscription
     */
    function addConsumer(uint64 subId, address consumer) external;

    /**
     * @notice Remove a consumer from a VRF subscription.
     * @param subId - ID of the subscription
     * @param consumer - Consumer to remove from the subscription
     */
    function removeConsumer(uint64 subId, address consumer) external;

    /**
     * @notice Cancel a subscription
     * @param subId - ID of the subscription
     * @param to - Where to send the remaining LINK to
     */
    function cancelSubscription(uint64 subId, address to) external;

    /*
    * @notice Check to see if there exists a request commitment consumers
    * for all consumers and keyhashes for a given sub.
    * @param subId - ID of the subscription
    * @return true if there exists at least one unfulfilled request for the subscription, false
    * otherwise.
    */
    function pendingRequestExists(uint64 subId) external view returns (bool);
}

File 32 of 41 : Decimal.sol
/*
    Copyright 2019 dYdX Trading Inc.
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

/**
 * @title Decimal
 * @author dYdX
 *
 * Library that defines a fixed-point number with 18 decimal places.
 */
library Decimal {
    // ============ Constants ============

    uint256 constant BASE = 10**18;

    // ============ Structs ============


    struct D256 {
        uint256 value;
    }

    // ============ Static Functions ============

    function zero()
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: 0 });
    }

    function one()
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: BASE });
    }

    function from(
        uint256 a
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: a * (BASE) });
    }

    function ratio(
        uint256 a,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: getPartial(a, BASE, b) });
    }

    // ============ Self Functions ============

    function add(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value + (b * (BASE)) });
    }

    function sub(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value - (b * (BASE)) });
    }

    function sub(
        D256 memory self,
        uint256 b,
        string memory reason
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value - (b * (BASE)) });
    }

    function mul(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value * (b) });
    }

    function div(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value / (b) });
    }

    function pow(
        D256 memory self,
        uint256 b
    )
    internal
    pure
    returns (D256 memory)
    {
        if (b == 0) {
            return from(1);
        }

        D256 memory temp = D256({ value: self.value });
        for (uint256 i = 1; i < b; i++) {
            temp = mul(temp, self);
        }

        return temp;
    }

    function add(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value + (b.value) });
    }

    function sub(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value - (b.value) });
    }

    function sub(
        D256 memory self,
        D256 memory b,
        string memory reason
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: self.value - (b.value) });
    }

    function mul(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: getPartial(self.value, b.value, BASE) });
    }

    function div(
        D256 memory self,
        D256 memory b
    )
    internal
    pure
    returns (D256 memory)
    {
        return D256({ value: getPartial(self.value, BASE, b.value) });
    }

    function equals(D256 memory self, D256 memory b) internal pure returns (bool) {
        return self.value == b.value;
    }

    function greaterThan(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) == 2;
    }

    function lessThan(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) == 0;
    }

    function greaterThanOrEqualTo(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) > 0;
    }

    function lessThanOrEqualTo(D256 memory self, D256 memory b) internal pure returns (bool) {
        return compareTo(self, b) < 2;
    }

    function isZero(D256 memory self) internal pure returns (bool) {
        return self.value == 0;
    }

    function asUint256(D256 memory self) internal pure returns (uint256) {
        return self.value / (BASE);
    }

    // ============ Core Methods ============

    function getPartial(
        uint256 target,
        uint256 numerator,
        uint256 denominator
    )
    private
    pure
    returns (uint256)
    {
        return (target * numerator) / (denominator);
    }

    function compareTo(
        D256 memory a,
        D256 memory b
    )
    private
    pure
    returns (uint256)
    {
        if (a.value == b.value) {
            return 1;
        }
        return a.value > b.value ? 2 : 0;
    }
}

File 33 of 41 : IUniswapV2Factory.sol
/// SPDX-License-Identifier: UNLICENSED
pragma solidity >= 0.8.20;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint256);

    function feeTo() external view returns (address);

    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);

    function allPairs(uint256) external view returns (address pair);

    function allPairsLength() external view returns (uint256);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;

    function setFeeToSetter(address) external;
}

File 34 of 41 : IUniswapV2Pair.sol
/// SPDX-License-Identifier: UNLICENSED
pragma solidity >= 0.8.20;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(address from, address to, uint256 value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    )
        external;

    event Mint(address indexed sender, uint256 amount0, uint256 amount1);
    event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint256 amount0In,
        uint256 amount1In,
        uint256 amount0Out,
        uint256 amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function factory() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

    function price0CumulativeLast() external view returns (uint256);

    function price1CumulativeLast() external view returns (uint256);

    function kLast() external view returns (uint256);

    function mint(address to) external returns (uint256 liquidity);

    function burn(address to) external returns (uint256 amount0, uint256 amount1);

    function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;

    function skim(address to) external;

    function sync() external;

    function initialize(address, address) external;
}

File 35 of 41 : IUniswapV2Router.sol
/// SPDX-License-Identifier: UNLICENSED
pragma solidity >= 0.8.20;

interface IUniswapV2Router02 {
    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (uint256 amountA, uint256 amountB, uint256 liquidity);

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    )
        external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    )
        external
        payable;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    )
        external;

    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 36 of 41 : Require.sol
/*
    Copyright 2019 dYdX Trading Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;

/**
 * @title Require
 * @author dYdX
 *
 * Stringifies parameters to pretty-print revert messages. Costs more gas than regular require()
 */
library Require {

    // ============ Constants ============

    uint256 constant ASCII_ZERO = 48; // '0'
    uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
    uint256 constant ASCII_LOWER_EX = 120; // 'x'
    bytes2 constant COLON = 0x3a20; // ': '
    bytes2 constant COMMA = 0x2c20; // ', '
    bytes2 constant LPAREN = 0x203c; // ' <'
    bytes1 constant RPAREN = 0x3e; // '>'
    uint256 constant FOUR_BIT_MASK = 0xf;

    // ============ Library Functions ============

    function that(
        bool must,
        bytes32 file,
        bytes32 reason
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason)
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        uint256 payloadA
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        uint256 payloadA,
        uint256 payloadB
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        address payloadA
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        address payloadA,
        uint256 payloadB
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        address payloadA,
        uint256 payloadB,
        uint256 payloadC
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        COMMA,
                        stringify(payloadC),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        bytes32 payloadA
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        RPAREN
                    )
                )
            );
        }
    }

    function that(
        bool must,
        bytes32 file,
        bytes32 reason,
        bytes32 payloadA,
        uint256 payloadB,
        uint256 payloadC
    )
    internal
    pure
    {
        if (!must) {
            revert(
                string(
                    abi.encodePacked(
                        stringifyTruncated(file),
                        COLON,
                        stringifyTruncated(reason),
                        LPAREN,
                        stringify(payloadA),
                        COMMA,
                        stringify(payloadB),
                        COMMA,
                        stringify(payloadC),
                        RPAREN
                    )
                )
            );
        }
    }

    // ============ Private Functions ============

    function stringifyTruncated(
        bytes32 input
    )
    private
    pure
    returns (bytes memory)
    {
        // put the input bytes into the result
        bytes memory result = abi.encodePacked(input);

        // determine the length of the input by finding the location of the last non-zero byte
        for (uint256 i = 32; i > 0; ) {
            // reverse-for-loops with unsigned integer
            /* solium-disable-next-line security/no-modify-for-iter-var */
            i--;

            // find the last non-zero byte in order to determine the length
            if (result[i] != 0) {
                uint256 length = i + 1;

                /* solium-disable-next-line security/no-inline-assembly */
                assembly {
                    mstore(result, length) // r.length = length;
                }

                return result;
            }
        }

        // all bytes are zero
        return new bytes(0);
    }

    function stringify(
        uint256 input
    )
    private
    pure
    returns (bytes memory)
    {
        if (input == 0) {
            return "0";
        }

        // get the final string length
        uint256 j = input;
        uint256 length;
        while (j != 0) {
            length++;
            j /= 10;
        }

        // allocate the string
        bytes memory bstr = new bytes(length);

        // populate the string starting with the least-significant character
        j = input;
        for (uint256 i = length; i > 0; ) {
            // reverse-for-loops with unsigned integer
            /* solium-disable-next-line security/no-modify-for-iter-var */
            i--;

            // take last decimal digit
            bstr[i] = bytes1(uint8(ASCII_ZERO + (j % 10)));

            // remove the last decimal digit
            j /= 10;
        }

        return bstr;
    }

    function stringify(
        address input
    )
    private
    pure
    returns (bytes memory)
    {
        uint256 z = uint256(uint160(input));

        // addresses are "0x" followed by 20 bytes of data which take up 2 characters each
        bytes memory result = new bytes(42);

        // populate the result with "0x"
        result[0] = bytes1(uint8(ASCII_ZERO));
        result[1] = bytes1(uint8(ASCII_LOWER_EX));

        // for each byte (starting from the lowest byte), populate the result with two characters
        for (uint256 i = 0; i < 20; i++) {
            // each byte takes two characters
            uint256 shift = i * 2;

            // populate the least-significant character
            result[41 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;

            // populate the most-significant character
            result[40 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;
        }

        return result;
    }

    function stringify(
        bytes32 input
    )
    private
    pure
    returns (bytes memory)
    {
        uint256 z = uint256(input);

        // bytes32 are "0x" followed by 32 bytes of data which take up 2 characters each
        bytes memory result = new bytes(66);

        // populate the result with "0x"
        result[0] = bytes1(uint8(ASCII_ZERO));
        result[1] = bytes1(uint8(ASCII_LOWER_EX));

        // for each byte (starting from the lowest byte), populate the result with two characters
        for (uint256 i = 0; i < 32; i++) {
            // each byte takes two characters
            uint256 shift = i * 2;

            // populate the least-significant character
            result[65 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;

            // populate the most-significant character
            result[64 - shift] = char(z & FOUR_BIT_MASK);
            z = z >> 4;
        }

        return result;
    }

    function char(
        uint256 input
    )
    private
    pure
    returns (bytes1)
    {
        // return ASCII digit (0-9)
        if (input < 10) {
            return bytes1(uint8(input + ASCII_ZERO));
        }

        // return ASCII letter (a-f)
        return bytes1(uint8(input + ASCII_RELATIVE_ZERO));
    }
}

File 37 of 41 : ITickets.sol
/*
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import { Tickets } from "./Tickets.sol";

abstract contract ITickets is Tickets {
}

File 38 of 41 : IToken.sol
/*
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import { Lucky8Token } from "./Token.sol";

abstract contract IToken is Lucky8Token {
}

File 39 of 41 : Tickets.sol
/*
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ERC1155 } from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import { ERC1155Supply } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import { ERC1155URIStorage } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol";

contract Tickets is Ownable, ERC1155Supply, ERC1155URIStorage {
    constructor(string memory _uri) 
        Ownable(msg.sender)
        ERC1155(_uri)
    {

    }

    ///////////////////////////////////////////
    ////////// ERC-1155 OVERRIDES /////////////
    ///////////////////////////////////////////

    function mint(address to, uint round, uint amount) public onlyOwner {
        _mint(to, round, amount, "");
    }

    /// @dev Override needed to make the tickets non-transferable.
    function safeTransferFrom(
        address, /* from */
        address, /* to */
        uint256, /* id */
        uint256, /* value */
        bytes memory /* data */
    )
        public
        pure
        override
    {
        revert("Lottery: Tickets are non-transferable");
    }

    /// @dev Override needed to make the tickets non-transferable.
    function safeBatchTransferFrom(
        address, /* from */
        address, /* to */
        uint256[] memory, /* ids */
        uint256[] memory, /* values */
        bytes memory /* data */
    )
        public
        pure
        override
    {
        revert("Lottery: Tickets are non-transferable");
    }

    /// @dev Override needed to get token id URI.
    function uri(uint256 id) public view override(ERC1155URIStorage, ERC1155) returns (string memory) {
        return super.uri(id);
    }

    /// @dev Override needed to update balances for ERC-1155 tokens.
    function _update(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values
    )
        internal
        override(ERC1155Supply, ERC1155)
    {
        super._update(from, to, ids, values);
    }
}

File 40 of 41 : Token.sol
/*
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity >= 0.8.20;


import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import { IUniswapV2Pair } from "../external/IUniswapV2Pair.sol";
import { IUniswapV2Factory } from "../external/IUniswapV2Factory.sol";
import { IUniswapV2Router02 } from "../external/IUniswapV2Router.sol";

import { Upgradeable } from "./Upgradeable.sol";

/// @dev The Lucky8Token contract.
contract Lucky8Token is ERC20, Ownable, Upgradeable {
    ///////////////////////////////////////////
    //////// CONSTANTS AND IMMUTABLES /////////
    ///////////////////////////////////////////

    /// @dev Dead address.
    address internal constant _ZERO_ADDR = address(0);

    /// @dev USDC address.
    ERC20 internal constant _USDC = ERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
    address internal _USDC_RECEIVAL_PROXY;

    /// @dev old token address.
    address public oldTokenV1;
    address public oldTokenV2;

    /// @dev Uniswap V2 USDC Pair.
    address public pair;

    /// @dev Uniswap V2 Router.
    IUniswapV2Router02 public constant uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);

    ///////////////////////////////////////////
    //////// TOKEN SETTINGS ///////////////////
    ///////////////////////////////////////////

    uint256 public constant BASE = 1 ether;

    /// @dev Migration Enabled.
    bool public migrationEnabled;

    /// @dev Buy fee.
    uint256 public buyFee;

    /// @dev Sell fee.
    uint256 public sellFee;

    /// @dev Minimum Amount to distribute
    uint256 public minDistribution; 

    /// @dev Cap Pool Slippage on fee sells
    uint256 public maxPoolSlippage;

    /// @dev Fee Sell amount
    uint256 public feeDistributionToSell;

    /// @dev LP of Sold proceeds
    uint256 public feeDistributionLPofProceeds;

    /// @dev Stores AMMs pairs.
    mapping(address => bool) public isAmmPair;

    /// @dev Stores addresses that are excluded from fees.
    mapping(address => bool) public isExcludedFromFee;

    /// @dev Stores addresses that are excluded from fees.
    mapping(address => bool) public isInitialized;

    function name() public override pure returns (string memory) {
        return "Lucky 8 Token";
    }
    function symbol() public override pure returns (string memory) {
        return "888";
    }
    
    ///////////////////////////////////////////
    //////// EVENTS ///////////////////////////
    ///////////////////////////////////////////

    /// @dev This event is emitted when an address is blocked or unblocked.
    event SetBlockedAddress(address addr, bool blocked);

    /// @dev This event is emitted when an AMM pair is set or unset.
    event SetAmmPair(address pair, bool isPair);

    /// @dev This event is emitted when an address is excluded from fees.
    event SetExcludedFromFee(address addr, bool excluded);

    /// @dev This event is emitted when the teamWallet is changed.
    event SetTeamWallet(address oldTeamWallet, address newTeamWallet);

    /// @dev This event is emitted migration is enabled.
    event SetMigrationEnabled(bool oldMigrationEnabled, bool newMigrationEnabled);

    /// @dev This event is emitted when the buy fee is changed.
    event SetBuyFee(uint256 oldBuyFee, uint256 newBuyFee);

    /// @dev This event is emitted when min distribution is changed.
    event SetMinDistribution(uint256 oldMinDistribution, uint256 newMinDistribution);

    /// @dev This event is emitted when max pool slippage is changed.
    event SetMaxPoolSlippage(uint256 oldSlippage, uint256 newSlippage);

    /// @dev This event is emitted when distribution to sell is changed.
    event SetFeeDistributionToSell(uint256 oldPercentage, uint256 newPercentage);

    /// @dev This event is emitted when sale proceeds to LP is changed.
    event SetFeeDistributionToLPOfProceeds(uint256 oldPercentage, uint256 newPercentage);

    /// @dev This event is emitted when distribution to team is changed.
    event SetFeeDistributionToTeam(uint256 oldPercentage, uint256 newPercentage);

    /// @dev This event is emitted when burn percentage is changed.
    event SetFeeDistributionToBurn(uint256 oldPercentage, uint256 newPercentage);

    /// @dev This event is emitted when the sell fee is changed.
    event SetSellFee(uint256 oldSellFee, uint256 newSellFee);

    modifier initializer() {
        require(
            isInitialized[implementation()] == false,
            "Already initialized"
        );

        isInitialized[implementation()] = true;

        _;
    }

    bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
    function implementation() public view returns (address impl) {
        bytes32 slot = IMPLEMENTATION_SLOT;
        assembly {
            impl := sload(slot)
        }
    }

    constructor() ERC20("","") Ownable(msg.sender) {
        // proxy is getting initialized din the initialize function
    }

    function initialize() initializer override public {
        _transferOwnership(0x3Ba65aD297A3B0B3C00508eBf5bC3d72c9d5f1A5);

        oldTokenV1 = 0x8880111018C364912dBe5Ee61D98942647680888;
        oldTokenV2 = 0x35722BC146938c8B0d39f3e192da3DCCfD8a2e57;

        _USDC_RECEIVAL_PROXY = address(new TokenReceivalProxy(_USDC));

        pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), address(_USDC));

        isAmmPair[pair] = true;

        isExcludedFromFee[owner()] = true;
        isExcludedFromFee[address(this)] = true;
        isExcludedFromFee[address(uniswapV2Router)] = true;
        isExcludedFromFee[0x3Ba65aD297A3B0B3C00508eBf5bC3d72c9d5f1A5] = true;

        buyFee = 1e17; // 10%
        sellFee = 1e17; // 10%
        minDistribution = 50_000 ether; // 50k Tokens
        maxPoolSlippage = 2e16; // 2%
        feeDistributionToSell = 6e17; // 60%
        feeDistributionLPofProceeds = 33e16; // 33% (ca 20% of total in USDC + ca 20% of total)
    }

    function upgrade(address newImplementation) external onlyOwner {
        upgradeTo(newImplementation);
    }

    function migrateFromV1(uint amount) external {
        require(migrationEnabled, "Migration: not active");
        require(
            ERC20(oldTokenV1).transferFrom(msg.sender, 0x000000000000000000000000000000000000dEaD, amount), 
            "Migration: Invalid Balance or allowance"
        );
        _mint(msg.sender, amount);
    }

    function migrateFromV2(uint amount) external {
        require(migrationEnabled, "Migration: not active");
        require(
            ERC20(oldTokenV2).transferFrom(msg.sender, 0x000000000000000000000000000000000000dEaD, amount), 
            "Migration: Invalid Balance or allowance"
        );
        _mint(msg.sender, amount);
    }

    /// @dev This function is used to set the buy fee.
    function setMigrationEnabled(bool _migrationEnabled) external onlyOwner {
        bool oldMigrationEnabled = migrationEnabled;
        migrationEnabled = _migrationEnabled;
        emit SetMigrationEnabled(oldMigrationEnabled, _migrationEnabled);
    }

    /// @dev This function is used to set the buy fee.
    function setBuyFee(uint256 _buyFee) external onlyOwner {
        uint256 oldBuyFee = buyFee;
        buyFee = _buyFee;
        emit SetBuyFee(oldBuyFee, buyFee);
    }

    /// @dev This function is used to set the sell fee.
    function setSellFee(uint256 _sellFee) external onlyOwner {
        uint256 oldSellFee = sellFee;
        sellFee = _sellFee;
        emit SetSellFee(oldSellFee, sellFee);
    }

    /// @dev This function is used to set the min auto distribution.
    function setMinDistribution(uint256 _minDistribution) external onlyOwner {
        uint old = minDistribution;
        minDistribution = _minDistribution;
        emit SetMinDistribution(old, _minDistribution);
    }

    /// @dev This function is used to set the min auto distribution.
    function setMaxPoolSlippage(uint256 _slippage) external onlyOwner {
        uint old = maxPoolSlippage;
        maxPoolSlippage = _slippage;
        emit SetMaxPoolSlippage(old, _slippage);
    }

    /// @dev This function is used to set the min auto distribution.
    function setFeeDistributionToSell(uint256 _percentage) external onlyOwner {
        uint old = feeDistributionToSell;
        feeDistributionToSell = _percentage;
        emit SetFeeDistributionToSell(old, _percentage);
    }

    /// @dev This function is used to set the min auto distribution.
    function setFeeDistributionLPofProceeds(uint256 _percentage) external onlyOwner {
        uint old = feeDistributionLPofProceeds;
        feeDistributionLPofProceeds = _percentage;
        emit SetFeeDistributionToLPOfProceeds(old, _percentage);
    }

    /// @dev This function is used to set an AMM pair.
    function setAmmPair(address _pair, bool isPair) external onlyOwner {
        isAmmPair[_pair] = isPair;
        emit SetAmmPair(_pair, isPair);
    }

    /// @dev This function is used to set an address as excluded from fees.
    function setExcludedFromFee(address addr, bool excluded) external onlyOwner {
        isExcludedFromFee[addr] = excluded;
        emit SetExcludedFromFee(addr, excluded);
    }

    /// @dev Burn the specified amount of tokens from the caller.
    function burn(address addr, uint256 amount) external onlyOwner {
        _burn(addr, amount);
    }

    /// @dev Set function..
    function _update(address _from, address _to, uint256 amount) internal override {
        // If amount is 0 then just execute the transfer and return.
        if (amount == 0) {
            super._update(_from, _to, amount);
            return;
        }

        // If sender or recipient is excluded from fee then just transfer and return.
        if (isExcludedFromFee[_from] || isExcludedFromFee[_to]) {
            super._update(_from, _to, amount);
            return;
        }

        // If sender or recipient is an AMM pair compute fee.
        uint256 fee;
        if (isAmmPair[_to] && sellFee > 0) {
            fee = (amount * sellFee) / BASE;
        } else if (isAmmPair[_from] && buyFee > 0) {
            fee = (amount * buyFee) / BASE;
        }

        // collect fee
        super._update(_from, address(this), fee);
        amount -= fee;

        // If enough rewards are accrued, distribute them
        uint accruedRewards = balanceOf(address(this));
        if (
            isAmmPair[_to] &&
            accruedRewards > minDistribution
        ){
            distributeFees();
        }

        super._update(_from, _to, amount);
    }

    /// @dev Distribute collected fees to DAO & Team, automatically sell and LP set percentages
    function distributeFees() public {
        require(balanceOf(address(this)) > 0, "Nothing to distribute");

        // Sell to Pool
        if (feeDistributionToSell > 0) {
            uint sellAmount = balanceOf(address(this)) * feeDistributionToSell / BASE;
            // limit sell amount
            uint sellLimit = balanceOf(pair) * maxPoolSlippage / BASE;
            if(sellAmount > sellLimit) {
                sellAmount = sellLimit;
            }
            
            // execute sale
            address[] memory path = new address[](2);
                path[0] = address(this);
                path[1] = address(_USDC);
            _approve(address(this), address(uniswapV2Router), sellAmount);
            uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
                sellAmount, 0, path, _USDC_RECEIVAL_PROXY, block.timestamp
            );
            ERC20(_USDC).transferFrom(_USDC_RECEIVAL_PROXY, address(this), ERC20(_USDC).balanceOf(_USDC_RECEIVAL_PROXY));

            // LP
            if(feeDistributionLPofProceeds > 0) {
                uint usdcBalance = ERC20(_USDC).balanceOf(address(this));
                uint usdcToLP = usdcBalance * feeDistributionLPofProceeds / BASE;

                (uint thisReserve, uint usdcReserve) = getReserves(address(this), address(_USDC), pair);

                // transfer USDC to pool
                ERC20(_USDC).transfer(pair, usdcToLP);
                // transfer token to pool
                super._update(address(this), pair, usdcToLP * thisReserve / usdcReserve + 1);
                
                // mint LP Tokens
                IUniswapV2Pair(pair).mint(address(this));
            }
        }

        // send any remaining 888, USDC & LP Token to DAO
        super._update(address(this), owner(), balanceOf(address(this)));
        ERC20(_USDC).transfer(owner(),ERC20(_USDC).balanceOf(address(this)));
        ERC20(pair).transfer(owner(), ERC20(pair).balanceOf(address(this)));
    }

    // overridable for testing
    function getReserves(address tokenA, address tokenB, address pair) internal view returns (uint reserveA, uint reserveB) {
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pair).getReserves();
        (address token0,) = sortTokens(tokenA, tokenB);
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
    }
}


contract TokenReceivalProxy {
    constructor(ERC20 token){
        token.approve(msg.sender, type(uint256).max);
    }
}

File 41 of 41 : Upgradeable.sol
/*
    Copyright 2018-2019 zOS Global Limited
    Copyright 2020 Empty Set Squad <[email protected]>
    Copyright 2023 Lucky8 Lottery

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

pragma solidity ^0.8.20;
pragma experimental ABIEncoderV2;

import "../external/Address.sol";

/**
 * Based off of, and designed to interface with, openzeppelin/upgrades package
 */
abstract contract Upgradeable {
    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     * @param implementation Address of the new implementation.
     */
    event Upgraded(address indexed implementation);

    function initialize() virtual public;

    /**
     * @dev Upgrades the proxy to a new implementation.
     * @param newImplementation Address of the new implementation.
     */
    function upgradeTo(address newImplementation) internal {
        setImplementation(newImplementation);

        (bool success, bytes memory reason) = newImplementation.delegatecall(abi.encodeWithSignature("initialize()"));
        require(success, string(reason));

        emit Upgraded(newImplementation);
    }

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

        bytes32 slot = IMPLEMENTATION_SLOT;

        assembly {
            sstore(slot, newImplementation)
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"block","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Advance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"valueUnderlying","type":"uint256"}],"name":"Bond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"candidate","type":"address"}],"name":"Commit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Incentivization","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"LotteryDrawFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalTickets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"prizePool","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"winnningTickets","type":"uint256"}],"name":"LotteryDrawStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PrizeClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"candidate","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"}],"name":"Proposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TicketsMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"valueUnderlying","type":"uint256"}],"name":"Unbond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"candidate","type":"address"},{"indexed":false,"internalType":"enum Candidate.Vote","name":"vote","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"bonded","type":"uint256"}],"name":"Vote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"ChainlinkSubId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VRFCoordinator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VRFKeyhash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"advance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"approveFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfBonded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOfStaged","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"bond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"chainLinkRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"chainlinkRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"claimPrize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"commit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"depositAndBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"drawExecuted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"emergencyCommit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"epochForRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"fluidUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"impl","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"isNominated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintTickets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"periodFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"prizePerTicket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"candidate","type":"address"}],"name":"recordedVote","outputs":[{"internalType":"enum Candidate.Vote","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"rejectFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"startFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"statusOf","outputs":[{"internalType":"enum Account.Status","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"thisEpochsPrizePool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"thisEpochsTokenRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickets","outputs":[{"internalType":"contract ITickets","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBonded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"totalBondedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPrizePool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaged","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTokenRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUserTokenClaims","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"unbond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"unbondUnderlying","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"contract IToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"userPrizeClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"userTicketRange","outputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userUSDCClaims","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"},{"internalType":"enum Candidate.Vote","name":"vote","type":"uint8"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"votesFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"winnersAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"winningTickets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506158c280620000216000396000f3fe608060405234801561001057600080fd5b50600436106103ba5760003560e01c806364668022116101f4578063b6b55f251161011a578063df9a2b1c116100ad578063f1b7cf491161007c578063f1b7cf4914610c11578063fc0c546a14610c41578063ff2d2abb14610c5f578063ffbe3b7314610c90576103ba565b8063df9a2b1c14610b9f578063ea105ac714610bbb578063ed6c793114610bc5578063f05f88e014610bf5576103ba565b8063d2e2a975116100e9578063d2e2a97514610af1578063d60b347f14610b0f578063d709815414610b3f578063dd62ed3e14610b6f576103ba565b8063b6b55f2514610a6b578063bceb514d14610a87578063c7964b4d14610aa3578063cf02377914610ad3576103ba565b806386cf9f14116101925780639940686e116101615780639940686e146109d1578063a117b350146109ed578063a50cd8e714610a0b578063a9059cbb14610a3b576103ba565b806386cf9f1414610935578063900cf0cf1461096557806395d89b411461098357806397a5d5b5146109a1576103ba565b806370a08231116101ce57806370a082311461089b5780638129fc1c146108cb578063825ad607146108d5578063833f65ab14610905576103ba565b8063646680221461082f57806369c61d0b1461085f5780636c6861911461087d576103ba565b8063353a420c116102e45780633fbba9a6116102775780635053e461116102465780635053e461146107a557806351bf21d8146107c357806355802803146107f35780635c60da1b14610811576103ba565b80633fbba9a61461071d57806342b70aed1461074d57806344d96e951461076b57806347c0506914610789576103ba565b80633a3e6c81116102b35780633a3e6c81146106815780633d68ec02146106b15780633de3fbd9146106e15780633e413bee146106ff576103ba565b8063353a420c146105e75780633600da8214610617578063369e8c1d14610647578063398ab9a714610663576103ba565b80631fe543e31161035c5780632b59dd851161032b5780632b59dd85146105715780632e1a7d4d1461058f578063313ce567146105ab57806333b60863146105c9576103ba565b80631fe543e3146104eb578063218585211461050757806323b872dd1461052557806327de9e3214610555576103ba565b80630d673c91116103985780630d673c911461043d57806315e14bf61461046d57806318160ddd1461049d5780631fce0812146104bb576103ba565b806306fdde03146103bf578063071b197e146103dd578063095ea7b31461040d575b600080fd5b6103c7610cc0565b6040516103d49190614600565b60405180910390f35b6103f760048036038101906103f2919061466c565b610cfd565b60405161040491906146b4565b60405180910390f35b6104276004803603810190610422919061472d565b610d2c565b60405161043491906146b4565b60405180910390f35b6104576004803603810190610452919061466c565b610d34565b604051610464919061477c565b60405180910390f35b61048760048036038101906104829190614797565b610d53565b604051610494919061477c565b60405180910390f35b6104a5610da1565b6040516104b2919061477c565b60405180910390f35b6104d560048036038101906104d091906147c4565b610db0565b6040516104e291906146b4565b60405180910390f35b6105056004803603810190610500919061494c565b610e1d565b005b61050f611074565b60405161051c9190614a07565b60405180910390f35b61053f600480360381019061053a9190614a22565b6110a3565b60405161054c91906146b4565b60405180910390f35b61056f600480360381019061056a919061466c565b6110ac565b005b6105796111e2565b604051610586919061477c565b60405180910390f35b6105a960048036038101906105a4919061466c565b61121c565b005b6105b361137a565b6040516105c09190614a91565b60405180910390f35b6105d1611383565b6040516105de9190614abb565b60405180910390f35b61060160048036038101906105fc9190614797565b61139f565b60405161060e919061477c565b60405180910390f35b610631600480360381019061062c919061466c565b6113ed565b60405161063e919061477c565b60405180910390f35b610661600480360381019061065c9190614797565b61140f565b005b61066b611696565b604051610678919061477c565b60405180910390f35b61069b60048036038101906106969190614797565b611759565b6040516106a891906146b4565b60405180910390f35b6106cb60048036038101906106c6919061466c565b6117aa565b6040516106d8919061477c565b60405180910390f35b6106e96117cc565b6040516106f6919061477c565b60405180910390f35b610707611866565b6040516107149190614af7565b60405180910390f35b61073760048036038101906107329190614b12565b611875565b6040516107449190614bc9565b60405180910390f35b61075561190e565b604051610762919061477c565b60405180910390f35b61077361192f565b604051610780919061477c565b60405180910390f35b6107a3600480360381019061079e9190614797565b61193e565b005b6107ad611b3d565b6040516107ba919061477c565b60405180910390f35b6107dd60048036038101906107d89190614797565b611ba3565b6040516107ea919061477c565b60405180910390f35b6107fb611bf1565b6040516108089190614c07565b60405180910390f35b610819611bfb565b6040516108269190614abb565b60405180910390f35b61084960048036038101906108449190614797565b611c2c565b604051610856919061477c565b60405180910390f35b610867611c7a565b604051610874919061477c565b60405180910390f35b610885611c89565b6040516108929190614c3b565b60405180910390f35b6108b560048036038101906108b09190614797565b611cb4565b6040516108c2919061477c565b60405180910390f35b6108d3611d02565b005b6108ef60048036038101906108ea9190614797565b611d6f565b6040516108fc919061477c565b60405180910390f35b61091f600480360381019061091a919061466c565b611dbd565b60405161092c919061477c565b60405180910390f35b61094f600480360381019061094a9190614797565b611de2565b60405161095c919061477c565b60405180910390f35b61096d611e30565b60405161097a919061477c565b60405180910390f35b61098b611e3f565b6040516109989190614600565b60405180910390f35b6109bb60048036038101906109b69190614797565b611e7c565b6040516109c89190614c9e565b60405180910390f35b6109eb60048036038101906109e6919061466c565b611f41565b005b6109f5612093565b604051610a02919061477c565b60405180910390f35b610a256004803603810190610a209190614797565b6120cd565b604051610a32919061477c565b60405180910390f35b610a556004803603810190610a50919061472d565b6120f2565b604051610a6291906146b4565b60405180910390f35b610a856004803603810190610a80919061466c565b6120fa565b005b610aa16004803603810190610a9c9190614cde565b6121dd565b005b610abd6004803603810190610ab8919061466c565b6125af565b604051610aca919061477c565b60405180910390f35b610adb6125d1565b604051610ae8919061477c565b60405180910390f35b610af96125e0565b604051610b06919061477c565b60405180910390f35b610b296004803603810190610b249190614797565b6129ab565b604051610b3691906146b4565b60405180910390f35b610b596004803603810190610b54919061466c565b612a06565b604051610b66919061477c565b60405180910390f35b610b896004803603810190610b849190614b12565b612c8e565b604051610b96919061477c565b60405180910390f35b610bb96004803603810190610bb4919061466c565b612c96565b005b610bc3612dca565b005b610bdf6004803603810190610bda919061466c565b612e24565b604051610bec9190614ddc565b60405180910390f35b610c0f6004803603810190610c0a919061466c565b612e95565b005b610c2b6004803603810190610c269190614797565b612eaa565b604051610c38919061477c565b60405180910390f35b610c49612ef8565b604051610c569190614af7565b60405180910390f35b610c796004803603810190610c74919061472d565b612f27565b604051610c87929190614dfe565b60405180910390f35b610caa6004803603810190610ca5919061466c565b612fe9565b604051610cb7919061477c565b60405180910390f35b60606040518060400160405280601481526020017f4c75636b7938205374616b656420546f6b656e73000000000000000000000000815250905090565b600080600801600083815260200190815260200160002060060160009054906101000a900460ff169050919050565b600092915050565b6000806009016000838152602001908152602001600020549050919050565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b60008060010160000154905090565b600080600801600084815260200190815260200160002060040160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610e25611383565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8990614e73565b60405180910390fd5b6000610e9d83610d34565b905082610ea9826125af565b14610ee9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee090614edf565b60405180910390fd5b60001515610ef682610cfd565b151514610f38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2f90614f4b565b60405180910390fd5b610f4181612e24565b51825114610f4e57600080fd5b6000610f58611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b039836040518263ffffffff1660e01b8152600401610f90919061477c565b602060405180830381865afa158015610fad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd19190614f80565b905060005b83518110156110225761100f838284878581518110610ff857610ff7614fad565b5b602002602001015161100a919061500b565b61300b565b808061101a9061506b565b915050610fd6565b5061102e82600161304a565b7f60d2a26be72e20dd7fb9bd580d3e6af0888043986cfc368ac2cdf2229bd0e74782611058613080565b604051611066929190614dfe565b60405180910390a150505050565b60008060050160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60009392505050565b336111276002808111156110c3576110c2614b52565b5b6110cc83611e7c565b60028111156110de576110dd614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f7220666c75696400000000000000000000000000613088565b61113033613107565b600061113b33611cb4565b61114433611d6f565b8461114f91906150b3565b61115991906150f5565b9050611165338261316d565b61116e8161322b565b611178338461324e565b3373ffffffffffffffffffffffffffffffffffffffff167f93530ac0ee8c50e696e13c5ac62355d0c0ba4bd943620d5bda1eb08b64ae751260016111ba611e30565b6111c49190615126565b85846040516111d59392919061515a565b60405180910390a2505050565b60006112136111ef613372565b6040518060200160405280611202611696565b81525061339690919063ffffffff16565b60000151905090565b336112986001600281111561123457611233614b52565b5b61123d83611e7c565b600281111561124f5761124e614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f72206c6f636b6564000000000000000000000000613088565b6112a0612ef8565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b81526004016112da929190615191565b6020604051808303816000875af11580156112f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131d91906151e6565b5061132833836133cf565b3373ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405161136e919061477c565b60405180910390a25050565b60006012905090565b600073271682deb8c4e0901d1a1550ad2e64d568e69909905090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050919050565b6000806008016000838152602001908152602001600020600101549050919050565b61146261141b82611759565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f74206e6f6d696e6174656400000000000000000000000000000000000000613088565b6000600161146f83610d53565b61147884612eaa565b6114829190615126565b61148c9190615213565b90506114e28161149a611e30565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420656e6465640000000000000000000000000000000000000000000000613088565b6115556114ed61348d565b6001836114fa9190615126565b6115049190615126565b61150c611e30565b11157f476f7665726e00000000000000000000000000000000000000000000000000007f4578706972656400000000000000000000000000000000000000000000000000613088565b6115d261158b611563613496565b61157d61156f866120cd565b61157886612fe9565b6134ba565b6134eb90919063ffffffff16565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4d75737420686176652071756f726f6d00000000000000000000000000000000613088565b61162f6115de8361139f565b6115e784611c2c565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420617070726f7665640000000000000000000000000000000000000000613088565b61163882613502565b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f815ca4497ab9fc80c76f210e6e842a5e198e195aa136034557eee144f790e7bb60405160405180910390a35050565b6000806116a1611c7a565b6116a9611866565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116e19190614abb565b602060405180830381865afa1580156116fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117229190614f80565b61172c9190615213565b9050611736613686565b61173e613686565b8261174991906150f5565b61175391906150b3565b91505090565b6000806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154119050919050565b6000806008016000838152602001908152602001600020600101549050919050565b60006117d661190e565b6117de612ef8565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016118169190614abb565b602060405180830381865afa158015611833573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118579190614f80565b6118619190615213565b905090565b600061187061368f565b905090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60006119186125d1565b61192061192f565b61192a9190615126565b905090565b60008060010160010154905090565b61199161194a82611759565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f74206e6f6d696e6174656400000000000000000000000000000000000000613088565b6119fe61199c6136ab565b6119a4611e30565b6119ae9190615126565b6119b6611b3d565b117f476f7665726e00000000000000000000000000000000000000000000000000007f45706f63682073796e6365640000000000000000000000000000000000000000613088565b611a7a611a33611a0c6136b4565b611a25611a1885611c2c565b611a20610da1565b6134ba565b6134eb90919063ffffffff16565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4d7573742068617665207375706572206d616a6f726974790000000000000000613088565b611ad7611a868261139f565b611a8f83611c2c565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420617070726f7665640000000000000000000000000000000000000000613088565b611ae081613502565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f815ca4497ab9fc80c76f210e6e842a5e198e195aa136034557eee144f790e7bb60405160405180910390a350565b600080611b486136d8565b90508060200151611b57613080565b1015611b67576000915050611ba0565b806000015181604001518260200151611b7e613080565b611b889190615213565b611b9291906150f5565b611b9c9190615126565b9150505b90565b60008060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b6000610378905090565b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b9050805491505090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b60008060010160030154905090565b60007f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef60001b905090565b60008060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b611d5d611d15611d10611bfb565b6129ab565b157f5065726d697373696f6e000000000000000000000000000000000000000000007f416c726561647920696e697469616c697a656400000000000000000000000000613088565b611d6d611d68611bfb565b613708565b565b600080611d7a610da1565b905060008103611d8e576000915050611db8565b80611d9884611cb4565b611da061192f565b611daa91906150b3565b611db491906150f5565b9150505b919050565b6000806008016000838152602001908152602001600020600201805490509050919050565b60008060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b60008060000160000154905090565b60606040518060400160405280600481526020017f7338383800000000000000000000000000000000000000000000000000000000815250905090565b6000611e86611e30565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541115611edb5760029050611f3c565b600060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154611f29611e30565b1015611f36576001611f39565b60005b90505b919050565b33611fbc600280811115611f5857611f57614b52565b5b611f6183611e7c565b6002811115611f7357611f72614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f7220666c75696400000000000000000000000000613088565b600080611fc761192f565b14611ff657611fd461192f565b611fdc610da1565b84611fe791906150b3565b611ff191906150f5565b61200a565b611ffe613769565b8361200991906150b3565b5b90506120163382613772565b61201f83613896565b61202933846133cf565b3373ffffffffffffffffffffffffffffffffffffffff167f44002fdef5a0c2d2e4e05572e9780b95aef97e0e93ffd7cc076b09fa78ff2b46600161206b611e30565b6120759190615126565b83866040516120869392919061515a565b60405180910390a2505050565b60006120c46120a0613372565b60405180602001604052806120b36117cc565b81525061339690919063ffffffff16565b60000151905090565b60006120d88261139f565b6120e183611c2c565b6120eb9190615126565b9050919050565b600092915050565b612102612ef8565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b815260040161213e93929190615247565b6020604051808303816000875af115801561215d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218191906151e6565b5061218c338261316d565b3373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c826040516121d2919061477c565b60405180910390a250565b33612259600160028111156121f5576121f4614b52565b5b6121fe83611e7c565b60028111156122105761220f614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f72206c6f636b6564000000000000000000000000613088565b6122af600061226733611cb4565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4d7573742068617665207374616b650000000000000000000000000000000000613088565b6122b883611759565b6123955761230f6122c8336138b9565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420656e6f756768207374616b6520746f2070726f706f73650000000000613088565b6123208361231b613912565b61391b565b612328611e30565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fd15e38a680a427478883cd2d32eb664cb6bb2090b0126a23ebaf3e3784b8c56b61237f613912565b60405161238c919061477c565b60405180910390a45b6124046123a184610d53565b6123aa85612eaa565b6123b49190615126565b6123bc611e30565b107f476f7665726e00000000000000000000000000000000000000000000000000007f456e646564000000000000000000000000000000000000000000000000000000613088565b600061240f33611cb4565b9050600061241d3386611875565b905080600281111561243257612431614b52565b5b84600281111561244557612444614b52565b5b036124515750506125aa565b60028081111561246457612463614b52565b5b81600281111561247757612476614b52565b5b036124875761248685836139ba565b5b6001600281111561249b5761249a614b52565b5b8160028111156124ae576124ad614b52565b5b036124be576124bd8583613a58565b5b6002808111156124d1576124d0614b52565b5b8460028111156124e4576124e3614b52565b5b036124f4576124f38583613af6565b5b6001600281111561250857612507614b52565b5b84600281111561251b5761251a614b52565b5b0361252b5761252a8583613b94565b5b612536338686613c32565b6125403386613ce1565b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fbe50c78cbc15b0864819aadea36c6499da421b33c38e2ef19bebda583c708c78868560405161259f92919061527e565b60405180910390a350505b505050565b6000806008016000838152602001908152602001600020600501549050919050565b60008060010160020154905090565b6000806125eb611074565b73ffffffffffffffffffffffffffffffffffffffff1662fdd58e3361260e611e30565b6040518363ffffffff1660e01b815260040161262b929190615191565b602060405180830381865afa158015612648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266c9190614f80565b146126ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126a390615319565b60405180910390fd5b6000670de0b6b3a76400006126c033611d6f565b6126ca91906150f5565b905060006126d6611074565b73ffffffffffffffffffffffffffffffffffffffff1662fdd58e336126f9611e30565b6040518363ffffffff1660e01b8152600401612716929190615191565b602060405180830381865afa158015612733573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127579190614f80565b14612797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161278e906153ab565b60405180910390fd5b60006127a1611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b0396127c4611e30565b6040518263ffffffff1660e01b81526004016127e0919061477c565b602060405180830381865afa1580156127fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128219190614f80565b905061282b611074565b73ffffffffffffffffffffffffffffffffffffffff1663156e29f63361284f611e30565b856040518463ffffffff1660e01b815260040161286e939291906153cb565b600060405180830381600087803b15801561288857600080fd5b505af115801561289c573d6000803e3d6000fd5b5050505060006128aa611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b0396128cd611e30565b6040518263ffffffff1660e01b81526004016128e9919061477c565b602060405180830381865afa158015612906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292a9190614f80565b905061294b33612938611e30565b846001856129469190615213565b613da3565b3373ffffffffffffffffffffffffffffffffffffffff167f47077b9c55ea85476c20e80bb7b9315ff5e80e0354086bd502bfda0fa91ba7aa61298b611e30565b8560405161299a929190614dfe565b60405180910390a282935050505090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160009054906101000a900460ff169050919050565b6000801515612a158333610db0565b151514612a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4e9061544e565b60405180910390fd5b612a6082610cfd565b612a9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a96906154e0565b60405180910390fd5b600080612aac3385612f27565b915091506000612abb85612e24565b9050600080600090505b8251811015612b3a5784838281518110612ae257612ae1614fad565b5b602002602001015110158015612b12575083838281518110612b0757612b06614fad565b5b602002602001015111155b15612b2757600182612b249190615126565b91505b8080612b329061506b565b915050612ac5565b5060008111612b7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b759061554c565b60405180910390fd5b612b8a86336001613e65565b6000612b95876117aa565b82612ba091906150b3565b9050612bab81613ed8565b612bb3611866565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401612bed929190615191565b6020604051808303816000875af1158015612c0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3091906151e6565b503373ffffffffffffffffffffffffffffffffffffffff167f256642a903d86ec186d0ad895b74bdbe7f9e5a72db568f4c4d58c2fa38b39e1c8883604051612c79929190614dfe565b60405180910390a28095505050505050919050565b600092915050565b33612d11600280811115612cad57612cac614b52565b5b612cb683611e7c565b6002811115612cc857612cc7614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f7220666c75696400000000000000000000000000613088565b612d1a33613107565b6000612d2461192f565b612d2c610da1565b84612d3791906150b3565b612d4191906150f5565b9050612d4d338461316d565b612d568361322b565b612d60338261324e565b3373ffffffffffffffffffffffffffffffffffffffff167f93530ac0ee8c50e696e13c5ac62355d0c0ba4bd943620d5bda1eb08b64ae75126001612da2611e30565b612dac9190615126565b8386604051612dbd9392919061515a565b60405180910390a2505050565b612dd2613efb565b612dda6140f9565b612de2611e30565b7fc30b728d1c19e5db3678b8ea9e9a063a5655071e1a325c2f7fdbca48baa9060043612e0c613080565b604051612e1a929190614dfe565b60405180910390a2565b606060006008016000838152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015612e8957602002820191906000526020600020905b815481526020019060010190808311612e75575b50505050509050919050565b612e9e816120fa565b612ea781611f41565b50565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b60008060050160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806000600801600084815260200190815260200160002060030160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546000600801600085815260200190815260200160002060030160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154915091509250929050565b6000806008016000838152602001908152602001600020600001549050919050565b8060006008016000858152602001908152602001600020600201838154811061303757613036614fad565b5b9060005260206000200181905550505050565b60016000600801600084815260200190815260200160002060060160006101000a81548160ff0219169083151502179055505050565b600042905090565b826131025761309682614166565b613a2060f01b6130a583614166565b6040516020016130b793929190615600565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130f99190614600565b60405180910390fd5b505050565b61310f614270565b613117611e30565b6131219190615126565b600060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555050565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546131be9190615126565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055508060006001016002015461321b9190615126565b6000600101600201819055505050565b8060006001016001015461323f9190615213565b60006001016001018190555050565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461329f9190615213565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550806000600101600001546132fc9190615213565b600060010160000181905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051613366919061477c565b60405180910390a35050565b61337a6144d2565b604051806020016040528067016345785d8a0000815250905090565b61339e6144d2565b60405180602001604052806133c485600001518560000151670de0b6b3a7640000614279565b815250905092915050565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546134209190615213565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055508060006001016002015461347d9190615213565b6000600101600201819055505050565b60006002905090565b61349e6144d2565b60405180602001604052806703782dace9d90000815250905090565b6134c26144d2565b60405180602001604052806134e085670de0b6b3a764000086614279565b815250905092915050565b600060026134f9848461429b565b14905092915050565b61350b816142da565b6000808273ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f8129fc1c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516135b59190615635565b600060405180830381855af49150503d80600081146135f0576040519150601f19603f3d011682016040523d82523d6000602084013e6135f5565b606091505b509150915081819061363d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136349190614600565b60405180910390fd5b508273ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a2505050565b60006003905090565b600073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48905090565b60006003905090565b6136bc6144d2565b604051806020016040528067058d15e176280000815250905090565b6136e06144e5565b604051806060016040528060018152602001636585a470815260200162015180815250905090565b60016000600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160006101000a81548160ff02191690831515021790555050565b60006001905090565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546137c39190615126565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550806000600101600001546138209190615126565b6000600101600001819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161388a919061477c565b60405180910390a35050565b806000600101600101546138aa9190615126565b60006001016001018190555050565b6000806138c461192f565b036138d2576000905061390d565b60006138ed6138e084611cb4565b6138e8610da1565b6134ba565b90506139096138fa614351565b826134eb90919063ffffffff16565b9150505b919050565b60006003905090565b613923611e30565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154613a0b9190615213565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154613aa99190615213565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154613b479190615126565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154613be59190615126565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690836002811115613cd757613cd6614b52565b5b0217905550505050565b60008060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015490506000613d3583610d53565b613d3e84612eaa565b613d489190615126565b905081811115613d9d5780600060070160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b50505050565b816000600801600085815260200190815260200160002060030160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550806000600801600085815260200190815260200160002060030160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555050505050565b806000600801600085815260200190815260200160002060040160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505050565b80600060010160030154613eec9190615213565b60006001016003018190555050565b6000613f05612093565b9050613f1081613896565b6000613f1a6111e2565b9050613f2581614374565b613f48613f30611e30565b613f38613686565b83613f4391906150f5565b614397565b613f60613f53611e30565b613f5b613686565b6143b9565b6000613f6a611383565b73ffffffffffffffffffffffffffffffffffffffff16635d3b1d30613f8d611c89565b613f95611bf1565b6003620f4240613fa3613686565b6040518663ffffffff1660e01b8152600401613fc39594939291906156ef565b6020604051808303816000875af1158015613fe2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140069190614f80565b9050614019614013611e30565b82614433565b7fd722c1abea91ee750cbe97ef43e859927b34e8ef0620e511b3c37e4c1f4f157c614042611e30565b61404a613080565b614052611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b039614075611e30565b6040518263ffffffff1660e01b8152600401614091919061477c565b602060405180830381865afa1580156140ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140d29190614f80565b856140db613686565b6040516140ec959493929190615742565b60405180910390a1505050565b614154614104611e30565b61410c611b3d565b117f426f6e64696e67000000000000000000000000000000000000000000000000007f5374696c6c2063757272656e742065706f636800000000000000000000000000613088565b61415c614470565b61416461449e565b565b606060008260405160200161417b91906157b6565b60405160208183030381529060405290506000602090505b60008111156142185780806141a7906157d1565b915050600060f81b8282815181106141c2576141c1614fad565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146142135760006001826142039190615126565b905080835282935050505061426b565b614193565b50600067ffffffffffffffff81111561423457614233614809565b5b6040519080825280601f01601f1916602001820160405280156142665781602001600182028036833780820191505090505b509150505b919050565b60006002905090565b600081838561428891906150b3565b61429291906150f5565b90509392505050565b600081600001518360000151036142b557600190506142d4565b81600001518360000151116142cb5760006142ce565b60025b60ff1690505b92915050565b6142e3816144bf565b614322576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016143199061586c565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508181555050565b6143596144d2565b604051806020016040528066354a6ba7a18000815250905090565b806000600101600301546143889190615126565b60006001016003018190555050565b8060006008016000848152602001908152602001600020600101819055505050565b8067ffffffffffffffff8111156143d3576143d2614809565b5b6040519080825280602002602001820160405280156144015781602001602082028036833780820191505090505b5060006008016000848152602001908152602001600020600201908051906020019061442e929190614506565b505050565b8060006008016000848152602001908152602001600020600501819055508160006009016000838152602001908152602001600020819055505050565b61447861192f565b60006008016000614487611e30565b815260200190815260200160002060000181905550565b600160008001600001546144b29190615126565b6000800160000181905550565b600080823b905060008111915050919050565b6040518060200160405280600081525090565b60405180606001604052806000815260200160008152602001600081525090565b828054828255906000526020600020908101928215614542579160200282015b82811115614541578251825591602001919060010190614526565b5b50905061454f9190614553565b5090565b5b8082111561456c576000816000905550600101614554565b5090565b600081519050919050565b600082825260208201905092915050565b60005b838110156145aa57808201518184015260208101905061458f565b60008484015250505050565b6000601f19601f8301169050919050565b60006145d282614570565b6145dc818561457b565b93506145ec81856020860161458c565b6145f5816145b6565b840191505092915050565b6000602082019050818103600083015261461a81846145c7565b905092915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61464981614636565b811461465457600080fd5b50565b60008135905061466681614640565b92915050565b6000602082840312156146825761468161462c565b5b600061469084828501614657565b91505092915050565b60008115159050919050565b6146ae81614699565b82525050565b60006020820190506146c960008301846146a5565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006146fa826146cf565b9050919050565b61470a816146ef565b811461471557600080fd5b50565b60008135905061472781614701565b92915050565b600080604083850312156147445761474361462c565b5b600061475285828601614718565b925050602061476385828601614657565b9150509250929050565b61477681614636565b82525050565b6000602082019050614791600083018461476d565b92915050565b6000602082840312156147ad576147ac61462c565b5b60006147bb84828501614718565b91505092915050565b600080604083850312156147db576147da61462c565b5b60006147e985828601614657565b92505060206147fa85828601614718565b9150509250929050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b614841826145b6565b810181811067ffffffffffffffff821117156148605761485f614809565b5b80604052505050565b6000614873614622565b905061487f8282614838565b919050565b600067ffffffffffffffff82111561489f5761489e614809565b5b602082029050602081019050919050565b600080fd5b60006148c86148c384614884565b614869565b905080838252602082019050602084028301858111156148eb576148ea6148b0565b5b835b8181101561491457806149008882614657565b8452602084019350506020810190506148ed565b5050509392505050565b600082601f83011261493357614932614804565b5b81356149438482602086016148b5565b91505092915050565b600080604083850312156149635761496261462c565b5b600061497185828601614657565b925050602083013567ffffffffffffffff81111561499257614991614631565b5b61499e8582860161491e565b9150509250929050565b6000819050919050565b60006149cd6149c86149c3846146cf565b6149a8565b6146cf565b9050919050565b60006149df826149b2565b9050919050565b60006149f1826149d4565b9050919050565b614a01816149e6565b82525050565b6000602082019050614a1c60008301846149f8565b92915050565b600080600060608486031215614a3b57614a3a61462c565b5b6000614a4986828701614718565b9350506020614a5a86828701614718565b9250506040614a6b86828701614657565b9150509250925092565b600060ff82169050919050565b614a8b81614a75565b82525050565b6000602082019050614aa66000830184614a82565b92915050565b614ab5816146ef565b82525050565b6000602082019050614ad06000830184614aac565b92915050565b6000614ae1826149d4565b9050919050565b614af181614ad6565b82525050565b6000602082019050614b0c6000830184614ae8565b92915050565b60008060408385031215614b2957614b2861462c565b5b6000614b3785828601614718565b9250506020614b4885828601614718565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110614b9257614b91614b52565b5b50565b6000819050614ba382614b81565b919050565b6000614bb382614b95565b9050919050565b614bc381614ba8565b82525050565b6000602082019050614bde6000830184614bba565b92915050565b600067ffffffffffffffff82169050919050565b614c0181614be4565b82525050565b6000602082019050614c1c6000830184614bf8565b92915050565b6000819050919050565b614c3581614c22565b82525050565b6000602082019050614c506000830184614c2c565b92915050565b60038110614c6757614c66614b52565b5b50565b6000819050614c7882614c56565b919050565b6000614c8882614c6a565b9050919050565b614c9881614c7d565b82525050565b6000602082019050614cb36000830184614c8f565b92915050565b60038110614cc657600080fd5b50565b600081359050614cd881614cb9565b92915050565b60008060408385031215614cf557614cf461462c565b5b6000614d0385828601614718565b9250506020614d1485828601614cc9565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b614d5381614636565b82525050565b6000614d658383614d4a565b60208301905092915050565b6000602082019050919050565b6000614d8982614d1e565b614d938185614d29565b9350614d9e83614d3a565b8060005b83811015614dcf578151614db68882614d59565b9750614dc183614d71565b925050600181019050614da2565b5085935050505092915050565b60006020820190508181036000830152614df68184614d7e565b905092915050565b6000604082019050614e13600083018561476d565b614e20602083018461476d565b9392505050565b7f6f6e6c792056524620436f6f7264696e61746f722063616e2066756c66696c6c600082015250565b6000614e5d60208361457b565b9150614e6882614e27565b602082019050919050565b60006020820190508181036000830152614e8c81614e50565b9050919050565b7f696e76616c69642065706f636800000000000000000000000000000000000000600082015250565b6000614ec9600d8361457b565b9150614ed482614e93565b602082019050919050565b60006020820190508181036000830152614ef881614ebc565b9050919050565b7f6472617720616c72656164792065786563757465640000000000000000000000600082015250565b6000614f3560158361457b565b9150614f4082614eff565b602082019050919050565b60006020820190508181036000830152614f6481614f28565b9050919050565b600081519050614f7a81614640565b92915050565b600060208284031215614f9657614f9561462c565b5b6000614fa484828501614f6b565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061501682614636565b915061502183614636565b92508261503157615030614fdc565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061507682614636565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036150a8576150a761503c565b5b600182019050919050565b60006150be82614636565b91506150c983614636565b92508282026150d781614636565b915082820484148315176150ee576150ed61503c565b5b5092915050565b600061510082614636565b915061510b83614636565b92508261511b5761511a614fdc565b5b828204905092915050565b600061513182614636565b915061513c83614636565b92508282019050808211156151545761515361503c565b5b92915050565b600060608201905061516f600083018661476d565b61517c602083018561476d565b615189604083018461476d565b949350505050565b60006040820190506151a66000830185614aac565b6151b3602083018461476d565b9392505050565b6151c381614699565b81146151ce57600080fd5b50565b6000815190506151e0816151ba565b92915050565b6000602082840312156151fc576151fb61462c565b5b600061520a848285016151d1565b91505092915050565b600061521e82614636565b915061522983614636565b92508282039050818111156152415761524061503c565b5b92915050565b600060608201905061525c6000830186614aac565b6152696020830185614aac565b615276604083018461476d565b949350505050565b60006040820190506152936000830185614bba565b6152a0602083018461476d565b9392505050565b7f4c6f74746572793a20616c7265616479206d696e746564207469636b6574732060008201527f666f7220746869732065706f6368000000000000000000000000000000000000602082015250565b6000615303602e8361457b565b915061530e826152a7565b604082019050919050565b60006020820190508181036000830152615332816152f6565b9050919050565b7f4c6f74746572793a204e6f7420656e6f75676820626f6e6465642062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b600061539560228361457b565b91506153a082615339565b604082019050919050565b600060208201905081810360008301526153c481615388565b9050919050565b60006060820190506153e06000830186614aac565b6153ed602083018561476d565b6153fa604083018461476d565b949350505050565b7f4c6f74746572793a205072697a6520616c726561647920636c61696d65640000600082015250565b6000615438601e8361457b565b915061544382615402565b602082019050919050565b600060208201905081810360008301526154678161542b565b9050919050565b7f4c6f74746572793a2044726177206e6f7420796574207265736f6c766564206260008201527f7920636861696e6c696e6b207672660000000000000000000000000000000000602082015250565b60006154ca602f8361457b565b91506154d58261546e565b604082019050919050565b600060208201905081810360008301526154f9816154bd565b9050919050565b7f4c6f74746572793a206e6f2077696e6e696e67207469636b6574730000000000600082015250565b6000615536601b8361457b565b915061554182615500565b602082019050919050565b6000602082019050818103600083015261556581615529565b9050919050565b600081519050919050565b600081905092915050565b600061558d8261556c565b6155978185615577565b93506155a781856020860161458c565b80840191505092915050565b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b6000819050919050565b6155fa6155f5826155b3565b6155df565b82525050565b600061560c8286615582565b915061561882856155e9565b6002820191506156288284615582565b9150819050949350505050565b60006156418284615582565b915081905092915050565b6000819050919050565b600061ffff82169050919050565b600061567f61567a6156758461564c565b6149a8565b615656565b9050919050565b61568f81615664565b82525050565b6000819050919050565b600063ffffffff82169050919050565b60006156ca6156c56156c084615695565b6149a8565b61569f565b9050919050565b6156da816156af565b82525050565b6156e98161569f565b82525050565b600060a0820190506157046000830188614c2c565b6157116020830187614bf8565b61571e6040830186615686565b61572b60608301856156d1565b61573860808301846156e0565b9695505050505050565b600060a082019050615757600083018861476d565b615764602083018761476d565b615771604083018661476d565b61577e606083018561476d565b61578b608083018461476d565b9695505050505050565b6000819050919050565b6157b06157ab82614c22565b615795565b82525050565b60006157c2828461579f565b60208201915081905092915050565b60006157dc82614636565b9150600082036157ef576157ee61503c565b5b600182039050919050565b7f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f60008201527f6e20746f2061206e6f6e2d636f6e747261637420616464726573730000000000602082015250565b6000615856603b8361457b565b9150615861826157fa565b604082019050919050565b6000602082019050818103600083015261588581615849565b905091905056fea2646970667358221220ea1b07192f4928166989d71a34f8a4ea4a03c488c6d73ddaa35e20b3cd70d07364736f6c63430008140033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103ba5760003560e01c806364668022116101f4578063b6b55f251161011a578063df9a2b1c116100ad578063f1b7cf491161007c578063f1b7cf4914610c11578063fc0c546a14610c41578063ff2d2abb14610c5f578063ffbe3b7314610c90576103ba565b8063df9a2b1c14610b9f578063ea105ac714610bbb578063ed6c793114610bc5578063f05f88e014610bf5576103ba565b8063d2e2a975116100e9578063d2e2a97514610af1578063d60b347f14610b0f578063d709815414610b3f578063dd62ed3e14610b6f576103ba565b8063b6b55f2514610a6b578063bceb514d14610a87578063c7964b4d14610aa3578063cf02377914610ad3576103ba565b806386cf9f14116101925780639940686e116101615780639940686e146109d1578063a117b350146109ed578063a50cd8e714610a0b578063a9059cbb14610a3b576103ba565b806386cf9f1414610935578063900cf0cf1461096557806395d89b411461098357806397a5d5b5146109a1576103ba565b806370a08231116101ce57806370a082311461089b5780638129fc1c146108cb578063825ad607146108d5578063833f65ab14610905576103ba565b8063646680221461082f57806369c61d0b1461085f5780636c6861911461087d576103ba565b8063353a420c116102e45780633fbba9a6116102775780635053e461116102465780635053e461146107a557806351bf21d8146107c357806355802803146107f35780635c60da1b14610811576103ba565b80633fbba9a61461071d57806342b70aed1461074d57806344d96e951461076b57806347c0506914610789576103ba565b80633a3e6c81116102b35780633a3e6c81146106815780633d68ec02146106b15780633de3fbd9146106e15780633e413bee146106ff576103ba565b8063353a420c146105e75780633600da8214610617578063369e8c1d14610647578063398ab9a714610663576103ba565b80631fe543e31161035c5780632b59dd851161032b5780632b59dd85146105715780632e1a7d4d1461058f578063313ce567146105ab57806333b60863146105c9576103ba565b80631fe543e3146104eb578063218585211461050757806323b872dd1461052557806327de9e3214610555576103ba565b80630d673c91116103985780630d673c911461043d57806315e14bf61461046d57806318160ddd1461049d5780631fce0812146104bb576103ba565b806306fdde03146103bf578063071b197e146103dd578063095ea7b31461040d575b600080fd5b6103c7610cc0565b6040516103d49190614600565b60405180910390f35b6103f760048036038101906103f2919061466c565b610cfd565b60405161040491906146b4565b60405180910390f35b6104276004803603810190610422919061472d565b610d2c565b60405161043491906146b4565b60405180910390f35b6104576004803603810190610452919061466c565b610d34565b604051610464919061477c565b60405180910390f35b61048760048036038101906104829190614797565b610d53565b604051610494919061477c565b60405180910390f35b6104a5610da1565b6040516104b2919061477c565b60405180910390f35b6104d560048036038101906104d091906147c4565b610db0565b6040516104e291906146b4565b60405180910390f35b6105056004803603810190610500919061494c565b610e1d565b005b61050f611074565b60405161051c9190614a07565b60405180910390f35b61053f600480360381019061053a9190614a22565b6110a3565b60405161054c91906146b4565b60405180910390f35b61056f600480360381019061056a919061466c565b6110ac565b005b6105796111e2565b604051610586919061477c565b60405180910390f35b6105a960048036038101906105a4919061466c565b61121c565b005b6105b361137a565b6040516105c09190614a91565b60405180910390f35b6105d1611383565b6040516105de9190614abb565b60405180910390f35b61060160048036038101906105fc9190614797565b61139f565b60405161060e919061477c565b60405180910390f35b610631600480360381019061062c919061466c565b6113ed565b60405161063e919061477c565b60405180910390f35b610661600480360381019061065c9190614797565b61140f565b005b61066b611696565b604051610678919061477c565b60405180910390f35b61069b60048036038101906106969190614797565b611759565b6040516106a891906146b4565b60405180910390f35b6106cb60048036038101906106c6919061466c565b6117aa565b6040516106d8919061477c565b60405180910390f35b6106e96117cc565b6040516106f6919061477c565b60405180910390f35b610707611866565b6040516107149190614af7565b60405180910390f35b61073760048036038101906107329190614b12565b611875565b6040516107449190614bc9565b60405180910390f35b61075561190e565b604051610762919061477c565b60405180910390f35b61077361192f565b604051610780919061477c565b60405180910390f35b6107a3600480360381019061079e9190614797565b61193e565b005b6107ad611b3d565b6040516107ba919061477c565b60405180910390f35b6107dd60048036038101906107d89190614797565b611ba3565b6040516107ea919061477c565b60405180910390f35b6107fb611bf1565b6040516108089190614c07565b60405180910390f35b610819611bfb565b6040516108269190614abb565b60405180910390f35b61084960048036038101906108449190614797565b611c2c565b604051610856919061477c565b60405180910390f35b610867611c7a565b604051610874919061477c565b60405180910390f35b610885611c89565b6040516108929190614c3b565b60405180910390f35b6108b560048036038101906108b09190614797565b611cb4565b6040516108c2919061477c565b60405180910390f35b6108d3611d02565b005b6108ef60048036038101906108ea9190614797565b611d6f565b6040516108fc919061477c565b60405180910390f35b61091f600480360381019061091a919061466c565b611dbd565b60405161092c919061477c565b60405180910390f35b61094f600480360381019061094a9190614797565b611de2565b60405161095c919061477c565b60405180910390f35b61096d611e30565b60405161097a919061477c565b60405180910390f35b61098b611e3f565b6040516109989190614600565b60405180910390f35b6109bb60048036038101906109b69190614797565b611e7c565b6040516109c89190614c9e565b60405180910390f35b6109eb60048036038101906109e6919061466c565b611f41565b005b6109f5612093565b604051610a02919061477c565b60405180910390f35b610a256004803603810190610a209190614797565b6120cd565b604051610a32919061477c565b60405180910390f35b610a556004803603810190610a50919061472d565b6120f2565b604051610a6291906146b4565b60405180910390f35b610a856004803603810190610a80919061466c565b6120fa565b005b610aa16004803603810190610a9c9190614cde565b6121dd565b005b610abd6004803603810190610ab8919061466c565b6125af565b604051610aca919061477c565b60405180910390f35b610adb6125d1565b604051610ae8919061477c565b60405180910390f35b610af96125e0565b604051610b06919061477c565b60405180910390f35b610b296004803603810190610b249190614797565b6129ab565b604051610b3691906146b4565b60405180910390f35b610b596004803603810190610b54919061466c565b612a06565b604051610b66919061477c565b60405180910390f35b610b896004803603810190610b849190614b12565b612c8e565b604051610b96919061477c565b60405180910390f35b610bb96004803603810190610bb4919061466c565b612c96565b005b610bc3612dca565b005b610bdf6004803603810190610bda919061466c565b612e24565b604051610bec9190614ddc565b60405180910390f35b610c0f6004803603810190610c0a919061466c565b612e95565b005b610c2b6004803603810190610c269190614797565b612eaa565b604051610c38919061477c565b60405180910390f35b610c49612ef8565b604051610c569190614af7565b60405180910390f35b610c796004803603810190610c74919061472d565b612f27565b604051610c87929190614dfe565b60405180910390f35b610caa6004803603810190610ca5919061466c565b612fe9565b604051610cb7919061477c565b60405180910390f35b60606040518060400160405280601481526020017f4c75636b7938205374616b656420546f6b656e73000000000000000000000000815250905090565b600080600801600083815260200190815260200160002060060160009054906101000a900460ff169050919050565b600092915050565b6000806009016000838152602001908152602001600020549050919050565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b60008060010160000154905090565b600080600801600084815260200190815260200160002060040160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610e25611383565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8990614e73565b60405180910390fd5b6000610e9d83610d34565b905082610ea9826125af565b14610ee9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee090614edf565b60405180910390fd5b60001515610ef682610cfd565b151514610f38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2f90614f4b565b60405180910390fd5b610f4181612e24565b51825114610f4e57600080fd5b6000610f58611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b039836040518263ffffffff1660e01b8152600401610f90919061477c565b602060405180830381865afa158015610fad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd19190614f80565b905060005b83518110156110225761100f838284878581518110610ff857610ff7614fad565b5b602002602001015161100a919061500b565b61300b565b808061101a9061506b565b915050610fd6565b5061102e82600161304a565b7f60d2a26be72e20dd7fb9bd580d3e6af0888043986cfc368ac2cdf2229bd0e74782611058613080565b604051611066929190614dfe565b60405180910390a150505050565b60008060050160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60009392505050565b336111276002808111156110c3576110c2614b52565b5b6110cc83611e7c565b60028111156110de576110dd614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f7220666c75696400000000000000000000000000613088565b61113033613107565b600061113b33611cb4565b61114433611d6f565b8461114f91906150b3565b61115991906150f5565b9050611165338261316d565b61116e8161322b565b611178338461324e565b3373ffffffffffffffffffffffffffffffffffffffff167f93530ac0ee8c50e696e13c5ac62355d0c0ba4bd943620d5bda1eb08b64ae751260016111ba611e30565b6111c49190615126565b85846040516111d59392919061515a565b60405180910390a2505050565b60006112136111ef613372565b6040518060200160405280611202611696565b81525061339690919063ffffffff16565b60000151905090565b336112986001600281111561123457611233614b52565b5b61123d83611e7c565b600281111561124f5761124e614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f72206c6f636b6564000000000000000000000000613088565b6112a0612ef8565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b81526004016112da929190615191565b6020604051808303816000875af11580156112f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131d91906151e6565b5061132833836133cf565b3373ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405161136e919061477c565b60405180910390a25050565b60006012905090565b600073271682deb8c4e0901d1a1550ad2e64d568e69909905090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050919050565b6000806008016000838152602001908152602001600020600101549050919050565b61146261141b82611759565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f74206e6f6d696e6174656400000000000000000000000000000000000000613088565b6000600161146f83610d53565b61147884612eaa565b6114829190615126565b61148c9190615213565b90506114e28161149a611e30565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420656e6465640000000000000000000000000000000000000000000000613088565b6115556114ed61348d565b6001836114fa9190615126565b6115049190615126565b61150c611e30565b11157f476f7665726e00000000000000000000000000000000000000000000000000007f4578706972656400000000000000000000000000000000000000000000000000613088565b6115d261158b611563613496565b61157d61156f866120cd565b61157886612fe9565b6134ba565b6134eb90919063ffffffff16565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4d75737420686176652071756f726f6d00000000000000000000000000000000613088565b61162f6115de8361139f565b6115e784611c2c565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420617070726f7665640000000000000000000000000000000000000000613088565b61163882613502565b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f815ca4497ab9fc80c76f210e6e842a5e198e195aa136034557eee144f790e7bb60405160405180910390a35050565b6000806116a1611c7a565b6116a9611866565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116e19190614abb565b602060405180830381865afa1580156116fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117229190614f80565b61172c9190615213565b9050611736613686565b61173e613686565b8261174991906150f5565b61175391906150b3565b91505090565b6000806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154119050919050565b6000806008016000838152602001908152602001600020600101549050919050565b60006117d661190e565b6117de612ef8565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016118169190614abb565b602060405180830381865afa158015611833573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118579190614f80565b6118619190615213565b905090565b600061187061368f565b905090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60006119186125d1565b61192061192f565b61192a9190615126565b905090565b60008060010160010154905090565b61199161194a82611759565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f74206e6f6d696e6174656400000000000000000000000000000000000000613088565b6119fe61199c6136ab565b6119a4611e30565b6119ae9190615126565b6119b6611b3d565b117f476f7665726e00000000000000000000000000000000000000000000000000007f45706f63682073796e6365640000000000000000000000000000000000000000613088565b611a7a611a33611a0c6136b4565b611a25611a1885611c2c565b611a20610da1565b6134ba565b6134eb90919063ffffffff16565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4d7573742068617665207375706572206d616a6f726974790000000000000000613088565b611ad7611a868261139f565b611a8f83611c2c565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420617070726f7665640000000000000000000000000000000000000000613088565b611ae081613502565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f815ca4497ab9fc80c76f210e6e842a5e198e195aa136034557eee144f790e7bb60405160405180910390a350565b600080611b486136d8565b90508060200151611b57613080565b1015611b67576000915050611ba0565b806000015181604001518260200151611b7e613080565b611b889190615213565b611b9291906150f5565b611b9c9190615126565b9150505b90565b60008060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b6000610378905090565b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b9050805491505090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b60008060010160030154905090565b60007f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef60001b905090565b60008060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b611d5d611d15611d10611bfb565b6129ab565b157f5065726d697373696f6e000000000000000000000000000000000000000000007f416c726561647920696e697469616c697a656400000000000000000000000000613088565b611d6d611d68611bfb565b613708565b565b600080611d7a610da1565b905060008103611d8e576000915050611db8565b80611d9884611cb4565b611da061192f565b611daa91906150b3565b611db491906150f5565b9150505b919050565b6000806008016000838152602001908152602001600020600201805490509050919050565b60008060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b60008060000160000154905090565b60606040518060400160405280600481526020017f7338383800000000000000000000000000000000000000000000000000000000815250905090565b6000611e86611e30565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541115611edb5760029050611f3c565b600060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154611f29611e30565b1015611f36576001611f39565b60005b90505b919050565b33611fbc600280811115611f5857611f57614b52565b5b611f6183611e7c565b6002811115611f7357611f72614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f7220666c75696400000000000000000000000000613088565b600080611fc761192f565b14611ff657611fd461192f565b611fdc610da1565b84611fe791906150b3565b611ff191906150f5565b61200a565b611ffe613769565b8361200991906150b3565b5b90506120163382613772565b61201f83613896565b61202933846133cf565b3373ffffffffffffffffffffffffffffffffffffffff167f44002fdef5a0c2d2e4e05572e9780b95aef97e0e93ffd7cc076b09fa78ff2b46600161206b611e30565b6120759190615126565b83866040516120869392919061515a565b60405180910390a2505050565b60006120c46120a0613372565b60405180602001604052806120b36117cc565b81525061339690919063ffffffff16565b60000151905090565b60006120d88261139f565b6120e183611c2c565b6120eb9190615126565b9050919050565b600092915050565b612102612ef8565b73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b815260040161213e93929190615247565b6020604051808303816000875af115801561215d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218191906151e6565b5061218c338261316d565b3373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c826040516121d2919061477c565b60405180910390a250565b33612259600160028111156121f5576121f4614b52565b5b6121fe83611e7c565b60028111156122105761220f614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f72206c6f636b6564000000000000000000000000613088565b6122af600061226733611cb4565b117f476f7665726e00000000000000000000000000000000000000000000000000007f4d7573742068617665207374616b650000000000000000000000000000000000613088565b6122b883611759565b6123955761230f6122c8336138b9565b7f476f7665726e00000000000000000000000000000000000000000000000000007f4e6f7420656e6f756768207374616b6520746f2070726f706f73650000000000613088565b6123208361231b613912565b61391b565b612328611e30565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fd15e38a680a427478883cd2d32eb664cb6bb2090b0126a23ebaf3e3784b8c56b61237f613912565b60405161238c919061477c565b60405180910390a45b6124046123a184610d53565b6123aa85612eaa565b6123b49190615126565b6123bc611e30565b107f476f7665726e00000000000000000000000000000000000000000000000000007f456e646564000000000000000000000000000000000000000000000000000000613088565b600061240f33611cb4565b9050600061241d3386611875565b905080600281111561243257612431614b52565b5b84600281111561244557612444614b52565b5b036124515750506125aa565b60028081111561246457612463614b52565b5b81600281111561247757612476614b52565b5b036124875761248685836139ba565b5b6001600281111561249b5761249a614b52565b5b8160028111156124ae576124ad614b52565b5b036124be576124bd8583613a58565b5b6002808111156124d1576124d0614b52565b5b8460028111156124e4576124e3614b52565b5b036124f4576124f38583613af6565b5b6001600281111561250857612507614b52565b5b84600281111561251b5761251a614b52565b5b0361252b5761252a8583613b94565b5b612536338686613c32565b6125403386613ce1565b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fbe50c78cbc15b0864819aadea36c6499da421b33c38e2ef19bebda583c708c78868560405161259f92919061527e565b60405180910390a350505b505050565b6000806008016000838152602001908152602001600020600501549050919050565b60008060010160020154905090565b6000806125eb611074565b73ffffffffffffffffffffffffffffffffffffffff1662fdd58e3361260e611e30565b6040518363ffffffff1660e01b815260040161262b929190615191565b602060405180830381865afa158015612648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266c9190614f80565b146126ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126a390615319565b60405180910390fd5b6000670de0b6b3a76400006126c033611d6f565b6126ca91906150f5565b905060006126d6611074565b73ffffffffffffffffffffffffffffffffffffffff1662fdd58e336126f9611e30565b6040518363ffffffff1660e01b8152600401612716929190615191565b602060405180830381865afa158015612733573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127579190614f80565b14612797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161278e906153ab565b60405180910390fd5b60006127a1611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b0396127c4611e30565b6040518263ffffffff1660e01b81526004016127e0919061477c565b602060405180830381865afa1580156127fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128219190614f80565b905061282b611074565b73ffffffffffffffffffffffffffffffffffffffff1663156e29f63361284f611e30565b856040518463ffffffff1660e01b815260040161286e939291906153cb565b600060405180830381600087803b15801561288857600080fd5b505af115801561289c573d6000803e3d6000fd5b5050505060006128aa611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b0396128cd611e30565b6040518263ffffffff1660e01b81526004016128e9919061477c565b602060405180830381865afa158015612906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292a9190614f80565b905061294b33612938611e30565b846001856129469190615213565b613da3565b3373ffffffffffffffffffffffffffffffffffffffff167f47077b9c55ea85476c20e80bb7b9315ff5e80e0354086bd502bfda0fa91ba7aa61298b611e30565b8560405161299a929190614dfe565b60405180910390a282935050505090565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160009054906101000a900460ff169050919050565b6000801515612a158333610db0565b151514612a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4e9061544e565b60405180910390fd5b612a6082610cfd565b612a9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a96906154e0565b60405180910390fd5b600080612aac3385612f27565b915091506000612abb85612e24565b9050600080600090505b8251811015612b3a5784838281518110612ae257612ae1614fad565b5b602002602001015110158015612b12575083838281518110612b0757612b06614fad565b5b602002602001015111155b15612b2757600182612b249190615126565b91505b8080612b329061506b565b915050612ac5565b5060008111612b7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b759061554c565b60405180910390fd5b612b8a86336001613e65565b6000612b95876117aa565b82612ba091906150b3565b9050612bab81613ed8565b612bb3611866565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401612bed929190615191565b6020604051808303816000875af1158015612c0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3091906151e6565b503373ffffffffffffffffffffffffffffffffffffffff167f256642a903d86ec186d0ad895b74bdbe7f9e5a72db568f4c4d58c2fa38b39e1c8883604051612c79929190614dfe565b60405180910390a28095505050505050919050565b600092915050565b33612d11600280811115612cad57612cac614b52565b5b612cb683611e7c565b6002811115612cc857612cc7614b52565b5b14157f5065726d697373696f6e000000000000000000000000000000000000000000007f4e6f742066726f7a656e206f7220666c75696400000000000000000000000000613088565b612d1a33613107565b6000612d2461192f565b612d2c610da1565b84612d3791906150b3565b612d4191906150f5565b9050612d4d338461316d565b612d568361322b565b612d60338261324e565b3373ffffffffffffffffffffffffffffffffffffffff167f93530ac0ee8c50e696e13c5ac62355d0c0ba4bd943620d5bda1eb08b64ae75126001612da2611e30565b612dac9190615126565b8386604051612dbd9392919061515a565b60405180910390a2505050565b612dd2613efb565b612dda6140f9565b612de2611e30565b7fc30b728d1c19e5db3678b8ea9e9a063a5655071e1a325c2f7fdbca48baa9060043612e0c613080565b604051612e1a929190614dfe565b60405180910390a2565b606060006008016000838152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015612e8957602002820191906000526020600020905b815481526020019060010190808311612e75575b50505050509050919050565b612e9e816120fa565b612ea781611f41565b50565b600080600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b60008060050160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806000600801600084815260200190815260200160002060030160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546000600801600085815260200190815260200160002060030160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154915091509250929050565b6000806008016000838152602001908152602001600020600001549050919050565b8060006008016000858152602001908152602001600020600201838154811061303757613036614fad565b5b9060005260206000200181905550505050565b60016000600801600084815260200190815260200160002060060160006101000a81548160ff0219169083151502179055505050565b600042905090565b826131025761309682614166565b613a2060f01b6130a583614166565b6040516020016130b793929190615600565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130f99190614600565b60405180910390fd5b505050565b61310f614270565b613117611e30565b6131219190615126565b600060070160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555050565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546131be9190615126565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055508060006001016002015461321b9190615126565b6000600101600201819055505050565b8060006001016001015461323f9190615213565b60006001016001018190555050565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461329f9190615213565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550806000600101600001546132fc9190615213565b600060010160000181905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051613366919061477c565b60405180910390a35050565b61337a6144d2565b604051806020016040528067016345785d8a0000815250905090565b61339e6144d2565b60405180602001604052806133c485600001518560000151670de0b6b3a7640000614279565b815250905092915050565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546134209190615213565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055508060006001016002015461347d9190615213565b6000600101600201819055505050565b60006002905090565b61349e6144d2565b60405180602001604052806703782dace9d90000815250905090565b6134c26144d2565b60405180602001604052806134e085670de0b6b3a764000086614279565b815250905092915050565b600060026134f9848461429b565b14905092915050565b61350b816142da565b6000808273ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f8129fc1c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516135b59190615635565b600060405180830381855af49150503d80600081146135f0576040519150601f19603f3d011682016040523d82523d6000602084013e6135f5565b606091505b509150915081819061363d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136349190614600565b60405180910390fd5b508273ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a2505050565b60006003905090565b600073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48905090565b60006003905090565b6136bc6144d2565b604051806020016040528067058d15e176280000815250905090565b6136e06144e5565b604051806060016040528060018152602001636585a470815260200162015180815250905090565b60016000600a0160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160006101000a81548160ff02191690831515021790555050565b60006001905090565b80600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546137c39190615126565b600060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550806000600101600001546138209190615126565b6000600101600001819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161388a919061477c565b60405180910390a35050565b806000600101600101546138aa9190615126565b60006001016001018190555050565b6000806138c461192f565b036138d2576000905061390d565b60006138ed6138e084611cb4565b6138e8610da1565b6134ba565b90506139096138fa614351565b826134eb90919063ffffffff16565b9150505b919050565b60006003905090565b613923611e30565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154613a0b9190615213565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154613aa99190615213565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154613b479190615126565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154613be59190615126565b6000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505050565b806000600a0160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690836002811115613cd757613cd6614b52565b5b0217905550505050565b60008060070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015490506000613d3583610d53565b613d3e84612eaa565b613d489190615126565b905081811115613d9d5780600060070160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b50505050565b816000600801600085815260200190815260200160002060030160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550806000600801600085815260200190815260200160002060030160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555050505050565b806000600801600085815260200190815260200160002060040160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505050565b80600060010160030154613eec9190615213565b60006001016003018190555050565b6000613f05612093565b9050613f1081613896565b6000613f1a6111e2565b9050613f2581614374565b613f48613f30611e30565b613f38613686565b83613f4391906150f5565b614397565b613f60613f53611e30565b613f5b613686565b6143b9565b6000613f6a611383565b73ffffffffffffffffffffffffffffffffffffffff16635d3b1d30613f8d611c89565b613f95611bf1565b6003620f4240613fa3613686565b6040518663ffffffff1660e01b8152600401613fc39594939291906156ef565b6020604051808303816000875af1158015613fe2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140069190614f80565b9050614019614013611e30565b82614433565b7fd722c1abea91ee750cbe97ef43e859927b34e8ef0620e511b3c37e4c1f4f157c614042611e30565b61404a613080565b614052611074565b73ffffffffffffffffffffffffffffffffffffffff1663bd85b039614075611e30565b6040518263ffffffff1660e01b8152600401614091919061477c565b602060405180830381865afa1580156140ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140d29190614f80565b856140db613686565b6040516140ec959493929190615742565b60405180910390a1505050565b614154614104611e30565b61410c611b3d565b117f426f6e64696e67000000000000000000000000000000000000000000000000007f5374696c6c2063757272656e742065706f636800000000000000000000000000613088565b61415c614470565b61416461449e565b565b606060008260405160200161417b91906157b6565b60405160208183030381529060405290506000602090505b60008111156142185780806141a7906157d1565b915050600060f81b8282815181106141c2576141c1614fad565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146142135760006001826142039190615126565b905080835282935050505061426b565b614193565b50600067ffffffffffffffff81111561423457614233614809565b5b6040519080825280601f01601f1916602001820160405280156142665781602001600182028036833780820191505090505b509150505b919050565b60006002905090565b600081838561428891906150b3565b61429291906150f5565b90509392505050565b600081600001518360000151036142b557600190506142d4565b81600001518360000151116142cb5760006142ce565b60025b60ff1690505b92915050565b6142e3816144bf565b614322576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016143199061586c565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508181555050565b6143596144d2565b604051806020016040528066354a6ba7a18000815250905090565b806000600101600301546143889190615126565b60006001016003018190555050565b8060006008016000848152602001908152602001600020600101819055505050565b8067ffffffffffffffff8111156143d3576143d2614809565b5b6040519080825280602002602001820160405280156144015781602001602082028036833780820191505090505b5060006008016000848152602001908152602001600020600201908051906020019061442e929190614506565b505050565b8060006008016000848152602001908152602001600020600501819055508160006009016000838152602001908152602001600020819055505050565b61447861192f565b60006008016000614487611e30565b815260200190815260200160002060000181905550565b600160008001600001546144b29190615126565b6000800160000181905550565b600080823b905060008111915050919050565b6040518060200160405280600081525090565b60405180606001604052806000815260200160008152602001600081525090565b828054828255906000526020600020908101928215614542579160200282015b82811115614541578251825591602001919060010190614526565b5b50905061454f9190614553565b5090565b5b8082111561456c576000816000905550600101614554565b5090565b600081519050919050565b600082825260208201905092915050565b60005b838110156145aa57808201518184015260208101905061458f565b60008484015250505050565b6000601f19601f8301169050919050565b60006145d282614570565b6145dc818561457b565b93506145ec81856020860161458c565b6145f5816145b6565b840191505092915050565b6000602082019050818103600083015261461a81846145c7565b905092915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61464981614636565b811461465457600080fd5b50565b60008135905061466681614640565b92915050565b6000602082840312156146825761468161462c565b5b600061469084828501614657565b91505092915050565b60008115159050919050565b6146ae81614699565b82525050565b60006020820190506146c960008301846146a5565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006146fa826146cf565b9050919050565b61470a816146ef565b811461471557600080fd5b50565b60008135905061472781614701565b92915050565b600080604083850312156147445761474361462c565b5b600061475285828601614718565b925050602061476385828601614657565b9150509250929050565b61477681614636565b82525050565b6000602082019050614791600083018461476d565b92915050565b6000602082840312156147ad576147ac61462c565b5b60006147bb84828501614718565b91505092915050565b600080604083850312156147db576147da61462c565b5b60006147e985828601614657565b92505060206147fa85828601614718565b9150509250929050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b614841826145b6565b810181811067ffffffffffffffff821117156148605761485f614809565b5b80604052505050565b6000614873614622565b905061487f8282614838565b919050565b600067ffffffffffffffff82111561489f5761489e614809565b5b602082029050602081019050919050565b600080fd5b60006148c86148c384614884565b614869565b905080838252602082019050602084028301858111156148eb576148ea6148b0565b5b835b8181101561491457806149008882614657565b8452602084019350506020810190506148ed565b5050509392505050565b600082601f83011261493357614932614804565b5b81356149438482602086016148b5565b91505092915050565b600080604083850312156149635761496261462c565b5b600061497185828601614657565b925050602083013567ffffffffffffffff81111561499257614991614631565b5b61499e8582860161491e565b9150509250929050565b6000819050919050565b60006149cd6149c86149c3846146cf565b6149a8565b6146cf565b9050919050565b60006149df826149b2565b9050919050565b60006149f1826149d4565b9050919050565b614a01816149e6565b82525050565b6000602082019050614a1c60008301846149f8565b92915050565b600080600060608486031215614a3b57614a3a61462c565b5b6000614a4986828701614718565b9350506020614a5a86828701614718565b9250506040614a6b86828701614657565b9150509250925092565b600060ff82169050919050565b614a8b81614a75565b82525050565b6000602082019050614aa66000830184614a82565b92915050565b614ab5816146ef565b82525050565b6000602082019050614ad06000830184614aac565b92915050565b6000614ae1826149d4565b9050919050565b614af181614ad6565b82525050565b6000602082019050614b0c6000830184614ae8565b92915050565b60008060408385031215614b2957614b2861462c565b5b6000614b3785828601614718565b9250506020614b4885828601614718565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110614b9257614b91614b52565b5b50565b6000819050614ba382614b81565b919050565b6000614bb382614b95565b9050919050565b614bc381614ba8565b82525050565b6000602082019050614bde6000830184614bba565b92915050565b600067ffffffffffffffff82169050919050565b614c0181614be4565b82525050565b6000602082019050614c1c6000830184614bf8565b92915050565b6000819050919050565b614c3581614c22565b82525050565b6000602082019050614c506000830184614c2c565b92915050565b60038110614c6757614c66614b52565b5b50565b6000819050614c7882614c56565b919050565b6000614c8882614c6a565b9050919050565b614c9881614c7d565b82525050565b6000602082019050614cb36000830184614c8f565b92915050565b60038110614cc657600080fd5b50565b600081359050614cd881614cb9565b92915050565b60008060408385031215614cf557614cf461462c565b5b6000614d0385828601614718565b9250506020614d1485828601614cc9565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b614d5381614636565b82525050565b6000614d658383614d4a565b60208301905092915050565b6000602082019050919050565b6000614d8982614d1e565b614d938185614d29565b9350614d9e83614d3a565b8060005b83811015614dcf578151614db68882614d59565b9750614dc183614d71565b925050600181019050614da2565b5085935050505092915050565b60006020820190508181036000830152614df68184614d7e565b905092915050565b6000604082019050614e13600083018561476d565b614e20602083018461476d565b9392505050565b7f6f6e6c792056524620436f6f7264696e61746f722063616e2066756c66696c6c600082015250565b6000614e5d60208361457b565b9150614e6882614e27565b602082019050919050565b60006020820190508181036000830152614e8c81614e50565b9050919050565b7f696e76616c69642065706f636800000000000000000000000000000000000000600082015250565b6000614ec9600d8361457b565b9150614ed482614e93565b602082019050919050565b60006020820190508181036000830152614ef881614ebc565b9050919050565b7f6472617720616c72656164792065786563757465640000000000000000000000600082015250565b6000614f3560158361457b565b9150614f4082614eff565b602082019050919050565b60006020820190508181036000830152614f6481614f28565b9050919050565b600081519050614f7a81614640565b92915050565b600060208284031215614f9657614f9561462c565b5b6000614fa484828501614f6b565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061501682614636565b915061502183614636565b92508261503157615030614fdc565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061507682614636565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036150a8576150a761503c565b5b600182019050919050565b60006150be82614636565b91506150c983614636565b92508282026150d781614636565b915082820484148315176150ee576150ed61503c565b5b5092915050565b600061510082614636565b915061510b83614636565b92508261511b5761511a614fdc565b5b828204905092915050565b600061513182614636565b915061513c83614636565b92508282019050808211156151545761515361503c565b5b92915050565b600060608201905061516f600083018661476d565b61517c602083018561476d565b615189604083018461476d565b949350505050565b60006040820190506151a66000830185614aac565b6151b3602083018461476d565b9392505050565b6151c381614699565b81146151ce57600080fd5b50565b6000815190506151e0816151ba565b92915050565b6000602082840312156151fc576151fb61462c565b5b600061520a848285016151d1565b91505092915050565b600061521e82614636565b915061522983614636565b92508282039050818111156152415761524061503c565b5b92915050565b600060608201905061525c6000830186614aac565b6152696020830185614aac565b615276604083018461476d565b949350505050565b60006040820190506152936000830185614bba565b6152a0602083018461476d565b9392505050565b7f4c6f74746572793a20616c7265616479206d696e746564207469636b6574732060008201527f666f7220746869732065706f6368000000000000000000000000000000000000602082015250565b6000615303602e8361457b565b915061530e826152a7565b604082019050919050565b60006020820190508181036000830152615332816152f6565b9050919050565b7f4c6f74746572793a204e6f7420656e6f75676820626f6e6465642062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b600061539560228361457b565b91506153a082615339565b604082019050919050565b600060208201905081810360008301526153c481615388565b9050919050565b60006060820190506153e06000830186614aac565b6153ed602083018561476d565b6153fa604083018461476d565b949350505050565b7f4c6f74746572793a205072697a6520616c726561647920636c61696d65640000600082015250565b6000615438601e8361457b565b915061544382615402565b602082019050919050565b600060208201905081810360008301526154678161542b565b9050919050565b7f4c6f74746572793a2044726177206e6f7420796574207265736f6c766564206260008201527f7920636861696e6c696e6b207672660000000000000000000000000000000000602082015250565b60006154ca602f8361457b565b91506154d58261546e565b604082019050919050565b600060208201905081810360008301526154f9816154bd565b9050919050565b7f4c6f74746572793a206e6f2077696e6e696e67207469636b6574730000000000600082015250565b6000615536601b8361457b565b915061554182615500565b602082019050919050565b6000602082019050818103600083015261556581615529565b9050919050565b600081519050919050565b600081905092915050565b600061558d8261556c565b6155978185615577565b93506155a781856020860161458c565b80840191505092915050565b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b6000819050919050565b6155fa6155f5826155b3565b6155df565b82525050565b600061560c8286615582565b915061561882856155e9565b6002820191506156288284615582565b9150819050949350505050565b60006156418284615582565b915081905092915050565b6000819050919050565b600061ffff82169050919050565b600061567f61567a6156758461564c565b6149a8565b615656565b9050919050565b61568f81615664565b82525050565b6000819050919050565b600063ffffffff82169050919050565b60006156ca6156c56156c084615695565b6149a8565b61569f565b9050919050565b6156da816156af565b82525050565b6156e98161569f565b82525050565b600060a0820190506157046000830188614c2c565b6157116020830187614bf8565b61571e6040830186615686565b61572b60608301856156d1565b61573860808301846156e0565b9695505050505050565b600060a082019050615757600083018861476d565b615764602083018761476d565b615771604083018661476d565b61577e606083018561476d565b61578b608083018461476d565b9695505050505050565b6000819050919050565b6157b06157ab82614c22565b615795565b82525050565b60006157c2828461579f565b60208201915081905092915050565b60006157dc82614636565b9150600082036157ef576157ee61503c565b5b600182039050919050565b7f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f60008201527f6e20746f2061206e6f6e2d636f6e747261637420616464726573730000000000602082015250565b6000615856603b8361457b565b9150615861826157fa565b604082019050919050565b6000602082019050818103600083015261588581615849565b905091905056fea2646970667358221220ea1b07192f4928166989d71a34f8a4ea4a03c488c6d73ddaa35e20b3cd70d07364736f6c63430008140033

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
Loading...
Loading
[ 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.