Contract 0x060c4f055A3F7797405863518024A82ea1Fcb82F

 

Contract Overview

Balance:
0.200869048159630675 MATIC

MATIC Value:
$0.15 (@ $0.75/MATIC)

Token:
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x36dd72197b89ae104552cc303dc3f7f4e52b44b4833c477b95cf281302a64fd8Wager336939602022-09-29 1:30:589 hrs 46 mins ago0x7286d56c090d5e0324c4ad9f647b58427cbb79d4 IN  0x060c4f055a3f7797405863518024a82ea1fcb82f0.012896257953995 MATIC0.01217973900633.000000017
0x896b4e4dea94ff6c61ad4fd40ccec9945287fe442e8264062ee1cd58b0aeecd8Wager336578302022-09-28 4:47:401 day 6 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f3.512934922825641 MATIC0.009394836003 33.000000014
0x9b4a86a8d942a946d8f47202e4afc2c56381b66edc8d6131ad13f0348fbb7133Wager336533592022-09-28 2:11:431 day 9 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f1.513199591186136 MATIC0.010251826898 33.656245152
0x672444eb283c6e65df0b524cdb31dc97bce3cd91d48e4ef08b17f2bf0029d526Wager336533412022-09-28 2:11:071 day 9 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f2.013426763918436 MATIC0.010559372318 34.66590169
0x3e0d0e4bbe638fd7642487b0feace1d2d75fa998327602e1873e925d02bb4b70Wager336477962022-09-27 22:56:101 day 12 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f5.012858912573375 MATIC0.009394836004 33.000000015
0x22e00e2f8d0d7fed6cd4b37e685fcd135a343e2b9eb027c337fa37f702dfb97aWager336477732022-09-27 22:55:241 day 12 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f5.01285891257315 MATIC0.009394836003 33.000000014
0x47055e516f21f2cf09cbcbdfad176f607b01faa837e576af48e04e8d1bcae496Wager336477442022-09-27 22:54:261 day 12 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f5.01285891257315 MATIC0.009394836003 33.000000014
0x0f907b9f437adac3747c71c8c82b98fe9e4591174ac4ba1f0135b005a456fd18Wager336477152022-09-27 22:53:241 day 12 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f5.01285891257315 MATIC0.009394836003 33.000000014
0xcc7fc6360b6a15359f7ea072fa3455eba54231ed7c695698d2c60d77b511b203Wager336458582022-09-27 21:49:201 day 13 hrs ago0x2a9ecc42cb6ae762ebf4914a9b23019e07f2a92d IN  0x060c4f055a3f7797405863518024a82ea1fcb82f0.78288748256115 MATIC0.009586403337 33.672893294
0xd47fee5542a4d511139665e7f2e6554e60b9bbda1afa582261c1143be247c41fWager336458042022-09-27 21:47:281 day 13 hrs ago0x2a9ecc42cb6ae762ebf4914a9b23019e07f2a92d IN  0x060c4f055a3f7797405863518024a82ea1fcb82f0.782887482560475 MATIC0.010256897988 33.672893291
0xfacfb8048d5b5d477224e24d8192caf084ce63f691270ec00408a95dc16787e4Wager336457082022-09-27 21:44:121 day 13 hrs ago0x2a9ecc42cb6ae762ebf4914a9b23019e07f2a92d IN  0x060c4f055a3f7797405863518024a82ea1fcb82f1.562887482560025 MATIC0.010256897987 33.672893289
0x9bc823b1c2f9e3a80429588490ae47ff578e2bea731847c0e69cdf690822347cWager336456692022-09-27 21:42:501 day 13 hrs ago0x2a9ecc42cb6ae762ebf4914a9b23019e07f2a92d IN  0x060c4f055a3f7797405863518024a82ea1fcb82f0.78288748255935 MATIC0.010256897986 33.672893286
0xf7a026066ff95cb4c4700ad6885f42e7b0daef787700f056ad1fcfb2e10b200eWager336401372022-09-27 18:27:341 day 16 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f1.354878420621875 MATIC0.009708815601 34.100000004
0x465c300bc64cfece73a6d9c1ee0083f0ff9deae0d3761948e832f9d6562f8993Wager336400272022-09-27 18:23:461 day 16 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f1.431708412766 MATIC0.009395628014 33.00000005
0x9dd5eab67f57a9585d0e11ace9f43a2c6eee10092fda7bc6ebf3cd6c0ebf4d66Wager336381342022-09-27 17:18:341 day 17 hrs ago0x319f98abceb11453b2c839993abf9e357d9267c7 IN  0x060c4f055a3f7797405863518024a82ea1fcb82f0.118294463613975 MATIC0.018567385305 57.715742751
0xa86385c6072d62e3714447f5d8ac71f66e7e565e47c9a066594b07d71f98bd33Wager336380452022-09-27 17:15:321 day 18 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f1.2120933171034 MATIC0.021556143213 75.711035604
0x92e6caa1224fb2a8b506bdb0211e5b23b572da320f60287dc20c768512cf7242Wager336380222022-09-27 17:14:461 day 18 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f3.21270154796505 MATIC0.022325801248 78.414283878
0x5ada8c4252e8c56186133806a1ab76b44efa66456e903e9b0ac9428a9fb71af8Wager336379642022-09-27 17:12:461 day 18 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f3.02490279071855 MATIC0.026526769968 87.086085438
0xde58d555b6a5f67377c75c6678b40ab6b4e544a4c572758e2bfee99cbd704608Wager336372552022-09-27 16:46:161 day 18 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f2.204959084655874 MATIC0.012527754169 44.000878664
0x26770da641c26585c3f8aff5e3e54b6a91d3e2b740be0d54e2e1a6506b835250Wager336372192022-09-27 16:45:001 day 18 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f1.914678220254349 MATIC0.015020502503 52.756088535
0xf61909d59d64a1488213580225ddb99113e890e9651cd3d20e44bc241767d232Wager336355262022-09-27 15:46:441 day 19 hrs ago0x6850bb43c088f93bc616a9b4cebafbaff21dcdee IN  0x060c4f055a3f7797405863518024a82ea1fcb82f5.012733988933799 MATIC0.009394854441 33.000064777
0xa912b7a1f14f48aefe9754bec1890f136b9dd5cb6db8a091bc80f46bbe212b1aWager336347792022-09-27 15:21:001 day 19 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f0.910233100807374 MATIC0.009395628599 33.000002104
0x78000cb63cb9ea84efb56c3d5ed7bdfa3a3f1cf65fe83e3ac6deb5b981a13f59Wager336345652022-09-27 15:13:401 day 20 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f4.511859959281024 MATIC0.009395244554 33.000044098
0x8605aa4f24b35261c0f3da69743c48c4725592daedc124a8577c1283dcd2974aWager336342672022-09-27 15:03:221 day 20 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f0.511887002690949 MATIC0.009429463963 33.120237031
0x9c62419c4f4346f4753ffa0c1a0da68255693a1f9f1ad4b148bc126556b8a578Wager336341952022-09-27 14:59:261 day 20 hrs ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x060c4f055a3f7797405863518024a82ea1fcb82f1.003993939502399 MATIC0.009395504231 33.000956193
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xc301d835df889050b650a6a567e820f9510762150b91f7e445272d522d4cba73336715942022-09-28 12:41:0322 hrs 36 mins ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0xfa695010bf9e757a1abcd2703259f419217aa75635.170920325353368056 MATIC
0xe158d48aacdd2572850d0b28d013d39d94edfd5a188f57d2612b81910496330f336578372022-09-28 4:47:541 day 6 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb73.5 MATIC
0x7f9219c6464b63df4f774ead45a8c74f4061e9a4634fc41e29fb123f2250d272336533652022-09-28 2:11:551 day 9 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb71.5 MATIC
0xb7bdab016f1716290a9c858513c581cafca865770c332231118943e7b1454637336533472022-09-28 2:11:191 day 9 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.06 MATIC
0xb7bdab016f1716290a9c858513c581cafca865770c332231118943e7b1454637336533472022-09-28 2:11:191 day 9 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x6850bb43c088f93bc616a9b4cebafbaff21dcdee1.94 MATIC
0x0aa69f7b37eecc2e179080fa556891abac56c98b24024876a57fd0e77c7ea106336478032022-09-27 22:56:241 day 12 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb75 MATIC
0x0f08592398471c83b1b17d8293415787c65b67f31c3a5c6922476d1ad3087188336477812022-09-27 22:55:401 day 12 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.15 MATIC
0x0f08592398471c83b1b17d8293415787c65b67f31c3a5c6922476d1ad3087188336477812022-09-27 22:55:401 day 12 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x6850bb43c088f93bc616a9b4cebafbaff21dcdee4.85 MATIC
0x2ba3f4f5528d059e806f7af46c3f67243326e5dbe4ffd92a81eb908ad27901d1336477512022-09-27 22:54:401 day 12 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.15 MATIC
0x2ba3f4f5528d059e806f7af46c3f67243326e5dbe4ffd92a81eb908ad27901d1336477512022-09-27 22:54:401 day 12 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x6850bb43c088f93bc616a9b4cebafbaff21dcdee4.85 MATIC
0xd587d6b330abbead8dc8a76e148adbebb04fbe86ea50c9619988cba7bf78718e336477232022-09-27 22:53:401 day 12 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.15 MATIC
0xd587d6b330abbead8dc8a76e148adbebb04fbe86ea50c9619988cba7bf78718e336477232022-09-27 22:53:401 day 12 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x6850bb43c088f93bc616a9b4cebafbaff21dcdee4.85 MATIC
0xdb997381e8c60340964d7efa30b4dd4d70478ca1dd0ac4ac1a868725b194e0ed336458652022-09-27 21:49:341 day 13 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.0231 MATIC
0xdb997381e8c60340964d7efa30b4dd4d70478ca1dd0ac4ac1a868725b194e0ed336458652022-09-27 21:49:341 day 13 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x2a9ecc42cb6ae762ebf4914a9b23019e07f2a92d0.7469 MATIC
0x32de6d07457f0235070a26b7e36eb65d64e0edde10aef7c3eaa412e64ee403ec336458122022-09-27 21:47:441 day 13 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.0231 MATIC
0x32de6d07457f0235070a26b7e36eb65d64e0edde10aef7c3eaa412e64ee403ec336458122022-09-27 21:47:441 day 13 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x2a9ecc42cb6ae762ebf4914a9b23019e07f2a92d0.7469 MATIC
0x3d8e1e3bbea3b05ba8332d83cf8ee08221fa07b624107e528dd3deb8de405d23336457142022-09-27 21:44:241 day 13 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.0465 MATIC
0x3d8e1e3bbea3b05ba8332d83cf8ee08221fa07b624107e528dd3deb8de405d23336457142022-09-27 21:44:241 day 13 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x2a9ecc42cb6ae762ebf4914a9b23019e07f2a92d1.5035 MATIC
0xb5769d0031ec263ed0fcb04e83a8fd6c9116b0fa67a5cd2596352508e624a271336456762022-09-27 21:43:041 day 13 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.77 MATIC
0xf912e78522b5446a3c27a0bd9157c469ebc7f3e7ebe6b6aef5178391e10abf25336401452022-09-27 18:27:501 day 16 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb71.341897499125975 MATIC
0x0d1786f51a3e9dd7a5e1b728402ac7b28cd74ed637faf7624bbc06cb92e29c34336400352022-09-27 18:24:021 day 16 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.0425692497377925 MATIC
0x0d1786f51a3e9dd7a5e1b728402ac7b28cd74ed637faf7624bbc06cb92e29c34336400352022-09-27 18:24:021 day 16 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x863c5bf79bb048958f35636cc3455cd61766c36a1.3764057415219575 MATIC
0x4a289c29a45f4b907f6e85d151de9a08be56d304be9a20bdbbb8acec3bfd4108336381412022-09-27 17:18:481 day 17 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.1 MATIC
0xb55100102632daf1a305d453eb1c8b325444a0395d108346e1fcf52eaf3232c8336380512022-09-27 17:15:441 day 18 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f 0x2528401607cc0590d31c2fca129a75dc13b1dbb70.035692497377925 MATIC
0xb55100102632daf1a305d453eb1c8b325444a0395d108346e1fcf52eaf3232c8336380512022-09-27 17:15:441 day 18 hrs ago 0x060c4f055a3f7797405863518024a82ea1fcb82f0x863c5bf79bb048958f35636cc3455cd61766c36a1.154057415219575 MATIC
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
CoinToss

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 8000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 15 : 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 2 of 15 : 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);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  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 3 of 15 : 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;
}

File 4 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 5 of 15 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 6 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 7 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 10 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 15 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 12 of 15 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "./Address.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
abstract contract Multicall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
        return results;
    }
}

File 13 of 15 : IBank.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

/// @notice Minimal interface for Bank.
/// @author Romuald Hog.
interface IBank {
    /// @notice Gets the token's allow status used on the games smart contracts.
    /// @param token Address of the token.
    /// @return Whether the token is enabled for bets.
    function isAllowedToken(address token) external view returns (bool);

    /// @notice Payouts a winning bet, and allocate the house edge fee.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param profit Number of tokens to be sent to the gamer.
    /// @param fees Bet amount and bet profit fees amount.
    function payout(
        address payable user,
        address token,
        uint256 profit,
        uint256 fees
    ) external payable;

    /// @notice Accounts a loss bet.
    /// @dev In case of an ERC20, the bet amount should be transfered prior to this tx.
    /// @dev In case of the gas token, the bet amount is sent along with this tx.
    /// @param tokenAddress Address of the token.
    /// @param amount Loss bet amount.
    function cashIn(address tokenAddress, uint256 amount) external payable;

    /// @notice Calculates the max bet amount based on the token balance, the balance risk, and the game multiplier.
    /// @param token Address of the token.
    /// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit.
    /// @return Maximum bet amount for the token.
    /// @dev The multiplier should be at least 10000.
    function getMaxBetAmount(address token, uint256 multiplier)
        external
        view
        returns (uint256);

    /// @notice Harvests tokens dividends.
    /// @return tokens The list of tokens addresses.
    /// @return amounts The list of tokens' amounts harvested.
    function harvestDividends()
        external
        returns (address[] memory tokens, uint256[] memory amounts);

    /// @notice Get the available tokens dividends amounts.
    /// @return tokens The list of tokens addresses.
    /// @return amounts The list of tokens' amounts harvested.
    function getDividends()
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);

    function getVRFSubId(address token) external view returns (uint64);

    function getTokenOwner(address token) external view returns (address);

    function getMinBetAmount(address token) external view returns (uint256);
}

File 14 of 15 : CoinToss.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

import {Game} from "./Game.sol";

/// @title BetSwirl's Coin Toss game
/// @notice The game is played with a two-sided coin. The game's goal is to guess whether the lucky coin face will be Heads or Tails.
/// @author Romuald Hog (based on Yakitori's Coin Toss)
contract CoinToss is Game {
    /// @notice Full coin toss bet information struct.
    /// @param bet The Bet struct information.
    /// @param diceBet The Coin Toss bet struct information.
    /// @dev Used to package bet information for the front-end.
    struct FullCoinTossBet {
        Bet bet;
        CoinTossBet coinTossBet;
    }

    /// @notice Coin Toss bet information struct.
    /// @param face The chosen coin face.
    /// @param rolled The rolled coin face.
    struct CoinTossBet {
        bool face;
        bool rolled;
    }

    /// @notice Maps bets IDs to chosen and rolled coin faces.
    /// @dev Coin faces: true = Tails, false = Heads.
    mapping(uint256 => CoinTossBet) public coinTossBets;

    /// @notice Emitted after a bet is placed.
    /// @param id The bet ID.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param amount The bet amount.
    /// @param vrfCost The Chainlink VRF cost paid by player.
    /// @param face The chosen coin face.
    event PlaceBet(
        uint256 id,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint256 vrfCost,
        bool face
    );

    /// @notice Emitted after a bet is rolled.
    /// @param id The bet ID.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param amount The bet amount.
    /// @param face The chosen coin face.
    /// @param rolled The rolled coin face.
    /// @param payout The payout amount.
    event Roll(
        uint256 id,
        address indexed user,
        address indexed token,
        uint256 amount,
        bool face,
        bool rolled,
        uint256 payout
    );

    /// @notice Initialize the game base contract.
    /// @param bankAddress The address of the bank.
    /// @param chainlinkCoordinatorAddress Address of the Chainlink VRF Coordinator.
    /// @param LINK_ETH_feedAddress Address of the Chainlink LINK/ETH price feed.
    constructor(
        address bankAddress,
        address chainlinkCoordinatorAddress,
        address LINK_ETH_feedAddress
    ) Game(bankAddress, chainlinkCoordinatorAddress, 1, LINK_ETH_feedAddress) {}

    /// @notice Calculates the target payout amount.
    /// @param betAmount Bet amount.
    /// @return The target payout amount.
    function _getPayout(uint256 betAmount) private pure returns (uint256) {
        return betAmount * 2;
    }

    /// @notice Creates a new bet and stores the chosen coin face.
    /// @param face The chosen coin face.
    /// @param token Address of the token.
    /// @param tokenAmount The number of tokens bet.
    function wager(
        bool face,
        address token,
        uint256 tokenAmount
    ) external payable whenNotPaused {
        Bet memory bet = _newBet(
            token,
            tokenAmount,
            _getPayout(10000)
        );

        coinTossBets[bet.id].face = face;

        emit PlaceBet(bet.id, bet.user, bet.token, bet.amount, bet.vrfCost, face);
    }

    /// @notice Resolves the bet using the Chainlink randomness.
    /// @param id The bet ID.
    /// @param randomWords Random words list. Contains only one for this game.
    // solhint-disable-next-line private-vars-leading-underscore
    function fulfillRandomWords(uint256 id, uint256[] memory randomWords)
        internal
        override
    {
        CoinTossBet storage coinTossBet = coinTossBets[id];
        Bet storage bet = bets[id];

        uint256 rolled = randomWords[0] % 2;

        bool[2] memory coinSides = [false, true];
        bool rolledCoinSide = coinSides[rolled];
        coinTossBet.rolled = rolledCoinSide;
        uint256 payout = _resolveBet(
            bet,
            rolledCoinSide == coinTossBet.face,
            _getPayout(bet.amount)
        );

        emit Roll(
            bet.id,
            bet.user,
            bet.token,
            bet.amount,
            coinTossBet.face,
            rolledCoinSide,
            payout
        );
    }

    /// @notice Gets the list of the last user bets.
    /// @param user Address of the gamer.
    /// @param dataLength The amount of bets to return.
    /// @return A list of Coin Toss bet.
    function getLastUserBets(address user, uint256 dataLength)
        external
        view
        returns (FullCoinTossBet[] memory)
    {
        Bet[] memory lastBets = _getLastUserBets(user, dataLength);
        FullCoinTossBet[] memory lastCoinTossBets = new FullCoinTossBet[](
            lastBets.length
        );
        for (uint256 i; i < lastBets.length; i++) {
            lastCoinTossBets[i] = FullCoinTossBet(
                lastBets[i],
                coinTossBets[lastBets[i].id]
            );
        }
        return lastCoinTossBets;
    }
}

File 15 of 15 : Game.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Multicall} from "@openzeppelin/contracts/utils/Multicall.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import {VRFConsumerBaseV2} from "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
import {VRFCoordinatorV2Interface} from "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

import {IBank} from "../bank/IBank.sol";

// import "hardhat/console.sol";

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

/// @title Game base contract
/// @author Romuald Hog
/// @notice This should be parent contract of each games.
/// It defines all the games common functions and state variables.
/// @dev All rates are in basis point. Chainlink VRF v2 is used.
abstract contract Game is
    Ownable,
    Pausable,
    Multicall,
    VRFConsumerBaseV2,
    ReentrancyGuard
{
    using SafeERC20 for IERC20;

    /// @notice Bet information struct.
    /// @param resolved Whether the bet has been resolved.
    /// @param user Address of the gamer.
    /// @param token Address of the token.
    /// @param id Bet ID generated by Chainlink VRF.
    /// @param amount The bet amount.
    /// @param blockNumber Block number of the bet used to refund in case Chainlink's callback fail.
    /// @param payout The payout amount.
    /// @param vrfCost The Chainlink VRF cost paid by player.
    struct Bet {
        bool resolved;
        address payable user;
        address token;
        uint256 id;
        uint256 amount;
        uint256 blockNumber;
        uint256 payout;
        uint256 vrfCost;
    }

    /// @notice Token struct.
    /// @param houseEdge House edge rate.
    /// @param pendingCount Number of pending bets.
    /// @param VRFCallbackGasLimit How much gas is needed in the Chainlink VRF callback.
    /// @param VRFFees Chainlink's VRF collected fees amount.
    struct Token {
        uint16 houseEdge;
        uint64 pendingCount;
        uint32 VRFCallbackGasLimit;
        uint256 VRFFees;
    }

    /// @notice Chainlink VRF configuration struct.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param numRandomWords How many random words is needed to resolve a game's bet.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    /// @param chainlinkCoordinator Reference to the VRFCoordinatorV2 deployed contract.
    struct ChainlinkConfig {
        uint16 requestConfirmations;
        uint16 numRandomWords;
        bytes32 keyHash;
        IVRFCoordinatorV2 chainlinkCoordinator;
    }

    /// @notice Chainlink VRF configuration state.
    ChainlinkConfig private _chainlinkConfig;

    /// @notice Chainlink price feed.
    AggregatorV3Interface private immutable _LINK_ETH_feed;

    /// @notice Maps bets IDs to Bet information.
    mapping(uint256 => Bet) public bets;

    /// @notice Maps users addresses to bets IDs
    mapping(address => uint256[]) internal _userBets;

    /// @notice Maps tokens addresses to token configuration.
    mapping(address => Token) public tokens;

    /// @notice The bank that manage to payout a won bet and collect a loss bet.
    IBank public bank;

    /// @notice Emitted after the bank is set.
    /// @param bank Address of the bank contract.
    event SetBank(address bank);

    /// @notice Emitted after the house edge is set for a token.
    /// @param token Address of the token.
    /// @param houseEdge House edge rate.
    event SetHouseEdge(address indexed token, uint16 houseEdge);

    /// @notice Emitted after the Chainlink callback gas limit is set for a token.
    /// @param token Address of the token.
    /// @param callbackGasLimit New Chainlink VRF callback gas limit.
    event SetVRFCallbackGasLimit(
        address indexed token,
        uint32 callbackGasLimit
    );

    /// @notice Emitted after the Chainlink config is set.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    event SetChainlinkConfig(uint16 requestConfirmations, bytes32 keyHash);

    /// @notice Emitted after the bet amount is transfered to the user.
    /// @param id The bet ID.
    /// @param user Address of the gamer.
    /// @param amount Number of tokens refunded.
    /// @param chainlinkVRFCost The Chainlink VRF cost refunded to player.
    event BetRefunded(
        uint256 id,
        address user,
        uint256 amount,
        uint256 chainlinkVRFCost
    );

    /// @notice Emitted after the token's VRF fees amount is transfered to the user.
    /// @param token Address of the token.
    /// @param amount Number of tokens refunded.
    event DistributeTokenVRFFees(address indexed token, uint256 amount);

    /// @notice Insufficient bet amount.
    /// @param minBetAmount Bet amount.
    error UnderMinBetAmount(uint256 minBetAmount);

    /// @notice Bet provided doesn't exist or was already resolved.
    error NotPendingBet();

    /// @notice Bet isn't resolved yet.
    error NotFulfilled();

    /// @notice House edge is capped at 4%.
    error ExcessiveHouseEdge();

    /// @notice Token is not allowed.
    error ForbiddenToken();

    /// @notice Chainlink price feed not working
    /// @param linkWei LINK/ETH price returned.
    error InvalidLinkWeiPrice(int256 linkWei);

    /// @notice The msg.value is not enough to cover Chainlink's fee.
    error WrongGasValueToCoverFee();

    /// @notice Reverting error when sender isn't allowed.
    error AccessDenied();

    /// @notice Reverting error when provided address isn't valid.
    error InvalidAddress();

    /// @notice Reverting error when bet resolution cost refund to user failed.
    error BetVRFCostRefundFailed();

    /// @notice Reverting error when token has pending bets.
    error TokenHasPendingBets();

    /// @notice Initialize contract's state variables and VRF Consumer.
    /// @param bankAddress The address of the bank.
    /// @param chainlinkCoordinatorAddress Address of the Chainlink VRF Coordinator.
    /// @param numRandomWords How many random words is needed to resolve a game's bet.
    /// @param LINK_ETH_feedAddress Address of the Chainlink LINK/ETH price feed.
    constructor(
        address bankAddress,
        address chainlinkCoordinatorAddress,
        uint16 numRandomWords,
        address LINK_ETH_feedAddress
    ) VRFConsumerBaseV2(chainlinkCoordinatorAddress) {
        if (
            LINK_ETH_feedAddress == address(0) ||
            chainlinkCoordinatorAddress == address(0)
        ) {
            revert InvalidAddress();
        }
        require(
            numRandomWords != 0 && numRandomWords <= 500,
            "Wrong Chainlink NumRandomWords"
        );

        setBank(IBank(bankAddress));
        _chainlinkConfig.chainlinkCoordinator = IVRFCoordinatorV2(
            chainlinkCoordinatorAddress
        );
        _chainlinkConfig.numRandomWords = numRandomWords;
        _LINK_ETH_feed = AggregatorV3Interface(LINK_ETH_feedAddress);
    }

    /// @notice Calculates the amount's fee based on the house edge.
    /// @param token Address of the token.
    /// @param amount From which the fee amount will be calculated.
    /// @return The fee amount.
    function _getFees(address token, uint256 amount)
        private
        view
        returns (uint256)
    {
        return (tokens[token].houseEdge * amount) / 10000;
    }

    /// @notice Creates a new bet and request randomness to Chainlink,
    /// transfer the ERC20 tokens to the contract or refund the bet amount overflow if the bet amount exceed the maxBetAmount.
    /// @param tokenAddress Address of the token.
    /// @param tokenAmount The number of tokens bet.
    /// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit.
    /// @return A new Bet struct information.
    function _newBet(
        address tokenAddress,
        uint256 tokenAmount,
        uint256 multiplier
    ) internal whenNotPaused nonReentrant returns (Bet memory) {
        Token storage token = tokens[tokenAddress];
        if (
            bank.isAllowedToken(tokenAddress) == false || token.houseEdge == 0
        ) {
            revert ForbiddenToken();
        }

        address user = msg.sender;
        bool isGasToken = tokenAddress == address(0);
        uint256 fee = isGasToken ? (msg.value - tokenAmount) : msg.value;
        uint256 betAmount = isGasToken ? msg.value - fee : tokenAmount;

        // Charge user for Chainlink VRF fee.
        {
            uint256 chainlinkVRFCost = getChainlinkVRFCost(tokenAddress);
            if (fee < (chainlinkVRFCost - ((10 * chainlinkVRFCost) / 100))) {
                // 5% slippage.
                revert WrongGasValueToCoverFee();
            }
            token.VRFFees += fee;
        }

        // Bet amount is capped.
        {
            uint256 minBetAmount = bank.getMinBetAmount(tokenAddress);
            if (betAmount < minBetAmount) {
                revert UnderMinBetAmount(minBetAmount);
            }

            uint256 maxBetAmount = bank.getMaxBetAmount(
                tokenAddress,
                multiplier
            );
            if (betAmount > maxBetAmount) {
                if (isGasToken) {
                    payable(user).transfer(betAmount - maxBetAmount);
                }
                betAmount = maxBetAmount;
            }
        }

        // Create bet
        uint256 id = _chainlinkConfig.chainlinkCoordinator.requestRandomWords(
            _chainlinkConfig.keyHash,
            bank.getVRFSubId(tokenAddress),
            _chainlinkConfig.requestConfirmations,
            token.VRFCallbackGasLimit,
            _chainlinkConfig.numRandomWords
        );
        Bet memory newBet = Bet(
            false,
            payable(user),
            tokenAddress,
            id,
            betAmount,
            block.number,
            0,
            fee
        );
        _userBets[user].push(id);
        bets[id] = newBet;
        token.pendingCount++;

        // If ERC20, transfer the tokens
        if (!isGasToken) {
            IERC20(tokenAddress).safeTransferFrom(
                user,
                address(this),
                betAmount
            );
        }

        return newBet;
    }

    /// @notice Resolves the bet based on the game child contract result.
    /// In case bet is won, the bet amount minus the house edge is transfered to user from the game contract, and the profit is transfered to the user from the Bank.
    /// In case bet is lost, the bet amount is transfered to the Bank from the game contract.
    /// @param bet The Bet struct information.
    /// @param wins Whether the bet is winning.
    /// @param payout What should be sent to the user in case of a won bet. Payout = bet amount + profit amount.
    /// @return The payout amount.
    /// @dev Should not revert as it resolves the bet with the randomness.
    function _resolveBet(
        Bet storage bet,
        bool wins,
        uint256 payout
    ) internal returns (uint256) {
        if (bet.resolved == true || bet.user == address(0)) {
            revert NotPendingBet();
        }
        bet.resolved = true;

        address token = bet.token;
        tokens[token].pendingCount--;

        uint256 betAmount = bet.amount;
        bool isGasToken = bet.token == address(0);
        // Check for the result
        if (wins) {
            address payable user = bet.user;

            uint256 profit = payout - betAmount;
            uint256 betAmountFee = _getFees(token, betAmount);
            uint256 profitFee = _getFees(token, profit);
            uint256 fee = betAmountFee + profitFee;

            payout -= fee;

            uint256 betAmountPayout = betAmount - betAmountFee;
            uint256 profitPayout = profit - profitFee;
            // Transfer the bet amount payout to the player
            if (isGasToken) {
                user.transfer(betAmountPayout);
            } else {
                IERC20(token).safeTransfer(user, betAmountPayout);
                // Transfer the bet amount fee to the bank.
                IERC20(token).safeTransfer(address(bank), betAmountFee);
            }

            // Transfer the payout from the bank, the bet amount fee to the bank, and account fees.
            bank.payout{value: isGasToken ? betAmountFee : 0}(
                user,
                token,
                profitPayout,
                fee
            );
        } else {
            payout = 0;
            if (!isGasToken) {
                IERC20(token).safeTransfer(address(bank), betAmount);
            }
            bank.cashIn{value: isGasToken ? betAmount : 0}(token, betAmount);
        }

        bet.payout = payout;
        return payout;
    }

    /// @notice Gets the list of the last user bets.
    /// @param user Address of the gamer.
    /// @param dataLength The amount of bets to return.
    /// @return A list of Bet.
    function _getLastUserBets(address user, uint256 dataLength)
        internal
        view
        returns (Bet[] memory)
    {
        uint256[] memory userBetsIds = _userBets[user];
        uint256 betsLength = userBetsIds.length;

        if (betsLength < dataLength) {
            dataLength = betsLength;
        }

        Bet[] memory userBets = new Bet[](dataLength);
        if (dataLength != 0) {
            uint256 userBetsIndex;
            for (uint256 i = betsLength; i > betsLength - dataLength; i--) {
                userBets[userBetsIndex] = bets[userBetsIds[i - 1]];
                userBetsIndex++;
            }
        }

        return userBets;
    }

    /// @notice Sets the game house edge rate for a specific token.
    /// @param token Address of the token.
    /// @param houseEdge House edge rate.
    /// @dev The house edge rate couldn't exceed 4%.
    function setHouseEdge(address token, uint16 houseEdge) external onlyOwner {
        if (houseEdge > 400) {
            revert ExcessiveHouseEdge();
        }
        if (hasPendingBets(token)) {
            revert TokenHasPendingBets();
        }
        tokens[token].houseEdge = houseEdge;
        emit SetHouseEdge(token, houseEdge);
    }

    /// @notice Pauses the contract to disable new bets.
    function pause() external onlyOwner {
        if (paused()) {
            _unpause();
        } else {
            _pause();
        }
    }

    /// @notice Sets the Chainlink VRF V2 configuration.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    function setChainlinkConfig(uint16 requestConfirmations, bytes32 keyHash)
        external
        onlyOwner
    {
        _chainlinkConfig.requestConfirmations = requestConfirmations;
        _chainlinkConfig.keyHash = keyHash;
        emit SetChainlinkConfig(requestConfirmations, keyHash);
    }

    /// @notice Sets the Chainlink VRF V2 configuration.
    /// @param callbackGasLimit How much gas is needed in the Chainlink VRF callback.
    function setVRFCallbackGasLimit(address token, uint32 callbackGasLimit)
        external
        onlyOwner
    {
        tokens[token].VRFCallbackGasLimit = callbackGasLimit;
        emit SetVRFCallbackGasLimit(token, callbackGasLimit);
    }

    /// @notice Distributes the token's collected Chainlink fees.
    /// @param token Address of the token.
    function withdrawTokensVRFFees(address token) external {
        uint256 tokenChainlinkFees = tokens[token].VRFFees;
        if (tokenChainlinkFees != 0) {
            delete tokens[token].VRFFees;
            payable(bank.getTokenOwner(token)).transfer(tokenChainlinkFees);
            emit DistributeTokenVRFFees(token, tokenChainlinkFees);
        }
    }

    /// @notice Refunds the bet to the user if the Chainlink VRF callback failed.
    /// @param id The Bet ID.
    function refundBet(uint256 id) external nonReentrant {
        Bet storage bet = bets[id];
        if (bet.resolved == true) {
            revert NotPendingBet();
        } else if (block.number < bet.blockNumber + 30) {
            revert NotFulfilled();
        }

        Token storage token = tokens[bet.token];
        token.pendingCount--;

        bet.resolved = true;
        bet.payout = bet.amount;

        if (bet.token == address(0)) {
            payable(bet.user).transfer(bet.amount);
        } else {
            IERC20(bet.token).safeTransfer(bet.user, bet.amount);
        }

        uint256 chainlinkVRFCost = bet.vrfCost;
        if (
            token.VRFFees >= chainlinkVRFCost &&
            address(this).balance >= chainlinkVRFCost
        ) {
            token.VRFFees -= chainlinkVRFCost;
            payable(bet.user).transfer(chainlinkVRFCost);
            emit BetRefunded(id, bet.user, bet.amount, chainlinkVRFCost);
        } else {
            revert BetVRFCostRefundFailed();
        }
    }

    /// @notice Returns the Chainlink VRF config.
    /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding.
    /// @param keyHash Hash of the public key used to verify the VRF proof.
    /// @param chainlinkCoordinator Reference to the VRFCoordinatorV2 deployed contract.
    function getChainlinkConfig()
        external
        view
        returns (
            uint16 requestConfirmations,
            bytes32 keyHash,
            IVRFCoordinatorV2 chainlinkCoordinator
        )
    {
        return (
            _chainlinkConfig.requestConfirmations,
            _chainlinkConfig.keyHash,
            _chainlinkConfig.chainlinkCoordinator
        );
    }

    /// @notice Returns whether the token has pending bets.
    /// @return Whether the token has pending bets.
    function hasPendingBets(address token) public view returns (bool) {
        return tokens[token].pendingCount != 0;
    }

    /// @notice Sets the Bank contract.
    /// @param _bank Address of the Bank contract.
    function setBank(IBank _bank) public onlyOwner {
        if (address(_bank) == address(0)) {
            revert InvalidAddress();
        }
        bank = _bank;
        emit SetBank(address(_bank));
    }

    /// @notice Returns the amount of ETH that should be passed to the wager transaction.
    /// to cover Chainlink VRF fee.
    /// @return The bet resolution cost amount.
    function getChainlinkVRFCost(address token) public view returns (uint256) {
        (, int256 weiPerUnitLink, , , ) = _LINK_ETH_feed.latestRoundData();
        if (weiPerUnitLink <= 0) {
            revert InvalidLinkWeiPrice(weiPerUnitLink);
        }
        // Get Chainlink VRF v2 fee amount.
        (
            uint32 fulfillmentFlatFeeLinkPPMTier1,
            ,
            ,
            ,
            ,
            ,
            ,
            ,

        ) = _chainlinkConfig.chainlinkCoordinator.getFeeConfig();
        // 115000 gas is the average Verification gas of Chainlink VRF.
        return
            (tx.gasprice * (115000 + tokens[token].VRFCallbackGasLimit)) +
            ((1e12 *
                uint256(fulfillmentFlatFeeLinkPPMTier1) *
                uint256(weiPerUnitLink)) / 1e18);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"bankAddress","type":"address"},{"internalType":"address","name":"chainlinkCoordinatorAddress","type":"address"},{"internalType":"address","name":"LINK_ETH_feedAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[],"name":"BetVRFCostRefundFailed","type":"error"},{"inputs":[],"name":"ExcessiveHouseEdge","type":"error"},{"inputs":[],"name":"ForbiddenToken","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[{"internalType":"int256","name":"linkWei","type":"int256"}],"name":"InvalidLinkWeiPrice","type":"error"},{"inputs":[],"name":"NotFulfilled","type":"error"},{"inputs":[],"name":"NotPendingBet","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"TokenHasPendingBets","type":"error"},{"inputs":[{"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"UnderMinBetAmount","type":"error"},{"inputs":[],"name":"WrongGasValueToCoverFee","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainlinkVRFCost","type":"uint256"}],"name":"BetRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeTokenVRFFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vrfCost","type":"uint256"},{"indexed":false,"internalType":"bool","name":"face","type":"bool"}],"name":"PlaceBet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"face","type":"bool"},{"indexed":false,"internalType":"bool","name":"rolled","type":"bool"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"}],"name":"Roll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bank","type":"address"}],"name":"SetBank","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"indexed":false,"internalType":"bytes32","name":"keyHash","type":"bytes32"}],"name":"SetChainlinkConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"SetHouseEdge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"SetVRFCallbackGasLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"bank","outputs":[{"internalType":"contract IBank","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bets","outputs":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address payable","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"coinTossBets","outputs":[{"internalType":"bool","name":"face","type":"bool"},{"internalType":"bool","name":"rolled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainlinkConfig","outputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"contract IVRFCoordinatorV2","name":"chainlinkCoordinator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getChainlinkVRFCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"dataLength","type":"uint256"}],"name":"getLastUserBets","outputs":[{"components":[{"components":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address payable","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"internalType":"struct Game.Bet","name":"bet","type":"tuple"},{"components":[{"internalType":"bool","name":"face","type":"bool"},{"internalType":"bool","name":"rolled","type":"bool"}],"internalType":"struct CoinToss.CoinTossBet","name":"coinTossBet","type":"tuple"}],"internalType":"struct CoinToss.FullCoinTossBet[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"hasPendingBets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","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":"id","type":"uint256"}],"name":"refundBet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBank","name":"_bank","type":"address"}],"name":"setBank","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"}],"name":"setChainlinkConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"setHouseEdge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"setVRFCallbackGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"uint16","name":"houseEdge","type":"uint16"},{"internalType":"uint64","name":"pendingCount","type":"uint64"},{"internalType":"uint32","name":"VRFCallbackGasLimit","type":"uint32"},{"internalType":"uint256","name":"VRFFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"face","type":"bool"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"wager","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawTokensVRFFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b50604051620035a2380380620035a28339810160408190526200003491620002ad565b82826001838262000045336200015c565b6000805460ff60a01b191690556001600160a01b0390811660805260018055811615806200007a57506001600160a01b038316155b15620000995760405163e6c4247b60e01b815260040160405180910390fd5b61ffff821615801590620000b357506101f48261ffff1611155b620001055760405162461bcd60e51b815260206004820152601e60248201527f57726f6e6720436861696e6c696e6b204e756d52616e646f6d576f726473000060448201526064015b60405180910390fd5b6200011084620001ac565b600480546001600160a01b039485166001600160a01b03199091161790556002805461ffff909316620100000263ffff000019909316929092179091551660a05250620002f792505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620001b662000232565b6001600160a01b038116620001de5760405163e6c4247b60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb2612440679060200160405180910390a150565b6000546001600160a01b031633146200028e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620000fc565b565b80516001600160a01b0381168114620002a857600080fd5b919050565b600080600060608486031215620002c357600080fd5b620002ce8462000290565b9250620002de6020850162000290565b9150620002ee6040850162000290565b90509250925092565b60805160a05161327e620003246000396000610ae70152600081816106c4015261071f015261327e6000f3fe6080604052600436106101755760003560e01c80638456cb59116100cb578063c2fb579f1161007f578063e32fe50411610059578063e32fe5041461052b578063e48603391461054b578063f2fde38b146105e557600080fd5b8063c2fb579f1461048e578063e051ece9146104bb578063e1fdb4b41461050b57600080fd5b8063982c3fdd116100b0578063982c3fdd14610413578063a23cd7df14610441578063ac9650d81461046157600080fd5b80638456cb59146103e05780638da5cb5b146103f557600080fd5b80635c975abb1161012d57806376cdb03b1161010757806376cdb03b1461034957806378bcde22146103815780637d0807d7146103a157600080fd5b80635c975abb146102e4578063707cd55e14610314578063715018a61461033457600080fd5b806322af00fa1161015e57806322af00fa146101bc57806350462ea014610279578063594043fd1461028c57600080fd5b8063090d23b91461017a5780631fe543e31461019c575b600080fd5b34801561018657600080fd5b5061019a610195366004612937565b610605565b005b3480156101a857600080fd5b5061019a6101b7366004612983565b6106b9565b3480156101c857600080fd5b5061022b6101d7366004612a6b565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460069095015460ff8516966101009095046001600160a01b039081169694169492939192919088565b6040805198151589526001600160a01b0397881660208a015295909616948701949094526060860192909252608085015260a084015260c083015260e0820152610100015b60405180910390f35b61019a610287366004612a92565b61075f565b34801561029857600080fd5b506102d46102a7366004612937565b6001600160a01b031660009081526007602052604090205462010000900467ffffffffffffffff16151590565b6040519015158152602001610270565b3480156102f057600080fd5b5060005474010000000000000000000000000000000000000000900460ff166102d4565b34801561032057600080fd5b5061019a61032f366004612937565b610832565b34801561034057600080fd5b5061019a610973565b34801561035557600080fd5b50600854610369906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b34801561038d57600080fd5b5061019a61039c366004612aea565b610987565b3480156103ad57600080fd5b506002546003546004546040805161ffff909416845260208401929092526001600160a01b031690820152606001610270565b3480156103ec57600080fd5b5061019a610aa7565b34801561040157600080fd5b506000546001600160a01b0316610369565b34801561041f57600080fd5b5061043361042e366004612937565b610ae2565b604051908152602001610270565b34801561044d57600080fd5b5061019a61045c366004612b1f565b610cce565b34801561046d57600080fd5b5061048161047c366004612b49565b610d49565b6040516102709190612c2c565b34801561049a57600080fd5b506104ae6104a9366004612cac565b610e3f565b6040516102709190612cca565b3480156104c757600080fd5b506104f46104d6366004612a6b565b60096020526000908152604090205460ff8082169161010090041682565b604080519215158352901515602083015201610270565b34801561051757600080fd5b5061019a610526366004612a6b565b610fcd565b34801561053757600080fd5b5061019a610546366004612d92565b6112e4565b34801561055757600080fd5b506105ac610566366004612937565b6007602052600090815260409020805460019091015461ffff82169162010000810467ffffffffffffffff16916a010000000000000000000090910463ffffffff169084565b6040805161ffff909516855267ffffffffffffffff909316602085015263ffffffff909116918301919091526060820152608001610270565b3480156105f157600080fd5b5061019a610600366004612937565b611376565b61060d611406565b6001600160a01b03811661064d576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb2612440679060200160405180910390a150565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610751576040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b61075b8282611460565b5050565b6107676115be565b600061077e8383610779612710611629565b611636565b6060818101805160009081526009602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168a15159081179091558286015182870151945160808089015160e08a015187519384529583015294810193909352948201529394506001600160a01b039283169392909116917fa056e15b055f378463e53b317d9503bc9aba54ace23957ea9ff7fbfa0bf2efc0910160405180910390a350505050565b6001600160a01b038116600090815260076020526040902060010154801561075b576001600160a01b038281166000818152600760205260408082206001019190915560085490517fdc17c9ca00000000000000000000000000000000000000000000000000000000815260048101929092529091169063dc17c9ca90602401602060405180830381865afa1580156108cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f39190612dcb565b6001600160a01b03166108fc829081150290604051600060405180830381858888f1935050505015801561092b573d6000803e3d6000fd5b50816001600160a01b03167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af568260405161096791815260200190565b60405180910390a25050565b61097b611406565b6109856000611d7a565b565b61098f611406565b6101908161ffff1611156109cf576040517f70b5774c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660009081526007602052604090205462010000900467ffffffffffffffff1615610a2f576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac8129101610967565b610aaf611406565b60005474010000000000000000000000000000000000000000900460ff1615610ada57610985611de2565b610985611e52565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b679190612e02565b50505091505060008113610baa576040517f43d4cf6600000000000000000000000000000000000000000000000000000000815260048101829052602401610748565b60048054604080517f5fbbc0d200000000000000000000000000000000000000000000000000000000815290516000936001600160a01b0390931692635fbbc0d292808201926101209290918290030181865afa158015610c0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c339190612e65565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610c5e9190612f4a565b610c689190612f4a565b610c729190612fb6565b6001600160a01b038516600090815260076020526040902054610cac906a0100000000000000000000900463ffffffff166201c138612fca565b610cbc9063ffffffff163a612f4a565b610cc69190612fe7565b949350505050565b610cd6611406565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff8416908117909155600382905560408051918252602082018390527f312eab8f28128692f3404f828c413db540bc15a246c46d0b40e3c004b947c437910160405180910390a15050565b60608167ffffffffffffffff811115610d6457610d64612954565b604051908082528060200260200182016040528015610d9757816020015b6060815260200190600190039081610d825790505b50905060005b82811015610e3757610e0730858584818110610dbb57610dbb612ffa565b9050602002810190610dcd9190613029565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611ec192505050565b828281518110610e1957610e19612ffa565b60200260200101819052508080610e2f90613095565b915050610d9d565b505b92915050565b60606000610e4d8484611eed565b90506000815167ffffffffffffffff811115610e6b57610e6b612954565b604051908082528060200260200182016040528015610efe57816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e083018290526101008301829052610120830182905282528251808401909352808352602080840191909152810191909152815260200190600190039081610e895790505b50905060005b8251811015610fc4576040518060400160405280848381518110610f2a57610f2a612ffa565b6020026020010151815260200160096000868581518110610f4d57610f4d612ffa565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525460ff808216151583526101009091041615159181019190915290528251839083908110610fa657610fa6612ffa565b60200260200101819052508080610fbc90613095565b915050610f04565b50949350505050565b60026001540361101f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610748565b6002600190815560008281526005602052604090208054909160ff90911615159003611077576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481015461108790601e612fe7565b4310156110c0576040517f07bc6c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018101546001600160a01b03166000908152600760205260409020805462010000900467ffffffffffffffff168160026110fa836130cd565b825467ffffffffffffffff9182166101009390930a92830291909202199091161790555081547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081178355600383015460058401558201546001600160a01b03166111aa57815460038301546040516101009092046001600160a01b0316916108fc82150291906000818181858888f193505050501580156111a4573d6000803e3d6000fd5b506111d5565b8154600383015460018401546111d5926001600160a01b039182169261010090910490911690612118565b6006820154600182015481118015906111ee5750804710155b156112a85780826001016000828254611207919061310f565b909155505082546040516101009091046001600160a01b0316906108fc8315029083906000818181858888f19350505050158015611249573d6000803e3d6000fd5b5082546003840154604080518781526101009093046001600160a01b03166020840152820152606081018290527fe282fd838bb937af0c0f54e49ba5f86229ed0c90344c3cc4e2135cb673493e699060800160405180910390a16112da565b6040517fb0ee34b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050600180555050565b6112ec611406565b6001600160a01b03821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a010000000000000000000063ffffffff87169081029190911790915591519182527f9edb52532d26512950c91a14b132f6df3cd06bfb49e795e03e56736121cd24a89101610967565b61137e611406565b6001600160a01b0381166113fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610748565b61140381611d7a565b50565b6000546001600160a01b031633146109855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610748565b6000828152600960209081526040808320600590925282208351919290916002908590839061149157611491612ffa565b60200260200101516114a39190613122565b60408051808201909152600080825260016020830152919250908183600281106114cf576114cf612ffa565b602002015185547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff81166101008315159081029182178955600388015493945060009361153493899360ff91821691161715159091149061152f90611629565b6121e4565b60018601548654600288015460038901548a5460408051938452602084019290925260ff161515908201528515156060820152608081018490529293506001600160a01b0391821692610100909104909116907f4a6c40516242d2bc8453081e1746087d26dc596dcc95d61f76381accb74699399060a00160405180910390a35050505050505050565b60005474010000000000000000000000000000000000000000900460ff16156109855760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610748565b6000610e39826002612f4a565b61169260405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b61169a6115be565b6002600154036116ec5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610748565b60026001556001600160a01b038481166000818152600760205260409081902060085491517fcbe230c3000000000000000000000000000000000000000000000000000000008152600481019390935292169063cbe230c390602401602060405180830381865afa158015611765573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117899190613136565b15806117985750805461ffff16155b156117cf576040517fc455905500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038616156000816117e857346117f2565b6117f2873461310f565b9050600082611801578761180b565b61180b823461310f565b905060006118188a610ae2565b9050606461182782600a612f4a565b6118319190612fb6565b61183b908261310f565b831015611874576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b828660010160008282546118889190612fe7565b90915550506008546040517ff6b2a2f10000000000000000000000000000000000000000000000000000000081526001600160a01b038c81166004830152600093509091169063f6b2a2f190602401602060405180830381865afa1580156118f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119189190613153565b905080821015611957576040517f022558f400000000000000000000000000000000000000000000000000000000815260048101829052602401610748565b6008546040517f278b39de0000000000000000000000000000000000000000000000000000000081526001600160a01b038c81166004830152602482018b9052600092169063278b39de90604401602060405180830381865afa1580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e69190613153565b905080831115611a3b578415611a37576001600160a01b0386166108fc611a0d838661310f565b6040518115909202916000818181858888f19350505050158015611a35573d6000803e3d6000fd5b505b8092505b5050600480546003546008546040517f279e34150000000000000000000000000000000000000000000000000000000081526001600160a01b038e81169582019590955260009493841693635d3b1d309392169063279e341590602401602060405180830381865afa158015611ab5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad9919061316c565b6002548a5460405160e086901b7fffffffff00000000000000000000000000000000000000000000000000000000168152600481019490945267ffffffffffffffff909216602484015261ffff80821660448501526a010000000000000000000090920463ffffffff16606484015262010000900416608482015260a4016020604051808303816000875af1158015611b76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9a9190613153565b90506000604051806101000160405280600015158152602001876001600160a01b031681526020018c6001600160a01b031681526020018381526020018481526020014381526020016000815260200185815250905060066000876001600160a01b03166001600160a01b03168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806005600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e0820151816006015590505086600001600281819054906101000a900467ffffffffffffffff1680929190611d2790613196565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505084611d6857611d686001600160a01b038c1687308661253e565b600180559a9950505050505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611dea612595565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611e5a6115be565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e353390565b6060611ee68383604051806060016040528060278152602001613222602791396125ff565b9392505050565b6001600160a01b0382166000908152600660209081526040808320805482518185028101850190935280835260609493830182828015611f4c57602002820191906000526020600020905b815481526020019060010190808311611f38575b5050835193945050505083811015611f62578093505b60008467ffffffffffffffff811115611f7d57611f7d612954565b60405190808252806020026020018201604052801561200a57816020015b611ff760405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081611f9b5790505b509050841561210f576000825b612021878561310f565b81111561210c57600560008661203860018561310f565b8151811061204857612048612ffa565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff811615158352046001600160a01b03908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015283518490849081106120e0576120e0612ffa565b602002602001018190525081806120f690613095565b9250508080612104906131bd565b915050612017565b50505b95945050505050565b6040516001600160a01b0383166024820152604481018290526121df9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526126f3565b505050565b825460009060ff161515600114806122095750835461010090046001600160a01b0316155b15612240576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811785558401546001600160a01b03166000818152600760205260409020805467ffffffffffffffff62010000909104169060026122a4836130cd565b825467ffffffffffffffff9182166101009390930a928302919092021990911617905550600385015460018601546001600160a01b031615851561247357865461010090046001600160a01b031660006122fe848861310f565b9050600061230c86866127d8565b9050600061231a87846127d8565b905060006123288284612fe7565b9050612334818b61310f565b99506000612342848961310f565b90506000612350848761310f565b90508715612394576040516001600160a01b0388169083156108fc029084906000818181858888f1935050505015801561238e573d6000803e3d6000fd5b506123c2565b6123a86001600160a01b038b168884612118565b6008546123c2906001600160a01b038c8116911687612118565b6008546001600160a01b0316631f615023896123df5760006123e1565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03808c1660048301528e16602482015260448101859052606481018790526084016000604051808303818588803b15801561244e57600080fd5b505af1158015612462573d6000803e3d6000fd5b50505050505050505050505061252d565b600094508061249657600854612496906001600160a01b03858116911684612118565b6008546001600160a01b0316633138809d826124b35760006124b5565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0387166004820152602481018690526044016000604051808303818588803b15801561251357600080fd5b505af1158015612527573d6000803e3d6000fd5b50505050505b505050506005929092018290555090565b6040516001600160a01b038085166024830152831660448201526064810182905261258f9085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161215d565b50505050565b60005474010000000000000000000000000000000000000000900460ff166109855760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610748565b60606001600160a01b0384163b61267e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610748565b600080856001600160a01b03168560405161269991906131f2565b600060405180830381855af49150503d80600081146126d4576040519150601f19603f3d011682016040523d82523d6000602084013e6126d9565b606091505b50915091506126e982828661280e565b9695505050505050565b6000612748826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128479092919063ffffffff16565b8051909150156121df57808060200190518101906127669190613136565b6121df5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610748565b6001600160a01b0382166000908152600760205260408120546127109061280490849061ffff16612f4a565b611ee69190612fb6565b6060831561281d575081611ee6565b82511561282d5782518084602001fd5b8160405162461bcd60e51b8152600401610748919061320e565b6060610cc68484600085856001600160a01b0385163b6128a95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610748565b600080866001600160a01b031685876040516128c591906131f2565b60006040518083038185875af1925050503d8060008114612902576040519150601f19603f3d011682016040523d82523d6000602084013e612907565b606091505b509150915061291782828661280e565b979650505050505050565b6001600160a01b038116811461140357600080fd5b60006020828403121561294957600080fd5b8135611ee681612922565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806040838503121561299657600080fd5b8235915060208084013567ffffffffffffffff808211156129b657600080fd5b818601915086601f8301126129ca57600080fd5b8135818111156129dc576129dc612954565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715612a1f57612a1f612954565b604052918252848201925083810185019189831115612a3d57600080fd5b938501935b82851015612a5b57843584529385019392850192612a42565b8096505050505050509250929050565b600060208284031215612a7d57600080fd5b5035919050565b801515811461140357600080fd5b600080600060608486031215612aa757600080fd5b8335612ab281612a84565b92506020840135612ac281612922565b929592945050506040919091013590565b803561ffff81168114612ae557600080fd5b919050565b60008060408385031215612afd57600080fd5b8235612b0881612922565b9150612b1660208401612ad3565b90509250929050565b60008060408385031215612b3257600080fd5b612b3b83612ad3565b946020939093013593505050565b60008060208385031215612b5c57600080fd5b823567ffffffffffffffff80821115612b7457600080fd5b818501915085601f830112612b8857600080fd5b813581811115612b9757600080fd5b8660208260051b8501011115612bac57600080fd5b60209290920196919550909350505050565b60005b83811015612bd9578181015183820152602001612bc1565b50506000910152565b60008151808452612bfa816020860160208601612bbe565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612c9f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612c8d858351612be2565b94509285019290850190600101612c53565b5092979650505050505050565b60008060408385031215612cbf57600080fd5b8235612b3b81612922565b602080825282518282018190526000919060409081850190868401855b82811015612d735781518051805115158652878101516001600160a01b0390811689880152878201511687870152606080820151908701526080808201519087015260a0808201519087015260c0808201519087015260e09081015190860152860151805115156101008601526020015115156101208501526101409093019290850190600101612ce7565b5091979650505050505050565b63ffffffff8116811461140357600080fd5b60008060408385031215612da557600080fd5b8235612db081612922565b91506020830135612dc081612d80565b809150509250929050565b600060208284031215612ddd57600080fd5b8151611ee681612922565b805169ffffffffffffffffffff81168114612ae557600080fd5b600080600080600060a08688031215612e1a57600080fd5b612e2386612de8565b9450602086015193506040860151925060608601519150612e4660808701612de8565b90509295509295909350565b805162ffffff81168114612ae557600080fd5b60008060008060008060008060006101208a8c031215612e8457600080fd5b8951612e8f81612d80565b60208b0151909950612ea081612d80565b60408b0151909850612eb181612d80565b60608b0151909750612ec281612d80565b60808b0151909650612ed381612d80565b9450612ee160a08b01612e52565b9350612eef60c08b01612e52565b9250612efd60e08b01612e52565b9150612f0c6101008b01612e52565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f8257612f82612f1b565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082612fc557612fc5612f87565b500490565b63ffffffff818116838216019080821115610e3757610e37612f1b565b80820180821115610e3957610e39612f1b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261305e57600080fd5b83018035915067ffffffffffffffff82111561307957600080fd5b60200191503681900382131561308e57600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036130c6576130c6612f1b565b5060010190565b600067ffffffffffffffff8216806130e7576130e7612f1b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b81810381811115610e3957610e39612f1b565b60008261313157613131612f87565b500690565b60006020828403121561314857600080fd5b8151611ee681612a84565b60006020828403121561316557600080fd5b5051919050565b60006020828403121561317e57600080fd5b815167ffffffffffffffff81168114611ee657600080fd5b600067ffffffffffffffff8083168181036131b3576131b3612f1b565b6001019392505050565b6000816131cc576131cc612f1b565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60008251613204818460208701612bbe565b9190910192915050565b602081526000611ee66020830184612be256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212202aa3f16b31b5a89a7de203c315026aa987080079525e836b268adc7e639566f864736f6c634300081000330000000000000000000000002528401607cc0590d31c2fca129a75dc13b1dbb7000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802

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

0000000000000000000000002528401607cc0590d31c2fca129a75dc13b1dbb7000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802

-----Decoded View---------------
Arg [0] : bankAddress (address): 0x2528401607cc0590d31c2fca129a75dc13b1dbb7
Arg [1] : chainlinkCoordinatorAddress (address): 0xae975071be8f8ee67addbc1a82488f1c24858067
Arg [2] : LINK_ETH_feedAddress (address): 0x5787befdc0ecd210dfa948264631cd53e68f7802

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000002528401607cc0590d31c2fca129a75dc13b1dbb7
Arg [1] : 000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067
Arg [2] : 0000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.