MATIC Price: $0.745601 (+9.27%)
Gas: 64 GWei
 

Sponsored

Transaction Hash
Method
Block
From
To
Value
Collect Vrf Fee549103682024-03-21 10:06:1761 days ago1711015577IN
0x8C88C581...dA8329270
0 MATIC0.0031182381.15319752
Collect Vrf Fee549101132024-03-21 9:56:1161 days ago1711014971IN
0x8C88C581...dA8329270
0 MATIC0.0035360181.99639826
Play548700652024-03-20 7:37:2962 days ago1710920249IN
0x8C88C581...dA8329270
0.1610223 MATIC0.02946449109.61492074
Play548700412024-03-20 7:36:2562 days ago1710920185IN
0x8C88C581...dA8329270
0.14119272 MATIC0.02884885107.32462061
Play548700282024-03-20 7:35:3762 days ago1710920137IN
0x8C88C581...dA8329270
0.13345157 MATIC0.0241673789.91240589
Play548700092024-03-20 7:34:5762 days ago1710920097IN
0x8C88C581...dA8329270
0.14537689 MATIC0.0266562799.17211765
Play548699912024-03-20 7:34:1962 days ago1710920059IN
0x8C88C581...dA8329270
0.14919027 MATIC0.02763952102.83020713
Play548699622024-03-20 7:33:0762 days ago1710919987IN
0x8C88C581...dA8329270
0.14118215 MATIC0.02813339104.66292652
Play548384562024-03-19 11:27:2063 days ago1710847640IN
0x8C88C581...dA8329270
0.26104061 MATIC0.05150445191.6088325
Play548384272024-03-19 11:26:1863 days ago1710847578IN
0x8C88C581...dA8329270
0.22536432 MATIC0.04551087169.31130535
Play548261672024-03-19 3:11:1663 days ago1710817876IN
0x8C88C581...dA8329270
0.0738702 MATIC0.0144574453.78755578
Play548261472024-03-19 3:10:3463 days ago1710817834IN
0x8C88C581...dA8329270
0.07726528 MATIC0.0152583956.76740354
Play548261172024-03-19 3:09:3063 days ago1710817770IN
0x8C88C581...dA8329270
0.07883144 MATIC0.0158607559.00840303
Play548260972024-03-19 3:08:4863 days ago1710817728IN
0x8C88C581...dA8329270
0.08379706 MATIC0.0168430862.66309494
Play548260802024-03-19 3:08:1263 days ago1710817692IN
0x8C88C581...dA8329270
0.08896422 MATIC0.0181353567.47084866
Play548260652024-03-19 3:07:4063 days ago1710817660IN
0x8C88C581...dA8329270
0.09464091 MATIC0.0187833269.88154466
Play548260472024-03-19 3:07:0063 days ago1710817620IN
0x8C88C581...dA8329270
0.10209664 MATIC0.0203108375.56450801
Play548260242024-03-19 3:06:1263 days ago1710817572IN
0x8C88C581...dA8329270
0.1106044 MATIC0.0221580682.43697552
Play548260082024-03-19 3:05:3863 days ago1710817538IN
0x8C88C581...dA8329270
0.109858 MATIC0.0234958787.41416573
Play548259882024-03-19 3:04:5663 days ago1710817496IN
0x8C88C581...dA8329270
0.10766894 MATIC0.0216739380.63578672
Play548259682024-03-19 3:04:1463 days ago1710817454IN
0x8C88C581...dA8329270
0.12465995 MATIC0.024100989.66511645
Play541757232024-03-02 11:36:4880 days ago1709379408IN
0x8C88C581...dA8329270
0.08507682 MATIC0.0151395156.32260745
Play541757032024-03-02 11:36:0680 days ago1709379366IN
0x8C88C581...dA8329270
0.08720073 MATIC0.0151788556.47149197
Play541755992024-03-02 11:32:2480 days ago1709379144IN
0x8C88C581...dA8329270
0.11475432 MATIC0.0204714176.15853059
Play537349262024-02-20 6:06:3091 days ago1708409190IN
0x8C88C581...dA8329270
0.12385441 MATIC0.0247118991.93824944
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To Value
549101132024-03-21 9:56:1161 days ago1711014971
0x8C88C581...dA8329270
152.03308526 MATIC
548700652024-03-20 7:37:2962 days ago1710920249
0x8C88C581...dA8329270
0.03154173 MATIC
548700412024-03-20 7:36:2562 days ago1710920185
0x8C88C581...dA8329270
0.01423148 MATIC
548700282024-03-20 7:35:3762 days ago1710920137
0x8C88C581...dA8329270
0.02564377 MATIC
548700092024-03-20 7:34:5762 days ago1710920097
0x8C88C581...dA8329270
0.02738341 MATIC
548699912024-03-20 7:34:1962 days ago1710920059
0x8C88C581...dA8329270
0.02717288 MATIC
548699622024-03-20 7:33:0762 days ago1710919987
0x8C88C581...dA8329270
0.01714878 MATIC
548384562024-03-19 11:27:2063 days ago1710847640
0x8C88C581...dA8329270
0.04113199 MATIC
548384272024-03-19 11:26:1863 days ago1710847578
0x8C88C581...dA8329270
0.02998298 MATIC
548261672024-03-19 3:11:1663 days ago1710817876
0x8C88C581...dA8329270
0.00584014 MATIC
548261472024-03-19 3:10:3463 days ago1710817834
0x8C88C581...dA8329270
0.00595739 MATIC
548261172024-03-19 3:09:3063 days ago1710817770
0x8C88C581...dA8329270
0.00505845 MATIC
548260972024-03-19 3:08:4863 days ago1710817728
0x8C88C581...dA8329270
0.00600391 MATIC
548260802024-03-19 3:08:1263 days ago1710817692
0x8C88C581...dA8329270
0.00588254 MATIC
548260652024-03-19 3:07:4063 days ago1710817660
0x8C88C581...dA8329270
0.00890747 MATIC
548260472024-03-19 3:07:0063 days ago1710817620
0x8C88C581...dA8329270
0.01011194 MATIC
548260242024-03-19 3:06:1263 days ago1710817572
0x8C88C581...dA8329270
0.01105998 MATIC
548260082024-03-19 3:05:3863 days ago1710817538
0x8C88C581...dA8329270
0.00483867 MATIC
548259882024-03-19 3:04:5663 days ago1710817496
0x8C88C581...dA8329270
0.01010582 MATIC
548259682024-03-19 3:04:1463 days ago1710817454
0x8C88C581...dA8329270
0.01716457 MATIC
541757232024-03-02 11:36:4880 days ago1709379408
0x8C88C581...dA8329270
0.01337544 MATIC
541757032024-03-02 11:36:0680 days ago1709379366
0x8C88C581...dA8329270
0.01533558 MATIC
541755992024-03-02 11:32:2480 days ago1709379144
0x8C88C581...dA8329270
0.02123343 MATIC
537349262024-02-20 6:06:3091 days ago1708409190
0x8C88C581...dA8329270
0.01269086 MATIC
537349072024-02-20 6:05:5091 days ago1708409150
0x8C88C581...dA8329270
0.01399614 MATIC
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ZapankiCanRace

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, MIT license
File 1 of 12 : ZapankiCanRace.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./common/ZapankiGames.sol";

contract ZapankiCanRace is ZapankiGames {
    using SafeERC20 for IERC20;

    struct CanRaceGame {
        uint256 wager;
        uint256 vrfId;
        address tokenAddress;
        uint64 blockNumber;
        uint8 pickedCanId;
    }

    mapping(address => CanRaceGame) canRaceGames;
    mapping(uint256 => address) vrfPendingPlayer;

    mapping(uint8 => uint64) public canMultipliers;

    event CanRaceFulfilled(
        address indexed playerAddress,
        uint256 wager,
        uint256 payout,
        address tokenAddress,
        uint8 winnerCanId,
        uint64 multiplier,
        uint256 l2eAmount
    );
    event CanRaceRefund(address indexed player, uint256 wager, address tokenAddress);

    constructor(
        address _vrfCoordinator,
        IBankroll _bankroll,
        address _trustedForwarder,
        address _link_eth_feed,
        bytes32 _vrfKeyHash,
        uint64 _vrfSubId,
        uint32 _vrfCallbackGasLimit
    )
        ZapankiGames(
            _vrfCoordinator,
            _bankroll,
            _trustedForwarder,
            _link_eth_feed,
            _vrfKeyHash,
            _vrfSubId,
            _vrfCallbackGasLimit
        )
    {
        canMultipliers[1] = 19600;
        canMultipliers[2] = 29600;
        canMultipliers[3] = 79600;
        canMultipliers[4] = 149600;
        canMultipliers[5] = 599600;
    }

    function getCurrentUserState(address player) external view returns (CanRaceGame memory) {
        return (canRaceGames[player]);
    }

    function getMultipliers() external view returns (uint64[5] memory multipliers) {
        for (uint8 i = 1; i < 5; i++) {
            multipliers[i - 1] = canMultipliers[i];
        }
        return multipliers;
    }

    function getWinner(uint256 randomWord) internal pure returns (uint8 canId) {
        uint256 rand = randomWord % 10000;
        if (rand < 4800) {
            canId = 1;
        } else if (rand < 8000) {
            canId = 2;
        } else if (rand < 9200) {
            canId = 3;
        } else if (rand < 9840) {
            canId = 4;
        } else {
            canId = 5;
        }
    }

    function play(uint256 wager, address tokenAddress, uint8 pickedCanId) external payable nonReentrant {
        address msgSender = _msgSender();
        require(canRaceGames[msgSender].vrfId == 0, "Waiting VRF request");

        _checkMaxWager(wager, tokenAddress, pickedCanId);
        _processWager(tokenAddress, wager, 1100000, msgSender);
        uint256 id = _requestRandomWords(1);

        canRaceGames[msgSender] = CanRaceGame(wager, id, tokenAddress, uint64(block.number), pickedCanId);
        vrfPendingPlayer[id] = msgSender;
    }

    function refund() external nonReentrant {
        address msgSender = _msgSender();
        CanRaceGame storage game = canRaceGames[msgSender];
        require(game.vrfId != 0, "Not waiting VRF request");
        require(game.blockNumber + BLOCK_REFUND_COOLDOWN + 10 <= block.number, "Too early");

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

        if (tokenAddress == address(0)) {
            (bool success, ) = payable(msgSender).call{value: wager}("");
            require(success, "Transfer failed");
        } else {
            IERC20(tokenAddress).safeTransfer(msgSender, wager);
        }
        emit CanRaceRefund(msgSender, wager, tokenAddress);

        delete (vrfPendingPlayer[game.vrfId]);
        delete (canRaceGames[msgSender]);
    }

    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
        address playerAddress = vrfPendingPlayer[requestId];
        if (playerAddress == address(0)) return;
        CanRaceGame storage game = canRaceGames[playerAddress];
        if (block.number > game.blockNumber + BLOCK_REFUND_COOLDOWN) return;
        uint256 payout;

        uint8 winnerCanId = getWinner(randomWords[0]);
        uint64 multiplier = canMultipliers[winnerCanId];
        bool isWon = winnerCanId == game.pickedCanId;

        uint64 userMultiplier;
        if (isWon) {
            payout += (game.wager * multiplier) / 10000;
            userMultiplier = multiplier;
        }
        _transferToBankroll(game.tokenAddress, game.wager);
        if (payout != 0) {
            _payoutBankrollToPlayer(playerAddress, payout, game.tokenAddress);
        }

        uint256 l2eAmount = bankroll.payoutL2E(playerAddress, game.tokenAddress, game.wager, payout);

        emit CanRaceFulfilled(
            playerAddress,
            game.wager,
            payout,
            game.tokenAddress,
            winnerCanId,
            userMultiplier,
            l2eAmount
        );
        delete (vrfPendingPlayer[requestId]);
        delete (canRaceGames[playerAddress]);
    }

    function _checkMaxWager(uint256 wager, address tokenAddress, uint8 canId) internal view {
        uint256 balance;
        if (tokenAddress == address(0)) {
            balance = address(bankroll).balance;
        } else {
            balance = IERC20(tokenAddress).balanceOf(address(bankroll));
        }
        uint256 maxWager = (balance * (11000 - 10890)) / (canMultipliers[canId] - 10000);
        require(wager <= maxWager, "Too many wager");
    }
}

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

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

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

  function version() external view returns (uint256);

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

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

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

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

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

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

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

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

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

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

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

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

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

File 1 of 12 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness. It ensures 2 things:
 * @dev 1. The fulfillment came from the VRFCoordinator
 * @dev 2. The consumer contract implements fulfillRandomWords.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constructor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash). Create subscription, fund it
 * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface
 * @dev subscription management functions).
 * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations,
 * @dev callbackGasLimit, numWords),
 * @dev see (VRFCoordinatorInterface for a description of the arguments).
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomWords method.
 *
 * @dev The randomness argument to fulfillRandomWords is a set of random words
 * @dev generated from your requestId and the blockHash of the request.
 *
 * @dev If your contract could have concurrent requests open, you can use the
 * @dev requestId returned from requestRandomWords to track which response is associated
 * @dev with which randomness request.
 * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ.
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request. It is for this reason that
 * @dev that you can signal to an oracle you'd like them to wait longer before
 * @dev responding to the request (however this is not enforced in the contract
 * @dev and so remains effective only in the case of unmodified oracle software).
 */
abstract contract VRFConsumerBaseV2 {
  error OnlyCoordinatorCanFulfill(address have, address want);
  address private immutable vrfCoordinator;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   */
  constructor(address _vrfCoordinator) {
    vrfCoordinator = _vrfCoordinator;
  }

  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomWords the VRF output expanded to the requested number of words
   */
  function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
    if (msg.sender != vrfCoordinator) {
      revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
    }
    fulfillRandomWords(requestId, randomWords);
  }
}

File 1 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 1 of 12 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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);
}

File 1 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 1 of 12 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

File 1 of 12 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

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

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

abstract contract ZapankiGames is ReentrancyGuard, VRFConsumerBaseV2 {
    using SafeERC20 for IERC20;

    AggregatorV3Interface public LINK_ETH_FEED;
    IVRFCoordinatorV2 public vrfCoordinator;
    IBankroll public bankroll;
    address public trustedForwarder;

    bytes32 vrfKeyHash;
    uint256 public claimableVRFFee;
    uint64 constant BLOCK_REFUND_COOLDOWN = 1000;
    uint64 vrfSubId;
    uint32 vrfCallbackGasLimit;

    modifier onlyOwner() {
        require(msg.sender == bankroll.owner(), "Not Owner");
        _;
    }

    constructor(
        address _vrfCoordinator,
        IBankroll _bankroll,
        address _trustedForwarder,
        address _link_eth_feed,
        bytes32 _vrfKeyHash,
        uint64 _vrfSubId,
        uint32 _vrfCallbackGasLimit
    ) VRFConsumerBaseV2(_vrfCoordinator) {
        vrfCoordinator = IVRFCoordinatorV2(_vrfCoordinator);
        bankroll = _bankroll;
        LINK_ETH_FEED = AggregatorV3Interface(_link_eth_feed);
        vrfKeyHash = _vrfKeyHash;
        vrfSubId = _vrfSubId;
        vrfCallbackGasLimit = _vrfCallbackGasLimit;
        trustedForwarder = _trustedForwarder;
    }

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

    function _msgSender() internal view returns (address sender) {
        if (isTrustedForwarder(msg.sender)) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            /// @solidity memory-safe-assembly
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            return msg.sender;
        }
    }

    function _shouldStop(int256 value, uint256 stopGain, uint256 stopLoss) internal pure returns (bool) {
        return value >= int256(stopGain) || value <= -int256(stopLoss);
    }

    function _processWager(address tokenAddress, uint256 wager, uint256 gasAmount, address msgSender) internal {
        require(bankroll.getIsValidWager(address(this), tokenAddress), "Token not approved");
        require(wager != 0, "Wager must be greater than 0");
        if (tokenAddress == address(0)) {
            _chargeVRFFee(msg.value - wager, gasAmount);
        } else {
            _chargeVRFFee(msg.value, gasAmount);
            IERC20(tokenAddress).safeTransferFrom(msgSender, address(this), wager);
        }
    }

    function _transferToBankroll(address tokenAddress, uint256 amount) internal {
        if (tokenAddress == address(0)) {
            (bool success, ) = payable(address(bankroll)).call{value: amount}("");
            require(success, "refund failed");
        } else {
            IERC20(tokenAddress).safeTransfer(address(bankroll), amount);
        }
    }

    function getVRFFee(uint256 gasAmount) public view returns (uint256 fee) {
        (, int256 answer, , , ) = LINK_ETH_FEED.latestRoundData();
        (uint32 fulfillmentFlatFeeLinkPPMTier1, , , , , , , , ) = vrfCoordinator.getFeeConfig();

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

    function _refundVRFFee(uint256 refundableAmount) internal {
        if (refundableAmount > 0) {
            (bool success, ) = payable(msg.sender).call{value: refundableAmount}("");
            require(success, "refund failed");
        }
    }

    function _chargeVRFFee(uint256 vrfFeeProvided, uint256 gasAmount) internal {
        uint256 _vrfFee = getVRFFee(gasAmount);
        require(vrfFeeProvided >= _vrfFee, "Insufficient vrf fee");
        _refundVRFFee(vrfFeeProvided - _vrfFee);
        claimableVRFFee += _vrfFee;
    }

    function collectVrfFee() external nonReentrant onlyOwner {
        uint256 fee = claimableVRFFee;
        claimableVRFFee = 0;
        (bool success, ) = payable(address(msg.sender)).call{value: fee}("");
        require(success, "transfer failed");
    }

    function _payoutBankrollToPlayer(address player, uint256 payout, address tokenAddress) internal {
        bankroll.transferPayout(player, payout, tokenAddress);
    }

    function _requestRandomWords(uint32 numWords) internal returns (uint256 s_requestId) {
        s_requestId = vrfCoordinator.requestRandomWords(vrfKeyHash, vrfSubId, 3, vrfCallbackGasLimit, numWords);
    }
}

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

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 owner() external view returns (address);

    function payoutL2E(
        address player,
        address wagerToken,
        uint256 wager,
        uint256 payout
    ) external returns (uint256 l2eAmount);
}

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

import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"contract IBankroll","name":"_bankroll","type":"address"},{"internalType":"address","name":"_trustedForwarder","type":"address"},{"internalType":"address","name":"_link_eth_feed","type":"address"},{"internalType":"bytes32","name":"_vrfKeyHash","type":"bytes32"},{"internalType":"uint64","name":"_vrfSubId","type":"uint64"},{"internalType":"uint32","name":"_vrfCallbackGasLimit","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","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":"uint8","name":"winnerCanId","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"multiplier","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"l2eAmount","type":"uint256"}],"name":"CanRaceFulfilled","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":"CanRaceRefund","type":"event"},{"inputs":[],"name":"LINK_ETH_FEED","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bankroll","outputs":[{"internalType":"contract IBankroll","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"canMultipliers","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimableVRFFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectVrfFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"getCurrentUserState","outputs":[{"components":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"uint256","name":"vrfId","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint64","name":"blockNumber","type":"uint64"},{"internalType":"uint8","name":"pickedCanId","type":"uint8"}],"internalType":"struct ZapankiCanRace.CanRaceGame","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMultipliers","outputs":[{"internalType":"uint64[5]","name":"multipliers","type":"uint64[5]"}],"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":"wager","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"pickedCanId","type":"uint8"}],"name":"play","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vrfCoordinator","outputs":[{"internalType":"contract IVRFCoordinatorV2","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b5060405162001e1038038062001e108339810160408190526200003491620001d7565b600160008181556001600160a01b039889166080819052600280546001600160a01b0319908116909217905560038054998b1699821699909917909855815495891695881695909517905560059283556007805463ffffffff90921668010000000000000000026001600160601b03199092166001600160401b0390931692909217179055600480549590931694909316939093179055600a6020527fbbc70db1b6c7afd11e79c0fb0051300458f1a3acb8ee9789d9b6b26c61ad9bc780546001600160401b0319908116614c90179091557fbff4442b8ed600beeb8e26b1279a0f0d14c6edfaec26d968ee13c86f7d4c2ba8805482166173a01790557fa856840544dc26124927add067d799967eac11be13e14d82cc281ea46fa3975980548216620136f01790557fe1eb2b2161a492c07c5a334e48012567cba93ec021043f53c1955516a3c5a841805482166202486017905591527ff35035bc2b01d44bd35a1dcdc552315cffb73da35cfd60570b7b777f98036f9f80549091166209263017905562000289565b6001600160a01b0381168114620001d457600080fd5b50565b600080600080600080600060e0888a031215620001f357600080fd5b87516200020081620001be565b60208901519097506200021381620001be565b60408901519096506200022681620001be565b60608901519095506200023981620001be565b608089015160a08a015191955093506001600160401b03811681146200025e57600080fd5b60c089015190925063ffffffff811681146200027957600080fd5b8091505092959891949750929550565b608051611b64620002ac600039600081816103e001526104220152611b646000f3fe6080604052600436106100dd5760003560e01c80637da0a8771161007f578063a3e56fa811610059578063a3e56fa814610334578063acf341b614610354578063ad178361146103a2578063b897dcdf146103c257600080fd5b80637da0a877146102d057806380cfa527146102f05780638bd161141461031457600080fd5b8063590e1ae3116100bb578063590e1ae31461018057806374b0a7891461019557806376fca03d146101aa57806379873f8a146102ae57600080fd5b80630c657eb0146100e25780631fe543e31461011f578063572b6c0514610141575b600080fd5b3480156100ee57600080fd5b50600354610102906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561012b57600080fd5b5061013f61013a36600461168b565b6103d5565b005b34801561014d57600080fd5b5061017061015c366004611769565b6004546001600160a01b0391821691161490565b6040519015158152602001610116565b34801561018c57600080fd5b5061013f610462565b3480156101a157600080fd5b5061013f6106ba565b3480156101b657600080fd5b5061025c6101c5366004611769565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152506001600160a01b03908116600090815260086020908152604091829020825160a081018452815481526001820154928101929092526002015492831691810191909152600160a01b82046001600160401b03166060820152600160e01b90910460ff16608082015290565b604051610116919081518152602080830151908201526040808301516001600160a01b0316908201526060808301516001600160401b03169082015260809182015160ff169181019190915260a00190565b3480156102ba57600080fd5b506102c3610825565b6040516101169190611786565b3480156102dc57600080fd5b50600454610102906001600160a01b031681565b3480156102fc57600080fd5b5061030660065481565b604051908152602001610116565b34801561032057600080fd5b5061030661032f3660046117c0565b6108a0565b34801561034057600080fd5b50600254610102906001600160a01b031681565b34801561036057600080fd5b5061038a61036f3660046117ef565b600a602052600090815260409020546001600160401b031681565b6040516001600160401b039091168152602001610116565b3480156103ae57600080fd5b50600154610102906001600160a01b031681565b61013f6103d036600461180a565b6109f5565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104545760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b61045e8282610b62565b5050565b61046a610e03565b6000610474610e2d565b6001600160a01b038116600090815260086020526040812060018101549293509190036104e35760405162461bcd60e51b815260206004820152601760248201527f4e6f742077616974696e67205652462072657175657374000000000000000000604482015260640161044b565b60028101544390610507906103e890600160a01b90046001600160401b031661185e565b61051290600a61185e565b6001600160401b031611156105555760405162461bcd60e51b8152602060048201526009602482015268546f6f206561726c7960b81b604482015260640161044b565b805460028201546001600160a01b031680610605576000846001600160a01b03168360405160006040518083038185875af1925050503d80600081146105b7576040519150601f19603f3d011682016040523d82523d6000602084013e6105bc565b606091505b50509050806105ff5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b604482015260640161044b565b50610619565b6106196001600160a01b0382168584610e54565b604080518381526001600160a01b0383811660208301528616917f9f0caed56b199598b34820b9d68a95056c977e8e33e4e887472d7b4d0d63a9d5910160405180910390a25050600190810154600090815260096020908152604080832080546001600160a01b03191690556001600160a01b039490941682526008905291822082815580820183905560020180546001600160e81b03191690559055565b565b6106c2610e03565b600360009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610715573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107399190611885565b6001600160a01b0316336001600160a01b0316146107855760405162461bcd60e51b81526020600482015260096024820152682737ba1027bbb732b960b91b604482015260640161044b565b60068054600091829055604051909190339083908381818185875af1925050503d80600081146107d1576040519150601f19603f3d011682016040523d82523d6000602084013e6107d6565b606091505b50509050806108195760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015260640161044b565b50506106b86001600055565b61082d611657565b60015b60058160ff16101561089c5760ff81166000908152600a60205260409020546001600160401b0316826108646001846118a2565b60ff1660058110610877576108776118bb565b6001600160401b03909216602092909202015280610894816118d1565b915050610830565b5090565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a919061190a565b5050509150506000600260009054906101000a90046001600160a01b03166001600160a01b0316635fbbc0d26040518163ffffffff1660e01b815260040161012060405180830381865afa158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099a9190611981565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a510006109c59190611a29565b6109cf9190611a29565b6109d99190611a56565b6109e3853a611a29565b6109ed9190611a6a565b949350505050565b6109fd610e03565b6000610a07610e2d565b6001600160a01b03811660009081526008602052604090206001015490915015610a695760405162461bcd60e51b815260206004820152601360248201527215d85a5d1a5b99c8159491881c995c5d595cdd606a1b604482015260640161044b565b610a74848484610eb3565b610a8383856210c8e084610fd8565b6000610a8f6001611128565b6040805160a08101825287815260208082018481526001600160a01b03808a168486019081526001600160401b034381166060870190815260ff808d16608089019081529b85166000818152600889528a812099518a55965160018a015593516002909801805492519c51909116600160e01b0260ff60e01b199c909316600160a01b026001600160e01b031990921697909416969096179590951798909816939093179092559281526009909252902080546001600160a01b03191690921790915550610b5d6001600055565b505050565b6000828152600960205260409020546001600160a01b031680610b8457505050565b6001600160a01b03811660009081526008602052604090206002810154610bbe906103e890600160a01b90046001600160401b031661185e565b6001600160401b0316431115610bd45750505050565b600080610bfa85600081518110610bed57610bed6118bb565b60200260200101516111db565b60ff8082166000818152600a602052604081205460028801549495506001600160401b031693600160e01b900490921614908115610c6657855461271090610c4c906001600160401b03861690611a29565b610c569190611a56565b610c609086611a6a565b94508290505b60028601548654610c80916001600160a01b031690611243565b8415610ca1576002860154610ca190889087906001600160a01b03166112fe565b6003546002870154875460405160016292610160e01b031981526001600160a01b038b811660048301529283166024820152604481019190915260648101889052600092919091169063ff6d9eff906084016020604051808303816000875af1158015610d12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d369190611a7d565b8754600289015460408051928352602083018a90526001600160a01b039182168382015260ff891660608401526001600160401b038616608084015260a08301849052519293508a16917f36648f0b22ced55099f7a92d8bebe2cbdc8d20eb9eaf808b7fbaef93df4a20749181900360c00190a25050506000968752505060096020908152604080872080546001600160a01b03191690556001600160a01b03949094168652600890525050822082815560018101929092555060020180546001600160e81b0319169055565b600260005403610e2657604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b6004546000906001600160a01b03163303610e4f575060131936013560601c90565b503390565b6040516001600160a01b03838116602483015260448201839052610b5d91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611371565b60006001600160a01b038316610ed657506003546001600160a01b031631610f47565b6003546040516370a0823160e01b81526001600160a01b039182166004820152908416906370a0823190602401602060405180830381865afa158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f449190611a7d565b90505b60ff82166000908152600a6020526040812054610f7090612710906001600160401b0316611a96565b6001600160401b0316610f8483606e611a29565b610f8e9190611a56565b905080851115610fd15760405162461bcd60e51b815260206004820152600e60248201526d2a37b79036b0b73c903bb0b3b2b960911b604482015260640161044b565b5050505050565b600354604051632ff5fe7360e21b81523060048201526001600160a01b0386811660248301529091169063bfd7f9cc90604401602060405180830381865afa158015611028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104c9190611ab6565b61108d5760405162461bcd60e51b8152602060048201526012602482015271151bdad95b881b9bdd08185c1c1c9bdd995960721b604482015260640161044b565b826000036110dd5760405162461bcd60e51b815260206004820152601c60248201527f5761676572206d7573742062652067726561746572207468616e203000000000604482015260640161044b565b6001600160a01b038416611103576110fe6110f88434611ad8565b836113d4565b611122565b61110d34836113d4565b6111226001600160a01b038516823086611456565b50505050565b6002546005546007546040516305d3b1d360e41b815260048101929092526001600160401b03811660248301526003604483015268010000000000000000900463ffffffff9081166064830152831660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af11580156111b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d59190611a7d565b92915050565b6000806111ea61271084611aeb565b90506112c08110156111ff576001915061123d565b611f40811015611212576002915061123d565b6123f0811015611225576003915061123d565b612670811015611238576004915061123d565b600591505b50919050565b6001600160a01b0382166112e4576003546040516000916001600160a01b03169083908381818185875af1925050503d806000811461129e576040519150601f19603f3d011682016040523d82523d6000602084013e6112a3565b606091505b5050905080610b5d5760405162461bcd60e51b815260206004820152600d60248201526c1c99599d5b990819985a5b1959609a1b604482015260640161044b565b60035461045e906001600160a01b03848116911683610e54565b6003546040516336012f6160e11b81526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b15801561135457600080fd5b505af1158015611368573d6000803e3d6000fd5b50505050505050565b60006113866001600160a01b0384168361148f565b905080516000141580156113ab5750808060200190518101906113a99190611ab6565b155b15610b5d57604051635274afe760e01b81526001600160a01b038416600482015260240161044b565b60006113df826108a0565b9050808310156114285760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e74207672662066656560601b604482015260640161044b565b61143a6114358285611ad8565b6114a4565b806006600082825461144c9190611a6a565b9091555050505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526111229186918216906323b872dd90608401610e81565b606061149d83836000611535565b9392505050565b801561153257604051600090339083908381818185875af1925050503d80600081146114ec576040519150601f19603f3d011682016040523d82523d6000602084013e6114f1565b606091505b505090508061045e5760405162461bcd60e51b815260206004820152600d60248201526c1c99599d5b990819985a5b1959609a1b604482015260640161044b565b50565b60608147101561155a5760405163cd78605960e01b815230600482015260240161044b565b600080856001600160a01b031684866040516115769190611aff565b60006040518083038185875af1925050503d80600081146115b3576040519150601f19603f3d011682016040523d82523d6000602084013e6115b8565b606091505b50915091506115c88683836115d2565b9695505050505050565b6060826115e7576115e28261162e565b61149d565b81511580156115fe57506001600160a01b0384163b155b1561162757604051639996b31560e01b81526001600160a01b038516600482015260240161044b565b508061149d565b80511561163e5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040518060a001604052806005906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561169e57600080fd5b823591506020808401356001600160401b03808211156116bd57600080fd5b818601915086601f8301126116d157600080fd5b8135818111156116e3576116e3611675565b8060051b604051601f19603f8301168101818110858211171561170857611708611675565b60405291825284820192508381018501918983111561172657600080fd5b938501935b828510156117445784358452938501939285019261172b565b8096505050505050509250929050565b6001600160a01b038116811461153257600080fd5b60006020828403121561177b57600080fd5b813561149d81611754565b60a08101818360005b60058110156117b75781516001600160401b031683526020928301929091019060010161178f565b50505092915050565b6000602082840312156117d257600080fd5b5035919050565b803560ff811681146117ea57600080fd5b919050565b60006020828403121561180157600080fd5b61149d826117d9565b60008060006060848603121561181f57600080fd5b83359250602084013561183181611754565b915061183f604085016117d9565b90509250925092565b634e487b7160e01b600052601160045260246000fd5b6001600160401b0381811683821601908082111561187e5761187e611848565b5092915050565b60006020828403121561189757600080fd5b815161149d81611754565b60ff82811682821603908111156111d5576111d5611848565b634e487b7160e01b600052603260045260246000fd5b600060ff821660ff81036118e7576118e7611848565b60010192915050565b805169ffffffffffffffffffff811681146117ea57600080fd5b600080600080600060a0868803121561192257600080fd5b61192b866118f0565b945060208601519350604086015192506060860151915061194e608087016118f0565b90509295509295909350565b805163ffffffff811681146117ea57600080fd5b805162ffffff811681146117ea57600080fd5b60008060008060008060008060006101208a8c0312156119a057600080fd5b6119a98a61195a565b98506119b760208b0161195a565b97506119c560408b0161195a565b96506119d360608b0161195a565b95506119e160808b0161195a565b94506119ef60a08b0161196e565b93506119fd60c08b0161196e565b9250611a0b60e08b0161196e565b9150611a1a6101008b0161196e565b90509295985092959850929598565b80820281158282048414176111d5576111d5611848565b634e487b7160e01b600052601260045260246000fd5b600082611a6557611a65611a40565b500490565b808201808211156111d5576111d5611848565b600060208284031215611a8f57600080fd5b5051919050565b6001600160401b0382811682821603908082111561187e5761187e611848565b600060208284031215611ac857600080fd5b8151801515811461149d57600080fd5b818103818111156111d5576111d5611848565b600082611afa57611afa611a40565b500690565b6000825160005b81811015611b205760208186018101518583015201611b06565b50600092019182525091905056fea26469706673582212200a25489d8d6e1520253a68196aba409f432f6c5998ed2dc2bc7270c8135eeab164736f6c63430008140033000000000000000000000000ae975071be8f8ee67addbc1a82488f1c2485806700000000000000000000000041cb3a2e51635f680acf3e6c043498782a4f37a500000000000000000000000041cb3a2e51635f680acf3e6c043498782a4f37a50000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802d729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a8000000000000000000000000000000000000000000000000000000000000038e00000000000000000000000000000000000000000000000000000000002625a0

Deployed Bytecode

0x6080604052600436106100dd5760003560e01c80637da0a8771161007f578063a3e56fa811610059578063a3e56fa814610334578063acf341b614610354578063ad178361146103a2578063b897dcdf146103c257600080fd5b80637da0a877146102d057806380cfa527146102f05780638bd161141461031457600080fd5b8063590e1ae3116100bb578063590e1ae31461018057806374b0a7891461019557806376fca03d146101aa57806379873f8a146102ae57600080fd5b80630c657eb0146100e25780631fe543e31461011f578063572b6c0514610141575b600080fd5b3480156100ee57600080fd5b50600354610102906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561012b57600080fd5b5061013f61013a36600461168b565b6103d5565b005b34801561014d57600080fd5b5061017061015c366004611769565b6004546001600160a01b0391821691161490565b6040519015158152602001610116565b34801561018c57600080fd5b5061013f610462565b3480156101a157600080fd5b5061013f6106ba565b3480156101b657600080fd5b5061025c6101c5366004611769565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152506001600160a01b03908116600090815260086020908152604091829020825160a081018452815481526001820154928101929092526002015492831691810191909152600160a01b82046001600160401b03166060820152600160e01b90910460ff16608082015290565b604051610116919081518152602080830151908201526040808301516001600160a01b0316908201526060808301516001600160401b03169082015260809182015160ff169181019190915260a00190565b3480156102ba57600080fd5b506102c3610825565b6040516101169190611786565b3480156102dc57600080fd5b50600454610102906001600160a01b031681565b3480156102fc57600080fd5b5061030660065481565b604051908152602001610116565b34801561032057600080fd5b5061030661032f3660046117c0565b6108a0565b34801561034057600080fd5b50600254610102906001600160a01b031681565b34801561036057600080fd5b5061038a61036f3660046117ef565b600a602052600090815260409020546001600160401b031681565b6040516001600160401b039091168152602001610116565b3480156103ae57600080fd5b50600154610102906001600160a01b031681565b61013f6103d036600461180a565b6109f5565b336001600160a01b037f000000000000000000000000ae975071be8f8ee67addbc1a82488f1c2485806716146104545760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580671660248201526044015b60405180910390fd5b61045e8282610b62565b5050565b61046a610e03565b6000610474610e2d565b6001600160a01b038116600090815260086020526040812060018101549293509190036104e35760405162461bcd60e51b815260206004820152601760248201527f4e6f742077616974696e67205652462072657175657374000000000000000000604482015260640161044b565b60028101544390610507906103e890600160a01b90046001600160401b031661185e565b61051290600a61185e565b6001600160401b031611156105555760405162461bcd60e51b8152602060048201526009602482015268546f6f206561726c7960b81b604482015260640161044b565b805460028201546001600160a01b031680610605576000846001600160a01b03168360405160006040518083038185875af1925050503d80600081146105b7576040519150601f19603f3d011682016040523d82523d6000602084013e6105bc565b606091505b50509050806105ff5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b604482015260640161044b565b50610619565b6106196001600160a01b0382168584610e54565b604080518381526001600160a01b0383811660208301528616917f9f0caed56b199598b34820b9d68a95056c977e8e33e4e887472d7b4d0d63a9d5910160405180910390a25050600190810154600090815260096020908152604080832080546001600160a01b03191690556001600160a01b039490941682526008905291822082815580820183905560020180546001600160e81b03191690559055565b565b6106c2610e03565b600360009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610715573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107399190611885565b6001600160a01b0316336001600160a01b0316146107855760405162461bcd60e51b81526020600482015260096024820152682737ba1027bbb732b960b91b604482015260640161044b565b60068054600091829055604051909190339083908381818185875af1925050503d80600081146107d1576040519150601f19603f3d011682016040523d82523d6000602084013e6107d6565b606091505b50509050806108195760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015260640161044b565b50506106b86001600055565b61082d611657565b60015b60058160ff16101561089c5760ff81166000908152600a60205260409020546001600160401b0316826108646001846118a2565b60ff1660058110610877576108776118bb565b6001600160401b03909216602092909202015280610894816118d1565b915050610830565b5090565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a919061190a565b5050509150506000600260009054906101000a90046001600160a01b03166001600160a01b0316635fbbc0d26040518163ffffffff1660e01b815260040161012060405180830381865afa158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099a9190611981565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a510006109c59190611a29565b6109cf9190611a29565b6109d99190611a56565b6109e3853a611a29565b6109ed9190611a6a565b949350505050565b6109fd610e03565b6000610a07610e2d565b6001600160a01b03811660009081526008602052604090206001015490915015610a695760405162461bcd60e51b815260206004820152601360248201527215d85a5d1a5b99c8159491881c995c5d595cdd606a1b604482015260640161044b565b610a74848484610eb3565b610a8383856210c8e084610fd8565b6000610a8f6001611128565b6040805160a08101825287815260208082018481526001600160a01b03808a168486019081526001600160401b034381166060870190815260ff808d16608089019081529b85166000818152600889528a812099518a55965160018a015593516002909801805492519c51909116600160e01b0260ff60e01b199c909316600160a01b026001600160e01b031990921697909416969096179590951798909816939093179092559281526009909252902080546001600160a01b03191690921790915550610b5d6001600055565b505050565b6000828152600960205260409020546001600160a01b031680610b8457505050565b6001600160a01b03811660009081526008602052604090206002810154610bbe906103e890600160a01b90046001600160401b031661185e565b6001600160401b0316431115610bd45750505050565b600080610bfa85600081518110610bed57610bed6118bb565b60200260200101516111db565b60ff8082166000818152600a602052604081205460028801549495506001600160401b031693600160e01b900490921614908115610c6657855461271090610c4c906001600160401b03861690611a29565b610c569190611a56565b610c609086611a6a565b94508290505b60028601548654610c80916001600160a01b031690611243565b8415610ca1576002860154610ca190889087906001600160a01b03166112fe565b6003546002870154875460405160016292610160e01b031981526001600160a01b038b811660048301529283166024820152604481019190915260648101889052600092919091169063ff6d9eff906084016020604051808303816000875af1158015610d12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d369190611a7d565b8754600289015460408051928352602083018a90526001600160a01b039182168382015260ff891660608401526001600160401b038616608084015260a08301849052519293508a16917f36648f0b22ced55099f7a92d8bebe2cbdc8d20eb9eaf808b7fbaef93df4a20749181900360c00190a25050506000968752505060096020908152604080872080546001600160a01b03191690556001600160a01b03949094168652600890525050822082815560018101929092555060020180546001600160e81b0319169055565b600260005403610e2657604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b6004546000906001600160a01b03163303610e4f575060131936013560601c90565b503390565b6040516001600160a01b03838116602483015260448201839052610b5d91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611371565b60006001600160a01b038316610ed657506003546001600160a01b031631610f47565b6003546040516370a0823160e01b81526001600160a01b039182166004820152908416906370a0823190602401602060405180830381865afa158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f449190611a7d565b90505b60ff82166000908152600a6020526040812054610f7090612710906001600160401b0316611a96565b6001600160401b0316610f8483606e611a29565b610f8e9190611a56565b905080851115610fd15760405162461bcd60e51b815260206004820152600e60248201526d2a37b79036b0b73c903bb0b3b2b960911b604482015260640161044b565b5050505050565b600354604051632ff5fe7360e21b81523060048201526001600160a01b0386811660248301529091169063bfd7f9cc90604401602060405180830381865afa158015611028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104c9190611ab6565b61108d5760405162461bcd60e51b8152602060048201526012602482015271151bdad95b881b9bdd08185c1c1c9bdd995960721b604482015260640161044b565b826000036110dd5760405162461bcd60e51b815260206004820152601c60248201527f5761676572206d7573742062652067726561746572207468616e203000000000604482015260640161044b565b6001600160a01b038416611103576110fe6110f88434611ad8565b836113d4565b611122565b61110d34836113d4565b6111226001600160a01b038516823086611456565b50505050565b6002546005546007546040516305d3b1d360e41b815260048101929092526001600160401b03811660248301526003604483015268010000000000000000900463ffffffff9081166064830152831660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af11580156111b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d59190611a7d565b92915050565b6000806111ea61271084611aeb565b90506112c08110156111ff576001915061123d565b611f40811015611212576002915061123d565b6123f0811015611225576003915061123d565b612670811015611238576004915061123d565b600591505b50919050565b6001600160a01b0382166112e4576003546040516000916001600160a01b03169083908381818185875af1925050503d806000811461129e576040519150601f19603f3d011682016040523d82523d6000602084013e6112a3565b606091505b5050905080610b5d5760405162461bcd60e51b815260206004820152600d60248201526c1c99599d5b990819985a5b1959609a1b604482015260640161044b565b60035461045e906001600160a01b03848116911683610e54565b6003546040516336012f6160e11b81526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b15801561135457600080fd5b505af1158015611368573d6000803e3d6000fd5b50505050505050565b60006113866001600160a01b0384168361148f565b905080516000141580156113ab5750808060200190518101906113a99190611ab6565b155b15610b5d57604051635274afe760e01b81526001600160a01b038416600482015260240161044b565b60006113df826108a0565b9050808310156114285760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e74207672662066656560601b604482015260640161044b565b61143a6114358285611ad8565b6114a4565b806006600082825461144c9190611a6a565b9091555050505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526111229186918216906323b872dd90608401610e81565b606061149d83836000611535565b9392505050565b801561153257604051600090339083908381818185875af1925050503d80600081146114ec576040519150601f19603f3d011682016040523d82523d6000602084013e6114f1565b606091505b505090508061045e5760405162461bcd60e51b815260206004820152600d60248201526c1c99599d5b990819985a5b1959609a1b604482015260640161044b565b50565b60608147101561155a5760405163cd78605960e01b815230600482015260240161044b565b600080856001600160a01b031684866040516115769190611aff565b60006040518083038185875af1925050503d80600081146115b3576040519150601f19603f3d011682016040523d82523d6000602084013e6115b8565b606091505b50915091506115c88683836115d2565b9695505050505050565b6060826115e7576115e28261162e565b61149d565b81511580156115fe57506001600160a01b0384163b155b1561162757604051639996b31560e01b81526001600160a01b038516600482015260240161044b565b508061149d565b80511561163e5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040518060a001604052806005906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561169e57600080fd5b823591506020808401356001600160401b03808211156116bd57600080fd5b818601915086601f8301126116d157600080fd5b8135818111156116e3576116e3611675565b8060051b604051601f19603f8301168101818110858211171561170857611708611675565b60405291825284820192508381018501918983111561172657600080fd5b938501935b828510156117445784358452938501939285019261172b565b8096505050505050509250929050565b6001600160a01b038116811461153257600080fd5b60006020828403121561177b57600080fd5b813561149d81611754565b60a08101818360005b60058110156117b75781516001600160401b031683526020928301929091019060010161178f565b50505092915050565b6000602082840312156117d257600080fd5b5035919050565b803560ff811681146117ea57600080fd5b919050565b60006020828403121561180157600080fd5b61149d826117d9565b60008060006060848603121561181f57600080fd5b83359250602084013561183181611754565b915061183f604085016117d9565b90509250925092565b634e487b7160e01b600052601160045260246000fd5b6001600160401b0381811683821601908082111561187e5761187e611848565b5092915050565b60006020828403121561189757600080fd5b815161149d81611754565b60ff82811682821603908111156111d5576111d5611848565b634e487b7160e01b600052603260045260246000fd5b600060ff821660ff81036118e7576118e7611848565b60010192915050565b805169ffffffffffffffffffff811681146117ea57600080fd5b600080600080600060a0868803121561192257600080fd5b61192b866118f0565b945060208601519350604086015192506060860151915061194e608087016118f0565b90509295509295909350565b805163ffffffff811681146117ea57600080fd5b805162ffffff811681146117ea57600080fd5b60008060008060008060008060006101208a8c0312156119a057600080fd5b6119a98a61195a565b98506119b760208b0161195a565b97506119c560408b0161195a565b96506119d360608b0161195a565b95506119e160808b0161195a565b94506119ef60a08b0161196e565b93506119fd60c08b0161196e565b9250611a0b60e08b0161196e565b9150611a1a6101008b0161196e565b90509295985092959850929598565b80820281158282048414176111d5576111d5611848565b634e487b7160e01b600052601260045260246000fd5b600082611a6557611a65611a40565b500490565b808201808211156111d5576111d5611848565b600060208284031215611a8f57600080fd5b5051919050565b6001600160401b0382811682821603908082111561187e5761187e611848565b600060208284031215611ac857600080fd5b8151801515811461149d57600080fd5b818103818111156111d5576111d5611848565b600082611afa57611afa611a40565b500690565b6000825160005b81811015611b205760208186018101518583015201611b06565b50600092019182525091905056fea26469706673582212200a25489d8d6e1520253a68196aba409f432f6c5998ed2dc2bc7270c8135eeab164736f6c63430008140033

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

000000000000000000000000ae975071be8f8ee67addbc1a82488f1c2485806700000000000000000000000041cb3a2e51635f680acf3e6c043498782a4f37a500000000000000000000000041cb3a2e51635f680acf3e6c043498782a4f37a50000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802d729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a8000000000000000000000000000000000000000000000000000000000000038e00000000000000000000000000000000000000000000000000000000002625a0

-----Decoded View---------------
Arg [0] : _vrfCoordinator (address): 0xAE975071Be8F8eE67addBC1A82488F1C24858067
Arg [1] : _bankroll (address): 0x41cb3a2e51635F680Acf3E6C043498782a4F37A5
Arg [2] : _trustedForwarder (address): 0x41cb3a2e51635F680Acf3E6C043498782a4F37A5
Arg [3] : _link_eth_feed (address): 0x5787BefDc0ECd210Dfa948264631CD53E68F7802
Arg [4] : _vrfKeyHash (bytes32): 0xd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a8
Arg [5] : _vrfSubId (uint64): 910
Arg [6] : _vrfCallbackGasLimit (uint32): 2500000

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067
Arg [1] : 00000000000000000000000041cb3a2e51635f680acf3e6c043498782a4f37a5
Arg [2] : 00000000000000000000000041cb3a2e51635f680acf3e6c043498782a4f37a5
Arg [3] : 0000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802
Arg [4] : d729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a8
Arg [5] : 000000000000000000000000000000000000000000000000000000000000038e
Arg [6] : 00000000000000000000000000000000000000000000000000000000002625a0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.