ETH Price: $3,183.35 (-7.52%)
Gas: 2 Gwei

Contract

0x30659414F4398bdbb816Ca76989306Ed0a45A14F
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Cancel Raffle183842542023-10-19 12:03:47279 days ago1697717027IN
0x30659414...d0a45A14F
0 ETH0.000411958.79130384
Create Raffle183842512023-10-19 12:03:11279 days ago1697716991IN
0x30659414...d0a45A14F
0 ETH0.003946939.01069953
Set Winner179436172023-08-18 19:00:11341 days ago1692385211IN
0x30659414...d0a45A14F
0 ETH0.0055659731.04143182
Buy Entry179436152023-08-18 18:59:47341 days ago1692385187IN
0x30659414...d0a45A14F
0.01 ETH0.0027019528.95058656
Buy Entry179436112023-08-18 18:58:59341 days ago1692385139IN
0x30659414...d0a45A14F
0.04 ETH0.0029233431.32268595
Buy Entry179436082023-08-18 18:58:23341 days ago1692385103IN
0x30659414...d0a45A14F
0.04 ETH0.0028228830.24625856
Buy Entry179436072023-08-18 18:58:11341 days ago1692385091IN
0x30659414...d0a45A14F
0 ETH0.0025862927.70770836
Buy Entry179436062023-08-18 18:57:59341 days ago1692385079IN
0x30659414...d0a45A14F
0.02 ETH0.0026712328.61767333
Buy Entry179436052023-08-18 18:57:47341 days ago1692385067IN
0x30659414...d0a45A14F
0.04 ETH0.0043571728.96251675
Buy Entry179436002023-08-18 18:56:47341 days ago1692385007IN
0x30659414...d0a45A14F
0.02 ETH0.0043714729.05986262
Buy Entry179436002023-08-18 18:56:47341 days ago1692385007IN
0x30659414...d0a45A14F
0 ETH0.0043721729.05986262
Buy Entry179435972023-08-18 18:56:11341 days ago1692384971IN
0x30659414...d0a45A14F
0.01 ETH0.0024962826.74343405
Buy Entry179435342023-08-18 18:43:11341 days ago1692384191IN
0x30659414...d0a45A14F
0.01 ETH0.0047152331.34002883
Buy Entry179434342023-08-18 18:23:11341 days ago1692382991IN
0x30659414...d0a45A14F
0.02 ETH0.0055397736.82038804
Buy Entry179433602023-08-18 18:08:23341 days ago1692382103IN
0x30659414...d0a45A14F
0 ETH0.0034061436.49104796
Buy Entry179433412023-08-18 18:04:23341 days ago1692381863IN
0x30659414...d0a45A14F
0.04 ETH0.0032373534.68271574
Buy Entry179433322023-08-18 18:02:35341 days ago1692381755IN
0x30659414...d0a45A14F
0.02 ETH0.0032425234.74703916
Buy Entry179433122023-08-18 17:58:35341 days ago1692381515IN
0x30659414...d0a45A14F
0 ETH0.0042371128.16222677
Buy Entry179432812023-08-18 17:52:23341 days ago1692381143IN
0x30659414...d0a45A14F
0.01 ETH0.0050340833.45930708
Buy Entry179432432023-08-18 17:44:47341 days ago1692380687IN
0x30659414...d0a45A14F
0.01 ETH0.0063153341.97855163
Buy Entry179430672023-08-18 17:09:23341 days ago1692378563IN
0x30659414...d0a45A14F
0.01 ETH0.0076955951.15325425
Buy Entry179430222023-08-18 17:00:23341 days ago1692378023IN
0x30659414...d0a45A14F
0.04 ETH0.0035462737.99228118
Buy Entry179430202023-08-18 16:59:59341 days ago1692377999IN
0x30659414...d0a45A14F
0.04 ETH0.0032408734.72044669
Buy Entry179430162023-08-18 16:59:11341 days ago1692377951IN
0x30659414...d0a45A14F
0.04 ETH0.0048722532.38370448
Buy Entry179429662023-08-18 16:49:11341 days ago1692377351IN
0x30659414...d0a45A14F
0 ETH0.0053723535.70763003
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
179436282023-08-18 19:02:23341 days ago1692385343
0x30659414...d0a45A14F
1.53 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MultipleNFTGatedLean

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 13 : MultipleNFTGatedLean.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/// @title Raffles manager (single winner and NFT prize)
/// @author Luis Pando
/// @notice It consumes VRF v1 from Chainlink. It has the role
/// "operator" that is the one used by a backend app to make some calls
/// @dev It saves in an ordered array the player wallet and the current
/// entries count. So buying entries has a complexity of O(1)
/// For calculating the winner, from the huge random number generated by Chainlink
/// a normalized random is generated by using the module method, adding 1 to have
/// a random from 1 to entriesCount.
/// So next step is to perform a binary search on the ordered array to get the
/// player O(log n)
/// Example:
/// 0 -> { 1, player1} as player1 buys 1 entry
/// 1 -> {51, player2} as player2 buys 50 entries
/// 2 -> {52, player3} as player3 buys 1 entry
/// 3 -> {53, player4} as player4 buys 1 entry
/// 4 -> {153, player5} as player5 buys 100 entries
/// So the setWinner method performs a binary search on that sorted array to get the upper bound.
/// If the random number generated is 150, the winner is player5. If the random number is 20, winner is player2

contract MultipleNFTGatedLean is
    AccessControl,
    ReentrancyGuard,
    VRFConsumerBase
{
    ////////// CHAINLINK VRF v1 /////////////////
    bytes32 internal keyHash; // chainlink
    uint256 internal fee; // fee paid in LINK to chainlink. 0.1 in Rinkeby, 2 in mainnet

    struct RandomResult {
        uint256 randomNumber; // random number generated by chainlink.
        uint256 nomalizedRandomNumber; // random number % entriesLength + 1. So between 1 and entries.length
    }

    // event sent when the random number is generated by the VRF
    event RandomNumberCreated(
        uint256 indexed idFromMetawin,
        uint256 randomNumber,
        uint256 normalizedRandomNumber
    );

    struct RaffleInfo {
        uint256 id; // raffleId
        uint256 size; // length of the entries array of that raffle
    }

    mapping(uint256 => RandomResult) public requests;
    // map the requestId created by chainlink with the raffle info passed as param when calling getRandomNumber()
    mapping(bytes32 => RaffleInfo) public chainlinkRaffleInfo;

    /////////////// END CHAINKINK VRF V1 //////////////

    error EntryNotAllowed(string errorType);

    // Event sent when the raffle is created by the operator
    event RaffleCreated(
        uint256 indexed raffleId,
        address indexed nftAddress,
        uint256 indexed nftId
    );
    // Event sent when the owner of the nft stakes it for the raffle
    event RaffleStarted(uint256 indexed raffleId, address indexed seller);
    // Event sent when the raffle is finished (either early cashout or successful completion)
    event RaffleEnded(
        uint256 indexed raffleId,
        address indexed winner,
        uint256 amountRaised,
        uint256 randomNumber
    );
    // Event sent when one or more entries are sold (info from the price structure)
    event EntrySold(
        uint256 indexed raffleId,
        address indexed buyer,
        uint256 currentSize,
        uint256 priceStructureId
    );
    // Event sent when a free entry is added by the operator
    event FreeEntry(
        uint256 indexed raffleId,
        address[] buyer,
        uint256 amount,
        uint256 currentSize
    );
    // Event sent when a raffle is asked to cancel by the operator
    event RaffleCancelled(uint256 indexed raffleId, uint256 amountRaised);
    // The raffle is closed successfully and the platform receives the fee
    event FeeTransferredToPlatform(
        uint256 indexed raffleId,
        uint256 amountTransferred
    );
    // When the raffle is asked to be cancelled and 30 days have passed, the operator can call a method
    // to transfer the remaining funds and this event is emitted
    event RemainingFundsTransferred(
        uint256 indexed raffleId,
        uint256 amountInWeis
    );
    // When the raffle is asked to be cancelled and 30 days have not passed yet, the players can call a
    // method to refund the amount spent on the raffle and this event is emitted
    event Refund(
        uint256 indexed raffleId,
        uint256 amountInWeis,
        address indexed player
    );
    event EarlyCashoutTriggered(uint256 indexed raffleId, uint256 amountRaised);
    event SetWinnerTriggered(uint256 indexed raffleId, uint256 amountRaised);
    // Emitted when an entry is cancelled
    event EntryCancelled(
        uint256 indexed raffleId,
        uint256 amountOfEntriesCanceled,
        address player
    );

    /* every raffle has an array of price structure (max size = 5) with the different 
    prices for the different entries bought. The price for 1 entry is different than 
    for 5 entries where there is a discount*/
    struct PriceStructure {
        uint256 id;
        uint48 numEntries;
        uint256 price;
    }
    // mapping(uint256 => PriceStructure[5]) public prices;

    mapping(uint256 => PriceStructure) public pricesList;

    // Every raffle has a funding structure.
    struct FundingStructure {
        uint128 minimumFundsInWeis;
        uint128 desiredFundsInWeis;
    }
    mapping(uint256 => FundingStructure) public fundingList;

    // In order to calculate the winner, in this struct is saved for each bought the data
    struct EntriesBought {
        uint48 currentEntriesLength; // current amount of entries bought in the raffle
        address player; // wallet address of the player
    }
    // every raffle has a sorted array of EntriesBought. Each element is created when calling
    // either buyEntry or giveBatchEntriesForFree
    mapping(uint256 => EntriesBought[]) public entriesList;

    // Main raffle data struct
    struct RaffleStruct {
        uint48 platformPercentage; // percentage of the funds raised that goes to the platform
        //   uint48 cancellingDate;
        uint48 collateralId; // NFT id of the NFT
        address collateralAddress; // address of the NFT
        address winner; // address of thed winner of the raffle. Address(0) if no winner yet
        address seller; // address of the seller of the NFT
        uint256 randomNumber; // normalized (0-Entries array size) random number generated by the VRF
    }
    // The main structure is an array of raffles
    RaffleStruct[] public raffles;

    struct EntryInfoStruct {
        bool requireWhitelisting;
        STATUS status; // status of the raffle. Can be created, accepted, ended, etc
        ENTRY_TYPE entryType;
        uint48 walletsCap;
        uint48 entriesLength; // to easy frontend, the length of the entries array is saved here
        uint128 amountRaised; // funds raised so far in wei
        //    address[] collectionWhitelist;
    }
    // The main structure is an array of raffles
    EntryInfoStruct[] public rafflesEntryInfo;

    // Map with the player wallets linked to a particular raffle + nft
    mapping(bytes32 => address) public requiredNFTWallets;

    mapping(bytes32 => uint48) public walletsCap;

    // key = collection address + raffleID
    mapping(bytes32 => bool) public whitelistCollections;

    // All the different status a rafVRFCoordinatorfle can have
    enum STATUS {
        CREATED, // the operator creates the raffle
        ACCEPTED, // the seller stakes the nft for the raffle
        EARLY_CASHOUT, // the seller wants to cashout early
        CANCELLED, // the operator cancels the raffle and transfer the remaining funds after 30 days passes
        CLOSING_REQUESTED, // the operator sets a winner
        ENDED, // the raffle is finished, and NFT and funds were transferred
        CANCEL_REQUESTED // operator asks to cancel the raffle. Players has 30 days to ask for a refund
    }

    enum ENTRY_TYPE {
        ONLY_DIRECTLY,
        ONLY_EXTERNAL_CONTRACT,
        MIXED
    }

    // The operator role is operated by a backend application
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR");
    // requested by Hamburger. Role for the buy method of the hamburger (only that contract)
    bytes32 public constant MINTERCONTRACT_ROLE = keccak256("MINTERCONTRACT");

    // address of the wallet controlled by the platform that will receive the platform fee
    address payable public destinationWallet =
        payable(0x52a032cF59eA274f9D745f29b6D514fe95Ba192D);

    constructor(
        address _vrfCoordinator,
        address _linkToken,
        bytes32 _keyHash,
        bool _mainetFee
    )
        VRFConsumerBase(
            _vrfCoordinator, // VRF Coordinator
            _linkToken // LINK Token
        )
    {
        _setupRole(OPERATOR_ROLE, 0x13503B622abC0bD30A7e9687057DF6E8c42Fb928);
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);

        keyHash = _keyHash;
        if (_mainetFee == true)
            fee = 2 * 10 ** 18; // in mainnet, the fee must be 2 LINK
        else fee = 0.1 * 10 ** 18; // 0.1 LINK In Rinkeby and Goerli
    }

    function callVRFAndGetRequestId() internal returns (bytes32 requestId) {
        require(
            LINK.balanceOf(address(this)) >= fee,
            "Not enough LINK - fill contract with faucet"
        );
        bytes32 result = requestRandomness(keyHash, fee);
        return result;
    }

    /// @dev this is the method that will be called by the smart contract to get a random number
    /// @param _id Id of the raffle
    /// @param _entriesSize length of the entries array of that raffle
    /// @param _requestId id generated by Chainlink
    function getRandomNumber(
        uint256 _id,
        uint256 _entriesSize,
        bytes32 _requestId
    ) internal {
        chainlinkRaffleInfo[_requestId] = RaffleInfo({
            id: _id,
            size: _entriesSize
        });
    }

    /// @dev Callback function used by VRF Coordinator. Is called by chainlink
    /// the random number generated is normalized to the size of the entries array, and an event is
    /// generated, that will be listened by the platform backend to be checked if corresponds to a
    /// member of the MW community, and if true will call transferNFTAndFunds
    /// @param requestId id generated previously (on method getRandomNumber by chainlink)
    /// @param randomness random number (huge) generated by chainlink
    function fulfillRandomness(
        bytes32 requestId,
        uint256 randomness
    ) internal override {
        // randomness is the actual random number. Now extract from the aux map the original param id of the call
        RaffleInfo memory raffleInfo = chainlinkRaffleInfo[requestId];
        // save the random number on the map with the original id as key
        uint256 normalizedRandomNumber = (randomness % raffleInfo.size) + 1;

        RandomResult memory result = RandomResult({
            randomNumber: randomness,
            nomalizedRandomNumber: normalizedRandomNumber
        });

        requests[raffleInfo.id] = result;

        // send the event with the original id and the random number
        emit RandomNumberCreated(
            raffleInfo.id,
            randomness,
            normalizedRandomNumber
        );

        transferNFTAndFunds(raffleInfo.id, normalizedRandomNumber);
    }

    //////////////////////////////////////////////

    /// @param _desiredFundsInWeis the amount the seller would like to get from the raffle
    /// @param _collateralAddress The address of the NFT of the raffle
    /// @param _collateralId The id of the NFT (ERC721)
    /// @param _minimumFundsInWeis The mininum amount required for the raffle to set a winner
    /// @param _prices Array of prices and amount of entries the customer could purchase
    //   /// @param _commissionInBasicPoints commission for the platform, in basic points
    /// @notice Creates a raffle
    /// @dev creates a raffle struct and push it to the raffles array. Some data is stored in the funding data structure
    /// sends an event when finished
    //   /// @return raffleId
    function createRaffle(
        uint128 _desiredFundsInWeis,
        uint48 _walletsCap,
        address _collateralAddress,
        uint48 _collateralId,
        uint128 _minimumFundsInWeis,
        PriceStructure[] calldata _prices,
        uint48 _commissionInBasicPoints,
        address[] calldata _collectionWhitelist,
        ENTRY_TYPE _entryType
    ) external onlyRole(OPERATOR_ROLE) {
        require(_collateralAddress != address(0), "NFT is null");
        require(_commissionInBasicPoints <= 5000, "commission too high");

        RaffleStruct memory raffle = RaffleStruct({
            collateralAddress: _collateralAddress,
            collateralId: _collateralId,
            winner: address(0),
            randomNumber: 0,
            seller: address(0),
            platformPercentage: _commissionInBasicPoints
            //cancellingDate: 0
        });
        raffles.push(raffle);

        uint256 idRaffle = raffles.length - 1;

        saveEntryInfo(_collectionWhitelist, _walletsCap, idRaffle);

        require(_prices.length > 0, "No prices");

        for (uint256 i = 0; i < _prices.length; i++) {
            require(_prices[i].numEntries > 0, "numEntries is 0");

            PriceStructure memory p = PriceStructure({
                id: idRaffle,
                numEntries: _prices[i].numEntries,
                price: _prices[i].price
            });

            pricesList[_prices[i].id] = p;
        }

        fundingList[idRaffle] = FundingStructure({
            minimumFundsInWeis: _minimumFundsInWeis,
            desiredFundsInWeis: _desiredFundsInWeis
        });

        emit RaffleCreated(idRaffle, _collateralAddress, _collateralId);

        // Initialize the entries list array, by adding a player and removing it
        EntriesBought memory entryBought = EntriesBought({
            player: msg.sender,
            currentEntriesLength: uint48(1)
        });
        entriesList[idRaffle].push(entryBought);
        delete entriesList[idRaffle][0];
    }

    function saveEntryInfo(
        //  ENTRY_TYPE _entryType,
        address[] calldata _whitelist,
        uint48 _walletsCap,
        uint256 _raffleId
    ) internal {
        bool requireWhitelisting = false;
        uint256 whitelistLength = _whitelist.length;
        if (whitelistLength > 0) {
            requireWhitelisting = true;
            for (uint256 i; i <= whitelistLength - 1; ++i) {
                bytes32 key = keccak256(abi.encode(_whitelist[i], _raffleId));
                whitelistCollections[key] = true;
            }
        }

        EntryInfoStruct memory entryInfo = EntryInfoStruct({
            status: STATUS.CREATED,
            amountRaised: 0,
            entriesLength: 0,
            entryType: ENTRY_TYPE.ONLY_DIRECTLY,
            requireWhitelisting: requireWhitelisting,
            walletsCap: _walletsCap
        });
        rafflesEntryInfo.push(entryInfo);
    }

    /*
    Callable only by the owner of the NFT
    Once the operator has created the raffle, he can stake the NFT
    At this moment, the NFT is locked and the players can buy entries
    */
    /// @param _raffleId Id of the raffle
    /// @notice The owner of the NFT can stake it on the raffle. At this moment the raffle starts and can sell entries to players
    /// @dev the owner must have approved this contract before. Otherwise will revert when transferring from the owner
    function stakeNFT(uint256 _raffleId) external {
        RaffleStruct storage raffle = raffles[_raffleId];
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        // Check if the raffle is already created
        require(entryInfo.status == STATUS.CREATED, "Raffle not CREATED");
        // the owner of the NFT must be the current caller
        IERC721 token = IERC721(raffle.collateralAddress);
        require(
            token.ownerOf(raffle.collateralId) == msg.sender,
            "NFT is not owned by caller"
        );

        entryInfo.status = STATUS.ACCEPTED;
        raffle.seller = msg.sender;

        // transfer the asset to the contract
        token.transferFrom(msg.sender, address(this), raffle.collateralId); // transfer the token to the contract

        emit RaffleStarted(_raffleId, msg.sender);
    }

    /// @dev callable by players. Depending on the number of entries assigned to the price structure the player buys (_id parameter)
    /// one or more entries will be assigned to the player.
    /// Also it is checked the maximum number of entries per user is not reached
    /// As the method is payable, in msg.value there will be the amount paid by the user
    /// @notice If the operator set requiredNFTs when creating the raffle, only the owners of nft on that collection can make a call to this method. This will be
    /// used for special raffles
    /// @param _raffleId: id of the raffle
    /// @param _id: id of the price structure
    function buyEntry(
        uint256 _raffleId,
        uint256 _id,
        address _collection,
        uint256[] calldata _tokenIdUsed
    ) external payable {
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        // 18.05.23 NFT gating
        // if the raffle requires an nft
        if (entryInfo.requireWhitelisting == true) {
            bytes32 collectionHash = keccak256(
                abi.encode(_collection, _raffleId)
            );
            require(
                whitelistCollections[collectionHash] == true,
                "Not in required collection"
            );
            IERC721 requiredNFT = IERC721(_collection);
            // 04.06.23 Richard asked for a contract to have 2 nfts in
            // order to let players participate
            for (uint256 i; i <= 1; ++i) {
                require(
                    requiredNFT.ownerOf(_tokenIdUsed[i]) == msg.sender,
                    "Not the owner of tokenId"
                );
                bytes32 hashRequiredNFT = keccak256(
                    abi.encode(_collection, _raffleId, _tokenIdUsed[i])
                );
                // check the tokenId has not been using yet in the raffle, to avoid abuse
                if (requiredNFTWallets[hashRequiredNFT] == address(0)) {
                    requiredNFTWallets[hashRequiredNFT] = msg.sender;
                } else
                    require(
                        requiredNFTWallets[hashRequiredNFT] == msg.sender,
                        "tokenId used"
                    );
            }
        }

        // 06.05.2023 To avoid late players to buy entries after the draw
        if (entryInfo.status != STATUS.ACCEPTED)
            revert EntryNotAllowed("Not in ACCEPTED");

        // Price checks
        if (_id == 0) revert EntryNotAllowed("howMany is 0");
        PriceStructure memory priceStruct = pricesList[_id];
        if (priceStruct.id != _raffleId)
            revert EntryNotAllowed("Id not in raffleId");
        uint48 numEntries = priceStruct.numEntries;
        if (numEntries == 0) revert EntryNotAllowed("Id not supported");
        if (msg.value != priceStruct.price)
            revert EntryNotAllowed("msg.value must be equal to the price");

        // 31.05.23 wallet cap
        if (entryInfo.walletsCap > 0) {
            bytes32 entriesCountHash = keccak256(
                abi.encode(_raffleId, msg.sender)
            );
            uint48 entriesCount = walletsCap[entriesCountHash];
            if (entriesCount >= entryInfo.walletsCap)
                revert EntryNotAllowed("Wallet already used");
            // update wallet cap of current user
            walletsCap[entriesCountHash] =
                walletsCap[entriesCountHash] +
                priceStruct.numEntries;
        }

        // save the entries onchain
        uint48 entriesLength = entryInfo.entriesLength;
        EntriesBought memory entryBought = EntriesBought({
            player: msg.sender,
            currentEntriesLength: uint48(entriesLength + numEntries)
        });
        if (entryInfo.entriesLength == 0)
            entriesList[_raffleId][0] = entryBought;
        else entriesList[_raffleId].push(entryBought);
        // update raffle variables
        entryInfo.amountRaised += uint128(msg.value);
        entryInfo.entriesLength = entriesLength + numEntries;

        emit EntrySold(_raffleId, msg.sender, entryInfo.entriesLength, _id);
    }

    // The operator can add free entries to the raffle
    /// @param _raffleId Id of the raffle
    /// @param _freePlayers array of addresses corresponding to the wallet of the users that won a free entrie
    /// @dev only operator can make this call. Assigns a single entry per user, except if that user already reached the max limit of entries per user
    function giveBatchEntriesForFree(
        uint256 _raffleId,
        address[] memory _freePlayers
    ) external nonReentrant onlyRole(OPERATOR_ROLE) {
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        require(
            entryInfo.status == STATUS.ACCEPTED,
            "Raffle is not in accepted"
        );

        uint256 freePlayersLength = _freePlayers.length;
        uint48 validPlayersCount = 0;
        for (uint256 i = 0; i < freePlayersLength; i++) {
            address entry = _freePlayers[i];
            {
                // add a new element to the entriesBought array.
                // as this method only adds 1 entry per call, the amountbought is always 1
                EntriesBought memory entryBought = EntriesBought({
                    player: entry,
                    currentEntriesLength: uint48(
                        entryInfo.entriesLength + i + 1
                    )
                });
                entriesList[_raffleId].push(entryBought);

                /*         claimsData[keccak256(abi.encode(entry, _raffleId))]
                    .numEntriesPerUser++;
*/
                ++validPlayersCount;
            }
        }

        entryInfo.entriesLength = entryInfo.entriesLength + validPlayersCount;

        emit FreeEntry(
            _raffleId,
            _freePlayers,
            freePlayersLength,
            entryInfo.entriesLength
        );
    }

    // helper method to get the winner address of a raffle
    /// @param _raffleId Id of the raffle
    /// @param _normalizedRandomNumber Generated by chainlink
    /// @return the wallet that won the raffle
    /// @dev Uses a binary search on the sorted array to retreive the winner
    /// but if the winner candidate is blacklisted, loop through the left looking for
    /// a candidate not blacklisted
    function getWinnerAddressFromRandom(
        uint256 _raffleId,
        uint256 _normalizedRandomNumber
    ) public view returns (address) {
        uint256 position = findUpperBound(
            entriesList[_raffleId],
            _normalizedRandomNumber
        );

        address candidate = entriesList[_raffleId][position].player;
        // general case
        if (candidate != address(0)) return candidate;
        // special case. The user is blacklisted, so try next on the left until find a non-blacklisted
        else {
            bool ended = false;
            uint256 i = position;
            while (
                ended == false && entriesList[_raffleId][i].player == address(0)
            ) {
                if (i == 0) i = entriesList[_raffleId].length - 1;
                else i = i - 1;
                // we came to the beginning without finding a non blacklisted player
                if (i == position) ended == true;
            }
            require(!ended, "All users blacklisted");
            return entriesList[_raffleId][i].player;
        }
    }

    /// @param array sorted array of EntriesBought. CurrentEntriesLength is the numeric field used to sort
    /// @param element uint256 to find. Goes from 1 to entriesLength
    /// @dev based on openzeppelin code (v4.0), modified to use an array of EntriesBought
    /// Searches a sorted array and returns the first index that contains a value greater or equal to element.
    /// If no such index exists (i.e. all values in the array are strictly less than element), the array length is returned. Time complexity O(log n).
    /// array is expected to be sorted in ascending order, and to contain no repeated elements.
    /// https://docs.openzeppelin.com/contracts/3.x/api/utils#Arrays-findUpperBound-uint256---uint256-
    function findUpperBound(
        EntriesBought[] storage array,
        uint256 element
    ) internal view returns (uint256) {
        if (array.length == 0) {
            return 0;
        }

        uint256 low = 0;
        uint256 high = array.length;

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

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

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

    // The operator can call this method once they receive the event "RandomNumberCreated"
    // triggered by the VRF v1 consumer contract (RandomNumber.sol)
    /// @param _raffleId Id of the raffle
    /// @param _normalizedRandomNumber index of the array that contains the winner of the raffle. Generated by chainlink
    /// @notice it is the method that sets the winner and transfers funds and nft
    /// @dev called by Chainlink callback
    function transferNFTAndFunds(
        uint256 _raffleId,
        uint256 _normalizedRandomNumber
    ) internal nonReentrant {
        RaffleStruct storage raffle = raffles[_raffleId];
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        // Only when the raffle has been asked to be closed and the platform
        require(
            entryInfo.status == STATUS.EARLY_CASHOUT ||
                entryInfo.status == STATUS.CLOSING_REQUESTED,
            "Raffle in wrong status"
        );

        raffle.randomNumber = _normalizedRandomNumber;
        raffle.winner = getWinnerAddressFromRandom(
            _raffleId,
            _normalizedRandomNumber
        );
        entryInfo.status = STATUS.ENDED;

        IERC721 _asset = IERC721(raffle.collateralAddress);
        _asset.transferFrom(address(this), raffle.winner, raffle.collateralId); // transfer the tokens to the contract

        uint256 amountForPlatform = (entryInfo.amountRaised *
            raffle.platformPercentage) / 10000;
        uint256 amountForSeller = entryInfo.amountRaised - amountForPlatform;
        // transfer amount (75%) to the seller.
        (bool sent, ) = raffle.seller.call{value: amountForSeller}("");
        require(sent, "Failed to send Ether");
        // transfer the amount to the platform
        (bool sent2, ) = destinationWallet.call{value: amountForPlatform}("");
        require(sent2, "Failed send Eth to MW");
        emit FeeTransferredToPlatform(_raffleId, amountForPlatform);

        emit RaffleEnded(
            _raffleId,
            raffle.winner,
            entryInfo.amountRaised,
            _normalizedRandomNumber
        );
    }

    function setCashOutActions(
        uint256 _raffleId
    ) internal returns (EntryInfoStruct memory) {
        RaffleStruct memory raffle = raffles[_raffleId];
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        FundingStructure memory funding = fundingList[_raffleId];

        require(raffle.seller == msg.sender, "Not the seller");
        // Check if the raffle is already accepted
        require(
            entryInfo.status == STATUS.ACCEPTED,
            "Raffle not in accepted status"
        );
        require(
            entryInfo.amountRaised >= funding.minimumFundsInWeis,
            "Not enough funds raised"
        );

        entryInfo.status = STATUS.EARLY_CASHOUT;

        emit EarlyCashoutTriggered(_raffleId, entryInfo.amountRaised);

        return entryInfo;
    }

    // can be called by the seller at every moment once enough funds has been raised
    /// @param _raffleId Id of the raffle
    /// @notice the seller of the nft, if the minimum amount has been reached, can call an early cashout, finishing the raffle
    /// @dev it triggers Chainlink VRF1 consumer, and generates a random number that is normalized and checked that corresponds to a MW player
    function earlyCashOut(uint256 _raffleId) external {
    /*    EntryInfoStruct memory raffle = setWinnerActions(_raffleId);
        bytes32 requestId = callVRFAndGetRequestId();
        getRandomNumber(_raffleId, raffle.entriesLength, requestId);*/
    }

    function setWinnerActions(
        uint256 _raffleId
    ) internal returns (EntryInfoStruct memory) {
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        // RaffleStruct storage raffle = raffles[_raffleId];
        FundingStructure storage funding = fundingList[_raffleId];
        // Check if the raffle is already accepted or is called again because early cashout failed
        require(entryInfo.status == STATUS.ACCEPTED, "Raffle in wrong status");
        require(
            entryInfo.amountRaised >= funding.minimumFundsInWeis,
            "Not enough funds raised"
        );

        require(
            funding.desiredFundsInWeis <= entryInfo.amountRaised,
            "Desired funds not raised"
        );
        entryInfo.status = STATUS.CLOSING_REQUESTED;

        emit SetWinnerTriggered(_raffleId, entryInfo.amountRaised);
        return entryInfo;
    }

    /// @param _raffleId Id of the raffle
    /// @notice the operator finish the raffle, if the desired funds has been reached
    /// @dev it triggers Chainlink VRF1 consumer, and generates a random number that is normalized and checked that corresponds to a MW player
    function setWinner(
        uint256 _raffleId
    ) external nonReentrant onlyRole(OPERATOR_ROLE) {
        EntryInfoStruct memory raffle = setWinnerActions(_raffleId);
        // this call trigers the VRF v1 process from Chainlink

        bytes32 requestId = callVRFAndGetRequestId();
        getRandomNumber(_raffleId, raffle.entriesLength, requestId);
    }

    /// @param _newAddress new address of the platform
    /// @dev Change the wallet of the platform. The one that will receive the platform fee when the raffle is closed.
    /// Only the admin can change this
    function setDestinationAddress(
        address payable _newAddress
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        destinationWallet = _newAddress;
    }

    /// @param _raffleId Id of the raffle
    /// @dev The operator can cancel the raffle. The NFT is sent back to the seller
    /// The raised funds are send to the destination wallet. The buyers will
    /// be refunded offchain in the metawin wallet
    function cancelRaffle(
        uint256 _raffleId
    ) external nonReentrant onlyRole(OPERATOR_ROLE) {
        RaffleStruct memory raffle = raffles[_raffleId];
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        // Dont cancel twice, or cancel an already ended raffle
        require(
            entryInfo.status != STATUS.ENDED &&
                entryInfo.status != STATUS.CANCELLED &&
                entryInfo.status != STATUS.EARLY_CASHOUT &&
                entryInfo.status != STATUS.CLOSING_REQUESTED &&
                entryInfo.status != STATUS.CANCEL_REQUESTED,
            "Wrong status"
        );

        // only if the raffle is in accepted status the NFT is staked and could have entries sold
        if (entryInfo.status == STATUS.ACCEPTED) {
            // transfer nft to the owner
            IERC721 _asset = IERC721(raffle.collateralAddress);
            _asset.transferFrom(
                address(this),
                raffle.seller,
                raffle.collateralId
            );
        }
        entryInfo.status = STATUS.CANCEL_REQUESTED;
        //     raffle.cancellingDate = uint48(block.timestamp);

        emit RaffleCancelled(_raffleId, entryInfo.amountRaised);
    }

    /// @param _raffleId Id of the raffle
    /// @dev after 30 days after cancelling passes, the operator can transfer to
    /// destinationWallet the remaining funds
    function transferRemainingFunds(
        uint256 _raffleId
    ) external nonReentrant onlyRole(OPERATOR_ROLE) {
        //     RaffleStruct memory raffle = raffles[_raffleId];
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];
        require(
            entryInfo.status == STATUS.CANCELLED ||
                entryInfo.status == STATUS.CANCEL_REQUESTED,
            "Wrong status"
        );

        entryInfo.status = STATUS.CANCELLED;

        (bool sent, ) = destinationWallet.call{value: entryInfo.amountRaised}(
            ""
        );
        require(sent, "Fail send Eth to MW");

        emit RemainingFundsTransferred(_raffleId, entryInfo.amountRaised);

        entryInfo.amountRaised = 0;
    }

    /// @param _raffleId Id of the raffle
    /// @return array of entries bougth of that particular raffle
    function getEntriesBought(
        uint256 _raffleId
    ) external view returns (EntriesBought[] memory) {
        return entriesList[_raffleId];
    }

    /*   /// @param _raffleId Id of the raffle
    /// @param _player wallet of the player
    /// @return Claims data of the player on that raffle
    function getClaimData(
        uint256 _raffleId,
        address _player
    ) external view returns (ClaimStruct memory) {
        return claimsData[keccak256(abi.encode(_player, _raffleId))];
    }
*/

    /// @dev for different reasons player entries should be void
    /// this has a cost in gas, but this makes cheaper in gas the callback from chainlink
    /// This method has to be called for every raffle of the blacklisted player
    /// @param _raffleId Id of the raffle
    /// @param entriesToCancel array that contains the index of the entries to cancel. 0 based
    /// @param _player player who owns the entry to be voided
    function cancelEntry(
        uint256 _raffleId,
        uint256[] calldata entriesToCancel,
        address _player
    ) external onlyRole(OPERATOR_ROLE) {
        uint256 totalEntriesBoughtCancelled = 0;
        for (uint256 i = 0; i < entriesToCancel.length; i++) {
            EntriesBought storage entry = entriesList[_raffleId][
                entriesToCancel[i]
            ];

            require(entry.player == _player, "Entry did not belong to player");

            entry.player = address(0);

            uint256 previousTotalEntriesLength;
            if (entriesToCancel[i] == 0) previousTotalEntriesLength = 0;
            else
                previousTotalEntriesLength = entriesList[_raffleId][
                    entriesToCancel[i] 
                ].currentEntriesLength;
            totalEntriesBoughtCancelled +=
                entry.currentEntriesLength -
                previousTotalEntriesLength;
        }
        emit EntryCancelled(_raffleId, totalEntriesBoughtCancelled, _player);
    }

    // Requested by Valerio Di Napoli.
    /// @param _raffleId id of the raffle
    /// @param _amountOfEntries amount of entries. Must be lower than maxEntriesPerUser
    /// @param _player The address of the player
    /// @notice Called by other contract created by Valerio, that minted an NFT and after that call this method
    /// @dev add entries but they are free so no payable
    function createFreeEntriesFromExternalContract(
        uint256 _raffleId,
        uint48 _amountOfEntries,
        address _player
    ) external onlyRole(MINTERCONTRACT_ROLE) nonReentrant {
        // if can buy run this code.
        // bytes32 hash = keccak256(abi.encode(_player, _raffleId));

        //    RaffleStruct storage raffle = raffles[_raffleId];
        EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];

        require(
            entryInfo.entryType == ENTRY_TYPE.ONLY_EXTERNAL_CONTRACT ||
                entryInfo.entryType == ENTRY_TYPE.MIXED,
            "Entry type not allowed"
        );

        EntriesBought memory entryBought = EntriesBought({
            player: _player,
            currentEntriesLength: entryInfo.entriesLength + _amountOfEntries
        });
        entriesList[_raffleId].push(entryBought);

        // update the field entriesLength.
        entryInfo.entriesLength += _amountOfEntries;
        //update claim data
        //     claimsData[hash].numEntriesPerUser += _amountOfEntries;

        address[] memory players = new address[](1);
        players[0] = _player;
        emit FreeEntry(
            _raffleId,
            players,
            _amountOfEntries,
            entryInfo.entriesLength
        );
    }

    function getRafflesEntryInfo(
        uint256 _raffleId
    ) public view returns (EntryInfoStruct memory) {
        return rafflesEntryInfo[_raffleId];
    }

    function playerIsBlacklisted(address _player) external pure returns (bool) {
        //  return blackListManager.isBlackListed(_player);
        return false;
    }

    function raffleNotInAcceptedState(
        uint256 _raffleId
    ) external view returns (bool) {
        EntryInfoStruct memory entryInfo = rafflesEntryInfo[_raffleId];
        return (entryInfo.status != STATUS.ACCEPTED);
    }

    function playerIsSeller(
        address _player,
        uint256 _raffleId
    ) external view returns (bool) {
        RaffleStruct memory raffle = raffles[_raffleId];
        return (raffle.seller == _player);
    }

    function playerReachedMaxEntries(
        address _player,
        uint256 _raffleId,
        uint256 _amountOfEntries
    ) external pure returns (bool) {
        /*     EntryInfoStruct storage entryInfo = rafflesEntryInfo[_raffleId];

        bytes32 hash = keccak256(abi.encode(_player, _raffleId));
        // check there are enough entries left for this particular user
        return (claimsData[hash].numEntriesPerUser + _amountOfEntries >
            entryInfo.maxEntries);*/
        return false;
    }

    /* Requested by Valerio Di Napoli.
    @param _player The address of the player    
    @param _raffleId id of the raffle
    @param _colection Address of the required collection, if any
    @param _tokenIdUsed Id of the token of the required collection the player says he has and want to use in the raffle
    @returns bool if the player can buy or not, and string with the cause of the rejection. "" if can buy
    @notice Method that returns if the user can or cannot buy entries because the player owns an nft in the case or required collections.
    */
    function playerHasRequiredNFTs(
        address _player,
        uint256 _raffleId,
        address _collection,
        uint256 _tokenIdUsed
    ) external pure returns (bool canBuy, string memory cause) {
        return (true, "");
    }
}

File 2 of 13 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

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

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

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

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

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`.
        // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
        // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
        // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
        // good first aproximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1;
        uint256 x = a;
        if (x >> 128 > 0) {
            x >>= 128;
            result <<= 64;
        }
        if (x >> 64 > 0) {
            x >>= 64;
            result <<= 32;
        }
        if (x >> 32 > 0) {
            x >>= 32;
            result <<= 16;
        }
        if (x >> 16 > 0) {
            x >>= 16;
            result <<= 8;
        }
        if (x >> 8 > 0) {
            x >>= 8;
            result <<= 4;
        }
        if (x >> 4 > 0) {
            x >>= 4;
            result <<= 2;
        }
        if (x >> 2 > 0) {
            result <<= 1;
        }

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

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

File 3 of 13 : 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 4 of 13 : 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 5 of 13 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 7 of 13 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: 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 Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

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

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

File 8 of 13 : 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 9 of 13 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @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 Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    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 have ``role``'s admin role.
     */
    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 granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 10 of 13 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev 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})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @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 virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @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`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    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.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 11 of 13 : LinkTokenInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface LinkTokenInterface {
  function allowance(address owner, address spender) external view returns (uint256 remaining);

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

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

  function decimals() external view returns (uint8 decimalPlaces);

  function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);

  function increaseApproval(address spender, uint256 subtractedValue) external;

  function name() external view returns (string memory tokenName);

  function symbol() external view returns (string memory tokenSymbol);

  function totalSupply() external view returns (uint256 totalTokensIssued);

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

  function transferAndCall(
    address to,
    uint256 value,
    bytes calldata data
  ) external returns (bool success);

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

File 12 of 13 : VRFRequestIDBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract VRFRequestIDBase {
  /**
   * @notice returns the seed which is actually input to the VRF coordinator
   *
   * @dev To prevent repetition of VRF output due to repetition of the
   * @dev user-supplied seed, that seed is combined in a hash with the
   * @dev user-specific nonce, and the address of the consuming contract. The
   * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
   * @dev the final seed, but the nonce does protect against repetition in
   * @dev requests which are included in a single block.
   *
   * @param _userSeed VRF seed input provided by user
   * @param _requester Address of the requesting contract
   * @param _nonce User-specific nonce at the time of the request
   */
  function makeVRFInputSeed(
    bytes32 _keyHash,
    uint256 _userSeed,
    address _requester,
    uint256 _nonce
  ) internal pure returns (uint256) {
    return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
  }

  /**
   * @notice Returns the id for this request
   * @param _keyHash The serviceAgreement ID to be used for this request
   * @param _vRFInputSeed The seed to be passed directly to the VRF
   * @return The id for this request
   *
   * @dev Note that _vRFInputSeed is not the seed passed by the consuming
   * @dev contract, but the one generated by makeVRFInputSeed
   */
  function makeRequestId(bytes32 _keyHash, uint256 _vRFInputSeed) internal pure returns (bytes32) {
    return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
  }
}

File 13 of 13 : VRFConsumerBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./interfaces/LinkTokenInterface.sol";

import "./VRFRequestIDBase.sol";

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constructor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator, _link) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash), and have told you the minimum LINK
 * @dev price for VRF service. Make sure your contract has sufficient LINK, and
 * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
 * @dev want to generate randomness from.
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomness method.
 *
 * @dev The randomness argument to fulfillRandomness is the actual random value
 * @dev generated from your seed.
 *
 * @dev The requestId argument is generated from the keyHash and the seed by
 * @dev makeRequestId(keyHash, seed). If your contract could have concurrent
 * @dev requests open, you can use the requestId to track which seed is
 * @dev associated with which randomness. See VRFRequestIDBase.sol for more
 * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.)
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ. (Which is critical to making unpredictable randomness! See the
 * @dev next section.)
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the ultimate input to the VRF is mixed with the block hash of the
 * @dev block in which the request is made, user-provided seeds have no impact
 * @dev on its economic security properties. They are only included for API
 * @dev compatability with previous versions of this contract.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request.
 */
abstract contract VRFConsumerBase is VRFRequestIDBase {
  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBase expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomness the VRF output
   */
  function fulfillRandomness(bytes32 requestId, uint256 randomness) internal virtual;

  /**
   * @dev In order to keep backwards compatibility we have kept the user
   * seed field around. We remove the use of it because given that the blockhash
   * enters later, it overrides whatever randomness the used seed provides.
   * Given that it adds no security, and can easily lead to misunderstandings,
   * we have removed it from usage and can now provide a simpler API.
   */
  uint256 private constant USER_SEED_PLACEHOLDER = 0;

  /**
   * @notice requestRandomness initiates a request for VRF output given _seed
   *
   * @dev The fulfillRandomness method receives the output, once it's provided
   * @dev by the Oracle, and verified by the vrfCoordinator.
   *
   * @dev The _keyHash must already be registered with the VRFCoordinator, and
   * @dev the _fee must exceed the fee specified during registration of the
   * @dev _keyHash.
   *
   * @dev The _seed parameter is vestigial, and is kept only for API
   * @dev compatibility with older versions. It can't *hurt* to mix in some of
   * @dev your own randomness, here, but it's not necessary because the VRF
   * @dev oracle will mix the hash of the block containing your request into the
   * @dev VRF seed it ultimately uses.
   *
   * @param _keyHash ID of public key against which randomness is generated
   * @param _fee The amount of LINK to send with the request
   *
   * @return requestId unique ID for this request
   *
   * @dev The returned requestId can be used to distinguish responses to
   * @dev concurrent requests. It is passed as the first argument to
   * @dev fulfillRandomness.
   */
  function requestRandomness(bytes32 _keyHash, uint256 _fee) internal returns (bytes32 requestId) {
    LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
    // This is the seed passed to VRFCoordinator. The oracle will mix this with
    // the hash of the block containing this request to obtain the seed/input
    // which is finally passed to the VRF cryptographic machinery.
    uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
    // nonces[_keyHash] must stay in sync with
    // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
    // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
    // This provides protection against the user repeating their input seed,
    // which would result in a predictable/duplicate output, if multiple such
    // requests appeared in the same block.
    nonces[_keyHash] = nonces[_keyHash] + 1;
    return makeRequestId(_keyHash, vRFSeed);
  }

  LinkTokenInterface internal immutable LINK;
  address private immutable vrfCoordinator;

  // Nonces for each VRF key from which randomness has been requested.
  //
  // Must stay in sync with VRFCoordinator[_keyHash][this]
  mapping(bytes32 => uint256) /* keyHash */ /* nonce */
    private nonces;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   * @param _link address of LINK token contract
   *
   * @dev https://docs.chain.link/docs/link-token-contracts
   */
  constructor(address _vrfCoordinator, address _link) {
    vrfCoordinator = _vrfCoordinator;
    LINK = LinkTokenInterface(_link);
  }

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
    require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
    fulfillRandomness(requestId, randomness);
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"address","name":"_linkToken","type":"address"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"bool","name":"_mainetFee","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"string","name":"errorType","type":"string"}],"name":"EntryNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountRaised","type":"uint256"}],"name":"EarlyCashoutTriggered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOfEntriesCanceled","type":"uint256"},{"indexed":false,"internalType":"address","name":"player","type":"address"}],"name":"EntryCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"currentSize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceStructureId","type":"uint256"}],"name":"EntrySold","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountTransferred","type":"uint256"}],"name":"FeeTransferredToPlatform","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"buyer","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currentSize","type":"uint256"}],"name":"FreeEntry","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountRaised","type":"uint256"}],"name":"RaffleCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"RaffleCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"winner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountRaised","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"randomNumber","type":"uint256"}],"name":"RaffleEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"}],"name":"RaffleStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"idFromMetawin","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"randomNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"normalizedRandomNumber","type":"uint256"}],"name":"RandomNumberCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountInWeis","type":"uint256"},{"indexed":true,"internalType":"address","name":"player","type":"address"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountInWeis","type":"uint256"}],"name":"RemainingFundsTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountRaised","type":"uint256"}],"name":"SetWinnerTriggered","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTERCONTRACT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256[]","name":"_tokenIdUsed","type":"uint256[]"}],"name":"buyEntry","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"uint256[]","name":"entriesToCancel","type":"uint256[]"},{"internalType":"address","name":"_player","type":"address"}],"name":"cancelEntry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"cancelRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"chainlinkRaffleInfo","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"uint48","name":"_amountOfEntries","type":"uint48"},{"internalType":"address","name":"_player","type":"address"}],"name":"createFreeEntriesFromExternalContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_desiredFundsInWeis","type":"uint128"},{"internalType":"uint48","name":"_walletsCap","type":"uint48"},{"internalType":"address","name":"_collateralAddress","type":"address"},{"internalType":"uint48","name":"_collateralId","type":"uint48"},{"internalType":"uint128","name":"_minimumFundsInWeis","type":"uint128"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint48","name":"numEntries","type":"uint48"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct MultipleNFTGatedLean.PriceStructure[]","name":"_prices","type":"tuple[]"},{"internalType":"uint48","name":"_commissionInBasicPoints","type":"uint48"},{"internalType":"address[]","name":"_collectionWhitelist","type":"address[]"},{"internalType":"enum MultipleNFTGatedLean.ENTRY_TYPE","name":"_entryType","type":"uint8"}],"name":"createRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"destinationWallet","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"earlyCashOut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"entriesList","outputs":[{"internalType":"uint48","name":"currentEntriesLength","type":"uint48"},{"internalType":"address","name":"player","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"fundingList","outputs":[{"internalType":"uint128","name":"minimumFundsInWeis","type":"uint128"},{"internalType":"uint128","name":"desiredFundsInWeis","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"getEntriesBought","outputs":[{"components":[{"internalType":"uint48","name":"currentEntriesLength","type":"uint48"},{"internalType":"address","name":"player","type":"address"}],"internalType":"struct MultipleNFTGatedLean.EntriesBought[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"getRafflesEntryInfo","outputs":[{"components":[{"internalType":"bool","name":"requireWhitelisting","type":"bool"},{"internalType":"enum MultipleNFTGatedLean.STATUS","name":"status","type":"uint8"},{"internalType":"enum MultipleNFTGatedLean.ENTRY_TYPE","name":"entryType","type":"uint8"},{"internalType":"uint48","name":"walletsCap","type":"uint48"},{"internalType":"uint48","name":"entriesLength","type":"uint48"},{"internalType":"uint128","name":"amountRaised","type":"uint128"}],"internalType":"struct MultipleNFTGatedLean.EntryInfoStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"uint256","name":"_normalizedRandomNumber","type":"uint256"}],"name":"getWinnerAddressFromRandom","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"address[]","name":"_freePlayers","type":"address[]"}],"name":"giveBatchEntriesForFree","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"_player","type":"address"},{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_tokenIdUsed","type":"uint256"}],"name":"playerHasRequiredNFTs","outputs":[{"internalType":"bool","name":"canBuy","type":"bool"},{"internalType":"string","name":"cause","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"playerIsBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"},{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"playerIsSeller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"},{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"uint256","name":"_amountOfEntries","type":"uint256"}],"name":"playerReachedMaxEntries","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pricesList","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint48","name":"numEntries","type":"uint48"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"raffleNotInAcceptedState","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffles","outputs":[{"internalType":"uint48","name":"platformPercentage","type":"uint48"},{"internalType":"uint48","name":"collateralId","type":"uint48"},{"internalType":"address","name":"collateralAddress","type":"address"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"randomNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rafflesEntryInfo","outputs":[{"internalType":"bool","name":"requireWhitelisting","type":"bool"},{"internalType":"enum MultipleNFTGatedLean.STATUS","name":"status","type":"uint8"},{"internalType":"enum MultipleNFTGatedLean.ENTRY_TYPE","name":"entryType","type":"uint8"},{"internalType":"uint48","name":"walletsCap","type":"uint48"},{"internalType":"uint48","name":"entriesLength","type":"uint48"},{"internalType":"uint128","name":"amountRaised","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","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":"uint256","name":"","type":"uint256"}],"name":"requests","outputs":[{"internalType":"uint256","name":"randomNumber","type":"uint256"},{"internalType":"uint256","name":"nomalizedRandomNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"requiredNFTWallets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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 payable","name":"_newAddress","type":"address"}],"name":"setDestinationAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"setWinner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"stakeNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"transferRemainingFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"walletsCap","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"whitelistCollections","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60c0604052600f80546001600160a01b0319167352a032cf59ea274f9d745f29b6d514fe95ba192d1790553480156200003757600080fd5b5060405162004d9138038062004d918339810160408190526200005a91620001cc565b600180556001600160601b0319606085811b821660a05284901b16608052620000b87f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c7313503b622abc0bd30a7e9687057df6e8c42fb928620000ff565b620000c5600033620000ff565b600382905560018115151415620000e857671bc16d674ec80000600455620000f5565b67016345785d8a00006004555b5050505062000224565b6200010b82826200010f565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200010b576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200016b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b80516001600160a01b0381168114620001c757600080fd5b919050565b60008060008060808587031215620001e2578384fd5b620001ed85620001af565b9350620001fd60208601620001af565b9250604085015191506060850151801515811462000219578182fd5b939692955090935050565b60805160601c60a05160601c614b336200025e60003960008181611d9601526138bd015260008181613270015261388e0152614b336000f3fe60806040526004361061023b5760003560e01c80635d4bc0ce1161012e578063a9a32d77116100ab578063ddba6e6b1161006f578063ddba6e6b14610848578063eb99038c146108ae578063f3691455146108d2578063f5b541a6146108f2578063f720e7081461091457600080fd5b8063a9a32d7714610791578063babdf60b146107b1578063bb459ec4146107f5578063d547741f14610808578063d649214c1461082857600080fd5b806381d12c58116100f257806381d12c58146106db57806391d148541461070f57806393a75d021461072f57806394985ddd1461075c578063a217fddf1461077c57600080fd5b80635d4bc0ce146105e15780635fba3171146106475780636eb604e0146106675780637c903fc0146106875780637fa4cacb146106bb57600080fd5b80632a596800116101bc57806336734e341161018057806336734e341461052157806336a418bf146105415780633a3956c2146105715780634239a50c146105a357806353b7a59b146105c157600080fd5b80632a5968001461044b5780632f2ff15d14610494578063317f3059146104b457806336568abe146104d4578063365e3658146104f457600080fd5b80630df71602116102035780630df716021461035e5780631a0187f51461037e5780631e6cd395146103cc5780631fe96857146103ec578063248a9ca31461040d57600080fd5b8063013805c51461024057806301ffc9a71461028b578063039be558146102bb578063043a1c9a1461031c5780630b148ff01461033c575b600080fd5b34801561024c57600080fd5b5061026061025b366004614223565b610960565b6040805165ffffffffffff90931683526001600160a01b039091166020830152015b60405180910390f35b34801561029757600080fd5b506102ab6102a6366004614244565b6109a8565b6040519015158152602001610282565b3480156102c757600080fd5b506102fc6102d63660046141dc565b6008602052600090815260409020546001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610282565b34801561032857600080fd5b506102ab610337366004614116565b6109df565b34801561034857600080fd5b5061035c61035736600461452d565b610a8c565b005b34801561036a57600080fd5b5061035c6103793660046141dc565b610d81565b34801561038a57600080fd5b506103b46103993660046141dc565b600c602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610282565b3480156103d857600080fd5b506102ab6103e73660046141dc565b610e22565b3480156103f857600080fd5b506102ab6104073660046140de565b50600090565b34801561041957600080fd5b5061043d6104283660046141dc565b60009081526020819052604090206001015490565b604051908152602001610282565b34801561045757600080fd5b5061047f6104663660046141dc565b6006602052600090815260409020805460019091015482565b60408051928352602083019190915201610282565b3480156104a057600080fd5b5061035c6104af3660046141f4565b610f75565b3480156104c057600080fd5b5061035c6104cf3660046141dc565b610f9f565b3480156104e057600080fd5b5061035c6104ef3660046141f4565b6111c2565b34801561050057600080fd5b5061051461050f3660046141dc565b611240565b604051610282919061474c565b34801561052d57600080fd5b5061035c61053c366004614395565b6112ce565b34801561054d57600080fd5b506102ab61055c3660046141dc565b600e6020526000908152604090205460ff1681565b34801561057d57600080fd5b5061059161058c3660046141dc565b61154b565b604051610282969594939291906147ac565b3480156105af57600080fd5b5061035c6105be3660046141dc565b50565b3480156105cd57600080fd5b50600f546103b4906001600160a01b031681565b3480156105ed57600080fd5b506106016105fc3660046141dc565b6115b0565b6040805165ffffffffffff97881681529690951660208701526001600160a01b0393841694860194909452908216606085015216608083015260a082015260c001610282565b34801561065357600080fd5b5061035c6106623660046141dc565b611613565b34801561067357600080fd5b5061035c6106823660046141dc565b611958565b34801561069357600080fd5b5061043d7fde5ee446972f4e39ab62c03aa34b2096680a875c3fdb3eb2f947cbb93341c05881565b3480156106c757600080fd5b5061035c6106d63660046140de565b611bd5565b3480156106e757600080fd5b5061047f6106f63660046141dc565b6005602052600090815260409020805460019091015482565b34801561071b57600080fd5b506102ab61072a3660046141f4565b611c03565b34801561073b57600080fd5b5061074f61074a3660046141dc565b611c2c565b6040516102829190614865565b34801561076857600080fd5b5061035c610777366004614223565b611d8b565b34801561078857600080fd5b5061043d600081565b34801561079d57600080fd5b5061035c6107ac36600461426c565b611e0d565b3480156107bd57600080fd5b506107e76107cc366004614141565b60408051602081019091526000815260019094509492505050565b604051610282929190614800565b61035c6108033660046144c5565b612397565b34801561081457600080fd5b5061035c6108233660046141f4565b612b52565b34801561083457600080fd5b5061035c610843366004614468565b612b77565b34801561085457600080fd5b5061088c6108633660046141dc565b600760205260009081526040902080546001820154600290920154909165ffffffffffff169083565b6040805193845265ffffffffffff909216602084015290820152606001610282565b3480156108ba57600080fd5b506102ab6108c9366004614188565b60009392505050565b3480156108de57600080fd5b506103b46108ed366004614223565b612d98565b3480156108fe57600080fd5b5061043d600080516020614ade83398151915281565b34801561092057600080fd5b5061094961092f3660046141dc565b600d6020526000908152604090205465ffffffffffff1681565b60405165ffffffffffff9091168152602001610282565b6009602052816000526040600020818154811061097c57600080fd5b60009182526020909120015465ffffffffffff81169250600160301b90046001600160a01b0316905082565b60006001600160e01b03198216637965db0b60e01b14806109d957506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080600a8381548110610a0357634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160c0810182526004909302909101805465ffffffffffff8082168552600160301b820416948401949094526001600160a01b03600160601b909404841691830191909152600181015483166060830152600281015483166080830181905260039091015460a0909201919091529085161491505092915050565b7fde5ee446972f4e39ab62c03aa34b2096680a875c3fdb3eb2f947cbb93341c058610ab681612f3e565b60026001541415610ae25760405162461bcd60e51b8152600401610ad99061482e565b60405180910390fd5b60026001819055506000600b8581548110610b0d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200190506001815462010000900460ff166002811115610b4657634e487b7160e01b600052602160045260246000fd5b1480610b7b57506002815462010000900460ff166002811115610b7957634e487b7160e01b600052602160045260246000fd5b145b610bc05760405162461bcd60e51b8152602060048201526016602482015275115b9d1c9e481d1e5c19481b9bdd08185b1b1bddd95960521b6044820152606401610ad9565b60006040518060400160405280868460000160099054906101000a900465ffffffffffff16610bef9190614914565b65ffffffffffff90811682526001600160a01b0380881660209384015260008a815260098085526040822080546001810182559083529185902086519201805495870151909316600160301b026001600160d01b03199095169184169190911793909317905584549293508792859291610c73918591600160481b90910416614914565b92506101000a81548165ffffffffffff021916908365ffffffffffff1602179055506000600167ffffffffffffffff811115610cbf57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610ce8578160200160208202803683370190505b5090508481600081518110610d0d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152825460405188917f4da4f5fab0816c65315b6f5d15f879f96b98661133d7b3787788f291367604fb91610d6c9185918b9165ffffffffffff600160481b909104169061471a565b60405180910390a25050600180555050505050565b60026001541415610da45760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade833981519152610dc181612f3e565b6000610dcc83612f48565b90506000610dd8613252565b9050610e1884836080015165ffffffffffff1683604080518082018252938452602080850193845260009283526006905290209151825551600190910155565b5050600180555050565b600080600b8381548110610e4657634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160c081019091529101805460ff808216151584529293919291840191610100909104166006811115610e9757634e487b7160e01b600052602160045260246000fd5b6006811115610eb657634e487b7160e01b600052602160045260246000fd5b8152815460209091019062010000900460ff166002811115610ee857634e487b7160e01b600052602160045260246000fd5b6002811115610f0757634e487b7160e01b600052602160045260246000fd5b8152905465ffffffffffff6301000000820481166020840152600160481b82041660408301526001600160801b03600160781b909104166060909101529050600181602001516006811115610f6c57634e487b7160e01b600052602160045260246000fd5b14159392505050565b600082815260208190526040902060010154610f9081612f3e565b610f9a8383613364565b505050565b60026001541415610fc25760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade833981519152610fdf81612f3e565b6000600b838154811061100257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060038154610100900460ff16600681111561103a57634e487b7160e01b600052602160045260246000fd5b148061106e575060068154610100900460ff16600681111561106c57634e487b7160e01b600052602160045260246000fd5b145b6110a95760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610ad9565b805461ff00191661030017808255600f546040516000926001600160a01b0390921691600160781b90046001600160801b0316908381818185875af1925050503d8060008114611115576040519150601f19603f3d011682016040523d82523d6000602084013e61111a565b606091505b50509050806111615760405162461bcd60e51b81526020600482015260136024820152724661696c2073656e642045746820746f204d5760681b6044820152606401610ad9565b8154604051600160781b9091046001600160801b0316815284907fcdef6558dae40f2699846eedf449462daab85b1224ad7f077569ba91aaa949259060200160405180910390a2508054600160781b600160f81b0319169055505060018055565b6001600160a01b03811633146112325760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ad9565b61123c82826133e8565b5050565b606060096000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156112c3576000848152602090819020604080518082019091529084015465ffffffffffff81168252600160301b90046001600160a01b031681830152825260019092019101611275565b505050509050919050565b600260015414156112f15760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade83398151915261130e81612f3e565b6000600b848154811061133157634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060018154610100900460ff16600681111561136957634e487b7160e01b600052602160045260246000fd5b146113b65760405162461bcd60e51b815260206004820152601960248201527f526166666c65206973206e6f7420696e206163636570746564000000000000006044820152606401610ad9565b82516000805b828110156114b85760008682815181106113e657634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006040518060400160405280848860000160099054906101000a900465ffffffffffff1665ffffffffffff1661142791906148fc565b6114329060016148fc565b65ffffffffffff90811682526001600160a01b0380861660209384015260008d8152600984526040812080546001810182559082529084902085519101805494860151909216600160301b026001600160d01b031990941692169190911791909117905590506114a184614a36565b9350505080806114b090614a1b565b9150506113bc565b5082546114d5908290600160481b900465ffffffffffff16614914565b835465ffffffffffff60481b1916600160481b65ffffffffffff92831681029190911780865560405189937f4da4f5fab0816c65315b6f5d15f879f96b98661133d7b3787788f291367604fb93611537938b93899392909104909116906146e9565b60405180910390a250506001805550505050565b600b818154811061155b57600080fd5b60009182526020909120015460ff808216925061010082048116916201000081049091169065ffffffffffff63010000008204811691600160481b8104909116906001600160801b03600160781b9091041686565b600a81815481106115c057600080fd5b6000918252602090912060049091020180546001820154600283015460039093015465ffffffffffff8084169550600160301b840416936001600160a01b03600160601b90940484169392831692169086565b600260015414156116365760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade83398151915261165381612f3e565b6000600a838154811061167657634e487b7160e01b600052603260045260246000fd5b600091825260208083206040805160c0810182526004909402909101805465ffffffffffff8082168652600160301b820416938501939093526001600160a01b03600160601b909304831691840191909152600181015482166060840152600281015490911660808301526003015460a0820152600b8054919350908590811061171057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060058154610100900460ff16600681111561174857634e487b7160e01b600052602160045260246000fd5b1415801561177f575060038154610100900460ff16600681111561177c57634e487b7160e01b600052602160045260246000fd5b14155b80156117b4575060028154610100900460ff1660068111156117b157634e487b7160e01b600052602160045260246000fd5b14155b80156117e9575060048154610100900460ff1660068111156117e657634e487b7160e01b600052602160045260246000fd5b14155b801561181e575060068154610100900460ff16600681111561181b57634e487b7160e01b600052602160045260246000fd5b14155b6118595760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610ad9565b60018154610100900460ff16600681111561188457634e487b7160e01b600052602160045260246000fd5b14156118fb576040808301516080840151602085015192516323b872dd60e01b815291926001600160a01b038416926323b872dd926118c792309260040161468e565b600060405180830381600087803b1580156118e157600080fd5b505af11580156118f5573d6000803e3d6000fd5b50505050505b805461ff0019166106001780825560408051600160781b9092046001600160801b031682525185917fd512a34b0f0618078770fcd85d974df1ab46a7882e8b3d45aa91764f4961aed2919081900360200190a25050600180555050565b6000600a828154811061197b57634e487b7160e01b600052603260045260246000fd5b906000526020600020906004020190506000600b83815481106119ae57634e487b7160e01b600052603260045260246000fd5b6000918252602082200191508154610100900460ff1660068111156119e357634e487b7160e01b600052602160045260246000fd5b14611a255760405162461bcd60e51b8152602060048201526012602482015271149859999b19481b9bdd0810d4915055115160721b6044820152606401610ad9565b81546040516331a9108f60e11b8152600160301b820465ffffffffffff166004820152600160601b9091046001600160a01b03169033908290636352211e9060240160206040518083038186803b158015611a7f57600080fd5b505afa158015611a93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab791906140fa565b6001600160a01b031614611b0d5760405162461bcd60e51b815260206004820152601a60248201527f4e4654206973206e6f74206f776e65642062792063616c6c65720000000000006044820152606401610ad9565b815461ff0019166101001782556002830180546001600160a01b0319163390811790915583546040516323b872dd60e01b81526001600160a01b038416926323b872dd92611b7092309165ffffffffffff600160301b909104169060040161468e565b600060405180830381600087803b158015611b8a57600080fd5b505af1158015611b9e573d6000803e3d6000fd5b50506040513392508691507f8bb509eedfd1c4847b0a8a2b4493cf2ebb9970dc367e477cd2a8523e212dc1db90600090a350505050565b6000611be081612f3e565b50600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b611c666040805160c08101909152600080825260208201908152602001600081526000602082018190526040820181905260609091015290565b600b8281548110611c8757634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160c081019091529101805460ff808216151584529293919291840191610100909104166006811115611cd857634e487b7160e01b600052602160045260246000fd5b6006811115611cf757634e487b7160e01b600052602160045260246000fd5b8152815460209091019062010000900460ff166002811115611d2957634e487b7160e01b600052602160045260246000fd5b6002811115611d4857634e487b7160e01b600052602160045260246000fd5b8152905465ffffffffffff6301000000820481166020840152600160481b82041660408301526001600160801b03600160781b9091041660609091015292915050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611e035760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610ad9565b61123c828261344d565b600080516020614ade833981519152611e2581612f3e565b6001600160a01b038a16611e695760405162461bcd60e51b815260206004820152600b60248201526a139195081a5cc81b9d5b1b60aa1b6044820152606401610ad9565b6113888565ffffffffffff161115611eb95760405162461bcd60e51b81526020600482015260136024820152720c6dedadad2e6e6d2dedc40e8dede40d0d2ced606b1b6044820152606401610ad9565b6040805160c08101825265ffffffffffff80881682528b8116602083019081526001600160a01b03808f169484019485526000606085018181526080860182815260a08701838152600a8054600181810183558287528a5160049092027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8810180549a519d518a16600160601b026bffffffffffffffffffffffff9e8d16600160301b026bffffffffffffffffffffffff19909c1694909c1693909317999099179b909b169890981790975591517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a9860180549186166001600160a01b031992831617905590517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa860180549190951691161790925590517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2ab9092019190915590549192909161202991906149bd565b905061203786868f8461350a565b876120705760405162461bcd60e51b81526020600482015260096024820152684e6f2070726963657360b81b6044820152606401610ad9565b60005b888110156122095760008a8a8381811061209d57634e487b7160e01b600052603260045260246000fd5b90506060020160200160208101906120b5919061456c565b65ffffffffffff16116120fc5760405162461bcd60e51b815260206004820152600f60248201526e06e756d456e7472696573206973203608c1b6044820152606401610ad9565b600060405180606001604052808481526020018c8c8581811061212f57634e487b7160e01b600052603260045260246000fd5b9050606002016020016020810190612147919061456c565b65ffffffffffff1681526020018c8c8581811061217457634e487b7160e01b600052603260045260246000fd5b90506060020160400135815250905080600760008d8d868181106121a857634e487b7160e01b600052603260045260246000fd5b60600291909101358252506020808201929092526040908101600020835181559183015160018301805465ffffffffffff191665ffffffffffff9092169190911790559190910151600290910155508061220181614a1b565b915050612073565b5060405180604001604052808b6001600160801b031681526020018f6001600160801b03168152506008600083815260200190815260200160002060008201518160000160006101000a8154816001600160801b0302191690836001600160801b0316021790555060208201518160000160106101000a8154816001600160801b0302191690836001600160801b031602179055509050508a65ffffffffffff168c6001600160a01b0316827f81781e053ec72aa8731479536c4da8f819ef3283d2c0dea5c4f0d938bed8489560405160405180910390a460408051808201825260018082523360208084019182526000868152600982529485208054938401815580865290852084519301805492516001600160a01b0316600160301b026001600160d01b031990931665ffffffffffff94909416939093179190911790915583835280549192909161236d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200180546001600160d01b0319169055505050505050505050505050505050565b6000600b86815481106123ba57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001805490915060ff1615156001141561269457604080516001600160a01b038616602082015290810187905260009060600160408051601f1981840301815291815281516020928301206000818152600e90935291205490915060ff1615156001146124725760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420696e20726571756972656420636f6c6c656374696f6e0000000000006044820152606401610ad9565b8460005b6001811161269057336001600160a01b038316636352211e8888858181106124ae57634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b81526004016124d391815260200190565b60206040518083038186803b1580156124eb57600080fd5b505afa1580156124ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252391906140fa565b6001600160a01b0316146125795760405162461bcd60e51b815260206004820152601860248201527f4e6f7420746865206f776e6572206f6620746f6b656e496400000000000000006044820152606401610ad9565b6000878a88888581811061259d57634e487b7160e01b600052603260045260246000fd5b905060200201356040516020016125d2939291906001600160a01b039390931683526020830191909152604082015260600190565b60408051601f1981840301815291815281516020928301206000818152600c9093529120549091506001600160a01b031661262a576000818152600c6020526040902080546001600160a01b0319163317905561267f565b6000818152600c60205260409020546001600160a01b0316331461267f5760405162461bcd60e51b815260206004820152600c60248201526b1d1bdad95b9259081d5cd95960a21b6044820152606401610ad9565b5061268981614a1b565b9050612476565b5050505b60018154610100900460ff1660068111156126bf57634e487b7160e01b600052602160045260246000fd5b146126ff5760405163efeb42cf60e01b815260206004820152600f60248201526e139bdd081a5b881050d0d154151151608a1b6044820152606401610ad9565b8461273c5760405163efeb42cf60e01b815260206004820152600c60248201526b0686f774d616e7920697320360a41b6044820152606401610ad9565b60008581526007602090815260409182902082516060810184528154808252600183015465ffffffffffff16938201939093526002909101549281019290925287146127c05760405163efeb42cf60e01b81526020600482015260126024820152711259081b9bdd081a5b881c9859999b19525960721b6044820152606401610ad9565b602081015165ffffffffffff811661280e5760405163efeb42cf60e01b815260206004820152601060248201526f1259081b9bdd081cdd5c1c1bdc9d195960821b6044820152606401610ad9565b8160400151341461286e5760405163efeb42cf60e01b8152602060048201526024808201527f6d73672e76616c7565206d75737420626520657175616c20746f2074686520706044820152637269636560e01b6064820152608401610ad9565b82546301000000900465ffffffffffff161561296c576040805160208082018b90523382840152825180830384018152606090920183528151918101919091206000818152600d90925291902054845465ffffffffffff9182169163010000009091041681106129175760405163efeb42cf60e01b815260206004820152601360248201527215d85b1b195d08185b1c9958591e481d5cd959606a1b6044820152606401610ad9565b6020808501516000848152600d90925260409091205461293f919065ffffffffffff16614914565b6000928352600d6020526040909220805465ffffffffffff191665ffffffffffff90931692909217909155505b825460408051808201909152600160481b90910465ffffffffffff1690600090806129978585614914565b65ffffffffffff9081168252336020909201919091528654919250600160481b90910416612a335760008a815260096020526040812080548392906129ec57634e487b7160e01b600052603260045260246000fd5b600091825260209182902083519101805493909201516001600160a01b0316600160301b026001600160d01b031990931665ffffffffffff90911617919091179055612a89565b60008a81526009602090815260408220805460018101825590835291819020835192018054918401516001600160a01b0316600160301b026001600160d01b031990921665ffffffffffff909316929092171790555b845434908690600f90612aad908490600160781b90046001600160801b03166148d1565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508282612add9190614914565b855465ffffffffffff60481b1916600160481b65ffffffffffff92831681029190911780885560408051929091049092168152602081018b905233918c917fd746af8dc82f9bed98cea0fe0264eb1c3d2e5f7bcc77fc5efb429c79df407887910160405180910390a350505050505050505050565b600082815260208190526040902060010154612b6d81612f3e565b610f9a83836133e8565b600080516020614ade833981519152612b8f81612f3e565b6000805b84811015612d4c576000878152600960205260408120878784818110612bc957634e487b7160e01b600052603260045260246000fd5b9050602002013581548110612bee57634e487b7160e01b600052603260045260246000fd5b600091825260209091200180549091506001600160a01b03868116600160301b9092041614612c5f5760405162461bcd60e51b815260206004820152601e60248201527f456e74727920646964206e6f742062656c6f6e6720746f20706c6179657200006044820152606401610ad9565b80546601000000000000600160d01b03191681556000878784818110612c9557634e487b7160e01b600052603260045260246000fd5b9050602002013560001415612cac57506000612d16565b6000898152600960205260409020888885818110612cda57634e487b7160e01b600052603260045260246000fd5b9050602002013581548110612cff57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015465ffffffffffff1690505b8154612d2b90829065ffffffffffff166149bd565b612d3590856148fc565b935050508080612d4490614a1b565b915050612b93565b50604080518281526001600160a01b038516602082015287917f2cca80c1af5abb202a642a502875436822768d733462843a7c3a902b0fad99d0910160405180910390a2505050505050565b60008281526009602052604081208190612db29084613735565b60008581526009602052604081208054929350909183908110612de557634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600160301b90046001600160a01b031690508015612e125791506109d99050565b6000825b81158015612e6b57506000878152600960205260408120805483908110612e4d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600160301b90046001600160a01b0316145b15612ea25780612e9757600087815260096020526040902054612e90906001906149bd565b9050612e16565b612e906001826149bd565b8115612ee85760405162461bcd60e51b8152602060048201526015602482015274105b1b081d5cd95c9cc8189b1858dadb1a5cdd1959605a1b6044820152606401610ad9565b6000878152600960205260409020805482908110612f1657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600160301b90046001600160a01b031694506109d99350505050565b6105be8133613826565b612f826040805160c08101909152600080825260208201908152602001600081526000602082018190526040820181905260609091015290565b6000600b8381548110612fa557634e487b7160e01b600052603260045260246000fd5b60009182526020808320868452600890915260409092209101915060018254610100900460ff166006811115612feb57634e487b7160e01b600052602160045260246000fd5b146130315760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610ad9565b805482546001600160801b03918216600160781b90910490911610156130995760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656e6f7567682066756e6473207261697365640000000000000000006044820152606401610ad9565b81548154600160781b9091046001600160801b03908116600160801b9092041611156131075760405162461bcd60e51b815260206004820152601860248201527f446573697265642066756e6473206e6f742072616973656400000000000000006044820152606401610ad9565b815461ff0019166104001780835560408051600160781b9092046001600160801b031682525185917ff2be214756d2fbc1e781d10809ddef33000009d805be55356bb348134ce21c68919081900360200190a26040805160c08101909152825460ff808216151583528491602084019161010090910416600681111561319d57634e487b7160e01b600052602160045260246000fd5b60068111156131bc57634e487b7160e01b600052602160045260246000fd5b8152815460209091019062010000900460ff1660028111156131ee57634e487b7160e01b600052602160045260246000fd5b600281111561320d57634e487b7160e01b600052602160045260246000fd5b8152905465ffffffffffff6301000000820481166020840152600160481b82041660408301526001600160801b03600160781b90910416606090910152949350505050565b600480546040516370a0823160e01b815230928101929092526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b1580156132ba57600080fd5b505afa1580156132ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132f2919061437d565b10156133545760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610ad9565b60006109d960035460045461388a565b61336e8282611c03565b61123c576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556133a43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6133f28282611c03565b1561123c576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008281526006602090815260408083208151808301909252805482526001015491810182905291906134809084614a5c565b61348b9060016148fc565b60408051808201825285815260208082018481528651600090815260058352849020835181559051600190910155855183518881529182018590529394509092917f7c40e661b8212d0c4f60ac6e6ebed99c28680c7b3ede5b82f3b0254543f62fca910160405180910390a282516135039083613a1d565b5050505050565b60008380156135c0576001915060005b6135256001836149bd565b81116135be57600087878381811061354d57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061356291906140de565b604080516001600160a01b039092166020830152810186905260600160408051601f1981840301815291815281516020928301206000908152600e9092529020805460ff19166001179055506135b781614a1b565b905061351a565b505b6040805160c081018252831515815260006020820181815292820181905265ffffffffffff871660608301526080820181905260a08201819052600b8054600181018255915281517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9909101805491151560ff198316811782559351929384939192839161ff00191661ffff199091161761010083600681111561367457634e487b7160e01b600052602160045260246000fd5b021790555060408201518154829062ff00001916620100008360028111156136ac57634e487b7160e01b600052602160045260246000fd5b021790555060608201518154608084015160a0909401516effffffffffffffffffffffff00000019909116630100000065ffffffffffff9384160265ffffffffffff60481b191617600160481b929094169190910292909217600160781b600160f81b031916600160781b6001600160801b039093169290920291909117905550505050505050565b8154600090613746575060006109d9565b82546000905b808210156137b95760006137608383613e44565b90508486828154811061378357634e487b7160e01b600052603260045260246000fd5b60009182526020909120015465ffffffffffff1611156137a5578091506137b3565b6137b08160016148fc565b92505b5061374c565b600082118015613805575083856137d16001856149bd565b815481106137ef57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015465ffffffffffff16145b1561381e576138156001836149bd565b925050506109d9565b5090506109d9565b6138308282611c03565b61123c57613848816001600160a01b03166014613e66565b613853836020613e66565b604051602001613864929190614619565b60408051601f198184030181529082905262461bcd60e51b8252610ad99160040161481b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f0000000000000000000000000000000000000000000000000000000000000000848660006040516020016138fa929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401613927939291906146b9565b602060405180830381600087803b15801561394157600080fd5b505af1158015613955573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061397991906141bc565b50600083815260026020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526139d59060016148fc565b600085815260026020526040902055613a158482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b949350505050565b60026001541415613a405760405162461bcd60e51b8152600401610ad99061482e565b60026001819055506000600a8381548110613a6b57634e487b7160e01b600052603260045260246000fd5b906000526020600020906004020190506000600b8481548110613a9e57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060028154610100900460ff166006811115613ad657634e487b7160e01b600052602160045260246000fd5b1480613b0a575060048154610100900460ff166006811115613b0857634e487b7160e01b600052602160045260246000fd5b145b613b4f5760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610ad9565b60038201839055613b608484612d98565b6001830180546001600160a01b0319166001600160a01b03928316178155825461ff001916610500178355835490546040516323b872dd60e01b8152600160601b830484169384936323b872dd93613bd2933093919091169165ffffffffffff600160301b909104169060040161468e565b600060405180830381600087803b158015613bec57600080fd5b505af1158015613c00573d6000803e3d6000fd5b505084548454600093506127109250613c319165ffffffffffff1690600160781b90046001600160801b031661496f565b613c3b9190614935565b83546001600160801b039182169250600091613c61918491600160781b909104166149bd565b60028601546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114613cb5576040519150601f19603f3d011682016040523d82523d6000602084013e613cba565b606091505b5050905080613d025760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610ad9565b600f546040516000916001600160a01b03169085908381818185875af1925050503d8060008114613d4f576040519150601f19603f3d011682016040523d82523d6000602084013e613d54565b606091505b5050905080613d9d5760405162461bcd60e51b81526020600482015260156024820152744661696c65642073656e642045746820746f204d5760581b6044820152606401610ad9565b887f7378e11c2b0ec7514bbf7ba369980eedcba0bca03e116dc9e7138f7748e211d685604051613dcf91815260200190565b60405180910390a26001870154865460408051600160781b9092046001600160801b03168252602082018b90526001600160a01b03909216918b917fe0b2a72a0644b093aac275024c05c7c28851a0b572557a32241d13634a0f3e08910160405180910390a350506001805550505050505050565b6000613e53600284841861495b565b613e5f908484166148fc565b9392505050565b60606000613e7583600261499e565b613e809060026148fc565b67ffffffffffffffff811115613ea657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ed0576020820181803683370190505b509050600360fc1b81600081518110613ef957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f3657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613f5a84600261499e565b613f659060016148fc565b90505b6001811115613ff9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613fa757634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613fcb57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613ff281614a04565b9050613f68565b508315613e5f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ad9565b803561405381614ac8565b919050565b60008083601f840112614069578182fd5b50813567ffffffffffffffff811115614080578182fd5b6020830191508360208260051b850101111561409b57600080fd5b9250929050565b80356003811061405357600080fd5b80356001600160801b038116811461405357600080fd5b803565ffffffffffff8116811461405357600080fd5b6000602082840312156140ef578081fd5b8135613e5f81614ac8565b60006020828403121561410b578081fd5b8151613e5f81614ac8565b60008060408385031215614128578081fd5b823561413381614ac8565b946020939093013593505050565b60008060008060808587031215614156578182fd5b843561416181614ac8565b935060208501359250604085013561417881614ac8565b9396929550929360600135925050565b60008060006060848603121561419c578283fd5b83356141a781614ac8565b95602085013595506040909401359392505050565b6000602082840312156141cd578081fd5b81518015158114613e5f578182fd5b6000602082840312156141ed578081fd5b5035919050565b60008060408385031215614206578182fd5b82359150602083013561421881614ac8565b809150509250929050565b60008060408385031215614235578182fd5b50508035926020909101359150565b600060208284031215614255578081fd5b81356001600160e01b031981168114613e5f578182fd5b60008060008060008060008060008060006101208c8e03121561428d578889fd5b6142968c6140b1565b9a506142a460208d016140c8565b995060408c01356142b481614ac8565b98506142c260608d016140c8565b97506142d060808d016140b1565b965060a08c013567ffffffffffffffff808211156142ec578788fd5b818e0191508e601f8301126142ff578788fd5b81358181111561430d578889fd5b8f6020606083028501011115614321578889fd5b602083019850965061433560c08f016140c8565b955060e08e013591508082111561434a578485fd5b506143578e828f01614058565b909450925061436b90506101008d016140a2565b90509295989b509295989b9093969950565b60006020828403121561438e578081fd5b5051919050565b600080604083850312156143a7578182fd5b8235915060208084013567ffffffffffffffff808211156143c6578384fd5b818601915086601f8301126143d9578384fd5b8135818111156143eb576143eb614ab2565b8060051b604051601f19603f8301168101818110858211171561441057614410614ab2565b604052828152858101935084860182860187018b101561442e578788fd5b8795505b838610156144575761444381614048565b855260019590950194938601938601614432565b508096505050505050509250929050565b6000806000806060858703121561447d578182fd5b84359350602085013567ffffffffffffffff81111561449a578283fd5b6144a687828801614058565b90945092505060408501356144ba81614ac8565b939692955090935050565b6000806000806000608086880312156144dc578283fd5b853594506020860135935060408601356144f581614ac8565b9250606086013567ffffffffffffffff811115614510578182fd5b61451c88828901614058565b969995985093965092949392505050565b600080600060608486031215614541578081fd5b83359250614551602085016140c8565b9150604084013561456181614ac8565b809150509250925092565b60006020828403121561457d578081fd5b613e5f826140c8565b6000815180845260208085019450808401835b838110156145be5781516001600160a01b031687529582019590820190600101614599565b509495945050505050565b600081518084526145e18160208601602086016149d4565b601f01601f19169290920160200192915050565b6003811061460557614605614a9c565b9052565b6007811061460557614605614a9c565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516146518160178501602088016149d4565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516146828160288401602088016149d4565b01602801949350505050565b6001600160a01b03938416815291909216602082015265ffffffffffff909116604082015260600190565b60018060a01b03841681528260208201526060604082015260006146e060608301846145c9565b95945050505050565b6060815260006146fc6060830186614586565b905083602083015265ffffffffffff83166040830152949350505050565b60608152600061472d6060830186614586565b65ffffffffffff94851660208401529290931660409091015292915050565b602080825282518282018190526000919060409081850190868401855b8281101561479f578151805165ffffffffffff1685528601516001600160a01b0316868501529284019290850190600101614769565b5091979650505050505050565b861515815260c081016147c26020830188614609565b6147cf60408301876145f5565b65ffffffffffff94851660608301529290931660808401526001600160801b031660a0909201919091529392505050565b8215158152604060208201526000613a1560408301846145c9565b602081526000613e5f60208301846145c9565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81511515815260208083015160c083019161488290840182614609565b50604083015161489560408401826145f5565b50606083015165ffffffffffff808216606085015280608086015116608085015250506001600160801b0360a08401511660a083015292915050565b60006001600160801b038083168185168083038211156148f3576148f3614a70565b01949350505050565b6000821982111561490f5761490f614a70565b500190565b600065ffffffffffff8083168185168083038211156148f3576148f3614a70565b60006001600160801b038084168061494f5761494f614a86565b92169190910492915050565b60008261496a5761496a614a86565b500490565b60006001600160801b038083168185168183048111821515161561499557614995614a70565b02949350505050565b60008160001904831182151516156149b8576149b8614a70565b500290565b6000828210156149cf576149cf614a70565b500390565b60005b838110156149ef5781810151838201526020016149d7565b838111156149fe576000848401525b50505050565b600081614a1357614a13614a70565b506000190190565b6000600019821415614a2f57614a2f614a70565b5060010190565b600065ffffffffffff80831681811415614a5257614a52614a70565b6001019392505050565b600082614a6b57614a6b614a86565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146105be57600080fdfe523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0ca2646970667358221220f0b0fa29848f6ab1b13be8ea73d979f55708e648a88caa079bd1e9fa48289fa164736f6c63430008040033000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986caaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000000000000000000001

Deployed Bytecode

0x60806040526004361061023b5760003560e01c80635d4bc0ce1161012e578063a9a32d77116100ab578063ddba6e6b1161006f578063ddba6e6b14610848578063eb99038c146108ae578063f3691455146108d2578063f5b541a6146108f2578063f720e7081461091457600080fd5b8063a9a32d7714610791578063babdf60b146107b1578063bb459ec4146107f5578063d547741f14610808578063d649214c1461082857600080fd5b806381d12c58116100f257806381d12c58146106db57806391d148541461070f57806393a75d021461072f57806394985ddd1461075c578063a217fddf1461077c57600080fd5b80635d4bc0ce146105e15780635fba3171146106475780636eb604e0146106675780637c903fc0146106875780637fa4cacb146106bb57600080fd5b80632a596800116101bc57806336734e341161018057806336734e341461052157806336a418bf146105415780633a3956c2146105715780634239a50c146105a357806353b7a59b146105c157600080fd5b80632a5968001461044b5780632f2ff15d14610494578063317f3059146104b457806336568abe146104d4578063365e3658146104f457600080fd5b80630df71602116102035780630df716021461035e5780631a0187f51461037e5780631e6cd395146103cc5780631fe96857146103ec578063248a9ca31461040d57600080fd5b8063013805c51461024057806301ffc9a71461028b578063039be558146102bb578063043a1c9a1461031c5780630b148ff01461033c575b600080fd5b34801561024c57600080fd5b5061026061025b366004614223565b610960565b6040805165ffffffffffff90931683526001600160a01b039091166020830152015b60405180910390f35b34801561029757600080fd5b506102ab6102a6366004614244565b6109a8565b6040519015158152602001610282565b3480156102c757600080fd5b506102fc6102d63660046141dc565b6008602052600090815260409020546001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610282565b34801561032857600080fd5b506102ab610337366004614116565b6109df565b34801561034857600080fd5b5061035c61035736600461452d565b610a8c565b005b34801561036a57600080fd5b5061035c6103793660046141dc565b610d81565b34801561038a57600080fd5b506103b46103993660046141dc565b600c602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610282565b3480156103d857600080fd5b506102ab6103e73660046141dc565b610e22565b3480156103f857600080fd5b506102ab6104073660046140de565b50600090565b34801561041957600080fd5b5061043d6104283660046141dc565b60009081526020819052604090206001015490565b604051908152602001610282565b34801561045757600080fd5b5061047f6104663660046141dc565b6006602052600090815260409020805460019091015482565b60408051928352602083019190915201610282565b3480156104a057600080fd5b5061035c6104af3660046141f4565b610f75565b3480156104c057600080fd5b5061035c6104cf3660046141dc565b610f9f565b3480156104e057600080fd5b5061035c6104ef3660046141f4565b6111c2565b34801561050057600080fd5b5061051461050f3660046141dc565b611240565b604051610282919061474c565b34801561052d57600080fd5b5061035c61053c366004614395565b6112ce565b34801561054d57600080fd5b506102ab61055c3660046141dc565b600e6020526000908152604090205460ff1681565b34801561057d57600080fd5b5061059161058c3660046141dc565b61154b565b604051610282969594939291906147ac565b3480156105af57600080fd5b5061035c6105be3660046141dc565b50565b3480156105cd57600080fd5b50600f546103b4906001600160a01b031681565b3480156105ed57600080fd5b506106016105fc3660046141dc565b6115b0565b6040805165ffffffffffff97881681529690951660208701526001600160a01b0393841694860194909452908216606085015216608083015260a082015260c001610282565b34801561065357600080fd5b5061035c6106623660046141dc565b611613565b34801561067357600080fd5b5061035c6106823660046141dc565b611958565b34801561069357600080fd5b5061043d7fde5ee446972f4e39ab62c03aa34b2096680a875c3fdb3eb2f947cbb93341c05881565b3480156106c757600080fd5b5061035c6106d63660046140de565b611bd5565b3480156106e757600080fd5b5061047f6106f63660046141dc565b6005602052600090815260409020805460019091015482565b34801561071b57600080fd5b506102ab61072a3660046141f4565b611c03565b34801561073b57600080fd5b5061074f61074a3660046141dc565b611c2c565b6040516102829190614865565b34801561076857600080fd5b5061035c610777366004614223565b611d8b565b34801561078857600080fd5b5061043d600081565b34801561079d57600080fd5b5061035c6107ac36600461426c565b611e0d565b3480156107bd57600080fd5b506107e76107cc366004614141565b60408051602081019091526000815260019094509492505050565b604051610282929190614800565b61035c6108033660046144c5565b612397565b34801561081457600080fd5b5061035c6108233660046141f4565b612b52565b34801561083457600080fd5b5061035c610843366004614468565b612b77565b34801561085457600080fd5b5061088c6108633660046141dc565b600760205260009081526040902080546001820154600290920154909165ffffffffffff169083565b6040805193845265ffffffffffff909216602084015290820152606001610282565b3480156108ba57600080fd5b506102ab6108c9366004614188565b60009392505050565b3480156108de57600080fd5b506103b46108ed366004614223565b612d98565b3480156108fe57600080fd5b5061043d600080516020614ade83398151915281565b34801561092057600080fd5b5061094961092f3660046141dc565b600d6020526000908152604090205465ffffffffffff1681565b60405165ffffffffffff9091168152602001610282565b6009602052816000526040600020818154811061097c57600080fd5b60009182526020909120015465ffffffffffff81169250600160301b90046001600160a01b0316905082565b60006001600160e01b03198216637965db0b60e01b14806109d957506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080600a8381548110610a0357634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160c0810182526004909302909101805465ffffffffffff8082168552600160301b820416948401949094526001600160a01b03600160601b909404841691830191909152600181015483166060830152600281015483166080830181905260039091015460a0909201919091529085161491505092915050565b7fde5ee446972f4e39ab62c03aa34b2096680a875c3fdb3eb2f947cbb93341c058610ab681612f3e565b60026001541415610ae25760405162461bcd60e51b8152600401610ad99061482e565b60405180910390fd5b60026001819055506000600b8581548110610b0d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200190506001815462010000900460ff166002811115610b4657634e487b7160e01b600052602160045260246000fd5b1480610b7b57506002815462010000900460ff166002811115610b7957634e487b7160e01b600052602160045260246000fd5b145b610bc05760405162461bcd60e51b8152602060048201526016602482015275115b9d1c9e481d1e5c19481b9bdd08185b1b1bddd95960521b6044820152606401610ad9565b60006040518060400160405280868460000160099054906101000a900465ffffffffffff16610bef9190614914565b65ffffffffffff90811682526001600160a01b0380881660209384015260008a815260098085526040822080546001810182559083529185902086519201805495870151909316600160301b026001600160d01b03199095169184169190911793909317905584549293508792859291610c73918591600160481b90910416614914565b92506101000a81548165ffffffffffff021916908365ffffffffffff1602179055506000600167ffffffffffffffff811115610cbf57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610ce8578160200160208202803683370190505b5090508481600081518110610d0d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152825460405188917f4da4f5fab0816c65315b6f5d15f879f96b98661133d7b3787788f291367604fb91610d6c9185918b9165ffffffffffff600160481b909104169061471a565b60405180910390a25050600180555050505050565b60026001541415610da45760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade833981519152610dc181612f3e565b6000610dcc83612f48565b90506000610dd8613252565b9050610e1884836080015165ffffffffffff1683604080518082018252938452602080850193845260009283526006905290209151825551600190910155565b5050600180555050565b600080600b8381548110610e4657634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160c081019091529101805460ff808216151584529293919291840191610100909104166006811115610e9757634e487b7160e01b600052602160045260246000fd5b6006811115610eb657634e487b7160e01b600052602160045260246000fd5b8152815460209091019062010000900460ff166002811115610ee857634e487b7160e01b600052602160045260246000fd5b6002811115610f0757634e487b7160e01b600052602160045260246000fd5b8152905465ffffffffffff6301000000820481166020840152600160481b82041660408301526001600160801b03600160781b909104166060909101529050600181602001516006811115610f6c57634e487b7160e01b600052602160045260246000fd5b14159392505050565b600082815260208190526040902060010154610f9081612f3e565b610f9a8383613364565b505050565b60026001541415610fc25760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade833981519152610fdf81612f3e565b6000600b838154811061100257634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060038154610100900460ff16600681111561103a57634e487b7160e01b600052602160045260246000fd5b148061106e575060068154610100900460ff16600681111561106c57634e487b7160e01b600052602160045260246000fd5b145b6110a95760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610ad9565b805461ff00191661030017808255600f546040516000926001600160a01b0390921691600160781b90046001600160801b0316908381818185875af1925050503d8060008114611115576040519150601f19603f3d011682016040523d82523d6000602084013e61111a565b606091505b50509050806111615760405162461bcd60e51b81526020600482015260136024820152724661696c2073656e642045746820746f204d5760681b6044820152606401610ad9565b8154604051600160781b9091046001600160801b0316815284907fcdef6558dae40f2699846eedf449462daab85b1224ad7f077569ba91aaa949259060200160405180910390a2508054600160781b600160f81b0319169055505060018055565b6001600160a01b03811633146112325760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ad9565b61123c82826133e8565b5050565b606060096000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156112c3576000848152602090819020604080518082019091529084015465ffffffffffff81168252600160301b90046001600160a01b031681830152825260019092019101611275565b505050509050919050565b600260015414156112f15760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade83398151915261130e81612f3e565b6000600b848154811061133157634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060018154610100900460ff16600681111561136957634e487b7160e01b600052602160045260246000fd5b146113b65760405162461bcd60e51b815260206004820152601960248201527f526166666c65206973206e6f7420696e206163636570746564000000000000006044820152606401610ad9565b82516000805b828110156114b85760008682815181106113e657634e487b7160e01b600052603260045260246000fd5b6020026020010151905060006040518060400160405280848860000160099054906101000a900465ffffffffffff1665ffffffffffff1661142791906148fc565b6114329060016148fc565b65ffffffffffff90811682526001600160a01b0380861660209384015260008d8152600984526040812080546001810182559082529084902085519101805494860151909216600160301b026001600160d01b031990941692169190911791909117905590506114a184614a36565b9350505080806114b090614a1b565b9150506113bc565b5082546114d5908290600160481b900465ffffffffffff16614914565b835465ffffffffffff60481b1916600160481b65ffffffffffff92831681029190911780865560405189937f4da4f5fab0816c65315b6f5d15f879f96b98661133d7b3787788f291367604fb93611537938b93899392909104909116906146e9565b60405180910390a250506001805550505050565b600b818154811061155b57600080fd5b60009182526020909120015460ff808216925061010082048116916201000081049091169065ffffffffffff63010000008204811691600160481b8104909116906001600160801b03600160781b9091041686565b600a81815481106115c057600080fd5b6000918252602090912060049091020180546001820154600283015460039093015465ffffffffffff8084169550600160301b840416936001600160a01b03600160601b90940484169392831692169086565b600260015414156116365760405162461bcd60e51b8152600401610ad99061482e565b6002600155600080516020614ade83398151915261165381612f3e565b6000600a838154811061167657634e487b7160e01b600052603260045260246000fd5b600091825260208083206040805160c0810182526004909402909101805465ffffffffffff8082168652600160301b820416938501939093526001600160a01b03600160601b909304831691840191909152600181015482166060840152600281015490911660808301526003015460a0820152600b8054919350908590811061171057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060058154610100900460ff16600681111561174857634e487b7160e01b600052602160045260246000fd5b1415801561177f575060038154610100900460ff16600681111561177c57634e487b7160e01b600052602160045260246000fd5b14155b80156117b4575060028154610100900460ff1660068111156117b157634e487b7160e01b600052602160045260246000fd5b14155b80156117e9575060048154610100900460ff1660068111156117e657634e487b7160e01b600052602160045260246000fd5b14155b801561181e575060068154610100900460ff16600681111561181b57634e487b7160e01b600052602160045260246000fd5b14155b6118595760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610ad9565b60018154610100900460ff16600681111561188457634e487b7160e01b600052602160045260246000fd5b14156118fb576040808301516080840151602085015192516323b872dd60e01b815291926001600160a01b038416926323b872dd926118c792309260040161468e565b600060405180830381600087803b1580156118e157600080fd5b505af11580156118f5573d6000803e3d6000fd5b50505050505b805461ff0019166106001780825560408051600160781b9092046001600160801b031682525185917fd512a34b0f0618078770fcd85d974df1ab46a7882e8b3d45aa91764f4961aed2919081900360200190a25050600180555050565b6000600a828154811061197b57634e487b7160e01b600052603260045260246000fd5b906000526020600020906004020190506000600b83815481106119ae57634e487b7160e01b600052603260045260246000fd5b6000918252602082200191508154610100900460ff1660068111156119e357634e487b7160e01b600052602160045260246000fd5b14611a255760405162461bcd60e51b8152602060048201526012602482015271149859999b19481b9bdd0810d4915055115160721b6044820152606401610ad9565b81546040516331a9108f60e11b8152600160301b820465ffffffffffff166004820152600160601b9091046001600160a01b03169033908290636352211e9060240160206040518083038186803b158015611a7f57600080fd5b505afa158015611a93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab791906140fa565b6001600160a01b031614611b0d5760405162461bcd60e51b815260206004820152601a60248201527f4e4654206973206e6f74206f776e65642062792063616c6c65720000000000006044820152606401610ad9565b815461ff0019166101001782556002830180546001600160a01b0319163390811790915583546040516323b872dd60e01b81526001600160a01b038416926323b872dd92611b7092309165ffffffffffff600160301b909104169060040161468e565b600060405180830381600087803b158015611b8a57600080fd5b505af1158015611b9e573d6000803e3d6000fd5b50506040513392508691507f8bb509eedfd1c4847b0a8a2b4493cf2ebb9970dc367e477cd2a8523e212dc1db90600090a350505050565b6000611be081612f3e565b50600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b611c666040805160c08101909152600080825260208201908152602001600081526000602082018190526040820181905260609091015290565b600b8281548110611c8757634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160c081019091529101805460ff808216151584529293919291840191610100909104166006811115611cd857634e487b7160e01b600052602160045260246000fd5b6006811115611cf757634e487b7160e01b600052602160045260246000fd5b8152815460209091019062010000900460ff166002811115611d2957634e487b7160e01b600052602160045260246000fd5b6002811115611d4857634e487b7160e01b600052602160045260246000fd5b8152905465ffffffffffff6301000000820481166020840152600160481b82041660408301526001600160801b03600160781b9091041660609091015292915050565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb79521614611e035760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610ad9565b61123c828261344d565b600080516020614ade833981519152611e2581612f3e565b6001600160a01b038a16611e695760405162461bcd60e51b815260206004820152600b60248201526a139195081a5cc81b9d5b1b60aa1b6044820152606401610ad9565b6113888565ffffffffffff161115611eb95760405162461bcd60e51b81526020600482015260136024820152720c6dedadad2e6e6d2dedc40e8dede40d0d2ced606b1b6044820152606401610ad9565b6040805160c08101825265ffffffffffff80881682528b8116602083019081526001600160a01b03808f169484019485526000606085018181526080860182815260a08701838152600a8054600181810183558287528a5160049092027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8810180549a519d518a16600160601b026bffffffffffffffffffffffff9e8d16600160301b026bffffffffffffffffffffffff19909c1694909c1693909317999099179b909b169890981790975591517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a9860180549186166001600160a01b031992831617905590517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa860180549190951691161790925590517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2ab9092019190915590549192909161202991906149bd565b905061203786868f8461350a565b876120705760405162461bcd60e51b81526020600482015260096024820152684e6f2070726963657360b81b6044820152606401610ad9565b60005b888110156122095760008a8a8381811061209d57634e487b7160e01b600052603260045260246000fd5b90506060020160200160208101906120b5919061456c565b65ffffffffffff16116120fc5760405162461bcd60e51b815260206004820152600f60248201526e06e756d456e7472696573206973203608c1b6044820152606401610ad9565b600060405180606001604052808481526020018c8c8581811061212f57634e487b7160e01b600052603260045260246000fd5b9050606002016020016020810190612147919061456c565b65ffffffffffff1681526020018c8c8581811061217457634e487b7160e01b600052603260045260246000fd5b90506060020160400135815250905080600760008d8d868181106121a857634e487b7160e01b600052603260045260246000fd5b60600291909101358252506020808201929092526040908101600020835181559183015160018301805465ffffffffffff191665ffffffffffff9092169190911790559190910151600290910155508061220181614a1b565b915050612073565b5060405180604001604052808b6001600160801b031681526020018f6001600160801b03168152506008600083815260200190815260200160002060008201518160000160006101000a8154816001600160801b0302191690836001600160801b0316021790555060208201518160000160106101000a8154816001600160801b0302191690836001600160801b031602179055509050508a65ffffffffffff168c6001600160a01b0316827f81781e053ec72aa8731479536c4da8f819ef3283d2c0dea5c4f0d938bed8489560405160405180910390a460408051808201825260018082523360208084019182526000868152600982529485208054938401815580865290852084519301805492516001600160a01b0316600160301b026001600160d01b031990931665ffffffffffff94909416939093179190911790915583835280549192909161236d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200180546001600160d01b0319169055505050505050505050505050505050565b6000600b86815481106123ba57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001805490915060ff1615156001141561269457604080516001600160a01b038616602082015290810187905260009060600160408051601f1981840301815291815281516020928301206000818152600e90935291205490915060ff1615156001146124725760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420696e20726571756972656420636f6c6c656374696f6e0000000000006044820152606401610ad9565b8460005b6001811161269057336001600160a01b038316636352211e8888858181106124ae57634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b81526004016124d391815260200190565b60206040518083038186803b1580156124eb57600080fd5b505afa1580156124ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252391906140fa565b6001600160a01b0316146125795760405162461bcd60e51b815260206004820152601860248201527f4e6f7420746865206f776e6572206f6620746f6b656e496400000000000000006044820152606401610ad9565b6000878a88888581811061259d57634e487b7160e01b600052603260045260246000fd5b905060200201356040516020016125d2939291906001600160a01b039390931683526020830191909152604082015260600190565b60408051601f1981840301815291815281516020928301206000818152600c9093529120549091506001600160a01b031661262a576000818152600c6020526040902080546001600160a01b0319163317905561267f565b6000818152600c60205260409020546001600160a01b0316331461267f5760405162461bcd60e51b815260206004820152600c60248201526b1d1bdad95b9259081d5cd95960a21b6044820152606401610ad9565b5061268981614a1b565b9050612476565b5050505b60018154610100900460ff1660068111156126bf57634e487b7160e01b600052602160045260246000fd5b146126ff5760405163efeb42cf60e01b815260206004820152600f60248201526e139bdd081a5b881050d0d154151151608a1b6044820152606401610ad9565b8461273c5760405163efeb42cf60e01b815260206004820152600c60248201526b0686f774d616e7920697320360a41b6044820152606401610ad9565b60008581526007602090815260409182902082516060810184528154808252600183015465ffffffffffff16938201939093526002909101549281019290925287146127c05760405163efeb42cf60e01b81526020600482015260126024820152711259081b9bdd081a5b881c9859999b19525960721b6044820152606401610ad9565b602081015165ffffffffffff811661280e5760405163efeb42cf60e01b815260206004820152601060248201526f1259081b9bdd081cdd5c1c1bdc9d195960821b6044820152606401610ad9565b8160400151341461286e5760405163efeb42cf60e01b8152602060048201526024808201527f6d73672e76616c7565206d75737420626520657175616c20746f2074686520706044820152637269636560e01b6064820152608401610ad9565b82546301000000900465ffffffffffff161561296c576040805160208082018b90523382840152825180830384018152606090920183528151918101919091206000818152600d90925291902054845465ffffffffffff9182169163010000009091041681106129175760405163efeb42cf60e01b815260206004820152601360248201527215d85b1b195d08185b1c9958591e481d5cd959606a1b6044820152606401610ad9565b6020808501516000848152600d90925260409091205461293f919065ffffffffffff16614914565b6000928352600d6020526040909220805465ffffffffffff191665ffffffffffff90931692909217909155505b825460408051808201909152600160481b90910465ffffffffffff1690600090806129978585614914565b65ffffffffffff9081168252336020909201919091528654919250600160481b90910416612a335760008a815260096020526040812080548392906129ec57634e487b7160e01b600052603260045260246000fd5b600091825260209182902083519101805493909201516001600160a01b0316600160301b026001600160d01b031990931665ffffffffffff90911617919091179055612a89565b60008a81526009602090815260408220805460018101825590835291819020835192018054918401516001600160a01b0316600160301b026001600160d01b031990921665ffffffffffff909316929092171790555b845434908690600f90612aad908490600160781b90046001600160801b03166148d1565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508282612add9190614914565b855465ffffffffffff60481b1916600160481b65ffffffffffff92831681029190911780885560408051929091049092168152602081018b905233918c917fd746af8dc82f9bed98cea0fe0264eb1c3d2e5f7bcc77fc5efb429c79df407887910160405180910390a350505050505050505050565b600082815260208190526040902060010154612b6d81612f3e565b610f9a83836133e8565b600080516020614ade833981519152612b8f81612f3e565b6000805b84811015612d4c576000878152600960205260408120878784818110612bc957634e487b7160e01b600052603260045260246000fd5b9050602002013581548110612bee57634e487b7160e01b600052603260045260246000fd5b600091825260209091200180549091506001600160a01b03868116600160301b9092041614612c5f5760405162461bcd60e51b815260206004820152601e60248201527f456e74727920646964206e6f742062656c6f6e6720746f20706c6179657200006044820152606401610ad9565b80546601000000000000600160d01b03191681556000878784818110612c9557634e487b7160e01b600052603260045260246000fd5b9050602002013560001415612cac57506000612d16565b6000898152600960205260409020888885818110612cda57634e487b7160e01b600052603260045260246000fd5b9050602002013581548110612cff57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015465ffffffffffff1690505b8154612d2b90829065ffffffffffff166149bd565b612d3590856148fc565b935050508080612d4490614a1b565b915050612b93565b50604080518281526001600160a01b038516602082015287917f2cca80c1af5abb202a642a502875436822768d733462843a7c3a902b0fad99d0910160405180910390a2505050505050565b60008281526009602052604081208190612db29084613735565b60008581526009602052604081208054929350909183908110612de557634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600160301b90046001600160a01b031690508015612e125791506109d99050565b6000825b81158015612e6b57506000878152600960205260408120805483908110612e4d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600160301b90046001600160a01b0316145b15612ea25780612e9757600087815260096020526040902054612e90906001906149bd565b9050612e16565b612e906001826149bd565b8115612ee85760405162461bcd60e51b8152602060048201526015602482015274105b1b081d5cd95c9cc8189b1858dadb1a5cdd1959605a1b6044820152606401610ad9565b6000878152600960205260409020805482908110612f1657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600160301b90046001600160a01b031694506109d99350505050565b6105be8133613826565b612f826040805160c08101909152600080825260208201908152602001600081526000602082018190526040820181905260609091015290565b6000600b8381548110612fa557634e487b7160e01b600052603260045260246000fd5b60009182526020808320868452600890915260409092209101915060018254610100900460ff166006811115612feb57634e487b7160e01b600052602160045260246000fd5b146130315760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610ad9565b805482546001600160801b03918216600160781b90910490911610156130995760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656e6f7567682066756e6473207261697365640000000000000000006044820152606401610ad9565b81548154600160781b9091046001600160801b03908116600160801b9092041611156131075760405162461bcd60e51b815260206004820152601860248201527f446573697265642066756e6473206e6f742072616973656400000000000000006044820152606401610ad9565b815461ff0019166104001780835560408051600160781b9092046001600160801b031682525185917ff2be214756d2fbc1e781d10809ddef33000009d805be55356bb348134ce21c68919081900360200190a26040805160c08101909152825460ff808216151583528491602084019161010090910416600681111561319d57634e487b7160e01b600052602160045260246000fd5b60068111156131bc57634e487b7160e01b600052602160045260246000fd5b8152815460209091019062010000900460ff1660028111156131ee57634e487b7160e01b600052602160045260246000fd5b600281111561320d57634e487b7160e01b600052602160045260246000fd5b8152905465ffffffffffff6301000000820481166020840152600160481b82041660408301526001600160801b03600160781b90910416606090910152949350505050565b600480546040516370a0823160e01b815230928101929092526000917f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316906370a082319060240160206040518083038186803b1580156132ba57600080fd5b505afa1580156132ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132f2919061437d565b10156133545760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610ad9565b60006109d960035460045461388a565b61336e8282611c03565b61123c576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556133a43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6133f28282611c03565b1561123c576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008281526006602090815260408083208151808301909252805482526001015491810182905291906134809084614a5c565b61348b9060016148fc565b60408051808201825285815260208082018481528651600090815260058352849020835181559051600190910155855183518881529182018590529394509092917f7c40e661b8212d0c4f60ac6e6ebed99c28680c7b3ede5b82f3b0254543f62fca910160405180910390a282516135039083613a1d565b5050505050565b60008380156135c0576001915060005b6135256001836149bd565b81116135be57600087878381811061354d57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061356291906140de565b604080516001600160a01b039092166020830152810186905260600160408051601f1981840301815291815281516020928301206000908152600e9092529020805460ff19166001179055506135b781614a1b565b905061351a565b505b6040805160c081018252831515815260006020820181815292820181905265ffffffffffff871660608301526080820181905260a08201819052600b8054600181018255915281517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9909101805491151560ff198316811782559351929384939192839161ff00191661ffff199091161761010083600681111561367457634e487b7160e01b600052602160045260246000fd5b021790555060408201518154829062ff00001916620100008360028111156136ac57634e487b7160e01b600052602160045260246000fd5b021790555060608201518154608084015160a0909401516effffffffffffffffffffffff00000019909116630100000065ffffffffffff9384160265ffffffffffff60481b191617600160481b929094169190910292909217600160781b600160f81b031916600160781b6001600160801b039093169290920291909117905550505050505050565b8154600090613746575060006109d9565b82546000905b808210156137b95760006137608383613e44565b90508486828154811061378357634e487b7160e01b600052603260045260246000fd5b60009182526020909120015465ffffffffffff1611156137a5578091506137b3565b6137b08160016148fc565b92505b5061374c565b600082118015613805575083856137d16001856149bd565b815481106137ef57634e487b7160e01b600052603260045260246000fd5b60009182526020909120015465ffffffffffff16145b1561381e576138156001836149bd565b925050506109d9565b5090506109d9565b6138308282611c03565b61123c57613848816001600160a01b03166014613e66565b613853836020613e66565b604051602001613864929190614619565b60408051601f198184030181529082905262461bcd60e51b8252610ad99160040161481b565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952848660006040516020016138fa929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401613927939291906146b9565b602060405180830381600087803b15801561394157600080fd5b505af1158015613955573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061397991906141bc565b50600083815260026020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526139d59060016148fc565b600085815260026020526040902055613a158482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b949350505050565b60026001541415613a405760405162461bcd60e51b8152600401610ad99061482e565b60026001819055506000600a8381548110613a6b57634e487b7160e01b600052603260045260246000fd5b906000526020600020906004020190506000600b8481548110613a9e57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001905060028154610100900460ff166006811115613ad657634e487b7160e01b600052602160045260246000fd5b1480613b0a575060048154610100900460ff166006811115613b0857634e487b7160e01b600052602160045260246000fd5b145b613b4f5760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610ad9565b60038201839055613b608484612d98565b6001830180546001600160a01b0319166001600160a01b03928316178155825461ff001916610500178355835490546040516323b872dd60e01b8152600160601b830484169384936323b872dd93613bd2933093919091169165ffffffffffff600160301b909104169060040161468e565b600060405180830381600087803b158015613bec57600080fd5b505af1158015613c00573d6000803e3d6000fd5b505084548454600093506127109250613c319165ffffffffffff1690600160781b90046001600160801b031661496f565b613c3b9190614935565b83546001600160801b039182169250600091613c61918491600160781b909104166149bd565b60028601546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114613cb5576040519150601f19603f3d011682016040523d82523d6000602084013e613cba565b606091505b5050905080613d025760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610ad9565b600f546040516000916001600160a01b03169085908381818185875af1925050503d8060008114613d4f576040519150601f19603f3d011682016040523d82523d6000602084013e613d54565b606091505b5050905080613d9d5760405162461bcd60e51b81526020600482015260156024820152744661696c65642073656e642045746820746f204d5760581b6044820152606401610ad9565b887f7378e11c2b0ec7514bbf7ba369980eedcba0bca03e116dc9e7138f7748e211d685604051613dcf91815260200190565b60405180910390a26001870154865460408051600160781b9092046001600160801b03168252602082018b90526001600160a01b03909216918b917fe0b2a72a0644b093aac275024c05c7c28851a0b572557a32241d13634a0f3e08910160405180910390a350506001805550505050505050565b6000613e53600284841861495b565b613e5f908484166148fc565b9392505050565b60606000613e7583600261499e565b613e809060026148fc565b67ffffffffffffffff811115613ea657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ed0576020820181803683370190505b509050600360fc1b81600081518110613ef957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f3657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613f5a84600261499e565b613f659060016148fc565b90505b6001811115613ff9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613fa757634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613fcb57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613ff281614a04565b9050613f68565b508315613e5f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ad9565b803561405381614ac8565b919050565b60008083601f840112614069578182fd5b50813567ffffffffffffffff811115614080578182fd5b6020830191508360208260051b850101111561409b57600080fd5b9250929050565b80356003811061405357600080fd5b80356001600160801b038116811461405357600080fd5b803565ffffffffffff8116811461405357600080fd5b6000602082840312156140ef578081fd5b8135613e5f81614ac8565b60006020828403121561410b578081fd5b8151613e5f81614ac8565b60008060408385031215614128578081fd5b823561413381614ac8565b946020939093013593505050565b60008060008060808587031215614156578182fd5b843561416181614ac8565b935060208501359250604085013561417881614ac8565b9396929550929360600135925050565b60008060006060848603121561419c578283fd5b83356141a781614ac8565b95602085013595506040909401359392505050565b6000602082840312156141cd578081fd5b81518015158114613e5f578182fd5b6000602082840312156141ed578081fd5b5035919050565b60008060408385031215614206578182fd5b82359150602083013561421881614ac8565b809150509250929050565b60008060408385031215614235578182fd5b50508035926020909101359150565b600060208284031215614255578081fd5b81356001600160e01b031981168114613e5f578182fd5b60008060008060008060008060008060006101208c8e03121561428d578889fd5b6142968c6140b1565b9a506142a460208d016140c8565b995060408c01356142b481614ac8565b98506142c260608d016140c8565b97506142d060808d016140b1565b965060a08c013567ffffffffffffffff808211156142ec578788fd5b818e0191508e601f8301126142ff578788fd5b81358181111561430d578889fd5b8f6020606083028501011115614321578889fd5b602083019850965061433560c08f016140c8565b955060e08e013591508082111561434a578485fd5b506143578e828f01614058565b909450925061436b90506101008d016140a2565b90509295989b509295989b9093969950565b60006020828403121561438e578081fd5b5051919050565b600080604083850312156143a7578182fd5b8235915060208084013567ffffffffffffffff808211156143c6578384fd5b818601915086601f8301126143d9578384fd5b8135818111156143eb576143eb614ab2565b8060051b604051601f19603f8301168101818110858211171561441057614410614ab2565b604052828152858101935084860182860187018b101561442e578788fd5b8795505b838610156144575761444381614048565b855260019590950194938601938601614432565b508096505050505050509250929050565b6000806000806060858703121561447d578182fd5b84359350602085013567ffffffffffffffff81111561449a578283fd5b6144a687828801614058565b90945092505060408501356144ba81614ac8565b939692955090935050565b6000806000806000608086880312156144dc578283fd5b853594506020860135935060408601356144f581614ac8565b9250606086013567ffffffffffffffff811115614510578182fd5b61451c88828901614058565b969995985093965092949392505050565b600080600060608486031215614541578081fd5b83359250614551602085016140c8565b9150604084013561456181614ac8565b809150509250925092565b60006020828403121561457d578081fd5b613e5f826140c8565b6000815180845260208085019450808401835b838110156145be5781516001600160a01b031687529582019590820190600101614599565b509495945050505050565b600081518084526145e18160208601602086016149d4565b601f01601f19169290920160200192915050565b6003811061460557614605614a9c565b9052565b6007811061460557614605614a9c565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516146518160178501602088016149d4565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516146828160288401602088016149d4565b01602801949350505050565b6001600160a01b03938416815291909216602082015265ffffffffffff909116604082015260600190565b60018060a01b03841681528260208201526060604082015260006146e060608301846145c9565b95945050505050565b6060815260006146fc6060830186614586565b905083602083015265ffffffffffff83166040830152949350505050565b60608152600061472d6060830186614586565b65ffffffffffff94851660208401529290931660409091015292915050565b602080825282518282018190526000919060409081850190868401855b8281101561479f578151805165ffffffffffff1685528601516001600160a01b0316868501529284019290850190600101614769565b5091979650505050505050565b861515815260c081016147c26020830188614609565b6147cf60408301876145f5565b65ffffffffffff94851660608301529290931660808401526001600160801b031660a0909201919091529392505050565b8215158152604060208201526000613a1560408301846145c9565b602081526000613e5f60208301846145c9565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81511515815260208083015160c083019161488290840182614609565b50604083015161489560408401826145f5565b50606083015165ffffffffffff808216606085015280608086015116608085015250506001600160801b0360a08401511660a083015292915050565b60006001600160801b038083168185168083038211156148f3576148f3614a70565b01949350505050565b6000821982111561490f5761490f614a70565b500190565b600065ffffffffffff8083168185168083038211156148f3576148f3614a70565b60006001600160801b038084168061494f5761494f614a86565b92169190910492915050565b60008261496a5761496a614a86565b500490565b60006001600160801b038083168185168183048111821515161561499557614995614a70565b02949350505050565b60008160001904831182151516156149b8576149b8614a70565b500290565b6000828210156149cf576149cf614a70565b500390565b60005b838110156149ef5781810151838201526020016149d7565b838111156149fe576000848401525b50505050565b600081614a1357614a13614a70565b506000190190565b6000600019821415614a2f57614a2f614a70565b5060010190565b600065ffffffffffff80831681811415614a5257614a52614a70565b6001019392505050565b600082614a6b57614a6b614a86565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146105be57600080fdfe523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0ca2646970667358221220f0b0fa29848f6ab1b13be8ea73d979f55708e648a88caa079bd1e9fa48289fa164736f6c63430008040033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986caaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000000000000000000001

-----Decoded View---------------
Arg [0] : _vrfCoordinator (address): 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
Arg [1] : _linkToken (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
Arg [2] : _keyHash (bytes32): 0xaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [3] : _mainetFee (bool): True

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952
Arg [1] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [2] : aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ 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.