ETH Price: $2,487.98 (-1.19%)

Contract

0x8652168693827ff341f2ad5AD9a091f2A975710A
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Cancel Raffle158674452022-10-31 10:28:35733 days ago1667212115IN
0x86521686...2A975710A
0 ETH0.0008894811.5133541
Cancel Raffle158674442022-10-31 10:28:23733 days ago1667212103IN
0x86521686...2A975710A
0 ETH0.0009118111.80236581
Buy Entry158505472022-10-29 1:49:47735 days ago1667008187IN
0x86521686...2A975710A
0.008 ETH0.000313699.34965127
Buy Entry158505472022-10-29 1:49:47735 days ago1667008187IN
0x86521686...2A975710A
0.008 ETH0.000296918.84965127
Buy Entry158505472022-10-29 1:49:47735 days ago1667008187IN
0x86521686...2A975710A
0.008 ETH0.000313699.34965127
Buy Entry158505462022-10-29 1:49:35735 days ago1667008175IN
0x86521686...2A975710A
0.008 ETH0.000267687.97848629
Buy Entry158482892022-10-28 18:15:47735 days ago1666980947IN
0x86521686...2A975710A
0.008 ETH0.0005862217.4727812
Set Winner158404702022-10-27 16:01:35737 days ago1666886495IN
0x86521686...2A975710A
0 ETH0.0043247923.44342675
Buy Entry158404642022-10-27 16:00:23737 days ago1666886423IN
0x86521686...2A975710A
0.008 ETH0.0026319420.91417129
Buy Entry158404602022-10-27 15:59:35737 days ago1666886375IN
0x86521686...2A975710A
0.008 ETH0.0022907318.20283193
Buy Entry158404552022-10-27 15:58:35737 days ago1666886315IN
0x86521686...2A975710A
0.008 ETH0.0022769718.09349834
Buy Entry158404402022-10-27 15:55:35737 days ago1666886135IN
0x86521686...2A975710A
0.008 ETH0.002321318.44577659
Buy Entry158404262022-10-27 15:52:47737 days ago1666885967IN
0x86521686...2A975710A
0.008 ETH0.0024158719.19722947
Buy Entry158404192022-10-27 15:51:23737 days ago1666885883IN
0x86521686...2A975710A
0.024 ETH0.003912418.82785173
Buy Entry158404192022-10-27 15:51:23737 days ago1666885883IN
0x86521686...2A975710A
0.12 ETH0.029972918.82785173
Buy Entry158404132022-10-27 15:50:11737 days ago1666885811IN
0x86521686...2A975710A
0.024 ETH0.0039881119.19215925
Buy Entry158404122022-10-27 15:49:59737 days ago1666885799IN
0x86521686...2A975710A
0.008 ETH0.002447819.45098053
Buy Entry158404102022-10-27 15:49:35737 days ago1666885775IN
0x86521686...2A975710A
0.024 ETH0.0047270719.53344912
Buy Entry158404092022-10-27 15:49:23737 days ago1666885763IN
0x86521686...2A975710A
0.008 ETH0.0022190717.63342879
Buy Entry158404042022-10-27 15:48:23737 days ago1666885703IN
0x86521686...2A975710A
0.008 ETH0.0017658717.65877627
Buy Entry158404032022-10-27 15:48:11737 days ago1666885691IN
0x86521686...2A975710A
0.008 ETH0.0019895415.80947241
Buy Entry158403892022-10-27 15:45:23737 days ago1666885523IN
0x86521686...2A975710A
0.008 ETH0.0027022721.47301279
Buy Entry158403632022-10-27 15:40:11737 days ago1666885211IN
0x86521686...2A975710A
0.008 ETH0.002957323.49960619
Buy Entry158403632022-10-27 15:40:11737 days ago1666885211IN
0x86521686...2A975710A
0.08 ETH0.0231793323.49960619
Buy Entry158403532022-10-27 15:37:59737 days ago1666885079IN
0x86521686...2A975710A
0.024 ETH0.0056960523.53750231
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
158404812022-10-27 16:03:47737 days ago1666886627
0x86521686...2A975710A
14.056 ETH
158395932022-10-27 13:03:47737 days ago1666875827
0x86521686...2A975710A
2.25 ETH
158145642022-10-24 1:03:59740 days ago1666573439
0x86521686...2A975710A
1.016 ETH
158136732022-10-23 22:03:47740 days ago1666562627
0x86521686...2A975710A
0.736 ETH
158127772022-10-23 19:03:47740 days ago1666551827
0x86521686...2A975710A
1.54 ETH
158118812022-10-23 16:03:47741 days ago1666541027
0x86521686...2A975710A
1.53 ETH
158109832022-10-23 13:03:11741 days ago1666530191
0x86521686...2A975710A
1.24 ETH
158100932022-10-23 10:03:47741 days ago1666519427
0x86521686...2A975710A
0.552 ETH
158091962022-10-23 7:03:47741 days ago1666508627
0x86521686...2A975710A
0.264 ETH
158074012022-10-23 1:03:47741 days ago1666487027
0x86521686...2A975710A
0.888 ETH
158065082022-10-22 22:03:47741 days ago1666476227
0x86521686...2A975710A
0.752 ETH
158056152022-10-22 19:03:47741 days ago1666465427
0x86521686...2A975710A
1.61 ETH
158047192022-10-22 16:03:59742 days ago1666454639
0x86521686...2A975710A
1.05 ETH
158038252022-10-22 13:03:47742 days ago1666443827
0x86521686...2A975710A
2.01 ETH
158029282022-10-22 10:03:59742 days ago1666433039
0x86521686...2A975710A
0.544 ETH
158020372022-10-22 7:05:35742 days ago1666422335
0x86521686...2A975710A
0.256 ETH
158011332022-10-22 4:03:59742 days ago1666411439
0x86521686...2A975710A
0.32 ETH
158002372022-10-22 1:03:59742 days ago1666400639
0x86521686...2A975710A
0.448 ETH
157993422022-10-21 22:03:59742 days ago1666389839
0x86521686...2A975710A
1.79 ETH
157984472022-10-21 19:03:47742 days ago1666379027
0x86521686...2A975710A
1.97 ETH
157975532022-10-21 16:04:11743 days ago1666368251
0x86521686...2A975710A
8.901 ETH
157966612022-10-21 13:04:11743 days ago1666357451
0x86521686...2A975710A
1.58 ETH
157957632022-10-21 10:03:47743 days ago1666346627
0x86521686...2A975710A
0.98 ETH
157948672022-10-21 7:04:23743 days ago1666335863
0x86521686...2A975710A
0.44 ETH
157939732022-10-21 4:04:11743 days ago1666325051
0x86521686...2A975710A
1.176 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Manager

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

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

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

// Interface to Chainlink VRF v1
//import "./IVRFConsumerv1.sol";

/// @title Raffles manager
/// @author Luis
/// @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
contract Manager 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 % size of the entries array. So between 0 and entries.length -1
    }

    // 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 //////////////

    // 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);
    event StatusChangedInEmergency(uint256 indexed raffleId, uint256 newStatus);

    /* 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;
        uint256 numEntries;
        uint256 price;
    }
    mapping(uint256 => PriceStructure[5]) public prices;

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

    // Main raffle data struct
    struct RaffleStruct {
        STATUS status; // status of the raffle. Can be created, accepted, ended, etc
        uint256 maxEntries; // maximum number of entries allowed per user, to avoid abuse
        address collateralAddress; // address of the NFT
        uint256 collateralId; // NFT id of the NFT
        address winner; // address of thed winner of the raffle. Address(0) if no winner yet
        uint256 randomNumber; // normalized (0-Entries array size) random number generated by the VRF
        uint256 amountRaised; // funds raised so far in wei
        address[] entries; // array of addresses of the entries bought
        address seller; // address of the seller of the NFT
        uint256 platformPercentage; // percentage of the funds raised that goes to the platform
        address requiredNFT; // address of the required nft. Will be address(0) if no NFT is required to buy
        uint256 entriesLength; // to easy frontend, the length of the entries array is saved here
        uint256 cancellingDate;
    }
    // The main structure is an array of raffles
    RaffleStruct[] public raffles;

    // Map that contains the number of entries each user has bought, to prevent abuse, and the claiming info
    struct ClaimStruct {
        uint256 numEntriesPerUser;
        uint256 amountSpentInWeis;
        bool claimed;
    }
    mapping(bytes32 => ClaimStruct) public claimsData;

    // All the different status a raffle 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
    }
    // The operator role is operated by a backend application
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR");

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

    // address of the VRF v1 Consumer contract from Chainlink
    //   address public chainlinkContractAddress;

    constructor()
        VRFConsumerBase(
            0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator
            0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token
        )
    {
        //chainlinkContractAddress = _VRFAddress;
        _setupRole(OPERATOR_ROLE, msg.sender);
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);

        keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445;
        // fee = 0.1 * 10**18; // 0.1 LINK In Rinkeby
        // in mainnet, the fee must be 2 LINK
        fee = 2 * 10**18;
    }

    /// @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
    /// @return requestId Id generated by chainlink
    function getRandomNumber(uint256 _id, uint256 _entriesSize)
        internal
        returns (bytes32 requestId)
    {
        require(
            LINK.balanceOf(address(this)) > fee,
            "Not enough LINK - fill contract with faucet"
        );
        bytes32 result = requestRandomness(keyHash, fee);
        // result is the requestId generated by chainlink. It is saved in a map linked to the param id
        chainlinkRaffleInfo[result] = RaffleInfo({id: _id, size: _entriesSize});
        return result;
    }

    /// @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;

        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 _maxEntriesPerUser To avoid whales, the number of entries an user can have is limited
    /// @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
    /// @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(
        uint256 _desiredFundsInWeis,
        uint256 _maxEntriesPerUser,
        address _collateralAddress,
        uint256 _collateralId,
        uint256 _minimumFundsInWeis,
        PriceStructure[] calldata _prices,
        uint256 _commissionInBasicPoints,
        address _requiredNFT
    ) external onlyRole(OPERATOR_ROLE) returns (uint256) {
        require(_maxEntriesPerUser > 0, "maxEntries is 0");
        require(_collateralAddress != address(0), "NFT is null");
        require(_commissionInBasicPoints <= 5000, "commission too high");

        address[] memory _entries = new address[](0);

        RaffleStruct memory raffle = RaffleStruct({
            status: STATUS.CREATED,
            maxEntries: _maxEntriesPerUser,
            collateralAddress: _collateralAddress,
            collateralId: _collateralId,
            winner: address(0),
            randomNumber: 0,
            amountRaised: 0,
            entries: _entries,
            seller: address(0),
            platformPercentage: _commissionInBasicPoints,
            requiredNFT: _requiredNFT,
            entriesLength: 0,
            cancellingDate: 0
        });

        raffles.push(raffle);

        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: _prices[i].id,
                numEntries: _prices[i].numEntries,
                price: _prices[i].price
            });

            prices[raffles.length - 1][i] = p;
        }

        fundingList[raffles.length - 1] = FundingStructure({
            minimumFundsInWeis: _minimumFundsInWeis,
            desiredFundsInWeis: _desiredFundsInWeis
        });

        emit RaffleCreated(
            raffles.length - 1,
            _collateralAddress,
            _collateralId
        );

        return raffles.length - 1;
    }

    /* * Example of a price structure:
1 ticket 0.02
5 tickets 0.018 (10% discount)
10 tickets 0.16  (20% discount)
25 tickets 0.35  (30% discount) 
50 tickets 0.6 (40% discount)
*/
    /// @param _idRaffle raffleId
    /// @param _id Id of the price structure
    /// @return the price structure of that particular Id + raffle
    /// @dev Returns the price structure, used in the frontend
    function getPriceStructForId(uint256 _idRaffle, uint256 _id)
        internal
        view
        returns (PriceStructure memory)
    {
        for (uint256 i = 0; i < 5; i++) {
            if (prices[_idRaffle][i].id == _id) {
                return prices[_idRaffle][i];
            }
        }
        return PriceStructure({id: 0, numEntries: 0, price: 0});
    }

    /*
    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];
        // Check if the raffle is already created
        require(raffle.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"
        );

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

        // transfer the asset to the contract
        //  IERC721 _asset = IERC721(raffle.collateralAddress);
        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 made a call to set a required nft, only the owners of that nft 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)
        external
        payable
        nonReentrant
    {
        if (raffles[_raffleId].requiredNFT != address(0)) {
            IERC721 requiredNFT = IERC721(raffles[_raffleId].requiredNFT);
            require(requiredNFT.balanceOf(msg.sender) > 0, "No NFT");
        }
        require(msg.sender != address(0), "msg.sender is null"); // 37
        require(_id > 0, "howMany is 0");
        require(
            raffles[_raffleId].status == STATUS.ACCEPTED,
            "Raffle is not in accepted"
        ); // 1808
        PriceStructure memory priceStruct = getPriceStructForId(_raffleId, _id);
        //  require(priceStruct.price > 0, "id not supported");
        require(
            msg.value == priceStruct.price,
            "msg.value must be equal to the price"
        ); // 1722

        bytes32 hash = keccak256(abi.encode(msg.sender, _raffleId));
        // check there are enough entries left for this particular user
        require(
            claimsData[hash].numEntriesPerUser + priceStruct.numEntries <=
                raffles[_raffleId].maxEntries,
            "Bought too many entries"
        ); // 3425

        address entry = msg.sender; // 12
        for (uint256 i = 0; i < priceStruct.numEntries; i++) {
            raffles[_raffleId].entries.push(entry);
        }
        raffles[_raffleId].amountRaised += msg.value; // 6917 gas
        // update the field entriesLength, used in frontend to avoid making extra calls
        raffles[_raffleId].entriesLength = raffles[_raffleId].entries.length;
        //update claim data
        claimsData[hash].numEntriesPerUser += priceStruct.numEntries;
        claimsData[hash].amountSpentInWeis += msg.value;

        emit EntrySold(
            _raffleId,
            msg.sender,
            raffles[_raffleId].entries.length,
            _id
        ); // 2377
    }

    // 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 payable nonReentrant onlyRole(OPERATOR_ROLE) {
        require(
            raffles[_raffleId].status == STATUS.ACCEPTED,
            "Raffle is not in accepted"
        );

        uint256 freePlayersLength = _freePlayers.length;
        for (uint256 i = 0; i < freePlayersLength; i++) {
            address entry = _freePlayers[i];
            if (
                claimsData[keccak256(abi.encode(entry, _raffleId))]
                    .numEntriesPerUser +
                    1 <=
                raffles[_raffleId].maxEntries
            ) {
                raffles[_raffleId].entries.push(entry);
                claimsData[keccak256(abi.encode(entry, _raffleId))]
                    .numEntriesPerUser++;
            }
        }

        raffles[_raffleId].entriesLength = raffles[_raffleId].entries.length;

        emit FreeEntry(
            _raffleId,
            _freePlayers,
            freePlayersLength,
            raffles[_raffleId].entries.length
        );
    }

    // 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 only after the backekd checks the winner is a member of MW. Only those who bought using the MW site
    /// can be winners, not those who made the call to "buyEntries" directly without using MW
    function transferNFTAndFunds(
        uint256 _raffleId,
        uint256 _normalizedRandomNumber
    ) internal nonReentrant {
        RaffleStruct storage raffle = raffles[_raffleId];
        // Only when the raffle has been asked to be closed and the platform
        require(
            raffle.status == STATUS.EARLY_CASHOUT ||
                raffle.status == STATUS.CLOSING_REQUESTED,
            "Raffle in wrong status"
        );

        raffle.randomNumber = _normalizedRandomNumber;
        raffle.winner = raffle.entries[_normalizedRandomNumber];
        raffle.status = STATUS.ENDED;

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

        uint256 amountForPlatform = (raffle.amountRaised *
            raffle.platformPercentage) / 10000;
        uint256 amountForSeller = raffle.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.entries[_normalizedRandomNumber],
            raffle.amountRaised,
            _normalizedRandomNumber
        );
    }

    // 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 {
        RaffleStruct storage raffle = raffles[_raffleId];
        FundingStructure memory funding = fundingList[_raffleId];

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

        raffle.status = STATUS.EARLY_CASHOUT;

        //    IVRFConsumerv1 randomNumber = IVRFConsumerv1(chainlinkContractAddress);
        getRandomNumber(_raffleId, raffle.entries.length);

        emit EarlyCashoutTriggered(_raffleId, raffle.amountRaised);
    }

    // helper method to get the winner address of a raffle
    /// @param _raffleId Id of the raffle
    /// @param _normalizedRandomNumber index of the array that contains the winner of the raffle. Generated by chainlink
    /// @return the wallet that won the raffle (at the moment, as must be confirmed that is a member of the MW community)
    function getWinnerAddressFromRandom(
        uint256 _raffleId,
        uint256 _normalizedRandomNumber
    ) external view returns (address) {
        return raffles[_raffleId].entries[_normalizedRandomNumber];
    }

    /// @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
        payable
        nonReentrant
        onlyRole(OPERATOR_ROLE)
    {
        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(
            raffle.status == STATUS.ACCEPTED, //||
            "Raffle in wrong status"
        );
        require(
            raffle.amountRaised >= funding.minimumFundsInWeis,
            "Not enough funds raised"
        );

        //   if (raffle.status != STATUS.EARLY_CASHOUT) {
        require(
            funding.desiredFundsInWeis <= raffle.amountRaised,
            "Desired funds not raised"
        );
        raffle.status = STATUS.CLOSING_REQUESTED;
        // }

        //   IVRFConsumerv1 randomNumber = IVRFConsumerv1(chainlinkContractAddress);
        getRandomNumber(_raffleId, raffle.entries.length);

        emit SetWinnerTriggered(_raffleId, raffle.amountRaised);
    }

    /// @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 storage raffle = raffles[_raffleId];
        //FundingStructure memory funding = fundingList[_raffleId];
        // Dont cancel twice, or cancel an already ended raffle
        require(
            raffle.status != STATUS.ENDED &&
                raffle.status != STATUS.CANCELLED &&
                raffle.status != STATUS.EARLY_CASHOUT &&
                raffle.status != STATUS.CLOSING_REQUESTED &&
                raffle.status != STATUS.CANCEL_REQUESTED,
            "Wrong status"
        );

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

        emit RaffleCancelled(_raffleId, raffle.amountRaised);
    }

    /// @param _raffleId Id of the raffle
    /// @dev The player can claim a refund during the first 30 days after the raffle was cancelled
    /// in the map "ClaimsData" it is saves how much the player spent on that raffle, as they could
    /// have bought several entries
    function claimRefund(uint256 _raffleId) external nonReentrant {
        RaffleStruct storage raffle = raffles[_raffleId];
        require(raffle.status == STATUS.CANCEL_REQUESTED, "wrong status");
        require(
            block.timestamp <= raffle.cancellingDate + 30 days,
            "claim time expired"
        );

        ClaimStruct storage claimData = claimsData[
            keccak256(abi.encode(msg.sender, _raffleId))
        ];

        require(claimData.claimed == false, "already refunded");

        raffle.amountRaised = raffle.amountRaised - claimData.amountSpentInWeis;

        claimData.claimed = true;
        (bool sent, ) = msg.sender.call{value: claimData.amountSpentInWeis}("");
        require(sent, "Fail send refund");

        emit Refund(_raffleId, claimData.amountSpentInWeis, msg.sender);
    }

    /// @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 storage raffle = raffles[_raffleId];
        require(raffle.status == STATUS.CANCEL_REQUESTED, "Wrong status");
        require(
            block.timestamp > raffle.cancellingDate + 30 days,
            "claim too soon"
        );

        raffle.status = STATUS.CANCELLED;

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

        emit RemainingFundsTransferred(_raffleId, raffle.amountRaised);

        raffle.amountRaised = 0;
    }

    /// @param _raffleId Id of the raffle
    /// @return array of entries of that particular raffle
    function getEntries(uint256 _raffleId)
        external
        view
        returns (address[] memory)
    {
        return raffles[_raffleId].entries;
    }

    function getClaimData(uint256 _raffleId, address _player)
        external
        view
        returns (ClaimStruct memory)
    {
        return claimsData[keccak256(abi.encode(_player, _raffleId))];
    }
}

File 2 of 12 : 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 3 of 12 : 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 4 of 12 : 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 5 of 12 : 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);
  }
}

File 6 of 12 : 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 7 of 12 : 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 8 of 12 : 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 9 of 12 : 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 10 of 12 : 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 11 of 12 : 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 12 : 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));
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newStatus","type":"uint256"}],"name":"StatusChangedInEmergency","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_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"}],"name":"buyEntry","outputs":[],"stateMutability":"payable","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"}],"name":"claimRefund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"claimsData","outputs":[{"internalType":"uint256","name":"numEntriesPerUser","type":"uint256"},{"internalType":"uint256","name":"amountSpentInWeis","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_desiredFundsInWeis","type":"uint256"},{"internalType":"uint256","name":"_maxEntriesPerUser","type":"uint256"},{"internalType":"address","name":"_collateralAddress","type":"address"},{"internalType":"uint256","name":"_collateralId","type":"uint256"},{"internalType":"uint256","name":"_minimumFundsInWeis","type":"uint256"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"numEntries","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct Manager.PriceStructure[]","name":"_prices","type":"tuple[]"},{"internalType":"uint256","name":"_commissionInBasicPoints","type":"uint256"},{"internalType":"address","name":"_requiredNFT","type":"address"}],"name":"createRaffle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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"}],"name":"fundingList","outputs":[{"internalType":"uint256","name":"minimumFundsInWeis","type":"uint256"},{"internalType":"uint256","name":"desiredFundsInWeis","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"},{"internalType":"address","name":"_player","type":"address"}],"name":"getClaimData","outputs":[{"components":[{"internalType":"uint256","name":"numEntriesPerUser","type":"uint256"},{"internalType":"uint256","name":"amountSpentInWeis","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"internalType":"struct Manager.ClaimStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"getEntries","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"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":"payable","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":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"prices","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"numEntries","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffles","outputs":[{"internalType":"enum Manager.STATUS","name":"status","type":"uint8"},{"internalType":"uint256","name":"maxEntries","type":"uint256"},{"internalType":"address","name":"collateralAddress","type":"address"},{"internalType":"uint256","name":"collateralId","type":"uint256"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"randomNumber","type":"uint256"},{"internalType":"uint256","name":"amountRaised","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"platformPercentage","type":"uint256"},{"internalType":"address","name":"requiredNFT","type":"address"},{"internalType":"uint256","name":"entriesLength","type":"uint256"},{"internalType":"uint256","name":"cancellingDate","type":"uint256"}],"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":"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":"payable","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"}]

60c0604052600b80546001600160a01b0319167312334d915d254f1ffd3f7ea80bb5eba5ea87fb361790553480156200003757600080fd5b50600180557ff0d54349addcf704f77ae15b96510dea15cb795200000000000000000000000060a0527f514910771af9ca656af840dff83e8264ecf986ca000000000000000000000000608052620000b07f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c33620000f3565b620000bd600033620000f3565b7faa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445600355671bc16d674ec80000600455620001a3565b620000ff828262000103565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000ff576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200015f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60805160601c60a05160601c61393e620001dd600039600081816124510152612aaf0152600081816126510152612a80015261393e6000f3fe6080604052600436106101c25760003560e01c80635b7baf64116100f757806394985ddd11610095578063d547741f11610064578063d547741f146105d8578063e2a6f547146105f8578063f369145514610633578063f5b541a61461065357600080fd5b806394985ddd1461051a578063a217fddf1461053a578063baf029051461054f578063d3549ebd146105ab57600080fd5b80636eb604e0116100d15780636eb604e0146104865780637fa4cacb146104a657806381d12c58146104c657806391d14854146104fa57600080fd5b80635b7baf641461040e5780635d4bc0ce1461042e5780635fba31711461046657600080fd5b80632f2ff15d1161016457806336734e341161013e57806336734e341461035f5780634239a50c1461037257806352c8c6d71461039257806353b7a59b146103d657600080fd5b80632f2ff15d146102ff578063317f30591461031f57806336568abe1461033f57600080fd5b80630df71602116101a05780630df71602146102735780632368549614610288578063248a9ca31461029b5780632a596800146102cb57600080fd5b806301ffc9a7146101c7578063039be558146101fc5780630b9badcd14610245575b600080fd5b3480156101d357600080fd5b506101e76101e2366004613384565b610675565b60405190151581526020015b60405180910390f35b34801561020857600080fd5b5061023061021736600461331c565b6008602052600090815260409020805460019091015482565b604080519283526020830191909152016101f3565b34801561025157600080fd5b506102656102603660046134a9565b6106ac565b6040519081526020016101f3565b61028661028136600461331c565b610bcc565b005b610286610296366004613363565b610dc7565b3480156102a757600080fd5b506102656102b636600461331c565b60009081526020819052604090206001015490565b3480156102d757600080fd5b506102306102e636600461331c565b6006602052600090815260409020805460019091015482565b34801561030b57600080fd5b5061028661031a366004613334565b611392565b34801561032b57600080fd5b5061028661033a36600461331c565b6113bc565b34801561034b57600080fd5b5061028661035a366004613334565b6115db565b61028661036d3660046133d6565b611659565b34801561037e57600080fd5b5061028661038d36600461331c565b611998565b34801561039e57600080fd5b506103b26103ad3660046133c4565b611b62565b604080518251815260208084015190820152918101511515908201526060016101f3565b3480156103e257600080fd5b50600b546103f6906001600160a01b031681565b6040516001600160a01b0390911681526020016101f3565b34801561041a57600080fd5b5061028661042936600461331c565b611bf7565b34801561043a57600080fd5b5061044e61044936600461331c565b611e98565b6040516101f39c9b9a999897969594939291906136b9565b34801561047257600080fd5b5061028661048136600461331c565b611f1f565b34801561049257600080fd5b506102866104a136600461331c565b6121b3565b3480156104b257600080fd5b506102866104c13660046132e0565b6123ef565b3480156104d257600080fd5b506102306104e136600461331c565b6005602052600090815260409020805460019091015482565b34801561050657600080fd5b506101e7610515366004613334565b61241d565b34801561052657600080fd5b50610286610535366004613363565b612446565b34801561054657600080fd5b50610265600081565b34801561055b57600080fd5b5061058e61056a36600461331c565b600a6020526000908152604090208054600182015460029092015490919060ff1683565b6040805193845260208401929092521515908201526060016101f3565b3480156105b757600080fd5b506105cb6105c636600461331c565b6124c8565b6040516101f39190613681565b3480156105e457600080fd5b506102866105f3366004613334565b61255c565b34801561060457600080fd5b50610618610613366004613363565b612581565b604080519384526020840192909252908201526060016101f3565b34801561063f57600080fd5b506103f661064e366004613363565b6125b7565b34801561065f57600080fd5b506102656000805160206138e983398151915281565b60006001600160e01b03198216637965db0b60e01b14806106a657506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006000805160206138e98339815191526106c681612626565b60008a1161070d5760405162461bcd60e51b815260206004820152600f60248201526e06d6178456e7472696573206973203608c1b60448201526064015b60405180910390fd5b6001600160a01b0389166107515760405162461bcd60e51b815260206004820152600b60248201526a139195081a5cc81b9d5b1b60aa1b6044820152606401610704565b6113888411156107995760405162461bcd60e51b81526020600482015260136024820152720c6dedadad2e6e6d2dedc40e8dede40d0d2ced606b1b6044820152606401610704565b6040805160008082526101c082018352602082018181529282018d90526001600160a01b038c81166060840152608083018c905260a0830182905260c0830182905260e08301829052610100830183905261012083018290526101408301889052861661016083015261018082018190526101a082018190526009805460018082018355919092528351600d9092027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01805493949384939192839160ff19169083600681111561087a57634e487b7160e01b600052602160045260246000fd5b0217905550602082810151600183015560408301516002830180546001600160a01b039283166001600160a01b03199182161790915560608501516003850155608085015160048501805491909316911617905560a0830151600583015560c0830151600683015560e083015180516108f9926007850192019061323a565b506101008201516008820180546001600160a01b039283166001600160a01b0319918216179091556101208401516009840155610140840151600a84018054919093169116179055610160820151600b82015561018090910151600c90910155866109925760405162461bcd60e51b81526020600482015260096024820152684e6f2070726963657360b81b6044820152606401610704565b60005b87811015610b1f5760008989838181106109bf57634e487b7160e01b600052603260045260246000fd5b9050606002016020013511610a085760405162461bcd60e51b815260206004820152600f60248201526e06e756d456e7472696573206973203608c1b6044820152606401610704565b600060405180606001604052808b8b85818110610a3557634e487b7160e01b600052603260045260246000fd5b9050606002016000013581526020018b8b85818110610a6457634e487b7160e01b600052603260045260246000fd5b9050606002016020013581526020018b8b85818110610a9357634e487b7160e01b600052603260045260246000fd5b90506060020160400135815250905080600760006001600980549050610ab99190613804565b81526020019081526020016000208360058110610ae657634e487b7160e01b600052603260045260246000fd5b60030201600082015181600001556020820151816001015560408201518160020155905050508080610b1790613862565b915050610995565b5060405180604001604052808a81526020018e815250600860006001600980549050610b4b9190613804565b8152602080820192909252604001600020825181559101516001918201556009548b916001600160a01b038e1691610b839190613804565b6040517f81781e053ec72aa8731479536c4da8f819ef3283d2c0dea5c4f0d938bed8489590600090a4600954610bbb90600190613804565b9d9c50505050505050505050505050565b60026001541415610bef5760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e9833981519152610c0c81612626565b600060098381548110610c2f57634e487b7160e01b600052603260045260246000fd5b6000918252602080832086845260089091526040909220600d90910290910191506001825460ff166006811115610c7657634e487b7160e01b600052602160045260246000fd5b14610cbc5760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610704565b805460068301541015610d0b5760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da08199d5b991cc81c985a5cd959604a1b6044820152606401610704565b816006015481600101541115610d635760405162461bcd60e51b815260206004820152601860248201527f446573697265642066756e6473206e6f742072616973656400000000000000006044820152606401610704565b815460ff191660041782556007820154610d7e908590612633565b50837ff2be214756d2fbc1e781d10809ddef33000009d805be55356bb348134ce21c688360060154604051610db591815260200190565b60405180910390a25050600180555050565b60026001541415610dea5760405162461bcd60e51b815260040161070490613782565b6002600155600980546000919084908110610e1557634e487b7160e01b600052603260045260246000fd5b60009182526020909120600a600d9092020101546001600160a01b031614610f2157600060098381548110610e5a57634e487b7160e01b600052603260045260246000fd5b600091825260208220600d9190910201600a01546040516370a0823160e01b81523360048201526001600160a01b03909116925082906370a082319060240160206040518083038186803b158015610eb157600080fd5b505afa158015610ec5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee991906133ac565b11610f1f5760405162461bcd60e51b8152602060048201526006602482015265139bc813919560d21b6044820152606401610704565b505b33610f635760405162461bcd60e51b81526020600482015260126024820152711b5cd9cb9cd95b99195c881a5cc81b9d5b1b60721b6044820152606401610704565b60008111610fa25760405162461bcd60e51b815260206004820152600c60248201526b0686f774d616e7920697320360a41b6044820152606401610704565b600160098381548110610fc557634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d909102015460ff166006811115610ff857634e487b7160e01b600052602160045260246000fd5b146110415760405162461bcd60e51b8152602060048201526019602482015278149859999b19481a5cc81b9bdd081a5b881858d8d95c1d1959603a1b6044820152606401610704565b600061104d8383612778565b9050806040015134146110ae5760405162461bcd60e51b8152602060048201526024808201527f6d73672e76616c7565206d75737420626520657175616c20746f2074686520706044820152637269636560e01b6064820152608401610704565b60408051336020820152908101849052600090606001604051602081830303815290604052805190602001209050600984815481106110fd57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600101548260200151600a60008481526020019081526020016000206000015461113591906137b9565b11156111835760405162461bcd60e51b815260206004820152601760248201527f426f7567687420746f6f206d616e7920656e74726965730000000000000000006044820152606401610704565b3360005b836020015181101561120357600986815481106111b457634e487b7160e01b600052603260045260246000fd5b60009182526020808320600d92909202909101600701805460018101825590835291200180546001600160a01b0319166001600160a01b038416179055806111fb81613862565b915050611187565b50346009868154811061122657634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600601600082825461124691906137b9565b9091555050600980548690811061126d57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160070180549050600986815481106112a357634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600b01819055508260200151600a600084815260200190815260200160002060000160008282546112e291906137b9565b90915550506000828152600a6020526040812060010180543492906113089084906137b9565b92505081905550336001600160a01b0316857fd746af8dc82f9bed98cea0fe0264eb1c3d2e5f7bcc77fc5efb429c79df4078876009888154811061135c57634e487b7160e01b600052603260045260246000fd5b60009182526020918290206007600d909202010154604080519182529181018990520160405180910390a3505060018055505050565b6000828152602081905260409020600101546113ad81612626565b6113b7838361287d565b505050565b600260015414156113df5760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e98339815191526113fc81612626565b60006009838154811061141f57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506006815460ff16600681111561145757634e487b7160e01b600052602160045260246000fd5b146114935760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610704565b600c8101546114a59062278d006137b9565b42116114e45760405162461bcd60e51b815260206004820152600e60248201526d31b630b4b6903a37b79039b7b7b760911b6044820152606401610704565b805460ff19166003178155600b5460068201546040516000926001600160a01b031691908381818185875af1925050503d8060008114611540576040519150601f19603f3d011682016040523d82523d6000602084013e611545565b606091505b505090508061158c5760405162461bcd60e51b81526020600482015260136024820152724661696c2073656e642045746820746f204d5760681b6044820152606401610704565b837fcdef6558dae40f2699846eedf449462daab85b1224ad7f077569ba91aaa9492583600601546040516115c291815260200190565b60405180910390a2506000600690910155505060018055565b6001600160a01b038116331461164b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610704565b6116558282612901565b5050565b6002600154141561167c5760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e983398151915261169981612626565b6001600984815481106116bc57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d909102015460ff1660068111156116ef57634e487b7160e01b600052602160045260246000fd5b146117385760405162461bcd60e51b8152602060048201526019602482015278149859999b19481a5cc81b9bdd081a5b881858d8d95c1d1959603a1b6044820152606401610704565b815160005b818110156118c257600084828151811061176757634e487b7160e01b600052603260045260246000fd5b602002602001015190506009868154811061179257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160010154600a600083896040516020016117cf9291906001600160a01b03929092168252602082015260400190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154600161180391906137b9565b116118af576009868154811061182957634e487b7160e01b600052603260045260246000fd5b60009182526020808320600d9290920290910160070180546001810182559083528183200180546001600160a01b0319166001600160a01b03851690811790915560408051808401929092528181018a9052805180830382018152606090920181528151918301919091208352600a90915281208054916118a983613862565b91905055505b50806118ba81613862565b91505061173d565b50600984815481106118e457634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600701805490506009858154811061191a57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600b0181905550837f4da4f5fab0816c65315b6f5d15f879f96b98661133d7b3787788f291367604fb84836009888154811061197457634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160070180549050604051610db593929190613694565b6000600982815481106119bb57634e487b7160e01b600052603260045260246000fd5b6000918252602080832085845260088083526040948590208551808701909652805486526001015492850192909252600d909202909101908101549092506001600160a01b03163314611a415760405162461bcd60e51b815260206004820152600e60248201526d2737ba103a34329039b2b63632b960911b6044820152606401610704565b6001825460ff166006811115611a6757634e487b7160e01b600052602160045260246000fd5b14611ab45760405162461bcd60e51b815260206004820152601d60248201527f526166666c65206e6f7420696e206163636570746564207374617475730000006044820152606401610704565b805160068301541015611b035760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da08199d5b991cc81c985a5cd959604a1b6044820152606401610704565b815460ff191660021782556007820154611b1e908490612633565b50827f66859952a354270d9bd258f064bfb08464306538d8a01f12e1b9c6be7def11058360060154604051611b5591815260200190565b60405180910390a2505050565b611b88604051806060016040528060008152602001600081526020016000151581525090565b50604080516001600160a01b039290921660208084019190915282820193909352805180830382018152606083018083528151918501919091206000908152600a9094529281902060c0830190915280548352600181015460808301526002015460ff16151560a09091015290565b60026001541415611c1a5760405162461bcd60e51b815260040161070490613782565b6002600181905550600060098281548110611c4557634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506006815460ff166006811115611c7d57634e487b7160e01b600052602160045260246000fd5b14611cb95760405162461bcd60e51b815260206004820152600c60248201526b77726f6e672073746174757360a01b6044820152606401610704565b600c810154611ccb9062278d006137b9565b421115611d0f5760405162461bcd60e51b815260206004820152601260248201527118db185a5b481d1a5b5948195e1c1a5c995960721b6044820152606401610704565b6040805133602080830191909152818301859052825180830384018152606090920183528151918101919091206000908152600a90915220600281015460ff1615611d8f5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c99599d5b99195960821b6044820152606401610704565b80600101548260060154611da39190613804565b600683015560028101805460ff1916600190811790915581015460405160009133918381818185875af1925050503d8060008114611dfd576040519150601f19603f3d011682016040523d82523d6000602084013e611e02565b606091505b5050905080611e465760405162461bcd60e51b815260206004820152601060248201526f11985a5b081cd95b99081c99599d5b9960821b6044820152606401610704565b336001600160a01b0316847ffe438001a6dd8298a7672e341088143b150c2227f220b57280a002f5357612b78460010154604051611e8691815260200190565b60405180910390a35050600180555050565b60098181548110611ea857600080fd5b60009182526020909120600d90910201805460018201546002830154600384015460048501546005860154600687015460088801546009890154600a8a0154600b8b0154600c909b015460ff909a169b5097996001600160a01b03978816999698958816979496939592851694919392909116918c565b60026001541415611f425760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e9833981519152611f5f81612626565b600060098381548110611f8257634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506005815460ff166006811115611fba57634e487b7160e01b600052602160045260246000fd5b14158015611fec57506003815460ff166006811115611fe957634e487b7160e01b600052602160045260246000fd5b14155b801561201c57506002815460ff16600681111561201957634e487b7160e01b600052602160045260246000fd5b14155b801561204c57506004815460ff16600681111561204957634e487b7160e01b600052602160045260246000fd5b14155b801561207c57506006815460ff16600681111561207957634e487b7160e01b600052602160045260246000fd5b14155b6120b75760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610704565b6001815460ff1660068111156120dd57634e487b7160e01b600052602160045260246000fd5b141561215f576002810154600882015460038301546040516323b872dd60e01b81523060048201526001600160a01b039283166024820152604481019190915291169081906323b872dd90606401600060405180830381600087803b15801561214557600080fd5b505af1158015612159573d6000803e3d6000fd5b50505050505b805460ff19166006908117825542600c83015581015460405190815283907fd512a34b0f0618078770fcd85d974df1ab46a7882e8b3d45aa91764f4961aed29060200160405180910390a250506001805550565b6000600982815481106121d657634e487b7160e01b600052603260045260246000fd5b600091825260208220600d909102019150815460ff16600681111561220b57634e487b7160e01b600052602160045260246000fd5b1461224d5760405162461bcd60e51b8152602060048201526012602482015271149859999b19481b9bdd0810d4915055115160721b6044820152606401610704565b600281015460038201546040516331a9108f60e11b81526001600160a01b039092169133918391636352211e9161228a9160040190815260200190565b60206040518083038186803b1580156122a257600080fd5b505afa1580156122b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122da91906132c4565b6001600160a01b0316146123305760405162461bcd60e51b815260206004820152601a60248201527f4e4654206973206e6f74206f776e65642062792063616c6c65720000000000006044820152606401610704565b815460ff191660011782556008820180546001600160a01b0319163390811790915560038301546040516323b872dd60e01b8152600481019290925230602483015260448201526001600160a01b038216906323b872dd90606401600060405180830381600087803b1580156123a557600080fd5b505af11580156123b9573d6000803e3d6000fd5b50506040513392508591507f8bb509eedfd1c4847b0a8a2b4493cf2ebb9970dc367e477cd2a8523e212dc1db90600090a3505050565b60006123fa81612626565b50600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146124be5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610704565b6116558282612966565b6060600982815481106124eb57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160070180548060200260200160405190810160405280929190818152602001828054801561255057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612532575b50505050509050919050565b60008281526020819052604090206001015461257781612626565b6113b78383612901565b6007602052816000526040600020816005811061259d57600080fd5b600302018054600182015460029092015490935090915083565b6000600983815481106125da57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600701828154811061260a57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03169392505050565b6126308133612a18565b50565b600480546040516370a0823160e01b815230928101929092526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561269b57600080fd5b505afa1580156126af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d391906133ac565b116127345760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610704565b6000612744600354600454612a7c565b6040805180820182529586526020808701958652600083815260069091522094518555925160019094019390935550919050565b61279c60405180606001604052806000815260200160008152602001600081525090565b60005b6005811015612856576000848152600760205260409020839082600581106127d757634e487b7160e01b600052603260045260246000fd5b60030201541415612844576000848152600760205260409020816005811061280f57634e487b7160e01b600052603260045260246000fd5b6003020160405180606001604052908160008201548152602001600182015481526020016002820154815250509150506106a6565b8061284e81613862565b91505061279f565b50604051806060016040528060008152602001600081526020016000815250905092915050565b612887828261241d565b611655576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556128bd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61290b828261241d565b15611655576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152600660209081526040808320815180830190925280548252600101549181018290529190612999908461387d565b60408051808201825285815260208082018481528651600090815260058352849020835181559051600190910155855183518881529182018590529394509092917f7c40e661b8212d0c4f60ac6e6ebed99c28680c7b3ede5b82f3b0254543f62fca910160405180910390a28251612a119083612c0f565b5050505050565b612a22828261241d565b61165557612a3a816001600160a01b03166014613051565b612a45836020613051565b604051602001612a569291906135dc565b60408051601f198184030181529082905262461bcd60e51b82526107049160040161376f565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001612aec929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401612b1993929190613651565b602060405180830381600087803b158015612b3357600080fd5b505af1158015612b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6b91906132fc565b50600083815260026020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052612bc79060016137b9565b600085815260026020526040902055612c078482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b949350505050565b60026001541415612c325760405162461bcd60e51b815260040161070490613782565b6002600181905550600060098381548110612c5d57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506002815460ff166006811115612c9557634e487b7160e01b600052602160045260246000fd5b1480612cc457506004815460ff166006811115612cc257634e487b7160e01b600052602160045260246000fd5b145b612d095760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610704565b6005810182905560078101805483908110612d3457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546004820180546001600160a01b039283166001600160a01b0319909116179055815460ff191660051782556002820154600783018054919092169182916323b872dd91309187908110612da357634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600386015460405160e085901b6001600160e01b03191681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015612e0357600080fd5b505af1158015612e17573d6000803e3d6000fd5b50505050600061271083600901548460060154612e3491906137e5565b612e3e91906137d1565b90506000818460060154612e529190613804565b60088501546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114612ea6576040519150601f19603f3d011682016040523d82523d6000602084013e612eab565b606091505b5050905080612ef35760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610704565b600b546040516000916001600160a01b03169085908381818185875af1925050503d8060008114612f40576040519150601f19603f3d011682016040523d82523d6000602084013e612f45565b606091505b5050905080612f8e5760405162461bcd60e51b81526020600482015260156024820152744661696c65642073656e642045746820746f204d5760581b6044820152606401610704565b877f7378e11c2b0ec7514bbf7ba369980eedcba0bca03e116dc9e7138f7748e211d685604051612fc091815260200190565b60405180910390a2856007018781548110612feb57634e487b7160e01b600052603260045260246000fd5b600091825260209182902001546006880154604080519182529281018a90526001600160a01b03909116918a917fe0b2a72a0644b093aac275024c05c7c28851a0b572557a32241d13634a0f3e08910160405180910390a3505060018055505050505050565b606060006130608360026137e5565b61306b9060026137b9565b67ffffffffffffffff81111561309157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156130bb576020820181803683370190505b509050600360fc1b816000815181106130e457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061312157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006131458460026137e5565b6131509060016137b9565b90505b60018111156131e4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061319257634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106131b657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936131dd8161384b565b9050613153565b5083156132335760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610704565b9392505050565b82805482825590600052602060002090810192821561328f579160200282015b8281111561328f57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061325a565b5061329b92915061329f565b5090565b5b8082111561329b57600081556001016132a0565b80356132bf816138d3565b919050565b6000602082840312156132d5578081fd5b8151613233816138d3565b6000602082840312156132f1578081fd5b8135613233816138d3565b60006020828403121561330d578081fd5b81518015158114613233578182fd5b60006020828403121561332d578081fd5b5035919050565b60008060408385031215613346578081fd5b823591506020830135613358816138d3565b809150509250929050565b60008060408385031215613375578182fd5b50508035926020909101359150565b600060208284031215613395578081fd5b81356001600160e01b031981168114613233578182fd5b6000602082840312156133bd578081fd5b5051919050565b60008060408385031215613346578182fd5b600080604083850312156133e8578182fd5b8235915060208084013567ffffffffffffffff80821115613407578384fd5b818601915086601f83011261341a578384fd5b81358181111561342c5761342c6138bd565b8060051b604051601f19603f83011681018181108582111715613451576134516138bd565b604052828152858101935084860182860187018b101561346f578788fd5b8795505b8386101561349857613484816132b4565b855260019590950194938601938601613473565b508096505050505050509250929050565b60008060008060008060008060006101008a8c0312156134c7578485fd5b8935985060208a0135975060408a01356134e0816138d3565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff8082111561350a578586fd5b818c0191508c601f83011261351d578586fd5b81358181111561352b578687fd5b8d602060608302850101111561353f578687fd5b60208301965080955050505060c08a0135915061355e60e08b016132b4565b90509295985092959850929598565b6000815180845260208085019450808401835b838110156135a55781516001600160a01b031687529582019590820190600101613580565b509495945050505050565b600081518084526135c881602086016020860161381b565b601f01601f19169290920160200192915050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161361481601785016020880161381b565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161364581602884016020880161381b565b01602801949350505050565b60018060a01b038416815282602082015260606040820152600061367860608301846135b0565b95945050505050565b602081526000613233602083018461356d565b6060815260006136a7606083018661356d565b60208301949094525060400152919050565b610180810160078e106136dc57634e487b7160e01b600052602160045260246000fd5b8d82528c60208301526136fa604083018d6001600160a01b03169052565b8a6060830152613715608083018b6001600160a01b03169052565b8860a08301528760c083015261373660e08301886001600160a01b03169052565b856101008301526137536101208301866001600160a01b03169052565b61014082019390935261016001529a9950505050505050505050565b60208152600061323360208301846135b0565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600082198211156137cc576137cc613891565b500190565b6000826137e0576137e06138a7565b500490565b60008160001904831182151516156137ff576137ff613891565b500290565b60008282101561381657613816613891565b500390565b60005b8381101561383657818101518382015260200161381e565b83811115613845576000848401525b50505050565b60008161385a5761385a613891565b506000190190565b600060001982141561387657613876613891565b5060010190565b60008261388c5761388c6138a7565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461263057600080fdfe523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0ca2646970667358221220a91a3987227bb7fca7b3f4062b4532495dfaa365be288e93f1d50ef973cf849d64736f6c63430008040033

Deployed Bytecode

0x6080604052600436106101c25760003560e01c80635b7baf64116100f757806394985ddd11610095578063d547741f11610064578063d547741f146105d8578063e2a6f547146105f8578063f369145514610633578063f5b541a61461065357600080fd5b806394985ddd1461051a578063a217fddf1461053a578063baf029051461054f578063d3549ebd146105ab57600080fd5b80636eb604e0116100d15780636eb604e0146104865780637fa4cacb146104a657806381d12c58146104c657806391d14854146104fa57600080fd5b80635b7baf641461040e5780635d4bc0ce1461042e5780635fba31711461046657600080fd5b80632f2ff15d1161016457806336734e341161013e57806336734e341461035f5780634239a50c1461037257806352c8c6d71461039257806353b7a59b146103d657600080fd5b80632f2ff15d146102ff578063317f30591461031f57806336568abe1461033f57600080fd5b80630df71602116101a05780630df71602146102735780632368549614610288578063248a9ca31461029b5780632a596800146102cb57600080fd5b806301ffc9a7146101c7578063039be558146101fc5780630b9badcd14610245575b600080fd5b3480156101d357600080fd5b506101e76101e2366004613384565b610675565b60405190151581526020015b60405180910390f35b34801561020857600080fd5b5061023061021736600461331c565b6008602052600090815260409020805460019091015482565b604080519283526020830191909152016101f3565b34801561025157600080fd5b506102656102603660046134a9565b6106ac565b6040519081526020016101f3565b61028661028136600461331c565b610bcc565b005b610286610296366004613363565b610dc7565b3480156102a757600080fd5b506102656102b636600461331c565b60009081526020819052604090206001015490565b3480156102d757600080fd5b506102306102e636600461331c565b6006602052600090815260409020805460019091015482565b34801561030b57600080fd5b5061028661031a366004613334565b611392565b34801561032b57600080fd5b5061028661033a36600461331c565b6113bc565b34801561034b57600080fd5b5061028661035a366004613334565b6115db565b61028661036d3660046133d6565b611659565b34801561037e57600080fd5b5061028661038d36600461331c565b611998565b34801561039e57600080fd5b506103b26103ad3660046133c4565b611b62565b604080518251815260208084015190820152918101511515908201526060016101f3565b3480156103e257600080fd5b50600b546103f6906001600160a01b031681565b6040516001600160a01b0390911681526020016101f3565b34801561041a57600080fd5b5061028661042936600461331c565b611bf7565b34801561043a57600080fd5b5061044e61044936600461331c565b611e98565b6040516101f39c9b9a999897969594939291906136b9565b34801561047257600080fd5b5061028661048136600461331c565b611f1f565b34801561049257600080fd5b506102866104a136600461331c565b6121b3565b3480156104b257600080fd5b506102866104c13660046132e0565b6123ef565b3480156104d257600080fd5b506102306104e136600461331c565b6005602052600090815260409020805460019091015482565b34801561050657600080fd5b506101e7610515366004613334565b61241d565b34801561052657600080fd5b50610286610535366004613363565b612446565b34801561054657600080fd5b50610265600081565b34801561055b57600080fd5b5061058e61056a36600461331c565b600a6020526000908152604090208054600182015460029092015490919060ff1683565b6040805193845260208401929092521515908201526060016101f3565b3480156105b757600080fd5b506105cb6105c636600461331c565b6124c8565b6040516101f39190613681565b3480156105e457600080fd5b506102866105f3366004613334565b61255c565b34801561060457600080fd5b50610618610613366004613363565b612581565b604080519384526020840192909252908201526060016101f3565b34801561063f57600080fd5b506103f661064e366004613363565b6125b7565b34801561065f57600080fd5b506102656000805160206138e983398151915281565b60006001600160e01b03198216637965db0b60e01b14806106a657506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006000805160206138e98339815191526106c681612626565b60008a1161070d5760405162461bcd60e51b815260206004820152600f60248201526e06d6178456e7472696573206973203608c1b60448201526064015b60405180910390fd5b6001600160a01b0389166107515760405162461bcd60e51b815260206004820152600b60248201526a139195081a5cc81b9d5b1b60aa1b6044820152606401610704565b6113888411156107995760405162461bcd60e51b81526020600482015260136024820152720c6dedadad2e6e6d2dedc40e8dede40d0d2ced606b1b6044820152606401610704565b6040805160008082526101c082018352602082018181529282018d90526001600160a01b038c81166060840152608083018c905260a0830182905260c0830182905260e08301829052610100830183905261012083018290526101408301889052861661016083015261018082018190526101a082018190526009805460018082018355919092528351600d9092027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01805493949384939192839160ff19169083600681111561087a57634e487b7160e01b600052602160045260246000fd5b0217905550602082810151600183015560408301516002830180546001600160a01b039283166001600160a01b03199182161790915560608501516003850155608085015160048501805491909316911617905560a0830151600583015560c0830151600683015560e083015180516108f9926007850192019061323a565b506101008201516008820180546001600160a01b039283166001600160a01b0319918216179091556101208401516009840155610140840151600a84018054919093169116179055610160820151600b82015561018090910151600c90910155866109925760405162461bcd60e51b81526020600482015260096024820152684e6f2070726963657360b81b6044820152606401610704565b60005b87811015610b1f5760008989838181106109bf57634e487b7160e01b600052603260045260246000fd5b9050606002016020013511610a085760405162461bcd60e51b815260206004820152600f60248201526e06e756d456e7472696573206973203608c1b6044820152606401610704565b600060405180606001604052808b8b85818110610a3557634e487b7160e01b600052603260045260246000fd5b9050606002016000013581526020018b8b85818110610a6457634e487b7160e01b600052603260045260246000fd5b9050606002016020013581526020018b8b85818110610a9357634e487b7160e01b600052603260045260246000fd5b90506060020160400135815250905080600760006001600980549050610ab99190613804565b81526020019081526020016000208360058110610ae657634e487b7160e01b600052603260045260246000fd5b60030201600082015181600001556020820151816001015560408201518160020155905050508080610b1790613862565b915050610995565b5060405180604001604052808a81526020018e815250600860006001600980549050610b4b9190613804565b8152602080820192909252604001600020825181559101516001918201556009548b916001600160a01b038e1691610b839190613804565b6040517f81781e053ec72aa8731479536c4da8f819ef3283d2c0dea5c4f0d938bed8489590600090a4600954610bbb90600190613804565b9d9c50505050505050505050505050565b60026001541415610bef5760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e9833981519152610c0c81612626565b600060098381548110610c2f57634e487b7160e01b600052603260045260246000fd5b6000918252602080832086845260089091526040909220600d90910290910191506001825460ff166006811115610c7657634e487b7160e01b600052602160045260246000fd5b14610cbc5760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610704565b805460068301541015610d0b5760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da08199d5b991cc81c985a5cd959604a1b6044820152606401610704565b816006015481600101541115610d635760405162461bcd60e51b815260206004820152601860248201527f446573697265642066756e6473206e6f742072616973656400000000000000006044820152606401610704565b815460ff191660041782556007820154610d7e908590612633565b50837ff2be214756d2fbc1e781d10809ddef33000009d805be55356bb348134ce21c688360060154604051610db591815260200190565b60405180910390a25050600180555050565b60026001541415610dea5760405162461bcd60e51b815260040161070490613782565b6002600155600980546000919084908110610e1557634e487b7160e01b600052603260045260246000fd5b60009182526020909120600a600d9092020101546001600160a01b031614610f2157600060098381548110610e5a57634e487b7160e01b600052603260045260246000fd5b600091825260208220600d9190910201600a01546040516370a0823160e01b81523360048201526001600160a01b03909116925082906370a082319060240160206040518083038186803b158015610eb157600080fd5b505afa158015610ec5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee991906133ac565b11610f1f5760405162461bcd60e51b8152602060048201526006602482015265139bc813919560d21b6044820152606401610704565b505b33610f635760405162461bcd60e51b81526020600482015260126024820152711b5cd9cb9cd95b99195c881a5cc81b9d5b1b60721b6044820152606401610704565b60008111610fa25760405162461bcd60e51b815260206004820152600c60248201526b0686f774d616e7920697320360a41b6044820152606401610704565b600160098381548110610fc557634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d909102015460ff166006811115610ff857634e487b7160e01b600052602160045260246000fd5b146110415760405162461bcd60e51b8152602060048201526019602482015278149859999b19481a5cc81b9bdd081a5b881858d8d95c1d1959603a1b6044820152606401610704565b600061104d8383612778565b9050806040015134146110ae5760405162461bcd60e51b8152602060048201526024808201527f6d73672e76616c7565206d75737420626520657175616c20746f2074686520706044820152637269636560e01b6064820152608401610704565b60408051336020820152908101849052600090606001604051602081830303815290604052805190602001209050600984815481106110fd57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600101548260200151600a60008481526020019081526020016000206000015461113591906137b9565b11156111835760405162461bcd60e51b815260206004820152601760248201527f426f7567687420746f6f206d616e7920656e74726965730000000000000000006044820152606401610704565b3360005b836020015181101561120357600986815481106111b457634e487b7160e01b600052603260045260246000fd5b60009182526020808320600d92909202909101600701805460018101825590835291200180546001600160a01b0319166001600160a01b038416179055806111fb81613862565b915050611187565b50346009868154811061122657634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600601600082825461124691906137b9565b9091555050600980548690811061126d57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160070180549050600986815481106112a357634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600b01819055508260200151600a600084815260200190815260200160002060000160008282546112e291906137b9565b90915550506000828152600a6020526040812060010180543492906113089084906137b9565b92505081905550336001600160a01b0316857fd746af8dc82f9bed98cea0fe0264eb1c3d2e5f7bcc77fc5efb429c79df4078876009888154811061135c57634e487b7160e01b600052603260045260246000fd5b60009182526020918290206007600d909202010154604080519182529181018990520160405180910390a3505060018055505050565b6000828152602081905260409020600101546113ad81612626565b6113b7838361287d565b505050565b600260015414156113df5760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e98339815191526113fc81612626565b60006009838154811061141f57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506006815460ff16600681111561145757634e487b7160e01b600052602160045260246000fd5b146114935760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610704565b600c8101546114a59062278d006137b9565b42116114e45760405162461bcd60e51b815260206004820152600e60248201526d31b630b4b6903a37b79039b7b7b760911b6044820152606401610704565b805460ff19166003178155600b5460068201546040516000926001600160a01b031691908381818185875af1925050503d8060008114611540576040519150601f19603f3d011682016040523d82523d6000602084013e611545565b606091505b505090508061158c5760405162461bcd60e51b81526020600482015260136024820152724661696c2073656e642045746820746f204d5760681b6044820152606401610704565b837fcdef6558dae40f2699846eedf449462daab85b1224ad7f077569ba91aaa9492583600601546040516115c291815260200190565b60405180910390a2506000600690910155505060018055565b6001600160a01b038116331461164b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610704565b6116558282612901565b5050565b6002600154141561167c5760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e983398151915261169981612626565b6001600984815481106116bc57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d909102015460ff1660068111156116ef57634e487b7160e01b600052602160045260246000fd5b146117385760405162461bcd60e51b8152602060048201526019602482015278149859999b19481a5cc81b9bdd081a5b881858d8d95c1d1959603a1b6044820152606401610704565b815160005b818110156118c257600084828151811061176757634e487b7160e01b600052603260045260246000fd5b602002602001015190506009868154811061179257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160010154600a600083896040516020016117cf9291906001600160a01b03929092168252602082015260400190565b60405160208183030381529060405280519060200120815260200190815260200160002060000154600161180391906137b9565b116118af576009868154811061182957634e487b7160e01b600052603260045260246000fd5b60009182526020808320600d9290920290910160070180546001810182559083528183200180546001600160a01b0319166001600160a01b03851690811790915560408051808401929092528181018a9052805180830382018152606090920181528151918301919091208352600a90915281208054916118a983613862565b91905055505b50806118ba81613862565b91505061173d565b50600984815481106118e457634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600701805490506009858154811061191a57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600b0181905550837f4da4f5fab0816c65315b6f5d15f879f96b98661133d7b3787788f291367604fb84836009888154811061197457634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160070180549050604051610db593929190613694565b6000600982815481106119bb57634e487b7160e01b600052603260045260246000fd5b6000918252602080832085845260088083526040948590208551808701909652805486526001015492850192909252600d909202909101908101549092506001600160a01b03163314611a415760405162461bcd60e51b815260206004820152600e60248201526d2737ba103a34329039b2b63632b960911b6044820152606401610704565b6001825460ff166006811115611a6757634e487b7160e01b600052602160045260246000fd5b14611ab45760405162461bcd60e51b815260206004820152601d60248201527f526166666c65206e6f7420696e206163636570746564207374617475730000006044820152606401610704565b805160068301541015611b035760405162461bcd60e51b8152602060048201526017602482015276139bdd08195b9bdd59da08199d5b991cc81c985a5cd959604a1b6044820152606401610704565b815460ff191660021782556007820154611b1e908490612633565b50827f66859952a354270d9bd258f064bfb08464306538d8a01f12e1b9c6be7def11058360060154604051611b5591815260200190565b60405180910390a2505050565b611b88604051806060016040528060008152602001600081526020016000151581525090565b50604080516001600160a01b039290921660208084019190915282820193909352805180830382018152606083018083528151918501919091206000908152600a9094529281902060c0830190915280548352600181015460808301526002015460ff16151560a09091015290565b60026001541415611c1a5760405162461bcd60e51b815260040161070490613782565b6002600181905550600060098281548110611c4557634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506006815460ff166006811115611c7d57634e487b7160e01b600052602160045260246000fd5b14611cb95760405162461bcd60e51b815260206004820152600c60248201526b77726f6e672073746174757360a01b6044820152606401610704565b600c810154611ccb9062278d006137b9565b421115611d0f5760405162461bcd60e51b815260206004820152601260248201527118db185a5b481d1a5b5948195e1c1a5c995960721b6044820152606401610704565b6040805133602080830191909152818301859052825180830384018152606090920183528151918101919091206000908152600a90915220600281015460ff1615611d8f5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c99599d5b99195960821b6044820152606401610704565b80600101548260060154611da39190613804565b600683015560028101805460ff1916600190811790915581015460405160009133918381818185875af1925050503d8060008114611dfd576040519150601f19603f3d011682016040523d82523d6000602084013e611e02565b606091505b5050905080611e465760405162461bcd60e51b815260206004820152601060248201526f11985a5b081cd95b99081c99599d5b9960821b6044820152606401610704565b336001600160a01b0316847ffe438001a6dd8298a7672e341088143b150c2227f220b57280a002f5357612b78460010154604051611e8691815260200190565b60405180910390a35050600180555050565b60098181548110611ea857600080fd5b60009182526020909120600d90910201805460018201546002830154600384015460048501546005860154600687015460088801546009890154600a8a0154600b8b0154600c909b015460ff909a169b5097996001600160a01b03978816999698958816979496939592851694919392909116918c565b60026001541415611f425760405162461bcd60e51b815260040161070490613782565b60026001556000805160206138e9833981519152611f5f81612626565b600060098381548110611f8257634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506005815460ff166006811115611fba57634e487b7160e01b600052602160045260246000fd5b14158015611fec57506003815460ff166006811115611fe957634e487b7160e01b600052602160045260246000fd5b14155b801561201c57506002815460ff16600681111561201957634e487b7160e01b600052602160045260246000fd5b14155b801561204c57506004815460ff16600681111561204957634e487b7160e01b600052602160045260246000fd5b14155b801561207c57506006815460ff16600681111561207957634e487b7160e01b600052602160045260246000fd5b14155b6120b75760405162461bcd60e51b815260206004820152600c60248201526b57726f6e672073746174757360a01b6044820152606401610704565b6001815460ff1660068111156120dd57634e487b7160e01b600052602160045260246000fd5b141561215f576002810154600882015460038301546040516323b872dd60e01b81523060048201526001600160a01b039283166024820152604481019190915291169081906323b872dd90606401600060405180830381600087803b15801561214557600080fd5b505af1158015612159573d6000803e3d6000fd5b50505050505b805460ff19166006908117825542600c83015581015460405190815283907fd512a34b0f0618078770fcd85d974df1ab46a7882e8b3d45aa91764f4961aed29060200160405180910390a250506001805550565b6000600982815481106121d657634e487b7160e01b600052603260045260246000fd5b600091825260208220600d909102019150815460ff16600681111561220b57634e487b7160e01b600052602160045260246000fd5b1461224d5760405162461bcd60e51b8152602060048201526012602482015271149859999b19481b9bdd0810d4915055115160721b6044820152606401610704565b600281015460038201546040516331a9108f60e11b81526001600160a01b039092169133918391636352211e9161228a9160040190815260200190565b60206040518083038186803b1580156122a257600080fd5b505afa1580156122b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122da91906132c4565b6001600160a01b0316146123305760405162461bcd60e51b815260206004820152601a60248201527f4e4654206973206e6f74206f776e65642062792063616c6c65720000000000006044820152606401610704565b815460ff191660011782556008820180546001600160a01b0319163390811790915560038301546040516323b872dd60e01b8152600481019290925230602483015260448201526001600160a01b038216906323b872dd90606401600060405180830381600087803b1580156123a557600080fd5b505af11580156123b9573d6000803e3d6000fd5b50506040513392508591507f8bb509eedfd1c4847b0a8a2b4493cf2ebb9970dc367e477cd2a8523e212dc1db90600090a3505050565b60006123fa81612626565b50600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795216146124be5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610704565b6116558282612966565b6060600982815481106124eb57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d020160070180548060200260200160405190810160405280929190818152602001828054801561255057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612532575b50505050509050919050565b60008281526020819052604090206001015461257781612626565b6113b78383612901565b6007602052816000526040600020816005811061259d57600080fd5b600302018054600182015460029092015490935090915083565b6000600983815481106125da57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600d0201600701828154811061260a57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03169392505050565b6126308133612a18565b50565b600480546040516370a0823160e01b815230928101929092526000917f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316906370a082319060240160206040518083038186803b15801561269b57600080fd5b505afa1580156126af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d391906133ac565b116127345760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b6064820152608401610704565b6000612744600354600454612a7c565b6040805180820182529586526020808701958652600083815260069091522094518555925160019094019390935550919050565b61279c60405180606001604052806000815260200160008152602001600081525090565b60005b6005811015612856576000848152600760205260409020839082600581106127d757634e487b7160e01b600052603260045260246000fd5b60030201541415612844576000848152600760205260409020816005811061280f57634e487b7160e01b600052603260045260246000fd5b6003020160405180606001604052908160008201548152602001600182015481526020016002820154815250509150506106a6565b8061284e81613862565b91505061279f565b50604051806060016040528060008152602001600081526020016000815250905092915050565b612887828261241d565b611655576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556128bd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61290b828261241d565b15611655576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152600660209081526040808320815180830190925280548252600101549181018290529190612999908461387d565b60408051808201825285815260208082018481528651600090815260058352849020835181559051600190910155855183518881529182018590529394509092917f7c40e661b8212d0c4f60ac6e6ebed99c28680c7b3ede5b82f3b0254543f62fca910160405180910390a28251612a119083612c0f565b5050505050565b612a22828261241d565b61165557612a3a816001600160a01b03166014613051565b612a45836020613051565b604051602001612a569291906135dc565b60408051601f198184030181529082905262461bcd60e51b82526107049160040161376f565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795284866000604051602001612aec929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401612b1993929190613651565b602060405180830381600087803b158015612b3357600080fd5b505af1158015612b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6b91906132fc565b50600083815260026020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052612bc79060016137b9565b600085815260026020526040902055612c078482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b949350505050565b60026001541415612c325760405162461bcd60e51b815260040161070490613782565b6002600181905550600060098381548110612c5d57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600d9091020190506002815460ff166006811115612c9557634e487b7160e01b600052602160045260246000fd5b1480612cc457506004815460ff166006811115612cc257634e487b7160e01b600052602160045260246000fd5b145b612d095760405162461bcd60e51b8152602060048201526016602482015275526166666c6520696e2077726f6e672073746174757360501b6044820152606401610704565b6005810182905560078101805483908110612d3457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546004820180546001600160a01b039283166001600160a01b0319909116179055815460ff191660051782556002820154600783018054919092169182916323b872dd91309187908110612da357634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600386015460405160e085901b6001600160e01b03191681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015612e0357600080fd5b505af1158015612e17573d6000803e3d6000fd5b50505050600061271083600901548460060154612e3491906137e5565b612e3e91906137d1565b90506000818460060154612e529190613804565b60088501546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114612ea6576040519150601f19603f3d011682016040523d82523d6000602084013e612eab565b606091505b5050905080612ef35760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610704565b600b546040516000916001600160a01b03169085908381818185875af1925050503d8060008114612f40576040519150601f19603f3d011682016040523d82523d6000602084013e612f45565b606091505b5050905080612f8e5760405162461bcd60e51b81526020600482015260156024820152744661696c65642073656e642045746820746f204d5760581b6044820152606401610704565b877f7378e11c2b0ec7514bbf7ba369980eedcba0bca03e116dc9e7138f7748e211d685604051612fc091815260200190565b60405180910390a2856007018781548110612feb57634e487b7160e01b600052603260045260246000fd5b600091825260209182902001546006880154604080519182529281018a90526001600160a01b03909116918a917fe0b2a72a0644b093aac275024c05c7c28851a0b572557a32241d13634a0f3e08910160405180910390a3505060018055505050505050565b606060006130608360026137e5565b61306b9060026137b9565b67ffffffffffffffff81111561309157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156130bb576020820181803683370190505b509050600360fc1b816000815181106130e457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061312157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006131458460026137e5565b6131509060016137b9565b90505b60018111156131e4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061319257634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106131b657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936131dd8161384b565b9050613153565b5083156132335760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610704565b9392505050565b82805482825590600052602060002090810192821561328f579160200282015b8281111561328f57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061325a565b5061329b92915061329f565b5090565b5b8082111561329b57600081556001016132a0565b80356132bf816138d3565b919050565b6000602082840312156132d5578081fd5b8151613233816138d3565b6000602082840312156132f1578081fd5b8135613233816138d3565b60006020828403121561330d578081fd5b81518015158114613233578182fd5b60006020828403121561332d578081fd5b5035919050565b60008060408385031215613346578081fd5b823591506020830135613358816138d3565b809150509250929050565b60008060408385031215613375578182fd5b50508035926020909101359150565b600060208284031215613395578081fd5b81356001600160e01b031981168114613233578182fd5b6000602082840312156133bd578081fd5b5051919050565b60008060408385031215613346578182fd5b600080604083850312156133e8578182fd5b8235915060208084013567ffffffffffffffff80821115613407578384fd5b818601915086601f83011261341a578384fd5b81358181111561342c5761342c6138bd565b8060051b604051601f19603f83011681018181108582111715613451576134516138bd565b604052828152858101935084860182860187018b101561346f578788fd5b8795505b8386101561349857613484816132b4565b855260019590950194938601938601613473565b508096505050505050509250929050565b60008060008060008060008060006101008a8c0312156134c7578485fd5b8935985060208a0135975060408a01356134e0816138d3565b965060608a0135955060808a0135945060a08a013567ffffffffffffffff8082111561350a578586fd5b818c0191508c601f83011261351d578586fd5b81358181111561352b578687fd5b8d602060608302850101111561353f578687fd5b60208301965080955050505060c08a0135915061355e60e08b016132b4565b90509295985092959850929598565b6000815180845260208085019450808401835b838110156135a55781516001600160a01b031687529582019590820190600101613580565b509495945050505050565b600081518084526135c881602086016020860161381b565b601f01601f19169290920160200192915050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161361481601785016020880161381b565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161364581602884016020880161381b565b01602801949350505050565b60018060a01b038416815282602082015260606040820152600061367860608301846135b0565b95945050505050565b602081526000613233602083018461356d565b6060815260006136a7606083018661356d565b60208301949094525060400152919050565b610180810160078e106136dc57634e487b7160e01b600052602160045260246000fd5b8d82528c60208301526136fa604083018d6001600160a01b03169052565b8a6060830152613715608083018b6001600160a01b03169052565b8860a08301528760c083015261373660e08301886001600160a01b03169052565b856101008301526137536101208301866001600160a01b03169052565b61014082019390935261016001529a9950505050505050505050565b60208152600061323360208301846135b0565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600082198211156137cc576137cc613891565b500190565b6000826137e0576137e06138a7565b500490565b60008160001904831182151516156137ff576137ff613891565b500290565b60008282101561381657613816613891565b500390565b60005b8381101561383657818101518382015260200161381e565b83811115613845576000848401525b50505050565b60008161385a5761385a613891565b506000190190565b600060001982141561387657613876613891565b5060010190565b60008261388c5761388c6138a7565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461263057600080fdfe523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0ca2646970667358221220a91a3987227bb7fca7b3f4062b4532495dfaa365be288e93f1d50ef973cf849d64736f6c63430008040033

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.