ETH Price: $2,841.51 (-3.31%)
 

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Purchase340908132025-08-12 3:56:13166 days ago1754970973IN
0x259212b9...02a8CB504
0 ETH0.000002970.00393955
Purchase340797122025-08-11 21:46:11167 days ago1754948771IN
0x259212b9...02a8CB504
0 ETH0.00001910.02527782
Purchase340612132025-08-11 11:29:33167 days ago1754911773IN
0x259212b9...02a8CB504
0 ETH0.000001520.00213869
Purchase340577982025-08-11 9:35:43167 days ago1754904943IN
0x259212b9...02a8CB504
0 ETH0.000002940.00532213
Purchase340527992025-08-11 6:49:05167 days ago1754894945IN
0x259212b9...02a8CB504
0 ETH0.000016620.0029464
Purchase339960772025-08-09 23:18:21169 days ago1754781501IN
0x259212b9...02a8CB504
0 ETH0.000007470.01044914
Purchase339647612025-08-09 5:54:29169 days ago1754718869IN
0x259212b9...02a8CB504
0 ETH0.000010520.01241513
Purchase339367482025-08-08 14:20:43170 days ago1754662843IN
0x259212b9...02a8CB504
0 ETH0.000022130.02073135
Purchase339314012025-08-08 11:22:29170 days ago1754652149IN
0x259212b9...02a8CB504
0 ETH0.000027940.00582911
Purchase339306282025-08-08 10:56:43170 days ago1754650603IN
0x259212b9...02a8CB504
0 ETH0.000014420.0256
Purchase339045012025-08-07 20:25:49171 days ago1754598349IN
0x259212b9...02a8CB504
0 ETH0.000011620.02179281
Purchase339018952025-08-07 18:58:57171 days ago1754593137IN
0x259212b9...02a8CB504
0 ETH0.000001670.00497109
Purchase339013082025-08-07 18:39:23171 days ago1754591963IN
0x259212b9...02a8CB504
0 ETH0.000001580.00494655
Purchase339011982025-08-07 18:35:43171 days ago1754591743IN
0x259212b9...02a8CB504
0 ETH0.000003350.00552501
Purchase339007642025-08-07 18:21:15171 days ago1754590875IN
0x259212b9...02a8CB504
0 ETH0.000005830.01745655
Purchase338916292025-08-07 13:16:45171 days ago1754572605IN
0x259212b9...02a8CB504
0 ETH0.00000210.00628144
Purchase338798202025-08-07 6:43:07171 days ago1754548987IN
0x259212b9...02a8CB504
0 ETH0.000004280.00658986
Purchase338779352025-08-07 5:40:17171 days ago1754545217IN
0x259212b9...02a8CB504
0 ETH0.000006320.00653906
Purchase338760162025-08-07 4:36:19171 days ago1754541379IN
0x259212b9...02a8CB504
0 ETH0.000006960.00491978
Purchase338758172025-08-07 4:29:41171 days ago1754540981IN
0x259212b9...02a8CB504
0 ETH0.000001810.00533584
Purchase338742622025-08-07 3:37:51172 days ago1754537871IN
0x259212b9...02a8CB504
0 ETH0.000003510.01034892
Purchase338738452025-08-07 3:23:57172 days ago1754537037IN
0x259212b9...02a8CB504
0 ETH0.000004820.00774473
Purchase338674092025-08-06 23:49:25172 days ago1754524165IN
0x259212b9...02a8CB504
0 ETH0.000044030.00474739
Purchase338642632025-08-06 22:04:33172 days ago1754517873IN
0x259212b9...02a8CB504
0 ETH0.000012990.00891792
Purchase338615362025-08-06 20:33:39172 days ago1754512419IN
0x259212b9...02a8CB504
0 ETH0.00000750.02042946
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ToshiRaffle

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol";
import "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../referral/Referrable.sol";

interface IUSDC {
    function isBlacklisted(address _account) external view returns (bool);
}

interface IUniswapV3Router {
    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    function exactInput(ExactInputParams calldata params) external returns (uint256 amountOut);
}

interface IMACRO {
    function getPriorTicketOwner(uint256 _ticketNum, uint256 _timestamp) external view returns (address);
    function nextTicketId() external view returns (uint256);
    function getNumDeadTicketIds() external view returns (uint256);
    function burnFeesAddress() external view returns (address);
    function balanceForUnits(uint256 units) external view returns (uint256);
}

/// @notice ToshiRaffle contract - Will choose winner and send winnings
contract ToshiRaffle is VRFV2PlusWrapperConsumerBase, Ownable, Referrable {
    /// STATE VAR ///

    /// @notice Raffle time
    uint256 public raffleTime;

    /// @notice Percent denom
    uint256 public constant PERCENT_DENOM = 1 ether;
    /// @notice Number of times to itterate through same seed
    uint256 public constant SEED_ITERATIONS = 10;
    /// @notice Team percent
    uint256 public immutable teamPercent;

    /// @notice Array of request ids
    uint256[] public requestIds;
    /// @notice Id of last request
    uint256 public lastRequestId;
    /// @notice Balance percent to be distirbuted for raffle
    uint256 public balancePercentForRaffle;
    /// @notice Max raffle
    uint256 public MAX_RAFFLE = 1_250_000_000;
    /// @notice Call back gas limit
    uint32 public constant callbackGasLimit = 2_000_000;
    /// @notice Confirmation needed
    uint16 public requestConfirmations = 15;
    /// @notice Number of random numbers to generate
    uint32 public numWords = 1;

    /// @notice Chainlink wrapper address
    address public wrapperAddress = 0xb0407dbe851f8318bd31404A49e658143C982F23;
    /// @notice Address USDC
    address public constant USDC = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913;
    /// @notice Addres of WETH
    address public constant WETH = 0x4200000000000000000000000000000000000006;
    /// @notice Address MACRO
    address public constant MACRO = 0x5F5668D7C748Fc1A17540C3a7f9245d8CeA10C29;
    /// @notice Address for team wallet
    address public teamWallet;
    /// @notice Treasury address
    address public immutable treasury = 0x5ab49fbAC60D8957939E3dB2A2d691629546697E;

    /// @notice Current raffle id
    uint256 public raffleId;
    /// @notice Units of MACRO to purchase one ticket
    uint256 public immutable unitsPerTicket;

    /// @notice Bool if awaiting for results
    bool public awaitingResult;

    /// @notice Raffle details for raffle id
    mapping(uint256 => Raffle) public raffles;
    /// @notice Fee And Referral details for raffle id
    mapping(uint256 => FeeAndReferral) public feeAndReferrals;
    /// @notice Request for request id
    mapping(uint256 => RequestStatus) public s_requests;

    /// @notice Owner of ticket id for raffle
    mapping(uint256 => mapping(uint256 => address)) public ownerForTicketForRaffleId;
    /// @notice Ticket purchase details for user for raffle
    mapping(uint256 => mapping(address => uint256[])) public userTicketPurchases;

    /// EVENTS ///

    event RequestSent(uint256 requestId, uint32 numWords);
    event RequestFulfilled(uint256 requestId, uint256[] randomWords, uint256 payment);

    event Settled(
        uint256 indexed raffleId, address indexed winner, uint256 indexed winningTicketId, uint256 amount, uint256 seed
    );

    event ReferralAndTeamFee(
        uint256 indexed raffleId,
        address indexed firstDegree,
        address indexed secondDegree,
        uint256 firstDegreeTake,
        uint256 secondDegreeTake,
        uint256 teamTake
    );

    event AttemptedSettle(uint256 indexed raffleId, uint256 seed);

    /// STRUCTS ///

    /// @notice Struct with raffle details
    struct Raffle {
        uint256 seed;
        uint256 ticketIds;
        uint256 deadTickets;
        uint256 ticketsSold;
        uint256 amount;
        uint256 startTime;
        uint256 endTime;
        uint256 winningTicket;
        address winner;
    }

    struct FeeAndReferral {
        address firstDegree;
        address secondDegree;
        uint256 firstDegreeTake;
        uint256 secondDegreeTake;
        uint256 teamTake;
    }

    /// @notice Struct with Request details
    struct RequestStatus {
        uint256 paid;
        bool fulfilled;
        uint256[] randomWords;
    }

    /// CONSTRUCTOR ///

    constructor() VRFV2PlusWrapperConsumerBase(wrapperAddress) Referrable(0x634b84cFF9CBd1c2621B80e1782F65EC4b70D2D1) {
        teamWallet = 0x6e5b13DE700536e3Bb96b00c833e9Fca9490AC08;
        balancePercentForRaffle = 0.9 ether;
        teamPercent = 0.2 ether;
        unitsPerTicket = 100 ether;
        raffleTime = 6 hours;
        IERC20(USDC).approve(v3Router, type(uint256).max);
    }

    /// PURCHASE TICKETS ///

    /// @notice Purchase `_amount` of tickets for `_startingRaffleId` for `_who`
    function purchase(
        uint256 _amount,
        uint256 _startingRaffleId,
        uint256 _numberOfRaffles,
        address _who,
        address _referral
    ) external {
        require(_startingRaffleId >= raffleId, "Can NOT start on previous raffle");
        require(_numberOfRaffles > 0, "Can NOT be 0 raffles");
        Raffle memory raffle = raffles[_startingRaffleId];

        if (_startingRaffleId == raffleId) {
            require(block.timestamp < raffle.endTime - 30 minutes, "Can NOT purchase for current raffle");
        }

        uint256 totalUnitsNeeded = unitsPerTicket * _amount * _numberOfRaffles;
        IERC20(MACRO).transferFrom(
            msg.sender, IMACRO(MACRO).burnFeesAddress(), IMACRO(MACRO).balanceForUnits(totalUnitsNeeded)
        );

        address referer = _setReferral(_who, _referral);
        uint256 _currentRaffleId = _startingRaffleId;
        for (uint256 x; x < _numberOfRaffles; x++) {
            uint256[] storage userTicket = userTicketPurchases[_currentRaffleId][_who];

            for (uint256 i; i < _amount; i++) {
                userTicket.push(raffle.ticketsSold);
                ownerForTicketForRaffleId[_currentRaffleId][raffle.ticketsSold] = _who;
                raffle.ticketsSold++;
            }

            if (referer != address(0)) {
                uint256 _refererTickets = _ticketsReferred(referer, _amount);

                if (_refererTickets > 0) {
                    uint256[] storage refererTicket = userTicketPurchases[_currentRaffleId][referer];

                    for (uint256 y; y < _refererTickets; y++) {
                        refererTicket.push(raffle.ticketsSold);
                        ownerForTicketForRaffleId[_currentRaffleId][raffle.ticketsSold] = referer;
                        raffle.ticketsSold++;
                    }
                }
            }

            raffles[_currentRaffleId] = raffle;
            _currentRaffleId++;
            raffle = raffles[_currentRaffleId];
        }
    }

    /// PUSH RAFFLE RESULTS ///

    /// @notice If can settle a raffle, settle
    function settleRaffle() external returns (uint256) {
        require(canSettleRaffle(), "Can NOT settle raffle");

        awaitingResult = true;
        bytes memory extraArgs = VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false}));
        uint256 requestId;
        uint256 reqPrice;

        (requestId, reqPrice) = requestRandomness(callbackGasLimit, requestConfirmations, numWords, extraArgs);

        s_requests[requestId] = RequestStatus({paid: reqPrice, randomWords: new uint256[](0), fulfilled: false});

        requestIds.push(requestId);
        lastRequestId = requestId;
        emit RequestSent(requestId, numWords);

        Raffle memory currentRaffle = raffles[raffleId];

        if (currentRaffle.ticketIds == 0) {
            if (raffleId + 1 < 28) {
                (uint256 _nextPot, uint256 _fee) = _swap();
                raffles[raffleId + 1].amount = _nextPot;
                feeAndReferrals[raffleId + 1].teamTake = _fee;
            }
            currentRaffle.ticketIds = IMACRO(MACRO).nextTicketId();
            currentRaffle.deadTickets = IMACRO(MACRO).getNumDeadTicketIds();
            raffles[raffleId] = currentRaffle;
        }

        return requestId;
    }

    /// INTERNAL CHAINLINK ///

    /// @notice Chainlink callback
    function fulfillRandomWords(uint256 _requestId, uint256[] memory _randomWords) internal override {
        s_requests[_requestId].fulfilled = true;
        s_requests[_requestId].randomWords = _randomWords;
        _pullSettle(_randomWords[0]);

        emit RequestFulfilled(_requestId, _randomWords, s_requests[_requestId].paid);
    }

    /// INTERNAL FUNCTIONS ///

    /// @notice Finalize settle - called in `fulfillRandomWords()`
    function _pullSettle(uint256 _seed) internal returns (bool _settled, address _winner, uint256 _winningTicket) {
        Raffle memory currentRaffle = raffles[raffleId];
        uint256 ticketId = _seed % (currentRaffle.ticketIds + currentRaffle.ticketsSold);

        for (uint256 i; i < SEED_ITERATIONS; i++) {
            if (ticketId < currentRaffle.ticketIds) {
                _winner = IMACRO(MACRO).getPriorTicketOwner(ticketId, currentRaffle.endTime);
            } else {
                _winner = ownerForTicketForRaffleId[raffleId][ticketId - currentRaffle.ticketIds];
            }

            if (_winner != address(0) && !IUSDC(USDC).isBlacklisted(_winner)) {
                _winningTicket = ticketId;
                break;
            }

            ticketId = uint256(keccak256(abi.encodePacked(_seed, ticketId)))
                % (currentRaffle.ticketIds + currentRaffle.ticketsSold);
        }

        awaitingResult = false;

        if (_winner == address(0)) {
            emit AttemptedSettle(raffleId, _seed);
            return (false, _winner, 0);
        }

        currentRaffle.winner = _winner;
        currentRaffle.winningTicket = _winningTicket;
        currentRaffle.seed = _seed;

        raffles[raffleId] = currentRaffle;

        uint256 toSend = currentRaffle.amount;
        if (toSend > 0) {
            IERC20(TOSHI).transfer(_winner, toSend);
        }

        FeeAndReferral memory feeAndReferral = feeAndReferrals[raffleId];
        if (feeAndReferral.teamTake > 0) {
            uint256 remainingFee = feeAndReferral.teamTake;

            feeAndReferral.firstDegree = IReferral(macroReferral).firstDegreeReferral(_winner);
            if (feeAndReferral.firstDegree != address(0) && !IUSDC(USDC).isBlacklisted(feeAndReferral.firstDegree)) {
                feeAndReferral.firstDegreeTake =
                    IReferral(macroReferral).firstDegreeReferrerTakeHome(feeAndReferral.firstDegree, toSend);
                remainingFee -= feeAndReferral.firstDegreeTake;
                IERC20(TOSHI).transfer(feeAndReferral.firstDegree, feeAndReferral.firstDegreeTake);
            }

            feeAndReferral.secondDegree = IReferral(macroReferral).secondDegreeReferral(_winner);
            if (feeAndReferral.secondDegree != address(0) && !IUSDC(USDC).isBlacklisted(feeAndReferral.secondDegree)) {
                feeAndReferral.secondDegreeTake =
                    IReferral(macroReferral).secondDegreeReferrerTakeHome(feeAndReferral.secondDegree, toSend);

                remainingFee -= feeAndReferral.secondDegreeTake;
                IERC20(TOSHI).transfer(feeAndReferral.secondDegree, feeAndReferral.secondDegreeTake);
            }

            feeAndReferral.teamTake = remainingFee;
            IERC20(TOSHI).transfer(teamWallet, remainingFee);
            feeAndReferrals[raffleId] = feeAndReferral;

            emit ReferralAndTeamFee(
                raffleId,
                feeAndReferral.firstDegree,
                feeAndReferral.secondDegree,
                feeAndReferral.firstDegreeTake,
                feeAndReferral.secondDegreeTake,
                feeAndReferral.teamTake
            );
        }

        raffleId++;

        if (raffleId == 28) {
            finished = true;
            emit Settled(raffleId - 1, _winner, _winningTicket, toSend, _seed);
            return (true, _winner, _winningTicket);
        }

        Raffle memory previousRaffle = raffles[raffleId - 1];
        Raffle memory nextRaffle = raffles[raffleId];

        nextRaffle.startTime = previousRaffle.endTime;
        nextRaffle.endTime = nextRaffle.startTime + raffleTime;

        raffles[raffleId] = nextRaffle;

        emit Settled(raffleId - 1, _winner, _winningTicket, toSend, _seed);
        return (true, _winner, _winningTicket);
    }

    /// OWNER ///

    /// @notice Set raffle time
    function setRaffleTime(uint256 _newTime) external onlyOwner {
        raffleTime = _newTime;
    }

    /// @notice Set balance percent for the reffle
    function setBalancePercentForRaffle(uint256 _percent) external onlyOwner {
        require(_percent >= 0.5 ether, "Can NOT be less than 50%");
        require(_percent <= PERCENT_DENOM, "Can NOT be greater than 100%");

        balancePercentForRaffle = _percent;
    }

    /// @notice Set team wallet
    function setTeamWallet(address _teamWallet) external onlyOwner {
        require(_teamWallet != address(0), "Zero address");
        teamWallet = _teamWallet;
    }

    /// @notice Withdraw stuck token from contract
    function withdrawStuckToken(address _token, address _to, uint256 _amount) external onlyOwner {
        require(_token != address(0), "_token address cannot be 0");
        IERC20(_token).transfer(_to, _amount);
    }

    /// VIEW FUNCTIONS ///

    /// @notice Returns if can settle raffle
    function canSettleRaffle() public view returns (bool) {
        if (!started || finished) return false;
        Raffle memory currentRaffle = raffles[raffleId];
        if (block.timestamp >= currentRaffle.endTime && !awaitingResult) return true;
        return false;
    }

    /// @notice Returns current pot for period
    function potForPeriod() public view returns (uint256 pot, uint256 fee) {
        fee = feeAndReferrals[raffleId].teamTake;
        pot = raffles[raffleId].amount;
    }

    /// @notice Returns request status for request id
    function getRequestStatus(uint256 _requestId)
        external
        view
        returns (uint256 paid, bool fulfilled, uint256[] memory randomWords)
    {
        require(s_requests[_requestId].paid > 0, "request not found");
        RequestStatus memory request = s_requests[_requestId];
        return (request.paid, request.fulfilled, request.randomWords);
    }

    /// @notice Return total entries for `_raffleId`
    function getTotalEntries(uint256 _raffleId) external view returns (uint256) {
        Raffle memory raffle = raffles[_raffleId];
        if (_raffleId >= raffleId) {
            return (raffle.ticketsSold + IMACRO(MACRO).nextTicketId() - IMACRO(MACRO).getNumDeadTicketIds());
        }

        return (raffle.ticketsSold + raffle.ticketIds - raffle.deadTickets);
    }

    /// @notice Get the purhcased Id for `_who` for `_raffleId`
    /// @notice userTicketPurchases[i] + raffle.ticketIds == ticketId AFTER SETTLE
    /// @notice The Purchase Id is the ID OF THE PURCHASE OF TICKET, NOT the id of ticket itself
    function getUserPurchaseIds(address _who, uint256 _raffleId) external view returns (uint256[] memory _ids) {
        return userTicketPurchases[_raffleId][_who];
    }

    /// @notice Get num user purchse ids of `_who` for `_raffleId`
    function getNumUserPurchaseIds(address _who, uint256 _raffleId) external view returns (uint256) {
        return userTicketPurchases[_raffleId][_who].length;
    }

    /// COMMUNITY RAFFLE ///

    address public constant v3Router = 0x2626664c2603336E57B271c5C0b26F421741e481;
    address public constant TOSHI = 0xAC1Bd2486aAf3B5C0fc3Fd868558b082a531B2B4;
    bool public started;
    bool public finished;

    uint24 constant WETHTOSHIFee = 10000;
    uint24 constant USDCWETHFee = 500;

    /// @notice Begin raffle
    function beginRaffle(uint256 _endTime) external onlyOwner {
        require(!started);
        require(_endTime > block.timestamp + 6 hours);

        Raffle memory currentRaffle;
        currentRaffle.startTime = block.timestamp;
        currentRaffle.endTime = _endTime;

        (uint256 _nextPot, uint256 _fee) = _swap();
        currentRaffle.amount = _nextPot;
        feeAndReferrals[raffleId].teamTake = _fee;

        raffles[0] = currentRaffle;

        started = true;
    }

    /// @notice Get current swap amount
    function _swapAmount() internal view returns (uint256 _amount) {
        uint256 totalBalance = IERC20(USDC).balanceOf(address(this));
        _amount = (totalBalance * balancePercentForRaffle) / PERCENT_DENOM;

        if (_amount > MAX_RAFFLE) {
            _amount = MAX_RAFFLE;
        }
    }
    
    /// @notice Internal swap to TOSHI
    function _swap() internal returns (uint256 _pot, uint256 _fee) {
        uint256 _balanceBefore = IERC20(TOSHI).balanceOf(address(this));
        IUniswapV3Router.ExactInputParams memory params = IUniswapV3Router.ExactInputParams({
            path: abi.encodePacked(USDC, USDCWETHFee, WETH, WETHTOSHIFee, TOSHI),
            recipient: address(this),
            amountIn: _swapAmount(),
            amountOutMinimum: 0
        });

        IUniswapV3Router(v3Router).exactInput(params);
        uint256 totalPotForCurrent = IERC20(TOSHI).balanceOf(address(this)) - _balanceBefore;

        _fee = totalPotForCurrent * teamPercent / PERCENT_DENOM;
        _pot = totalPotForCurrent - _fee;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// solhint-disable-next-line interface-starts-with-i
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);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IVRFV2PlusWrapper {
  /**
   * @return the request ID of the most recent VRF V2 request made by this wrapper. This should only
   * be relied option within the same transaction that the request was made.
   */
  function lastRequestId() external view returns (uint256);

  /**
   * @notice Calculates the price of a VRF request with the given callbackGasLimit at the current
   * @notice block.
   *
   * @dev This function relies on the transaction gas price which is not automatically set during
   * @dev simulation. To estimate the price at a specific gas price, use the estimatePrice function.
   *
   * @param _callbackGasLimit is the gas limit used to estimate the price.
   * @param _numWords is the number of words to request.
   */
  function calculateRequestPrice(uint32 _callbackGasLimit, uint32 _numWords) external view returns (uint256);

  /**
   * @notice Calculates the price of a VRF request in native with the given callbackGasLimit at the current
   * @notice block.
   *
   * @dev This function relies on the transaction gas price which is not automatically set during
   * @dev simulation. To estimate the price at a specific gas price, use the estimatePrice function.
   *
   * @param _callbackGasLimit is the gas limit used to estimate the price.
   * @param _numWords is the number of words to request.
   */
  function calculateRequestPriceNative(uint32 _callbackGasLimit, uint32 _numWords) external view returns (uint256);

  /**
   * @notice Estimates the price of a VRF request with a specific gas limit and gas price.
   *
   * @dev This is a convenience function that can be called in simulation to better understand
   * @dev pricing.
   *
   * @param _callbackGasLimit is the gas limit used to estimate the price.
   * @param _numWords is the number of words to request.
   * @param _requestGasPriceWei is the gas price in wei used for the estimation.
   */
  function estimateRequestPrice(
    uint32 _callbackGasLimit,
    uint32 _numWords,
    uint256 _requestGasPriceWei
  ) external view returns (uint256);

  /**
   * @notice Estimates the price of a VRF request in native with a specific gas limit and gas price.
   *
   * @dev This is a convenience function that can be called in simulation to better understand
   * @dev pricing.
   *
   * @param _callbackGasLimit is the gas limit used to estimate the price.
   * @param _numWords is the number of words to request.
   * @param _requestGasPriceWei is the gas price in wei used for the estimation.
   */
  function estimateRequestPriceNative(
    uint32 _callbackGasLimit,
    uint32 _numWords,
    uint256 _requestGasPriceWei
  ) external view returns (uint256);

  /**
   * @notice Requests randomness from the VRF V2 wrapper, paying in native token.
   *
   * @param _callbackGasLimit is the gas limit for the request.
   * @param _requestConfirmations number of request confirmations to wait before serving a request.
   * @param _numWords is the number of words to request.
   */
  function requestRandomWordsInNative(
    uint32 _callbackGasLimit,
    uint16 _requestConfirmations,
    uint32 _numWords,
    bytes calldata extraArgs
  ) external payable returns (uint256 requestId);

  function link() external view returns (address);
  function linkNativeFeed() external view returns (address);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

// End consumer library.
library VRFV2PlusClient {
  // extraArgs will evolve to support new features
  bytes4 public constant EXTRA_ARGS_V1_TAG = bytes4(keccak256("VRF ExtraArgsV1"));
  struct ExtraArgsV1 {
    bool nativePayment;
  }

  struct RandomWordsRequest {
    bytes32 keyHash;
    uint256 subId;
    uint16 requestConfirmations;
    uint32 callbackGasLimit;
    uint32 numWords;
    bytes extraArgs;
  }

  function _argsToBytes(ExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) {
    return abi.encodeWithSelector(EXTRA_ARGS_V1_TAG, extraArgs);
  }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol";
import {IVRFV2PlusWrapper} from "./interfaces/IVRFV2PlusWrapper.sol";

/**
 *
 * @notice Interface for contracts using VRF randomness through the VRF V2 wrapper
 * ********************************************************************************
 * @dev PURPOSE
 *
 * @dev Create VRF V2+ requests without the need for subscription management. Rather than creating
 * @dev and funding a VRF V2+ subscription, a user can use this wrapper to create one off requests,
 * @dev paying up front rather than at fulfillment.
 *
 * @dev Since the price is determined using the gas price of the request transaction rather than
 * @dev the fulfillment transaction, the wrapper charges an additional premium on callback gas
 * @dev usage, in addition to some extra overhead costs associated with the VRFV2Wrapper contract.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFV2PlusWrapperConsumerBase. The consumer must be funded
 * @dev with enough LINK or ether to make the request, otherwise requests will revert. To request randomness,
 * @dev call the 'requestRandomWords' function with the desired VRF parameters. This function handles
 * @dev paying for the request based on the current pricing.
 *
 * @dev Consumers must implement the fullfillRandomWords function, which will be called during
 * @dev fulfillment with the randomness result.
 */
abstract contract VRFV2PlusWrapperConsumerBase {
  error OnlyVRFWrapperCanFulfill(address have, address want);

  LinkTokenInterface internal immutable i_linkToken;
  IVRFV2PlusWrapper public immutable i_vrfV2PlusWrapper;

  /**
   * @param _vrfV2PlusWrapper is the address of the VRFV2Wrapper contract
   */
  constructor(address _vrfV2PlusWrapper) {
    IVRFV2PlusWrapper vrfV2PlusWrapper = IVRFV2PlusWrapper(_vrfV2PlusWrapper);

    i_linkToken = LinkTokenInterface(vrfV2PlusWrapper.link());
    i_vrfV2PlusWrapper = vrfV2PlusWrapper;
  }

  /**
   * @dev Requests randomness from the VRF V2+ wrapper.
   *
   * @param _callbackGasLimit is the gas limit that should be used when calling the consumer's
   *        fulfillRandomWords function.
   * @param _requestConfirmations is the number of confirmations to wait before fulfilling the
   *        request. A higher number of confirmations increases security by reducing the likelihood
   *        that a chain re-org changes a published randomness outcome.
   * @param _numWords is the number of random words to request.
   *
   * @return requestId is the VRF V2+ request ID of the newly created randomness request.
   */
  // solhint-disable-next-line chainlink-solidity/prefix-internal-functions-with-underscore
  function requestRandomness(
    uint32 _callbackGasLimit,
    uint16 _requestConfirmations,
    uint32 _numWords,
    bytes memory extraArgs
  ) internal returns (uint256 requestId, uint256 reqPrice) {
    reqPrice = i_vrfV2PlusWrapper.calculateRequestPrice(_callbackGasLimit, _numWords);
    i_linkToken.transferAndCall(
      address(i_vrfV2PlusWrapper),
      reqPrice,
      abi.encode(_callbackGasLimit, _requestConfirmations, _numWords, extraArgs)
    );
    return (i_vrfV2PlusWrapper.lastRequestId(), reqPrice);
  }

  // solhint-disable-next-line chainlink-solidity/prefix-internal-functions-with-underscore
  function requestRandomnessPayInNative(
    uint32 _callbackGasLimit,
    uint16 _requestConfirmations,
    uint32 _numWords,
    bytes memory extraArgs
  ) internal returns (uint256 requestId, uint256 requestPrice) {
    requestPrice = i_vrfV2PlusWrapper.calculateRequestPriceNative(_callbackGasLimit, _numWords);
    return (
      i_vrfV2PlusWrapper.requestRandomWordsInNative{value: requestPrice}(
        _callbackGasLimit,
        _requestConfirmations,
        _numWords,
        extraArgs
      ),
      requestPrice
    );
  }

  /**
   * @notice fulfillRandomWords handles the VRF V2 wrapper response. The consuming contract must
   * @notice implement it.
   *
   * @param _requestId is the VRF V2 request ID.
   * @param _randomWords is the randomness result.
   */
  // solhint-disable-next-line chainlink-solidity/prefix-internal-functions-with-underscore
  function fulfillRandomWords(uint256 _requestId, uint256[] memory _randomWords) internal virtual;

  function rawFulfillRandomWords(uint256 _requestId, uint256[] memory _randomWords) external {
    address vrfWrapperAddr = address(i_vrfV2PlusWrapper);
    if (msg.sender != vrfWrapperAddr) {
      revert OnlyVRFWrapperCanFulfill(msg.sender, vrfWrapperAddr);
    }
    fulfillRandomWords(_requestId, _randomWords);
  }

  /// @notice getBalance returns the native balance of the consumer contract
  function getBalance() public view returns (uint256) {
    return address(this).balance;
  }

  /// @notice getLinkToken returns the link token contract
  function getLinkToken() public view returns (LinkTokenInterface) {
    return i_linkToken;
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

pragma solidity ^0.8.0;

interface IReferral {
    function canBeReferred(address _who) external view returns (bool);
    function setReferral(address _beingReferred, address _referer) external;
    function firstDegreeReferral(address _who) external view returns (address);
    function secondDegreeReferral(address _who) external view returns (address);
    function firstDegreeReferrerTakeHome(address _who, uint256 _raffleAmount)
        external
        view
        returns (uint256 _takeHomeAmount);
    function secondDegreeReferrerTakeHome(address _who, uint256 _raffleAmount)
        external
        view
        returns (uint256 _takeHomeAmount);
}

abstract contract Referrable {
    /// STATE VAR ///

    uint256 public constant TICKETS_REFERRED_FOR_TICKET = 10;

    /// @notice Macro Referral address
    address public immutable macroReferral;

    mapping(address referer => uint256 ticketsReferred) public ticketsReferredForReferer;
    mapping(address referer => uint256 ticketsReceived) public ticketsReceivedForReferral;

    event TicketsReferred(address indexed referer, address indexed referred, uint256 ticketsPurchased);

    /// CONSTRUCTOR ///

    constructor (address _macroReferral) {
        macroReferral = _macroReferral;
    }

    /// INTERNAL ///

    /// @notice Return proper referer address for msg.sender and set referral if needed
    function _setReferral(address _who, address _referral) internal returns (address referer) {
        if(_who == msg.sender) {
            referer = IReferral(macroReferral).firstDegreeReferral(msg.sender);
            if (IReferral(macroReferral).canBeReferred(msg.sender) && _referral != address(0)) {
                IReferral(macroReferral).setReferral(msg.sender, _referral);
                referer = _referral;
            }
        } else {
            referer = IReferral(macroReferral).firstDegreeReferral(_who);
        }
    }

    /// @notice Internal tickets referred
    function _ticketsReferred(address _referer, uint256 _amount) internal returns (uint256 _ticketsToReceive) {
        ticketsReferredForReferer[_referer] += _amount;

        _ticketsToReceive =
            (ticketsReferredForReferer[_referer] / TICKETS_REFERRED_FOR_TICKET) - ticketsReceivedForReferral[_referer];

        ticketsReceivedForReferral[_referer] += _ticketsToReceive;

        emit TicketsReferred(_referer, msg.sender, _amount);
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyVRFWrapperCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seed","type":"uint256"}],"name":"AttemptedSettle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"firstDegree","type":"address"},{"indexed":true,"internalType":"address","name":"secondDegree","type":"address"},{"indexed":false,"internalType":"uint256","name":"firstDegreeTake","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"secondDegreeTake","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"teamTake","type":"uint256"}],"name":"ReferralAndTeamFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"randomWords","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"payment","type":"uint256"}],"name":"RequestFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"numWords","type":"uint32"}],"name":"RequestSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raffleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"winner","type":"address"},{"indexed":true,"internalType":"uint256","name":"winningTicketId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seed","type":"uint256"}],"name":"Settled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"referer","type":"address"},{"indexed":true,"internalType":"address","name":"referred","type":"address"},{"indexed":false,"internalType":"uint256","name":"ticketsPurchased","type":"uint256"}],"name":"TicketsReferred","type":"event"},{"inputs":[],"name":"MACRO","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_RAFFLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_DENOM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEED_ITERATIONS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TICKETS_REFERRED_FOR_TICKET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOSHI","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"awaitingResult","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balancePercentForRaffle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_endTime","type":"uint256"}],"name":"beginRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"callbackGasLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canSettleRaffle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"feeAndReferrals","outputs":[{"internalType":"address","name":"firstDegree","type":"address"},{"internalType":"address","name":"secondDegree","type":"address"},{"internalType":"uint256","name":"firstDegreeTake","type":"uint256"},{"internalType":"uint256","name":"secondDegreeTake","type":"uint256"},{"internalType":"uint256","name":"teamTake","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finished","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkToken","outputs":[{"internalType":"contract LinkTokenInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_who","type":"address"},{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"getNumUserPurchaseIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"getRequestStatus","outputs":[{"internalType":"uint256","name":"paid","type":"uint256"},{"internalType":"bool","name":"fulfilled","type":"bool"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"getTotalEntries","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_who","type":"address"},{"internalType":"uint256","name":"_raffleId","type":"uint256"}],"name":"getUserPurchaseIds","outputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"i_vrfV2PlusWrapper","outputs":[{"internalType":"contract IVRFV2PlusWrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"macroReferral","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numWords","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownerForTicketForRaffleId","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"potForPeriod","outputs":[{"internalType":"uint256","name":"pot","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_startingRaffleId","type":"uint256"},{"internalType":"uint256","name":"_numberOfRaffles","type":"uint256"},{"internalType":"address","name":"_who","type":"address"},{"internalType":"address","name":"_referral","type":"address"}],"name":"purchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"raffleId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"raffleTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"raffles","outputs":[{"internalType":"uint256","name":"seed","type":"uint256"},{"internalType":"uint256","name":"ticketIds","type":"uint256"},{"internalType":"uint256","name":"deadTickets","type":"uint256"},{"internalType":"uint256","name":"ticketsSold","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"winningTicket","type":"uint256"},{"internalType":"address","name":"winner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256[]","name":"_randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestConfirmations","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"s_requests","outputs":[{"internalType":"uint256","name":"paid","type":"uint256"},{"internalType":"bool","name":"fulfilled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"setBalancePercentForRaffle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTime","type":"uint256"}],"name":"setRaffleTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_teamWallet","type":"address"}],"name":"setTeamWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleRaffle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"started","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"referer","type":"address"}],"name":"ticketsReceivedForReferral","outputs":[{"internalType":"uint256","name":"ticketsReceived","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"referer","type":"address"}],"name":"ticketsReferredForReferer","outputs":[{"internalType":"uint256","name":"ticketsReferred","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unitsPerTicket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userTicketPurchases","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v3Router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawStuckToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrapperAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

610140604052634a817c80600755600880546001600160d01b03191679b0407dbe851f8318bd31404a49e658143c982f2300000001000f179055735ab49fbac60d8957939e3db2a2d691629546697e6101005234801561005e57600080fd5b5073634b84cff9cbd1c2621b80e1782f65ec4b70d2d1600860069054906101000a90046001600160a01b03166000819050806001600160a01b0316631c4695f46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f19190610252565b6001600160a01b039081166080521660a0525061010d33610202565b6001600160a01b031660c052600980546001600160a01b031916736e5b13de700536e3bb96b00c833e9fca9490ac08179055670c7d713b49da00006006556702c68af0bb14000060e05268056bc75e2d631000006101205261546060035560405163095ea7b360e01b8152732626664c2603336e57b271c5c0b26f421741e4816004820152600019602482015273833589fcd6edb6e08f4c7c32d4f71b54bda029139063095ea7b3906044016020604051808303816000875af11580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190610282565b506102a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561026457600080fd5b81516001600160a01b038116811461027b57600080fd5b9392505050565b60006020828403121561029457600080fd5b8151801515811461027b57600080fd5b60805160a05160c05160e0516101005161012051613c1361035c600039600081816108a70152610f78015260006105cc0152600081816108ce015261251b0152600081816103fa01528181611f4001528181611fe4015281816120ae0152818161213201528181612cb301528181612dfa01528181612f40015261309101526000818161077f015281816109f901528181612646015281816126e4015261278e0152600081816108f201526126b50152613c136000f3fe608060405234801561001057600080fd5b50600436106103575760003560e01c80638796ba8c116101c8578063b4de4cc511610104578063d8a4676f116100a2578063e76d51681161007c578063e76d5168146108f0578063f2fde38b14610916578063fa89800514610929578063fc2a88c31461096957600080fd5b8063d8a4676f14610880578063de5dc4ca146108a2578063e164ac50146108c957600080fd5b8063bda844c1116100de578063bda844c114610853578063bef4876b14610866578063c2dc3e5214610878578063c2f6feb41461061e57600080fd5b8063b4de4cc514610825578063b6e21c7114610838578063b70632b61461084b57600080fd5b806395a5a8f711610171578063a168fa891161014b578063a168fa89146107a1578063ad5c4648146107e0578063b0fb162f146107fb578063b375603c1461081c57600080fd5b806395a5a8f7146106f557806396974951146106fe5780639ed0868d1461077a57600080fd5b80638f6ec6e7116101a25780638f6ec6e7146106be57806392a91789146106d957806392d4e570146106ec57600080fd5b80638796ba8c1461067f57806389a30271146106925780638da5cb5b146106ad57600080fd5b80635992704411610297578063715018a6116102405780637ccfd7fc1161021a5780637ccfd7fc146106265780637df8b8021461063c5780637f41887014610659578063865999511461066c57600080fd5b8063715018a61461060957806375f7d8ce1461061157806378066a461461061e57600080fd5b80635d4bc0ce116102715780635d4bc0ce1461051857806361d027b3146105c75780636b9bdb80146105ee57600080fd5b806359927044146104d25780635a524a1c146104e55780635a82f06b146104f857600080fd5b80631b7eb59a116103045780631fe543e3116102de5780631fe543e31461046d57806324f74697146104805780634fbcf3271461049f578063542e6669146104b257600080fd5b80631b7eb59a146103f55780631cc15ea01461041c5780631f2698ab1461045057600080fd5b806312065fe01161033557806312065fe0146103ba5780631525ff7d146103c057806316c73381146103d557600080fd5b80630452096b1461035c5780630dc913061461037e5780630ebe7d11146103b1575b600080fd5b61036b670de0b6b3a764000081565b6040519081526020015b60405180910390f35b610399732626664c2603336e57b271c5c0b26f421741e48181565b6040516001600160a01b039091168152602001610375565b61036b60075481565b4761036b565b6103d36103ce3660046136f6565b610972565b005b61036b6103e33660046136f6565b60026020526000908152604090205481565b6103997f000000000000000000000000000000000000000000000000000000000000000081565b61039961042a366004613713565b600f6020908152600092835260408084209091529082529020546001600160a01b031681565b60115461045d9060ff1681565b6040519015158152602001610375565b6103d361047b36600461374b565b6109f7565b61048a621e848081565b60405163ffffffff9091168152602001610375565b61036b6104ad366004613824565b610a7a565b6104c56104c0366004613824565b610aa4565b604051610375919061388c565b600954610399906001600160a01b031681565b6103d36104f336600461389f565b610b18565b61036b6105063660046136f6565b60016020526000908152604090205481565b61057a61052636600461389f565b600c602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460078801546008909801549697959694959394929391929091906001600160a01b031689565b60408051998a5260208a0198909852968801959095526060870193909352608086019190915260a085015260c084015260e08301526001600160a01b031661010082015261012001610375565b6103997f000000000000000000000000000000000000000000000000000000000000000081565b61039973ac1bd2486aaf3b5c0fc3fd868558b082a531b2b481565b6103d3610bd5565b600b5461045d9060ff1681565b61036b600a81565b60085461048a9062010000900463ffffffff1681565b60085461039990660100000000000090046001600160a01b031681565b61036b61066736600461389f565b610be9565b6103d361067a36600461389f565b610d92565b61036b61068d36600461389f565b610d9f565b61039973833589fcd6edb6e08f4c7c32d4f71b54bda0291381565b6000546001600160a01b0316610399565b610399735f5668d7c748fc1a17540c3a7f9245d8cea10c2981565b6103d36106e73660046138b8565b610dc0565b61036b60035481565b61036b60065481565b61074761070c36600461389f565b600d60205260009081526040902080546001820154600283015460038401546004909401546001600160a01b03938416949390921692909185565b604080516001600160a01b039687168152959094166020860152928401919091526060830152608082015260a001610375565b6103997f000000000000000000000000000000000000000000000000000000000000000081565b6107cb6107af36600461389f565b600e602052600090815260409020805460019091015460ff1682565b60408051928352901515602083015201610375565b61039973420000000000000000000000000000000000000681565b6008546108099061ffff1681565b60405161ffff9091168152602001610375565b61036b600a5481565b6103d361083336600461389f565b6113eb565b61036b61084636600461390e565b611635565b61036b611673565b6103d3610861366004613946565b611a8e565b60115461045d90610100900460ff1681565b61045d611b65565b61089361088e36600461389f565b611c37565b60405161037593929190613976565b61036b7f000000000000000000000000000000000000000000000000000000000000000081565b61036b7f000000000000000000000000000000000000000000000000000000000000000081565b7f0000000000000000000000000000000000000000000000000000000000000000610399565b6103d36109243660046136f6565b611d35565b610954600a546000908152600d60209081526040808320600490810154600c90935292209091015491565b60408051928352602083019190915201610375565b61036b60055481565b61097a611dc5565b6001600160a01b0381166109d55760405162461bcd60e51b815260206004820152600c60248201527f5a65726f2061646472657373000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b7f0000000000000000000000000000000000000000000000000000000000000000336001600160a01b03821614610a6b576040517f8ba9316e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044016109cc565b610a758383611e1f565b505050565b60008181526010602090815260408083206001600160a01b03861684529091529020545b92915050565b60008181526010602090815260408083206001600160a01b0386168452825291829020805483518184028101840190945280845260609392830182828015610b0b57602002820191906000526020600020905b815481526020019060010190808311610af7575b5050505050905092915050565b610b20611dc5565b6706f05b59d3b20000811015610b785760405162461bcd60e51b815260206004820152601860248201527f43616e204e4f54206265206c657373207468616e20353025000000000000000060448201526064016109cc565b670de0b6b3a7640000811115610bd05760405162461bcd60e51b815260206004820152601c60248201527f43616e204e4f542062652067726561746572207468616e20313030250000000060448201526064016109cc565b600655565b610bdd611dc5565b610be76000611ec9565b565b6000818152600c60209081526040808320815161012081018352815481526001820154938101939093526002810154918301919091526003810154606083015260048101546080830152600581015460a0830152600681015460c0830152600781015460e0830152600801546001600160a01b0316610100820152600a548310610d7957735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b031663803d9b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce391906139a0565b735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b0316636031a52f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5991906139a0565b8260600151610d6891906139cf565b610d7291906139e2565b9392505050565b806040015181602001518260600151610d6891906139cf565b610d9a611dc5565b600355565b60048181548110610daf57600080fd5b600091825260209091200154905081565b600a54841015610e125760405162461bcd60e51b815260206004820181905260248201527f43616e204e4f54207374617274206f6e2070726576696f757320726166666c6560448201526064016109cc565b60008311610e625760405162461bcd60e51b815260206004820152601460248201527f43616e204e4f54206265203020726166666c657300000000000000000000000060448201526064016109cc565b6000848152600c6020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e08201526008909101546001600160a01b0316610100820152600a548503610f6f576107088160c00151610efb91906139e2565b4210610f6f5760405162461bcd60e51b815260206004820152602360248201527f43616e204e4f5420707572636861736520666f722063757272656e742072616660448201527f666c65000000000000000000000000000000000000000000000000000000000060648201526084016109cc565b600084610f9c887f00000000000000000000000000000000000000000000000000000000000000006139f5565b610fa691906139f5565b9050735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b03166323b872dd33735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b031663d1a972666040518163ffffffff1660e01b8152600401602060405180830381865afa15801561101e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110429190613a0c565b6040517f2e6cb9f900000000000000000000000000000000000000000000000000000000815260048101869052735f5668d7c748fc1a17540c3a7f9245d8cea10c2990632e6cb9f990602401602060405180830381865afa1580156110ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cf91906139a0565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561113b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115f9190613a29565b50600061116c8585611f19565b90508660005b878110156113df5760008281526010602090815260408083206001600160a01b038b1684529091528120905b8b81101561120a5760608701805183546001810185556000858152602080822090920192909255868252600f8152604080832084518452909152902080546001600160a01b0319166001600160a01b038c161790558051906111ff82613a4b565b90525060010161119e565b506001600160a01b038416156112c3576000611226858d61219d565b905080156112c15760008481526010602090815260408083206001600160a01b03891684529091528120905b828110156112be5760608901805183546001810185556000858152602080822090920192909255888252600f8152604080832084518452909152902080546001600160a01b0319166001600160a01b038a161790558051906112b382613a4b565b905250600101611252565b50505b505b6000838152600c602090815260409182902088518155908801516001820155908701516002820155606087015160038201556080870151600482015560a0870151600582015560c0870151600682015560e08701516007820155610100870151600890910180546001600160a01b0319166001600160a01b039092169190911790558261134f81613a4b565b6000818152600c602090815260409182902082516101208101845281548152600180830154938201939093526002820154938101939093526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e0840152600801546001600160a01b03166101008301529098509094509290920191506111729050565b50505050505050505050565b6113f3611dc5565b60115460ff161561140357600080fd5b61140f426154606139cf565b811161141a57600080fd5b611472604051806101200160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b4260a082015260c0810182905260008061148a61227f565b60808501918252600a546000908152600d6020908152604080832060040193909355908052600c815285517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8558501517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e9558401517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ea5560608401517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116eb55517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ec55505060a08101517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ed5560c08101517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ee5560e08101517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ef5561010001517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116f080546001600160a01b0319166001600160a01b03909216919091179055506011805460ff19166001179055565b6010602052826000526040600020602052816000526040600020818154811061165d57600080fd5b9060005260206000200160009250925050505481565b600061167d611b65565b6116c95760405162461bcd60e51b815260206004820152601560248201527f43616e204e4f5420736574746c6520726166666c65000000000000000000000060448201526064016109cc565b600b805460ff1916600117905560408051602081019091526000808252906116f09061255f565b600854909150600090819061171c90621e84809061ffff81169062010000900463ffffffff16866125fd565b604080516060810182528281526000602080830182815284518381528083018652848601908152878452600e83529490922083518155915160018301805460ff1916911515919091179055925180519597509395509093909261178692600285019291019061368a565b5050600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01839055506005829055600854604080518481526201000090920463ffffffff1660208301527fcc58b13ad3eab50626c6a6300b1d139cd6ebb1688a7cced9461c2f7e762665ee910160405180910390a1600a546000908152600c602090815260408083208151610120810183528154815260018201549381018490526002820154928101929092526003810154606083015260048101546080830152600581015460a0830152600681015460c0830152600781015460e0830152600801546001600160a01b03166101008201529103611a8557601c600a54600161189e91906139cf565b1015611907576000806118af61227f565b9150915081600c6000600a5460016118c791906139cf565b81526020019081526020016000206004018190555080600d6000600a5460016118f091906139cf565b815260208101919091526040016000206004015550505b735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b0316636031a52f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197d91906139a0565b816020018181525050735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b031663803d9b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fc91906139a0565b6040828101918252600a546000908152600c60209081529190208351815590830151600182015590516002820155606082015160038201556080820151600482015560a0820151600582015560c0820151600682015560e08201516007820155610100820151600890910180546001600160a01b0319166001600160a01b039092169190911790555b50909392505050565b611a96611dc5565b6001600160a01b038316611aec5760405162461bcd60e51b815260206004820152601a60248201527f5f746f6b656e20616464726573732063616e6e6f74206265203000000000000060448201526064016109cc565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611b3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5f9190613a29565b50505050565b60115460009060ff161580611b815750601154610100900460ff165b15611b8c5750600090565b600a546000908152600c6020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c08201819052600783015460e08301526008909201546001600160a01b0316610100820152904210801590611c225750600b5460ff16155b15611c2f57600191505090565b600091505090565b6000818152600e60205260408120548190606090611c975760405162461bcd60e51b815260206004820152601160248201527f72657175657374206e6f7420666f756e6400000000000000000000000000000060448201526064016109cc565b6000848152600e60209081526040808320815160608101835281548152600182015460ff16151581850152600282018054845181870281018701865281815292959394860193830182828015611d0c57602002820191906000526020600020905b815481526020019060010190808311611cf8575b5050505050815250509050806000015181602001518260400151935093509350505b9193909250565b611d3d611dc5565b6001600160a01b038116611db95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016109cc565b611dc281611ec9565b50565b6000546001600160a01b03163314610be75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109cc565b6000828152600e602090815260409091206001818101805460ff191690911790558251611e549260029092019184019061368a565b50611e7881600081518110611e6b57611e6b613a64565b6020026020010151612819565b5050506000828152600e6020526040908190205490517f147eb1ff0c82f87f2b03e2c43f5a36488ff63ec6b730195fde4605f612f8db5191611ebd9185918591613a7a565b60405180910390a15050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000336001600160a01b0384160361211357604051637ba1395b60e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f74272b690602401602060405180830381865afa158015611f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb39190613a0c565b6040517fd7da7fca0000000000000000000000000000000000000000000000000000000081523360048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d7da7fca90602401602060405180830381865afa158015612033573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120579190613a29565b801561206b57506001600160a01b03821615155b1561210e576040517f7543e3f00000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0383811660248301527f00000000000000000000000000000000000000000000000000000000000000001690637543e3f090604401600060405180830381600087803b1580156120f257600080fd5b505af1158015612106573d6000803e3d6000fd5b505050508190505b610a9e565b604051637ba1395b60e11b81526001600160a01b0384811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063f74272b690602401602060405180830381865afa158015612179573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d729190613a0c565b6001600160a01b0382166000908152600160205260408120805483919083906121c79084906139cf565b90915550506001600160a01b0383166000908152600260209081526040808320546001909252909120546121fd90600a90613ab9565b61220791906139e2565b6001600160a01b0384166000908152600260205260408120805492935083929091906122349084906139cf565b909155505060405182815233906001600160a01b038516907fe111b0f7c004e38aa34ef1506f9d5077b975b91a5da7e645fd5de747c47848d59060200160405180910390a392915050565b6040516370a0823160e01b81523060048201526000908190819073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b4906370a0823190602401602060405180830381865afa1580156122d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122f991906139a0565b604080516080810182527f833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000060a08201527e01f4000000000000000000000000000000000000000000000000000000000060b48201527f420000000000000000000000000000000000000600000000000000000000000060b78201527e2710000000000000000000000000000000000000000000000000000000000060cb8201527fac1bd2486aaf3b5c0fc3fd868558b082a531b2b400000000000000000000000060ce820152815160c281830301815260e28201835281523060208201529192506000919081016123e86135d9565b815260006020909101526040517fb858183f000000000000000000000000000000000000000000000000000000008152909150732626664c2603336e57b271c5c0b26f421741e4819063b858183f90612445908490600401613b13565b6020604051808303816000875af1158015612464573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248891906139a0565b506040516370a0823160e01b8152306004820152600090839073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b4906370a0823190602401602060405180830381865afa1580156124dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250191906139a0565b61250b91906139e2565b9050670de0b6b3a76400006125407f0000000000000000000000000000000000000000000000000000000000000000836139f5565b61254a9190613ab9565b935061255684826139e2565b94505050509091565b60607f92fd13387c7fe7befbc38d303d6468778fb9731bc4583f17d92989c6fcfdeaaa8260405160240161259891511515815260200190565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915292915050565b6040517f27e5c50a00000000000000000000000000000000000000000000000000000000815263ffffffff80861660048301528316602482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906327e5c50a90604401602060405180830381865afa15801561268d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b191906139a0565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f0000000000000000000000000000000000000000000000000000000000000000838989898960405160200161271b9493929190613b62565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161274893929190613ba1565b6020604051808303816000875af1158015612767573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278b9190613a29565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fc2a88c36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061280e91906139a0565b915094509492505050565b600a546000908152600c6020908152604080832081516101208101835281548152600182015493810184905260028201549281019290925260038101546060830181905260048201546080840152600582015460a0840152600682015460c0840152600782015460e08401526008909101546001600160a01b0316610100830152839283929183916128ab91906139cf565b6128b59087613bc9565b905060005b600a811015612aac5782602001518210156129755760c08301516040517f7ce07cdb000000000000000000000000000000000000000000000000000000008152735f5668d7c748fc1a17540c3a7f9245d8cea10c2991637ce07cdb9161292d918691600401918252602082015260400190565b602060405180830381865afa15801561294a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061296e9190613a0c565b94506129b9565b600f6000600a548152602001908152602001600020600084602001518461299c91906139e2565b81526020810191909152604001600020546001600160a01b031694505b6001600160a01b03851615801590612a4a575060405163fe575a8760e01b81526001600160a01b038616600482015273833589fcd6edb6e08f4c7c32d4f71b54bda029139063fe575a8790602401602060405180830381865afa158015612a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a489190613a29565b155b15612a5757819350612aac565b82606001518360200151612a6b91906139cf565b60408051602081018a90529081018490526060016040516020818303038152906040528051906020012060001c612aa29190613bc9565b91506001016128ba565b50600b805460ff191690556001600160a01b038416612b0a57600a546040518781527f6aec39946a3754eb6013bcddea89f4af2965cccdd4803bb1a8fd0c9fa0a5aaf29060200160405180910390a25060009350839150611d2e9050565b6001600160a01b03848116610100840190815260e08401858152888552600a546000908152600c6020908152604091829020875181559087015160018201559086015160028201556060860151600382015560808601516004820181905560a0870151600583015560c08701516006830155915160078201559151600890920180546001600160a01b03191692909316919091179091558015612c2e5760405163a9059cbb60e01b81526001600160a01b03861660048201526024810182905273ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af1158015612c08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c2c9190613a29565b505b600a546000908152600d6020908152604091829020825160a08101845281546001600160a01b039081168252600183015416928101929092526002810154928201929092526003820154606082015260049091015460808201819052156132f0576080810151604051637ba1395b60e11b81526001600160a01b0388811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063f74272b690602401602060405180830381865afa158015612cfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d1e9190613a0c565b6001600160a01b031680835215801590612db45750815160405163fe575a8760e01b81526001600160a01b03909116600482015273833589fcd6edb6e08f4c7c32d4f71b54bda029139063fe575a8790602401602060405180830381865afa158015612d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db29190613a29565b155b15612f085781516040517fe6712ac50000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018590527f00000000000000000000000000000000000000000000000000000000000000009091169063e6712ac590604401602060405180830381865afa158015612e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6791906139a0565b60408301819052612e7890826139e2565b8251604080850151905163a9059cbb60e01b81526001600160a01b039092166004830152602482015290915073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af1158015612ee2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f069190613a29565b505b6040517f87c7a72f0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301527f000000000000000000000000000000000000000000000000000000000000000016906387c7a72f90602401602060405180830381865afa158015612f87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fab9190613a0c565b6001600160a01b031660208301819052158015906130485750602082015160405163fe575a8760e01b81526001600160a01b03909116600482015273833589fcd6edb6e08f4c7c32d4f71b54bda029139063fe575a8790602401602060405180830381865afa158015613022573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130469190613a29565b155b156131a25760208201516040517fce0a80540000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018590527f00000000000000000000000000000000000000000000000000000000000000009091169063ce0a805490604401602060405180830381865afa1580156130da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fe91906139a0565b6060830181905261310f90826139e2565b6020830151606084015160405163a9059cbb60e01b81526001600160a01b039092166004830152602482015290915073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af115801561317c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a09190613a29565b505b6080820181905260095460405163a9059cbb60e01b81526001600160a01b0390911660048201526024810182905273ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af115801561320e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132329190613a29565b50600a80546000908152600d6020908152604091829020855181546001600160a01b039182166001600160a01b0319918216811784559388015160018401805491909316911681179091558387015160028301819055606088015160038401819055608089015160049094018490559554945191959394937f1b99f496633909e67045497e1b70c154062fdec6cb58b2920b2447bdc66cd2f1936132e6939283526020830191909152604082015260600190565b60405180910390a4505b600a805490600061330083613a4b565b9190505550600a54601c03613380576011805461ff001916610100179055600a5485906001600160a01b0388169061333a906001906139e2565b60408051868152602081018d90527fb2790cfbb501cb5d139a6d2e6b8157f1e9fc7043f1354b6645d9accfa9d95582910160405180910390a46001965050505050611d2e565b6000600c60006001600a5461339591906139e2565b81526020019081526020016000206040518061012001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152505090506000600c6000600a5481526020019081526020016000206040518061012001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152505090508160c001518160a00181815250506003548160a001516134f491906139cf565b60c08201908152600a80546000908152600c60209081526040918290208551815590850151600180830191909155918501516002820155606085015160038201556080850151600482015560a085015160058201559251600684015560e08401516007840155610100840151600890930180546001600160a01b0319166001600160a01b03948516179055905489928b169161358f916139e2565b60408051888152602081018f90527fb2790cfbb501cb5d139a6d2e6b8157f1e9fc7043f1354b6645d9accfa9d95582910160405180910390a4600198505050505050509193909250565b6040516370a0823160e01b8152306004820152600090819073833589fcd6edb6e08f4c7c32d4f71b54bda02913906370a0823190602401602060405180830381865afa15801561362d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061365191906139a0565b9050670de0b6b3a76400006006548261366a91906139f5565b6136749190613ab9565b91506007548211156136865760075491505b5090565b8280548282559060005260206000209081019282156136c5579160200282015b828111156136c55782518255916020019190600101906136aa565b506136869291505b8082111561368657600081556001016136cd565b6001600160a01b0381168114611dc257600080fd5b60006020828403121561370857600080fd5b8135610d72816136e1565b6000806040838503121561372657600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561375e57600080fd5b82359150602083013567ffffffffffffffff81111561377c57600080fd5b8301601f8101851361378d57600080fd5b803567ffffffffffffffff8111156137a7576137a7613735565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156137d4576137d4613735565b6040529182526020818401810192908101888411156137f257600080fd5b6020850194505b83851015613815578435808252602095860195909350016137f9565b50809450505050509250929050565b6000806040838503121561383757600080fd5b8235613842816136e1565b946020939093013593505050565b600081518084526020840193506020830160005b82811015613882578151865260209586019590910190600101613864565b5093949350505050565b602081526000610d726020830184613850565b6000602082840312156138b157600080fd5b5035919050565b600080600080600060a086880312156138d057600080fd5b85359450602086013593506040860135925060608601356138f0816136e1565b91506080860135613900816136e1565b809150509295509295909350565b60008060006060848603121561392357600080fd5b833592506020840135613935816136e1565b929592945050506040919091013590565b60008060006060848603121561395b57600080fd5b8335613966816136e1565b92506020840135613935816136e1565b83815282151560208201526060604082015260006139976060830184613850565b95945050505050565b6000602082840312156139b257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a9e57610a9e6139b9565b81810381811115610a9e57610a9e6139b9565b8082028115828204841417610a9e57610a9e6139b9565b600060208284031215613a1e57600080fd5b8151610d72816136e1565b600060208284031215613a3b57600080fd5b81518015158114610d7257600080fd5b600060018201613a5d57613a5d6139b9565b5060010190565b634e487b7160e01b600052603260045260246000fd5b838152606060208201526000613a936060830185613850565b9050826040830152949350505050565b634e487b7160e01b600052601260045260246000fd5b600082613ac857613ac8613aa3565b500490565b6000815180845260005b81811015613af357602081850181015186830182015201613ad7565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000825160806020840152613b2f60a0840182613acd565b90506001600160a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b63ffffffff8516815261ffff8416602082015263ffffffff83166040820152608060608201526000613b976080830184613acd565b9695505050505050565b6001600160a01b03841681528260208201526060604082015260006139976060830184613acd565b600082613bd857613bd8613aa3565b50069056fea2646970667358221220c7497327cde7c3b128132accc1fb41b74ca52b57324a3a70fb59b1ac3bf39c1d64736f6c634300081c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103575760003560e01c80638796ba8c116101c8578063b4de4cc511610104578063d8a4676f116100a2578063e76d51681161007c578063e76d5168146108f0578063f2fde38b14610916578063fa89800514610929578063fc2a88c31461096957600080fd5b8063d8a4676f14610880578063de5dc4ca146108a2578063e164ac50146108c957600080fd5b8063bda844c1116100de578063bda844c114610853578063bef4876b14610866578063c2dc3e5214610878578063c2f6feb41461061e57600080fd5b8063b4de4cc514610825578063b6e21c7114610838578063b70632b61461084b57600080fd5b806395a5a8f711610171578063a168fa891161014b578063a168fa89146107a1578063ad5c4648146107e0578063b0fb162f146107fb578063b375603c1461081c57600080fd5b806395a5a8f7146106f557806396974951146106fe5780639ed0868d1461077a57600080fd5b80638f6ec6e7116101a25780638f6ec6e7146106be57806392a91789146106d957806392d4e570146106ec57600080fd5b80638796ba8c1461067f57806389a30271146106925780638da5cb5b146106ad57600080fd5b80635992704411610297578063715018a6116102405780637ccfd7fc1161021a5780637ccfd7fc146106265780637df8b8021461063c5780637f41887014610659578063865999511461066c57600080fd5b8063715018a61461060957806375f7d8ce1461061157806378066a461461061e57600080fd5b80635d4bc0ce116102715780635d4bc0ce1461051857806361d027b3146105c75780636b9bdb80146105ee57600080fd5b806359927044146104d25780635a524a1c146104e55780635a82f06b146104f857600080fd5b80631b7eb59a116103045780631fe543e3116102de5780631fe543e31461046d57806324f74697146104805780634fbcf3271461049f578063542e6669146104b257600080fd5b80631b7eb59a146103f55780631cc15ea01461041c5780631f2698ab1461045057600080fd5b806312065fe01161033557806312065fe0146103ba5780631525ff7d146103c057806316c73381146103d557600080fd5b80630452096b1461035c5780630dc913061461037e5780630ebe7d11146103b1575b600080fd5b61036b670de0b6b3a764000081565b6040519081526020015b60405180910390f35b610399732626664c2603336e57b271c5c0b26f421741e48181565b6040516001600160a01b039091168152602001610375565b61036b60075481565b4761036b565b6103d36103ce3660046136f6565b610972565b005b61036b6103e33660046136f6565b60026020526000908152604090205481565b6103997f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d181565b61039961042a366004613713565b600f6020908152600092835260408084209091529082529020546001600160a01b031681565b60115461045d9060ff1681565b6040519015158152602001610375565b6103d361047b36600461374b565b6109f7565b61048a621e848081565b60405163ffffffff9091168152602001610375565b61036b6104ad366004613824565b610a7a565b6104c56104c0366004613824565b610aa4565b604051610375919061388c565b600954610399906001600160a01b031681565b6103d36104f336600461389f565b610b18565b61036b6105063660046136f6565b60016020526000908152604090205481565b61057a61052636600461389f565b600c602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460078801546008909801549697959694959394929391929091906001600160a01b031689565b60408051998a5260208a0198909852968801959095526060870193909352608086019190915260a085015260c084015260e08301526001600160a01b031661010082015261012001610375565b6103997f0000000000000000000000005ab49fbac60d8957939e3db2a2d691629546697e81565b61039973ac1bd2486aaf3b5c0fc3fd868558b082a531b2b481565b6103d3610bd5565b600b5461045d9060ff1681565b61036b600a81565b60085461048a9062010000900463ffffffff1681565b60085461039990660100000000000090046001600160a01b031681565b61036b61066736600461389f565b610be9565b6103d361067a36600461389f565b610d92565b61036b61068d36600461389f565b610d9f565b61039973833589fcd6edb6e08f4c7c32d4f71b54bda0291381565b6000546001600160a01b0316610399565b610399735f5668d7c748fc1a17540c3a7f9245d8cea10c2981565b6103d36106e73660046138b8565b610dc0565b61036b60035481565b61036b60065481565b61074761070c36600461389f565b600d60205260009081526040902080546001820154600283015460038401546004909401546001600160a01b03938416949390921692909185565b604080516001600160a01b039687168152959094166020860152928401919091526060830152608082015260a001610375565b6103997f000000000000000000000000b0407dbe851f8318bd31404a49e658143c982f2381565b6107cb6107af36600461389f565b600e602052600090815260409020805460019091015460ff1682565b60408051928352901515602083015201610375565b61039973420000000000000000000000000000000000000681565b6008546108099061ffff1681565b60405161ffff9091168152602001610375565b61036b600a5481565b6103d361083336600461389f565b6113eb565b61036b61084636600461390e565b611635565b61036b611673565b6103d3610861366004613946565b611a8e565b60115461045d90610100900460ff1681565b61045d611b65565b61089361088e36600461389f565b611c37565b60405161037593929190613976565b61036b7f0000000000000000000000000000000000000000000000056bc75e2d6310000081565b61036b7f00000000000000000000000000000000000000000000000002c68af0bb14000081565b7f00000000000000000000000088fb150bdc53a65fe94dea0c9ba0a6daf8c6e196610399565b6103d36109243660046136f6565b611d35565b610954600a546000908152600d60209081526040808320600490810154600c90935292209091015491565b60408051928352602083019190915201610375565b61036b60055481565b61097a611dc5565b6001600160a01b0381166109d55760405162461bcd60e51b815260206004820152600c60248201527f5a65726f2061646472657373000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b7f000000000000000000000000b0407dbe851f8318bd31404a49e658143c982f23336001600160a01b03821614610a6b576040517f8ba9316e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044016109cc565b610a758383611e1f565b505050565b60008181526010602090815260408083206001600160a01b03861684529091529020545b92915050565b60008181526010602090815260408083206001600160a01b0386168452825291829020805483518184028101840190945280845260609392830182828015610b0b57602002820191906000526020600020905b815481526020019060010190808311610af7575b5050505050905092915050565b610b20611dc5565b6706f05b59d3b20000811015610b785760405162461bcd60e51b815260206004820152601860248201527f43616e204e4f54206265206c657373207468616e20353025000000000000000060448201526064016109cc565b670de0b6b3a7640000811115610bd05760405162461bcd60e51b815260206004820152601c60248201527f43616e204e4f542062652067726561746572207468616e20313030250000000060448201526064016109cc565b600655565b610bdd611dc5565b610be76000611ec9565b565b6000818152600c60209081526040808320815161012081018352815481526001820154938101939093526002810154918301919091526003810154606083015260048101546080830152600581015460a0830152600681015460c0830152600781015460e0830152600801546001600160a01b0316610100820152600a548310610d7957735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b031663803d9b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce391906139a0565b735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b0316636031a52f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5991906139a0565b8260600151610d6891906139cf565b610d7291906139e2565b9392505050565b806040015181602001518260600151610d6891906139cf565b610d9a611dc5565b600355565b60048181548110610daf57600080fd5b600091825260209091200154905081565b600a54841015610e125760405162461bcd60e51b815260206004820181905260248201527f43616e204e4f54207374617274206f6e2070726576696f757320726166666c6560448201526064016109cc565b60008311610e625760405162461bcd60e51b815260206004820152601460248201527f43616e204e4f54206265203020726166666c657300000000000000000000000060448201526064016109cc565b6000848152600c6020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e08201526008909101546001600160a01b0316610100820152600a548503610f6f576107088160c00151610efb91906139e2565b4210610f6f5760405162461bcd60e51b815260206004820152602360248201527f43616e204e4f5420707572636861736520666f722063757272656e742072616660448201527f666c65000000000000000000000000000000000000000000000000000000000060648201526084016109cc565b600084610f9c887f0000000000000000000000000000000000000000000000056bc75e2d631000006139f5565b610fa691906139f5565b9050735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b03166323b872dd33735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b031663d1a972666040518163ffffffff1660e01b8152600401602060405180830381865afa15801561101e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110429190613a0c565b6040517f2e6cb9f900000000000000000000000000000000000000000000000000000000815260048101869052735f5668d7c748fc1a17540c3a7f9245d8cea10c2990632e6cb9f990602401602060405180830381865afa1580156110ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cf91906139a0565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561113b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115f9190613a29565b50600061116c8585611f19565b90508660005b878110156113df5760008281526010602090815260408083206001600160a01b038b1684529091528120905b8b81101561120a5760608701805183546001810185556000858152602080822090920192909255868252600f8152604080832084518452909152902080546001600160a01b0319166001600160a01b038c161790558051906111ff82613a4b565b90525060010161119e565b506001600160a01b038416156112c3576000611226858d61219d565b905080156112c15760008481526010602090815260408083206001600160a01b03891684529091528120905b828110156112be5760608901805183546001810185556000858152602080822090920192909255888252600f8152604080832084518452909152902080546001600160a01b0319166001600160a01b038a161790558051906112b382613a4b565b905250600101611252565b50505b505b6000838152600c602090815260409182902088518155908801516001820155908701516002820155606087015160038201556080870151600482015560a0870151600582015560c0870151600682015560e08701516007820155610100870151600890910180546001600160a01b0319166001600160a01b039092169190911790558261134f81613a4b565b6000818152600c602090815260409182902082516101208101845281548152600180830154938201939093526002820154938101939093526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e0840152600801546001600160a01b03166101008301529098509094509290920191506111729050565b50505050505050505050565b6113f3611dc5565b60115460ff161561140357600080fd5b61140f426154606139cf565b811161141a57600080fd5b611472604051806101200160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b4260a082015260c0810182905260008061148a61227f565b60808501918252600a546000908152600d6020908152604080832060040193909355908052600c815285517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8558501517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e9558401517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ea5560608401517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116eb55517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ec55505060a08101517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ed5560c08101517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ee5560e08101517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116ef5561010001517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116f080546001600160a01b0319166001600160a01b03909216919091179055506011805460ff19166001179055565b6010602052826000526040600020602052816000526040600020818154811061165d57600080fd5b9060005260206000200160009250925050505481565b600061167d611b65565b6116c95760405162461bcd60e51b815260206004820152601560248201527f43616e204e4f5420736574746c6520726166666c65000000000000000000000060448201526064016109cc565b600b805460ff1916600117905560408051602081019091526000808252906116f09061255f565b600854909150600090819061171c90621e84809061ffff81169062010000900463ffffffff16866125fd565b604080516060810182528281526000602080830182815284518381528083018652848601908152878452600e83529490922083518155915160018301805460ff1916911515919091179055925180519597509395509093909261178692600285019291019061368a565b5050600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01839055506005829055600854604080518481526201000090920463ffffffff1660208301527fcc58b13ad3eab50626c6a6300b1d139cd6ebb1688a7cced9461c2f7e762665ee910160405180910390a1600a546000908152600c602090815260408083208151610120810183528154815260018201549381018490526002820154928101929092526003810154606083015260048101546080830152600581015460a0830152600681015460c0830152600781015460e0830152600801546001600160a01b03166101008201529103611a8557601c600a54600161189e91906139cf565b1015611907576000806118af61227f565b9150915081600c6000600a5460016118c791906139cf565b81526020019081526020016000206004018190555080600d6000600a5460016118f091906139cf565b815260208101919091526040016000206004015550505b735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b0316636031a52f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197d91906139a0565b816020018181525050735f5668d7c748fc1a17540c3a7f9245d8cea10c296001600160a01b031663803d9b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fc91906139a0565b6040828101918252600a546000908152600c60209081529190208351815590830151600182015590516002820155606082015160038201556080820151600482015560a0820151600582015560c0820151600682015560e08201516007820155610100820151600890910180546001600160a01b0319166001600160a01b039092169190911790555b50909392505050565b611a96611dc5565b6001600160a01b038316611aec5760405162461bcd60e51b815260206004820152601a60248201527f5f746f6b656e20616464726573732063616e6e6f74206265203000000000000060448201526064016109cc565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611b3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5f9190613a29565b50505050565b60115460009060ff161580611b815750601154610100900460ff165b15611b8c5750600090565b600a546000908152600c6020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c08201819052600783015460e08301526008909201546001600160a01b0316610100820152904210801590611c225750600b5460ff16155b15611c2f57600191505090565b600091505090565b6000818152600e60205260408120548190606090611c975760405162461bcd60e51b815260206004820152601160248201527f72657175657374206e6f7420666f756e6400000000000000000000000000000060448201526064016109cc565b6000848152600e60209081526040808320815160608101835281548152600182015460ff16151581850152600282018054845181870281018701865281815292959394860193830182828015611d0c57602002820191906000526020600020905b815481526020019060010190808311611cf8575b5050505050815250509050806000015181602001518260400151935093509350505b9193909250565b611d3d611dc5565b6001600160a01b038116611db95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016109cc565b611dc281611ec9565b50565b6000546001600160a01b03163314610be75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109cc565b6000828152600e602090815260409091206001818101805460ff191690911790558251611e549260029092019184019061368a565b50611e7881600081518110611e6b57611e6b613a64565b6020026020010151612819565b5050506000828152600e6020526040908190205490517f147eb1ff0c82f87f2b03e2c43f5a36488ff63ec6b730195fde4605f612f8db5191611ebd9185918591613a7a565b60405180910390a15050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000336001600160a01b0384160361211357604051637ba1395b60e11b81523360048201527f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d16001600160a01b03169063f74272b690602401602060405180830381865afa158015611f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb39190613a0c565b6040517fd7da7fca0000000000000000000000000000000000000000000000000000000081523360048201529091507f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d16001600160a01b03169063d7da7fca90602401602060405180830381865afa158015612033573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120579190613a29565b801561206b57506001600160a01b03821615155b1561210e576040517f7543e3f00000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0383811660248301527f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d11690637543e3f090604401600060405180830381600087803b1580156120f257600080fd5b505af1158015612106573d6000803e3d6000fd5b505050508190505b610a9e565b604051637ba1395b60e11b81526001600160a01b0384811660048301527f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d1169063f74272b690602401602060405180830381865afa158015612179573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d729190613a0c565b6001600160a01b0382166000908152600160205260408120805483919083906121c79084906139cf565b90915550506001600160a01b0383166000908152600260209081526040808320546001909252909120546121fd90600a90613ab9565b61220791906139e2565b6001600160a01b0384166000908152600260205260408120805492935083929091906122349084906139cf565b909155505060405182815233906001600160a01b038516907fe111b0f7c004e38aa34ef1506f9d5077b975b91a5da7e645fd5de747c47848d59060200160405180910390a392915050565b6040516370a0823160e01b81523060048201526000908190819073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b4906370a0823190602401602060405180830381865afa1580156122d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122f991906139a0565b604080516080810182527f833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000060a08201527e01f4000000000000000000000000000000000000000000000000000000000060b48201527f420000000000000000000000000000000000000600000000000000000000000060b78201527e2710000000000000000000000000000000000000000000000000000000000060cb8201527fac1bd2486aaf3b5c0fc3fd868558b082a531b2b400000000000000000000000060ce820152815160c281830301815260e28201835281523060208201529192506000919081016123e86135d9565b815260006020909101526040517fb858183f000000000000000000000000000000000000000000000000000000008152909150732626664c2603336e57b271c5c0b26f421741e4819063b858183f90612445908490600401613b13565b6020604051808303816000875af1158015612464573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248891906139a0565b506040516370a0823160e01b8152306004820152600090839073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b4906370a0823190602401602060405180830381865afa1580156124dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250191906139a0565b61250b91906139e2565b9050670de0b6b3a76400006125407f00000000000000000000000000000000000000000000000002c68af0bb140000836139f5565b61254a9190613ab9565b935061255684826139e2565b94505050509091565b60607f92fd13387c7fe7befbc38d303d6468778fb9731bc4583f17d92989c6fcfdeaaa8260405160240161259891511515815260200190565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915292915050565b6040517f27e5c50a00000000000000000000000000000000000000000000000000000000815263ffffffff80861660048301528316602482015260009081906001600160a01b037f000000000000000000000000b0407dbe851f8318bd31404a49e658143c982f2316906327e5c50a90604401602060405180830381865afa15801561268d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b191906139a0565b90507f00000000000000000000000088fb150bdc53a65fe94dea0c9ba0a6daf8c6e1966001600160a01b0316634000aea07f000000000000000000000000b0407dbe851f8318bd31404a49e658143c982f23838989898960405160200161271b9493929190613b62565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161274893929190613ba1565b6020604051808303816000875af1158015612767573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278b9190613a29565b507f000000000000000000000000b0407dbe851f8318bd31404a49e658143c982f236001600160a01b031663fc2a88c36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061280e91906139a0565b915094509492505050565b600a546000908152600c6020908152604080832081516101208101835281548152600182015493810184905260028201549281019290925260038101546060830181905260048201546080840152600582015460a0840152600682015460c0840152600782015460e08401526008909101546001600160a01b0316610100830152839283929183916128ab91906139cf565b6128b59087613bc9565b905060005b600a811015612aac5782602001518210156129755760c08301516040517f7ce07cdb000000000000000000000000000000000000000000000000000000008152735f5668d7c748fc1a17540c3a7f9245d8cea10c2991637ce07cdb9161292d918691600401918252602082015260400190565b602060405180830381865afa15801561294a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061296e9190613a0c565b94506129b9565b600f6000600a548152602001908152602001600020600084602001518461299c91906139e2565b81526020810191909152604001600020546001600160a01b031694505b6001600160a01b03851615801590612a4a575060405163fe575a8760e01b81526001600160a01b038616600482015273833589fcd6edb6e08f4c7c32d4f71b54bda029139063fe575a8790602401602060405180830381865afa158015612a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a489190613a29565b155b15612a5757819350612aac565b82606001518360200151612a6b91906139cf565b60408051602081018a90529081018490526060016040516020818303038152906040528051906020012060001c612aa29190613bc9565b91506001016128ba565b50600b805460ff191690556001600160a01b038416612b0a57600a546040518781527f6aec39946a3754eb6013bcddea89f4af2965cccdd4803bb1a8fd0c9fa0a5aaf29060200160405180910390a25060009350839150611d2e9050565b6001600160a01b03848116610100840190815260e08401858152888552600a546000908152600c6020908152604091829020875181559087015160018201559086015160028201556060860151600382015560808601516004820181905560a0870151600583015560c08701516006830155915160078201559151600890920180546001600160a01b03191692909316919091179091558015612c2e5760405163a9059cbb60e01b81526001600160a01b03861660048201526024810182905273ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af1158015612c08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c2c9190613a29565b505b600a546000908152600d6020908152604091829020825160a08101845281546001600160a01b039081168252600183015416928101929092526002810154928201929092526003820154606082015260049091015460808201819052156132f0576080810151604051637ba1395b60e11b81526001600160a01b0388811660048301527f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d1169063f74272b690602401602060405180830381865afa158015612cfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d1e9190613a0c565b6001600160a01b031680835215801590612db45750815160405163fe575a8760e01b81526001600160a01b03909116600482015273833589fcd6edb6e08f4c7c32d4f71b54bda029139063fe575a8790602401602060405180830381865afa158015612d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db29190613a29565b155b15612f085781516040517fe6712ac50000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018590527f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d19091169063e6712ac590604401602060405180830381865afa158015612e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6791906139a0565b60408301819052612e7890826139e2565b8251604080850151905163a9059cbb60e01b81526001600160a01b039092166004830152602482015290915073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af1158015612ee2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f069190613a29565b505b6040517f87c7a72f0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301527f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d116906387c7a72f90602401602060405180830381865afa158015612f87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fab9190613a0c565b6001600160a01b031660208301819052158015906130485750602082015160405163fe575a8760e01b81526001600160a01b03909116600482015273833589fcd6edb6e08f4c7c32d4f71b54bda029139063fe575a8790602401602060405180830381865afa158015613022573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130469190613a29565b155b156131a25760208201516040517fce0a80540000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018590527f000000000000000000000000634b84cff9cbd1c2621b80e1782f65ec4b70d2d19091169063ce0a805490604401602060405180830381865afa1580156130da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fe91906139a0565b6060830181905261310f90826139e2565b6020830151606084015160405163a9059cbb60e01b81526001600160a01b039092166004830152602482015290915073ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af115801561317c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a09190613a29565b505b6080820181905260095460405163a9059cbb60e01b81526001600160a01b0390911660048201526024810182905273ac1bd2486aaf3b5c0fc3fd868558b082a531b2b49063a9059cbb906044016020604051808303816000875af115801561320e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132329190613a29565b50600a80546000908152600d6020908152604091829020855181546001600160a01b039182166001600160a01b0319918216811784559388015160018401805491909316911681179091558387015160028301819055606088015160038401819055608089015160049094018490559554945191959394937f1b99f496633909e67045497e1b70c154062fdec6cb58b2920b2447bdc66cd2f1936132e6939283526020830191909152604082015260600190565b60405180910390a4505b600a805490600061330083613a4b565b9190505550600a54601c03613380576011805461ff001916610100179055600a5485906001600160a01b0388169061333a906001906139e2565b60408051868152602081018d90527fb2790cfbb501cb5d139a6d2e6b8157f1e9fc7043f1354b6645d9accfa9d95582910160405180910390a46001965050505050611d2e565b6000600c60006001600a5461339591906139e2565b81526020019081526020016000206040518061012001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152505090506000600c6000600a5481526020019081526020016000206040518061012001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152505090508160c001518160a00181815250506003548160a001516134f491906139cf565b60c08201908152600a80546000908152600c60209081526040918290208551815590850151600180830191909155918501516002820155606085015160038201556080850151600482015560a085015160058201559251600684015560e08401516007840155610100840151600890930180546001600160a01b0319166001600160a01b03948516179055905489928b169161358f916139e2565b60408051888152602081018f90527fb2790cfbb501cb5d139a6d2e6b8157f1e9fc7043f1354b6645d9accfa9d95582910160405180910390a4600198505050505050509193909250565b6040516370a0823160e01b8152306004820152600090819073833589fcd6edb6e08f4c7c32d4f71b54bda02913906370a0823190602401602060405180830381865afa15801561362d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061365191906139a0565b9050670de0b6b3a76400006006548261366a91906139f5565b6136749190613ab9565b91506007548211156136865760075491505b5090565b8280548282559060005260206000209081019282156136c5579160200282015b828111156136c55782518255916020019190600101906136aa565b506136869291505b8082111561368657600081556001016136cd565b6001600160a01b0381168114611dc257600080fd5b60006020828403121561370857600080fd5b8135610d72816136e1565b6000806040838503121561372657600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561375e57600080fd5b82359150602083013567ffffffffffffffff81111561377c57600080fd5b8301601f8101851361378d57600080fd5b803567ffffffffffffffff8111156137a7576137a7613735565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156137d4576137d4613735565b6040529182526020818401810192908101888411156137f257600080fd5b6020850194505b83851015613815578435808252602095860195909350016137f9565b50809450505050509250929050565b6000806040838503121561383757600080fd5b8235613842816136e1565b946020939093013593505050565b600081518084526020840193506020830160005b82811015613882578151865260209586019590910190600101613864565b5093949350505050565b602081526000610d726020830184613850565b6000602082840312156138b157600080fd5b5035919050565b600080600080600060a086880312156138d057600080fd5b85359450602086013593506040860135925060608601356138f0816136e1565b91506080860135613900816136e1565b809150509295509295909350565b60008060006060848603121561392357600080fd5b833592506020840135613935816136e1565b929592945050506040919091013590565b60008060006060848603121561395b57600080fd5b8335613966816136e1565b92506020840135613935816136e1565b83815282151560208201526060604082015260006139976060830184613850565b95945050505050565b6000602082840312156139b257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610a9e57610a9e6139b9565b81810381811115610a9e57610a9e6139b9565b8082028115828204841417610a9e57610a9e6139b9565b600060208284031215613a1e57600080fd5b8151610d72816136e1565b600060208284031215613a3b57600080fd5b81518015158114610d7257600080fd5b600060018201613a5d57613a5d6139b9565b5060010190565b634e487b7160e01b600052603260045260246000fd5b838152606060208201526000613a936060830185613850565b9050826040830152949350505050565b634e487b7160e01b600052601260045260246000fd5b600082613ac857613ac8613aa3565b500490565b6000815180845260005b81811015613af357602081850181015186830182015201613ad7565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000825160806020840152613b2f60a0840182613acd565b90506001600160a01b03602085015116604084015260408401516060840152606084015160808401528091505092915050565b63ffffffff8516815261ffff8416602082015263ffffffff83166040820152608060608201526000613b976080830184613acd565b9695505050505050565b6001600160a01b03841681528260208201526060604082015260006139976060830184613acd565b600082613bd857613bd8613aa3565b50069056fea2646970667358221220c7497327cde7c3b128132accc1fb41b74ca52b57324a3a70fb59b1ac3bf39c1d64736f6c634300081c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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