Mumbai Testnet

Contract

0x750D99EE27dE30DDD254137a4dd1b6B98F4c62A2

Overview

MATIC Balance

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Value
Activate Raffle ...271806542022-07-15 5:53:40677 days ago1657864420IN
0x750D99EE...98F4c62A2
0 MATIC0.000067422.02364366
Update Raffle Dr...271806532022-07-15 5:53:30677 days ago1657864410IN
0x750D99EE...98F4c62A2
0 MATIC0.00051062.08866371
Add Raffle Draw271806522022-07-15 5:53:20677 days ago1657864400IN
0x750D99EE...98F4c62A2
0 MATIC0.000379452.08866371
Grant Role271806512022-07-15 5:53:10677 days ago1657864390IN
0x750D99EE...98F4c62A2
0 MATIC0.000055972.08866371
Pick Winners270706832022-07-07 16:25:23685 days ago1657211123IN
0x750D99EE...98F4c62A2
0 MATIC0.0208729534.20208428
Buy Entries270578062022-07-06 16:50:37686 days ago1657126237IN
0x750D99EE...98F4c62A2
0 MATIC0.000240371.40000002
Buy Entries270578052022-07-06 16:50:32686 days ago1657126232IN
0x750D99EE...98F4c62A2
0 MATIC0.000501741.40000002
Buy Entries270578052022-07-06 16:50:32686 days ago1657126232IN
0x750D99EE...98F4c62A2
0 MATIC0.000776421.40000002
Buy Entries270571372022-07-06 15:54:41686 days ago1657122881IN
0x750D99EE...98F4c62A2
0 MATIC0.000303961.40000018
Buy Entries270571362022-07-06 15:54:36686 days ago1657122876IN
0x750D99EE...98F4c62A2
0 MATIC0.000247321.40000018
Buy Entries270571362022-07-06 15:54:36686 days ago1657122876IN
0x750D99EE...98F4c62A2
0 MATIC0.000776521.40000018
Buy Entries270571002022-07-06 15:51:36686 days ago1657122696IN
0x750D99EE...98F4c62A2
0 MATIC0.000240371.40000002
Buy Entries270571002022-07-06 15:51:36686 days ago1657122696IN
0x750D99EE...98F4c62A2
0 MATIC0.000458431.40000002
Buy Entries270570982022-07-06 15:51:26686 days ago1657122686IN
0x750D99EE...98F4c62A2
0 MATIC0.000522091.40000002
Buy Entries270556932022-07-06 13:53:59686 days ago1657115639IN
0x750D99EE...98F4c62A2
0 MATIC0.000303961.40000005
Buy Entries270556922022-07-06 13:53:54686 days ago1657115634IN
0x750D99EE...98F4c62A2
0 MATIC0.000374521.40000005
Buy Entries270556922022-07-06 13:53:54686 days ago1657115634IN
0x750D99EE...98F4c62A2
0 MATIC0.000813081.40000005
Buy Entries270549862022-07-06 12:54:53686 days ago1657112093IN
0x750D99EE...98F4c62A2
0 MATIC0.000240371.40000002
Buy Entries270549862022-07-06 12:54:53686 days ago1657112093IN
0x750D99EE...98F4c62A2
0 MATIC0.000311051.40000002
Buy Entries270549852022-07-06 12:54:48686 days ago1657112088IN
0x750D99EE...98F4c62A2
0 MATIC0.000819931.40000002
Buy Entries270545322022-07-06 12:13:51686 days ago1657109631IN
0x750D99EE...98F4c62A2
0 MATIC0.000240371.40000002
Buy Entries270545312022-07-06 12:13:41686 days ago1657109621IN
0x750D99EE...98F4c62A2
0 MATIC0.000247321.40000002
Buy Entries270545312022-07-06 12:13:41686 days ago1657109621IN
0x750D99EE...98F4c62A2
0 MATIC0.000733141.40000002
Buy Entries270543992022-07-06 12:02:18686 days ago1657108938IN
0x750D99EE...98F4c62A2
0 MATIC0.000240371.40000001
Buy Entries270543982022-07-06 12:02:08686 days ago1657108928IN
0x750D99EE...98F4c62A2
0 MATIC0.000374521.40000001
View all transactions

Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RaffleDraw

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 22 : RaffleDraw.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.4;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "./Base.sol";
import "./interfaces/IRaffleDraw.sol";
import "./interfaces/IChibiLuckyToken.sol";

contract RaffleDraw is Base, IRaffleDraw {
    /** --------------------STORAGE VARIABLES-------------------- */
    using Counters for Counters.Counter;
    /**
     * raffle draws
     */
    mapping(uint256 => Draw) public raffleDraws;
    /**
     * the total number of raffle draws
     */
    uint256 public totalRaffleDraws;
    /**
     * draw => player => entries mapping
     */
    mapping(uint256 => mapping(address => uint256[]))
        public raffleDrawPlayerEntryMapping;
    /**
     * draw => entry => player mapping
     */
    mapping(uint256 => mapping(uint256 => address))
        public raffleDrawEntryPlayerMapping;
    /**
     * role for managing raffle draws
     */
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
    /**
     * external contracts
     */
    ERC1155Burnable public luckyTokenContract;
    /**
     * winner mapping by entries
     */
    mapping(uint256 => DrawWinner) private _raffleDrawWinners;
    /**
     * raffle id counter
     */
    Counters.Counter private _raffleDrawIdCounter;

    /** --------------------STORAGE VARIABLES-------------------- */

    /** --------------------EXTERNAL FUNCTIONS-------------------- */
    /**
     * see {IRaffleDraw-buyEntries}
     */
    function buyEntries(
        uint256 drawId,
        uint256[] calldata luckyTokenIds,
        uint256[] calldata numberOfTokens
    ) external override {
        require(drawId < totalRaffleDraws, "CHIBI:INVALID_ID");
        require(luckyTokenIds.length > 0, "CHIBI:INVALID_LUCKY_TOKENS");
        Draw memory draw = raffleDraws[drawId];
        require(draw.status == DrawStatus.ACTIVE, "CHIBI:INVALID_STATUS");
        require(
            draw.endDate >= block.timestamp,
            "CHIBI:TOO_LATE_TO_BUY_ENTRIES"
        );

        uint256 newEntries = _calculateNumberOfEntries(
            draw.tier,
            luckyTokenIds,
            numberOfTokens
        );
        require(
            (draw.currentEntries + newEntries) <= draw.totalEntries,
            "CHIBI:EXCEED_MAXIMUM_AVAILABLE_ENTRIES"
        );
        require(
            (raffleDrawPlayerEntryMapping[drawId][msg.sender].length +
                newEntries) <= draw.maxEntriesPerWallet,
            "CHIBI:EXCEED_MAXIMUM_AVAILABLE_ENTRIES_FOR_A_WALLET"
        );

        for (uint256 i = 0; i < luckyTokenIds.length; i++) {
            require(
                numberOfTokens[i] > 0,
                "CHIBI:NUMBER_OF_TOKEN_MUST_BE_GREATER_THAN_0"
            );
            require(
                numberOfTokens[i] <=
                    luckyTokenContract.balanceOf(msg.sender, luckyTokenIds[i]),
                "CHIBI:NOT_ENOUGH_TOKENS"
            );
        }
        require(
            luckyTokenContract.isApprovedForAll(msg.sender, address(this)),
            "CHIBI:NOT_ALLOWED_TO_BURN_LUCKY_TOKEN"
        );

        // burn Lucky tokens before buying entries
        luckyTokenContract.burnBatch(msg.sender, luckyTokenIds, numberOfTokens);

        uint256[] memory newEntryIndexes = new uint256[](newEntries);
        for (uint256 i = 0; i < newEntries; i++) {
            uint256 newEntry = draw.currentEntries + i;
            // add entries to player
            raffleDrawPlayerEntryMapping[draw.id][msg.sender].push(newEntry);
            // mapping entry => player
            raffleDrawEntryPlayerMapping[draw.id][newEntry] = msg.sender;
            newEntryIndexes[i] = newEntry;
        }
        // update currentEntries;
        raffleDraws[drawId].currentEntries += newEntries;

        emit RaffleDrawEntriesBought(drawId, msg.sender, newEntryIndexes);
    }

    /**
     * see {IRaffleDraw-findRaffleDraws}
     */
    function findRaffleDraws(uint256[] calldata drawIds)
        external
        view
        override
        returns (Draw[] memory draws)
    {
        draws = new Draw[](drawIds.length);
        for (uint256 i; i < draws.length; i++) {
            draws[i] = raffleDraws[drawIds[i]];
        }
    }

    /**
     * see {IRaffleDraw-getDrawPlayerStatus}
     */
    function getDrawPlayerStatus(address player, uint256[] calldata drawIds)
        external
        view
        override
        returns (DrawPlayerStatus[] memory statuses)
    {
        statuses = new DrawPlayerStatus[](drawIds.length);
        for (uint256 i = 0; i < drawIds.length; i++) {
            Draw memory draw = raffleDraws[drawIds[i]];
            if (
                draw.status == DrawStatus.ACTIVE &&
                draw.endDate >= block.timestamp
            ) {
                uint256 walletAvailableEntries = draw.maxEntriesPerWallet -
                    raffleDrawPlayerEntryMapping[draw.id][player].length;
                uint256 drawAvailableEntries = draw.totalEntries -
                    draw.currentEntries;
                bool canBuyEntries = walletAvailableEntries > 0 &&
                    drawAvailableEntries > 0;
                uint256 availableEntries = walletAvailableEntries;
                if (availableEntries > drawAvailableEntries) {
                    availableEntries = drawAvailableEntries;
                }
                statuses[i] = DrawPlayerStatus({
                    canBuyEntries: canBuyEntries,
                    availableEntries: availableEntries
                });
            }
        }
    }

    /**
     * see {IRaffleDraw-calculateNumberOfEntries}
     */
    function calculateNumberOfEntries(
        Tier tier,
        uint256[] calldata luckyTokenIds,
        uint256[] calldata numberOfTokens
    ) external pure override returns (uint256 numberOfEntries) {
        numberOfEntries = _calculateNumberOfEntries(
            tier,
            luckyTokenIds,
            numberOfTokens
        );
    }

    /**
     * see {IRaffleDraw-pickWinners}
     */
    function pickWinners(uint256 drawId)
        external
        override
        onlyRole(MANAGER_ROLE)
    {
        Draw memory draw = raffleDraws[drawId];
        require(drawId < totalRaffleDraws, "CHIBI:INVALID_ID");
        require(draw.status == DrawStatus.ACTIVE, "CHIBI:INVALID_STATUS");
        require(draw.endDate < block.timestamp, "CHIBI:CANNOT_PICK_WINNER_YET");
        uint256[] memory winnerEntries;
        address[] memory winners;
        if (draw.currentEntries <= draw.numberOfPrizes) {
            // all are winners
            winnerEntries = new uint256[](draw.currentEntries);
            winners = new address[](draw.currentEntries);
            for (uint256 i = 0; i < draw.currentEntries; i++) {
                winnerEntries[i] = i;
                winners[i] = raffleDrawEntryPlayerMapping[drawId][
                    winnerEntries[i]
                ];
                _raffleDrawWinners[drawId].entryMapping[
                    winnerEntries[i]
                ] = true;
            }
        } else {
            winnerEntries = new uint256[](draw.numberOfPrizes);
            winners = new address[](draw.numberOfPrizes);
            for (uint256 i = 0; i < draw.numberOfPrizes; i++) {
                uint256 randomEntry = uint256(
                    keccak256(
                        abi.encodePacked(
                            block.difficulty,
                            block.number,
                            i == 0 ? address(0) : winners[i] // previous winner
                        )
                    )
                ) % draw.currentEntries;
                while (_raffleDrawWinners[drawId].entryMapping[randomEntry]) {
                    // move to the first next entry which is not picked yet
                    randomEntry = (randomEntry + 1) % draw.currentEntries;
                }
                winnerEntries[i] = randomEntry;
                winners[i] = raffleDrawEntryPlayerMapping[drawId][
                    winnerEntries[i]
                ];
                _raffleDrawWinners[drawId].entryMapping[
                    winnerEntries[i]
                ] = true;
            }
        }
        _raffleDrawWinners[drawId].drawEntries = winnerEntries;

        emit RaffleDrawWinnerPicked(drawId, winnerEntries, winners);

        raffleDraws[drawId].status = DrawStatus.COMPLETED;
        emit RaffleDrawStatusUpdated(drawId, DrawStatus.COMPLETED);
    }

    /**
     * see {IRaffleDraw-addRaffleDraw}
     */
    function addRaffleDraw(
        Tier tier,
        uint40 endDate,
        uint256 totalEntries,
        uint256 maxEntriesPerWallet,
        uint256 numberOfPrizes,
        string calldata name
    ) external override onlyRole(MANAGER_ROLE) {
        uint256 id = _raffleDrawIdCounter.current();
        _raffleDrawIdCounter.increment();
        raffleDraws[id] = Draw({
            id: id,
            tier: tier,
            status: DrawStatus.INACTIVE,
            endDate: endDate,
            totalEntries: totalEntries,
            maxEntriesPerWallet: maxEntriesPerWallet,
            numberOfPrizes: numberOfPrizes,
            name: name,
            description: "",
            imageUrl: "",
            currentEntries: 0
        });
        totalRaffleDraws += 1;

        emit RaffleDrawAdded(
            id,
            DrawStatus.INACTIVE,
            tier,
            endDate,
            totalEntries,
            maxEntriesPerWallet,
            numberOfPrizes,
            name
        );
    }

    /**
     * see {IRaffleDraw-updateRaffleDraw}
     */
    function updateRaffleDraw(
        uint256 id,
        Tier tier,
        uint40 endDate,
        uint256 totalEntries,
        uint256 maxEntriesPerWallet,
        uint256 numberOfPrizes
    ) external override onlyRole(MANAGER_ROLE) {
        require(id < totalRaffleDraws, "CHIBI:INVALID_ID");
        require(
            raffleDraws[id].status == DrawStatus.INACTIVE,
            "CHIBI:INVALID_STATUS"
        );

        raffleDraws[id].tier = tier;
        raffleDraws[id].endDate = endDate;
        raffleDraws[id].totalEntries = totalEntries;
        raffleDraws[id].maxEntriesPerWallet = maxEntriesPerWallet;
        raffleDraws[id].numberOfPrizes = numberOfPrizes;

        emit RaffleDrawUpdated(
            id,
            tier,
            endDate,
            totalEntries,
            maxEntriesPerWallet,
            numberOfPrizes
        );
    }

    /**
     * see {IRaffleDraw-updateRaffleDrawDesc}
     */
    function updateRaffleDrawDesc(
        uint256 id,
        string calldata name,
        string calldata description,
        string calldata imageUrl
    ) external override onlyRole(MANAGER_ROLE) {
        require(id < totalRaffleDraws, "CHIBI:INVALID_ID");
        require(
            raffleDraws[id].status == DrawStatus.INACTIVE,
            "CHIBI:INVALID_STATUS"
        );

        raffleDraws[id].name = name;
        raffleDraws[id].description = description;
        raffleDraws[id].imageUrl = imageUrl;

        emit RaffleDrawDescUpdated(id, name, description, imageUrl);
    }

    /**
     * see {IRaffleDraw-activateRaffleDraw}
     */
    function activateRaffleDraw(uint256 id, bool isActive)
        external
        override
        onlyRole(MANAGER_ROLE)
    {
        require(id < totalRaffleDraws, "CHIBI:INVALID_ID");
        require(
            raffleDraws[id].status != DrawStatus.COMPLETED,
            "CHIBI:RAFFLE_DRAW_ALREADY_COMPLETED"
        );
        if (raffleDraws[id].status == DrawStatus.INACTIVE && isActive) {
            raffleDraws[id].status = DrawStatus.ACTIVE;
            emit RaffleDrawStatusUpdated(id, DrawStatus.ACTIVE);
        } else if (raffleDraws[id].status == DrawStatus.ACTIVE && !isActive) {
            require(
                raffleDraws[id].currentEntries == 0,
                "CHIBI:ENTRIES_ALREADY_BOUGHT"
            );
            raffleDraws[id].status = DrawStatus.INACTIVE;
            emit RaffleDrawStatusUpdated(id, DrawStatus.INACTIVE);
        }
    }

    /**
     * see {IRaffleDraw-setExternalContractAddresses}
     */
    function setExternalContractAddresses(address luckyTokenAddr)
        external
        override
        onlyOwner
    {
        luckyTokenContract = ERC1155Burnable(luckyTokenAddr);
    }

    /** --------------------EXTERNAL FUNCTIONS-------------------- */

    /** --------------------PRIVATE FUNCTIONS-------------------- */
    /**
     * calculate number of entries can be bought using luck tokens (based on tier)
     */
    function _calculateNumberOfEntries(
        Tier tier,
        uint256[] calldata luckyTokenIds,
        uint256[] calldata numberOfTokens
    ) private pure returns (uint256 numberOfEntries) {
        require(
            luckyTokenIds.length == numberOfTokens.length,
            "CHIBI:ARRAY_LENGTHS_MUST_MATCH"
        );
        for (uint256 i = 0; i < luckyTokenIds.length; i++) {
            if (tier == Tier.Common) {
                // Common Raffles: Gold(1) tokens = 4 entries, Silver(2) token = 2 entries, Bronze(3) token = 1 entry.
                require(
                    luckyTokenIds[i] >= 1 && luckyTokenIds[i] <= 3,
                    "CHIBI:INVALID_TOKEN_ID"
                );
                if (luckyTokenIds[i] == 1) {
                    numberOfEntries += 4 * numberOfTokens[i];
                } else if (luckyTokenIds[i] == 2) {
                    numberOfEntries += 2 * numberOfTokens[i];
                } else {
                    numberOfEntries += numberOfTokens[i];
                }
            } else if (tier == Tier.Rare) {
                // Rare Raffles: Gold token = 2 entries, Silver token = 1 entry.
                require(
                    luckyTokenIds[i] >= 1 && luckyTokenIds[i] <= 2,
                    "CHIBI:INVALID_TOKEN_ID"
                );
                if (luckyTokenIds[i] == 1) {
                    numberOfEntries += 2 * numberOfTokens[i];
                } else {
                    numberOfEntries += numberOfTokens[i];
                }
            } else {
                // Epic Raffles: Gold token = 1 entry.
                require(luckyTokenIds[i] == 1, "CHIBI:INVALID_TOKEN_ID");
                numberOfEntries += numberOfTokens[i];
            }
        }
    }
    /** --------------------PRIVATE FUNCTIONS-------------------- */
}

File 2 of 22 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. 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;`
 */
library Counters {
    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 {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 2 of 22 : ERC1155Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC1155.sol";

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Burnable is ERC1155 {
    function burn(
        address account,
        uint256 id,
        uint256 value
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory values
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burnBatch(account, ids, values);
    }
}

File 2 of 22 : Base.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./AccessControl.sol";
import "./interfaces/IBase.sol";

/**
 * Base contract
 */
abstract contract Base is IBase, AccessControl, ReentrancyGuard {
    /** --------------------EXTERNAL FUNCTIONS-------------------- */
    /**
     * see {IBase-withdrawAllERC20}
     */
    function withdrawAllERC20(IERC20 token)
        external
        override
        onlyOwner
        nonReentrant
    {
        uint256 balance = token.balanceOf(address(this));
        require(balance > 0, "CHIBI::BALANCE_MUST_BE_GREATER_THAN_0");

        token.transfer(owner(), balance);
    }

    /**
     * see {IBase-withdrawERC721}
     */
    function withdrawERC721(IERC721 token, uint256[] calldata tokenIds)
        external
        override
        onlyOwner
        nonReentrant
    {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            token.safeTransferFrom(address(this), owner(), tokenIds[i]);
        }
    }
    /** --------------------EXTERNAL FUNCTIONS-------------------- */
}

File 2 of 22 : IRaffleDraw.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.4;

interface IRaffleDraw {
    enum Tier {
        Common,
        Rare,
        Epic
    }

    enum DrawStatus {
        ACTIVE,
        COMPLETED,
        INACTIVE
    }

    struct Draw {
        uint256 id;
        DrawStatus status;
        Tier tier;
        uint40 endDate;
        uint256 totalEntries;
        uint256 currentEntries;
        uint256 maxEntriesPerWallet;
        uint256 numberOfPrizes;
        string name;
        string description;
        string imageUrl;
    }

    struct DrawPlayerStatus {
        bool canBuyEntries;
        uint256 availableEntries;
    }

    struct DrawWinner {
        uint256[] drawEntries;
        mapping(uint256 => bool) entryMapping;
    }

    event RaffleDrawAdded(
        uint256 indexed id,
        DrawStatus indexed status,
        Tier indexed tier,
        uint40 endDate,
        uint256 totalEntries,
        uint256 maxEntriesPerWallet,
        uint256 numberOfPrizes,
        string name
    );

    event RaffleDrawUpdated(
        uint256 indexed id,
        Tier indexed tier,
        uint40 endDate,
        uint256 totalEntries,
        uint256 maxEntriesPerWallet,
        uint256 numberOfPrizes
    );

    event RaffleDrawDescUpdated(
        uint256 indexed id,
        string name,
        string description,
        string imageUrl
    );

    event RaffleDrawStatusUpdated(uint256 indexed id, DrawStatus status);

    event RaffleDrawEntriesBought(
        uint256 indexed id,
        address player,
        uint256[] drawEntries
    );

    event RaffleDrawWinnerPicked(
        uint256 indexed id,
        uint256[] drawEntries,
        address[] winners
    );

    /**
     * buy entries in a Raffle Draw with Luck tokens
     * Common Raffles: Gold tokens = 4 entries, Silver token = 2 entries, Bronze token = 1 entry.
     * Rare Raffles: Gold token = 2 entries, Silver token = 1 entry.
     * Epic Raffles: Gold token = 1 entry.
     */
    function buyEntries(
        uint256 drawId,
        uint256[] calldata luckyTokenIds,
        uint256[] calldata numberOfTokens
    ) external;

    /**
     * find draws
     */
    function findRaffleDraws(uint256[] calldata drawIds)
        external
        view
        returns (Draw[] memory draws);

    /**
     * get draw status for a player
     */
    function getDrawPlayerStatus(address player, uint256[] calldata drawIds)
        external
        view
        returns (DrawPlayerStatus[] memory statuses);

    /**
     * calculate number of entries can be bought using luck tokens (based on tier)
     */
    function calculateNumberOfEntries(
        Tier tier,
        uint256[] calldata luckyTokenIds,
        uint256[] calldata numberOfTokens
    ) external pure returns (uint256 numberOfEntries);

    /**
     * pick winners - manager only
     */
    function pickWinners(uint256 drawId) external;

    /**
     * add new raffle draw
     */
    function addRaffleDraw(
        Tier tier,
        uint40 endDate,
        uint256 totalEntries,
        uint256 maxEntriesPerWallet,
        uint256 numberOfPrizes,
        string calldata name
    ) external;

    /**
     * update raffle draw end date
     */
    function updateRaffleDraw(
        uint256 id,
        Tier tier,
        uint40 endDate,
        uint256 totalEntries,
        uint256 maxEntriesPerWallet,
        uint256 numberOfPrizes
    ) external;

    /**
     * update raffle draw description
     */
    function updateRaffleDrawDesc(
        uint256 id,
        string calldata name,
        string calldata description,
        string calldata imageUrl
    ) external;

    /**
     * set raffle draw status
     */
    function activateRaffleDraw(uint256 id, bool isActive) external;

    /**
     * set external contract addresses
     */
    function setExternalContractAddresses(address luckyTokenAddr) external;
}

File 2 of 22 : IChibiLuckyToken.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.4;

interface IChibiLuckyToken {
    /**
     * free mint, each wallet can only mint one token
     */
    function freeMint() external;

    /**
     * mint tokens with $SHIN
     */
    function mintWithShin(uint256 numberOfTokens) external;

    /**
     * mint tokens with Seals. Each seal can only be used once.
     */
    function mintWithSeals(uint256[] calldata sealTokenIds) external;

    /**
     * mint tokens with Chibi Legends. Each Legend can only be used once.
     */
    function mintWithChibiLegends(uint256[] calldata legendTokenIds) external;

    /**
     * check if can use Seals to mint
     */
    function canUseSeals(uint16[] calldata sealTokenIds)
        external
        view
        returns (bool[] memory statuses);

    /**
     * check if can use Chibi Legends to mint
     */
    function canUseChibiLegends(uint16[] calldata legendTokenIds)
        external
        view
        returns (bool[] memory statuses);

    /**
     * mint - only minter
     */
    function mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) external;

    /**
     * mint batch - only minter
     */
    function mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) external;

    /**
     * set base token URI & extension - only contract owner
     */
    function setURI(string memory newUri, string memory newExtension) external;

    /**
     * set external contract addresses (Shin) - only contract owner
     */
    function setExternalContractAddresses(
        address shinAddr,
        address chibiLegendAddr,
        address sealAddr
    ) external;

    /*
     * enable/disable mint - only contract owner
     */
    function enableMint(bool shouldEnableMintWithShin) external;

    /*
     * set mint cost ($SHIN) - only contract owner
     */
    function setMintCost(uint256 newCost) external;

    /**
     * set Chibi Legend - Lucky Token mapping
     */
    function setChibiLegendLuckyTokenMapping(
        uint256[] calldata chibiLegendTokenIds,
        uint256[] calldata luckyTokenIds
    ) external;

    /**
     * set Seal - Lucky Token mapping
     */
    function setSealLuckyTokenMapping(
        uint256[] calldata sealTokenIds,
        uint256[] calldata luckyTokenIds
    ) external;
}

File 2 of 22 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

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

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

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

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

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

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

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

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

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

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

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

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 2 of 22 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

File 2 of 22 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

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

File 2 of 22 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

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

File 2 of 22 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

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

        (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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 2 of 22 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 2 of 22 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 2 of 22 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 2 of 22 : AccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "./interfaces/IAccessControl.sol";

/**
 * Get the idea from Openzeppelin AccessControl
 */
abstract contract AccessControl is IAccessControl, Ownable {
    /** --------------------STORAGE VARIABLES-------------------- */
    struct RoleData {
        mapping(address => bool) members;
    }

    mapping(bytes32 => RoleData) private _roles;
    /** --------------------STORAGE VARIABLES-------------------- */

    /** --------------------MODIFIERS-------------------- */
    /**
     * Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /** --------------------MODIFIERS-------------------- */

    /** --------------------EXTERNAL FUNCTIONS-------------------- */
    /**
     * see {IAccessControl-hasRole}
     */
    function hasRole(bytes32 role, address account)
        external
        view
        override
        returns (bool)
    {
        return _roles[role].members[account];
    }

    /**
     * see {IAccessControl-grantRole}
     */
    function grantRole(bytes32 role, address account)
        external
        virtual
        override
        onlyOwner
    {
        _grantRole(role, account);
    }

    /**
     * see {IAccessControl-revokeRole}
     */
    function revokeRole(bytes32 role, address account)
        external
        virtual
        override
        onlyOwner
    {
        _revokeRole(role, account);
    }

    /**
     * see {IAccessControl-renounceRole}
     */
    function renounceRole(bytes32 role, address account)
        external
        virtual
        override
    {
        require(
            account == _msgSender(),
            "AccessControl: can only renounce roles for self"
        );

        _revokeRole(role, account);
    }

    /** --------------------EXTERNAL FUNCTIONS-------------------- */

    /** --------------------INTERNAL FUNCTIONS-------------------- */
    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!_hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!_hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (_hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function _hasRole(bytes32 role, address account)
        internal
        view
        returns (bool)
    {
        return _roles[role].members[account];
    }
    /** --------------------INTERNAL FUNCTIONS-------------------- */
}

File 2 of 22 : IBase.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.2;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
 * Base contract
 */
interface IBase {
    /**
     * withdraw all ERC20 tokens - contract owner only
     */
    function withdrawAllERC20(IERC20 token) external;

    /**
     * withdraw ERC721 tokens in an emergency case - contract owner only
     */
    function withdrawERC721(IERC721 token, uint256[] calldata tokenIds)
        external;
}

File 2 of 22 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

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

    /**
     * @dev 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 {
        _transferOwnership(address(0));
    }

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

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

File 2 of 22 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal 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);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

File 2 of 22 : IAccessControl.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.2;

interface IAccessControl {
    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(
        bytes32 indexed role,
        address indexed account,
        address indexed sender
    );

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(
        bytes32 indexed role,
        address indexed account,
        address indexed sender
    );

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account)
        external
        view
        returns (bool);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must be owner.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must be owner.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 2 of 22 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, 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;
}

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

Contract ABI

[{"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":"id","type":"uint256"},{"indexed":true,"internalType":"enum IRaffleDraw.DrawStatus","name":"status","type":"uint8"},{"indexed":true,"internalType":"enum IRaffleDraw.Tier","name":"tier","type":"uint8"},{"indexed":false,"internalType":"uint40","name":"endDate","type":"uint40"},{"indexed":false,"internalType":"uint256","name":"totalEntries","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxEntriesPerWallet","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"numberOfPrizes","type":"uint256"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"RaffleDrawAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"description","type":"string"},{"indexed":false,"internalType":"string","name":"imageUrl","type":"string"}],"name":"RaffleDrawDescUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"drawEntries","type":"uint256[]"}],"name":"RaffleDrawEntriesBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"enum IRaffleDraw.DrawStatus","name":"status","type":"uint8"}],"name":"RaffleDrawStatusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"enum IRaffleDraw.Tier","name":"tier","type":"uint8"},{"indexed":false,"internalType":"uint40","name":"endDate","type":"uint40"},{"indexed":false,"internalType":"uint256","name":"totalEntries","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxEntriesPerWallet","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"numberOfPrizes","type":"uint256"}],"name":"RaffleDrawUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"drawEntries","type":"uint256[]"},{"indexed":false,"internalType":"address[]","name":"winners","type":"address[]"}],"name":"RaffleDrawWinnerPicked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"name":"activateRaffleDraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IRaffleDraw.Tier","name":"tier","type":"uint8"},{"internalType":"uint40","name":"endDate","type":"uint40"},{"internalType":"uint256","name":"totalEntries","type":"uint256"},{"internalType":"uint256","name":"maxEntriesPerWallet","type":"uint256"},{"internalType":"uint256","name":"numberOfPrizes","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"name":"addRaffleDraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"drawId","type":"uint256"},{"internalType":"uint256[]","name":"luckyTokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"numberOfTokens","type":"uint256[]"}],"name":"buyEntries","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IRaffleDraw.Tier","name":"tier","type":"uint8"},{"internalType":"uint256[]","name":"luckyTokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"numberOfTokens","type":"uint256[]"}],"name":"calculateNumberOfEntries","outputs":[{"internalType":"uint256","name":"numberOfEntries","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"drawIds","type":"uint256[]"}],"name":"findRaffleDraws","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum IRaffleDraw.DrawStatus","name":"status","type":"uint8"},{"internalType":"enum IRaffleDraw.Tier","name":"tier","type":"uint8"},{"internalType":"uint40","name":"endDate","type":"uint40"},{"internalType":"uint256","name":"totalEntries","type":"uint256"},{"internalType":"uint256","name":"currentEntries","type":"uint256"},{"internalType":"uint256","name":"maxEntriesPerWallet","type":"uint256"},{"internalType":"uint256","name":"numberOfPrizes","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"}],"internalType":"struct IRaffleDraw.Draw[]","name":"draws","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256[]","name":"drawIds","type":"uint256[]"}],"name":"getDrawPlayerStatus","outputs":[{"components":[{"internalType":"bool","name":"canBuyEntries","type":"bool"},{"internalType":"uint256","name":"availableEntries","type":"uint256"}],"internalType":"struct IRaffleDraw.DrawPlayerStatus[]","name":"statuses","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyTokenContract","outputs":[{"internalType":"contract ERC1155Burnable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"drawId","type":"uint256"}],"name":"pickWinners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffleDrawEntryPlayerMapping","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffleDrawPlayerEntryMapping","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffleDraws","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum IRaffleDraw.DrawStatus","name":"status","type":"uint8"},{"internalType":"enum IRaffleDraw.Tier","name":"tier","type":"uint8"},{"internalType":"uint40","name":"endDate","type":"uint40"},{"internalType":"uint256","name":"totalEntries","type":"uint256"},{"internalType":"uint256","name":"currentEntries","type":"uint256"},{"internalType":"uint256","name":"maxEntriesPerWallet","type":"uint256"},{"internalType":"uint256","name":"numberOfPrizes","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"luckyTokenAddr","type":"address"}],"name":"setExternalContractAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalRaffleDraws","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":"id","type":"uint256"},{"internalType":"enum IRaffleDraw.Tier","name":"tier","type":"uint8"},{"internalType":"uint40","name":"endDate","type":"uint40"},{"internalType":"uint256","name":"totalEntries","type":"uint256"},{"internalType":"uint256","name":"maxEntriesPerWallet","type":"uint256"},{"internalType":"uint256","name":"numberOfPrizes","type":"uint256"}],"name":"updateRaffleDraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"imageUrl","type":"string"}],"name":"updateRaffleDrawDesc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"withdrawAllERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506200001d3362000028565b600160025562000078565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6142cc80620000886000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063a15f9fd311610097578063e26da3a311610071578063e26da3a31461037f578063ec87621c14610392578063f2fde38b146103a7578063fb5fcc3c146103ba57600080fd5b8063a15f9fd314610346578063b8edadf214610359578063d547741f1461036c57600080fd5b8063715018a6146102d1578063781e9c5b146102d9578063857abbd4146102ec5780638da5cb5b146102ff57806391d14854146103105780639866498a1461033357600080fd5b80632b514f75116101305780632b514f75146102275780632f2ff15d1461025157806336568abe1461026457806351e8a4751461027757806363d646131461028a57806366f435341461029d57600080fd5b80630722208914610178578063115d08ff146101a857806313123d52146101c857806313edab81146101dd5780631697d391146101f05780631d3628f714610210575b600080fd5b60075461018b906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101bb6101b63660046137f6565b6103cd565b60405161019f9190613d5a565b6101db6101d63660046139e2565b61086e565b005b6101db6101eb3660046138d2565b6111bf565b6102036101fe366004613848565b611319565b60405161019f9190613dab565b61021960045481565b60405190815260200161019f565b61023a6102353660046139e2565b61171c565b60405161019f9b9a99989796959493929190614047565b6101db61025f3660046138a3565b61191c565b6101db6102723660046138a3565b611954565b6101db610285366004613aa1565b6119ce565b6101db610298366004613a49565b611b5c565b61018b6102ab366004613b84565b60066020908152600092835260408084209091529082529020546001600160a01b031681565b6101db6124f2565b6101db6102e7366004613af8565b612528565b6101db6102fa3660046137da565b612646565b6000546001600160a01b031661018b565b61032361031e3660046138a3565b61284b565b604051901515815260200161019f565b6102196103413660046138e6565b612876565b6101db610354366004613963565b61288f565b6101db6103673660046137da565b612b39565b6101db61037a3660046138a3565b612b85565b6101db61038d366004613a7d565b612baf565b61021960008051602061427783398151915281565b6101db6103b53660046137da565b612e0e565b6102196103c8366004613a12565b612ea9565b6060816001600160401b038111156103f557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561043a57816020015b60408051808201909152600080825260208201528152602001906001900390816104135790505b50905060005b828110156108665760006003600086868581811061046e57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060405180610160016040529081600082015481526020016001820160009054906101000a900460ff1660028111156104cb57634e487b7160e01b600052602160045260246000fd5b60028111156104ea57634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff16600281111561052057634e487b7160e01b600052602160045260246000fd5b600281111561053f57634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c090920191610595906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546105c1906141a9565b801561060e5780601f106105e35761010080835404028352916020019161060e565b820191906000526020600020905b8154815290600101906020018083116105f157829003601f168201915b50505050508152602001600782018054610627906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610653906141a9565b80156106a05780601f10610675576101008083540402835291602001916106a0565b820191906000526020600020905b81548152906001019060200180831161068357829003601f168201915b505050505081526020016008820180546106b9906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546106e5906141a9565b80156107325780601f1061070757610100808354040283529160200191610732565b820191906000526020600020905b81548152906001019060200180831161071557829003601f168201915b50505050508152505090506000600281111561075e57634e487b7160e01b600052602160045260246000fd5b8160200151600281111561078257634e487b7160e01b600052602160045260246000fd5b14801561079a575042816060015164ffffffffff1610155b1561085357805160009081526005602090815260408083206001600160a01b038a16845290915281205460c08301516107d3919061414b565b905060008260a0015183608001516107eb919061414b565b9050600080831180156107fe5750600082115b9050828281111561080c5750815b604051806040016040528083151581526020018281525087878151811061084357634e487b7160e01b600052603260045260246000fd5b6020026020010181905250505050505b508061085e816141e4565b915050610440565b509392505050565b6000805160206142778339815191526108878133612ee7565b600082815260036020908152604080832081516101608101909252805482526001810154919290919083019060ff1660028111156108d557634e487b7160e01b600052602160045260246000fd5b60028111156108f457634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff16600281111561092a57634e487b7160e01b600052602160045260246000fd5b600281111561094957634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c09092019161099f906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546109cb906141a9565b8015610a185780601f106109ed57610100808354040283529160200191610a18565b820191906000526020600020905b8154815290600101906020018083116109fb57829003601f168201915b50505050508152602001600782018054610a31906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5d906141a9565b8015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b50505050508152602001600882018054610ac3906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610aef906141a9565b8015610b3c5780601f10610b1157610100808354040283529160200191610b3c565b820191906000526020600020905b815481529060010190602001808311610b1f57829003601f168201915b50505050508152505090506004548310610b715760405162461bcd60e51b8152600401610b689061401d565b60405180910390fd5b600081602001516002811115610b9757634e487b7160e01b600052602160045260246000fd5b14610bb45760405162461bcd60e51b8152600401610b6890613f8a565b42816060015164ffffffffff1610610c0e5760405162461bcd60e51b815260206004820152601c60248201527f43484942493a43414e4e4f545f5049434b5f57494e4e45525f594554000000006044820152606401610b68565b6060808260e001518360a0015111610e27578260a001516001600160401b03811115610c4a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c73578160200160208202803683370190505b5091508260a001516001600160401b03811115610ca057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610cc9578160200160208202803683370190505b50905060005b8360a00151811015610e215780838281518110610cfc57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050600660008781526020019081526020016000206000848381518110610d3d57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110610d8757634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250506001600860008881526020019081526020016000206001016000858481518110610de157634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610e19906141e4565b915050610ccf565b50611105565b8260e001516001600160401b03811115610e5157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610e7a578160200160208202803683370190505b5091508260e001516001600160401b03811115610ea757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610ed0578160200160208202803683370190505b50905060005b8360e001518110156111035760008460a00151444384600014610f2057858581518110610f1357634e487b7160e01b600052603260045260246000fd5b6020026020010151610f23565b60005b6040805160208101949094528301919091526bffffffffffffffffffffffff19606091821b16908201526074016040516020818303038152906040528051906020012060001c610f7391906141ff565b90505b600087815260086020908152604080832084845260010190915290205460ff1615610fbc5760a0850151610fab826001614114565b610fb591906141ff565b9050610f76565b80848381518110610fdd57634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060066000888152602001908152602001600020600085848151811061101e57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060009054906101000a90046001600160a01b031683838151811061106857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016008600089815260200190815260200160002060010160008685815181106110c257634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055505080806110fb906141e4565b915050610ed6565b505b60008581526008602090815260409091208351611124928501906135e2565b50847f3bfd6d356d70ddf611cc5683ca0524bac5f275ee52ee712e8ff9ae3bf5273a1a8383604051611157929190613ebc565b60405180910390a260008581526003602052604090206001908101805460ff191682800217905550847f78b95ce50cd4af869963f3c4ef3f4e07acf5ee574394e7fa6a9038c820c1fde860016040516111b09190613f1b565b60405180910390a25050505050565b6000546001600160a01b031633146111e95760405162461bcd60e51b8152600401610b6890613fe8565b60028054141561123b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b68565b6002805560005b8181101561130e57836001600160a01b03166342842e0e3061126c6000546001600160a01b031690565b86868681811061128c57634e487b7160e01b600052603260045260246000fd5b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156112e357600080fd5b505af11580156112f7573d6000803e3d6000fd5b505050508080611306906141e4565b915050611242565b505060016002555050565b6060816001600160401b0381111561134157634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156113d757816020015b6113c460408051610160810190915260008082526020820190815260200160008152602001600064ffffffffff168152602001600081526020016000815260200160008152602001600081526020016060815260200160608152602001606081525090565b81526020019060019003908161135f5790505b50905060005b8151811015611715576003600085858481811061140a57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060405180610160016040529081600082015481526020016001820160009054906101000a900460ff16600281111561146757634e487b7160e01b600052602160045260246000fd5b600281111561148657634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff1660028111156114bc57634e487b7160e01b600052602160045260246000fd5b60028111156114db57634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c090920191611531906141a9565b80601f016020809104026020016040519081016040528092919081815260200182805461155d906141a9565b80156115aa5780601f1061157f576101008083540402835291602001916115aa565b820191906000526020600020905b81548152906001019060200180831161158d57829003601f168201915b505050505081526020016007820180546115c3906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546115ef906141a9565b801561163c5780601f106116115761010080835404028352916020019161163c565b820191906000526020600020905b81548152906001019060200180831161161f57829003601f168201915b50505050508152602001600882018054611655906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611681906141a9565b80156116ce5780601f106116a3576101008083540402835291602001916116ce565b820191906000526020600020905b8154815290600101906020018083116116b157829003601f168201915b5050505050815250508282815181106116f757634e487b7160e01b600052603260045260246000fd5b6020026020010181905250808061170d906141e4565b9150506113dd565b5092915050565b60036020819052600091825260409091208054600182015460028301549383015460048401546005850154600686018054959760ff808716986101008804909116976201000090970464ffffffffff16969195949392909161177d906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546117a9906141a9565b80156117f65780601f106117cb576101008083540402835291602001916117f6565b820191906000526020600020905b8154815290600101906020018083116117d957829003601f168201915b50505050509080600701805461180b906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611837906141a9565b80156118845780601f1061185957610100808354040283529160200191611884565b820191906000526020600020905b81548152906001019060200180831161186757829003601f168201915b505050505090806008018054611899906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546118c5906141a9565b80156119125780601f106118e757610100808354040283529160200191611912565b820191906000526020600020905b8154815290600101906020018083116118f557829003601f168201915b505050505090508b565b6000546001600160a01b031633146119465760405162461bcd60e51b8152600401610b6890613fe8565b6119508282612f4b565b5050565b6001600160a01b03811633146119c45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b68565b6119508282612fb6565b6000805160206142778339815191526119e78133612ee7565b6004548710611a085760405162461bcd60e51b8152600401610b689061401d565b600260008881526003602052604090206001015460ff166002811115611a3e57634e487b7160e01b600052602160045260246000fd5b14611a5b5760405162461bcd60e51b8152600401610b6890613f8a565b6000878152600360205260409020600101805487919061ff001916610100836002811115611a9957634e487b7160e01b600052602160045260246000fd5b0217905550600087815260036020526040902060018101805466ffffffffff000019166201000064ffffffffff89160217905560028082018690556004820185905560059091018390558690811115611b0257634e487b7160e01b600052602160045260246000fd5b6040805164ffffffffff88168152602081018790529081018590526060810184905288907fc44b62f393942db848638d5b8e1cbd462aa2097e0498d7f8c533e4e3bfc9d1059060800160405180910390a350505050505050565b6004548510611b7d5760405162461bcd60e51b8152600401610b689061401d565b82611bca5760405162461bcd60e51b815260206004820152601a60248201527f43484942493a494e56414c49445f4c55434b595f544f4b454e530000000000006044820152606401610b68565b600085815260036020908152604080832081516101608101909252805482526001810154919290919083019060ff166002811115611c1857634e487b7160e01b600052602160045260246000fd5b6002811115611c3757634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff166002811115611c6d57634e487b7160e01b600052602160045260246000fd5b6002811115611c8c57634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c090920191611ce2906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611d0e906141a9565b8015611d5b5780601f10611d3057610100808354040283529160200191611d5b565b820191906000526020600020905b815481529060010190602001808311611d3e57829003601f168201915b50505050508152602001600782018054611d74906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611da0906141a9565b8015611ded5780601f10611dc257610100808354040283529160200191611ded565b820191906000526020600020905b815481529060010190602001808311611dd057829003601f168201915b50505050508152602001600882018054611e06906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611e32906141a9565b8015611e7f5780601f10611e5457610100808354040283529160200191611e7f565b820191906000526020600020905b815481529060010190602001808311611e6257829003601f168201915b505050505081525050905060006002811115611eab57634e487b7160e01b600052602160045260246000fd5b81602001516002811115611ecf57634e487b7160e01b600052602160045260246000fd5b14611eec5760405162461bcd60e51b8152600401610b6890613f8a565b42816060015164ffffffffff161015611f475760405162461bcd60e51b815260206004820152601d60248201527f43484942493a544f4f5f4c4154455f544f5f4255595f454e54524945530000006044820152606401610b68565b6000611f5a82604001518787878761301d565b90508160800151818360a00151611f719190614114565b1115611fce5760405162461bcd60e51b815260206004820152602660248201527f43484942493a4558434545445f4d4158494d554d5f415641494c41424c455f456044820152654e545249455360d01b6064820152608401610b68565b60c08201516000888152600560209081526040808320338452909152902054611ff8908390614114565b11156120625760405162461bcd60e51b815260206004820152603360248201527f43484942493a4558434545445f4d4158494d554d5f415641494c41424c455f45604482015272139514925154d7d193d497d057d5d053131155606a1b6064820152608401610b68565b60005b8581101561223557600085858381811061208f57634e487b7160e01b600052603260045260246000fd5b90506020020135116120f85760405162461bcd60e51b815260206004820152602c60248201527f43484942493a4e554d4245525f4f465f544f4b454e5f4d5553545f42455f475260448201526b045415445525f5448414e5f360a41b6064820152608401610b68565b6007546001600160a01b031662fdd58e3389898581811061212957634e487b7160e01b600052603260045260246000fd5b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060440160206040518083038186803b15801561217657600080fd5b505afa15801561218a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ae91906139fa565b8585838181106121ce57634e487b7160e01b600052603260045260246000fd5b9050602002013511156122235760405162461bcd60e51b815260206004820152601760248201527f43484942493a4e4f545f454e4f5547485f544f4b454e530000000000000000006044820152606401610b68565b8061222d816141e4565b915050612065565b5060075460405163e985e9c560e01b81523360048201523060248201526001600160a01b039091169063e985e9c59060440160206040518083038186803b15801561227f57600080fd5b505afa158015612293573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b79190613887565b6123115760405162461bcd60e51b815260206004820152602560248201527f43484942493a4e4f545f414c4c4f5745445f544f5f4255524e5f4c55434b595f6044820152642a27a5a2a760d91b6064820152608401610b68565b600754604051631ac8311560e21b81526001600160a01b0390911690636b20c454906123499033908a908a908a908a90600401613cea565b600060405180830381600087803b15801561236357600080fd5b505af1158015612377573d6000803e3d6000fd5b505050506000816001600160401b038111156123a357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156123cc578160200160208202803683370190505b50905060005b82811015612485576000818560a001516123ec9190614114565b8551600090815260056020908152604080832033808552908352818420805460018101825590855283852001859055895184526006835281842085855290925290912080546001600160a01b03191690911790558351909150819084908490811061246757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152508061247d816141e4565b9150506123d2565b50600088815260036020819052604082200180548492906124a7908490614114565b92505081905550877fc4ac83fc4c751a251d35bd0f04aabdeb0adc5766e8478c311d5ee680a211127133836040516124e0929190613d2e565b60405180910390a25050505050505050565b6000546001600160a01b0316331461251c5760405162461bcd60e51b8152600401610b6890613fe8565b61252660006133aa565b565b6000805160206142778339815191526125418133612ee7565b60045488106125625760405162461bcd60e51b8152600401610b689061401d565b600260008981526003602052604090206001015460ff16600281111561259857634e487b7160e01b600052602160045260246000fd5b146125b55760405162461bcd60e51b8152600401610b6890613f8a565b60008881526003602052604090206125d190600601888861362d565b5060008881526003602052604090206125ee90600701868661362d565b50600088815260036020526040902061260b90600801848461362d565b50877f94b54e2b3ed5d2d4137fc5103b0bb3a79ca552ce92875d0cc34079b57491449c8888888888886040516124e096959493929190613f2e565b6000546001600160a01b031633146126705760405162461bcd60e51b8152600401610b6890613fe8565b6002805414156126c25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b68565b600280556040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b15801561270857600080fd5b505afa15801561271c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274091906139fa565b9050600081116127a05760405162461bcd60e51b815260206004820152602560248201527f43484942493a3a42414c414e43455f4d5553545f42455f475245415445525f54604482015264048414e5f360dc1b6064820152608401610b68565b816001600160a01b031663a9059cbb6127c16000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381600087803b15801561280957600080fd5b505af115801561281d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128419190613887565b5050600160025550565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000612885868686868661301d565b9695505050505050565b6000805160206142778339815191526128a88133612ee7565b60006128b360095490565b90506128c3600980546001019055565b60408051610160810190915281815260208101600281526020018a60028111156128fd57634e487b7160e01b600052602160045260246000fd5b81526020018964ffffffffff1681526020018881526020016000815260200187815260200186815260200185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093855250506040805160208181018352848252808601919091528151808201835284815294820194909452858352600384529091208351815591830151600180840180549293509160ff1916908360028111156129c757634e487b7160e01b600052602160045260246000fd5b0217905550604082015160018201805461ff0019166101008360028111156129ff57634e487b7160e01b600052602160045260246000fd5b0217905550606082015160018201805464ffffffffff909216620100000266ffffffffff0000199092169190911790556080820151600282015560a0820151600382015560c0820151600482015560e082015160058201556101008201518051612a739160068401916020909101906136a1565b506101208201518051612a909160078401916020909101906136a1565b506101408201518051612aad9160088401916020909101906136a1565b50905050600160046000828254612ac49190614114565b909155508990506002811115612aea57634e487b7160e01b600052602160045260246000fd5b6002827f231b4255e51928eb3018bc3672027012b9848bd5aa8bbcac1499209edf59e1dd8b8b8b8b8b8b604051612b26969594939291906140e1565b60405180910390a4505050505050505050565b6000546001600160a01b03163314612b635760405162461bcd60e51b8152600401610b6890613fe8565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146119c45760405162461bcd60e51b8152600401610b6890613fe8565b600080516020614277833981519152612bc88133612ee7565b6004548310612be95760405162461bcd60e51b8152600401610b689061401d565b600160008481526003602052604090206001015460ff166002811115612c1f57634e487b7160e01b600052602160045260246000fd5b1415612c795760405162461bcd60e51b815260206004820152602360248201527f43484942493a524146464c455f445241575f414c52454144595f434f4d504c4560448201526215115160ea1b6064820152608401610b68565b600260008481526003602052604090206001015460ff166002811115612caf57634e487b7160e01b600052602160045260246000fd5b148015612cb95750815b15612d1457600083815260036020526040808220600101805460ff191690555184917f78b95ce50cd4af869963f3c4ef3f4e07acf5ee574394e7fa6a9038c820c1fde891612d079190613f1b565b60405180910390a2505050565b60008381526003602052604081206001015460ff166002811115612d4857634e487b7160e01b600052602160045260246000fd5b148015612d53575081155b15612e09576000838152600360208190526040909120015415612db85760405162461bcd60e51b815260206004820152601c60248201527f43484942493a454e54524945535f414c52454144595f424f55474854000000006044820152606401610b68565b60008381526003602052604090819020600101805460ff19166002908117909155905184917f78b95ce50cd4af869963f3c4ef3f4e07acf5ee574394e7fa6a9038c820c1fde891612d079190613f1b565b505050565b6000546001600160a01b03163314612e385760405162461bcd60e51b8152600401610b6890613fe8565b6001600160a01b038116612e9d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b68565b612ea6816133aa565b50565b60056020528260005260406000206020528160005260406000208181548110612ed157600080fd5b9060005260206000200160009250925050505481565b612ef1828261284b565b61195057612f09816001600160a01b031660146133fa565b612f148360206133fa565b604051602001612f25929190613c75565b60408051601f198184030181529082905262461bcd60e51b8252610b6891600401613f77565b612f55828261284b565b6119505760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b612fc0828261284b565b156119505760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600083821461306e5760405162461bcd60e51b815260206004820152601e60248201527f43484942493a41525241595f4c454e475448535f4d5553545f4d4154434800006044820152606401610b68565b60005b848110156133a057600087600281111561309b57634e487b7160e01b600052602160045260246000fd5b14156132225760018686838181106130c357634e487b7160e01b600052603260045260246000fd5b90506020020135101580156130ff575060038686838181106130f557634e487b7160e01b600052603260045260246000fd5b9050602002013511155b61311b5760405162461bcd60e51b8152600401610b6890613fb8565b85858281811061313b57634e487b7160e01b600052603260045260246000fd5b905060200201356001141561318e5783838281811061316a57634e487b7160e01b600052603260045260246000fd5b90506020020135600461317d919061412c565b6131879083614114565b915061338e565b8585828181106131ae57634e487b7160e01b600052603260045260246000fd5b90506020020135600214156131f0578383828181106131dd57634e487b7160e01b600052603260045260246000fd5b90506020020135600261317d919061412c565b83838281811061321057634e487b7160e01b600052603260045260246000fd5b90506020020135826131879190614114565b600187600281111561324457634e487b7160e01b600052602160045260246000fd5b141561331357600186868381811061326c57634e487b7160e01b600052603260045260246000fd5b90506020020135101580156132a85750600286868381811061329e57634e487b7160e01b600052603260045260246000fd5b9050602002013511155b6132c45760405162461bcd60e51b8152600401610b6890613fb8565b8585828181106132e457634e487b7160e01b600052603260045260246000fd5b90506020020135600114156131f0578383828181106131dd57634e487b7160e01b600052603260045260246000fd5b85858281811061333357634e487b7160e01b600052603260045260246000fd5b905060200201356001146133595760405162461bcd60e51b8152600401610b6890613fb8565b83838281811061337957634e487b7160e01b600052603260045260246000fd5b905060200201358261338b9190614114565b91505b80613398816141e4565b915050613071565b5095945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060600061340983600261412c565b613414906002614114565b6001600160401b0381111561343957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613463576020820181803683370190505b509050600360fc1b8160008151811061348c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106134c957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006134ed84600261412c565b6134f8906001614114565b90505b600181111561358c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061353a57634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061355e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361358581614192565b90506134fb565b5083156135db5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b68565b9392505050565b82805482825590600052602060002090810192821561361d579160200282015b8281111561361d578251825591602001919060010190613602565b50613629929150613714565b5090565b828054613639906141a9565b90600052602060002090601f01602090048101928261365b576000855561361d565b82601f106136745782800160ff1982351617855561361d565b8280016001018555821561361d579182015b8281111561361d578235825591602001919060010190613686565b8280546136ad906141a9565b90600052602060002090601f0160209004810192826136cf576000855561361d565b82601f106136e857805160ff191683800117855561361d565b8280016001018555821561361d579182018281111561361d578251825591602001919060010190613602565b5b808211156136295760008155600101613715565b60008083601f84011261373a578182fd5b5081356001600160401b03811115613750578182fd5b6020830191508360208260051b850101111561376b57600080fd5b9250929050565b80356003811061378157600080fd5b919050565b60008083601f840112613797578182fd5b5081356001600160401b038111156137ad578182fd5b60208301915083602082850101111561376b57600080fd5b803564ffffffffff8116811461378157600080fd5b6000602082840312156137eb578081fd5b81356135db81614253565b60008060006040848603121561380a578182fd5b833561381581614253565b925060208401356001600160401b0381111561382f578283fd5b61383b86828701613729565b9497909650939450505050565b6000806020838503121561385a578182fd5b82356001600160401b0381111561386f578283fd5b61387b85828601613729565b90969095509350505050565b600060208284031215613898578081fd5b81516135db81614268565b600080604083850312156138b5578182fd5b8235915060208301356138c781614253565b809150509250929050565b60008060006040848603121561380a578283fd5b6000806000806000606086880312156138fd578081fd5b61390686613772565b945060208601356001600160401b0380821115613921578283fd5b61392d89838a01613729565b90965094506040880135915080821115613945578283fd5b5061395288828901613729565b969995985093965092949392505050565b600080600080600080600060c0888a03121561397d578182fd5b61398688613772565b9650613994602089016137c5565b955060408801359450606088013593506080880135925060a08801356001600160401b038111156139c3578283fd5b6139cf8a828b01613786565b989b979a50959850939692959293505050565b6000602082840312156139f3578081fd5b5035919050565b600060208284031215613a0b578081fd5b5051919050565b600080600060608486031215613a26578283fd5b833592506020840135613a3881614253565b929592945050506040919091013590565b600080600080600060608688031215613a60578283fd5b8535945060208601356001600160401b0380821115613921578485fd5b60008060408385031215613a8f578182fd5b8235915060208301356138c781614268565b60008060008060008060c08789031215613ab9578384fd5b86359550613ac960208801613772565b9450613ad7604088016137c5565b9350606087013592506080870135915060a087013590509295509295509295565b60008060008060008060006080888a031215613b12578081fd5b8735965060208801356001600160401b0380821115613b2f578283fd5b613b3b8b838c01613786565b909850965060408a0135915080821115613b53578283fd5b613b5f8b838c01613786565b909650945060608a0135915080821115613b77578283fd5b506139cf8a828b01613786565b60008060408385031215613b96578182fd5b50508035926020909101359150565b81835260006001600160fb1b03831115613bbd578081fd5b8260051b80836020870137939093016020019283525090919050565b6000815180845260208085019450808401835b83811015613c0857815187529582019590820190600101613bec565b509495945050505050565b613c1c81614235565b9052565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008151808452613c61816020860160208601614162565b601f01601f19169290920160200192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613cad816017850160208801614162565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613cde816028840160208801614162565b01602801949350505050565b6001600160a01b0386168152606060208201819052600090613d0f9083018688613ba5565b8281036040840152613d22818587613ba5565b98975050505050505050565b6001600160a01b0383168152604060208201819052600090613d5290830184613bd9565b949350505050565b602080825282518282018190526000919060409081850190868401855b82811015613d9e578151805115158552860151868501529284019290850190600101613d77565b5091979650505050505050565b60006020808301818452808551808352604092508286019150828160051b870101848801865b83811015613eae57603f1989840301855281516101608151855288820151613dfb8a870182613c13565b5087820151613e0c89870182613c13565b5060608281015164ffffffffff16908601526080808301519086015260a0808301519086015260c0808301519086015260e0808301519086015261010080830151818701839052613e5f83880182613c49565b925050506101208083015186830382880152613e7b8382613c49565b925050506101408083015192508582038187015250613e9a8183613c49565b968901969450505090860190600101613dd1565b509098975050505050505050565b604081526000613ecf6040830185613bd9565b828103602084810191909152845180835285820192820190845b81811015613f0e5784516001600160a01b031683529383019391830191600101613ee9565b5090979650505050505050565b60208101613f2883614235565b91905290565b606081526000613f4260608301888a613c20565b8281036020840152613f55818789613c20565b90508281036040840152613f6a818587613c20565b9998505050505050505050565b6020815260006135db6020830184613c49565b60208082526014908201527343484942493a494e56414c49445f53544154555360601b604082015260600190565b60208082526016908201527510d21250924e9253959053125117d513d2d15397d25160521b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201526f10d21250924e9253959053125117d25160821b604082015260600190565b60006101608d83526140588d614235565b8c60208401526140678c614235565b8b604084015264ffffffffff8b1660608401528960808401528860a08401528760c08401528660e0840152806101008401526140a581840187613c49565b90508281036101208401526140ba8186613c49565b90508281036101408401526140cf8185613c49565b9e9d5050505050505050505050505050565b64ffffffffff8716815285602082015284604082015283606082015260a060808201526000613d2260a083018486613c20565b600082198211156141275761412761421f565b500190565b60008160001904831182151516156141465761414661421f565b500290565b60008282101561415d5761415d61421f565b500390565b60005b8381101561417d578181015183820152602001614165565b8381111561418c576000848401525b50505050565b6000816141a1576141a161421f565b506000190190565b600181811c908216806141bd57607f821691505b602082108114156141de57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156141f8576141f861421f565b5060010190565b60008261421a57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b60038110612ea657634e487b7160e01b600052602160045260246000fd5b6001600160a01b0381168114612ea657600080fd5b8015158114612ea657600080fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a264697066735822122027802627bb1385b1eda03d24d6eafaae806a07486a5d6f241589268d48d0457b64736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063a15f9fd311610097578063e26da3a311610071578063e26da3a31461037f578063ec87621c14610392578063f2fde38b146103a7578063fb5fcc3c146103ba57600080fd5b8063a15f9fd314610346578063b8edadf214610359578063d547741f1461036c57600080fd5b8063715018a6146102d1578063781e9c5b146102d9578063857abbd4146102ec5780638da5cb5b146102ff57806391d14854146103105780639866498a1461033357600080fd5b80632b514f75116101305780632b514f75146102275780632f2ff15d1461025157806336568abe1461026457806351e8a4751461027757806363d646131461028a57806366f435341461029d57600080fd5b80630722208914610178578063115d08ff146101a857806313123d52146101c857806313edab81146101dd5780631697d391146101f05780631d3628f714610210575b600080fd5b60075461018b906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101bb6101b63660046137f6565b6103cd565b60405161019f9190613d5a565b6101db6101d63660046139e2565b61086e565b005b6101db6101eb3660046138d2565b6111bf565b6102036101fe366004613848565b611319565b60405161019f9190613dab565b61021960045481565b60405190815260200161019f565b61023a6102353660046139e2565b61171c565b60405161019f9b9a99989796959493929190614047565b6101db61025f3660046138a3565b61191c565b6101db6102723660046138a3565b611954565b6101db610285366004613aa1565b6119ce565b6101db610298366004613a49565b611b5c565b61018b6102ab366004613b84565b60066020908152600092835260408084209091529082529020546001600160a01b031681565b6101db6124f2565b6101db6102e7366004613af8565b612528565b6101db6102fa3660046137da565b612646565b6000546001600160a01b031661018b565b61032361031e3660046138a3565b61284b565b604051901515815260200161019f565b6102196103413660046138e6565b612876565b6101db610354366004613963565b61288f565b6101db6103673660046137da565b612b39565b6101db61037a3660046138a3565b612b85565b6101db61038d366004613a7d565b612baf565b61021960008051602061427783398151915281565b6101db6103b53660046137da565b612e0e565b6102196103c8366004613a12565b612ea9565b6060816001600160401b038111156103f557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561043a57816020015b60408051808201909152600080825260208201528152602001906001900390816104135790505b50905060005b828110156108665760006003600086868581811061046e57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060405180610160016040529081600082015481526020016001820160009054906101000a900460ff1660028111156104cb57634e487b7160e01b600052602160045260246000fd5b60028111156104ea57634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff16600281111561052057634e487b7160e01b600052602160045260246000fd5b600281111561053f57634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c090920191610595906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546105c1906141a9565b801561060e5780601f106105e35761010080835404028352916020019161060e565b820191906000526020600020905b8154815290600101906020018083116105f157829003601f168201915b50505050508152602001600782018054610627906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610653906141a9565b80156106a05780601f10610675576101008083540402835291602001916106a0565b820191906000526020600020905b81548152906001019060200180831161068357829003601f168201915b505050505081526020016008820180546106b9906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546106e5906141a9565b80156107325780601f1061070757610100808354040283529160200191610732565b820191906000526020600020905b81548152906001019060200180831161071557829003601f168201915b50505050508152505090506000600281111561075e57634e487b7160e01b600052602160045260246000fd5b8160200151600281111561078257634e487b7160e01b600052602160045260246000fd5b14801561079a575042816060015164ffffffffff1610155b1561085357805160009081526005602090815260408083206001600160a01b038a16845290915281205460c08301516107d3919061414b565b905060008260a0015183608001516107eb919061414b565b9050600080831180156107fe5750600082115b9050828281111561080c5750815b604051806040016040528083151581526020018281525087878151811061084357634e487b7160e01b600052603260045260246000fd5b6020026020010181905250505050505b508061085e816141e4565b915050610440565b509392505050565b6000805160206142778339815191526108878133612ee7565b600082815260036020908152604080832081516101608101909252805482526001810154919290919083019060ff1660028111156108d557634e487b7160e01b600052602160045260246000fd5b60028111156108f457634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff16600281111561092a57634e487b7160e01b600052602160045260246000fd5b600281111561094957634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c09092019161099f906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546109cb906141a9565b8015610a185780601f106109ed57610100808354040283529160200191610a18565b820191906000526020600020905b8154815290600101906020018083116109fb57829003601f168201915b50505050508152602001600782018054610a31906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5d906141a9565b8015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b50505050508152602001600882018054610ac3906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054610aef906141a9565b8015610b3c5780601f10610b1157610100808354040283529160200191610b3c565b820191906000526020600020905b815481529060010190602001808311610b1f57829003601f168201915b50505050508152505090506004548310610b715760405162461bcd60e51b8152600401610b689061401d565b60405180910390fd5b600081602001516002811115610b9757634e487b7160e01b600052602160045260246000fd5b14610bb45760405162461bcd60e51b8152600401610b6890613f8a565b42816060015164ffffffffff1610610c0e5760405162461bcd60e51b815260206004820152601c60248201527f43484942493a43414e4e4f545f5049434b5f57494e4e45525f594554000000006044820152606401610b68565b6060808260e001518360a0015111610e27578260a001516001600160401b03811115610c4a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c73578160200160208202803683370190505b5091508260a001516001600160401b03811115610ca057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610cc9578160200160208202803683370190505b50905060005b8360a00151811015610e215780838281518110610cfc57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050600660008781526020019081526020016000206000848381518110610d3d57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110610d8757634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250506001600860008881526020019081526020016000206001016000858481518110610de157634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610e19906141e4565b915050610ccf565b50611105565b8260e001516001600160401b03811115610e5157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610e7a578160200160208202803683370190505b5091508260e001516001600160401b03811115610ea757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610ed0578160200160208202803683370190505b50905060005b8360e001518110156111035760008460a00151444384600014610f2057858581518110610f1357634e487b7160e01b600052603260045260246000fd5b6020026020010151610f23565b60005b6040805160208101949094528301919091526bffffffffffffffffffffffff19606091821b16908201526074016040516020818303038152906040528051906020012060001c610f7391906141ff565b90505b600087815260086020908152604080832084845260010190915290205460ff1615610fbc5760a0850151610fab826001614114565b610fb591906141ff565b9050610f76565b80848381518110610fdd57634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060066000888152602001908152602001600020600085848151811061101e57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060009054906101000a90046001600160a01b031683838151811061106857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505060016008600089815260200190815260200160002060010160008685815181106110c257634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055505080806110fb906141e4565b915050610ed6565b505b60008581526008602090815260409091208351611124928501906135e2565b50847f3bfd6d356d70ddf611cc5683ca0524bac5f275ee52ee712e8ff9ae3bf5273a1a8383604051611157929190613ebc565b60405180910390a260008581526003602052604090206001908101805460ff191682800217905550847f78b95ce50cd4af869963f3c4ef3f4e07acf5ee574394e7fa6a9038c820c1fde860016040516111b09190613f1b565b60405180910390a25050505050565b6000546001600160a01b031633146111e95760405162461bcd60e51b8152600401610b6890613fe8565b60028054141561123b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b68565b6002805560005b8181101561130e57836001600160a01b03166342842e0e3061126c6000546001600160a01b031690565b86868681811061128c57634e487b7160e01b600052603260045260246000fd5b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156112e357600080fd5b505af11580156112f7573d6000803e3d6000fd5b505050508080611306906141e4565b915050611242565b505060016002555050565b6060816001600160401b0381111561134157634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156113d757816020015b6113c460408051610160810190915260008082526020820190815260200160008152602001600064ffffffffff168152602001600081526020016000815260200160008152602001600081526020016060815260200160608152602001606081525090565b81526020019060019003908161135f5790505b50905060005b8151811015611715576003600085858481811061140a57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060405180610160016040529081600082015481526020016001820160009054906101000a900460ff16600281111561146757634e487b7160e01b600052602160045260246000fd5b600281111561148657634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff1660028111156114bc57634e487b7160e01b600052602160045260246000fd5b60028111156114db57634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c090920191611531906141a9565b80601f016020809104026020016040519081016040528092919081815260200182805461155d906141a9565b80156115aa5780601f1061157f576101008083540402835291602001916115aa565b820191906000526020600020905b81548152906001019060200180831161158d57829003601f168201915b505050505081526020016007820180546115c3906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546115ef906141a9565b801561163c5780601f106116115761010080835404028352916020019161163c565b820191906000526020600020905b81548152906001019060200180831161161f57829003601f168201915b50505050508152602001600882018054611655906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611681906141a9565b80156116ce5780601f106116a3576101008083540402835291602001916116ce565b820191906000526020600020905b8154815290600101906020018083116116b157829003601f168201915b5050505050815250508282815181106116f757634e487b7160e01b600052603260045260246000fd5b6020026020010181905250808061170d906141e4565b9150506113dd565b5092915050565b60036020819052600091825260409091208054600182015460028301549383015460048401546005850154600686018054959760ff808716986101008804909116976201000090970464ffffffffff16969195949392909161177d906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546117a9906141a9565b80156117f65780601f106117cb576101008083540402835291602001916117f6565b820191906000526020600020905b8154815290600101906020018083116117d957829003601f168201915b50505050509080600701805461180b906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611837906141a9565b80156118845780601f1061185957610100808354040283529160200191611884565b820191906000526020600020905b81548152906001019060200180831161186757829003601f168201915b505050505090806008018054611899906141a9565b80601f01602080910402602001604051908101604052809291908181526020018280546118c5906141a9565b80156119125780601f106118e757610100808354040283529160200191611912565b820191906000526020600020905b8154815290600101906020018083116118f557829003601f168201915b505050505090508b565b6000546001600160a01b031633146119465760405162461bcd60e51b8152600401610b6890613fe8565b6119508282612f4b565b5050565b6001600160a01b03811633146119c45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b68565b6119508282612fb6565b6000805160206142778339815191526119e78133612ee7565b6004548710611a085760405162461bcd60e51b8152600401610b689061401d565b600260008881526003602052604090206001015460ff166002811115611a3e57634e487b7160e01b600052602160045260246000fd5b14611a5b5760405162461bcd60e51b8152600401610b6890613f8a565b6000878152600360205260409020600101805487919061ff001916610100836002811115611a9957634e487b7160e01b600052602160045260246000fd5b0217905550600087815260036020526040902060018101805466ffffffffff000019166201000064ffffffffff89160217905560028082018690556004820185905560059091018390558690811115611b0257634e487b7160e01b600052602160045260246000fd5b6040805164ffffffffff88168152602081018790529081018590526060810184905288907fc44b62f393942db848638d5b8e1cbd462aa2097e0498d7f8c533e4e3bfc9d1059060800160405180910390a350505050505050565b6004548510611b7d5760405162461bcd60e51b8152600401610b689061401d565b82611bca5760405162461bcd60e51b815260206004820152601a60248201527f43484942493a494e56414c49445f4c55434b595f544f4b454e530000000000006044820152606401610b68565b600085815260036020908152604080832081516101608101909252805482526001810154919290919083019060ff166002811115611c1857634e487b7160e01b600052602160045260246000fd5b6002811115611c3757634e487b7160e01b600052602160045260246000fd5b81526020016001820160019054906101000a900460ff166002811115611c6d57634e487b7160e01b600052602160045260246000fd5b6002811115611c8c57634e487b7160e01b600052602160045260246000fd5b8152600182015462010000900464ffffffffff166020820152600282015460408201526003820154606082015260048201546080820152600582015460a082015260068201805460c090920191611ce2906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611d0e906141a9565b8015611d5b5780601f10611d3057610100808354040283529160200191611d5b565b820191906000526020600020905b815481529060010190602001808311611d3e57829003601f168201915b50505050508152602001600782018054611d74906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611da0906141a9565b8015611ded5780601f10611dc257610100808354040283529160200191611ded565b820191906000526020600020905b815481529060010190602001808311611dd057829003601f168201915b50505050508152602001600882018054611e06906141a9565b80601f0160208091040260200160405190810160405280929190818152602001828054611e32906141a9565b8015611e7f5780601f10611e5457610100808354040283529160200191611e7f565b820191906000526020600020905b815481529060010190602001808311611e6257829003601f168201915b505050505081525050905060006002811115611eab57634e487b7160e01b600052602160045260246000fd5b81602001516002811115611ecf57634e487b7160e01b600052602160045260246000fd5b14611eec5760405162461bcd60e51b8152600401610b6890613f8a565b42816060015164ffffffffff161015611f475760405162461bcd60e51b815260206004820152601d60248201527f43484942493a544f4f5f4c4154455f544f5f4255595f454e54524945530000006044820152606401610b68565b6000611f5a82604001518787878761301d565b90508160800151818360a00151611f719190614114565b1115611fce5760405162461bcd60e51b815260206004820152602660248201527f43484942493a4558434545445f4d4158494d554d5f415641494c41424c455f456044820152654e545249455360d01b6064820152608401610b68565b60c08201516000888152600560209081526040808320338452909152902054611ff8908390614114565b11156120625760405162461bcd60e51b815260206004820152603360248201527f43484942493a4558434545445f4d4158494d554d5f415641494c41424c455f45604482015272139514925154d7d193d497d057d5d053131155606a1b6064820152608401610b68565b60005b8581101561223557600085858381811061208f57634e487b7160e01b600052603260045260246000fd5b90506020020135116120f85760405162461bcd60e51b815260206004820152602c60248201527f43484942493a4e554d4245525f4f465f544f4b454e5f4d5553545f42455f475260448201526b045415445525f5448414e5f360a41b6064820152608401610b68565b6007546001600160a01b031662fdd58e3389898581811061212957634e487b7160e01b600052603260045260246000fd5b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060440160206040518083038186803b15801561217657600080fd5b505afa15801561218a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ae91906139fa565b8585838181106121ce57634e487b7160e01b600052603260045260246000fd5b9050602002013511156122235760405162461bcd60e51b815260206004820152601760248201527f43484942493a4e4f545f454e4f5547485f544f4b454e530000000000000000006044820152606401610b68565b8061222d816141e4565b915050612065565b5060075460405163e985e9c560e01b81523360048201523060248201526001600160a01b039091169063e985e9c59060440160206040518083038186803b15801561227f57600080fd5b505afa158015612293573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b79190613887565b6123115760405162461bcd60e51b815260206004820152602560248201527f43484942493a4e4f545f414c4c4f5745445f544f5f4255524e5f4c55434b595f6044820152642a27a5a2a760d91b6064820152608401610b68565b600754604051631ac8311560e21b81526001600160a01b0390911690636b20c454906123499033908a908a908a908a90600401613cea565b600060405180830381600087803b15801561236357600080fd5b505af1158015612377573d6000803e3d6000fd5b505050506000816001600160401b038111156123a357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156123cc578160200160208202803683370190505b50905060005b82811015612485576000818560a001516123ec9190614114565b8551600090815260056020908152604080832033808552908352818420805460018101825590855283852001859055895184526006835281842085855290925290912080546001600160a01b03191690911790558351909150819084908490811061246757634e487b7160e01b600052603260045260246000fd5b6020908102919091010152508061247d816141e4565b9150506123d2565b50600088815260036020819052604082200180548492906124a7908490614114565b92505081905550877fc4ac83fc4c751a251d35bd0f04aabdeb0adc5766e8478c311d5ee680a211127133836040516124e0929190613d2e565b60405180910390a25050505050505050565b6000546001600160a01b0316331461251c5760405162461bcd60e51b8152600401610b6890613fe8565b61252660006133aa565b565b6000805160206142778339815191526125418133612ee7565b60045488106125625760405162461bcd60e51b8152600401610b689061401d565b600260008981526003602052604090206001015460ff16600281111561259857634e487b7160e01b600052602160045260246000fd5b146125b55760405162461bcd60e51b8152600401610b6890613f8a565b60008881526003602052604090206125d190600601888861362d565b5060008881526003602052604090206125ee90600701868661362d565b50600088815260036020526040902061260b90600801848461362d565b50877f94b54e2b3ed5d2d4137fc5103b0bb3a79ca552ce92875d0cc34079b57491449c8888888888886040516124e096959493929190613f2e565b6000546001600160a01b031633146126705760405162461bcd60e51b8152600401610b6890613fe8565b6002805414156126c25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b68565b600280556040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b15801561270857600080fd5b505afa15801561271c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274091906139fa565b9050600081116127a05760405162461bcd60e51b815260206004820152602560248201527f43484942493a3a42414c414e43455f4d5553545f42455f475245415445525f54604482015264048414e5f360dc1b6064820152608401610b68565b816001600160a01b031663a9059cbb6127c16000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381600087803b15801561280957600080fd5b505af115801561281d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128419190613887565b5050600160025550565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000612885868686868661301d565b9695505050505050565b6000805160206142778339815191526128a88133612ee7565b60006128b360095490565b90506128c3600980546001019055565b60408051610160810190915281815260208101600281526020018a60028111156128fd57634e487b7160e01b600052602160045260246000fd5b81526020018964ffffffffff1681526020018881526020016000815260200187815260200186815260200185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093855250506040805160208181018352848252808601919091528151808201835284815294820194909452858352600384529091208351815591830151600180840180549293509160ff1916908360028111156129c757634e487b7160e01b600052602160045260246000fd5b0217905550604082015160018201805461ff0019166101008360028111156129ff57634e487b7160e01b600052602160045260246000fd5b0217905550606082015160018201805464ffffffffff909216620100000266ffffffffff0000199092169190911790556080820151600282015560a0820151600382015560c0820151600482015560e082015160058201556101008201518051612a739160068401916020909101906136a1565b506101208201518051612a909160078401916020909101906136a1565b506101408201518051612aad9160088401916020909101906136a1565b50905050600160046000828254612ac49190614114565b909155508990506002811115612aea57634e487b7160e01b600052602160045260246000fd5b6002827f231b4255e51928eb3018bc3672027012b9848bd5aa8bbcac1499209edf59e1dd8b8b8b8b8b8b604051612b26969594939291906140e1565b60405180910390a4505050505050505050565b6000546001600160a01b03163314612b635760405162461bcd60e51b8152600401610b6890613fe8565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146119c45760405162461bcd60e51b8152600401610b6890613fe8565b600080516020614277833981519152612bc88133612ee7565b6004548310612be95760405162461bcd60e51b8152600401610b689061401d565b600160008481526003602052604090206001015460ff166002811115612c1f57634e487b7160e01b600052602160045260246000fd5b1415612c795760405162461bcd60e51b815260206004820152602360248201527f43484942493a524146464c455f445241575f414c52454144595f434f4d504c4560448201526215115160ea1b6064820152608401610b68565b600260008481526003602052604090206001015460ff166002811115612caf57634e487b7160e01b600052602160045260246000fd5b148015612cb95750815b15612d1457600083815260036020526040808220600101805460ff191690555184917f78b95ce50cd4af869963f3c4ef3f4e07acf5ee574394e7fa6a9038c820c1fde891612d079190613f1b565b60405180910390a2505050565b60008381526003602052604081206001015460ff166002811115612d4857634e487b7160e01b600052602160045260246000fd5b148015612d53575081155b15612e09576000838152600360208190526040909120015415612db85760405162461bcd60e51b815260206004820152601c60248201527f43484942493a454e54524945535f414c52454144595f424f55474854000000006044820152606401610b68565b60008381526003602052604090819020600101805460ff19166002908117909155905184917f78b95ce50cd4af869963f3c4ef3f4e07acf5ee574394e7fa6a9038c820c1fde891612d079190613f1b565b505050565b6000546001600160a01b03163314612e385760405162461bcd60e51b8152600401610b6890613fe8565b6001600160a01b038116612e9d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b68565b612ea6816133aa565b50565b60056020528260005260406000206020528160005260406000208181548110612ed157600080fd5b9060005260206000200160009250925050505481565b612ef1828261284b565b61195057612f09816001600160a01b031660146133fa565b612f148360206133fa565b604051602001612f25929190613c75565b60408051601f198184030181529082905262461bcd60e51b8252610b6891600401613f77565b612f55828261284b565b6119505760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b612fc0828261284b565b156119505760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600083821461306e5760405162461bcd60e51b815260206004820152601e60248201527f43484942493a41525241595f4c454e475448535f4d5553545f4d4154434800006044820152606401610b68565b60005b848110156133a057600087600281111561309b57634e487b7160e01b600052602160045260246000fd5b14156132225760018686838181106130c357634e487b7160e01b600052603260045260246000fd5b90506020020135101580156130ff575060038686838181106130f557634e487b7160e01b600052603260045260246000fd5b9050602002013511155b61311b5760405162461bcd60e51b8152600401610b6890613fb8565b85858281811061313b57634e487b7160e01b600052603260045260246000fd5b905060200201356001141561318e5783838281811061316a57634e487b7160e01b600052603260045260246000fd5b90506020020135600461317d919061412c565b6131879083614114565b915061338e565b8585828181106131ae57634e487b7160e01b600052603260045260246000fd5b90506020020135600214156131f0578383828181106131dd57634e487b7160e01b600052603260045260246000fd5b90506020020135600261317d919061412c565b83838281811061321057634e487b7160e01b600052603260045260246000fd5b90506020020135826131879190614114565b600187600281111561324457634e487b7160e01b600052602160045260246000fd5b141561331357600186868381811061326c57634e487b7160e01b600052603260045260246000fd5b90506020020135101580156132a85750600286868381811061329e57634e487b7160e01b600052603260045260246000fd5b9050602002013511155b6132c45760405162461bcd60e51b8152600401610b6890613fb8565b8585828181106132e457634e487b7160e01b600052603260045260246000fd5b90506020020135600114156131f0578383828181106131dd57634e487b7160e01b600052603260045260246000fd5b85858281811061333357634e487b7160e01b600052603260045260246000fd5b905060200201356001146133595760405162461bcd60e51b8152600401610b6890613fb8565b83838281811061337957634e487b7160e01b600052603260045260246000fd5b905060200201358261338b9190614114565b91505b80613398816141e4565b915050613071565b5095945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060600061340983600261412c565b613414906002614114565b6001600160401b0381111561343957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613463576020820181803683370190505b509050600360fc1b8160008151811061348c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106134c957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006134ed84600261412c565b6134f8906001614114565b90505b600181111561358c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061353a57634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061355e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361358581614192565b90506134fb565b5083156135db5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b68565b9392505050565b82805482825590600052602060002090810192821561361d579160200282015b8281111561361d578251825591602001919060010190613602565b50613629929150613714565b5090565b828054613639906141a9565b90600052602060002090601f01602090048101928261365b576000855561361d565b82601f106136745782800160ff1982351617855561361d565b8280016001018555821561361d579182015b8281111561361d578235825591602001919060010190613686565b8280546136ad906141a9565b90600052602060002090601f0160209004810192826136cf576000855561361d565b82601f106136e857805160ff191683800117855561361d565b8280016001018555821561361d579182018281111561361d578251825591602001919060010190613602565b5b808211156136295760008155600101613715565b60008083601f84011261373a578182fd5b5081356001600160401b03811115613750578182fd5b6020830191508360208260051b850101111561376b57600080fd5b9250929050565b80356003811061378157600080fd5b919050565b60008083601f840112613797578182fd5b5081356001600160401b038111156137ad578182fd5b60208301915083602082850101111561376b57600080fd5b803564ffffffffff8116811461378157600080fd5b6000602082840312156137eb578081fd5b81356135db81614253565b60008060006040848603121561380a578182fd5b833561381581614253565b925060208401356001600160401b0381111561382f578283fd5b61383b86828701613729565b9497909650939450505050565b6000806020838503121561385a578182fd5b82356001600160401b0381111561386f578283fd5b61387b85828601613729565b90969095509350505050565b600060208284031215613898578081fd5b81516135db81614268565b600080604083850312156138b5578182fd5b8235915060208301356138c781614253565b809150509250929050565b60008060006040848603121561380a578283fd5b6000806000806000606086880312156138fd578081fd5b61390686613772565b945060208601356001600160401b0380821115613921578283fd5b61392d89838a01613729565b90965094506040880135915080821115613945578283fd5b5061395288828901613729565b969995985093965092949392505050565b600080600080600080600060c0888a03121561397d578182fd5b61398688613772565b9650613994602089016137c5565b955060408801359450606088013593506080880135925060a08801356001600160401b038111156139c3578283fd5b6139cf8a828b01613786565b989b979a50959850939692959293505050565b6000602082840312156139f3578081fd5b5035919050565b600060208284031215613a0b578081fd5b5051919050565b600080600060608486031215613a26578283fd5b833592506020840135613a3881614253565b929592945050506040919091013590565b600080600080600060608688031215613a60578283fd5b8535945060208601356001600160401b0380821115613921578485fd5b60008060408385031215613a8f578182fd5b8235915060208301356138c781614268565b60008060008060008060c08789031215613ab9578384fd5b86359550613ac960208801613772565b9450613ad7604088016137c5565b9350606087013592506080870135915060a087013590509295509295509295565b60008060008060008060006080888a031215613b12578081fd5b8735965060208801356001600160401b0380821115613b2f578283fd5b613b3b8b838c01613786565b909850965060408a0135915080821115613b53578283fd5b613b5f8b838c01613786565b909650945060608a0135915080821115613b77578283fd5b506139cf8a828b01613786565b60008060408385031215613b96578182fd5b50508035926020909101359150565b81835260006001600160fb1b03831115613bbd578081fd5b8260051b80836020870137939093016020019283525090919050565b6000815180845260208085019450808401835b83811015613c0857815187529582019590820190600101613bec565b509495945050505050565b613c1c81614235565b9052565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008151808452613c61816020860160208601614162565b601f01601f19169290920160200192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613cad816017850160208801614162565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613cde816028840160208801614162565b01602801949350505050565b6001600160a01b0386168152606060208201819052600090613d0f9083018688613ba5565b8281036040840152613d22818587613ba5565b98975050505050505050565b6001600160a01b0383168152604060208201819052600090613d5290830184613bd9565b949350505050565b602080825282518282018190526000919060409081850190868401855b82811015613d9e578151805115158552860151868501529284019290850190600101613d77565b5091979650505050505050565b60006020808301818452808551808352604092508286019150828160051b870101848801865b83811015613eae57603f1989840301855281516101608151855288820151613dfb8a870182613c13565b5087820151613e0c89870182613c13565b5060608281015164ffffffffff16908601526080808301519086015260a0808301519086015260c0808301519086015260e0808301519086015261010080830151818701839052613e5f83880182613c49565b925050506101208083015186830382880152613e7b8382613c49565b925050506101408083015192508582038187015250613e9a8183613c49565b968901969450505090860190600101613dd1565b509098975050505050505050565b604081526000613ecf6040830185613bd9565b828103602084810191909152845180835285820192820190845b81811015613f0e5784516001600160a01b031683529383019391830191600101613ee9565b5090979650505050505050565b60208101613f2883614235565b91905290565b606081526000613f4260608301888a613c20565b8281036020840152613f55818789613c20565b90508281036040840152613f6a818587613c20565b9998505050505050505050565b6020815260006135db6020830184613c49565b60208082526014908201527343484942493a494e56414c49445f53544154555360601b604082015260600190565b60208082526016908201527510d21250924e9253959053125117d513d2d15397d25160521b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201526f10d21250924e9253959053125117d25160821b604082015260600190565b60006101608d83526140588d614235565b8c60208401526140678c614235565b8b604084015264ffffffffff8b1660608401528960808401528860a08401528760c08401528660e0840152806101008401526140a581840187613c49565b90508281036101208401526140ba8186613c49565b90508281036101408401526140cf8185613c49565b9e9d5050505050505050505050505050565b64ffffffffff8716815285602082015284604082015283606082015260a060808201526000613d2260a083018486613c20565b600082198211156141275761412761421f565b500190565b60008160001904831182151516156141465761414661421f565b500290565b60008282101561415d5761415d61421f565b500390565b60005b8381101561417d578181015183820152602001614165565b8381111561418c576000848401525b50505050565b6000816141a1576141a161421f565b506000190190565b600181811c908216806141bd57607f821691505b602082108114156141de57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156141f8576141f861421f565b5060010190565b60008261421a57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b60038110612ea657634e487b7160e01b600052602160045260246000fd5b6001600160a01b0381168114612ea657600080fd5b8015158114612ea657600080fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a264697066735822122027802627bb1385b1eda03d24d6eafaae806a07486a5d6f241589268d48d0457b64736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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