POL Price: $0.699145 (+14.47%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo2,735.988388544374551595 POL

POL Value

$1,912.85 (@ $0.70/POL)

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Slots_Play649906122024-12-02 11:06:5620 hrs ago1733137616IN
0x1109a2D4...4eeB3C8C7
0.6899495 POL0.01342749.86538451
Slots_Play649537442024-12-01 12:48:4942 hrs ago1733057329IN
0x1109a2D4...4eeB3C8C7
190.08435568 POL0.012654646.99684211
Slots_Play649535992024-12-01 12:43:3942 hrs ago1733057019IN
0x1109a2D4...4eeB3C8C7
140.09290552 POL0.0143289153.21490759
Slots_Play649535632024-12-01 12:42:2342 hrs ago1733056943IN
0x1109a2D4...4eeB3C8C7
140.09357535 POL0.0144600853.70205958
Slots_Play649534882024-12-01 12:39:4542 hrs ago1733056785IN
0x1109a2D4...4eeB3C8C7
140.09357102 POL0.0144592353.69890842
Slots_Play649534522024-12-01 12:38:2742 hrs ago1733056707IN
0x1109a2D4...4eeB3C8C7
140.093874 POL0.0145185653.91926067
Slots_Play649532102024-12-01 12:29:2443 hrs ago1733056164IN
0x1109a2D4...4eeB3C8C7
64.07766008 POL0.0113434142.12731686
Slots_Play649531622024-12-01 12:27:4243 hrs ago1733056062IN
0x1109a2D4...4eeB3C8C7
288.0796471 POL0.0117325243.57242691
Slots_Play649531362024-12-01 12:26:3243 hrs ago1733055992IN
0x1109a2D4...4eeB3C8C7
160.07572182 POL0.0109638440.71767236
Slots_Play649476222024-12-01 9:10:0646 hrs ago1733044206IN
0x1109a2D4...4eeB3C8C7
2.55443127 POL0.0107524839.9327363
Slots_Play649475822024-12-01 9:08:4046 hrs ago1733044120IN
0x1109a2D4...4eeB3C8C7
17.07532012 POL0.0109265540.57917541
Slots_Play649475532024-12-01 9:07:4046 hrs ago1733044060IN
0x1109a2D4...4eeB3C8C7
17.07747953 POL0.0113494242.14965157
Slots_Play649475252024-12-01 9:06:4046 hrs ago1733044000IN
0x1109a2D4...4eeB3C8C7
26.07154259 POL0.010186837.83188348
Slots_Play649474732024-12-01 9:04:5046 hrs ago1733043890IN
0x1109a2D4...4eeB3C8C7
84.0688507 POL0.0096596535.87414121
Slots_Play649474242024-12-01 9:03:0646 hrs ago1733043786IN
0x1109a2D4...4eeB3C8C7
172.06757139 POL0.0094091234.94373236
Slots_Play649473862024-12-01 9:01:4446 hrs ago1733043704IN
0x1109a2D4...4eeB3C8C7
112.06806514 POL0.0095058135.30282552
Slots_Play649440782024-12-01 7:01:392 days ago1733036499IN
0x1109a2D4...4eeB3C8C7
62.06704936 POL0.0092110434.20808889
Slots_Play649440432024-12-01 7:00:252 days ago1733036425IN
0x1109a2D4...4eeB3C8C7
38.06703962 POL0.0092091334.20100083
Slots_Play649440022024-12-01 6:58:592 days ago1733036339IN
0x1109a2D4...4eeB3C8C7
38.06703197 POL0.0092076334.19543754
Slots_Play649439532024-12-01 6:57:152 days ago1733036235IN
0x1109a2D4...4eeB3C8C7
38.06703197 POL0.0092076334.19543823
Slots_Play649439122024-12-01 6:55:472 days ago1733036147IN
0x1109a2D4...4eeB3C8C7
38.06703197 POL0.0092076334.19543859
Slots_Play649437532024-12-01 6:50:092 days ago1733035809IN
0x1109a2D4...4eeB3C8C7
82.06703199 POL0.0092076334.19545576
Slots_Play649435782024-12-01 6:43:572 days ago1733035437IN
0x1109a2D4...4eeB3C8C7
55.06586983 POL0.0089800533.35024651
Slots_Play649435442024-12-01 6:42:452 days ago1733035365IN
0x1109a2D4...4eeB3C8C7
23.06586986 POL0.0089800633.35027038
Slots_Play649435092024-12-01 6:41:312 days ago1733035291IN
0x1109a2D4...4eeB3C8C7
11.56586993 POL0.0089800733.3503217
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
649906192024-12-02 11:07:1020 hrs ago1733137630
0x1109a2D4...4eeB3C8C7
0.6 POL
649906122024-12-02 11:06:5620 hrs ago1733137616
0x1109a2D4...4eeB3C8C7
0.0179899 POL
649537512024-12-01 12:49:0342 hrs ago1733057343
0x1109a2D4...4eeB3C8C7
190 POL
649537442024-12-01 12:48:4942 hrs ago1733057329
0x1109a2D4...4eeB3C8C7
0.01687113 POL
649536052024-12-01 12:43:5342 hrs ago1733057033
0x1109a2D4...4eeB3C8C7
140 POL
649535992024-12-01 12:43:3942 hrs ago1733057019
0x1109a2D4...4eeB3C8C7
0.0185811 POL
649535702024-12-01 12:42:3942 hrs ago1733056959
0x1109a2D4...4eeB3C8C7
140 POL
649535632024-12-01 12:42:2342 hrs ago1733056943
0x1109a2D4...4eeB3C8C7
0.01871507 POL
649534952024-12-01 12:39:5942 hrs ago1733056799
0x1109a2D4...4eeB3C8C7
140 POL
649534882024-12-01 12:39:4542 hrs ago1733056785
0x1109a2D4...4eeB3C8C7
0.0187142 POL
649534572024-12-01 12:38:3942 hrs ago1733056719
0x1109a2D4...4eeB3C8C7
140 POL
649534522024-12-01 12:38:2742 hrs ago1733056707
0x1109a2D4...4eeB3C8C7
0.0187748 POL
649532172024-12-01 12:29:4043 hrs ago1733056180
0x1109a2D4...4eeB3C8C7
64 POL
649532102024-12-01 12:29:2443 hrs ago1733056164
0x1109a2D4...4eeB3C8C7
0.01553201 POL
649531692024-12-01 12:27:5843 hrs ago1733056078
0x1109a2D4...4eeB3C8C7
288 POL
649531622024-12-01 12:27:4243 hrs ago1733056062
0x1109a2D4...4eeB3C8C7
0.01592942 POL
649531422024-12-01 12:26:4443 hrs ago1733056004
0x1109a2D4...4eeB3C8C7
160 POL
649531362024-12-01 12:26:3243 hrs ago1733055992
0x1109a2D4...4eeB3C8C7
0.01514436 POL
649476282024-12-01 9:10:1846 hrs ago1733044218
0x1109a2D4...4eeB3C8C7
2.48 POL
649476222024-12-01 9:10:0646 hrs ago1733044206
0x1109a2D4...4eeB3C8C7
0.01488625 POL
649475902024-12-01 9:08:5846 hrs ago1733044138
0x1109a2D4...4eeB3C8C7
17 POL
649475822024-12-01 9:08:4046 hrs ago1733044120
0x1109a2D4...4eeB3C8C7
0.01506402 POL
649475602024-12-01 9:07:5446 hrs ago1733044074
0x1109a2D4...4eeB3C8C7
17 POL
649475532024-12-01 9:07:4046 hrs ago1733044060
0x1109a2D4...4eeB3C8C7
0.0154959 POL
649475322024-12-01 9:06:5446 hrs ago1733044014
0x1109a2D4...4eeB3C8C7
26 POL
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Slots

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 9 : Slots.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import "./Common.sol";

/**
 * @title slots game, players put in a wager and recieve payout depending on the slots outcome
 */

contract Slots is Common {
    using SafeERC20 for IERC20;

    constructor(
        address _bankroll,
        address _vrf,
        address link_eth_feed,
        address _forwarder,
        uint16[] memory _multipliers,
        uint16[] memory _outcomeNum,
        uint16 _numOutcomes
    ) {
        Bankroll = IBankRoll(_bankroll);
        IChainLinkVRF = IVRFCoordinatorV2(_vrf);
        LINK_ETH_FEED = AggregatorV3Interface(link_eth_feed);
        ChainLinkVRF = _vrf;
        _trustedForwarder = _forwarder;
        _setSlotsMultipliers(_multipliers, _outcomeNum, _numOutcomes);
    }

    struct SlotsGame {
        uint256 wager;
        uint256 stopGain;
        uint256 stopLoss;
        uint256 requestID;
        address tokenAddress;
        uint64 blockNumber;
        uint32 numBets;
    }

    mapping(address => SlotsGame) slotsGames;
    mapping(uint256 => address) slotsIDs;

    mapping(uint16 => uint16) slotsMultipliers;
    uint16 numOutcomes;

    /**
     * @dev event emitted at the start of the game
     * @param playerAddress address of the player that made the bet
     * @param wager wagered amount
     * @param tokenAddress address of token the wager was made, 0 address is considered the native coin
     * @param numBets number of bets the player intends to make
     * @param stopGain gain value at which the betting stop if a gain is reached
     * @param stopLoss loss value at which the betting stop if a loss is reached
     */
    event Slots_Play_Event(
        address indexed playerAddress,
        uint256 wager,
        address tokenAddress,
        uint32 numBets,
        uint256 stopGain,
        uint256 stopLoss,
        uint256 VRFFee
    );

    /**
     * @dev event emitted by the VRF callback with the bet results
     * @param playerAddress address of the player that made the bet
     * @param wager wager amount
     * @param payout total payout transfered to the player
     * @param tokenAddress address of token the wager was made and payout, 0 address is considered the native coin
     * @param slotIDs slots result
     * @param multipliers multiplier of the slots result
     * @param payouts individual payouts for each bet
     * @param numGames number of games performed
     */
    event Slots_Outcome_Event(
        address indexed playerAddress,
        uint256 wager,
        uint256 payout,
        address tokenAddress,
        uint16[] slotIDs,
        uint256[] multipliers,
        uint256[] payouts,
        uint32 numGames
    );

    /**
     * @dev event emitted when a refund is done in slots
     * @param player address of the player reciving the refund
     * @param wager amount of wager that was refunded
     * @param tokenAddress address of token the refund was made in
     */
    event Slots_Refund_Event(
        address indexed player,
        uint256 wager,
        address tokenAddress
    );

    error AwaitingVRF(uint256 requestID);
    error InvalidNumBets(uint256 maxNumBets);
    error NotAwaitingVRF();
    error WagerAboveLimit(uint256 wager, uint256 maxWager);
    error BlockNumberTooLow(uint256 have, uint256 want);
    error OnlyCoordinatorCanFulfill(address have, address want);

    /**
     * @dev function to get current request player is await from VRF, returns 0 if none
     * @param player address of the player to get the state
     */
    function Slots_GetState(
        address player
    ) external view returns (SlotsGame memory) {
        return (slotsGames[player]);
    }

    /**
     * @dev function to view the current slots multipliers
     * @return  multipliers multipliers for all slots outcomes
     */
    function Slots_GetMultipliers()
        external
        view
        returns (uint16[] memory multipliers)
    {
        multipliers = new uint16[](numOutcomes);
        for (uint16 i = 0; i < numOutcomes; i++) {
            multipliers[i] = slotsMultipliers[i];
        }
        return multipliers;
    }

    /**
     * @dev Function to play slots, takes the user wager saves bet parameters and makes a request to the VRF
     * @param wager wager amount
     * @param tokenAddress address of token to bet, 0 address is considered the native coin
     * @param numBets number of bets to make, and amount of random numbers to request
     * @param stopGain treshold value at which the bets stop if a certain profit is obtained
     * @param stopLoss treshold value at which the bets stop if a certain loss is obtained
     */

    function Slots_Play(
        uint256 wager,
        address tokenAddress,
        uint32 numBets,
        uint256 stopGain,
        uint256 stopLoss
    ) external payable nonReentrant {
        address msgSender = _msgSender();

        if (slotsGames[msgSender].requestID != 0) {
            revert AwaitingVRF(slotsGames[msgSender].requestID);
        }
        if (!(numBets > 0 && numBets <= 100)) {
            revert InvalidNumBets(100);
        }

        _kellyWager(wager, tokenAddress);
        uint256 fee = _transferWager(
            tokenAddress,
            wager * numBets,
            1100000,
            msgSender
        );
        uint256 id = _requestRandomWords(numBets);

        slotsGames[msgSender] = SlotsGame(
            wager,
            stopGain,
            stopLoss,
            id,
            tokenAddress,
            uint64(block.number),
            numBets
        );
        slotsIDs[id] = msgSender;

        emit Slots_Play_Event(
            msgSender,
            wager,
            tokenAddress,
            numBets,
            stopGain,
            stopLoss,
            fee
        );
    }

    /**
     * @dev Function to refund user in case of VRF request failling
     */
    function Slots_Refund() external nonReentrant {
        address msgSender = _msgSender();
        SlotsGame storage game = slotsGames[msgSender];
        if (game.requestID == 0) {
            revert NotAwaitingVRF();
        }
        if (game.blockNumber + BLOCK_NUMBER_REFUND + 10 > block.number) {
            revert BlockNumberTooLow(
                block.number,
                game.blockNumber + BLOCK_NUMBER_REFUND + 10
            );
        }

        uint256 wager = game.wager * game.numBets;
        address tokenAddress = game.tokenAddress;

        delete (slotsIDs[game.requestID]);
        delete (slotsGames[msgSender]);

        if (tokenAddress == address(0)) {
            (bool success, ) = payable(msgSender).call{value: wager}("");
            if (!success) {
                revert TransferFailed();
            }
        } else {
            IERC20(tokenAddress).safeTransfer(msgSender, wager);
        }
        emit Slots_Refund_Event(msgSender, wager, tokenAddress);
    }

    /**
     * @dev function called by Chainlink VRF with random numbers
     * @param requestId id provided when the request was made
     * @param randomWords array of random numbers
     */
    function rawFulfillRandomWords(
        uint256 requestId,
        uint256[] memory randomWords
    ) external {
        if (msg.sender != ChainLinkVRF) {
            revert OnlyCoordinatorCanFulfill(msg.sender, ChainLinkVRF);
        }
        fulfillRandomWords(requestId, randomWords);
    }

    function fulfillRandomWords(
        uint256 requestId,
        uint256[] memory randomWords
    ) internal {
        address playerAddress = slotsIDs[requestId];
        if (playerAddress == address(0)) revert();
        SlotsGame storage game = slotsGames[playerAddress];
        if (block.number > game.blockNumber + BLOCK_NUMBER_REFUND) revert();

        uint256 payout;
        int256 totalValue;
        uint32 i;
        uint16[] memory slotID = new uint16[](game.numBets);
        uint256[] memory multipliers = new uint256[](game.numBets);
        uint256[] memory payouts = new uint256[](game.numBets);

        address tokenAddress = game.tokenAddress;

        for (i = 0; i < game.numBets; i++) {
            if (totalValue >= int256(game.stopGain)) {
                break;
            }
            if (totalValue <= -int256(game.stopLoss)) {
                break;
            }

            slotID[i] = uint16(randomWords[i] % numOutcomes);
            multipliers[i] = slotsMultipliers[slotID[i]];

            if (multipliers[i] != 0) {
                totalValue +=
                    int256(game.wager * multipliers[i]) -
                    int256(game.wager);
                payout += game.wager * multipliers[i];
                payouts[i] = game.wager * multipliers[i];
            } else {
                totalValue -= int256(game.wager);
            }
        }

        payout += (game.numBets - i) * game.wager;

        emit Slots_Outcome_Event(
            playerAddress,
            game.wager,
            payout,
            tokenAddress,
            slotID,
            multipliers,
            payouts,
            i
        );
        _transferToBankroll(tokenAddress, game.wager * game.numBets);
        delete (slotsIDs[requestId]);
        delete (slotsGames[playerAddress]);
        if (payout != 0) {
            _transferPayout(playerAddress, payout, tokenAddress);
        }
    }

    /**
     * @dev function to set the slots multipliers, can only be called at deploy time
     * @param _multipliers array of all multipliers with multiplier above 0
     * @param _outcomeNum array of slot outcome that corresponds to the multiplier
     * @param _numOutcomes total number of outcomes, example with 7 possibilities for each slot and 3 slots number = 7^3
     */
    function _setSlotsMultipliers(
        uint16[] memory _multipliers,
        uint16[] memory _outcomeNum,
        uint16 _numOutcomes
    ) internal {
        for (uint16 i = 0; i < numOutcomes; i++) {
            delete (slotsMultipliers[i]);
        }

        numOutcomes = _numOutcomes;
        for (uint16 i = 0; i < _multipliers.length; i++) {
            slotsMultipliers[_outcomeNum[i]] = _multipliers[i];
        }
    }

    /**
     * @dev calculates the maximum wager allowed based on the bankroll size
     */
    function _kellyWager(uint256 wager, address tokenAddress) internal view {
        uint256 balance;
        if (tokenAddress == address(0)) {
            balance = address(Bankroll).balance;
        } else {
            balance = IERC20(tokenAddress).balanceOf(address(Bankroll));
        }
        uint256 maxWager = (balance * 55770) / 100000000;
        if (wager > maxWager) {
            revert WagerAboveLimit(wager, maxWager);
        }
    }
}

File 2 of 9 : Common.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

//import "hardhat/console.sol";

interface IBankRoll {
    function getIsGame(address game) external view returns (bool);

    function getIsValidWager(
        address game,
        address tokenAddress
    ) external view returns (bool);

    function transferPayout(
        address player,
        uint256 payout,
        address token
    ) external;

    function getOwner() external view returns (address);

    function isPlayerSuspended(
        address player
    ) external view returns (bool, uint256);
}

interface IVRFCoordinatorV2 is VRFCoordinatorV2Interface {
    function getFeeConfig()
        external
        view
        returns (
            uint32,
            uint32,
            uint32,
            uint32,
            uint32,
            uint24,
            uint24,
            uint24,
            uint24
        );
}

contract Common is ReentrancyGuard {
    using SafeERC20 for IERC20;

    uint256 public VRFFees;
    address public ChainLinkVRF;
    address public _trustedForwarder;

    uint64 constant BLOCK_NUMBER_REFUND = 1000;

    AggregatorV3Interface public LINK_ETH_FEED;
    IVRFCoordinatorV2 public IChainLinkVRF;
    IBankRoll public Bankroll;

    error NotApprovedBankroll();
    error InvalidValue(uint256 required, uint256 sent);
    error TransferFailed();
    error RefundFailed();
    error NotOwner(address want, address have);
    error ZeroWager();
    error PlayerSuspended(uint256 suspensionTime);

    /**
     * @dev function to transfer the player wager to bankroll, and charge for VRF fee
     * , reverts if bankroll doesn't approve game or token
     * @param tokenAddress address of the token the wager is made on
     * @param wager total amount wagered
     */

    function _transferWager(
        address tokenAddress,
        uint256 wager,
        uint256 gasAmount,
        address msgSender
    ) internal returns (uint256 VRFfee) {
        if (!Bankroll.getIsValidWager(address(this), tokenAddress)) {
            revert NotApprovedBankroll();
        }
        if (wager == 0) {
            revert ZeroWager();
        }
        (bool suspended, uint256 suspendedTime) = Bankroll.isPlayerSuspended(
            msgSender
        );
        if (suspended) {
            revert PlayerSuspended(suspendedTime);
        }
        VRFfee = getVRFFee(gasAmount);

        if (tokenAddress == address(0)) {
            if (msg.value < wager + VRFfee) {
                revert InvalidValue(wager + VRFfee, msg.value);
            }
            _refundExcessValue(msg.value - (VRFfee + wager));
        } else {
            if (msg.value < VRFfee) {
                revert InvalidValue(VRFfee, msg.value);
            }

            IERC20(tokenAddress).safeTransferFrom(
                msgSender,
                address(this),
                wager
            );

            _refundExcessValue(msg.value - VRFfee);
        }
        VRFFees += VRFfee;
    }

    /**
     * @dev function to transfer the wager held by the game contract to the bankroll
     * @param tokenAddress address of the token to transfer
     * @param amount token amount to transfer
     */
    function _transferToBankroll(
        address tokenAddress,
        uint256 amount
    ) internal {
        if (tokenAddress == address(0)) {
            (bool success, ) = payable(address(Bankroll)).call{value: amount}(
                ""
            );
            if (!success) {
                revert RefundFailed();
            }
        } else {
            IERC20(tokenAddress).safeTransfer(address(Bankroll), amount);
        }
    }

    /**
     * @dev calculates in form of native token the fee charged by chainlink VRF
     * @return fee amount of fee user has to pay
     */
    function getVRFFee(uint256 gasAmount) public view returns (uint256 fee) {
        (, int256 answer, , , ) = LINK_ETH_FEED.latestRoundData();
        (uint32 fulfillmentFlatFeeLinkPPMTier1, , , , , , , , ) = IChainLinkVRF
            .getFeeConfig();

        fee =
            tx.gasprice *
            (gasAmount) +
            ((1e12 *
                uint256(fulfillmentFlatFeeLinkPPMTier1) *
                uint256(answer)) / 1e18);
    }

    /**
     * @dev returns to user the excess fee sent to pay for the VRF
     * @param refund amount to send back to user
     */
    function _refundExcessValue(uint256 refund) internal {
        if (refund == 0) {
            return;
        }
        (bool success, ) = payable(msg.sender).call{value: refund}("");
        if (!success) {
            revert RefundFailed();
        }
    }

    /**
     * @dev function to charge user for VRF
     */
    function _payVRFFee(uint256 gasAmount) internal returns (uint256 VRFfee) {
        VRFfee = getVRFFee(gasAmount);
        if (msg.value < VRFfee) {
            revert InvalidValue(VRFfee, msg.value);
        }
        _refundExcessValue(msg.value - VRFfee);
        VRFFees += VRFfee;
    }

    /**
     * @dev function to transfer VRF fees acumulated in the contract to the Bankroll
     * Can only be called by owner
     */
    function transferFees(address to) external nonReentrant {
        if (msg.sender != Bankroll.getOwner()) {
            revert NotOwner(Bankroll.getOwner(), msg.sender);
        }
        uint256 fee = VRFFees;
        VRFFees = 0;
        (bool success, ) = payable(address(to)).call{value: fee}("");
        if (!success) {
            revert TransferFailed();
        }
    }

    /**
     * @dev function to transfer wager to game contract, without charging for VRF
     * @param tokenAddress tokenAddress the wager is made on
     * @param wager wager amount
     */
    function _transferWagerPvPNoVRF(
        address tokenAddress,
        uint256 wager
    ) internal {
        if (!Bankroll.getIsValidWager(address(this), tokenAddress)) {
            revert NotApprovedBankroll();
        }
        if (tokenAddress == address(0)) {
            if (!(msg.value == wager)) {
                revert InvalidValue(wager, msg.value);
            }
        } else {
            IERC20(tokenAddress).safeTransferFrom(
                msg.sender,
                address(this),
                wager
            );
        }
    }

    /**
     * @dev function to transfer wager to game contract, including charge for VRF
     * @param tokenAddress tokenAddress the wager is made on
     * @param wager wager amount
     */
    function _transferWagerPvP(
        address tokenAddress,
        uint256 wager,
        uint256 gasAmount
    ) internal {
        if (!Bankroll.getIsValidWager(address(this), tokenAddress)) {
            revert NotApprovedBankroll();
        }

        uint256 VRFfee = getVRFFee(gasAmount);
        if (tokenAddress == address(0)) {
            if (msg.value < wager + VRFfee) {
                revert InvalidValue(wager, msg.value);
            }

            _refundExcessValue(msg.value - (VRFfee + wager));
        } else {
            if (msg.value < VRFfee) {
                revert InvalidValue(VRFfee, msg.value);
            }

            IERC20(tokenAddress).safeTransferFrom(
                msg.sender,
                address(this),
                wager
            );
            _refundExcessValue(msg.value - VRFfee);
        }
        VRFFees += VRFfee;
    }

    /**
     * @dev transfers payout from the game contract to the players
     * @param player address of the player to transfer the payout to
     * @param payout amount of payout to transfer
     * @param tokenAddress address of the token that payout will be transfered
     */
    function _transferPayoutPvP(
        address player,
        uint256 payout,
        address tokenAddress
    ) internal {
        if (tokenAddress == address(0)) {
            (bool success, ) = payable(player).call{value: payout}("");
            if (!success) {
                revert TransferFailed();
            }
        } else {
            IERC20(tokenAddress).safeTransfer(player, payout);
        }
    }

    /**
     * @dev transfers house edge from game contract to bankroll
     * @param amount amount to transfer
     * @param tokenAddress address of token to transfer
     */
    function _transferHouseEdgePvP(
        uint256 amount,
        address tokenAddress
    ) internal {
        if (tokenAddress == address(0)) {
            (bool success, ) = payable(address(Bankroll)).call{value: amount}(
                ""
            );
            if (!success) {
                revert TransferFailed();
            }
        } else {
            IERC20(tokenAddress).safeTransfer(address(Bankroll), amount);
        }
    }

    /**
     * @dev function to request bankroll to give payout to player
     * @param player address of the player
     * @param payout amount of payout to give
     * @param tokenAddress address of the token in which to give the payout
     */
    function _transferPayout(
        address player,
        uint256 payout,
        address tokenAddress
    ) internal {
        Bankroll.transferPayout(player, payout, tokenAddress);
    }

    /**
     * @dev function to send the request for randomness to chainlink
     * @param numWords number of random numbers required
     */
    function _requestRandomWords(
        uint32 numWords
    ) internal returns (uint256 s_requestId) {
        s_requestId = VRFCoordinatorV2Interface(ChainLinkVRF)
            .requestRandomWords(
                0xd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a8,
                576,
                3,
                2500000,
                numWords
            );
    }

    function isTrustedForwarder(address forwarder) public view returns (bool) {
        return forwarder == _trustedForwarder;
    }

    function _msgSender() internal view returns (address ret) {
        if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) {
            // At this point we know that the sender is a trusted forwarder,
            // so we trust that the last bytes of msg.data are the verified sender address.
            // extract sender address from the end of msg.data
            assembly {
                ret := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            ret = msg.sender;
        }
    }
}

File 3 of 9 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

File 4 of 9 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}

File 5 of 9 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFCoordinatorV2Interface {
  /**
   * @notice Get configuration relevant for making requests
   * @return minimumRequestConfirmations global min for request confirmations
   * @return maxGasLimit global max for request gas limit
   * @return s_provingKeyHashes list of registered key hashes
   */
  function getRequestConfig()
    external
    view
    returns (
      uint16,
      uint32,
      bytes32[] memory
    );

  /**
   * @notice Request a set of random words.
   * @param keyHash - Corresponds to a particular oracle job which uses
   * that key for generating the VRF proof. Different keyHash's have different gas price
   * ceilings, so you can select a specific one to bound your maximum per request cost.
   * @param subId  - The ID of the VRF subscription. Must be funded
   * with the minimum subscription balance required for the selected keyHash.
   * @param minimumRequestConfirmations - How many blocks you'd like the
   * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
   * for why you may want to request more. The acceptable range is
   * [minimumRequestBlockConfirmations, 200].
   * @param callbackGasLimit - How much gas you'd like to receive in your
   * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
   * may be slightly less than this amount because of gas used calling the function
   * (argument decoding etc.), so you may need to request slightly more than you expect
   * to have inside fulfillRandomWords. The acceptable range is
   * [0, maxGasLimit]
   * @param numWords - The number of uint256 random values you'd like to receive
   * in your fulfillRandomWords callback. Note these numbers are expanded in a
   * secure way by the VRFCoordinator from a single random value supplied by the oracle.
   * @return requestId - A unique identifier of the request. Can be used to match
   * a request to a response in fulfillRandomWords.
   */
  function requestRandomWords(
    bytes32 keyHash,
    uint64 subId,
    uint16 minimumRequestConfirmations,
    uint32 callbackGasLimit,
    uint32 numWords
  ) external returns (uint256 requestId);

  /**
   * @notice Create a VRF subscription.
   * @return subId - A unique subscription id.
   * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
   * @dev Note to fund the subscription, use transferAndCall. For example
   * @dev  LINKTOKEN.transferAndCall(
   * @dev    address(COORDINATOR),
   * @dev    amount,
   * @dev    abi.encode(subId));
   */
  function createSubscription() external returns (uint64 subId);

  /**
   * @notice Get a VRF subscription.
   * @param subId - ID of the subscription
   * @return balance - LINK balance of the subscription in juels.
   * @return reqCount - number of requests for this subscription, determines fee tier.
   * @return owner - owner of the subscription.
   * @return consumers - list of consumer address which are able to use this subscription.
   */
  function getSubscription(uint64 subId)
    external
    view
    returns (
      uint96 balance,
      uint64 reqCount,
      address owner,
      address[] memory consumers
    );

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @param newOwner - proposed new owner of the subscription
   */
  function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @dev will revert if original owner of subId has
   * not requested that msg.sender become the new owner.
   */
  function acceptSubscriptionOwnerTransfer(uint64 subId) external;

  /**
   * @notice Add a consumer to a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - New consumer which can use the subscription
   */
  function addConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Remove a consumer from a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - Consumer to remove from the subscription
   */
  function removeConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Cancel a subscription
   * @param subId - ID of the subscription
   * @param to - Where to send the remaining LINK to
   */
  function cancelSubscription(uint64 subId, address to) external;

  /*
   * @notice Check to see if there exists a request commitment consumers
   * for all consumers and keyhashes for a given sub.
   * @param subId - ID of the subscription
   * @return true if there exists at least one unfulfilled request for the subscription, false
   * otherwise.
   */
  function pendingRequestExists(uint64 subId) external view returns (bool);
}

File 6 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

File 7 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}

File 8 of 9 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 9 of 9 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_bankroll","type":"address"},{"internalType":"address","name":"_vrf","type":"address"},{"internalType":"address","name":"link_eth_feed","type":"address"},{"internalType":"address","name":"_forwarder","type":"address"},{"internalType":"uint16[]","name":"_multipliers","type":"uint16[]"},{"internalType":"uint16[]","name":"_outcomeNum","type":"uint16[]"},{"internalType":"uint16","name":"_numOutcomes","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"requestID","type":"uint256"}],"name":"AwaitingVRF","type":"error"},{"inputs":[{"internalType":"uint256","name":"have","type":"uint256"},{"internalType":"uint256","name":"want","type":"uint256"}],"name":"BlockNumberTooLow","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxNumBets","type":"uint256"}],"name":"InvalidNumBets","type":"error"},{"inputs":[{"internalType":"uint256","name":"required","type":"uint256"},{"internalType":"uint256","name":"sent","type":"uint256"}],"name":"InvalidValue","type":"error"},{"inputs":[],"name":"NotApprovedBankroll","type":"error"},{"inputs":[],"name":"NotAwaitingVRF","type":"error"},{"inputs":[{"internalType":"address","name":"want","type":"address"},{"internalType":"address","name":"have","type":"address"}],"name":"NotOwner","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[{"internalType":"uint256","name":"suspensionTime","type":"uint256"}],"name":"PlayerSuspended","type":"error"},{"inputs":[],"name":"RefundFailed","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"uint256","name":"maxWager","type":"uint256"}],"name":"WagerAboveLimit","type":"error"},{"inputs":[],"name":"ZeroWager","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"playerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"wager","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint16[]","name":"slotIDs","type":"uint16[]"},{"indexed":false,"internalType":"uint256[]","name":"multipliers","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"payouts","type":"uint256[]"},{"indexed":false,"internalType":"uint32","name":"numGames","type":"uint32"}],"name":"Slots_Outcome_Event","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"playerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"wager","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint32","name":"numBets","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"stopGain","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stopLoss","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"VRFFee","type":"uint256"}],"name":"Slots_Play_Event","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"wager","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"}],"name":"Slots_Refund_Event","type":"event"},{"inputs":[],"name":"Bankroll","outputs":[{"internalType":"contract IBankRoll","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ChainLinkVRF","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IChainLinkVRF","outputs":[{"internalType":"contract IVRFCoordinatorV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LINK_ETH_FEED","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"Slots_GetMultipliers","outputs":[{"internalType":"uint16[]","name":"multipliers","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"Slots_GetState","outputs":[{"components":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"uint256","name":"stopGain","type":"uint256"},{"internalType":"uint256","name":"stopLoss","type":"uint256"},{"internalType":"uint256","name":"requestID","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint64","name":"blockNumber","type":"uint64"},{"internalType":"uint32","name":"numBets","type":"uint32"}],"internalType":"struct Slots.SlotsGame","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint32","name":"numBets","type":"uint32"},{"internalType":"uint256","name":"stopGain","type":"uint256"},{"internalType":"uint256","name":"stopLoss","type":"uint256"}],"name":"Slots_Play","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"Slots_Refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"VRFFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gasAmount","type":"uint256"}],"name":"getVRFFee","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"address","name":"to","type":"address"}],"name":"transferFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620027a4380380620027a4833981016040819052620000349162000299565b6001600055600680546001600160a01b03808a166001600160a01b03199283161790925560058054898416908316811790915560048054898516908416179055600280548316909117905560038054928716929091169190911790556200009d838383620000aa565b50505050505050620003a8565b60005b600a5461ffff9081169082161015620000f15761ffff81166000908152600960205260409020805461ffff1916905580620000e88162000361565b915050620000ad565b50600a805461ffff191661ffff831617905560005b83518161ffff161015620001a057838161ffff16815181106200012d576200012d62000392565b602002602001015160096000858461ffff168151811062000152576200015262000392565b602002602001015161ffff1661ffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff1602179055508080620001979062000361565b91505062000106565b50505050565b80516001600160a01b0381168114620001be57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b805161ffff81168114620001be57600080fd5b600082601f830112620001fe57600080fd5b815160206001600160401b03808311156200021d576200021d620001c3565b8260051b604051601f19603f83011681018181108482111715620002455762000245620001c3565b6040529384528581018301938381019250878511156200026457600080fd5b83870191505b848210156200028e576200027e82620001d9565b835291830191908301906200026a565b979650505050505050565b600080600080600080600060e0888a031215620002b557600080fd5b620002c088620001a6565b9650620002d060208901620001a6565b9550620002e060408901620001a6565b9450620002f060608901620001a6565b60808901519094506001600160401b03808211156200030e57600080fd5b6200031c8b838c01620001ec565b945060a08a01519150808211156200033357600080fd5b50620003428a828b01620001ec565b9250506200035360c08901620001d9565b905092959891949750929550565b600061ffff808316818114156200038857634e487b7160e01b600052601160045260246000fd5b6001019392505050565b634e487b7160e01b600052603260045260246000fd5b6123ec80620003b86000396000f3fe6080604052600436106100dd5760003560e01c80637127698f1161007f578063953995ea11610059578063953995ea146102ce578063ad178361146102ee578063d0bcfc0c1461030e578063f26c05f21461032e57600080fd5b80637127698f146102755780638bd161141461028a5780638d7c16d2146102b857600080fd5b80634dd189d5116100bb5780634dd189d5146101be57806356c022bb146101f6578063572b6c051461021657806363dc4ef51461025557600080fd5b80631734e50a146100e25780631fe543e31461010d57806344e137341461012f575b600080fd5b3480156100ee57600080fd5b506100f7610341565b6040516101049190611d1c565b60405180910390f35b34801561011957600080fd5b5061012d610128366004611d4c565b6103f8565b005b34801561013b57600080fd5b5061014f61014a366004611e2b565b610464565b6040516101049190600060e082019050825182526020830151602083015260408301516040830152606083015160608301526001600160a01b03608084015116608083015267ffffffffffffffff60a08401511660a083015263ffffffff60c08401511660c083015292915050565b3480156101ca57600080fd5b506005546101de906001600160a01b031681565b6040516001600160a01b039091168152602001610104565b34801561020257600080fd5b506003546101de906001600160a01b031681565b34801561022257600080fd5b50610245610231366004611e2b565b6003546001600160a01b0391821691161490565b6040519015158152602001610104565b34801561026157600080fd5b5061012d610270366004611e2b565b610543565b34801561028157600080fd5b5061012d610720565b34801561029657600080fd5b506102aa6102a5366004611e48565b6109b7565b604051908152602001610104565b3480156102c457600080fd5b506102aa60015481565b3480156102da57600080fd5b506002546101de906001600160a01b031681565b3480156102fa57600080fd5b506004546101de906001600160a01b031681565b34801561031a57600080fd5b506006546101de906001600160a01b031681565b61012d61033c366004611e73565b610b18565b600a5460609061ffff1667ffffffffffffffff81111561036357610363611d36565b60405190808252806020026020018201604052801561038c578160200160208202803683370190505b50905060005b600a5461ffff90811690821610156103f45761ffff808216600081815260096020526040902054845192169184919081106103cf576103cf611ec5565b61ffff90921660209283029190910190910152806103ec81611ef1565b915050610392565b5090565b6002546001600160a01b03163314610456576002546040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b6104608282610e18565b5050565b6104bd6040518060e001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b03168152602001600067ffffffffffffffff168152602001600063ffffffff1681525090565b506001600160a01b03908116600090815260076020908152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004909101549182166080820152600160a01b820467ffffffffffffffff1660a0820152600160e01b90910463ffffffff1660c082015290565b61054b611320565b600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561059e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c29190611f13565b6001600160a01b0316336001600160a01b03161461069557600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561062d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106519190611f13565b6040517f23295f0e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015233602482015260440161044d565b600180546000918290556040519091906001600160a01b0384169083908381818185875af1925050503d80600081146106ea576040519150601f19603f3d011682016040523d82523d6000602084013e6106ef565b606091505b5050905080610711576040516312171d8360e31b815260040160405180910390fd5b505061071d6001600055565b50565b610728611320565b600061073261137a565b6001600160a01b0381166000908152600760205260409020600381015491925090610789576040517f49050b3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481015443906107ae906103e890600160a01b900467ffffffffffffffff16611f30565b6107b990600a611f30565b67ffffffffffffffff16111561083e57600481015443906107ee906103e890600160a01b900467ffffffffffffffff16611f30565b6107f990600a611f30565b6040517fb4ae675a000000000000000000000000000000000000000000000000000000008152600481019290925267ffffffffffffffff16602482015260440161044d565b6004810154815460009161086091600160e01b90910463ffffffff1690611f5c565b6004808401546003808601546000908152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038a811684526007909252822082815560018101839055600281018390559283018290559190930192909255919250168061094e576000846001600160a01b03168360405160006040518083038185875af1925050503d8060008114610921576040519150601f19603f3d011682016040523d82523d6000602084013e610926565b606091505b5050905080610948576040516312171d8360e31b815260040160405180910390fd5b50610962565b6109626001600160a01b03821685846113ae565b604080518381526001600160a01b0383811660208301528616917f1d349643bcdca147749e5f231209be458850aea573661bed4ab760d2a4eaf063910160405180910390a2505050506109b56001600055565b565b60048054604080517ffeaf968c000000000000000000000000000000000000000000000000000000008152905160009384936001600160a01b03169263feaf968c928183019260a0928290030181865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190611f9a565b5050509150506000600560009054906101000a90046001600160a01b03166001600160a01b0316635fbbc0d26040518163ffffffff1660e01b815260040161012060405180830381865afa158015610a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abd9190611ffd565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610ae89190611f5c565b610af29190611f5c565b610afc91906120c9565b610b06853a611f5c565b610b1091906120dd565b949350505050565b610b20611320565b6000610b2a61137a565b6001600160a01b03811660009081526007602052604090206003015490915015610ba1576001600160a01b038116600090815260076020526040908190206003015490517f440db96e000000000000000000000000000000000000000000000000000000008152600481019190915260240161044d565b60008463ffffffff16118015610bbe575060648463ffffffff1611155b610bf7576040517f931074910000000000000000000000000000000000000000000000000000000081526064600482015260240161044d565b610c01868661145c565b6000610c2186610c1763ffffffff88168a611f5c565b6210c8e085611572565b90506000610c2e8661181c565b90506040518060e00160405280898152602001868152602001858152602001828152602001886001600160a01b031681526020014367ffffffffffffffff1681526020018763ffffffff1681525060076000856001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a08201518160040160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060c082015181600401601c6101000a81548163ffffffff021916908363ffffffff160217905550905050826008600083815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550826001600160a01b03167f84a7b484f1c34e597d3331ce6ffc8714cf38182106d15c73d90ed934299f0c5b898989898988604051610dfc969594939291909586526001600160a01b0394909416602086015263ffffffff9290921660408501526060840152608083015260a082015260c00190565b60405180910390a2505050610e116001600055565b5050505050565b6000828152600860205260409020546001600160a01b031680610e3a57600080fd5b6001600160a01b03811660009081526007602052604090206004810154610e75906103e890600160a01b900467ffffffffffffffff16611f30565b67ffffffffffffffff16431115610e8b57600080fd5b6004810154600090819081908190600160e01b900463ffffffff1667ffffffffffffffff811115610ebe57610ebe611d36565b604051908082528060200260200182016040528015610ee7578160200160208202803683370190505b506004860154909150600090600160e01b900463ffffffff1667ffffffffffffffff811115610f1857610f18611d36565b604051908082528060200260200182016040528015610f41578160200160208202803683370190505b506004870154909150600090600160e01b900463ffffffff1667ffffffffffffffff811115610f7257610f72611d36565b604051908082528060200260200182016040528015610f9b578160200160208202803683370190505b506004880154600095509091506001600160a01b03165b600488015463ffffffff600160e01b909104811690861610156111f25787600101548612610fdf576111f2565b8760020154610fed906120f5565b8613610ff8576111f2565b600a548a5161ffff909116908b9063ffffffff881690811061101c5761101c611ec5565b602002602001015161102e9190612112565b848663ffffffff168151811061104657611046611ec5565b602002602001019061ffff16908161ffff168152505060096000858763ffffffff168151811061107857611078611ec5565b602002602001015161ffff1661ffff16815260200190815260200160002060009054906101000a900461ffff1661ffff16838663ffffffff16815181106110c1576110c1611ec5565b602002602001018181525050828563ffffffff16815181106110e5576110e5611ec5565b60200260200101516000146111d1578760000154838663ffffffff168151811061111157611111611ec5565b602002602001015189600001546111289190611f5c565b6111329190612126565b61113c908761217e565b9550828563ffffffff168151811061115657611156611ec5565b6020026020010151886000015461116d9190611f5c565b61117790886120dd565b9650828563ffffffff168151811061119157611191611ec5565b602002602001015188600001546111a89190611f5c565b828663ffffffff16815181106111c0576111c0611ec5565b6020026020010181815250506111e0565b87546111dd9087612126565b95505b846111ea816121d6565b955050610fb2565b87546004890154611211908790600160e01b900463ffffffff166121f0565b63ffffffff166112219190611f5c565b61122b90886120dd565b9650886001600160a01b03167f92effafb76f06eb770800ec9b38dbc4c3ad53f950062c07b4c7f9ced43d0f9f8896000015489848888888c6040516112769796959493929190612245565b60405180910390a2600488015488546112a79183916112a291600160e01b900463ffffffff1690611f5c565b6118ee565b60008b8152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038c168352600790915281208181556001810182905560028101829055600381018290556004015586156113135761131389888361198a565b5050505050505050505050565b600260005414156113735760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161044d565b6002600055565b60006014361080159061139757506003546001600160a01b031633145b156113a9575060131936013560601c90565b503390565b6040516001600160a01b0383166024820152604481018290526114579084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611a16565b505050565b60006001600160a01b03821661147f57506006546001600160a01b031631611509565b6006546040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152908316906370a0823190602401602060405180830381865afa1580156114e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150691906122b4565b90505b60006305f5e10061151c8361d9da611f5c565b61152691906120c9565b90508084111561156c576040517fd53662aa000000000000000000000000000000000000000000000000000000008152600481018590526024810182905260440161044d565b50505050565b6006546040517fbfd7f9cc0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038681166024830152600092169063bfd7f9cc90604401602060405180830381865afa1580156115dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160091906122dd565b611636576040517f51c3b94f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8361166d576040517f07375c8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546040517f0a5748a80000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526000928392911690630a5748a8906024016040805180830381865afa1580156116d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f791906122f8565b915091508115611736576040517f6c2775f50000000000000000000000000000000000000000000000000000000081526004810182905260240161044d565b61173f856109b7565b92506001600160a01b0387166117ae5761175983876120dd565b34101561178d5761176a83876120dd565b60405163de9b74a160e01b8152600481019190915234602482015260440161044d565b6117a961179a87856120dd565b6117a49034612324565b611afb565b6117fa565b823410156117d85760405163de9b74a160e01b81526004810184905234602482015260440161044d565b6117ed6001600160a01b038816853089611b6c565b6117fa6117a48434612324565b826001600082825461180c91906120dd565b9091555092979650505050505050565b6002546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081527fd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a86004820152610240602482015260036044820152622625a0606482015263ffffffff831660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af11580156118c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e891906122b4565b92915050565b6001600160a01b038216611970576006546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611949576040519150601f19603f3d011682016040523d82523d6000602084013e61194e565b606091505b505090508061145757604051633c31275160e21b815260040160405180910390fd5b600654610460906001600160a01b038481169116836113ae565b6006546040517f6c025ec20000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b1580156119f957600080fd5b505af1158015611a0d573d6000803e3d6000fd5b50505050505050565b6000611a6b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611bbd9092919063ffffffff16565b8051909150156114575780806020019051810190611a8991906122dd565b6114575760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161044d565b80611b035750565b604051600090339083908381818185875af1925050503d8060008114611b45576040519150601f19603f3d011682016040523d82523d6000602084013e611b4a565b606091505b505090508061046057604051633c31275160e21b815260040160405180910390fd5b6040516001600160a01b038085166024830152831660448201526064810182905261156c9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016113f3565b6060610b10848460008585600080866001600160a01b03168587604051611be49190612367565b60006040518083038185875af1925050503d8060008114611c21576040519150601f19603f3d011682016040523d82523d6000602084013e611c26565b606091505b5091509150611c3787838387611c42565b979650505050505050565b60608315611cae578251611ca7576001600160a01b0385163b611ca75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161044d565b5081610b10565b610b108383815115611cc35781518083602001fd5b8060405162461bcd60e51b815260040161044d9190612383565b600081518084526020808501945080840160005b83811015611d1157815161ffff1687529582019590820190600101611cf1565b509495945050505050565b602081526000611d2f6020830184611cdd565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611d5f57600080fd5b8235915060208084013567ffffffffffffffff80821115611d7f57600080fd5b818601915086601f830112611d9357600080fd5b813581811115611da557611da5611d36565b8060051b604051601f19603f83011681018181108582111715611dca57611dca611d36565b604052918252848201925083810185019189831115611de857600080fd5b938501935b82851015611e0657843584529385019392850192611ded565b8096505050505050509250929050565b6001600160a01b038116811461071d57600080fd5b600060208284031215611e3d57600080fd5b8135611d2f81611e16565b600060208284031215611e5a57600080fd5b5035919050565b63ffffffff8116811461071d57600080fd5b600080600080600060a08688031215611e8b57600080fd5b853594506020860135611e9d81611e16565b93506040860135611ead81611e61565b94979396509394606081013594506080013592915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600061ffff80831681811415611f0957611f09611edb565b6001019392505050565b600060208284031215611f2557600080fd5b8151611d2f81611e16565b600067ffffffffffffffff808316818516808303821115611f5357611f53611edb565b01949350505050565b6000816000190483118215151615611f7657611f76611edb565b500290565b805169ffffffffffffffffffff81168114611f9557600080fd5b919050565b600080600080600060a08688031215611fb257600080fd5b611fbb86611f7b565b9450602086015193506040860151925060608601519150611fde60808701611f7b565b90509295509295909350565b805162ffffff81168114611f9557600080fd5b60008060008060008060008060006101208a8c03121561201c57600080fd5b895161202781611e61565b60208b015190995061203881611e61565b60408b015190985061204981611e61565b60608b015190975061205a81611e61565b60808b015190965061206b81611e61565b945061207960a08b01611fea565b935061208760c08b01611fea565b925061209560e08b01611fea565b91506120a46101008b01611fea565b90509295985092959850929598565b634e487b7160e01b600052601260045260246000fd5b6000826120d8576120d86120b3565b500490565b600082198211156120f0576120f0611edb565b500190565b6000600160ff1b82141561210b5761210b611edb565b5060000390565b600082612121576121216120b3565b500690565b600080831283600160ff1b0183128115161561214457612144611edb565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01831381161561217857612178611edb565b50500390565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038413811516156121b8576121b8611edb565b82600160ff1b0384128116156121d0576121d0611edb565b50500190565b600063ffffffff80831681811415611f0957611f09611edb565b600063ffffffff8381169083168181101561220d5761220d611edb565b039392505050565b600081518084526020808501945080840160005b83811015611d1157815187529582019590820190600101612229565b8781528660208201526001600160a01b038616604082015260e06060820152600061227360e0830187611cdd565b82810360808401526122858187612215565b905082810360a08401526122998186612215565b91505063ffffffff831660c083015298975050505050505050565b6000602082840312156122c657600080fd5b5051919050565b80518015158114611f9557600080fd5b6000602082840312156122ef57600080fd5b611d2f826122cd565b6000806040838503121561230b57600080fd5b612314836122cd565b9150602083015190509250929050565b60008282101561233657612336611edb565b500390565b60005b8381101561235657818101518382015260200161233e565b8381111561156c5750506000910152565b6000825161237981846020870161233b565b9190910192915050565b60208152600082518060208401526123a281604085016020870161233b565b601f01601f1916919091016040019291505056fea2646970667358221220166fc59748f913d5cbf6a808395d01417faa0af4c710425c8fe43993eb19ccb064736f6c634300080b003300000000000000000000000051e99a0d09eeca8d7efec3062ac024b6d0989959000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802000000000000000000000000f73ab2d782bf6ba97ac4405d2cd4f1135da8dbd900000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000015700000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000150000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000250000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000007500000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000011d0000000000000000000000000000000000000000000000000000000000000156

Deployed Bytecode

0x6080604052600436106100dd5760003560e01c80637127698f1161007f578063953995ea11610059578063953995ea146102ce578063ad178361146102ee578063d0bcfc0c1461030e578063f26c05f21461032e57600080fd5b80637127698f146102755780638bd161141461028a5780638d7c16d2146102b857600080fd5b80634dd189d5116100bb5780634dd189d5146101be57806356c022bb146101f6578063572b6c051461021657806363dc4ef51461025557600080fd5b80631734e50a146100e25780631fe543e31461010d57806344e137341461012f575b600080fd5b3480156100ee57600080fd5b506100f7610341565b6040516101049190611d1c565b60405180910390f35b34801561011957600080fd5b5061012d610128366004611d4c565b6103f8565b005b34801561013b57600080fd5b5061014f61014a366004611e2b565b610464565b6040516101049190600060e082019050825182526020830151602083015260408301516040830152606083015160608301526001600160a01b03608084015116608083015267ffffffffffffffff60a08401511660a083015263ffffffff60c08401511660c083015292915050565b3480156101ca57600080fd5b506005546101de906001600160a01b031681565b6040516001600160a01b039091168152602001610104565b34801561020257600080fd5b506003546101de906001600160a01b031681565b34801561022257600080fd5b50610245610231366004611e2b565b6003546001600160a01b0391821691161490565b6040519015158152602001610104565b34801561026157600080fd5b5061012d610270366004611e2b565b610543565b34801561028157600080fd5b5061012d610720565b34801561029657600080fd5b506102aa6102a5366004611e48565b6109b7565b604051908152602001610104565b3480156102c457600080fd5b506102aa60015481565b3480156102da57600080fd5b506002546101de906001600160a01b031681565b3480156102fa57600080fd5b506004546101de906001600160a01b031681565b34801561031a57600080fd5b506006546101de906001600160a01b031681565b61012d61033c366004611e73565b610b18565b600a5460609061ffff1667ffffffffffffffff81111561036357610363611d36565b60405190808252806020026020018201604052801561038c578160200160208202803683370190505b50905060005b600a5461ffff90811690821610156103f45761ffff808216600081815260096020526040902054845192169184919081106103cf576103cf611ec5565b61ffff90921660209283029190910190910152806103ec81611ef1565b915050610392565b5090565b6002546001600160a01b03163314610456576002546040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b6104608282610e18565b5050565b6104bd6040518060e001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b03168152602001600067ffffffffffffffff168152602001600063ffffffff1681525090565b506001600160a01b03908116600090815260076020908152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004909101549182166080820152600160a01b820467ffffffffffffffff1660a0820152600160e01b90910463ffffffff1660c082015290565b61054b611320565b600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561059e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c29190611f13565b6001600160a01b0316336001600160a01b03161461069557600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561062d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106519190611f13565b6040517f23295f0e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015233602482015260440161044d565b600180546000918290556040519091906001600160a01b0384169083908381818185875af1925050503d80600081146106ea576040519150601f19603f3d011682016040523d82523d6000602084013e6106ef565b606091505b5050905080610711576040516312171d8360e31b815260040160405180910390fd5b505061071d6001600055565b50565b610728611320565b600061073261137a565b6001600160a01b0381166000908152600760205260409020600381015491925090610789576040517f49050b3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481015443906107ae906103e890600160a01b900467ffffffffffffffff16611f30565b6107b990600a611f30565b67ffffffffffffffff16111561083e57600481015443906107ee906103e890600160a01b900467ffffffffffffffff16611f30565b6107f990600a611f30565b6040517fb4ae675a000000000000000000000000000000000000000000000000000000008152600481019290925267ffffffffffffffff16602482015260440161044d565b6004810154815460009161086091600160e01b90910463ffffffff1690611f5c565b6004808401546003808601546000908152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038a811684526007909252822082815560018101839055600281018390559283018290559190930192909255919250168061094e576000846001600160a01b03168360405160006040518083038185875af1925050503d8060008114610921576040519150601f19603f3d011682016040523d82523d6000602084013e610926565b606091505b5050905080610948576040516312171d8360e31b815260040160405180910390fd5b50610962565b6109626001600160a01b03821685846113ae565b604080518381526001600160a01b0383811660208301528616917f1d349643bcdca147749e5f231209be458850aea573661bed4ab760d2a4eaf063910160405180910390a2505050506109b56001600055565b565b60048054604080517ffeaf968c000000000000000000000000000000000000000000000000000000008152905160009384936001600160a01b03169263feaf968c928183019260a0928290030181865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190611f9a565b5050509150506000600560009054906101000a90046001600160a01b03166001600160a01b0316635fbbc0d26040518163ffffffff1660e01b815260040161012060405180830381865afa158015610a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abd9190611ffd565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610ae89190611f5c565b610af29190611f5c565b610afc91906120c9565b610b06853a611f5c565b610b1091906120dd565b949350505050565b610b20611320565b6000610b2a61137a565b6001600160a01b03811660009081526007602052604090206003015490915015610ba1576001600160a01b038116600090815260076020526040908190206003015490517f440db96e000000000000000000000000000000000000000000000000000000008152600481019190915260240161044d565b60008463ffffffff16118015610bbe575060648463ffffffff1611155b610bf7576040517f931074910000000000000000000000000000000000000000000000000000000081526064600482015260240161044d565b610c01868661145c565b6000610c2186610c1763ffffffff88168a611f5c565b6210c8e085611572565b90506000610c2e8661181c565b90506040518060e00160405280898152602001868152602001858152602001828152602001886001600160a01b031681526020014367ffffffffffffffff1681526020018763ffffffff1681525060076000856001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a08201518160040160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060c082015181600401601c6101000a81548163ffffffff021916908363ffffffff160217905550905050826008600083815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550826001600160a01b03167f84a7b484f1c34e597d3331ce6ffc8714cf38182106d15c73d90ed934299f0c5b898989898988604051610dfc969594939291909586526001600160a01b0394909416602086015263ffffffff9290921660408501526060840152608083015260a082015260c00190565b60405180910390a2505050610e116001600055565b5050505050565b6000828152600860205260409020546001600160a01b031680610e3a57600080fd5b6001600160a01b03811660009081526007602052604090206004810154610e75906103e890600160a01b900467ffffffffffffffff16611f30565b67ffffffffffffffff16431115610e8b57600080fd5b6004810154600090819081908190600160e01b900463ffffffff1667ffffffffffffffff811115610ebe57610ebe611d36565b604051908082528060200260200182016040528015610ee7578160200160208202803683370190505b506004860154909150600090600160e01b900463ffffffff1667ffffffffffffffff811115610f1857610f18611d36565b604051908082528060200260200182016040528015610f41578160200160208202803683370190505b506004870154909150600090600160e01b900463ffffffff1667ffffffffffffffff811115610f7257610f72611d36565b604051908082528060200260200182016040528015610f9b578160200160208202803683370190505b506004880154600095509091506001600160a01b03165b600488015463ffffffff600160e01b909104811690861610156111f25787600101548612610fdf576111f2565b8760020154610fed906120f5565b8613610ff8576111f2565b600a548a5161ffff909116908b9063ffffffff881690811061101c5761101c611ec5565b602002602001015161102e9190612112565b848663ffffffff168151811061104657611046611ec5565b602002602001019061ffff16908161ffff168152505060096000858763ffffffff168151811061107857611078611ec5565b602002602001015161ffff1661ffff16815260200190815260200160002060009054906101000a900461ffff1661ffff16838663ffffffff16815181106110c1576110c1611ec5565b602002602001018181525050828563ffffffff16815181106110e5576110e5611ec5565b60200260200101516000146111d1578760000154838663ffffffff168151811061111157611111611ec5565b602002602001015189600001546111289190611f5c565b6111329190612126565b61113c908761217e565b9550828563ffffffff168151811061115657611156611ec5565b6020026020010151886000015461116d9190611f5c565b61117790886120dd565b9650828563ffffffff168151811061119157611191611ec5565b602002602001015188600001546111a89190611f5c565b828663ffffffff16815181106111c0576111c0611ec5565b6020026020010181815250506111e0565b87546111dd9087612126565b95505b846111ea816121d6565b955050610fb2565b87546004890154611211908790600160e01b900463ffffffff166121f0565b63ffffffff166112219190611f5c565b61122b90886120dd565b9650886001600160a01b03167f92effafb76f06eb770800ec9b38dbc4c3ad53f950062c07b4c7f9ced43d0f9f8896000015489848888888c6040516112769796959493929190612245565b60405180910390a2600488015488546112a79183916112a291600160e01b900463ffffffff1690611f5c565b6118ee565b60008b8152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038c168352600790915281208181556001810182905560028101829055600381018290556004015586156113135761131389888361198a565b5050505050505050505050565b600260005414156113735760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161044d565b6002600055565b60006014361080159061139757506003546001600160a01b031633145b156113a9575060131936013560601c90565b503390565b6040516001600160a01b0383166024820152604481018290526114579084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611a16565b505050565b60006001600160a01b03821661147f57506006546001600160a01b031631611509565b6006546040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152908316906370a0823190602401602060405180830381865afa1580156114e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150691906122b4565b90505b60006305f5e10061151c8361d9da611f5c565b61152691906120c9565b90508084111561156c576040517fd53662aa000000000000000000000000000000000000000000000000000000008152600481018590526024810182905260440161044d565b50505050565b6006546040517fbfd7f9cc0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038681166024830152600092169063bfd7f9cc90604401602060405180830381865afa1580156115dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160091906122dd565b611636576040517f51c3b94f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8361166d576040517f07375c8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546040517f0a5748a80000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526000928392911690630a5748a8906024016040805180830381865afa1580156116d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f791906122f8565b915091508115611736576040517f6c2775f50000000000000000000000000000000000000000000000000000000081526004810182905260240161044d565b61173f856109b7565b92506001600160a01b0387166117ae5761175983876120dd565b34101561178d5761176a83876120dd565b60405163de9b74a160e01b8152600481019190915234602482015260440161044d565b6117a961179a87856120dd565b6117a49034612324565b611afb565b6117fa565b823410156117d85760405163de9b74a160e01b81526004810184905234602482015260440161044d565b6117ed6001600160a01b038816853089611b6c565b6117fa6117a48434612324565b826001600082825461180c91906120dd565b9091555092979650505050505050565b6002546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081527fd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a86004820152610240602482015260036044820152622625a0606482015263ffffffff831660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af11580156118c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e891906122b4565b92915050565b6001600160a01b038216611970576006546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611949576040519150601f19603f3d011682016040523d82523d6000602084013e61194e565b606091505b505090508061145757604051633c31275160e21b815260040160405180910390fd5b600654610460906001600160a01b038481169116836113ae565b6006546040517f6c025ec20000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b1580156119f957600080fd5b505af1158015611a0d573d6000803e3d6000fd5b50505050505050565b6000611a6b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611bbd9092919063ffffffff16565b8051909150156114575780806020019051810190611a8991906122dd565b6114575760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161044d565b80611b035750565b604051600090339083908381818185875af1925050503d8060008114611b45576040519150601f19603f3d011682016040523d82523d6000602084013e611b4a565b606091505b505090508061046057604051633c31275160e21b815260040160405180910390fd5b6040516001600160a01b038085166024830152831660448201526064810182905261156c9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016113f3565b6060610b10848460008585600080866001600160a01b03168587604051611be49190612367565b60006040518083038185875af1925050503d8060008114611c21576040519150601f19603f3d011682016040523d82523d6000602084013e611c26565b606091505b5091509150611c3787838387611c42565b979650505050505050565b60608315611cae578251611ca7576001600160a01b0385163b611ca75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161044d565b5081610b10565b610b108383815115611cc35781518083602001fd5b8060405162461bcd60e51b815260040161044d9190612383565b600081518084526020808501945080840160005b83811015611d1157815161ffff1687529582019590820190600101611cf1565b509495945050505050565b602081526000611d2f6020830184611cdd565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611d5f57600080fd5b8235915060208084013567ffffffffffffffff80821115611d7f57600080fd5b818601915086601f830112611d9357600080fd5b813581811115611da557611da5611d36565b8060051b604051601f19603f83011681018181108582111715611dca57611dca611d36565b604052918252848201925083810185019189831115611de857600080fd5b938501935b82851015611e0657843584529385019392850192611ded565b8096505050505050509250929050565b6001600160a01b038116811461071d57600080fd5b600060208284031215611e3d57600080fd5b8135611d2f81611e16565b600060208284031215611e5a57600080fd5b5035919050565b63ffffffff8116811461071d57600080fd5b600080600080600060a08688031215611e8b57600080fd5b853594506020860135611e9d81611e16565b93506040860135611ead81611e61565b94979396509394606081013594506080013592915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600061ffff80831681811415611f0957611f09611edb565b6001019392505050565b600060208284031215611f2557600080fd5b8151611d2f81611e16565b600067ffffffffffffffff808316818516808303821115611f5357611f53611edb565b01949350505050565b6000816000190483118215151615611f7657611f76611edb565b500290565b805169ffffffffffffffffffff81168114611f9557600080fd5b919050565b600080600080600060a08688031215611fb257600080fd5b611fbb86611f7b565b9450602086015193506040860151925060608601519150611fde60808701611f7b565b90509295509295909350565b805162ffffff81168114611f9557600080fd5b60008060008060008060008060006101208a8c03121561201c57600080fd5b895161202781611e61565b60208b015190995061203881611e61565b60408b015190985061204981611e61565b60608b015190975061205a81611e61565b60808b015190965061206b81611e61565b945061207960a08b01611fea565b935061208760c08b01611fea565b925061209560e08b01611fea565b91506120a46101008b01611fea565b90509295985092959850929598565b634e487b7160e01b600052601260045260246000fd5b6000826120d8576120d86120b3565b500490565b600082198211156120f0576120f0611edb565b500190565b6000600160ff1b82141561210b5761210b611edb565b5060000390565b600082612121576121216120b3565b500690565b600080831283600160ff1b0183128115161561214457612144611edb565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01831381161561217857612178611edb565b50500390565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038413811516156121b8576121b8611edb565b82600160ff1b0384128116156121d0576121d0611edb565b50500190565b600063ffffffff80831681811415611f0957611f09611edb565b600063ffffffff8381169083168181101561220d5761220d611edb565b039392505050565b600081518084526020808501945080840160005b83811015611d1157815187529582019590820190600101612229565b8781528660208201526001600160a01b038616604082015260e06060820152600061227360e0830187611cdd565b82810360808401526122858187612215565b905082810360a08401526122998186612215565b91505063ffffffff831660c083015298975050505050505050565b6000602082840312156122c657600080fd5b5051919050565b80518015158114611f9557600080fd5b6000602082840312156122ef57600080fd5b611d2f826122cd565b6000806040838503121561230b57600080fd5b612314836122cd565b9150602083015190509250929050565b60008282101561233657612336611edb565b500390565b60005b8381101561235657818101518382015260200161233e565b8381111561156c5750506000910152565b6000825161237981846020870161233b565b9190910192915050565b60208152600082518060208401526123a281604085016020870161233b565b601f01601f1916919091016040019291505056fea2646970667358221220166fc59748f913d5cbf6a808395d01417faa0af4c710425c8fe43993eb19ccb064736f6c634300080b0033

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

00000000000000000000000051e99a0d09eeca8d7efec3062ac024b6d0989959000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802000000000000000000000000f73ab2d782bf6ba97ac4405d2cd4f1135da8dbd900000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000000000000015700000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000150000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000023000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000250000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002700000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000072000000000000000000000000000000000000000000000000000000000000007500000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000ad00000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000e5000000000000000000000000000000000000000000000000000000000000011d0000000000000000000000000000000000000000000000000000000000000156

-----Decoded View---------------
Arg [0] : _bankroll (address): 0x51e99A0D09EeCa8d7EFEc3062AC024B6d0989959
Arg [1] : _vrf (address): 0xAE975071Be8F8eE67addBC1A82488F1C24858067
Arg [2] : link_eth_feed (address): 0x5787BefDc0ECd210Dfa948264631CD53E68F7802
Arg [3] : _forwarder (address): 0xF73ab2d782bf6BA97ac4405D2CD4F1135da8dbd9
Arg [4] : _multipliers (uint16[]): 5,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,10,10,12,12,20,20,45,100
Arg [5] : _outcomeNum (uint16[]): 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,114,117,171,173,228,229,285,342
Arg [6] : _numOutcomes (uint16): 343

-----Encoded View---------------
123 Constructor Arguments found :
Arg [0] : 00000000000000000000000051e99a0d09eeca8d7efec3062ac024b6d0989959
Arg [1] : 000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067
Arg [2] : 0000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802
Arg [3] : 000000000000000000000000f73ab2d782bf6ba97ac4405d2cd4f1135da8dbd9
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000820
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000157
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000039
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [18] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [20] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [21] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [22] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [24] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [25] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [26] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [27] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [28] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [29] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [30] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [31] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [32] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [33] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [34] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [35] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [36] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [37] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [38] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [39] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [40] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [41] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [42] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [43] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [44] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [45] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [46] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [47] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [48] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [49] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [50] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [51] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [52] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [53] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [54] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [55] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [56] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [57] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [58] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [59] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [60] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [61] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [62] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [63] : 000000000000000000000000000000000000000000000000000000000000002d
Arg [64] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [65] : 0000000000000000000000000000000000000000000000000000000000000039
Arg [66] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [67] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [68] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [69] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [70] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [71] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [72] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [73] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [74] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [75] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [76] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [77] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [78] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [79] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [80] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [81] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [82] : 0000000000000000000000000000000000000000000000000000000000000010
Arg [83] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [84] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [85] : 0000000000000000000000000000000000000000000000000000000000000013
Arg [86] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [87] : 0000000000000000000000000000000000000000000000000000000000000015
Arg [88] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [89] : 0000000000000000000000000000000000000000000000000000000000000017
Arg [90] : 0000000000000000000000000000000000000000000000000000000000000018
Arg [91] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [92] : 000000000000000000000000000000000000000000000000000000000000001a
Arg [93] : 000000000000000000000000000000000000000000000000000000000000001b
Arg [94] : 000000000000000000000000000000000000000000000000000000000000001c
Arg [95] : 000000000000000000000000000000000000000000000000000000000000001d
Arg [96] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [97] : 000000000000000000000000000000000000000000000000000000000000001f
Arg [98] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [99] : 0000000000000000000000000000000000000000000000000000000000000021
Arg [100] : 0000000000000000000000000000000000000000000000000000000000000022
Arg [101] : 0000000000000000000000000000000000000000000000000000000000000023
Arg [102] : 0000000000000000000000000000000000000000000000000000000000000024
Arg [103] : 0000000000000000000000000000000000000000000000000000000000000025
Arg [104] : 0000000000000000000000000000000000000000000000000000000000000026
Arg [105] : 0000000000000000000000000000000000000000000000000000000000000027
Arg [106] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [107] : 0000000000000000000000000000000000000000000000000000000000000029
Arg [108] : 000000000000000000000000000000000000000000000000000000000000002a
Arg [109] : 000000000000000000000000000000000000000000000000000000000000002b
Arg [110] : 000000000000000000000000000000000000000000000000000000000000002c
Arg [111] : 000000000000000000000000000000000000000000000000000000000000002d
Arg [112] : 000000000000000000000000000000000000000000000000000000000000002e
Arg [113] : 000000000000000000000000000000000000000000000000000000000000002f
Arg [114] : 0000000000000000000000000000000000000000000000000000000000000030
Arg [115] : 0000000000000000000000000000000000000000000000000000000000000072
Arg [116] : 0000000000000000000000000000000000000000000000000000000000000075
Arg [117] : 00000000000000000000000000000000000000000000000000000000000000ab
Arg [118] : 00000000000000000000000000000000000000000000000000000000000000ad
Arg [119] : 00000000000000000000000000000000000000000000000000000000000000e4
Arg [120] : 00000000000000000000000000000000000000000000000000000000000000e5
Arg [121] : 000000000000000000000000000000000000000000000000000000000000011d
Arg [122] : 0000000000000000000000000000000000000000000000000000000000000156


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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