POL Price: $0.127287 (-3.45%)
 

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Plinko_Play709103822025-04-29 19:35:30269 days ago1745955330IN
0xD971c040...0f229FAa0
5.12536293 POL0.0011936330.00279215
Plinko_Play709103692025-04-29 19:35:04269 days ago1745955304IN
0xD971c040...0f229FAa0
5.12536141 POL0.0011936430.00316485
Plinko_Play703175352025-04-15 4:14:47284 days ago1744690487IN
0xD971c040...0f229FAa0
3.11939736 POL0.0012104530.42555002
Plinko_Play699696572025-04-06 14:03:18292 days ago1743948198IN
0xD971c040...0f229FAa0
201.18412923 POL0.00956742240.48431772
Plinko_Play699696522025-04-06 14:03:08292 days ago1743948188IN
0xD971c040...0f229FAa0
200.76848641 POL0.01163224292.38506015
Plinko_Play699696452025-04-06 14:02:52292 days ago1743948172IN
0xD971c040...0f229FAa0
200.85613182 POL0.00981309246.65941128
Plinko_Play699696132025-04-06 14:01:44292 days ago1743948104IN
0xD971c040...0f229FAa0
200.89193449 POL0.01131768284.47842491
Plinko_Play699385462025-04-05 19:35:27293 days ago1743881727IN
0xD971c040...0f229FAa0
91.12206834 POL0.0012686931.88950005
Plinko_Play697661322025-04-01 13:24:19297 days ago1743513859IN
0xD971c040...0f229FAa0
0.22014732 POL0.00423748.04674391
Plinko_Play697661232025-04-01 13:23:59297 days ago1743513839IN
0xD971c040...0f229FAa0
0.21644757 POL0.0041064946.56684158
Plinko_Play697661082025-04-01 13:23:27297 days ago1743513807IN
0xD971c040...0f229FAa0
0.21906388 POL0.0041987847.61336459
Plinko_Play697571032025-04-01 8:04:26298 days ago1743494666IN
0xD971c040...0f229FAa0
0.25605819 POL0.0134668345.61208884
Plinko_Play697559482025-04-01 7:23:32298 days ago1743492212IN
0xD971c040...0f229FAa0
0.33911281 POL0.0232886178.87840443
Plinko_Play697557682025-04-01 7:17:10298 days ago1743491830IN
0xD971c040...0f229FAa0
0.4682234 POL0.03853641130.52263841
Plinko_Play697550202025-04-01 6:50:28298 days ago1743490228IN
0xD971c040...0f229FAa0
0.22034052 POL0.0092617431.36948653
Plinko_Play697549742025-04-01 6:48:50298 days ago1743490130IN
0xD971c040...0f229FAa0
0.21994406 POL0.0092149231.21090329
Plinko_Play694186092025-03-23 22:38:02306 days ago1742769482IN
0xD971c040...0f229FAa0
10.12004952 POL0.0091736831.07120722
Plinko_Play691607842025-03-17 13:15:35312 days ago1742217335IN
0xD971c040...0f229FAa0
5.11474244 POL0.0092241231.24205471
Plinko_Play690936202025-03-15 21:16:52314 days ago1742073412IN
0xD971c040...0f229FAa0
8.12360689 POL0.0102143634.59600002
Plinko_Play689734352025-03-12 21:51:13317 days ago1741816273IN
0xD971c040...0f229FAa0
115.40384142 POL0.0092194931.22637459
Plinko_Play689733722025-03-12 21:48:59317 days ago1741816139IN
0xD971c040...0f229FAa0
170.21384142 POL0.0088574130.00000002
Plinko_Play689733212025-03-12 21:47:11317 days ago1741816031IN
0xD971c040...0f229FAa0
210.11384142 POL0.0093160631.55347041
Plinko_Play689732472025-03-12 21:44:33317 days ago1741815873IN
0xD971c040...0f229FAa0
219.31384142 POL0.0090632730.69727461
Plinko_Play689731982025-03-12 21:42:49317 days ago1741815769IN
0xD971c040...0f229FAa0
158.51384142 POL0.0091526531.00000002
Plinko_Play689731542025-03-12 21:41:17317 days ago1741815677IN
0xD971c040...0f229FAa0
138.71384142 POL0.0092208531.23100002
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
697571102025-04-01 8:04:42298 days ago1743494682
0xD971c040...0f229FAa0
0.1 POL
697571032025-04-01 8:04:26298 days ago1743494666
0xD971c040...0f229FAa0
0.03121163 POL
697559542025-04-01 7:23:46298 days ago1743492226
0xD971c040...0f229FAa0
0.1 POL
697559482025-04-01 7:23:32298 days ago1743492212
0xD971c040...0f229FAa0
0.04782256 POL
697557762025-04-01 7:17:28298 days ago1743491848
0xD971c040...0f229FAa0
0.1 POL
697557682025-04-01 7:17:10298 days ago1743491830
0xD971c040...0f229FAa0
0.07364468 POL
697550262025-04-01 6:50:42298 days ago1743490242
0xD971c040...0f229FAa0
0.1 POL
697550202025-04-01 6:50:28298 days ago1743490228
0xD971c040...0f229FAa0
0.0240681 POL
697549812025-04-01 6:49:06298 days ago1743490146
0xD971c040...0f229FAa0
0.1 POL
697549742025-04-01 6:48:50298 days ago1743490130
0xD971c040...0f229FAa0
0.02398881 POL
694186162025-03-23 22:38:16306 days ago1742769496
0xD971c040...0f229FAa0
10 POL
694186092025-03-23 22:38:02306 days ago1742769482
0xD971c040...0f229FAa0
0.0240099 POL
691607922025-03-17 13:15:51312 days ago1742217351
0xD971c040...0f229FAa0
5 POL
691607842025-03-17 13:15:35312 days ago1742217335
0xD971c040...0f229FAa0
0.02051786 POL
690936262025-03-15 21:17:04314 days ago1742073424
0xD971c040...0f229FAa0
8 POL
690936202025-03-15 21:16:52314 days ago1742073412
0xD971c040...0f229FAa0
0.02183837 POL
689734422025-03-12 21:51:29317 days ago1741816289
0xD971c040...0f229FAa0
115.29 POL
689734352025-03-12 21:51:13317 days ago1741816273
0xD971c040...0f229FAa0
0.02011553 POL
689733782025-03-12 21:49:13317 days ago1741816153
0xD971c040...0f229FAa0
170.1 POL
689733722025-03-12 21:48:59317 days ago1741816139
0xD971c040...0f229FAa0
0.02256828 POL
689733282025-03-12 21:47:27317 days ago1741816047
0xD971c040...0f229FAa0
210 POL
689733212025-03-12 21:47:11317 days ago1741816031
0xD971c040...0f229FAa0
0.01946134 POL
689732542025-03-12 21:44:49317 days ago1741815889
0xD971c040...0f229FAa0
219.2 POL
689732472025-03-12 21:44:33317 days ago1741815873
0xD971c040...0f229FAa0
0.02117373 POL
689732042025-03-12 21:43:03317 days ago1741815783
0xD971c040...0f229FAa0
158.4 POL
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Plinko

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import "./Common.sol";

/**
 * @title plinko game, players select a number of rows and risk and get payouts depending on the final position of the ball
 */
contract Plinko is Common {
    using SafeERC20 for IERC20;

    constructor(
        address _bankroll,
        address _vrf,
        address link_eth_feed,
        address _forwarder
    ) {
        Bankroll = IBankRoll(_bankroll);
        IChainLinkVRF = IVRFCoordinatorV2(_vrf);
        LINK_ETH_FEED = AggregatorV3Interface(link_eth_feed);
        ChainLinkVRF = _vrf;
        _trustedForwarder = _forwarder;
        kellyFractions[0] = [
            573159,
            240816,
            372158,
            267835,
            453230,
            480140,
            327817,
            384356,
            467936
        ];
        kellyFractions[1] = [
            108157,
            100164,
            100856,
            82065,
            91981,
            83772,
            68092,
            69475,
            100288
        ];
        kellyFractions[2] = [
            31369,
            25998,
            38394,
            27787,
            29334,
            29004,
            22764,
            21439,
            27190
        ];
    }

    struct PlinkoGame {
        uint256 wager;
        uint256 stopGain;
        uint256 stopLoss;
        uint256 requestID;
        address tokenAddress;
        uint64 blockNumber;
        uint32 numBets;
        uint8 risk;
        uint8 numRows;
    }

    mapping(address => PlinkoGame) plinkoGames;
    mapping(uint256 => address) plinkoIDs;
    mapping(uint8 => mapping(uint8 => mapping(uint8 => uint256))) plinkoMultipliers;
    mapping(uint8 => mapping(uint8 => bool)) isMultiplierSet;
    uint256[9][3] kellyFractions;

    /**
     * @dev event emitted at the start of the game
     * @param playerAddress address of the player that made the bet
     * @param wager wager amount
     * @param tokenAddress address of token the wager was made and payout, 0 address is considered the native coin
     * @param numRows number of rows selected
     * @param risk risk selected
     * @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 Plinko_Play_Event(
        address indexed playerAddress,
        uint256 wager,
        address tokenAddress,
        uint8 numRows,
        uint8 risk,
        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 paths direction taken by the plinko ball at each row, true-> right, false->left
     * @param risk risk selected by player
     * @param payouts individual payouts for each bet
     * @param numGames number of games performed
     */
    event Plinko_Outcome_Event(
        address indexed playerAddress,
        uint256 wager,
        uint256 payout,
        address tokenAddress,
        uint16[] paths,
        uint8 numRows,
        uint8 risk,
        uint256[] payouts,
        uint32 numGames
    );

    /**
     * @dev event emitted when a refund is done in plinko
     * @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 Plinko_Refund_Event(
        address indexed player,
        uint256 wager,
        address tokenAddress
    );

    error AwaitingVRF(uint256 requestID);
    error InvalidNumRows();
    error InvalidRisk();
    error InvalidNumBets(uint256 maxNumBets);
    error OnlyCoordinatorCanFulfill(address have, address want);
    error WagerAboveLimit(uint256 wager, uint256 maxWager);
    error NotAwaitingVRF();
    error BlockNumberTooLow(uint256 have, uint256 want);
    error MismatchedLength(uint256 multipliers, uint256 outcome);
    error MultiplierAlreadySet(uint8 numRows, uint8 risk);
    error InvalidNumberToSet();

    /**
     * @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 Plinko_GetState(
        address player
    ) external view returns (PlinkoGame memory) {
        return (plinkoGames[player]);
    }

    /**
     * @dev function to view the current plinko multipliers
     * @return multipliers all multipliers for all rows and risks
     */
    function Plinko_GetMultipliers()
        external
        view
        returns (uint256[17][9][3] memory multipliers)
    {
        for (uint8 r = 0; r < 3; r++) {
            for (uint8 g = 0; g < 9; g++) {
                for (uint8 i = 0; i < 17; i++) {
                    multipliers[r][g][i] = plinkoMultipliers[r][g + 8][i];
                }
            }
        }
        return multipliers;
    }

    /**
     * @dev Function to play Plinko, 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
     * @param numRows number of Rows that plinko will have, range 8-16
     * @param risk risk for game, higher risk increases variance, range 0-2
     */
    function Plinko_Play(
        uint256 wager,
        address tokenAddress,
        uint8 numRows,
        uint8 risk,
        uint32 numBets,
        uint256 stopGain,
        uint256 stopLoss
    ) external payable nonReentrant {
        address msgSender = _msgSender();
        if (numRows < 8 || numRows > 16) {
            revert InvalidNumRows();
        }
        if (risk >= 3) {
            revert InvalidRisk();
        }
        if (plinkoGames[msgSender].requestID != 0) {
            revert AwaitingVRF(plinkoGames[msgSender].requestID);
        }
        if (!(numBets > 0 && numBets <= 100)) {
            revert InvalidNumBets(100);
        }

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

        plinkoGames[msgSender] = PlinkoGame(
            wager,
            stopGain,
            stopLoss,
            id,
            tokenAddress,
            uint64(block.number),
            numBets,
            risk,
            numRows
        );
        plinkoIDs[id] = msgSender;

        emit Plinko_Play_Event(
            msgSender,
            wager,
            tokenAddress,
            numRows,
            risk,
            numBets,
            stopGain,
            stopLoss,
            fee
        );
    }

    /**
     * @dev Function to refund user in case of VRF request failling
     */
    function Plinko_Refund() external nonReentrant {
        address msgSender = _msgSender();
        PlinkoGame storage game = plinkoGames[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 (plinkoIDs[game.requestID]);
        delete (plinkoGames[msgSender]);

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

    /**
     * @dev function to set the plinko multipliers, can only be called by bankroll owner
     * @param multipliers array of all multipliers for the selected number of rows and risk
     * @param numRows number of rows to set multiplier
     * @param risk risk to set multiplier
     */
    function setPlinkoMultipliers(
        uint256[] calldata multipliers,
        uint8 numRows,
        uint8 risk
    ) external {
        if (msg.sender != Bankroll.getOwner()) {
            revert NotOwner(Bankroll.getOwner(), msg.sender);
        }
        if (isMultiplierSet[risk][numRows]) {
            revert MultiplierAlreadySet(numRows, risk);
        }

        if (multipliers.length != numRows + 1) {
            revert MismatchedLength(multipliers.length, numRows + 1);
        }
        if (numRows < 8 || numRows > 16) {
            revert InvalidNumRows();
        }
        if (risk >= 3) {
            revert InvalidRisk();
        }

        for (uint8 i = 0; i < multipliers.length; i++) {
            plinkoMultipliers[risk][numRows][i] = multipliers[i];
        }
        isMultiplierSet[risk][numRows] = true;
    }

    /**
     * @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 = plinkoIDs[requestId];
        if (playerAddress == address(0)) revert();
        PlinkoGame storage game = plinkoGames[playerAddress];
        if (block.number > game.blockNumber + BLOCK_NUMBER_REFUND) revert();

        uint16[] memory gamesResults = new uint16[](game.numBets);
        uint256[] memory payouts = new uint256[](game.numBets);

        int256 totalValue;
        uint256 payout;
        uint32 i;
        uint256 multiplier;

        address tokenAddress = game.tokenAddress;

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

            (multiplier, gamesResults[i]) = _plinkoGame(
                randomWords[i],
                game.numRows,
                game.risk
            );

            payouts[i] = (game.wager * multiplier) / 100;
            payout += payouts[i];
            totalValue += int256(payouts[i]) - int256(game.wager);
        }

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

        emit Plinko_Outcome_Event(
            playerAddress,
            game.wager,
            payout,
            tokenAddress,
            gamesResults,
            game.numRows,
            game.risk,
            payouts,
            i
        );
        _transferToBankroll(tokenAddress, game.wager * game.numBets);
        delete (plinkoIDs[requestId]);
        delete (plinkoGames[playerAddress]);
        if (payout != 0) {
            _transferPayout(playerAddress, payout, tokenAddress);
        }
    }

    /**
     * @dev function to get result of individual plinko game
     * @param randomWords rng to determine the result
     * @param numRows number of rows of game
     * @param risk risk level selected
     */
    function _plinkoGame(
        uint256 randomWords,
        uint8 numRows,
        uint8 risk
    ) internal view returns (uint256 multiplier, uint16 currentGameResult) {
        int8 ended = 0;
        for (uint8 g = 0; g < numRows; g++) {
            bool bitValue = _getBitValue(randomWords, g);
            if (bitValue) {
                ended += 1;
                currentGameResult = setBit(currentGameResult, g);
            } else {
                ended -= 1;
            }
        }
        uint8 multiplierSlot = uint8(ended + int8(numRows)) >> 1;
        multiplier = plinkoMultipliers[risk][numRows][multiplierSlot];
    }

    function _getBitValue(
        uint256 four_nibbles,
        uint256 index
    ) internal pure returns (bool) {
        return (four_nibbles & (1 << index)) != 0;
    }

    uint16 internal constant ONE = uint16(1);

    // Sets the bit at the given 'index' in 'self' to '1'.
    // Returns the modified value.
    function setBit(uint16 self, uint8 index) internal pure returns (uint16) {
        return self | (ONE << index);
    }

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

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

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

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

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

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

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

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

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

API
[{"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"}],"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":[],"name":"InvalidNumRows","type":"error"},{"inputs":[],"name":"InvalidNumberToSet","type":"error"},{"inputs":[],"name":"InvalidRisk","type":"error"},{"inputs":[{"internalType":"uint256","name":"required","type":"uint256"},{"internalType":"uint256","name":"sent","type":"uint256"}],"name":"InvalidValue","type":"error"},{"inputs":[{"internalType":"uint256","name":"multipliers","type":"uint256"},{"internalType":"uint256","name":"outcome","type":"uint256"}],"name":"MismatchedLength","type":"error"},{"inputs":[{"internalType":"uint8","name":"numRows","type":"uint8"},{"internalType":"uint8","name":"risk","type":"uint8"}],"name":"MultiplierAlreadySet","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":"paths","type":"uint16[]"},{"indexed":false,"internalType":"uint8","name":"numRows","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"risk","type":"uint8"},{"indexed":false,"internalType":"uint256[]","name":"payouts","type":"uint256[]"},{"indexed":false,"internalType":"uint32","name":"numGames","type":"uint32"}],"name":"Plinko_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":"uint8","name":"numRows","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"risk","type":"uint8"},{"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":"Plinko_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":"Plinko_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":"Plinko_GetMultipliers","outputs":[{"internalType":"uint256[17][9][3]","name":"multipliers","type":"uint256[17][9][3]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"Plinko_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":"uint8","name":"risk","type":"uint8"},{"internalType":"uint8","name":"numRows","type":"uint8"}],"internalType":"struct Plinko.PlinkoGame","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"numRows","type":"uint8"},{"internalType":"uint8","name":"risk","type":"uint8"},{"internalType":"uint32","name":"numBets","type":"uint32"},{"internalType":"uint256","name":"stopGain","type":"uint256"},{"internalType":"uint256","name":"stopLoss","type":"uint256"}],"name":"Plinko_Play","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"Plinko_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":"uint256[]","name":"multipliers","type":"uint256[]"},{"internalType":"uint8","name":"numRows","type":"uint8"},{"internalType":"uint8","name":"risk","type":"uint8"}],"name":"setPlinkoMultipliers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162002d4238038062002d4283398101604081905262000034916200028d565b6001600055600680546001600160a01b038681166001600160a01b031992831617909255600580548684169083168117909155600480548685169084161790556002805483169091179055600380549284169290911691909117905560408051610120810182526208bee781526203acb060208201526205adbe918101919091526204163b60608201526206ea6e60808201526207538c60a08201526205008960c08201526205dd6460e0820152620723e0610100820152620000fc90600b906009620001d8565b5060408051610120810182526201a67d8152620187446020820152620189f8918101919091526201409160608201526201674d60808201526201473c60a0820152620109fc60c082015262010f6360e0820152620187c061010082015262000169906014906009620001d8565b506040805161012081018252617a89815261658e60208201526195fa91810191909152616c8b6060820152617296608082015261714c60a08201526158ec60c08201526153bf60e0820152616a36610100820152620001cd90601d90600962000222565b5050505050620002ea565b826009810192821562000210579160200282015b8281111562000210578251829062ffffff16905591602001919060010190620001ec565b506200021e92915062000259565b5090565b826009810192821562000210579160200282015b8281111562000210578251829061ffff1690559160200191906001019062000236565b5b808211156200021e57600081556001016200025a565b80516001600160a01b03811681146200028857600080fd5b919050565b60008060008060808587031215620002a457600080fd5b620002af8562000270565b9350620002bf6020860162000270565b9250620002cf6040860162000270565b9150620002df6060860162000270565b905092959194509250565b612a4880620002fa6000396000f3fe6080604052600436106100e85760003560e01c80636483adca1161008a578063aa73ce1e11610059578063aa73ce1e14610286578063ad17836114610397578063d0bcfc0c146103b7578063f5d37812146103d757600080fd5b80636483adca146102005780638bd16114146102225780638d7c16d214610250578063953995ea1461026657600080fd5b806352ebe739116100c657806352ebe7391461016c57806356c022bb14610181578063572b6c05146101a157806363dc4ef5146101e057600080fd5b80631fe543e3146100ed57806345b9394f1461010f5780634dd189d51461012f575b600080fd5b3480156100f957600080fd5b5061010d6101083660046120c8565b6103ea565b005b34801561011b57600080fd5b5061010d61012a3660046121a8565b610456565b34801561013b57600080fd5b5060055461014f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561017857600080fd5b5061010d610758565b34801561018d57600080fd5b5060035461014f906001600160a01b031681565b3480156101ad57600080fd5b506101d06101bc366004612252565b6003546001600160a01b0391821691161490565b6040519015158152602001610163565b3480156101ec57600080fd5b5061010d6101fb366004612252565b6109f7565b34801561020c57600080fd5b50610215610b6c565b6040516101639190612276565b34801561022e57600080fd5b5061024261023d3660046122fa565b610c73565b604051908152602001610163565b34801561025c57600080fd5b5061024260015481565b34801561027257600080fd5b5060025461014f906001600160a01b031681565b34801561029257600080fd5b5061038a6102a1366004612252565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810191909152506001600160a01b03908116600090815260076020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201549283166080820152600160a01b830467ffffffffffffffff1660a0820152600160e01b90920463ffffffff1660c08301526005015460ff80821660e084015261010091829004169082015290565b6040516101639190612313565b3480156103a357600080fd5b5060045461014f906001600160a01b031681565b3480156103c357600080fd5b5060065461014f906001600160a01b031681565b61010d6103e53660046123b6565b610dd4565b6002546001600160a01b03163314610448576002546040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b610452828261119c565b5050565b600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cd919061242c565b6001600160a01b0316336001600160a01b0316146105a057600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055c919061242c565b6040517f23295f0e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015233602482015260440161043f565b60ff8082166000908152600a6020908152604080832086851684529091529020541615610606576040517f9e278f4000000000000000000000000000000000000000000000000000000000815260ff80841660048301528216602482015260440161043f565b61061182600161245f565b60ff168314610664578261062683600161245f565b6040517f01653d4d000000000000000000000000000000000000000000000000000000008152600481019290925260ff16602482015260440161043f565b60088260ff161080610679575060108260ff16115b156106975760405163264097e760e01b815260040160405180910390fd5b60038160ff16106106bb57604051631bb6feab60e11b815260040160405180910390fd5b60005b60ff81168411156107265784848260ff168181106106de576106de612484565b60ff80861660009081526009602090815260408083208a851684528252808320938816835292815291902091029290920135909155508061071e8161249a565b9150506106be565b5060ff9081166000908152600a60209081526040808320949093168252929092529020805460ff191660011790555050565b610760611595565b600061076a6115ef565b6001600160a01b03811660009081526007602052604090206003810154919250906107c1576040517f49050b3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481015443906107e6906103e890600160a01b900467ffffffffffffffff166124ba565b6107f190600a6124ba565b67ffffffffffffffff1611156108765760048101544390610826906103e890600160a01b900467ffffffffffffffff166124ba565b61083190600a6124ba565b6040517fb4ae675a000000000000000000000000000000000000000000000000000000008152600481019290925267ffffffffffffffff16602482015260440161043f565b6004810154815460009161089891600160e01b90910463ffffffff16906124e6565b6004808401546003808601546000908152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038a8116845260079092528220828155600181018390556002810183905592830182905593820155600501805461ffff19169055919250168061098e576000846001600160a01b03168360405160006040518083038185875af1925050503d8060008114610961576040519150601f19603f3d011682016040523d82523d6000602084013e610966565b606091505b5050905080610988576040516312171d8360e31b815260040160405180910390fd5b506109a2565b6109a26001600160a01b0382168584611623565b604080518381526001600160a01b0383811660208301528616917f4f8e8cee8236ba6bfafb6ee32536c2b0b60e058fa752308d558d7b8fa146dca5910160405180910390a2505050506109f56001600055565b565b6109ff611595565b600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a76919061242c565b6001600160a01b0316336001600160a01b031614610ae157600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610538573d6000803e3d6000fd5b600180546000918290556040519091906001600160a01b0384169083908381818185875af1925050503d8060008114610b36576040519150601f19603f3d011682016040523d82523d6000602084013e610b3b565b606091505b5050905080610b5d576040516312171d8360e31b815260040160405180910390fd5b5050610b696001600055565b50565b610b74612038565b60005b60038160ff161015610c6f5760005b60098160ff161015610c5c5760005b60118160ff161015610c495760ff8316600090815260096020526040812090610bbf84600861245f565b60ff1660ff16815260200190815260200160002060008260ff1660ff16815260200190815260200160002054848460ff1660038110610c0057610c00612484565b60200201518360ff1660098110610c1957610c19612484565b60200201518260ff1660118110610c3257610c32612484565b602002015280610c418161249a565b915050610b95565b5080610c548161249a565b915050610b86565b5080610c678161249a565b915050610b77565b5090565b60048054604080517ffeaf968c000000000000000000000000000000000000000000000000000000008152905160009384936001600160a01b03169263feaf968c928183019260a0928290030181865afa158015610cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf9919061251f565b5050509150506000600560009054906101000a90046001600160a01b03166001600160a01b0316635fbbc0d26040518163ffffffff1660e01b815260040161012060405180830381865afa158015610d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d799190612582565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610da491906124e6565b610dae91906124e6565b610db89190612638565b610dc2853a6124e6565b610dcc919061265a565b949350505050565b610ddc611595565b6000610de66115ef565b905060088660ff161080610dfd575060108660ff16115b15610e1b5760405163264097e760e01b815260040160405180910390fd5b60038560ff1610610e3f57604051631bb6feab60e11b815260040160405180910390fd5b6001600160a01b03811660009081526007602052604090206003015415610eb3576001600160a01b038116600090815260076020526040908190206003015490517f440db96e000000000000000000000000000000000000000000000000000000008152600481019190915260240161043f565b60008463ffffffff16118015610ed0575060648463ffffffff1611155b610f09576040517f931074910000000000000000000000000000000000000000000000000000000081526064600482015260240161043f565b610f15888888886116d1565b6000610f3588610f2b63ffffffff88168c6124e6565b621e848085611821565b90506000610f4286611acb565b90506040518061012001604052808b81526020018681526020018581526020018281526020018a6001600160a01b031681526020014367ffffffffffffffff1681526020018763ffffffff1681526020018860ff1681526020018960ff1681525060076000856001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a08201518160040160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060c082015181600401601c6101000a81548163ffffffff021916908363ffffffff16021790555060e08201518160050160006101000a81548160ff021916908360ff1602179055506101008201518160050160016101000a81548160ff021916908360ff160217905550905050826008600083815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550826001600160a01b03167fa609597d378f54ccc88b6d97954f5dc34c0de8adeb6c382516a6f8cc1cd24c6b8b8b8b8b8b8b8b8a60405161117e9897969594939291909788526001600160a01b0396909616602088015260ff948516604088015292909316606086015263ffffffff16608085015260a084019190915260c083015260e08201526101000190565b60405180910390a25050506111936001600055565b50505050505050565b6000828152600860205260409020546001600160a01b0316806111be57600080fd5b6001600160a01b038116600090815260076020526040902060048101546111f9906103e890600160a01b900467ffffffffffffffff166124ba565b67ffffffffffffffff1643111561120f57600080fd5b6004810154600090600160e01b900463ffffffff1667ffffffffffffffff81111561123c5761123c6120b2565b604051908082528060200260200182016040528015611265578160200160208202803683370190505b506004830154909150600090600160e01b900463ffffffff1667ffffffffffffffff811115611296576112966120b2565b6040519080825280602002602001820160405280156112bf578160200160208202803683370190505b5060048401549091506000908190819081906001600160a01b03165b600488015463ffffffff600160e01b90910481169084161015611446578760010154851261130857611446565b876002015461131690612672565b851361132157611446565b61135c8a8463ffffffff168151811061133c5761133c612484565b602090810291909101015160058a015460ff610100820481169116611b9d565b888563ffffffff168151811061137457611374612484565b602002602001018161ffff1661ffff168152508193505050606482896000015461139e91906124e6565b6113a89190612638565b868463ffffffff16815181106113c0576113c0612484565b602002602001018181525050858363ffffffff16815181106113e4576113e4612484565b6020026020010151846113f7919061265a565b93508760000154868463ffffffff168151811061141657611416612484565b6020026020010151611428919061268f565b61143290866126e7565b94508261143e8161273f565b9350506112db565b87546004890154611465908590600160e01b900463ffffffff16612763565b63ffffffff1661147591906124e6565b61147f908561265a565b885460058a01546040519296506001600160a01b038c16927f8e67907f20e5ba79f864289caa2ebae12b7009e941bc3ad33cd47340fd1b523c926114db929091899187918e9160ff61010082048116929116908f908d906127c3565b60405180910390a26004880154885461150c91839161150791600160e01b900463ffffffff16906124e6565b611c4c565b60008b8152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038c168352600790915281208181556001810182905560028101829055600381018290556004810191909155600501805461ffff19169055831561158857611588898583611ce8565b5050505050505050505050565b600260005414156115e85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161043f565b6002600055565b60006014361080159061160c57506003546001600160a01b031633145b1561161e575060131936013560601c90565b503390565b6040516001600160a01b0383166024820152604481018290526116cc9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611d6b565b505050565b60006001600160a01b0384166116f457506006546001600160a01b03163161177e565b6006546040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152908516906370a0823190602401602060405180830381865afa158015611757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177b9190612869565b90505b60006305f5e100600b8460ff166003811061179b5761179b612484565b600902016117aa600887612882565b60ff16600981106117bd576117bd612484565b01546117c990846124e6565b6117d39190612638565b905080861115611819576040517fd53662aa000000000000000000000000000000000000000000000000000000008152600481018790526024810182905260440161043f565b505050505050565b6006546040517fbfd7f9cc0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038681166024830152600092169063bfd7f9cc90604401602060405180830381865afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118af91906128b5565b6118e5576040517f51c3b94f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8361191c576040517f07375c8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546040517f0a5748a80000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526000928392911690630a5748a8906024016040805180830381865afa158015611982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a691906128d0565b9150915081156119e5576040517f6c2775f50000000000000000000000000000000000000000000000000000000081526004810182905260240161043f565b6119ee85610c73565b92506001600160a01b038716611a5d57611a08838761265a565b341015611a3c57611a19838761265a565b60405163de9b74a160e01b8152600481019190915234602482015260440161043f565b611a58611a49878561265a565b611a5390346128fc565b611e50565b611aa9565b82341015611a875760405163de9b74a160e01b81526004810184905234602482015260440161043f565b611a9c6001600160a01b038816853089611ec1565b611aa9611a5384346128fc565b8260016000828254611abb919061265a565b9091555092979650505050505050565b6002546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081527fd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a86004820152610240602482015260036044820152622625a0606482015263ffffffff831660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b979190612869565b92915050565b6000806000805b8560ff168160ff161015611c0157600160ff82161b871615801590611be057611bce600184612913565b9250600160ff83161b84179350611bee565b611beb600184612956565b92505b5080611bf98161249a565b915050611ba4565b5060006001611c108784612913565b60ff96871660009081526009602090815260408083209a8a16835299815289822092891690931c90971687529052505092909120549391925050565b6001600160a01b038216611cce576006546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611ca7576040519150601f19603f3d011682016040523d82523d6000602084013e611cac565b606091505b50509050806116cc57604051633c31275160e21b815260040160405180910390fd5b600654610452906001600160a01b03848116911683611623565b6006546040517f6c025ec20000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b158015611d5757600080fd5b505af1158015611193573d6000803e3d6000fd5b6000611dc0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f189092919063ffffffff16565b8051909150156116cc5780806020019051810190611dde91906128b5565b6116cc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161043f565b80611e585750565b604051600090339083908381818185875af1925050503d8060008114611e9a576040519150601f19603f3d011682016040523d82523d6000602084013e611e9f565b606091505b505090508061045257604051633c31275160e21b815260040160405180910390fd5b6040516001600160a01b0380851660248301528316604482015260648101829052611f129085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611668565b50505050565b6060610dcc848460008585600080866001600160a01b03168587604051611f3f91906129c3565b60006040518083038185875af1925050503d8060008114611f7c576040519150601f19603f3d011682016040523d82523d6000602084013e611f81565b606091505b5091509150611f9287838387611f9d565b979650505050505050565b60608315612009578251612002576001600160a01b0385163b6120025760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043f565b5081610dcc565b610dcc838381511561201e5781518083602001fd5b8060405162461bcd60e51b815260040161043f91906129df565b60405180606001604052806003905b61204f612065565b8152602001906001900390816120475790505090565b6040518061012001604052806009905b61207d612093565b8152602001906001900390816120755790505090565b6040518061022001604052806011906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156120db57600080fd5b8235915060208084013567ffffffffffffffff808211156120fb57600080fd5b818601915086601f83011261210f57600080fd5b813581811115612121576121216120b2565b8060051b604051601f19603f83011681018181108582111715612146576121466120b2565b60405291825284820192508381018501918983111561216457600080fd5b938501935b8285101561218257843584529385019392850192612169565b8096505050505050509250929050565b803560ff811681146121a357600080fd5b919050565b600080600080606085870312156121be57600080fd5b843567ffffffffffffffff808211156121d657600080fd5b818701915087601f8301126121ea57600080fd5b8135818111156121f957600080fd5b8860208260051b850101111561220e57600080fd5b6020928301965094506122249187019050612192565b915061223260408601612192565b905092959194509250565b6001600160a01b0381168114610b6957600080fd5b60006020828403121561226457600080fd5b813561226f8161223d565b9392505050565b6139608101818360005b60038110156122f15781518360005b60098110156122d75782518260005b60118110156122bd57825182526020928301929091019060010161229e565b50505060209290920191610220919091019060010161228f565b505050611320929092019160209190910190600101612280565b50505092915050565b60006020828403121561230c57600080fd5b5035919050565b600061012082019050825182526020830151602083015260408301516040830152606083015160608301526001600160a01b03608084015116608083015267ffffffffffffffff60a08401511660a083015260c083015161237c60c084018263ffffffff169052565b5060e083015161239160e084018260ff169052565b506101009283015160ff16919092015290565b63ffffffff81168114610b6957600080fd5b600080600080600080600060e0888a0312156123d157600080fd5b8735965060208801356123e38161223d565b95506123f160408901612192565b94506123ff60608901612192565b9350608088013561240f816123a4565b9699959850939692959460a0840135945060c09093013592915050565b60006020828403121561243e57600080fd5b815161226f8161223d565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff84168060ff0382111561247c5761247c612449565b019392505050565b634e487b7160e01b600052603260045260246000fd5b600060ff821660ff8114156124b1576124b1612449565b60010192915050565b600067ffffffffffffffff8083168185168083038211156124dd576124dd612449565b01949350505050565b600081600019048311821515161561250057612500612449565b500290565b805169ffffffffffffffffffff811681146121a357600080fd5b600080600080600060a0868803121561253757600080fd5b61254086612505565b945060208601519350604086015192506060860151915061256360808701612505565b90509295509295909350565b805162ffffff811681146121a357600080fd5b60008060008060008060008060006101208a8c0312156125a157600080fd5b89516125ac816123a4565b60208b01519099506125bd816123a4565b60408b01519098506125ce816123a4565b60608b01519097506125df816123a4565b60808b01519096506125f0816123a4565b94506125fe60a08b0161256f565b935061260c60c08b0161256f565b925061261a60e08b0161256f565b91506126296101008b0161256f565b90509295985092959850929598565b60008261265557634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561266d5761266d612449565b500190565b6000600160ff1b82141561268857612688612449565b5060000390565b600080831283600160ff1b018312811516156126ad576126ad612449565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0183138116156126e1576126e1612449565b50500390565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0384138115161561272157612721612449565b82600160ff1b03841281161561273957612739612449565b50500190565b600063ffffffff8083168181141561275957612759612449565b6001019392505050565b600063ffffffff8381169083168181101561278057612780612449565b039392505050565b600081518084526020808501945080840160005b838110156127b85781518752958201959082019060010161279c565b509495945050505050565b88815260208082018990526001600160a01b03881660408301526101006060830181905287519083018190526000916101208401918982019190845b8181101561281f57835161ffff16855293820193928201926001016127ff565b50505060ff881660808501525060ff861660a084015282810360c08401526128478186612788565b91505061285c60e083018463ffffffff169052565b9998505050505050505050565b60006020828403121561287b57600080fd5b5051919050565b600060ff821660ff84168082101561289c5761289c612449565b90039392505050565b805180151581146121a357600080fd5b6000602082840312156128c757600080fd5b61226f826128a5565b600080604083850312156128e357600080fd5b6128ec836128a5565b9150602083015190509250929050565b60008282101561290e5761290e612449565b500390565b60008160000b8360000b6000821282607f0382138115161561293757612937612449565b82607f1903821281161561294d5761294d612449565b50019392505050565b600081810b83820b8281128015607f1983018412161561297857612978612449565b81607f01831381161561298d5761298d612449565b5090039392505050565b60005b838110156129b257818101518382015260200161299a565b83811115611f125750506000910152565b600082516129d5818460208701612997565b9190910192915050565b60208152600082518060208401526129fe816040850160208701612997565b601f01601f1916919091016040019291505056fea26469706673582212206eba83535b8a778df3f3149a7d45e7748e02d0676bba0afc6252c807d30d7d5c64736f6c634300080b003300000000000000000000000051e99a0d09eeca8d7efec3062ac024b6d0989959000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802000000000000000000000000f73ab2d782bf6ba97ac4405d2cd4f1135da8dbd9

Deployed Bytecode

0x6080604052600436106100e85760003560e01c80636483adca1161008a578063aa73ce1e11610059578063aa73ce1e14610286578063ad17836114610397578063d0bcfc0c146103b7578063f5d37812146103d757600080fd5b80636483adca146102005780638bd16114146102225780638d7c16d214610250578063953995ea1461026657600080fd5b806352ebe739116100c657806352ebe7391461016c57806356c022bb14610181578063572b6c05146101a157806363dc4ef5146101e057600080fd5b80631fe543e3146100ed57806345b9394f1461010f5780634dd189d51461012f575b600080fd5b3480156100f957600080fd5b5061010d6101083660046120c8565b6103ea565b005b34801561011b57600080fd5b5061010d61012a3660046121a8565b610456565b34801561013b57600080fd5b5060055461014f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561017857600080fd5b5061010d610758565b34801561018d57600080fd5b5060035461014f906001600160a01b031681565b3480156101ad57600080fd5b506101d06101bc366004612252565b6003546001600160a01b0391821691161490565b6040519015158152602001610163565b3480156101ec57600080fd5b5061010d6101fb366004612252565b6109f7565b34801561020c57600080fd5b50610215610b6c565b6040516101639190612276565b34801561022e57600080fd5b5061024261023d3660046122fa565b610c73565b604051908152602001610163565b34801561025c57600080fd5b5061024260015481565b34801561027257600080fd5b5060025461014f906001600160a01b031681565b34801561029257600080fd5b5061038a6102a1366004612252565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810191909152506001600160a01b03908116600090815260076020908152604091829020825161012081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201549283166080820152600160a01b830467ffffffffffffffff1660a0820152600160e01b90920463ffffffff1660c08301526005015460ff80821660e084015261010091829004169082015290565b6040516101639190612313565b3480156103a357600080fd5b5060045461014f906001600160a01b031681565b3480156103c357600080fd5b5060065461014f906001600160a01b031681565b61010d6103e53660046123b6565b610dd4565b6002546001600160a01b03163314610448576002546040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b610452828261119c565b5050565b600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cd919061242c565b6001600160a01b0316336001600160a01b0316146105a057600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055c919061242c565b6040517f23295f0e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015233602482015260440161043f565b60ff8082166000908152600a6020908152604080832086851684529091529020541615610606576040517f9e278f4000000000000000000000000000000000000000000000000000000000815260ff80841660048301528216602482015260440161043f565b61061182600161245f565b60ff168314610664578261062683600161245f565b6040517f01653d4d000000000000000000000000000000000000000000000000000000008152600481019290925260ff16602482015260440161043f565b60088260ff161080610679575060108260ff16115b156106975760405163264097e760e01b815260040160405180910390fd5b60038160ff16106106bb57604051631bb6feab60e11b815260040160405180910390fd5b60005b60ff81168411156107265784848260ff168181106106de576106de612484565b60ff80861660009081526009602090815260408083208a851684528252808320938816835292815291902091029290920135909155508061071e8161249a565b9150506106be565b5060ff9081166000908152600a60209081526040808320949093168252929092529020805460ff191660011790555050565b610760611595565b600061076a6115ef565b6001600160a01b03811660009081526007602052604090206003810154919250906107c1576040517f49050b3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481015443906107e6906103e890600160a01b900467ffffffffffffffff166124ba565b6107f190600a6124ba565b67ffffffffffffffff1611156108765760048101544390610826906103e890600160a01b900467ffffffffffffffff166124ba565b61083190600a6124ba565b6040517fb4ae675a000000000000000000000000000000000000000000000000000000008152600481019290925267ffffffffffffffff16602482015260440161043f565b6004810154815460009161089891600160e01b90910463ffffffff16906124e6565b6004808401546003808601546000908152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038a8116845260079092528220828155600181018390556002810183905592830182905593820155600501805461ffff19169055919250168061098e576000846001600160a01b03168360405160006040518083038185875af1925050503d8060008114610961576040519150601f19603f3d011682016040523d82523d6000602084013e610966565b606091505b5050905080610988576040516312171d8360e31b815260040160405180910390fd5b506109a2565b6109a26001600160a01b0382168584611623565b604080518381526001600160a01b0383811660208301528616917f4f8e8cee8236ba6bfafb6ee32536c2b0b60e058fa752308d558d7b8fa146dca5910160405180910390a2505050506109f56001600055565b565b6109ff611595565b600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a76919061242c565b6001600160a01b0316336001600160a01b031614610ae157600660009054906101000a90046001600160a01b03166001600160a01b031663893d20e86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610538573d6000803e3d6000fd5b600180546000918290556040519091906001600160a01b0384169083908381818185875af1925050503d8060008114610b36576040519150601f19603f3d011682016040523d82523d6000602084013e610b3b565b606091505b5050905080610b5d576040516312171d8360e31b815260040160405180910390fd5b5050610b696001600055565b50565b610b74612038565b60005b60038160ff161015610c6f5760005b60098160ff161015610c5c5760005b60118160ff161015610c495760ff8316600090815260096020526040812090610bbf84600861245f565b60ff1660ff16815260200190815260200160002060008260ff1660ff16815260200190815260200160002054848460ff1660038110610c0057610c00612484565b60200201518360ff1660098110610c1957610c19612484565b60200201518260ff1660118110610c3257610c32612484565b602002015280610c418161249a565b915050610b95565b5080610c548161249a565b915050610b86565b5080610c678161249a565b915050610b77565b5090565b60048054604080517ffeaf968c000000000000000000000000000000000000000000000000000000008152905160009384936001600160a01b03169263feaf968c928183019260a0928290030181865afa158015610cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf9919061251f565b5050509150506000600560009054906101000a90046001600160a01b03166001600160a01b0316635fbbc0d26040518163ffffffff1660e01b815260040161012060405180830381865afa158015610d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d799190612582565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610da491906124e6565b610dae91906124e6565b610db89190612638565b610dc2853a6124e6565b610dcc919061265a565b949350505050565b610ddc611595565b6000610de66115ef565b905060088660ff161080610dfd575060108660ff16115b15610e1b5760405163264097e760e01b815260040160405180910390fd5b60038560ff1610610e3f57604051631bb6feab60e11b815260040160405180910390fd5b6001600160a01b03811660009081526007602052604090206003015415610eb3576001600160a01b038116600090815260076020526040908190206003015490517f440db96e000000000000000000000000000000000000000000000000000000008152600481019190915260240161043f565b60008463ffffffff16118015610ed0575060648463ffffffff1611155b610f09576040517f931074910000000000000000000000000000000000000000000000000000000081526064600482015260240161043f565b610f15888888886116d1565b6000610f3588610f2b63ffffffff88168c6124e6565b621e848085611821565b90506000610f4286611acb565b90506040518061012001604052808b81526020018681526020018581526020018281526020018a6001600160a01b031681526020014367ffffffffffffffff1681526020018763ffffffff1681526020018860ff1681526020018960ff1681525060076000856001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a08201518160040160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060c082015181600401601c6101000a81548163ffffffff021916908363ffffffff16021790555060e08201518160050160006101000a81548160ff021916908360ff1602179055506101008201518160050160016101000a81548160ff021916908360ff160217905550905050826008600083815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550826001600160a01b03167fa609597d378f54ccc88b6d97954f5dc34c0de8adeb6c382516a6f8cc1cd24c6b8b8b8b8b8b8b8b8a60405161117e9897969594939291909788526001600160a01b0396909616602088015260ff948516604088015292909316606086015263ffffffff16608085015260a084019190915260c083015260e08201526101000190565b60405180910390a25050506111936001600055565b50505050505050565b6000828152600860205260409020546001600160a01b0316806111be57600080fd5b6001600160a01b038116600090815260076020526040902060048101546111f9906103e890600160a01b900467ffffffffffffffff166124ba565b67ffffffffffffffff1643111561120f57600080fd5b6004810154600090600160e01b900463ffffffff1667ffffffffffffffff81111561123c5761123c6120b2565b604051908082528060200260200182016040528015611265578160200160208202803683370190505b506004830154909150600090600160e01b900463ffffffff1667ffffffffffffffff811115611296576112966120b2565b6040519080825280602002602001820160405280156112bf578160200160208202803683370190505b5060048401549091506000908190819081906001600160a01b03165b600488015463ffffffff600160e01b90910481169084161015611446578760010154851261130857611446565b876002015461131690612672565b851361132157611446565b61135c8a8463ffffffff168151811061133c5761133c612484565b602090810291909101015160058a015460ff610100820481169116611b9d565b888563ffffffff168151811061137457611374612484565b602002602001018161ffff1661ffff168152508193505050606482896000015461139e91906124e6565b6113a89190612638565b868463ffffffff16815181106113c0576113c0612484565b602002602001018181525050858363ffffffff16815181106113e4576113e4612484565b6020026020010151846113f7919061265a565b93508760000154868463ffffffff168151811061141657611416612484565b6020026020010151611428919061268f565b61143290866126e7565b94508261143e8161273f565b9350506112db565b87546004890154611465908590600160e01b900463ffffffff16612763565b63ffffffff1661147591906124e6565b61147f908561265a565b885460058a01546040519296506001600160a01b038c16927f8e67907f20e5ba79f864289caa2ebae12b7009e941bc3ad33cd47340fd1b523c926114db929091899187918e9160ff61010082048116929116908f908d906127c3565b60405180910390a26004880154885461150c91839161150791600160e01b900463ffffffff16906124e6565b611c4c565b60008b8152600860209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001600160a01b038c168352600790915281208181556001810182905560028101829055600381018290556004810191909155600501805461ffff19169055831561158857611588898583611ce8565b5050505050505050505050565b600260005414156115e85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161043f565b6002600055565b60006014361080159061160c57506003546001600160a01b031633145b1561161e575060131936013560601c90565b503390565b6040516001600160a01b0383166024820152604481018290526116cc9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611d6b565b505050565b60006001600160a01b0384166116f457506006546001600160a01b03163161177e565b6006546040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152908516906370a0823190602401602060405180830381865afa158015611757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177b9190612869565b90505b60006305f5e100600b8460ff166003811061179b5761179b612484565b600902016117aa600887612882565b60ff16600981106117bd576117bd612484565b01546117c990846124e6565b6117d39190612638565b905080861115611819576040517fd53662aa000000000000000000000000000000000000000000000000000000008152600481018790526024810182905260440161043f565b505050505050565b6006546040517fbfd7f9cc0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038681166024830152600092169063bfd7f9cc90604401602060405180830381865afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118af91906128b5565b6118e5576040517f51c3b94f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8361191c576040517f07375c8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546040517f0a5748a80000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526000928392911690630a5748a8906024016040805180830381865afa158015611982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a691906128d0565b9150915081156119e5576040517f6c2775f50000000000000000000000000000000000000000000000000000000081526004810182905260240161043f565b6119ee85610c73565b92506001600160a01b038716611a5d57611a08838761265a565b341015611a3c57611a19838761265a565b60405163de9b74a160e01b8152600481019190915234602482015260440161043f565b611a58611a49878561265a565b611a5390346128fc565b611e50565b611aa9565b82341015611a875760405163de9b74a160e01b81526004810184905234602482015260440161043f565b611a9c6001600160a01b038816853089611ec1565b611aa9611a5384346128fc565b8260016000828254611abb919061265a565b9091555092979650505050505050565b6002546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081527fd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a86004820152610240602482015260036044820152622625a0606482015263ffffffff831660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b979190612869565b92915050565b6000806000805b8560ff168160ff161015611c0157600160ff82161b871615801590611be057611bce600184612913565b9250600160ff83161b84179350611bee565b611beb600184612956565b92505b5080611bf98161249a565b915050611ba4565b5060006001611c108784612913565b60ff96871660009081526009602090815260408083209a8a16835299815289822092891690931c90971687529052505092909120549391925050565b6001600160a01b038216611cce576006546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611ca7576040519150601f19603f3d011682016040523d82523d6000602084013e611cac565b606091505b50509050806116cc57604051633c31275160e21b815260040160405180910390fd5b600654610452906001600160a01b03848116911683611623565b6006546040517f6c025ec20000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b158015611d5757600080fd5b505af1158015611193573d6000803e3d6000fd5b6000611dc0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f189092919063ffffffff16565b8051909150156116cc5780806020019051810190611dde91906128b5565b6116cc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161043f565b80611e585750565b604051600090339083908381818185875af1925050503d8060008114611e9a576040519150601f19603f3d011682016040523d82523d6000602084013e611e9f565b606091505b505090508061045257604051633c31275160e21b815260040160405180910390fd5b6040516001600160a01b0380851660248301528316604482015260648101829052611f129085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611668565b50505050565b6060610dcc848460008585600080866001600160a01b03168587604051611f3f91906129c3565b60006040518083038185875af1925050503d8060008114611f7c576040519150601f19603f3d011682016040523d82523d6000602084013e611f81565b606091505b5091509150611f9287838387611f9d565b979650505050505050565b60608315612009578251612002576001600160a01b0385163b6120025760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043f565b5081610dcc565b610dcc838381511561201e5781518083602001fd5b8060405162461bcd60e51b815260040161043f91906129df565b60405180606001604052806003905b61204f612065565b8152602001906001900390816120475790505090565b6040518061012001604052806009905b61207d612093565b8152602001906001900390816120755790505090565b6040518061022001604052806011906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156120db57600080fd5b8235915060208084013567ffffffffffffffff808211156120fb57600080fd5b818601915086601f83011261210f57600080fd5b813581811115612121576121216120b2565b8060051b604051601f19603f83011681018181108582111715612146576121466120b2565b60405291825284820192508381018501918983111561216457600080fd5b938501935b8285101561218257843584529385019392850192612169565b8096505050505050509250929050565b803560ff811681146121a357600080fd5b919050565b600080600080606085870312156121be57600080fd5b843567ffffffffffffffff808211156121d657600080fd5b818701915087601f8301126121ea57600080fd5b8135818111156121f957600080fd5b8860208260051b850101111561220e57600080fd5b6020928301965094506122249187019050612192565b915061223260408601612192565b905092959194509250565b6001600160a01b0381168114610b6957600080fd5b60006020828403121561226457600080fd5b813561226f8161223d565b9392505050565b6139608101818360005b60038110156122f15781518360005b60098110156122d75782518260005b60118110156122bd57825182526020928301929091019060010161229e565b50505060209290920191610220919091019060010161228f565b505050611320929092019160209190910190600101612280565b50505092915050565b60006020828403121561230c57600080fd5b5035919050565b600061012082019050825182526020830151602083015260408301516040830152606083015160608301526001600160a01b03608084015116608083015267ffffffffffffffff60a08401511660a083015260c083015161237c60c084018263ffffffff169052565b5060e083015161239160e084018260ff169052565b506101009283015160ff16919092015290565b63ffffffff81168114610b6957600080fd5b600080600080600080600060e0888a0312156123d157600080fd5b8735965060208801356123e38161223d565b95506123f160408901612192565b94506123ff60608901612192565b9350608088013561240f816123a4565b9699959850939692959460a0840135945060c09093013592915050565b60006020828403121561243e57600080fd5b815161226f8161223d565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff84168060ff0382111561247c5761247c612449565b019392505050565b634e487b7160e01b600052603260045260246000fd5b600060ff821660ff8114156124b1576124b1612449565b60010192915050565b600067ffffffffffffffff8083168185168083038211156124dd576124dd612449565b01949350505050565b600081600019048311821515161561250057612500612449565b500290565b805169ffffffffffffffffffff811681146121a357600080fd5b600080600080600060a0868803121561253757600080fd5b61254086612505565b945060208601519350604086015192506060860151915061256360808701612505565b90509295509295909350565b805162ffffff811681146121a357600080fd5b60008060008060008060008060006101208a8c0312156125a157600080fd5b89516125ac816123a4565b60208b01519099506125bd816123a4565b60408b01519098506125ce816123a4565b60608b01519097506125df816123a4565b60808b01519096506125f0816123a4565b94506125fe60a08b0161256f565b935061260c60c08b0161256f565b925061261a60e08b0161256f565b91506126296101008b0161256f565b90509295985092959850929598565b60008261265557634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561266d5761266d612449565b500190565b6000600160ff1b82141561268857612688612449565b5060000390565b600080831283600160ff1b018312811516156126ad576126ad612449565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0183138116156126e1576126e1612449565b50500390565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0384138115161561272157612721612449565b82600160ff1b03841281161561273957612739612449565b50500190565b600063ffffffff8083168181141561275957612759612449565b6001019392505050565b600063ffffffff8381169083168181101561278057612780612449565b039392505050565b600081518084526020808501945080840160005b838110156127b85781518752958201959082019060010161279c565b509495945050505050565b88815260208082018990526001600160a01b03881660408301526101006060830181905287519083018190526000916101208401918982019190845b8181101561281f57835161ffff16855293820193928201926001016127ff565b50505060ff881660808501525060ff861660a084015282810360c08401526128478186612788565b91505061285c60e083018463ffffffff169052565b9998505050505050505050565b60006020828403121561287b57600080fd5b5051919050565b600060ff821660ff84168082101561289c5761289c612449565b90039392505050565b805180151581146121a357600080fd5b6000602082840312156128c757600080fd5b61226f826128a5565b600080604083850312156128e357600080fd5b6128ec836128a5565b9150602083015190509250929050565b60008282101561290e5761290e612449565b500390565b60008160000b8360000b6000821282607f0382138115161561293757612937612449565b82607f1903821281161561294d5761294d612449565b50019392505050565b600081810b83820b8281128015607f1983018412161561297857612978612449565b81607f01831381161561298d5761298d612449565b5090039392505050565b60005b838110156129b257818101518382015260200161299a565b83811115611f125750506000910152565b600082516129d5818460208701612997565b9190910192915050565b60208152600082518060208401526129fe816040850160208701612997565b601f01601f1916919091016040019291505056fea26469706673582212206eba83535b8a778df3f3149a7d45e7748e02d0676bba0afc6252c807d30d7d5c64736f6c634300080b0033

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

00000000000000000000000051e99a0d09eeca8d7efec3062ac024b6d0989959000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802000000000000000000000000f73ab2d782bf6ba97ac4405d2cd4f1135da8dbd9

-----Decoded View---------------
Arg [0] : _bankroll (address): 0x51e99A0D09EeCa8d7EFEc3062AC024B6d0989959
Arg [1] : _vrf (address): 0xAE975071Be8F8eE67addBC1A82488F1C24858067
Arg [2] : link_eth_feed (address): 0x5787BefDc0ECd210Dfa948264631CD53E68F7802
Arg [3] : _forwarder (address): 0xF73ab2d782bf6BA97ac4405D2CD4F1135da8dbd9

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000051e99a0d09eeca8d7efec3062ac024b6d0989959
Arg [1] : 000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067
Arg [2] : 0000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802
Arg [3] : 000000000000000000000000f73ab2d782bf6ba97ac4405d2cd4f1135da8dbd9


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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