Contract 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52

Contract Overview

Balance:
0 BNB

Token:
Txn Hash
Block
From
To
Value [Txn Fee]
0x9e47af72995ae9d53102b81c4da6d9cf19236fdf81c1183995538f9a1ab87f8e81473592021-04-20 15:24:1020 hrs 43 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x8e65904a2a7a49ce4483350b277f57a91076b3d8d78e22151c4841992cb92c3b81473392021-04-20 15:23:1020 hrs 44 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x7898ffe58a231efe910b8ee3816fa3be10cac46d663ef2a94ef1daaecc5d5dea81472992021-04-20 15:21:1020 hrs 46 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00632008
0x1af0af751c6b69b4c9fba1aa426ed6935b76aa67d2ccb6e08caf7d8c86043a4b81472792021-04-20 15:20:1020 hrs 47 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00632008
0xaf9cd76431d6d35e0ce7b5d729ab73e6af608d3566f90b013f637a6b785ac01481472592021-04-20 15:19:1020 hrs 48 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x04eb52d9b1871a651fa40e2cb9eadd0f08b15589336eb3d92813fabec37ce0da81472392021-04-20 15:18:1020 hrs 49 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00555208
0xdf5d3523d7ea08a57fab65317e4dc40b868135abe9e0f3873f3b29f65c488b4481472192021-04-20 15:17:1020 hrs 50 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x8e3f524617bc71f391d3e763678bf35972b3290b572872146e78800db5fd50f181471992021-04-20 15:16:1020 hrs 51 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00632008
0x8ae3650be5fb12ce976138fe3682d4eac123b176accd8edacc73c701534502e381471792021-04-20 15:15:1020 hrs 52 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x4afc75f05dd3a847af9a14ddeef5bd20143f711d9880d3a1ab2c2fdbabdbf13381471592021-04-20 15:14:1020 hrs 53 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00631996
0x3d47e3243a8e37328ec304dad40b3416d198d8a3fd32742c97862ed417aa714a81471392021-04-20 15:13:1020 hrs 54 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x5dd1b89da237965c13b3ad76bf40edd6873e87a14f1513e17810bb45402e8a3a81471192021-04-20 15:12:1020 hrs 55 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0xe12454210d97c7c1a15623389efa9758f0d63e45be19420aff3851e349594edd81470792021-04-20 15:10:1020 hrs 57 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x18e56614549180b22a7a66d46983d0932e9be9eb60e31ecb5c801b690ebb022881470592021-04-20 15:09:1020 hrs 58 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x832c939844932b70d44814a7a748b679d356e976740011ef0a8a8f0576f4551581470412021-04-20 15:08:1620 hrs 59 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x8b8238a0f5d01e8b6bd01c2a6057caa4e80c7584ede2604b22d7021f22dd9c1f81470192021-04-20 15:07:1021 hrs ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00632008
0x10c6bdab237c41f1cc779a593ae68a019fbcf768b5e72ee6a01f58563b75892181469992021-04-20 15:06:1021 hrs 1 min ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x2a80ab34a2c2a626255b173b97e281a99e15b09b4632d3d98485c381f48e5a9881469792021-04-20 15:05:1021 hrs 2 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x91b25077a1b3784b2e9b6b42a12659fa69ee87eb5fbe469e13764f195ce6cab581469592021-04-20 15:04:1021 hrs 3 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0xeba7991ac3a4d4fa85e67a444f27a5a3f5cc55199d84b550ecbc2cb15761b47881469392021-04-20 15:03:1021 hrs 4 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0xd857cca39cd129487c73e716a6847a237b99ef2189eda7b49d87a4bcf9c643b681469192021-04-20 15:02:1021 hrs 5 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00555208
0x805578b3aae1093fd7634b00039623a6ecbf7a3ffde34e848339e4690837180781468992021-04-20 15:01:1021 hrs 6 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0x511b59a16cff4fefce58edff8d477958ee9eaf9809f49e45a79f65d4ef2baf7f81468792021-04-20 15:00:1021 hrs 7 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.00632008
0x3c7abb1cc2e4d8fbf363be815b309a8e575a7b9cca49a680c69419904ff194b881468592021-04-20 14:59:1021 hrs 8 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
0xafb0904fc07dc94d16166fc6c7be4d82ff07a063c40892b3e5052ed9f2b599b481468392021-04-20 14:58:1021 hrs 9 mins ago0xd19bc53e01bf0585f6fffdb4e6ed479a1f869266 IN  0x859b2d0102af35b248681c6ee1bdcc35e92c0b520 BNB0.0063202
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x9e47af72995ae9d53102b81c4da6d9cf19236fdf81c1183995538f9a1ab87f8e81473592021-04-20 15:24:1020 hrs 43 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x9e47af72995ae9d53102b81c4da6d9cf19236fdf81c1183995538f9a1ab87f8e81473592021-04-20 15:24:1020 hrs 43 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x8e65904a2a7a49ce4483350b277f57a91076b3d8d78e22151c4841992cb92c3b81473392021-04-20 15:23:1020 hrs 44 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x8e65904a2a7a49ce4483350b277f57a91076b3d8d78e22151c4841992cb92c3b81473392021-04-20 15:23:1020 hrs 44 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x7898ffe58a231efe910b8ee3816fa3be10cac46d663ef2a94ef1daaecc5d5dea81472992021-04-20 15:21:1020 hrs 46 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x7898ffe58a231efe910b8ee3816fa3be10cac46d663ef2a94ef1daaecc5d5dea81472992021-04-20 15:21:1020 hrs 46 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x1af0af751c6b69b4c9fba1aa426ed6935b76aa67d2ccb6e08caf7d8c86043a4b81472792021-04-20 15:20:1020 hrs 47 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x1af0af751c6b69b4c9fba1aa426ed6935b76aa67d2ccb6e08caf7d8c86043a4b81472792021-04-20 15:20:1020 hrs 47 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0xaf9cd76431d6d35e0ce7b5d729ab73e6af608d3566f90b013f637a6b785ac01481472592021-04-20 15:19:1020 hrs 48 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0xaf9cd76431d6d35e0ce7b5d729ab73e6af608d3566f90b013f637a6b785ac01481472592021-04-20 15:19:1020 hrs 48 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x04eb52d9b1871a651fa40e2cb9eadd0f08b15589336eb3d92813fabec37ce0da81472392021-04-20 15:18:1020 hrs 49 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x04eb52d9b1871a651fa40e2cb9eadd0f08b15589336eb3d92813fabec37ce0da81472392021-04-20 15:18:1020 hrs 49 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0xdf5d3523d7ea08a57fab65317e4dc40b868135abe9e0f3873f3b29f65c488b4481472192021-04-20 15:17:1020 hrs 50 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0xdf5d3523d7ea08a57fab65317e4dc40b868135abe9e0f3873f3b29f65c488b4481472192021-04-20 15:17:1020 hrs 50 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x8e3f524617bc71f391d3e763678bf35972b3290b572872146e78800db5fd50f181471992021-04-20 15:16:1020 hrs 51 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x8e3f524617bc71f391d3e763678bf35972b3290b572872146e78800db5fd50f181471992021-04-20 15:16:1020 hrs 51 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x8ae3650be5fb12ce976138fe3682d4eac123b176accd8edacc73c701534502e381471792021-04-20 15:15:1020 hrs 52 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x8ae3650be5fb12ce976138fe3682d4eac123b176accd8edacc73c701534502e381471792021-04-20 15:15:1020 hrs 52 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x4afc75f05dd3a847af9a14ddeef5bd20143f711d9880d3a1ab2c2fdbabdbf13381471592021-04-20 15:14:1020 hrs 53 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x4afc75f05dd3a847af9a14ddeef5bd20143f711d9880d3a1ab2c2fdbabdbf13381471592021-04-20 15:14:1020 hrs 53 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x3d47e3243a8e37328ec304dad40b3416d198d8a3fd32742c97862ed417aa714a81471392021-04-20 15:13:1020 hrs 54 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x3d47e3243a8e37328ec304dad40b3416d198d8a3fd32742c97862ed417aa714a81471392021-04-20 15:13:1020 hrs 54 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0x5dd1b89da237965c13b3ad76bf40edd6873e87a14f1513e17810bb45402e8a3a81471192021-04-20 15:12:1020 hrs 55 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
0x5dd1b89da237965c13b3ad76bf40edd6873e87a14f1513e17810bb45402e8a3a81471192021-04-20 15:12:1020 hrs 55 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x9af6156b4d903d2420f8b8aa505e62532702e8ce0 BNB
0xe12454210d97c7c1a15623389efa9758f0d63e45be19420aff3851e349594edd81470792021-04-20 15:10:1020 hrs 57 mins ago 0x859b2d0102af35b248681c6ee1bdcc35e92c0b52 0x6da73f3e3c3291dfbe6bfe1ae8aeeca759e91fba0 BNB
[ Download CSV Export 
Loading

Contract Source Code Verified (Similar Match)
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xF68c11387B3276088851199896E2d556B1090d95

Contract Name:
Lottery

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at BscScan.com on 2021-03-22
*/

pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;


// 
/*
 * @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 GSN 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 payable) {
        return msg.sender;
    }

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

// 
/**
 * @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);
}

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

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

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

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

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

// 
/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {

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

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

// 
/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

// 
/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}

// 
/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

// 
/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // 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.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        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.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

// 
/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// 
/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

// 
/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._indexes[key] != 0;
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

   /**
    * @dev Returns the key-value pair stored at position `index` in the map. O(1).
    *
    * Note that there are no guarantees on the ordering of entries inside the
    * array, and it may change when more entries are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        require(map._entries.length > index, "EnumerableMap: index out of bounds");

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        uint256 keyIndex = map._indexes[key];
        if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
        return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return _remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return _contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return _length(map._inner);
    }

   /**
    * @dev Returns the element stored at position `index` in the set. O(1).
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
    }
}

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

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

// 
/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;

    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;

    // Mapping from token ID to approved address
    mapping (uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping (address => mapping (address => bool)) private _operatorApprovals;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _holderTokens[owner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(base, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view virtual returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _tokenOwners.contains(tokenId);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId); // internal owner

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }

        _holderTokens[owner].remove(tokenId);

        _tokenOwners.remove(tokenId);

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
    }

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

// 
/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}

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

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

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

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

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

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

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

contract LotteryNFT is ERC721, Ownable {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    mapping (uint256 => uint8[4]) public lotteryInfo;
    mapping (uint256 => uint256) public lotteryAmount;
    mapping (uint256 => uint256) public issueIndex;
    mapping (uint256 => bool) public claimInfo;

    constructor() public ERC721("IceCream Lottery Ticket", "ILT") {}

    function newLotteryItem(address player, uint8[4] memory _lotteryNumbers, uint256 _amount, uint256 _issueIndex)
        public onlyOwner
        returns (uint256)
    {
        _tokenIds.increment();

        uint256 newItemId = _tokenIds.current();
        _mint(player, newItemId);
        lotteryInfo[newItemId] = _lotteryNumbers;
        lotteryAmount[newItemId] = _amount;
        issueIndex[newItemId] = _issueIndex;
        // claimInfo[newItemId] = false; default is false here
        // _setTokenURI(newItemId, tokenURI);

        return newItemId;
    }

    function getLotteryNumbers(uint256 tokenId) external view returns (uint8[4] memory) {
        return lotteryInfo[tokenId];
    }
    function getLotteryAmount(uint256 tokenId) external view returns (uint256) {
        return lotteryAmount[tokenId];
    }
    function getLotteryIssueIndex(uint256 tokenId) external view returns (uint256) {
        return issueIndex[tokenId];
    }
    function claimReward(uint256 tokenId) external onlyOwner {
        claimInfo[tokenId] = true;
    }
    function multiClaimReward(uint256[] memory tokenIds) external onlyOwner {
        for (uint i = 0; i < tokenIds.length; i++) {
            claimInfo[tokenIds[i]] = true;
        }
    }
    function burn(uint256 tokenId) external onlyOwner {
        _burn(tokenId);
    }
    function getClaimStatus(uint256 tokenId) external view returns (bool) {
        return claimInfo[tokenId];
    }
}

contract LotteryOwnable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
    }

    function initOwner(address owner) internal {
        _owner = owner;
        emit OwnershipTransferred(address(0), owner);
    }

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

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

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

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

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

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

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

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

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

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

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

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

// 
/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

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

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !Address.isContract(address(this));
    }
}

// import "@nomiclabs/buidler/console.sol";
// 4 numbers
contract Lottery is LotteryOwnable, Initializable {
    using SafeMath for uint256;
    using SafeMath for uint8;
    using SafeERC20 for IERC20;

    uint8 constant keyLengthForEachBuy = 11;
    // Allocation for first/sencond/third reward
    uint8[3] public allocation;
    // The TOKEN to buy lottery
    IERC20 public cake;
    // The Lottery NFT for tickets
    LotteryNFT public lotteryNFT;
    // adminAddress
    address public adminAddress;
    // maxNumber
    uint8 public maxNumber;
    // minPrice, if decimal is not 18, please reset it
    uint256 public minPrice;

    // =================================

    // issueId => winningNumbers[numbers]
    mapping (uint256 => uint8[4]) public historyNumbers;
    // issueId => [tokenId]
    mapping (uint256 => uint256[]) public lotteryInfo;
    // issueId => [totalAmount, firstMatchAmount, secondMatchingAmount, thirdMatchingAmount]
    mapping (uint256 => uint256[]) public historyAmount;
    // issueId => trickyNumber => buyAmountSum
    mapping (uint256 => mapping(uint64 => uint256)) public userBuyAmountSum;
    // address => [tokenId]
    mapping (address => uint256[]) public userInfo;

    uint256 public issueIndex = 0;
    uint256 public totalAddresses = 0;
    uint256 public totalAmount = 0;
    uint256 public lastTimestamp;

    uint8[4] public winningNumbers;

    // default false
    bool public drawingPhase;

    // =================================

    event Buy(address indexed user, uint256 tokenId);
    event Drawing(uint256 indexed issueIndex, uint8[4] winningNumbers);
    event Claim(address indexed user, uint256 tokenid, uint256 amount);
    event DevWithdraw(address indexed user, uint256 amount);
    event Reset(uint256 indexed issueIndex);
    event MultiClaim(address indexed user, uint256 amount);
    event MultiBuy(address indexed user, uint256 amount);

    constructor() public {
    }

    function initialize(
        IERC20 _cake,
        LotteryNFT _lottery,
        uint256 _minPrice,
        uint8 _maxNumber,
        address _owner,
        address _adminAddress
    ) public initializer {
        cake = _cake;
        lotteryNFT = _lottery;
        minPrice = _minPrice;
        maxNumber = _maxNumber;
        adminAddress = _adminAddress;
        lastTimestamp = block.timestamp;
        allocation = [60, 20, 10];
        initOwner(_owner);
    }

    uint8[4] private nullTicket = [0,0,0,0];

    modifier onlyAdmin() {
        require(msg.sender == adminAddress, "admin: wut?");
        _;
    }

    modifier inDrawingPhase() {
        require(!drawed(), 'drawed, can not buy now');
        require(!drawingPhase, 'drawing, can not buy now');
        _;
    }

    function drawed() public view returns(bool) {
        return winningNumbers[0] != 0;
    }

    function reset() external onlyAdmin {
        require(drawed(), "drawed?");
        lastTimestamp = block.timestamp;
        totalAddresses = 0;
        totalAmount = 0;
        winningNumbers[0]=0;
        winningNumbers[1]=0;
        winningNumbers[2]=0;
        winningNumbers[3]=0;
        drawingPhase = false;
        issueIndex = issueIndex +1;
        // if(getMatchingRewardAmount(issueIndex-1, 4) == 0) {
        //     uint256 amount = getTotalRewards(issueIndex-1).mul(allocation[0]).div(100);
        //     internalBuy(amount, nullTicket);
        // }
        emit Reset(issueIndex);
    }

    function enterDrawingPhase() external onlyAdmin {
        require(!drawed(), 'drawed');
        drawingPhase = true;
    }

    // add externalRandomNumber to prevent node validators exploiting
    function drawing(uint256 _externalRandomNumber) external onlyAdmin {
        require(!drawed(), "reset?");
        require(drawingPhase, "enter drawing phase first");
        bytes32 _structHash;
        uint256 _randomNumber;
        uint8 _maxNumber = maxNumber;
        bytes32 _blockhash = blockhash(block.number-1);

        // waste some gas fee here
        for (uint i = 0; i < 10; i++) {
            getTotalRewards(issueIndex);
        }
        uint256 _gasleft = gasleft();

        // 1
        _structHash = keccak256(
            abi.encode(
                _blockhash,
                totalAddresses,
                _gasleft,
                _externalRandomNumber
            )
        );
        _randomNumber  = uint256(_structHash);
        assembly {_randomNumber := add(mod(_randomNumber, _maxNumber),1)}
        winningNumbers[0]=uint8(_randomNumber);

        // 2
        _structHash = keccak256(
            abi.encode(
                _blockhash,
                totalAmount,
                _gasleft,
                _externalRandomNumber
            )
        );
        _randomNumber  = uint256(_structHash);
        assembly {_randomNumber := add(mod(_randomNumber, _maxNumber),1)}
        winningNumbers[1]=uint8(_randomNumber);

        // 3
        _structHash = keccak256(
            abi.encode(
                _blockhash,
                lastTimestamp,
                _gasleft,
                _externalRandomNumber
            )
        );
        _randomNumber  = uint256(_structHash);
        assembly {_randomNumber := add(mod(_randomNumber, _maxNumber),1)}
        winningNumbers[2]=uint8(_randomNumber);

        // 4
        _structHash = keccak256(
            abi.encode(
                _blockhash,
                _gasleft,
                _externalRandomNumber
            )
        );
        _randomNumber  = uint256(_structHash);
        assembly {_randomNumber := add(mod(_randomNumber, _maxNumber),1)}
        winningNumbers[3]=uint8(_randomNumber);
        historyNumbers[issueIndex] = winningNumbers;
        historyAmount[issueIndex] = calculateMatchingRewardAmount();
        drawingPhase = false;
        emit Drawing(issueIndex, winningNumbers);
    }

    function internalBuy(uint256 _price, uint8[4] memory _numbers) internal {
        require (!drawed(), 'drawed, can not buy now');
        for (uint i = 0; i < 4; i++) {
            require (_numbers[i] <= maxNumber, 'exceed the maximum');
        }
        uint256 tokenId = lotteryNFT.newLotteryItem(address(this), _numbers, _price, issueIndex);
        lotteryInfo[issueIndex].push(tokenId);
        totalAmount = totalAmount.add(_price);
        lastTimestamp = block.timestamp;
        emit Buy(address(this), tokenId);

    }

    function buy(uint256 _price, uint8[4] memory _numbers) external inDrawingPhase {
        require (_price >= minPrice, 'price must above minPrice');
        for (uint i = 0; i < 4; i++) {
            require (_numbers[i] <= maxNumber, 'exceed number scope');
        }
        uint256 tokenId = lotteryNFT.newLotteryItem(msg.sender, _numbers, _price, issueIndex);
        lotteryInfo[issueIndex].push(tokenId);
        if (userInfo[msg.sender].length == 0) {
            totalAddresses = totalAddresses + 1;
        }
        userInfo[msg.sender].push(tokenId);
        totalAmount = totalAmount.add(_price);
        lastTimestamp = block.timestamp;
        uint64[keyLengthForEachBuy] memory userNumberIndex = generateNumberIndexKey(_numbers);
        for (uint i = 0; i < keyLengthForEachBuy; i++) {
            userBuyAmountSum[issueIndex][userNumberIndex[i]]=userBuyAmountSum[issueIndex][userNumberIndex[i]].add(_price);
        }
        cake.safeTransferFrom(address(msg.sender), address(this), _price);
        emit Buy(msg.sender, tokenId);
    }

    function  multiBuy(uint256 _price, uint8[4][] memory _numbers) external inDrawingPhase {
        require (_price >= minPrice, 'price must above minPrice');
        uint256 totalPrice  = 0;
        for (uint i = 0; i < _numbers.length; i++) {
            for (uint j = 0; j < 4; j++) {
                require (_numbers[i][j] <= maxNumber && _numbers[i][j] > 0, 'exceed number scope');
            }
            uint256 tokenId = lotteryNFT.newLotteryItem(msg.sender, _numbers[i], _price, issueIndex);
            lotteryInfo[issueIndex].push(tokenId);
            if (userInfo[msg.sender].length == 0) {
                totalAddresses = totalAddresses + 1;
            }
            userInfo[msg.sender].push(tokenId);
            totalAmount = totalAmount.add(_price);
            lastTimestamp = block.timestamp;
            totalPrice = totalPrice.add(_price);
            uint64[keyLengthForEachBuy] memory numberIndexKey = generateNumberIndexKey(_numbers[i]);
            for (uint k = 0; k < keyLengthForEachBuy; k++) {
                userBuyAmountSum[issueIndex][numberIndexKey[k]]=userBuyAmountSum[issueIndex][numberIndexKey[k]].add(_price);
            }
        }
        cake.safeTransferFrom(address(msg.sender), address(this), totalPrice);
        emit MultiBuy(msg.sender, totalPrice);
    }

    function claimReward(uint256 _tokenId) external {
        require(msg.sender == lotteryNFT.ownerOf(_tokenId), "not from owner");
        require (!lotteryNFT.getClaimStatus(_tokenId), "claimed");
        uint256 reward = getRewardView(_tokenId);
        lotteryNFT.claimReward(_tokenId);
        if(reward>0) {
            cake.safeTransfer(address(msg.sender), reward);
        }
        emit Claim(msg.sender, _tokenId, reward);
    }

    function  multiClaim(uint256[] memory _tickets) external {
        uint256 totalReward = 0;
        for (uint i = 0; i < _tickets.length; i++) {
            require (msg.sender == lotteryNFT.ownerOf(_tickets[i]), "not from owner");
            require (!lotteryNFT.getClaimStatus(_tickets[i]), "claimed");
            uint256 reward = getRewardView(_tickets[i]);
            if(reward>0) {
                totalReward = reward.add(totalReward);
            }
        }
        lotteryNFT.multiClaimReward(_tickets);
        if(totalReward>0) {
            cake.safeTransfer(address(msg.sender), totalReward);
        }
        emit MultiClaim(msg.sender, totalReward);
    }

    function generateNumberIndexKey(uint8[4] memory number) public pure returns (uint64[keyLengthForEachBuy] memory) {
        uint64[4] memory tempNumber;
        tempNumber[0]=uint64(number[0]);
        tempNumber[1]=uint64(number[1]);
        tempNumber[2]=uint64(number[2]);
        tempNumber[3]=uint64(number[3]);

        uint64[keyLengthForEachBuy] memory result;
        result[0] = tempNumber[0]*256*256*256*256*256*256 + 1*256*256*256*256*256 + tempNumber[1]*256*256*256*256 + 2*256*256*256 + tempNumber[2]*256*256 + 3*256 + tempNumber[3];

        result[1] = tempNumber[0]*256*256*256*256 + 1*256*256*256 + tempNumber[1]*256*256 + 2*256+ tempNumber[2];
        result[2] = tempNumber[0]*256*256*256*256 + 1*256*256*256 + tempNumber[1]*256*256 + 3*256+ tempNumber[3];
        result[3] = tempNumber[0]*256*256*256*256 + 2*256*256*256 + tempNumber[2]*256*256 + 3*256 + tempNumber[3];
        result[4] = 1*256*256*256*256*256 + tempNumber[1]*256*256*256*256 + 2*256*256*256 + tempNumber[2]*256*256 + 3*256 + tempNumber[3];

        result[5] = tempNumber[0]*256*256 + 1*256+ tempNumber[1];
        result[6] = tempNumber[0]*256*256 + 2*256+ tempNumber[2];
        result[7] = tempNumber[0]*256*256 + 3*256+ tempNumber[3];
        result[8] = 1*256*256*256 + tempNumber[1]*256*256 + 2*256 + tempNumber[2];
        result[9] = 1*256*256*256 + tempNumber[1]*256*256 + 3*256 + tempNumber[3];
        result[10] = 2*256*256*256 + tempNumber[2]*256*256 + 3*256 + tempNumber[3];

        return result;
    }

    function calculateMatchingRewardAmount() internal view returns (uint256[4] memory) {
        uint64[keyLengthForEachBuy] memory numberIndexKey = generateNumberIndexKey(winningNumbers);

        uint256 totalAmout1 = userBuyAmountSum[issueIndex][numberIndexKey[0]];

        uint256 sumForTotalAmout2 = userBuyAmountSum[issueIndex][numberIndexKey[1]];
        sumForTotalAmout2 = sumForTotalAmout2.add(userBuyAmountSum[issueIndex][numberIndexKey[2]]);
        sumForTotalAmout2 = sumForTotalAmout2.add(userBuyAmountSum[issueIndex][numberIndexKey[3]]);
        sumForTotalAmout2 = sumForTotalAmout2.add(userBuyAmountSum[issueIndex][numberIndexKey[4]]);

        uint256 totalAmout2 = sumForTotalAmout2.sub(totalAmout1.mul(4));

        uint256 sumForTotalAmout3 = userBuyAmountSum[issueIndex][numberIndexKey[5]];
        sumForTotalAmout3 = sumForTotalAmout3.add(userBuyAmountSum[issueIndex][numberIndexKey[6]]);
        sumForTotalAmout3 = sumForTotalAmout3.add(userBuyAmountSum[issueIndex][numberIndexKey[7]]);
        sumForTotalAmout3 = sumForTotalAmout3.add(userBuyAmountSum[issueIndex][numberIndexKey[8]]);
        sumForTotalAmout3 = sumForTotalAmout3.add(userBuyAmountSum[issueIndex][numberIndexKey[9]]);
        sumForTotalAmout3 = sumForTotalAmout3.add(userBuyAmountSum[issueIndex][numberIndexKey[10]]);

        uint256 totalAmout3 = sumForTotalAmout3.add(totalAmout1.mul(6)).sub(sumForTotalAmout2.mul(3));

        return [totalAmount, totalAmout1, totalAmout2, totalAmout3];
    }

    function getMatchingRewardAmount(uint256 _issueIndex, uint256 _matchingNumber) public view returns (uint256) {
        return historyAmount[_issueIndex][5 - _matchingNumber];
    }

    function getTotalRewards(uint256 _issueIndex) public view returns(uint256) {
        require (_issueIndex <= issueIndex, '_issueIndex <= issueIndex');

        if(!drawed() && _issueIndex == issueIndex) {
            return totalAmount;
        }
        return historyAmount[_issueIndex][0];
    }

    function getRewardView(uint256 _tokenId) public view returns(uint256) {
        uint256 _issueIndex = lotteryNFT.getLotteryIssueIndex(_tokenId);
        uint8[4] memory lotteryNumbers = lotteryNFT.getLotteryNumbers(_tokenId);
        uint8[4] memory _winningNumbers = historyNumbers[_issueIndex];
        require(_winningNumbers[0] != 0, "not drawed");

        uint256 matchingNumber = 0;
        for (uint i = 0; i < lotteryNumbers.length; i++) {
            if (_winningNumbers[i] == lotteryNumbers[i]) {
                matchingNumber= matchingNumber +1;
            }
        }
        uint256 reward = 0;
        if (matchingNumber > 1) {
            uint256 amount = lotteryNFT.getLotteryAmount(_tokenId);
            uint256 poolAmount = getTotalRewards(_issueIndex).mul(allocation[4-matchingNumber]).div(100);
            reward = amount.mul(1e12).div(getMatchingRewardAmount(_issueIndex, matchingNumber)).mul(poolAmount);
        }
        return reward.div(1e12);
    }


    // Update admin address by the previous dev.
    function setAdmin(address _adminAddress) public onlyOwner {
        adminAddress = _adminAddress;
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function adminWithdraw(uint256 _amount) public onlyAdmin {
        cake.safeTransfer(address(msg.sender), _amount);
        emit DevWithdraw(msg.sender, _amount);
    }

    // Set the minimum price for one ticket
    function setMinPrice(uint256 _price) external onlyAdmin {
        minPrice = _price;
    }

    // Set the minimum price for one ticket
    function setMaxNumber(uint8 _maxNumber) external onlyAdmin {
        maxNumber = _maxNumber;
    }

    // Set the allocation for one reward
    function setAllocation(uint8 _allcation1, uint8 _allcation2, uint8 _allcation3) external onlyAdmin {
        require (_allcation1 + _allcation2 + _allcation3 < 100, 'exceed 100');
        allocation = [_allcation1, _allcation2, _allcation3];
    }

}

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DevWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"issueIndex","type":"uint256"},{"indexed":false,"internalType":"uint8[4]","name":"winningNumbers","type":"uint8[4]"}],"name":"Drawing","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MultiBuy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MultiClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"issueIndex","type":"uint256"}],"name":"Reset","type":"event"},{"inputs":[],"name":"adminAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"adminWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allocation","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint8[4]","name":"_numbers","type":"uint8[4]"}],"name":"buy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cake","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"drawed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_externalRandomNumber","type":"uint256"}],"name":"drawing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"drawingPhase","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enterDrawingPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8[4]","name":"number","type":"uint8[4]"}],"name":"generateNumberIndexKey","outputs":[{"internalType":"uint64[11]","name":"","type":"uint64[11]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_issueIndex","type":"uint256"},{"internalType":"uint256","name":"_matchingNumber","type":"uint256"}],"name":"getMatchingRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getRewardView","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_issueIndex","type":"uint256"}],"name":"getTotalRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"historyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"historyNumbers","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_cake","type":"address"},{"internalType":"contract LotteryNFT","name":"_lottery","type":"address"},{"internalType":"uint256","name":"_minPrice","type":"uint256"},{"internalType":"uint8","name":"_maxNumber","type":"uint8"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_adminAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"issueIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"lotteryInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lotteryNFT","outputs":[{"internalType":"contract LotteryNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxNumber","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint8[4][]","name":"_numbers","type":"uint8[4][]"}],"name":"multiBuy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tickets","type":"uint256[]"}],"name":"multiClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_adminAddress","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_allcation1","type":"uint8"},{"internalType":"uint8","name":"_allcation2","type":"uint8"},{"internalType":"uint8","name":"_allcation3","type":"uint8"}],"name":"setAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_maxNumber","type":"uint8"}],"name":"setMaxNumber","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setMinPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAddresses","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"userBuyAmountSum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"winningNumbers","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]

6000600b819055600c819055600d819055610100604052608081815260a082905260c082905260e0919091526200003b90601190600462000050565b503480156200004957600080fd5b5062000105565b600183019183908215620000d85791602002820160005b83821115620000a757835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030262000067565b8015620000d65782816101000a81549060ff0219169055600101602081600001049283019260010302620000a7565b505b50620000e6929150620000ea565b5090565b5b80821115620000e657805460ff19168155600101620000eb565b6130a780620001156000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c8063704b6c0211610130578063cfad5277116100b8578063e13454161161007c578063e13454161461047d578063e45be8eb14610485578063e8adfbc71461048d578063f2fde38b14610495578063fc6f9468146104a857610232565b8063cfad52771461043f578063d1f7dbcf14610447578063d411b0fa1461045a578063d826f88f1461046d578063dce174841461047557610232565b806385dcdf1b116100ff57806385dcdf1b146103d15780638da5cb5b146103f1578063a42206c914610406578063ae169a5014610419578063c39f49c01461042c57610232565b8063704b6c0214610390578063715018a6146103a35780637c5b4a37146103ab578063850bad94146103be57610232565b80633a4f6999116101be57806359bcbd681161018257806359bcbd681461033c5780635c17623a1461034f5780635ea8cd12146103625780636575243f146103755780636a28f8281461038857610232565b80633a4f6999146102d9578063438209f5146102ee5780634e45f095146103035780634ed73d2814610316578063552164ee1461032957610232565b80631ff68866116102055780631ff688661461028557806321ce919d1461028d5780632bdff851146102a05780632f506b20146102b3578063324a5562146102c657610232565b806311e420651461023757806314c20d571461024c57806319d8ac611461025f5780631a39d8ef1461027d575b600080fd5b61024a6102453660046126d7565b6104b0565b005b61024a61025a366004612826565b6105e7565b6102676108cb565b6040516102749190612fb4565b60405180910390f35b6102676108d1565b61024a6108d7565b61026761029b36600461256d565b610935565b61024a6102ae36600461277f565b610963565b6102676102c1366004612873565b610cac565b61024a6102d43660046128ad565b610cc9565b6102e1610d13565b6040516102749190612fcb565b6102f6610d23565b6040516102749190612a78565b6102e161031136600461274f565b610d2c565b61024a610324366004612598565b610d53565b61026761033736600461274f565b610fdf565b6102e161034a366004612852565b611053565b61024a61035d3660046128c9565b611089565b61024a61037036600461274f565b611110565b610267610383366004612852565b61113f565b610267611158565b61024a61039e366004612535565b61115e565b61024a6111aa565b61024a6103b936600461274f565b61121e565b6102e16103cc36600461274f565b6112a3565b6103e46103df36600461262c565b6112b0565b6040516102749190612a13565b6103f9611437565b604051610274919061292f565b61024a61041436600461274f565b611446565b61024a61042736600461274f565b6116cc565b61026761043a366004612852565b6118e2565b6102676118fb565b610267610455366004612852565b611901565b61026761046836600461274f565b611933565b61024a611c34565b6103f9611cde565b6102f6611ced565b610267611cf8565b6103f9611cfe565b61024a6104a3366004612535565b611d0d565b6103f9611db8565b600054600160a81b900460ff16806104cb57506104cb611dc7565b806104e05750600054600160a01b900460ff16155b6105055760405162461bcd60e51b81526004016104fc90612d77565b60405180910390fd5b600054600160a81b900460ff1615801561053c576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b600280546001600160a01b03199081166001600160a01b038a81169190911790925560038054821689841617815560058890556004805460ff60a01b1916600160a01b60ff8a16021790921692851692909217905542600e5560408051606081018252603c815260146020820152600a918101919091526105c0916001919061235a565b506105ca83611dd8565b80156105de576000805460ff60a81b191690555b50505050505050565b6105ef611ced565b1561060c5760405162461bcd60e51b81526004016104fc90612e3d565b60105460ff161561062f5760405162461bcd60e51b81526004016104fc90612d40565b6005548210156106515760405162461bcd60e51b81526004016104fc90612dc5565b60005b60048110156106a65760048054600160a01b900460ff169083908390811061067857fe5b602002015160ff16111561069e5760405162461bcd60e51b81526004016104fc90612b2b565b600101610654565b50600354600b54604051620dce4760ea1b81526000926001600160a01b0316916337391c00916106de91339187918991600401612943565b602060405180830381600087803b1580156106f857600080fd5b505af115801561070c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107309190612767565b600b546000908152600760209081526040808320805460018101825590845282842001849055338352600a90915290205490915061077257600c805460010190555b336000908152600a6020908152604082208054600181018255908352912001819055600d546107a19084611e23565b600d5542600e556107b06123ed565b6107b9836112b0565b905060005b600b81101561086b576108228560096000600b54815260200190815260200160002060008585600b81106107ee57fe5b60200201516001600160401b03166001600160401b0316815260200190815260200160002054611e2390919063ffffffff16565b600b805460009081526009602052604081209185908590811061084157fe5b602090810291909101516001600160401b03168252810191909152604001600020556001016107be565b50600254610884906001600160a01b0316333087611e4f565b336001600160a01b03167fe3d4187f6ca4248660cc0ac8b8056515bac4a8132be2eca31d6d0cc170722a7e836040516108bd9190612fb4565b60405180910390a250505050565b600e5481565b600d5481565b6004546001600160a01b031633146109015760405162461bcd60e51b81526004016104fc90612ea9565b610909611ced565b156109265760405162461bcd60e51b81526004016104fc90612f94565b6010805460ff19166001179055565b600a602052816000526040600020818154811061094e57fe5b90600052602060002001600091509150505481565b61096b611ced565b156109885760405162461bcd60e51b81526004016104fc90612e3d565b60105460ff16156109ab5760405162461bcd60e51b81526004016104fc90612d40565b6005548210156109cd5760405162461bcd60e51b81526004016104fc90612dc5565b6000805b8251811015610c4d5760005b6004811015610a7857600460149054906101000a900460ff1660ff16848381518110610a0557fe5b60200260200101518260048110610a1857fe5b602002015160ff1611158015610a5457506000848381518110610a3757fe5b60200260200101518260048110610a4a57fe5b602002015160ff16115b610a705760405162461bcd60e51b81526004016104fc90612b2b565b6001016109dd565b5060035483516000916001600160a01b0316906337391c00903390879086908110610a9f57fe5b602002602001015188600b546040518563ffffffff1660e01b8152600401610aca9493929190612943565b602060405180830381600087803b158015610ae457600080fd5b505af1158015610af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1c9190612767565b600b546000908152600760209081526040808320805460018101825590845282842001849055338352600a909152902054909150610b5e57600c805460010190555b336000908152600a6020908152604082208054600181018255908352912001819055600d54610b8d9086611e23565b600d5542600e55610b9e8386611e23565b9250610ba86123ed565b610bc4858481518110610bb757fe5b60200260200101516112b0565b905060005b600b811015610c4257610bf98760096000600b54815260200190815260200160002060008585600b81106107ee57fe5b600b8054600090815260096020526040812091859085908110610c1857fe5b602090810291909101516001600160401b0316825281019190915260400160002055600101610bc9565b5050506001016109d1565b50600254610c66906001600160a01b0316333084611e4f565b336001600160a01b03167f96c35ad1cc1743f26cb87980c38042de8082358ec6d171a7986d6e11dddfe85782604051610c9f9190612fb4565b60405180910390a2505050565b600960209081526000928352604080842090915290825290205481565b6004546001600160a01b03163314610cf35760405162461bcd60e51b81526004016104fc90612ea9565b6004805460ff909216600160a01b0260ff60a01b19909216919091179055565b600454600160a01b900460ff1681565b60105460ff1681565b600f8160048110610d3957fe5b60209182820401919006915054906101000a900460ff1681565b6000805b8251811015610f175760035483516001600160a01b0390911690636352211e90859084908110610d8357fe5b60200260200101516040518263ffffffff1660e01b8152600401610da79190612fb4565b60206040518083038186803b158015610dbf57600080fd5b505afa158015610dd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df79190612551565b6001600160a01b0316336001600160a01b031614610e275760405162461bcd60e51b81526004016104fc90612c89565b60035483516001600160a01b03909116906336dbd2f990859084908110610e4a57fe5b60200260200101516040518263ffffffff1660e01b8152600401610e6e9190612fb4565b60206040518083038186803b158015610e8657600080fd5b505afa158015610e9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebe91906126b7565b15610edb5760405162461bcd60e51b81526004016104fc90612d1f565b6000610ef9848381518110610eec57fe5b6020026020010151611933565b90508015610f0e57610f0b8184611e23565b92505b50600101610d57565b50600354604051637431035560e01b81526001600160a01b0390911690637431035590610f489085906004016129cf565b600060405180830381600087803b158015610f6257600080fd5b505af1158015610f76573d6000803e3d6000fd5b505050506000811115610f9a57600254610f9a906001600160a01b03163383611ea7565b336001600160a01b03167f6606374655494f5c0e2d6f392656e9777afd9ac5f61527d1bcad50b7e918a03e82604051610fd39190612fb4565b60405180910390a25050565b6000600b548211156110035760405162461bcd60e51b81526004016104fc90612b58565b61100b611ced565b1580156110195750600b5482145b156110275750600d5461104e565b6000828152600860205260408120805490919061104057fe5b906000526020600020015490505b919050565b6006602052816000526040600020816004811061106c57fe5b602081049091015460ff601f9092166101000a9004169150829050565b6004546001600160a01b031633146110b35760405162461bcd60e51b81526004016104fc90612ea9565b6064818385010160ff16106110da5760405162461bcd60e51b81526004016104fc90612ece565b6040805160608101825260ff8086168252848116602083015283169181019190915261110a90600190600361235a565b50505050565b6004546001600160a01b0316331461113a5760405162461bcd60e51b81526004016104fc90612ea9565b600555565b6007602052816000526040600020818154811061094e57fe5b600b5481565b6000546001600160a01b031633146111885760405162461bcd60e51b81526004016104fc90612e74565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146111d45760405162461bcd60e51b81526004016104fc90612e74565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6004546001600160a01b031633146112485760405162461bcd60e51b81526004016104fc90612ea9565b60025461125f906001600160a01b03163383611ea7565b336001600160a01b03167f050d1c64cc22ce461b9bc14f6b73852566da02b03c155242bc63169d1fec42aa826040516112989190612fb4565b60405180910390a250565b60018160038110610d3957fe5b6112b86123ed565b6112c061240c565b825160ff9081168252602080850151821690830152604080850151821690830152606080850151909116908201526112f66123ed565b6060828101805160408086018051602080890180518a516201000094850264010000000092830266010000000000009092029190910101909601650100020003009081016001600160401b039081168b52855183518d51908702908a02010163010002009081018216948c0194909452885183518d51908702908a02010163010003009081018216978c0197909752885186518d51908702908a020101630200030090810182169a8c019a909a5288518651845190870299029890980190970101861660808a015280518a51840201610100908101871660a08b015284518b5185020161020001871660c08b015287519a518402909a0161030001861660e08a015283518151840201909101851698880198909852845197518102909701909101821661012086015291519151909402010190911661014082015292915050565b6000546001600160a01b031690565b6004546001600160a01b031633146114705760405162461bcd60e51b81526004016104fc90612ea9565b611478611ced565b156114955760405162461bcd60e51b81526004016104fc90612ae7565b60105460ff166114b75760405162461bcd60e51b81526004016104fc90612ce8565b6004546000908190600160a01b900460ff16436000190140825b600a8110156114ee576114e5600b54610fdf565b506001016114d1565b5060005a905081600c54828860405160200161150d9493929190612a99565b60408051601f19818403018152908290528051602091820120600f805460ff191687830660010160ff811691909117909155600d54919850965061155792859285918b9101612a99565b60408051601f19818403018152908290528051602091820120600f805460ff8884066001019081166101000261ff001990921691909117909155600e5491985096506115a992859285918b9101612a99565b60408051808303601f19018152908290528051602091820120600f805460ff600189850601908116620100000262ff0000199092169190911790915590975095506115fa91849184918a9101612a83565b60408051808303601f190181529181528151602092830120600f805460ff60018985060190811663010000000263ff00000019909216919091178255600b54600090815260069095529290932090975090955061165891600461242a565b50611661611ecb565b600b54600090815260086020526040902061167d91600461245d565b506010805460ff19169055600b546040517fa13e935b188993737b3009d62bd916dcbe9e82d8236d75981eeadf26a1460d3d906116bc90600f90612a45565b60405180910390a2505050505050565b6003546040516331a9108f60e11b81526001600160a01b0390911690636352211e906116fc908490600401612fb4565b60206040518083038186803b15801561171457600080fd5b505afa158015611728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174c9190612551565b6001600160a01b0316336001600160a01b03161461177c5760405162461bcd60e51b81526004016104fc90612c89565b6003546040516336dbd2f960e01b81526001600160a01b03909116906336dbd2f9906117ac908490600401612fb4565b60206040518083038186803b1580156117c457600080fd5b505afa1580156117d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117fc91906126b7565b156118195760405162461bcd60e51b81526004016104fc90612d1f565b600061182482611933565b600354604051630ae169a560e41b81529192506001600160a01b03169063ae169a5090611855908590600401612fb4565b600060405180830381600087803b15801561186f57600080fd5b505af1158015611883573d6000803e3d6000fd5b5050505060008111156118a7576002546118a7906001600160a01b03163383611ea7565b336001600160a01b03167f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf78383604051610fd3929190612fbd565b6008602052816000526040600020818154811061094e57fe5b600c5481565b60008281526008602052604081208054600584900390811061191f57fe5b906000526020600020015490505b92915050565b600354604051631bf1e00f60e01b815260009182916001600160a01b0390911690631bf1e00f90611968908690600401612fb4565b60206040518083038186803b15801561198057600080fd5b505afa158015611994573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b89190612767565b90506119c261240c565b600354604051635f8e26a760e01b81526001600160a01b0390911690635f8e26a7906119f2908790600401612fb4565b60806040518083038186803b158015611a0a57600080fd5b505afa158015611a1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a429190612647565b9050611a4c61240c565b600083815260066020526040808220815160808101928390529290916004918390855b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411611a6f5790505050505050905080600060048110611ab157fe5b602002015160ff16611ad55760405162461bcd60e51b81526004016104fc90612b07565b6000805b6004811015611b1f57838160048110611aee57fe5b602002015160ff16838260048110611b0257fe5b602002015160ff161415611b17578160010191505b600101611ad9565b5060006001821115611c1a57600354604051637bd0606560e11b81526000916001600160a01b03169063f7a0c0ca90611b5c908b90600401612fb4565b60206040518083038186803b158015611b7457600080fd5b505afa158015611b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bac9190612767565b90506000611bf36064611bed60018760040360038110611bc857fe5b602081049091015460ff601f9092166101000a900416611be78b610fdf565b90612130565b9061216a565b9050611c1581611be7611c068a88611901565b611bed8664e8d4a51000612130565b925050505b611c298164e8d4a5100061216a565b979650505050505050565b6004546001600160a01b03163314611c5e5760405162461bcd60e51b81526004016104fc90612ea9565b611c66611ced565b611c825760405162461bcd60e51b81526004016104fc90612f29565b42600e556000600c819055600d819055600f805463ffffffff191690556010805460ff19169055600b80546001019081905560405190917f01c3cbb0d62726ab09d163873ebf9aed99dd8dc08e57bc938f458132fd178cf691a2565b6002546001600160a01b031681565b600f5460ff16151590565b60055481565b6003546001600160a01b031681565b6000546001600160a01b03163314611d375760405162461bcd60e51b81526004016104fc90612e74565b6001600160a01b038116611d5d5760405162461bcd60e51b81526004016104fc90612b8f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b031681565b6000611dd23061219c565b15905090565b600080546001600160a01b0319166001600160a01b03831690811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350565b600082820183811015611e485760405162461bcd60e51b81526004016104fc90612bd5565b9392505050565b61110a846323b872dd60e01b858585604051602401611e7093929190612992565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526121a2565b611ec68363a9059cbb60e01b8484604051602401611e709291906129b6565b505050565b611ed361240c565b611edb6123ed565b604080516080810191829052611f2e91600f90600490826000855b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411611ef657905050505050506112b0565b600b54600081815260096020818152604080842086516001600160401b039081168652818452828620548787528585528885015190911686528184529185205495855292909152939450611fb5918560025b60200201516001600160401b03166001600160401b031681526020019081526020016000205482611e2390919063ffffffff16565b600b546000908152600960205260408120919250611fd69190856003611f80565b600b546000908152600960205260408120919250611ff79190856004611f80565b90506000612010612009846004612130565b8390612231565b600b54600081815260096020818152604080842060a08b01516001600160401b0316855280835290842054948452919052929350909161205291876006611f80565b600b5460009081526009602052604081209192506120739190876007611f80565b600b5460009081526009602052604081209192506120949190876008611f80565b600b54600090815260096020819052604082209293506120b79291908890611f80565b600b5460009081526009602052604081209192506120d8919087600a611f80565b905060006121056120ea856003612130565b6120ff6120f8886006612130565b8590611e23565b90612231565b60408051608081018252600d5481526020810197909752860193909352505060608301525091505090565b60008261213f5750600061192d565b8282028284828161214c57fe5b0414611e485760405162461bcd60e51b81526004016104fc90612dfc565b600080821161218b5760405162461bcd60e51b81526004016104fc90612cb1565b81838161219457fe5b049392505050565b3b151590565b60606121f7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122599092919063ffffffff16565b805190915015611ec6578080602001905181019061221591906126b7565b611ec65760405162461bcd60e51b81526004016104fc90612f4a565b6000828211156122535760405162461bcd60e51b81526004016104fc90612c0c565b50900390565b60606122688484600085612270565b949350505050565b6060824710156122925760405162461bcd60e51b81526004016104fc90612c43565b61229b8561219c565b6122b75760405162461bcd60e51b81526004016104fc90612ef2565b60006060866001600160a01b031685876040516122d49190612913565b60006040518083038185875af1925050503d8060008114612311576040519150601f19603f3d011682016040523d82523d6000602084013e612316565b606091505b5091509150611c2982828660608315612330575081611e48565b8251156123405782518084602001fd5b8160405162461bcd60e51b81526004016104fc9190612ab4565b6001830191839082156123dd5791602002820160005b838211156123ae57835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302612370565b80156123db5782816101000a81549060ff02191690556001016020816000010492830192600103026123ae565b505b506123e99291506124a4565b5090565b604051806101600160405280600b906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b6001830191839082156123dd5791601f016020900482015b828111156123dd578254825591600101919060010190612442565b828054828255906000526020600020908101928215612498579160200282015b8281111561249857825182559160200191906001019061247d565b506123e99291506124bd565b5b808211156123e957805460ff191681556001016124a5565b5b808211156123e957600081556001016124be565b600082601f8301126124e2578081fd5b6124ec6080612fd9565b905080828460808501111561250057600080fd5b60005b600481101561252c57813561251781613062565b83526020928301929190910190600101612503565b50505092915050565b600060208284031215612546578081fd5b8135611e488161304a565b600060208284031215612562578081fd5b8151611e488161304a565b6000806040838503121561257f578081fd5b823561258a8161304a565b946020939093013593505050565b600060208083850312156125aa578182fd5b82356001600160401b038111156125bf578283fd5b8301601f810185136125cf578283fd5b80356125e26125dd82612fff565b612fd9565b81815283810190838501858402850186018910156125fe578687fd5b8694505b83851015612620578035835260019490940193918501918501612602565b50979650505050505050565b60006080828403121561263d578081fd5b611e4883836124d2565b600060808284031215612658578081fd5b82601f830112612666578081fd5b6126706080612fd9565b808385608086011115612681578384fd5b835b60048110156126ac57815161269781613062565b84526020938401939190910190600101612683565b509095945050505050565b6000602082840312156126c8578081fd5b81518015158114611e48578182fd5b60008060008060008060c087890312156126ef578182fd5b86356126fa8161304a565b9550602087013561270a8161304a565b945060408701359350606087013561272181613062565b925060808701356127318161304a565b915060a08701356127418161304a565b809150509295509295509295565b600060208284031215612760578081fd5b5035919050565b600060208284031215612778578081fd5b5051919050565b60008060408385031215612791578182fd5b823591506020808401356001600160401b038111156127ae578283fd5b8401601f810186136127be578283fd5b80356127cc6125dd82612fff565b818152838101908385016080808502860187018b10156127ea578788fd5b8795505b84861015612816576128008b836124d2565b84526001959095019492860192908101906127ee565b5096999098509650505050505050565b60008060a08385031215612838578182fd5b8235915061284984602085016124d2565b90509250929050565b60008060408385031215612864578182fd5b50508035926020909101359150565b60008060408385031215612885578182fd5b8235915060208301356001600160401b03811681146128a2578182fd5b809150509250929050565b6000602082840312156128be578081fd5b8135611e4881613062565b6000806000606084860312156128dd578081fd5b83356128e881613062565b925060208401356128f881613062565b9150604084013561290881613062565b809150509250925092565b6000825161292581846020870161301e565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b038516815260e0810160208083018660005b600481101561297c57815160ff168352918301919083019060010161295c565b5050505060a082019390935260c0015292915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015612a07578351835292840192918401916001016129eb565b50909695505050505050565b6101608101818360005b600b81101561252c5781516001600160401b0316835260209283019290910190600101612a1d565b905460ff8082168352600882901c81166020840152601082901c8116604084015260189190911c16606082015260800190565b901515815260200190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b6000602082528251806020840152612ad381604085016020870161301e565b601f01601f19169190910160400192915050565b60208082526006908201526572657365743f60d01b604082015260600190565b6020808252600a90820152691b9bdd08191c985dd95960b21b604082015260600190565b602080825260139082015272657863656564206e756d6265722073636f706560681b604082015260600190565b60208082526019908201527f5f6973737565496e646578203c3d206973737565496e64657800000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252600e908201526d3737ba10333937b69037bbb732b960911b604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526019908201527f656e7465722064726177696e6720706861736520666972737400000000000000604082015260600190565b60208082526007908201526618db185a5b595960ca1b604082015260600190565b60208082526018908201527f64726177696e672c2063616e206e6f7420627579206e6f770000000000000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526019908201527f7072696365206d7573742061626f7665206d696e507269636500000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526017908201527f6472617765642c2063616e206e6f7420627579206e6f77000000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600b908201526a61646d696e3a207775743f60a81b604082015260600190565b6020808252600a90820152690657863656564203130360b41b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600790820152666472617765643f60c81b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b602080825260069082015265191c985dd95960d21b604082015260600190565b90815260200190565b918252602082015260400190565b60ff91909116815260200190565b6040518181016001600160401b0381118282101715612ff757600080fd5b604052919050565b60006001600160401b03821115613014578081fd5b5060209081020190565b60005b83811015613039578181015183820152602001613021565b8381111561110a5750506000910152565b6001600160a01b038116811461305f57600080fd5b50565b60ff8116811461305f57600080fdfea2646970667358221220236a45781705116d34e0ab33543733fba4d043a35ccc02e265d0d6780027e46864736f6c634300060c0033

Deployed ByteCode Sourcemap

78986:15681:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;80938:483;;;;;;:::i;:::-;;:::i;:::-;;85528:1072;;;;;;:::i;:::-;;:::i;80295:28::-;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;80258:30;;;:::i;82486:125::-;;;:::i;80127:46::-;;;;;;:::i;:::-;;:::i;86608:1329::-;;;;;;:::i;:::-;;:::i;80020:71::-;;;;;;:::i;:::-;;:::i;94262:100::-;;;;;;:::i;:::-;;:::i;79473:22::-;;;:::i;:::-;;;;;;;:::i;80393:24::-;;;:::i;:::-;;;;;;;:::i;80332:30::-;;;;;;:::i;:::-;;:::i;88398:689::-;;;;;;:::i;:::-;;:::i;92345:305::-;;;;;;:::i;:::-;;:::i;79677:51::-;;;;;;:::i;:::-;;:::i;94412:250::-;;;;;;:::i;:::-;;:::i;94117:92::-;;;;;;:::i;:::-;;:::i;79764:49::-;;;;;;:::i;:::-;;:::i;80182:29::-;;;:::i;93717:105::-;;;;;;:::i;:::-;;:::i;70005:148::-;;;:::i;93893:171::-;;;;;;:::i;:::-;;:::i;79238:26::-;;;;;;:::i;:::-;;:::i;89095:1531::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;69365:79::-;;;:::i;:::-;;;;;;;:::i;82690:2281::-;;;;;;:::i;:::-;;:::i;87945:445::-;;;;;;:::i;:::-;;:::i;79914:51::-;;;;;;:::i;:::-;;:::i;80218:33::-;;;:::i;92155:182::-;;;;;;:::i;:::-;;:::i;92658:999::-;;;;;;:::i;:::-;;:::i;81858:620::-;;;:::i;79304:18::-;;;:::i;81758:92::-;;;:::i;79558:23::-;;;:::i;79365:28::-;;;:::i;70308:244::-;;;;;;:::i;:::-;;:::i;79421:27::-;;;:::i;80938:483::-;78350:13;;-1:-1:-1;;;78350:13:0;;;;;:33;;;78367:16;:14;:16::i;:::-;78350:50;;;-1:-1:-1;78388:12:0;;-1:-1:-1;;;78388:12:0;;;;78387:13;78350:50;78342:109;;;;-1:-1:-1;;;78342:109:0;;;;;;;:::i;:::-;;;;;;;;;78464:19;78487:13;-1:-1:-1;;;78487:13:0;;;;78486:14;78511:101;;;;78546:13;:20;;-1:-1:-1;;;;;;;;78546:20:0;;;-1:-1:-1;;;78546:20:0;78581:19;-1:-1:-1;;;78581:19:0;;;78511:101;81160:4:::1;:12:::0;;-1:-1:-1;;;;;;81160:12:0;;::::1;-1:-1:-1::0;;;;;81160:12:0;;::::1;::::0;;;::::1;::::0;;;81183:10:::1;:21:::0;;;::::1;::::0;;::::1;;::::0;;81215:8:::1;:20:::0;;;81246:9:::1;:22:::0;;-1:-1:-1;;;;81246:22:0::1;-1:-1:-1::0;;;81246:22:0::1;::::0;::::1;;;81279:28:::0;;::::1;::::0;;::::1;::::0;;;::::1;::::0;;81334:15:::1;81318:13;:31:::0;81360:25:::1;::::0;;::::1;::::0;::::1;::::0;;81374:2:::1;81360:25:::0;;81246:9:::1;81360:25;::::0;::::1;::::0;81382:2:::1;81360:25:::0;;;;;;;::::1;::::0;-1:-1:-1;;81360:25:0;::::1;:::i;:::-;;81396:17;81406:6;81396:9;:17::i;:::-;78642:14:::0;78638:68;;;78689:5;78673:21;;-1:-1:-1;;;;78673:21:0;;;78638:68;80938:483;;;;;;;:::o;85528:1072::-;81633:8;:6;:8::i;:::-;81632:9;81624:45;;;;-1:-1:-1;;;81624:45:0;;;;;;;:::i;:::-;81689:12;;;;81688:13;81680:50;;;;-1:-1:-1;;;81680:50:0;;;;;;;:::i;:::-;85637:8:::1;;85627:6;:18;;85618:57;;;;-1:-1:-1::0;;;85618:57:0::1;;;;;;;:::i;:::-;85691:6;85686:113;85707:1;85703;:5;85686:113;;;85754:9;::::0;;-1:-1:-1;;;85754:9:0;::::1;;;::::0;85739:8;;85748:1;;85739:11;::::1;;;;;;;;;:24;;;;85730:57;;;;-1:-1:-1::0;;;85730:57:0::1;;;;;;;:::i;:::-;85710:3;;85686:113;;;-1:-1:-1::0;85827:10:0::1;::::0;85883::::1;::::0;85827:67:::1;::::0;-1:-1:-1;;;85827:67:0;;85809:15:::1;::::0;-1:-1:-1;;;;;85827:10:0::1;::::0;:25:::1;::::0;:67:::1;::::0;85853:10:::1;::::0;85865:8;;85875:6;;85827:67:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;85917:10;::::0;85905:23:::1;::::0;;;:11:::1;:23;::::0;;;;;;;:37;;::::1;::::0;::::1;::::0;;;;;;;;::::1;::::0;;;85966:10:::1;85957:20:::0;;:8:::1;:20:::0;;;;;:27;85809:85;;-1:-1:-1;85953:100:0::1;;86023:14;::::0;;86040:1:::1;86023:18;86006:35:::0;;85953:100:::1;86072:10;86063:20;::::0;;;:8:::1;:20;::::0;;;;;;:34;;::::1;::::0;::::1;::::0;;;;;;;::::1;::::0;;;86122:11:::1;::::0;:23:::1;::::0;86138:6;86122:15:::1;:23::i;:::-;86108:11;:37:::0;86172:15:::1;86156:13;:31:::0;86198:50:::1;;:::i;:::-;86251:32;86274:8;86251:22;:32::i;:::-;86198:85;;86299:6;86294:183;79179:2;86311:23:::0;::::1;86294:183;;;86405:60;86458:6;86405:16;:28;86422:10;;86405:28;;;;;;;;;;;:48;86434:15;86450:1;86434:18;;;;;;;;;;;-1:-1:-1::0;;;;;86405:48:0::1;-1:-1:-1::0;;;;;86405:48:0::1;;;;;;;;;;;;;:52;;:60;;;;:::i;:::-;86373:10;::::0;;86356:28:::1;::::0;;;:16:::1;:28;::::0;;;;;86385:15;;86401:1;;86385:18;::::1;;;;;;::::0;;::::1;::::0;;;::::1;::::0;-1:-1:-1;;;;;86356:48:0::1;::::0;;;::::1;::::0;;;;;;-1:-1:-1;86356:48:0;:109;86336:3:::1;;86294:183;;;-1:-1:-1::0;86487:4:0::1;::::0;:65:::1;::::0;-1:-1:-1;;;;;86487:4:0::1;86517:10;86538:4;86545:6:::0;86487:21:::1;:65::i;:::-;86572:10;-1:-1:-1::0;;;;;86568:24:0::1;;86584:7;86568:24;;;;;;:::i;:::-;;;;;;;;81741:1;;85528:1072:::0;;:::o;80295:28::-;;;;:::o;80258:30::-;;;;:::o;82486:125::-;81531:12;;-1:-1:-1;;;;;81531:12:0;81517:10;:26;81509:50;;;;-1:-1:-1;;;81509:50:0;;;;;;;:::i;:::-;82554:8:::1;:6;:8::i;:::-;82553:9;82545:28;;;;-1:-1:-1::0;;;82545:28:0::1;;;;;;;:::i;:::-;82584:12;:19:::0;;-1:-1:-1;;82584:19:0::1;82599:4;82584:19;::::0;;82486:125::o;80127:46::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;86608:1329::-;81633:8;:6;:8::i;:::-;81632:9;81624:45;;;;-1:-1:-1;;;81624:45:0;;;;;;;:::i;:::-;81689:12;;;;81688:13;81680:50;;;;-1:-1:-1;;;81680:50:0;;;;;;;:::i;:::-;86725:8:::1;;86715:6;:18;;86706:57;;;;-1:-1:-1::0;;;86706:57:0::1;;;;;;;:::i;:::-;86774:18;86813:6:::0;86808:994:::1;86829:8;:15;86825:1;:19;86808:994;;;86871:6;86866:146;86887:1;86883;:5;86866:146;;;86941:9;;;;;;;;;;;86923:27;;:8;86932:1;86923:11;;;;;;;;;;;;;;86935:1;86923:14;;;;;;;;;;;:27;;;;:49;;;;;86971:1;86954:8;86963:1;86954:11;;;;;;;;;;;;;;86966:1;86954:14;;;;;;;;;;;:18;;;86923:49;86914:82;;;;-1:-1:-1::0;;;86914:82:0::1;;;;;;;:::i;:::-;86890:3;;86866:146;;;-1:-1:-1::0;87044:10:0::1;::::0;87082:11;;87026:15:::1;::::0;-1:-1:-1;;;;;87044:10:0::1;::::0;:25:::1;::::0;87070:10:::1;::::0;87082:8;;87091:1;;87082:11;::::1;;;;;;;;;;;87095:6;87103:10;;87044:70;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;87141:10;::::0;87129:23:::1;::::0;;;:11:::1;:23;::::0;;;;;;;:37;;::::1;::::0;::::1;::::0;;;;;;;;::::1;::::0;;;87194:10:::1;87185:20:::0;;:8:::1;:20:::0;;;;;:27;87026:88;;-1:-1:-1;87181:108:0::1;;87255:14;::::0;;87272:1:::1;87255:18;87238:35:::0;;87181:108:::1;87312:10;87303:20;::::0;;;:8:::1;:20;::::0;;;;;;:34;;::::1;::::0;::::1;::::0;;;;;;;::::1;::::0;;;87366:11:::1;::::0;:23:::1;::::0;87382:6;87366:15:::1;:23::i;:::-;87352:11;:37:::0;87420:15:::1;87404:13;:31:::0;87463:22:::1;:10:::0;87478:6;87463:14:::1;:22::i;:::-;87450:35;;87500:49;;:::i;:::-;87552:35;87575:8;87584:1;87575:11;;;;;;;;;;;;;;87552:22;:35::i;:::-;87500:87;;87607:6;87602:189;79179:2;87619:23:::0;::::1;87602:189;;;87716:59;87768:6;87716:16;:28;87733:10;;87716:28;;;;;;;;;;;:47;87745:14;87760:1;87745:17;;;;;;87716:59;87685:10;::::0;;87668:28:::1;::::0;;;:16:::1;:28;::::0;;;;;87697:14;;87712:1;;87697:17;::::1;;;;;;::::0;;::::1;::::0;;;::::1;::::0;-1:-1:-1;;;;;87668:47:0::1;::::0;;;::::1;::::0;;;;;;-1:-1:-1;87668:47:0;:107;87644:3:::1;;87602:189;;;-1:-1:-1::0;;;86846:3:0::1;;86808:994;;;-1:-1:-1::0;87812:4:0::1;::::0;:69:::1;::::0;-1:-1:-1;;;;;87812:4:0::1;87842:10;87863:4;87870:10:::0;87812:21:::1;:69::i;:::-;87906:10;-1:-1:-1::0;;;;;87897:32:0::1;;87918:10;87897:32;;;;;;:::i;:::-;;;;;;;;81741:1;86608:1329:::0;;:::o;80020:71::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;94262:100::-;81531:12;;-1:-1:-1;;;;;81531:12:0;81517:10;:26;81509:50;;;;-1:-1:-1;;;81509:50:0;;;;;;;:::i;:::-;94332:9:::1;:22:::0;;::::1;::::0;;::::1;-1:-1:-1::0;;;94332:22:0::1;-1:-1:-1::0;;;;94332:22:0;;::::1;::::0;;;::::1;::::0;;94262:100::o;79473:22::-;;;-1:-1:-1;;;79473:22:0;;;;;:::o;80393:24::-;;;;;;:::o;80332:30::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;88398:689::-;88466:19;88505:6;88500:375;88521:8;:15;88517:1;:19;88500:375;;;88581:10;;88600:11;;-1:-1:-1;;;;;88581:10:0;;;;:18;;88600:8;;88609:1;;88600:11;;;;;;;;;;;;88581:31;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;88567:45:0;:10;-1:-1:-1;;;;;88567:45:0;;88558:73;;;;-1:-1:-1;;;88558:73:0;;;;;;;:::i;:::-;88656:10;;88682:11;;-1:-1:-1;;;;;88656:10:0;;;;:25;;88682:8;;88691:1;;88682:11;;;;;;;;;;;;88656:38;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;88655:39;88646:60;;;;-1:-1:-1;;;88646:60:0;;;;;;;:::i;:::-;88721:14;88738:26;88752:8;88761:1;88752:11;;;;;;;;;;;;;;88738:13;:26::i;:::-;88721:43;-1:-1:-1;88782:8:0;;88779:85;;88825:23;:6;88836:11;88825:10;:23::i;:::-;88811:37;;88779:85;-1:-1:-1;88538:3:0;;88500:375;;;-1:-1:-1;88885:10:0;;:37;;-1:-1:-1;;;88885:37:0;;-1:-1:-1;;;;;88885:10:0;;;;:27;;:37;;88913:8;;88885:37;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88948:1;88936:11;:13;88933:96;;;88966:4;;:51;;-1:-1:-1;;;;;88966:4:0;88992:10;89005:11;88966:17;:51::i;:::-;89055:10;-1:-1:-1;;;;;89044:35:0;;89067:11;89044:35;;;;;;:::i;:::-;;;;;;;;88398:689;;:::o;92345:305::-;92411:7;92455:10;;92440:11;:25;;92431:64;;;;-1:-1:-1;;;92431:64:0;;;;;;;:::i;:::-;92512:8;:6;:8::i;:::-;92511:9;:38;;;;;92539:10;;92524:11;:25;92511:38;92508:88;;;-1:-1:-1;92573:11:0;;92566:18;;92508:88;92613:26;;;;:13;:26;;;;;:29;;:26;;;:29;;;;;;;;;;;;92606:36;;92345:305;;;;:::o;79677:51::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;79677:51:0;;-1:-1:-1;79677:51:0:o;94412:250::-;81531:12;;-1:-1:-1;;;;;81531:12:0;81517:10;:26;81509:50;;;;-1:-1:-1;;;81509:50:0;;;;;;;:::i;:::-;94573:3:::1;94559:11;94545;94531;:25;:39;:45;;;94522:69;;;;-1:-1:-1::0;;;94522:69:0::1;;;;;;;:::i;:::-;94602:52;::::0;;::::1;::::0;::::1;::::0;;::::1;::::0;;::::1;::::0;;;;::::1;;::::0;::::1;::::0;;::::1;::::0;;;;;;;::::1;::::0;:10:::1;::::0;:52:::1;;:::i;:::-;;94412:250:::0;;;:::o;94117:92::-;81531:12;;-1:-1:-1;;;;;81531:12:0;81517:10;:26;81509:50;;;;-1:-1:-1;;;81509:50:0;;;;;;;:::i;:::-;94184:8:::1;:17:::0;94117:92::o;79764:49::-;;;;;;;;;;;;;;;;;;80182:29;;;;:::o;93717:105::-;69577:6;;-1:-1:-1;;;;;69577:6:0;69587:10;69577:20;69569:65;;;;-1:-1:-1;;;69569:65:0;;;;;;;:::i;:::-;93786:12:::1;:28:::0;;-1:-1:-1;;;;;;93786:28:0::1;-1:-1:-1::0;;;;;93786:28:0;;;::::1;::::0;;;::::1;::::0;;93717:105::o;70005:148::-;69577:6;;-1:-1:-1;;;;;69577:6:0;69587:10;69577:20;69569:65;;;;-1:-1:-1;;;69569:65:0;;;;;;;:::i;:::-;70112:1:::1;70096:6:::0;;70075:40:::1;::::0;-1:-1:-1;;;;;70096:6:0;;::::1;::::0;70075:40:::1;::::0;70112:1;;70075:40:::1;70143:1;70126:19:::0;;-1:-1:-1;;;;;;70126:19:0::1;::::0;;70005:148::o;93893:171::-;81531:12;;-1:-1:-1;;;;;81531:12:0;81517:10;:26;81509:50;;;;-1:-1:-1;;;81509:50:0;;;;;;;:::i;:::-;93961:4:::1;::::0;:47:::1;::::0;-1:-1:-1;;;;;93961:4:0::1;93987:10;94000:7:::0;93961:17:::1;:47::i;:::-;94036:10;-1:-1:-1::0;;;;;94024:32:0::1;;94048:7;94024:32;;;;;;:::i;:::-;;;;;;;;93893:171:::0;:::o;79238:26::-;;;;;;;;;89095:1531;89172:34;;:::i;:::-;89219:27;;:::i;:::-;89278:9;;89271:17;;;;89257:31;;89278:9;89320;;;;89313:17;;89299:13;;;:31;89362:9;;;;;89355:17;;89341:13;;;:31;89404:9;;;;;89397:17;;;89383:13;;;:31;89427:41;;:::i;:::-;89635:13;;;;;;89603;;;;;;89635;89555;;;;;89491;;89603:21;;;;89555:29;;;;89491:37;;;;:93;;;;:133;:157;;;:141;:157;;;-1:-1:-1;;;;;89479:169:0;;;;;89752:13;;89721;;89673;;89721:21;;;89673:29;;;:69;:92;:77;:92;;;89661:104;;:9;;;:104;;;;89867:13;;89836;;89788;;89836:21;;;89788:29;;;:69;:92;:77;:92;;;89776:104;;:9;;;:104;;;;89983:13;;89951;;89903;;89951:21;;;89903:29;;;:69;:93;:77;:93;;;89891:105;;:9;;;:105;;;;90123:13;;90091;;90043;;90091:21;;;90043:29;;90019:93;;;;:117;;;;90007:129;;:9;;;:129;90192:13;;90161;;:21;;:44;90175:3;90161:44;;;90149:56;;:9;;;:56;90259:13;;90228;;:21;;:44;90252:5;90228:44;90216:56;;:9;;;:56;90326:13;;90295;;:21;;:44;;;90319:5;90295:44;90283:56;;:9;;;:56;90410:13;;90378;;:21;;90362:61;;;;90350:73;;:9;;;:73;;;;90494:13;;90462;;:21;;90446:61;;;;;;90434:73;;:9;;;:73;90579:13;;90547;;:21;;;90531:61;;90518:74;;;:10;;;:74;89479:169;:6;-1:-1:-1;;89095:1531:0:o;69365:79::-;69403:7;69430:6;-1:-1:-1;;;;;69430:6:0;69365:79;:::o;82690:2281::-;81531:12;;-1:-1:-1;;;;;81531:12:0;81517:10;:26;81509:50;;;;-1:-1:-1;;;81509:50:0;;;;;;;:::i;:::-;82777:8:::1;:6;:8::i;:::-;82776:9;82768:28;;;;-1:-1:-1::0;;;82768:28:0::1;;;;;;;:::i;:::-;82815:12;::::0;::::1;;82807:50;;;;-1:-1:-1::0;;;82807:50:0::1;;;;;;;:::i;:::-;82949:9;::::0;82868:19:::1;::::0;;;-1:-1:-1;;;82949:9:0;::::1;;;83000:12;-1:-1:-1::0;;83000:14:0;82990:25:::1;82868:19:::0;83064:84:::1;83085:2;83081:1;:6;83064:84;;;83109:27;83125:10;;83109:15;:27::i;:::-;-1:-1:-1::0;83089:3:0::1;;83064:84;;;;83158:16;83177:9;83158:28;;83280:10;83309:14;;83342:8;83369:21;83251:154;;;;;;;;;;;:::i;:::-;;::::0;;-1:-1:-1;;83251:154:0;;::::1;::::0;;;;;;;83227:189;;83251:154:::1;83227:189:::0;;::::1;::::0;83550:14:::1;:38:::0;;-1:-1:-1;;83550:38:0::1;83506:30:::0;;::::1;83537:1;83502:37;83550:38;::::0;::::1;::::0;;;::::1;::::0;;;83711:11:::1;::::0;83227:189;;-1:-1:-1;83502:37:0;-1:-1:-1;83653:151:0::1;::::0;83682:10;;83741:8;;83768:21;;83653:151:::1;;:::i;:::-;;::::0;;-1:-1:-1;;83653:151:0;;::::1;::::0;;;;;;;83629:186;;83653:151:::1;83629:186:::0;;::::1;::::0;83949:14:::1;:38:::0;;::::1;83905:30:::0;;::::1;83936:1;83901:37;83949:38:::0;;::::1;;;-1:-1:-1::0;;83949:38:0;;::::1;::::0;;;::::1;::::0;;;84110:13:::1;::::0;83629:186;;-1:-1:-1;83901:37:0;-1:-1:-1;84052:153:0::1;::::0;84081:10;;84142:8;;84169:21;;84052:153:::1;;:::i;:::-;;::::0;;;;::::1;-1:-1:-1::0;;84052:153:0;;;;;;;84028:188;;84052:153:::1;84028:188:::0;;::::1;::::0;84350:14:::1;:38:::0;;::::1;84337:1;84306:30:::0;;::::1;84302:37;84350:38:::0;;::::1;::::0;::::1;-1:-1:-1::0;;84350:38:0;;::::1;::::0;;;::::1;::::0;;;84028:188;;-1:-1:-1;84302:37:0;-1:-1:-1;84453:121:0::1;::::0;84482:10;;84511:8;;84538:21;;84453:121:::1;;:::i;:::-;;::::0;;;;::::1;-1:-1:-1::0;;84453:121:0;;;;;;84429:156;;84453:121:::1;84429:156:::0;;::::1;::::0;84719:14:::1;:38:::0;;::::1;84706:1;84675:30:::0;;::::1;84671:37;84719:38:::0;;::::1;::::0;::::1;-1:-1:-1::0;;84719:38:0;;::::1;::::0;;;::::1;::::0;;84783:10:::1;::::0;84719:17;84768:26;;;:14:::1;:26:::0;;;;;;;84429:156;;-1:-1:-1;84671:37:0;;-1:-1:-1;84768:43:0::1;::::0;::::1;;:::i;:::-;;84850:31;:29;:31::i;:::-;84836:10;::::0;84822:25:::1;::::0;;;:13:::1;:25;::::0;;;;:59:::1;::::0;::::1;;:::i;:::-;-1:-1:-1::0;84892:12:0::1;:20:::0;;-1:-1:-1;;84892:20:0::1;::::0;;84936:10:::1;::::0;84928:35:::1;::::0;::::1;::::0;::::1;::::0;84948:14:::1;::::0;84928:35:::1;:::i;:::-;;;;;;;;81570:1;;;;;82690:2281:::0;:::o;87945:445::-;88026:10;;:28;;-1:-1:-1;;;88026:28:0;;-1:-1:-1;;;;;88026:10:0;;;;:18;;:28;;88045:8;;88026:28;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;88012:42:0;:10;-1:-1:-1;;;;;88012:42:0;;88004:69;;;;-1:-1:-1;;;88004:69:0;;;;;;;:::i;:::-;88094:10;;:35;;-1:-1:-1;;;88094:35:0;;-1:-1:-1;;;;;88094:10:0;;;;:25;;:35;;88120:8;;88094:35;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;88093:36;88084:57;;;;-1:-1:-1;;;88084:57:0;;;;;;;:::i;:::-;88152:14;88169:23;88183:8;88169:13;:23::i;:::-;88203:10;;:32;;-1:-1:-1;;;88203:32:0;;88152:40;;-1:-1:-1;;;;;;88203:10:0;;:22;;:32;;88226:8;;88203:32;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88256:1;88249:6;:8;88246:86;;;88274:4;;:46;;-1:-1:-1;;;;;88274:4:0;88300:10;88313:6;88274:17;:46::i;:::-;88353:10;-1:-1:-1;;;;;88347:35:0;;88365:8;88375:6;88347:35;;;;;;;:::i;79914:51::-;;;;;;;;;;;;;;;;;;80218:33;;;;:::o;92155:182::-;92255:7;92282:26;;;:13;:26;;;;;:47;;92309:1;:19;;;;92282:47;;;;;;;;;;;;;;92275:54;;92155:182;;;;;:::o;92658:999::-;92761:10;;:41;;-1:-1:-1;;;92761:41:0;;92719:7;;;;-1:-1:-1;;;;;92761:10:0;;;;:31;;:41;;92793:8;;92761:41;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;92739:63;;92813:30;;:::i;:::-;92846:10;;:38;;-1:-1:-1;;;92846:38:0;;-1:-1:-1;;;;;92846:10:0;;;;:28;;:38;;92875:8;;92846:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;92813:71;;92895:31;;:::i;:::-;92929:27;;;;:14;:27;;;;;;92895:61;;;;;;;;;;92929:27;;92895:61;;92929:27;;92895:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;92975:15;92991:1;92975:18;;;;;;;;;;;:23;;92967:46;;;;-1:-1:-1;;;92967:46:0;;;;;;;:::i;:::-;93026:22;93068:6;93063:188;93084:21;93080:1;:25;93063:188;;;93153:14;93168:1;93153:17;;;;;;;;;;;93131:39;;:15;93147:1;93131:18;;;;;;;;;;;:39;;;93127:113;;;93207:14;93223:1;93207:17;93191:33;;93127:113;93107:3;;93063:188;;;;93261:14;93311:1;93294:14;:18;93290:326;;;93346:10;;:37;;-1:-1:-1;;;93346:37:0;;93329:14;;-1:-1:-1;;;;;93346:10:0;;:27;;:37;;93374:8;;93346:37;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;93329:54;;93398:18;93419:71;93486:3;93419:62;93452:10;93465:14;93463:1;:16;93452:28;;;;;;;;;;;;;;;;;;;;;;;;93419;93435:11;93419:15;:28::i;:::-;:32;;:62::i;:::-;:66;;:71::i;:::-;93398:92;;93514:90;93593:10;93514:74;93535:52;93559:11;93572:14;93535:23;:52::i;:::-;93514:16;:6;93525:4;93514:10;:16::i;:90::-;93505:99;;93290:326;;;93633:16;:6;93644:4;93633:10;:16::i;:::-;93626:23;92658:999;-1:-1:-1;;;;;;;92658:999:0:o;81858:620::-;81531:12;;-1:-1:-1;;;;;81531:12:0;81517:10;:26;81509:50;;;;-1:-1:-1;;;81509:50:0;;;;;;;:::i;:::-;81913:8:::1;:6;:8::i;:::-;81905:28;;;;-1:-1:-1::0;;;81905:28:0::1;;;;;;;:::i;:::-;81960:15;81944:13;:31:::0;82003:1:::1;81986:14;:18:::0;;;82015:11:::1;:15:::0;;;82041:14:::1;:19:::0;;-1:-1:-1;;82131:19:0;;;82161:12:::1;:20:::0;;-1:-1:-1;;82161:20:0::1;::::0;;82205:10:::1;::::0;;-1:-1:-1;82205:13:0::1;82192:26:::0;;;;82453:17:::1;::::0;82205:13;;82453:17:::1;::::0;::::1;81858:620::o:0;79304:18::-;;;-1:-1:-1;;;;;79304:18:0;;:::o;81758:92::-;81820:14;:17;;;:22;;;81758:92::o;79558:23::-;;;;:::o;79365:28::-;;;-1:-1:-1;;;;;79365:28:0;;:::o;70308:244::-;69577:6;;-1:-1:-1;;;;;69577:6:0;69587:10;69577:20;69569:65;;;;-1:-1:-1;;;69569:65:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;70397:22:0;::::1;70389:73;;;;-1:-1:-1::0;;;70389:73:0::1;;;;;;;:::i;:::-;70499:6;::::0;;70478:38:::1;::::0;-1:-1:-1;;;;;70478:38:0;;::::1;::::0;70499:6;::::1;::::0;70478:38:::1;::::0;::::1;70527:6;:17:::0;;-1:-1:-1;;;;;;70527:17:0::1;-1:-1:-1::0;;;;;70527:17:0;;;::::1;::::0;;;::::1;::::0;;70308:244::o;79421:27::-;;;-1:-1:-1;;;;;79421:27:0;;:::o;78806:114::-;78854:4;78879:33;78906:4;78879:18;:33::i;:::-;78878:34;78871:41;;78806:114;:::o;69153:131::-;69207:6;:14;;-1:-1:-1;;;;;;69207:14:0;-1:-1:-1;;;;;69207:14:0;;;;;;;69237:39;;69207:14;;:6;69237:39;;69207:6;;69237:39;69153:131;:::o;13049:179::-;13107:7;13139:5;;;13163:6;;;;13155:46;;;;-1:-1:-1;;;13155:46:0;;;;;;;:::i;:::-;13219:1;13049:179;-1:-1:-1;;;13049:179:0:o;74026:205::-;74127:96;74147:5;74177:27;;;74206:4;74212:2;74216:5;74154:68;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;74154:68:0;;;;;;;;;;;;;;-1:-1:-1;;;;;74154:68:0;-1:-1:-1;;;;;;74154:68:0;;;;;;;;;;74127:19;:96::i;73841:177::-;73924:86;73944:5;73974:23;;;73999:2;74003:5;73951:58;;;;;;;;;:::i;73924:86::-;73841:177;;;:::o;90634:1513::-;90698:17;;:::i;:::-;90728:49;;:::i;:::-;90780:38;;;;;;;;;;;;90803:14;;90780:38;;90803:14;-1:-1:-1;90780:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:22;:38::i;:::-;90870:10;;90831:19;90853:28;;;:16;:28;;;;;;;;90882:17;;-1:-1:-1;;;;;90853:47:0;;;;;;;;;;;;90941:28;;;;;;90970:17;;;;90941:47;;;;;;;;;;;;91041:28;;;;;;;90882:17;;-1:-1:-1;91019:70:0;;90882:17;91085:1;91070:17;;;;;-1:-1:-1;;;;;91041:47:0;-1:-1:-1;;;;;91041:47:0;;;;;;;;;;;;;91019:17;:21;;:70;;;;:::i;:::-;91159:10;;91142:28;;;;:16;:28;;;;;90999:90;;-1:-1:-1;91120:70:0;;91142:28;91171:14;91186:1;91171:17;;91120:70;91260:10;;91243:28;;;;:16;:28;;;;;91100:90;;-1:-1:-1;91221:70:0;;91243:28;91272:14;91287:1;91272:17;;91221:70;91201:90;-1:-1:-1;91304:19:0;91326:41;91348:18;:11;91364:1;91348:15;:18::i;:::-;91326:17;;:21;:41::i;:::-;91425:10;;91380:25;91408:28;;;:16;:28;;;;;;;;91437:17;;;;-1:-1:-1;;;;;91408:47:0;;;;;;;;;;91508:28;;;;;;91304:63;;-1:-1:-1;91408:47:0;;91486:70;;91437:14;91552:1;91537:17;;91486:70;91626:10;;91609:28;;;;:16;:28;;;;;91466:90;;-1:-1:-1;91587:70:0;;91609:28;91638:14;91653:1;91638:17;;91587:70;91727:10;;91710:28;;;;:16;:28;;;;;91567:90;;-1:-1:-1;91688:70:0;;91710:28;91739:14;91754:1;91739:17;;91688:70;91828:10;;91811:28;;;;:16;:28;;;;;;;91668:90;;-1:-1:-1;91789:70:0;;91811:28;;91840:14;;:17;;91789:70;91929:10;;91912:28;;;;:16;:28;;;;;91769:90;;-1:-1:-1;91890:71:0;;91912:28;91941:14;91956:2;91941:18;;91890:71;91870:91;-1:-1:-1;91974:19:0;91996:71;92042:24;:17;92064:1;92042:21;:24::i;:::-;91996:41;92018:18;:11;92034:1;92018:15;:18::i;:::-;91996:17;;:21;:41::i;:::-;:45;;:71::i;:::-;92080:59;;;;;;;;92088:11;;92080:59;;;;;;;;;;;;;;;-1:-1:-1;;92080:59:0;;;;-1:-1:-1;92080:59:0;-1:-1:-1;;90634:1513:0;:::o;13928:220::-;13986:7;14010:6;14006:20;;-1:-1:-1;14025:1:0;14018:8;;14006:20;14049:5;;;14053:1;14049;:5;:1;14073:5;;;;;:10;14065:56;;;;-1:-1:-1;;;14065:56:0;;;;;;;:::i;14626:153::-;14684:7;14716:1;14712;:5;14704:44;;;;-1:-1:-1;;;14704:44:0;;;;;;;:::i;:::-;14770:1;14766;:5;;;;;;;14626:153;-1:-1:-1;;;14626:153:0:o;18402:422::-;18769:20;18808:8;;;18402:422::o;76146:761::-;76570:23;76596:69;76624:4;76596:69;;;;;;;;;;;;;;;;;76604:5;-1:-1:-1;;;;;76596:27:0;;;:69;;;;;:::i;:::-;76680:17;;76570:95;;-1:-1:-1;76680:21:0;76676:224;;76822:10;76811:30;;;;;;;;;;;;:::i;:::-;76803:85;;;;-1:-1:-1;;;76803:85:0;;;;;;;:::i;13511:158::-;13569:7;13602:1;13597;:6;;13589:49;;;;-1:-1:-1;;;13589:49:0;;;;;;;:::i;:::-;-1:-1:-1;13656:5:0;;;13511:158::o;21320:195::-;21423:12;21455:52;21477:6;21485:4;21491:1;21494:12;21455:21;:52::i;:::-;21448:59;21320:195;-1:-1:-1;;;;21320:195:0:o;22372:530::-;22499:12;22557:5;22532:21;:30;;22524:81;;;;-1:-1:-1;;;22524:81:0;;;;;;;:::i;:::-;22624:18;22635:6;22624:10;:18::i;:::-;22616:60;;;;-1:-1:-1;;;22616:60:0;;;;;;;:::i;:::-;22750:12;22764:23;22791:6;-1:-1:-1;;;;;22791:11:0;22811:5;22819:4;22791:33;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22749:75;;;;22842:52;22860:7;22869:10;22881:12;25027;25056:7;25052:595;;;-1:-1:-1;25087:10:0;25080:17;;25052:595;25201:17;;:21;25197:439;;25464:10;25458:17;25525:15;25512:10;25508:2;25504:19;25497:44;25412:148;25607:12;25600:20;;-1:-1:-1;;;25600:20:0;;;;;;;;:::i;-1:-1:-1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1830:610;;1943:3;1936:4;1928:6;1924:17;1920:27;1910:2;;-1:-1;;1951:12;1910:2;2004:76;51943:17;2004:76;:::i;:::-;1995:85;;2086:16;2145:17;2203:3;51943:17;2178:3;2174:27;2171:36;2168:2;;;2220:1;;2210:12;2168:2;2245:1;2230:204;1985:4;2252:1;2249:13;2230:204;;;4073:6;4060:20;4085:31;4110:5;4085:31;:::i;:::-;2323:48;;51955:4;2385:14;;;;2413;;;;;2277:1;2270:9;2230:204;;;2234:14;;;1903:537;;;;:::o;4265:241::-;;4369:2;4357:9;4348:7;4344:23;4340:32;4337:2;;;-1:-1;;4375:12;4337:2;85:6;72:20;97:33;124:5;97:33;:::i;4513:263::-;;4628:2;4616:9;4607:7;4603:23;4599:32;4596:2;;;-1:-1;;4634:12;4596:2;226:6;220:13;238:33;265:5;238:33;:::i;4783:366::-;;;4904:2;4892:9;4883:7;4879:23;4875:32;4872:2;;;-1:-1;;4910:12;4872:2;85:6;72:20;97:33;124:5;97:33;:::i;:::-;4962:63;5062:2;5101:22;;;;3649:20;;-1:-1;;;4866:283::o;5156:377::-;;5285:2;;5273:9;5264:7;5260:23;5256:32;5253:2;;;-1:-1;;5291:12;5253:2;5349:17;5336:31;-1:-1;;;;;5379:6;5376:30;5373:2;;;-1:-1;;5409:12;5373:2;5485:22;;1208:4;1196:17;;1192:27;-1:-1;1182:2;;-1:-1;;1223:12;1182:2;1270:6;1257:20;1292:80;1307:64;1364:6;1307:64;:::i;:::-;1292:80;:::i;:::-;1400:21;;;1457:14;;;;1432:17;;;1546;;;1537:27;;;;1534:36;-1:-1;1531:2;;;-1:-1;;1573:12;1531:2;-1:-1;1599:10;;1593:206;1618:6;1615:1;1612:13;1593:206;;;3649:20;;1686:50;;1640:1;1633:9;;;;;1750:14;;;;1778;;1593:206;;;-1:-1;5429:88;5247:286;-1:-1;;;;;;;5247:286::o;5540:284::-;;5665:3;5653:9;5644:7;5640:23;5636:33;5633:2;;;-1:-1;;5672:12;5633:2;5734:74;5800:7;5776:22;5734:74;:::i;5831:306::-;;5967:3;5955:9;5946:7;5942:23;5938:33;5935:2;;;-1:-1;;5974:12;5935:2;2589:3;2582:4;2574:6;2570:17;2566:27;2556:2;;-1:-1;;2597:12;2556:2;2650:76;5967:3;2650:76;:::i;:::-;2732:16;2791:17;2849:3;5967;2824;2820:27;2817:36;2814:2;;;-1:-1;;2856:12;2814:2;-1:-1;2876:215;2631:4;2898:1;2895:13;2876:215;;;4210:6;4204:13;4222:31;4247:5;4222:31;:::i;:::-;2969:59;;51955:4;3042:14;;;;3070;;;;;2923:1;2916:9;2876:215;;;-1:-1;6026:95;;5929:208;-1:-1;;;;;5929:208::o;6144:257::-;;6256:2;6244:9;6235:7;6231:23;6227:32;6224:2;;;-1:-1;;6262:12;6224:2;3186:6;3180:13;65820:5;54596:13;54589:21;65798:5;65795:32;65785:2;;-1:-1;;65831:12;6408:933;;;;;;;6629:3;6617:9;6608:7;6604:23;6600:33;6597:2;;;-1:-1;;6636:12;6597:2;3335:6;3322:20;3347:48;3389:5;3347:48;:::i;:::-;6688:78;-1:-1;6803:2;6861:22;;3493:20;3518:52;3493:20;3518:52;:::i;:::-;6811:82;-1:-1;6930:2;6969:22;;3649:20;;-1:-1;7038:2;7075:22;;4060:20;4085:31;4060:20;4085:31;:::i;:::-;7046:61;-1:-1;7144:3;7184:22;;72:20;97:33;72:20;97:33;:::i;:::-;7153:63;-1:-1;7253:3;7293:22;;72:20;97:33;72:20;97:33;:::i;:::-;7262:63;;;;6591:750;;;;;;;;:::o;7348:241::-;;7452:2;7440:9;7431:7;7427:23;7423:32;7420:2;;;-1:-1;;7458:12;7420:2;-1:-1;3649:20;;7414:175;-1:-1;7414:175::o;7596:263::-;;7711:2;7699:9;7690:7;7686:23;7682:32;7679:2;;;-1:-1;;7717:12;7679:2;-1:-1;3797:13;;7673:186;-1:-1;7673:186::o;7866:544::-;;;8033:2;8021:9;8012:7;8008:23;8004:32;8001:2;;;-1:-1;;8039:12;8001:2;3662:6;3649:20;8091:63;;8219:2;;8208:9;8204:18;8191:32;-1:-1;;;;;8235:6;8232:30;8229:2;;;-1:-1;;8265:12;8229:2;8362:22;;433:4;421:17;;417:27;-1:-1;407:2;;-1:-1;;448:12;407:2;495:6;482:20;517:101;532:85;610:6;532:85;:::i;517:101::-;646:21;;;703:14;;;;678:17;;;804:4;792:17;;;783:27;;;;780:36;-1:-1;777:2;;;-1:-1;;819:12;777:2;-1:-1;845:10;;839:227;864:6;861:1;858:13;839:227;;;944:58;998:3;986:10;944:58;:::i;:::-;932:71;;886:1;879:9;;;;;1017:14;;;;1045;;;;839:227;;;-1:-1;7995:415;;8285:109;;-1:-1;7995:415;-1:-1;;;;;;;7995:415::o;8417:409::-;;;8559:3;8547:9;8538:7;8534:23;8530:33;8527:2;;;-1:-1;;8566:12;8527:2;3662:6;3649:20;8618:63;;8736:74;8802:7;8718:2;8782:9;8778:22;8736:74;:::i;:::-;8726:84;;8521:305;;;;;:::o;8833:366::-;;;8954:2;8942:9;8933:7;8929:23;8925:32;8922:2;;;-1:-1;;8960:12;8922:2;-1:-1;;3649:20;;;9112:2;9151:22;;;3649:20;;-1:-1;8916:283::o;9206:364::-;;;9326:2;9314:9;9305:7;9301:23;9297:32;9294:2;;;-1:-1;;9332:12;9294:2;3662:6;3649:20;9384:63;;9484:2;9526:9;9522:22;3926:20;-1:-1;;;;;66382:5;55199:30;66358:5;66355:34;66345:2;;-1:-1;;66393:12;66345:2;9492:62;;;;9288:282;;;;;:::o;9577:237::-;;9679:2;9667:9;9658:7;9654:23;9650:32;9647:2;;;-1:-1;;9685:12;9647:2;4073:6;4060:20;4085:31;4110:5;4085:31;:::i;9821:479::-;;;;9953:2;9941:9;9932:7;9928:23;9924:32;9921:2;;;-1:-1;;9959:12;9921:2;4073:6;4060:20;4085:31;4110:5;4085:31;:::i;:::-;10011:61;-1:-1;10109:2;10146:22;;4060:20;4085:31;4060:20;4085:31;:::i;:::-;10117:61;-1:-1;10215:2;10252:22;;4060:20;4085:31;4060:20;4085:31;:::i;:::-;10223:61;;;;9915:385;;;;;:::o;34841:271::-;;25245:5;52548:12;25356:52;25401:6;25396:3;25389:4;25382:5;25378:16;25356:52;:::i;:::-;25420:16;;;;;34975:137;-1:-1;;34975:137::o;35119:222::-;-1:-1;;;;;54993:54;;;;11061:37;;35246:2;35231:18;;35217:124::o;35348:658::-;-1:-1;;;;;54993:54;;10920:58;;35609:3;35594:19;;35824:2;35809:18;;;12920:21;35348:658;12947:252;52796:4;12969:1;12966:13;12947:252;;;13033:13;;54415:4;54404:16;34680:35;;10813:14;;;;53273;;;;12994:1;12987:9;12947:252;;;-1:-1;;;;35907:3;35892:19;;25036:37;;;;35991:3;35976:19;25036:37;35580:426;;-1:-1;;35580:426::o;36013:444::-;-1:-1;;;;;54993:54;;;11061:37;;54993:54;;;;36360:2;36345:18;;11061:37;36443:2;36428:18;;25036:37;;;;36196:2;36181:18;;36167:290::o;36464:333::-;-1:-1;;;;;54993:54;;;;11061:37;;36783:2;36768:18;;25036:37;36619:2;36604:18;;36590:207::o;36804:370::-;36981:2;36995:47;;;52548:12;;36966:18;;;53642:19;;;36804:370;;36981:2;52097:14;;;;53682;;;;36804:370;11549:260;11574:6;11571:1;11568:13;11549:260;;;11635:13;;25036:37;;53273:14;;;;10461;;;;11596:1;11589:9;11549:260;;;-1:-1;37048:116;;36952:222;-1:-1;;;;;;36952:222::o;37181:315::-;37354:3;37339:19;;37343:9;12235:21;37181:315;12262:256;52683:4;12284:1;12281:13;12262:256;;;12348:13;;-1:-1;;;;;55199:30;34575:36;;10648:4;10639:14;;;;53273;;;;12309:1;12302:9;12262:256;;37503:301;18316:13;;54415:4;54404:16;;;34680:35;;65476:1;65472:13;;;54404:16;;18472:4;18463:14;;34680:35;63217:2;63213:14;;;54404:16;;18665:14;;;34680:35;64469:2;64465:14;;;;54404:16;18867:14;;;34680:35;37669:3;37654:19;;37640:164::o;37811:210::-;54596:13;;54589:21;24919:34;;37932:2;37917:18;;37903:118::o;38028:444::-;25036:37;;;38375:2;38360:18;;25036:37;;;;38458:2;38443:18;;25036:37;38211:2;38196:18;;38182:290::o;38479:556::-;25036:37;;;38855:2;38840:18;;25036:37;;;;38938:2;38923:18;;25036:37;39021:2;39006:18;;25036:37;38690:3;38675:19;;38661:374::o;39568:310::-;;39715:2;39736:17;39729:47;25927:5;52548:12;53654:6;39715:2;39704:9;39700:18;53642:19;26021:52;26066:6;53682:14;39704:9;53682:14;39715:2;26047:5;26043:16;26021:52;:::i;:::-;61976:7;61960:14;-1:-1;;61956:28;26085:39;;;;53682:14;26085:39;;39686:192;-1:-1;;39686:192::o;39885:416::-;40085:2;40099:47;;;26361:1;40070:18;;;53642:19;-1:-1;;;53682:14;;;26376:29;26424:12;;;40056:245::o;40308:416::-;40508:2;40522:47;;;26675:2;40493:18;;;53642:19;-1:-1;;;53682:14;;;26691:33;26743:12;;;40479:245::o;40731:416::-;40931:2;40945:47;;;26994:2;40916:18;;;53642:19;-1:-1;;;53682:14;;;27010:42;27071:12;;;40902:245::o;41154:416::-;41354:2;41368:47;;;27322:2;41339:18;;;53642:19;27358:27;53682:14;;;27338:48;27405:12;;;41325:245::o;41577:416::-;41777:2;41791:47;;;27656:2;41762:18;;;53642:19;27692:34;53682:14;;;27672:55;-1:-1;;;27747:12;;;27740:30;27789:12;;;41748:245::o;42000:416::-;42200:2;42214:47;;;28040:2;42185:18;;;53642:19;28076:29;53682:14;;;28056:50;28125:12;;;42171:245::o;42423:416::-;42623:2;42637:47;;;28376:2;42608:18;;;53642:19;28412:32;53682:14;;;28392:53;28464:12;;;42594:245::o;42846:416::-;43046:2;43060:47;;;28715:2;43031:18;;;53642:19;28751:34;53682:14;;;28731:55;-1:-1;;;28806:12;;;28799:30;28848:12;;;43017:245::o;43269:416::-;43469:2;43483:47;;;29099:2;43454:18;;;53642:19;-1:-1;;;53682:14;;;29115:37;29171:12;;;43440:245::o;43692:416::-;43892:2;43906:47;;;29422:2;43877:18;;;53642:19;29458:28;53682:14;;;29438:49;29506:12;;;43863:245::o;44115:416::-;44315:2;44329:47;;;29757:2;44300:18;;;53642:19;29793:27;53682:14;;;29773:48;29840:12;;;44286:245::o;44538:416::-;44738:2;44752:47;;;30091:1;44723:18;;;53642:19;-1:-1;;;53682:14;;;30106:30;30155:12;;;44709:245::o;44961:416::-;45161:2;45175:47;;;30406:2;45146:18;;;53642:19;30442:26;53682:14;;;30422:47;30488:12;;;45132:245::o;45384:416::-;45584:2;45598:47;;;30739:2;45569:18;;;53642:19;30775:34;53682:14;;;30755:55;-1:-1;;;30830:12;;;30823:38;30880:12;;;45555:245::o;45807:416::-;46007:2;46021:47;;;31131:2;45992:18;;;53642:19;31167:27;53682:14;;;31147:48;31214:12;;;45978:245::o;46230:416::-;46430:2;46444:47;;;31465:2;46415:18;;;53642:19;31501:34;53682:14;;;31481:55;-1:-1;;;31556:12;;;31549:25;31593:12;;;46401:245::o;46653:416::-;46853:2;46867:47;;;31844:2;46838:18;;;53642:19;31880:25;53682:14;;;31860:46;31925:12;;;46824:245::o;47076:416::-;47276:2;47290:47;;;47261:18;;;53642:19;32212:34;53682:14;;;32192:55;32266:12;;;47247:245::o;47499:416::-;47699:2;47713:47;;;32517:2;47684:18;;;53642:19;-1:-1;;;53682:14;;;32533:34;32586:12;;;47670:245::o;47922:416::-;48122:2;48136:47;;;32837:2;48107:18;;;53642:19;-1:-1;;;53682:14;;;32853:33;32905:12;;;48093:245::o;48345:416::-;48545:2;48559:47;;;33156:2;48530:18;;;53642:19;33192:31;53682:14;;;33172:52;33243:12;;;48516:245::o;48768:416::-;48968:2;48982:47;;;33494:1;48953:18;;;53642:19;-1:-1;;;53682:14;;;33509:30;33558:12;;;48939:245::o;49191:416::-;49391:2;49405:47;;;33809:2;49376:18;;;53642:19;33845:34;53682:14;;;33825:55;-1:-1;;;33900:12;;;33893:34;33946:12;;;49362:245::o;49614:416::-;49814:2;49828:47;;;34197:1;49799:18;;;53642:19;-1:-1;;;53682:14;;;34212:29;34260:12;;;49785:245::o;50037:222::-;25036:37;;;50164:2;50149:18;;50135:124::o;50266:333::-;25036:37;;;50585:2;50570:18;;25036:37;50421:2;50406:18;;50392:207::o;50606:214::-;54415:4;54404:16;;;;34680:35;;50729:2;50714:18;;50700:120::o;50827:256::-;50889:2;50883:9;50915:17;;;-1:-1;;;;;50975:34;;51011:22;;;50972:62;50969:2;;;51047:1;;51037:12;50969:2;50889;51056:22;50867:216;;-1:-1;50867:216::o;51090:325::-;;-1:-1;;;;;51262:6;51259:30;51256:2;;;-1:-1;;51292:12;51256:2;-1:-1;51337:4;51325:17;;;51390:15;;51193:222::o;56297:268::-;56362:1;56369:101;56383:6;56380:1;56377:13;56369:101;;;56450:11;;;56444:18;56431:11;;;56424:39;56405:2;56398:10;56369:101;;;56485:6;56482:1;56479:13;56476:2;;;-1:-1;;56362:1;56532:16;;56525:27;56346:219::o;65615:117::-;-1:-1;;;;;54993:54;;65674:35;;65664:2;;65723:1;;65713:12;65664:2;65658:74;:::o;66419:113::-;54415:4;66502:5;54404:16;66479:5;66476:33;66466:2;;66523:1;;66513:12

Swarm Source

ipfs://236a45781705116d34e0ab33543733fba4d043a35ccc02e265d0d6780027e468
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading