Contract 0x06c737EB2539762FA5277F01Aa54E84c6e9972f3

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x8c388081ea868f9efb1ef69b7c6f8e76744b25c81e9c5cbae6d5e0b694624bd1Wager196410932022-09-07 13:58:1626 days 10 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.013239535059726 AVAX0.0086133575 27.5
0xa9796979319c62645c54f8f7c1dc897be97466f3c526ab2107f9d3aace59835dWager196410712022-09-07 13:57:2726 days 10 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.013239535059726 AVAX0.0086133575 27.5
0x922097673891fc9ad664a7d08a3a44bc9af745e5fc2e50d336ca41bc30719c36Wager196223822022-09-07 0:32:0226 days 23 hrs ago0xe98736508f8910f811a353b5c8d7caeb881d0847 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113249323706797 AVAX0.0086133575 27.5
0xa7f6bb02b884d48d04bf7fa90caadccf2eaf58becd328ec059e468c36f8f788bWager196121172022-09-06 18:41:1427 days 5 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.013251483583592 AVAX0.0086133575 27.5
0xb33ba12257a8f087a61b04b45206f711700d2862ba2b32f5578f482ef950c5f9Wager196120592022-09-06 18:39:1527 days 5 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.013251483583592 AVAX0.0086133575 27.5
0x437e7095b164456f137121f108741b4f7dec2b8b715517f387568f26850277b1Wager196120262022-09-06 18:38:0627 days 5 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.01324058674299 AVAX0.0090836075 27.5
0x47a71299308a50e22f867a17bcdf3f1799ba95e069d13ba1bb973333c1b265faWager195844482022-09-06 2:26:1527 days 21 hrs ago0xe98736508f8910f811a353b5c8d7caeb881d0847 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113234503282344 AVAX0.0086133575 27.5
0xb94d8f04f1b071db2cdf0a8a442bd341d08b5c7ad972265dd3cff3818cb98d16Wager195819962022-09-06 0:54:0627 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.313235576571569 AVAX0.0086130275 27.5
0x69f1c4db01b2667528a18799e6cf0aad1ca3ce65622affa0202fa1b7284bf3cbWager195819582022-09-06 0:52:5527 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113235576571569 AVAX0.0086136875 27.5
0xc5eab5a8c22dc092980bdea669c9a41acd071cc769eac38d8f07486db99393c6Wager195817382022-09-06 0:43:5927 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.053254396796852 AVAX0.0086133575 27.5
0x2d58df2fac85ed56a7e2011a03c5b0f2747615551f292e0fef8c3ae24d1cbc75Wager195816972022-09-06 0:42:3227 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.088254396796852 AVAX0.0086140175 27.5
0xfbcc84f4e931f577e19cb65fc45f5835b626d4003d21c4c4893ce40c3b272003Wager195816562022-09-06 0:41:0627 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.183254396796852 AVAX0.0086133575 27.5
0x1f86be6752e87aa25a500801487c458b987ba48627c7b985a3ebaac1536a5363Wager195750012022-09-05 20:31:1928 days 3 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.013338242838977 AVAX0.0086133575 27.5
0x4f7cd843a881fe72349abb78a4db905ebe8f6f70569d28569bd31b19d20578f2Wager195748672022-09-05 20:26:4228 days 3 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.013338242838977 AVAX0.0086133575 27.5
0x1e2dfd5ac2d974b3be399f4a4b180783c9bbc33b89591deaf4df6c4e722144e2Wager195748482022-09-05 20:25:5828 days 3 hrs ago0xb4d58f74d2b77e4317d465e073a281b7f4b27e39 IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f32.013338242838977 AVAX0.0086133575 27.5
0xb2875170c56382a5374e8ee2b8b74c202b22017a25278d1db393a8b3f68e8f99Wager195630062022-09-05 12:29:5428 days 11 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113335266230241 AVAX0.0086133575 27.5
0x1bd21aa828dc8cd05fc015519ba99cf932835ad9db6736fb8ea38df1ef7d9d93Wager195547632022-09-05 5:21:4028 days 18 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.083312356333241 AVAX0.0086133575 27.5
0x412f9854233a43a30c1cb76795910d79a35a064cf1409bf94b561e2f65015d8dWager195546212022-09-05 5:12:5628 days 18 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.033312356333241 AVAX0.0086133575 27.5
0x23d1e3ad350393542502556eaa42ef9fd10ace28cbef8c6719d00fe7af53adb2Wager195503492022-09-05 0:54:1028 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113290367166689 AVAX0.0086136875 27.5
0x7c50c7870252f0d70d9ac44aa7f146ccf871ea4d485d12cd737194c0a526daf0Wager195502872022-09-05 0:51:5328 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113290367166689 AVAX0.0086133575 27.5
0xb2e1479a815e8732174fcb68f7bf062aab1c713bba5a82bfb3004918c15c1b6dWager195500362022-09-05 0:43:1828 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.213290367166689 AVAX0.0086133575 27.5
0xaa717218c4a70af52c71b41d34dc7820eb5d22ef540269c44a6c6f1683162679Wager195500232022-09-05 0:42:5028 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.163290367166689 AVAX0.0086133575 27.5
0x75c07ab051feb976f3c6db1d857ea3f98a1f321dc8323f322a6891f5daf680a0Wager195499332022-09-05 0:39:4828 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113290367166689 AVAX0.0086133575 27.5
0x9dda6320fb6a581c8a629107eef687f4c40d41cd4ad7677aec488aa8fa6d36f1Wager195498962022-09-05 0:38:2728 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113290367166689 AVAX0.0086126975 27.5
0x78bf4aef2f726c7ab15d50295e8f044fa720a3365b9f4c88aed82953246b8d0aWager195498702022-09-05 0:37:3328 days 23 hrs ago0x08b6de2d12086a11de285cc8b7f8623d780f12ce IN  0x06c737eb2539762fa5277f01aa54e84c6e9972f30.113290367166689 AVAX0.0086133575 27.5
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xa72eddc9207612427f76abd5074fcfafea9f3f51f4329bcf9e16d56af352f255197165142022-09-09 20:52:3724 days 3 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x1a75280f832280af93f588f715a5fb4ca79184300.079471947736426755 AVAX
0x863ea3d6f713f98359fffdfeb2429da2f0399aaa99a76c6e455e4b25c885ad67196410972022-09-07 13:58:2426 days 10 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f2 AVAX
0x88cab03d59df431dea43783afb4652cc13bb7009864d0aacb756e808e2cdd924196410802022-09-07 13:57:4526 days 10 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f2 AVAX
0x88213f86a340b7a2475c8c7276f9fe2374fed1b3c8d3afeee9529de57f89cbed196223862022-09-07 0:32:0826 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.0027 AVAX
0x88213f86a340b7a2475c8c7276f9fe2374fed1b3c8d3afeee9529de57f89cbed196223862022-09-07 0:32:0826 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30xe98736508f8910f811a353b5c8d7caeb881d08470.0973 AVAX
0xc5881e440adc742fd9abee33da71de6855718149caae8d9e5fba79437639ec56196121202022-09-06 18:41:2027 days 5 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f2 AVAX
0x9d5be425391dbc4a7ad6aeb20ad64a452e23f7ecdaad1befefbba4bad9760a59196120622022-09-06 18:39:2127 days 5 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f2 AVAX
0xf0d823fbb6ad85d7ded6067d3483e6ffeb11cbbe18e6e3a556ae792d48f14295196120302022-09-06 18:38:1427 days 5 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.054 AVAX
0xf0d823fbb6ad85d7ded6067d3483e6ffeb11cbbe18e6e3a556ae792d48f14295196120302022-09-06 18:38:1427 days 5 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30xb4d58f74d2b77e4317d465e073a281b7f4b27e391.946 AVAX
0x5949406ee72cd5b77763518393fd2878fa2614334a7d96825b7c220a09ebd63f195944682022-09-06 8:27:1027 days 15 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x1a75280f832280af93f588f715a5fb4ca79184305.33502412513917459 AVAX
0xb9d67654828d7d526f4202acf1390166e603ab22c3c10a6efbb09813c42c6e8e195844542022-09-06 2:26:2727 days 21 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.0027 AVAX
0xb9d67654828d7d526f4202acf1390166e603ab22c3c10a6efbb09813c42c6e8e195844542022-09-06 2:26:2727 days 21 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30xe98736508f8910f811a353b5c8d7caeb881d08470.0973 AVAX
0x6d45225e76f6cdb4425ae35431df3f669cf8239d535b0fc60e863fc67de0c135195819992022-09-06 0:54:1427 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.3 AVAX
0xace644d9ecbc26fd1c2fee9fa32e4efb3926532bd014a16c2cf89ded55bb1b69195819632022-09-06 0:53:0227 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.1 AVAX
0xa903c0334d78ccedb64c1a5b04a39611d05396343faddbf248ce726a0f2bec5d195817412022-09-06 0:44:0927 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.00108 AVAX
0xa903c0334d78ccedb64c1a5b04a39611d05396343faddbf248ce726a0f2bec5d195817412022-09-06 0:44:0927 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30x08b6de2d12086a11de285cc8b7f8623d780f12ce0.03892 AVAX
0xf196ec446c2e61c38a845baf930e39b12e1d829053cf218e5918af165f8327ab195817082022-09-06 0:42:5727 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.002025 AVAX
0xf196ec446c2e61c38a845baf930e39b12e1d829053cf218e5918af165f8327ab195817082022-09-06 0:42:5727 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30x08b6de2d12086a11de285cc8b7f8623d780f12ce0.072975 AVAX
0x770269ed42c3912c73109a3fda8900697a6bf1aa3b403c6090d89173bcef74ef195816692022-09-06 0:41:3227 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.00459 AVAX
0x770269ed42c3912c73109a3fda8900697a6bf1aa3b403c6090d89173bcef74ef195816692022-09-06 0:41:3227 days 23 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30x08b6de2d12086a11de285cc8b7f8623d780f12ce0.16541 AVAX
0x1cbabafe49c1bf3e3493b325dd54fe0e1fad404bdedd3ebc4cc7a7623b16a449195750072022-09-05 20:31:3128 days 3 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.054 AVAX
0x1cbabafe49c1bf3e3493b325dd54fe0e1fad404bdedd3ebc4cc7a7623b16a449195750072022-09-05 20:31:3128 days 3 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30xb4d58f74d2b77e4317d465e073a281b7f4b27e391.946 AVAX
0x42f8769f91fa0eb6dd98c206aab64ce3a92df6c393e05618734188754c79cd2b195748722022-09-05 20:26:5228 days 3 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.054 AVAX
0x42f8769f91fa0eb6dd98c206aab64ce3a92df6c393e05618734188754c79cd2b195748722022-09-05 20:26:5228 days 3 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f30xb4d58f74d2b77e4317d465e073a281b7f4b27e391.946 AVAX
0xc155d9990d937bbaad3c085ba8d225f91e777938d8ea6e10735797425aad6406195748532022-09-05 20:26:0828 days 3 hrs ago 0x06c737eb2539762fa5277f01aa54e84c6e9972f3 0x187de399100aa962f209aa78621f5138aca6111f0.054 AVAX
[ 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:
Roulette

Compiler Version
v0.8.14+commit.80d49f37

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.0;

/** ****************************************************************************
 * @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 v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 v4.4.1 (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 Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

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

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        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.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

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

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

pragma solidity ^0.8.0;

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

    /**
     * @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 9 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 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 11 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 12 of 15 : IBank.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

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

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

pragma solidity ^0.8.10;

/// @notice Referral interface
/// @author Romuald Hog.
interface IReferral {
    /// @notice Adds an address as referrer.
    /// @param user The address of the user.
    /// @param referrer The address would set as referrer of user.
    function addReferrer(address user, address referrer) external;

    /// @notice Updates referrer's last active timestamp.
    /// @param user The address would like to update active time.
    function updateReferrerActivity(address user) external;

    /// @notice Calculates and allocate referrer(s) credits to uplines.
    /// @param user Address of the gamer to find referrer(s).
    /// @param token The token to allocate.
    /// @param amount The number of tokens allocated for referrer(s).
    function payReferral(
        address user,
        address token,
        uint256 amount
    ) external returns (uint256);

    /// @notice Utils function for check whether an address has the referrer.
    /// @param user The address of the user.
    /// @return Whether user has a referrer.
    function hasReferrer(address user) external view returns (bool);
}

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

pragma solidity ^0.8.10;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

import {IBank} from "../bank/IBank.sol";
import {IReferral} from "../bank/IReferral.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 Chainlink VRF configuration struct.
    /// @param subId Default subscription ID.
    /// @param callbackGasLimit How much gas you would like in your callback to do work with the random words provided.
    /// @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.
    struct ChainlinkConfig {
        uint64 subId;
        uint32 callbackGasLimit;
        uint16 requestConfirmations;
        bytes32 keyHash;
    }

    /// @notice Chainlink VRF configuration state.
    ChainlinkConfig public chainlinkConfig;

    /// @notice Reference to the VRFCoordinatorV2 deployed contract.
    IVRFCoordinatorV2 public chainlinkCoordinator;

    /// @notice How many random words is needed to resolve a game's bet.
    uint16 private immutable _numRandomWords;

    /// @notice Chainlink price feed.
    AggregatorV3Interface public 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 Token struct.
    /// @param houseEdge House edge rate.
    /// @param VRFSubId Chainlink's VRF subscription ID.
    /// @param partner Address of the partner to manage the token.
    /// @param minBetAmount Minimum bet amount.
    /// @param VRFFees Chainlink's VRF collected fees amount.
    struct Token {
        uint16 houseEdge;
        uint64 VRFSubId;
        address partner;
        uint256 minBetAmount;
        uint256 VRFFees;
    }
    /// @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, and to interact with Referral program.
    IBank public bank;

    /// @notice Referral program contract.
    IReferral public referralProgram;

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

    /// @notice Emitted after the referral program is set.
    /// @param referralProgram The referral program address.
    event SetReferralProgram(address referralProgram);

    /// @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 minimum bet amount is set for a token.
    /// @param token Address of the token.
    /// @param minBetAmount Minimum bet amount.
    event SetTokenMinBetAmount(address indexed token, uint256 minBetAmount);

    /// @notice Emitted after the bet amount transfer to the user failed.
    /// @param id The bet ID.
    /// @param amount Number of tokens failed to transfer.
    /// @param reason The reason provided by the external call.
    event BetAmountTransferFail(uint256 id, uint256 amount, string reason);

    /// @notice Emitted after the bet amount fee transfer to the bank failed.
    /// @param id The bet ID.
    /// @param amount Number of tokens failed to transfer.
    /// @param reason The reason provided by the external call.
    event BetAmountFeeTransferFail(uint256 id, uint256 amount, string reason);

    /// @notice Emitted after the bet profit transfer to the user failed.
    /// @param id The bet ID.
    /// @param amount Number of tokens failed to transfer.
    /// @param reason The reason provided by the external call.
    event BetProfitTransferFail(uint256 id, uint256 amount, string reason);

    /// @notice Emitted after the bet amount transfer to the bank failed.
    /// @param id The bet ID.
    /// @param amount Number of tokens failed to transfer.
    /// @param reason The reason provided by the external call.
    event BankCashInFail(uint256 id, uint256 amount, string reason);

    /// @notice Emitted after the bet amount ERC20 transfer to the bank failed.
    /// @param id The bet ID.
    /// @param amount Number of tokens failed to transfer.
    /// @param reason The reason provided by the external call.
    event BankTransferFail(uint256 id, uint256 amount, string reason);

    /// @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.
    event BetRefunded(uint256 id, address user, uint256 amount);

    /// @notice Emitted after the bet resolution cost refund to user failed.
    /// @param id The bet ID.
    /// @param user Address of the gamer.
    /// @param chainlinkVRFCost The bet resolution cost amount.
    event BetCostRefundFail(uint256 id, address user, 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 Emitted after the token's VRF subscription ID is set.
    /// @param token Address of the token.
    /// @param subId Subscription ID.
    event SetTokenVRFSubId(address indexed token, uint64 subId);

    /// @notice Emitted after a token partner is set.
    /// @param token Address of the token.
    /// @param partner Address of the partner.
    event SetTokenPartner(address indexed token, address partner);

    /// @notice Insufficient bet amount.
    /// @param token Bet's token address.
    /// @param value Bet amount.
    error UnderMinBetAmount(address token, uint256 value);

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

    /// @notice Bet isn't resolved yet.
    /// @param id Bet ID.
    error NotFulfilled(uint256 id);

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

    /// @notice Token is not allowed.
    /// @param token Bet's token address.
    error ForbiddenToken(address token);

    /// @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 Modifier that checks that an account is allowed to interact.
    /// @param token The token address.
    modifier onlyTokenOwner(address token) {
        address partner = tokens[token].partner;
        if (
            partner == address(0)
                ? owner() != msg.sender
                : msg.sender != partner
        ) {
            revert AccessDenied();
        }
        _;
    }

    /// @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.
    constructor(
        address bankAddress,
        address referralProgramAddress,
        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));
        setReferralProgram(IReferral(referralProgramAddress));
        chainlinkCoordinator = IVRFCoordinatorV2(chainlinkCoordinatorAddress);
        _numRandomWords = numRandomWords;
        LINK_ETH_feed = AggregatorV3Interface(LINK_ETH_feedAddress);
    }

    /// @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) internal onlyOwner {
        if (houseEdge > 400) {
            revert ExcessiveHouseEdge(houseEdge);
        }
        tokens[token].houseEdge = houseEdge;
        emit SetHouseEdge(token, houseEdge);
    }

    /// @notice Creates a new bet, request randomness to Chainlink, add the referrer,
    /// transfer the ERC20 tokens to the contract or refund the bet amount overflow if the bet amount exceed the maxBetAmount.
    /// @param token 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.
    /// @param referrer Address of the referrer.
    /// @return A new Bet struct information.
    function _newBet(
        address token,
        uint256 tokenAmount,
        uint256 multiplier,
        address referrer
    ) internal whenNotPaused nonReentrant returns (Bet memory) {
        if (bank.isAllowedToken(token) == false) {
            revert ForbiddenToken(token);
        }

        address user = msg.sender;
        bool isGasToken = token == 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();
            if (fee < (chainlinkVRFCost - ((10 * chainlinkVRFCost) / 100))) {
                // 5% slippage.
                revert WrongGasValueToCoverFee();
            }
            tokens[token].VRFFees += fee;
        }

        // Bet amount is capped.
        {
            if (
                betAmount < 10000 wei || betAmount < tokens[token].minBetAmount
            ) {
                revert UnderMinBetAmount(token, betAmount);
            }

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

        // Create bet
        uint256 id = chainlinkCoordinator.requestRandomWords(
            chainlinkConfig.keyHash,
            tokens[token].VRFSubId == 0
                ? chainlinkConfig.subId
                : tokens[token].VRFSubId,
            chainlinkConfig.requestConfirmations,
            chainlinkConfig.callbackGasLimit,
            _numRandomWords
        );
        Bet memory newBet = Bet(
            false,
            payable(user),
            token,
            id,
            betAmount,
            block.number,
            0,
            fee
        );
        _userBets[user].push(id);
        bets[id] = newBet;

        // Add referrer
        if (address(referralProgram) != address(0)) {
            if (
                referrer != address(0) &&
                _userBets[user].length == 1 &&
                !referralProgram.hasReferrer(user)
            ) {
                referralProgram.addReferrer(user, referrer);
            } else {
                referralProgram.updateReferrerActivity(user);
            }
        }

        // If ERC20, transfer the tokens
        if (!isGasToken) {
            IERC20(token).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) {
        address payable user = bet.user;
        if (bet.resolved == true || user == address(0)) {
            revert NotPendingBet(bet.id);
        }
        address token = bet.token;
        uint256 betAmount = bet.amount;
        bool isGasToken = bet.token == address(0);

        bet.resolved = true;

        // Check for the result
        if (wins) {
            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 from the contract
            if (isGasToken) {
                if (!user.send(betAmountPayout)) {
                    emit BetAmountTransferFail(
                        bet.id,
                        betAmount,
                        "Gas token send failed"
                    );
                }
            } else {
                try
                    IERC20(token).transfer(user, betAmountPayout)
                {} catch Error(string memory reason) {
                    emit BetAmountTransferFail(bet.id, betAmountPayout, reason);
                }
                try
                    IERC20(token).transfer(address(bank), betAmountFee)
                {} catch Error(string memory reason) {
                    emit BetAmountFeeTransferFail(bet.id, betAmountFee, reason);
                }
            }

            // Transfer the payout from the bank
            try
                bank.payout{value: isGasToken ? betAmountFee : 0}(
                    user,
                    token,
                    profitPayout,
                    fee
                )
            {} catch Error(string memory reason) {
                emit BetProfitTransferFail(bet.id, profitPayout, reason);
            }
        } else {
            payout = 0;
            if (!isGasToken) {
                try
                    IERC20(token).transfer(address(bank), betAmount)
                {} catch Error(string memory reason) {
                    emit BankTransferFail(bet.id, betAmount, reason);
                }
            }
            try
                bank.cashIn{value: isGasToken ? betAmount : 0}(token, betAmount)
            {} catch Error(string memory reason) {
                emit BankCashInFail(bet.id, betAmount, reason);
            }
        }

        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 = 0;
            for (uint256 i = betsLength; i > betsLength - dataLength; i--) {
                userBets[userBetsIndex] = bets[userBetsIds[i - 1]];
                userBetsIndex++;
            }
        }

        return userBets;
    }

    /// @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)
        internal
        view
        returns (uint256)
    {
        return (tokens[token].houseEdge * amount) / 10000;
    }

    /// @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 Sets the new referral program.
    /// @param _referralProgram The referral program address.
    function setReferralProgram(IReferral _referralProgram) public onlyOwner {
        referralProgram = _referralProgram;
        emit SetReferralProgram(address(referralProgram));
    }

    /// @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 subId Subscription ID.
    /// @param callbackGasLimit How much gas you would like in your callback to do work with the random words provided.
    /// @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(
        uint64 subId,
        uint32 callbackGasLimit,
        uint16 requestConfirmations,
        bytes32 keyHash
    ) external onlyOwner {
        chainlinkConfig.subId = subId;
        chainlinkConfig.callbackGasLimit = callbackGasLimit;
        chainlinkConfig.requestConfirmations = requestConfirmations;
        chainlinkConfig.keyHash = keyHash;
    }

    /// @notice Changes the token's partner address.
    /// @param token Address of the token.
    /// @param partner Address of the partner.
    function setTokenPartner(address token, address partner)
        external
        onlyTokenOwner(token)
    {
        withdrawTokensVRFFees(token);
        tokens[token].partner = partner;
        emit SetTokenPartner(token, partner);
    }

    /// @notice Sets the minimum bet amount for a specific token.
    /// @param token Address of the token.
    /// @param tokenMinBetAmount Minimum bet amount.
    function setTokenMinBetAmount(address token, uint256 tokenMinBetAmount)
        external
        onlyTokenOwner(token)
    {
        tokens[token].minBetAmount = tokenMinBetAmount;
        emit SetTokenMinBetAmount(token, tokenMinBetAmount);
    }

    /// @notice Sets the Chainlink VRF subscription ID for a specific token.
    /// @param token Address of the token.
    /// @param subId Subscription ID.
    function setTokenVRFSubId(address token, uint64 subId)
        external
        onlyTokenOwner(token)
    {
        tokens[token].VRFSubId = subId;
        emit SetTokenVRFSubId(token, subId);
    }

    /// @notice Distributes the token's collected Chainlink fees.
    /// @param token Address of the token.
    function withdrawTokensVRFFees(address token) public onlyTokenOwner(token) {
        uint256 tokenChainlinkFees = tokens[token].VRFFees;
        if (tokenChainlinkFees != 0) {
            tokens[token].VRFFees = 0;
            payable(msg.sender).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 {
        Bet storage bet = bets[id];
        if (bet.resolved == true) {
            revert NotPendingBet(id);
        } else if (block.number < bet.blockNumber + 30) {
            revert NotFulfilled(id);
        }

        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);
        }
        emit BetRefunded(id, bet.user, bet.amount);

        uint256 chainlinkVRFCost = bet.vrfCost;
        if (
            tokens[bet.token].VRFFees >= chainlinkVRFCost &&
            address(this).balance >= chainlinkVRFCost
        ) {
            tokens[bet.token].VRFFees -= chainlinkVRFCost;
            payable(bet.user).transfer(chainlinkVRFCost);
        } else {
            emit BetCostRefundFail(id, bet.user, chainlinkVRFCost);
        }
    }

    /// @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() public view returns (uint256) {
        (, int256 weiPerUnitLink, , , ) = LINK_ETH_feed.latestRoundData();
        if (weiPerUnitLink <= 0) {
            revert InvalidLinkWeiPrice(weiPerUnitLink);
        }
        // Get Chainlink VRF v2 fee amount.
        (
            uint32 fulfillmentFlatFeeLinkPPMTier1,
            ,
            ,
            ,
            ,
            ,
            ,
            ,

        ) = chainlinkCoordinator.getFeeConfig();
        // 115000 gas is the average Verification gas of Chainlink VRF.
        return
            (tx.gasprice * (115000 + chainlinkConfig.callbackGasLimit)) +
            ((1e12 *
                uint256(fulfillmentFlatFeeLinkPPMTier1) *
                uint256(weiPerUnitLink)) / 1e18);
    }
}

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

pragma solidity ^0.8.10;

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

/// @title BetSwirl's Roulette game
/// @notice
/// @author Romuald Hog
contract Roulette is Game {
    /// @notice Full roulette bet information struct.
    /// @param bet The Bet struct information.
    /// @param rouletteBet The Roulette bet struct information.
    /// @dev Used to package bet information for the front-end.
    struct FullRouletteBet {
        Bet bet;
        RouletteBet rouletteBet;
    }

    /// @notice Roulette bet information struct.
    /// @param bet The Bet struct information.
    /// @param numbers The chosen numbers.
    struct RouletteBet {
        uint40 numbers;
        uint8 rolled;
    }

    uint8 private constant MODULO = 37;
    uint256 private constant POPCNT_MULT =
        0x0000000000002000000000100000000008000000000400000000020000000001;
    uint256 private constant POPCNT_MASK =
        0x0001041041041041041041041041041041041041041041041041041041041041;
    uint256 private constant POPCNT_MODULO = 0x3F;

    /// @notice Maps bets IDs to chosen numbers.
    mapping(uint256 => RouletteBet) public rouletteBets;

    /// @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 numbers The chosen numbers.
    event PlaceBet(
        uint256 id,
        address indexed user,
        address indexed token,
        uint40 numbers
    );

    /// @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 numbers The chosen numbers.
    /// @param rolled The rolled number.
    /// @param payout The payout amount.
    event Roll(
        uint256 id,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint40 numbers,
        uint8 rolled,
        uint256 payout
    );

    /// @notice Provided cap is under the minimum.
    /// @param numbers The numbers chosen by user.
    error NumbersNotInRange(uint40 numbers);

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

    /// @notice Sets the game house edge rate for a specific token.
    /// @param token Address of the token.
    /// @param _houseEdge House edge rate.
    function setHouseEdge(address token, uint16 _houseEdge) external onlyOwner {
        _setHouseEdge(token, _houseEdge);
    }

    /// @notice Creates a new bet and stores the chosen bet mask.
    /// @param numbers The chosen numbers.
    /// @param token Address of the token.
    /// @param tokenAmount The number of tokens bet.
    /// @param referrer Address of the referrer.
    function wager(
        uint40 numbers,
        address token,
        uint256 tokenAmount,
        address referrer
    ) external payable whenNotPaused {
        if (numbers== 0 || numbers >= 2**MODULO - 1) {
            revert NumbersNotInRange(numbers);
        }

        Bet memory bet = _newBet(
            token,
            tokenAmount,
            getPayout(10000, numbers),
            referrer
        );

        rouletteBets[bet.id].numbers = numbers;

        emit PlaceBet(bet.id, bet.user, bet.token, numbers);
    }

    /// @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
    {
        RouletteBet storage rouletteBet = rouletteBets[id];
        Bet storage bet = bets[id];

        uint8 rolled = uint8(randomWords[0] % MODULO);
        rouletteBet.rolled = rolled;
        uint256 payout = _resolveBet(
            bet,
            (2**rolled) & rouletteBet.numbers != 0,
            getPayout(bet.amount, rouletteBet.numbers)
        );

        emit Roll(
            bet.id,
            bet.user,
            bet.token,
            bet.amount,
            rouletteBet.numbers,
            rolled,
            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 Dice bet.
    function getLastUserBets(address user, uint256 dataLength)
        external
        view
        returns (FullRouletteBet[] memory)
    {
        Bet[] memory lastBets = _getLastUserBets(user, dataLength);
        FullRouletteBet[] memory lastRouletteBets = new FullRouletteBet[](
            lastBets.length
        );
        for (uint256 i; i < lastBets.length; i++) {
            lastRouletteBets[i] = FullRouletteBet(
                lastBets[i],
                rouletteBets[lastBets[i].id]
            );
        }
        return lastRouletteBets;
    }

    /// @notice Calculates the target payout amount.
    /// @param betAmount Bet amount.
    /// @param numbers The chosen numbers.
    /// @return The target payout amount.
    function getPayout(uint256 betAmount, uint40 numbers)
        public
        pure
        returns (uint256)
    {
        return
            (betAmount * MODULO) /
            (((numbers * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO);
    }
}

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 ABI

[{"inputs":[{"internalType":"address","name":"bankAddress","type":"address"},{"internalType":"address","name":"referralProgramAddress","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":[{"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"ExcessiveHouseEdge","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"ForbiddenToken","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[{"internalType":"int256","name":"linkWei","type":"int256"}],"name":"InvalidLinkWeiPrice","type":"error"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"NotFulfilled","type":"error"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"NotPendingBet","type":"error"},{"inputs":[{"internalType":"uint40","name":"numbers","type":"uint40"}],"name":"NumbersNotInRange","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","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":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"BankCashInFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"BankTransferFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"BetAmountFeeTransferFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"BetAmountTransferFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"chainlinkVRFCost","type":"uint256"}],"name":"BetCostRefundFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"BetProfitTransferFail","type":"event"},{"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"}],"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":"uint40","name":"numbers","type":"uint40"}],"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":"uint40","name":"numbers","type":"uint40"},{"indexed":false,"internalType":"uint8","name":"rolled","type":"uint8"},{"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":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"SetHouseEdge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"referralProgram","type":"address"}],"name":"SetReferralProgram","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"SetTokenMinBetAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"partner","type":"address"}],"name":"SetTokenPartner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint64","name":"subId","type":"uint64"}],"name":"SetTokenVRFSubId","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"LINK_ETH_feed","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"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":[],"name":"chainlinkConfig","outputs":[{"internalType":"uint64","name":"subId","type":"uint64"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"},{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkCoordinator","outputs":[{"internalType":"contract IVRFCoordinatorV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"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":"uint40","name":"numbers","type":"uint40"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"internalType":"struct Roulette.RouletteBet","name":"rouletteBet","type":"tuple"}],"internalType":"struct Roulette.FullRouletteBet[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"betAmount","type":"uint256"},{"internalType":"uint40","name":"numbers","type":"uint40"}],"name":"getPayout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","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":[],"name":"referralProgram","outputs":[{"internalType":"contract IReferral","name":"","type":"address"}],"stateMutability":"view","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":"uint256","name":"","type":"uint256"}],"name":"rouletteBets","outputs":[{"internalType":"uint40","name":"numbers","type":"uint40"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBank","name":"_bank","type":"address"}],"name":"setBank","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"subId","type":"uint64"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"},{"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":"contract IReferral","name":"_referralProgram","type":"address"}],"name":"setReferralProgram","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenMinBetAmount","type":"uint256"}],"name":"setTokenMinBetAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"partner","type":"address"}],"name":"setTokenPartner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint64","name":"subId","type":"uint64"}],"name":"setTokenVRFSubId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"uint16","name":"houseEdge","type":"uint16"},{"internalType":"uint64","name":"VRFSubId","type":"uint64"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"minBetAmount","type":"uint256"},{"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":"uint40","name":"numbers","type":"uint40"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"referrer","type":"address"}],"name":"wager","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawTokensVRFFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040523480156200001157600080fd5b506040516200445938038062004459833981016040819052620000349162000323565b83838360018482620000463362000154565b6000805460ff60a01b191690556001600160a01b0390811660805260018055811615806200007b57506001600160a01b038316155b156200009a5760405163e6c4247b60e01b815260040160405180910390fd5b60008261ffff16118015620000b557506101f48261ffff1611155b620001075760405162461bcd60e51b815260206004820152601e60248201527f57726f6e6720436861696e6c696e6b204e756d52616e646f6d576f726473000060448201526064015b60405180910390fd5b6200011285620001a4565b6200011d846200026c565b600480546001600160a01b0319166001600160a01b0394851617905561ffff9190911660a0521660c0525062000380945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b03163314620001ef5760405162461bcd60e51b81526020600482018190526024820152600080516020620044398339815191526044820152606401620000fe565b6001600160a01b038116620002175760405163e6c4247b60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb261244067906020015b60405180910390a150565b6000546001600160a01b03163314620002b75760405162461bcd60e51b81526020600482018190526024820152600080516020620044398339815191526044820152606401620000fe565b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f678edf136de423322d705b75c3157ecfde496e1ad82aef725aa6deb9d94d4de29060200162000261565b80516001600160a01b03811681146200031e57600080fd5b919050565b600080600080608085870312156200033a57600080fd5b620003458562000306565b9350620003556020860162000306565b9250620003656040860162000306565b9150620003756060860162000306565b905092959194509250565b60805160a05160c05161407b620003be6000396000818161041201526109000152600061224f01526000818161086501526108c0015261407b6000f3fe6080604052600436106101b75760003560e01c806378bcde22116100ec578063c29ba5b51161008a578063e1fdb4b411610064578063e1fdb4b414610642578063e486033914610662578063e59af7321461070e578063f2fde38b1461072e57600080fd5b8063c29ba5b5146105d5578063c2fb579f146105f5578063cdc423441461062257600080fd5b80638da5cb5b116100c65780638da5cb5b14610509578063ac9650d814610527578063bc3ec38314610554578063be27e5301461057457600080fd5b806378bcde22146104c15780637947dbb8146104e15780638456cb59146104f457600080fd5b80635c975abb116101595780636dfa8e52116101335780636dfa8e521461044c578063707cd55e1461046c578063715018a61461048c57806376cdb03b146104a157600080fd5b80635c975abb1461033e578063653792df1461037957806369d2fc6a1461040057600080fd5b806328c9ea911161019557806328c9ea91146102bb5780633d32753c146102de5780633e32a381146102fe5780634297dcbe1461031e57600080fd5b8063090d23b9146101bc5780631fe543e3146101de57806322af00fa146101fe575b600080fd5b3480156101c857600080fd5b506101dc6101d73660046135b8565b61074e565b005b3480156101ea57600080fd5b506101dc6101f9366004613631565b61085a565b34801561020a57600080fd5b5061026d6102193660046136e4565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460069095015460ff8516966101009095046001600160a01b039081169694169492939192919088565b6040805198151589526001600160a01b0397881660208a015295909616948701949094526060860192909252608085015260a084015260c083015260e0820152610100015b60405180910390f35b3480156102c757600080fd5b506102d06108fb565b6040519081526020016102b2565b3480156102ea57600080fd5b506101dc6102f936600461373e565b610abf565b34801561030a57600080fd5b506101dc6103193660046135b8565b610bae565b34801561032a57600080fd5b506101dc61033936600461378b565b610c6e565b34801561034a57600080fd5b5060005474010000000000000000000000000000000000000000900460ff1660405190151581526020016102b2565b34801561038557600080fd5b506002546003546103c79167ffffffffffffffff81169168010000000000000000820463ffffffff16916c01000000000000000000000000900461ffff169084565b6040805167ffffffffffffffff909516855263ffffffff909316602085015261ffff9091169183019190915260608201526080016102b2565b34801561040c57600080fd5b506104347f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016102b2565b34801561045857600080fd5b506101dc6104673660046137b7565b610d66565b34801561047857600080fd5b506101dc6104873660046135b8565b610e86565b34801561049857600080fd5b506101dc610fcc565b3480156104ad57600080fd5b50600854610434906001600160a01b031681565b3480156104cd57600080fd5b506101dc6104dc3660046137ec565b611032565b6101dc6104ef36600461382d565b611096565b34801561050057600080fd5b506101dc611231565b34801561051557600080fd5b506000546001600160a01b0316610434565b34801561053357600080fd5b5061054761054236600461387e565b6112be565b6040516102b2919061394b565b34801561056057600080fd5b506101dc61056f3660046139cb565b6113b4565b34801561058057600080fd5b506105b661058f3660046136e4565b600a6020526000908152604090205464ffffffffff81169065010000000000900460ff1682565b6040805164ffffffffff909316835260ff9091166020830152016102b2565b3480156105e157600080fd5b506102d06105f0366004613a04565b6114dc565b34801561060157600080fd5b5061061561061036600461378b565b611552565b6040516102b29190613a27565b34801561062e57600080fd5b50600954610434906001600160a01b031681565b34801561064e57600080fd5b506101dc61065d3660046136e4565b6116e4565b34801561066e57600080fd5b506106ca61067d3660046135b8565b60076020526000908152604090208054600182015460029092015461ffff82169262010000830467ffffffffffffffff16926a010000000000000000000090046001600160a01b03169185565b6040805161ffff909616865267ffffffffffffffff90941660208601526001600160a01b03909216928401929092526060830191909152608082015260a0016102b2565b34801561071a57600080fd5b50600454610434906001600160a01b031681565b34801561073a57600080fd5b506101dc6107493660046135b8565b611989565b6000546001600160a01b031633146107ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b0381166107ed576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600880547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f10f5824683d64a0712038f2244e046b174a1cc57fbb8556bfda5ffb261244067906020015b60405180910390a150565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108ed576040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044016107a4565b6108f78282611a6b565b5050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa15801561095c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109809190613afd565b505050915050600081136109c3576040517f43d4cf66000000000000000000000000000000000000000000000000000000008152600481018290526024016107a4565b6000600460009054906101000a90046001600160a01b03166001600160a01b0316635fbbc0d26040518163ffffffff1660e01b815260040161012060405180830381865afa158015610a19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3d9190613b60565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610a689190613c45565b610a729190613c45565b610a7c9190613c93565b600254610a9e9068010000000000000000900463ffffffff166201c138613ca7565b610aae9063ffffffff163a613c45565b610ab89190613ccf565b9250505090565b6000546001600160a01b03163314610b195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a4565b6002805461ffff9093166c01000000000000000000000000027fffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffff63ffffffff90951668010000000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090941667ffffffffffffffff90961695909517929092179290921692909217909155600355565b6000546001600160a01b03163314610c085760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a4565b600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f678edf136de423322d705b75c3157ecfde496e1ad82aef725aa6deb9d94d4de29060200161084f565b6001600160a01b0380831660009081526007602052604090205483916a0100000000000000000000909104168015610cb257336001600160a01b0382161415610cd1565b33610cc56000546001600160a01b031690565b6001600160a01b031614155b15610d08576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841660008181526007602052604090819020600101859055517f8b4a07860448b613116df3f175c837980eceaca7d1dc5143c46a20ab31ec00f990610d589086815260200190565b60405180910390a250505050565b6001600160a01b0380831660009081526007602052604090205483916a0100000000000000000000909104168015610daa57336001600160a01b0382161415610dc9565b33610dbd6000546001600160a01b031690565b6001600160a01b031614155b15610e00576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffff0000000000000000ffff166201000067ffffffffffffffff89169081029190911790915591519182527fae367543cf47ca7e51a9f3f92711553aa33777847f719f7e2821ea8d846ed0e19101610d58565b6001600160a01b0380821660009081526007602052604090205482916a0100000000000000000000909104168015610eca57336001600160a01b0382161415610ee9565b33610edd6000546001600160a01b031690565b6001600160a01b031614155b15610f20576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383166000908152600760205260409020600201548015610fc6576001600160a01b03841660009081526007602052604080822060020182905551339183156108fc02918491818181858888f19350505050158015610f8a573d6000803e3d6000fd5b50836001600160a01b03167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af5682604051610d5891815260200190565b50505050565b6000546001600160a01b031633146110265760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a4565b6110306000611bb4565b565b6000546001600160a01b0316331461108c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a4565b6108f78282611c1c565b60005474010000000000000000000000000000000000000000900460ff16156111015760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107a4565b64ffffffffff841615806111335750600161111e60256002613dcb565b6111289190613dda565b8464ffffffffff1610155b15611173576040517fad7fc68c00000000000000000000000000000000000000000000000000000000815264ffffffffff851660048201526024016107a4565b600061118c8484611186612710896114dc565b85611d3b565b6060810180516000908152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000001664ffffffffff8b16908117909155828501518286015194518451908152928301919091529394506001600160a01b0393841693909216917f041b9daf484d2f7472d3d2258f13d1a69325f6218b893785e5adb40498e3dd1a910160405180910390a35050505050565b6000546001600160a01b0316331461128b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a4565b60005474010000000000000000000000000000000000000000900460ff16156112b65761103061263d565b61103061270f565b60608167ffffffffffffffff8111156112d9576112d96135d5565b60405190808252806020026020018201604052801561130c57816020015b60608152602001906001900390816112f75790505b50905060005b828110156113ac5761137c3085858481811061133057611330613df1565b90506020028101906113429190613e20565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506127e192505050565b82828151811061138e5761138e613df1565b602002602001018190525080806113a490613e8c565b915050611312565b505b92915050565b6001600160a01b0380831660009081526007602052604090205483916a01000000000000000000009091041680156113f857336001600160a01b0382161415611417565b3361140b6000546001600160a01b031690565b6001600160a01b031614155b1561144e576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61145784610e86565b6001600160a01b0384811660008181526007602090815260409182902080547fffff0000000000000000000000000000000000000000ffffffffffffffffffff166a0100000000000000000000958916958602179055905192835290917fc991529379552af6d0789cc899d5180a270a4bc3b1a3892adcac3d95f93dda1d9101610d58565b6000603f7e0104104104104104104104104104104104104104104104104104104104104161152b79200000000010000000000800000000040000000002000000000164ffffffffff8616613c45565b166115369190613ea6565b611541602585613c45565b61154b9190613c93565b9392505050565b606060006115608484612806565b90506000815167ffffffffffffffff81111561157e5761157e6135d5565b60405190808252806020026020018201604052801561161157816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e08301829052610100830182905261012083018290528252825180840190935280835260208084019190915281019190915281526020019060019003908161159c5790505b50905060005b82518110156116db57604051806040016040528084838151811061163d5761163d613df1565b60200260200101518152602001600a600086858151811061166057611660613df1565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525464ffffffffff8116825265010000000000900460ff1691810191909152905282518390839081106116bd576116bd613df1565b602002602001018190525080806116d390613e8c565b915050611617565b50949350505050565b6000818152600560205260409020805460ff161515600103611735576040517f1a040cf0000000000000000000000000000000000000000000000000000000008152600481018390526024016107a4565b600481015461174590601e613ccf565b431015611781576040517f283bb6b1000000000000000000000000000000000000000000000000000000008152600481018390526024016107a4565b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081178255600382015460058301558101546001600160a01b031661180d57805460038201546040516101009092046001600160a01b0316916108fc82150291906000818181858888f19350505050158015611807573d6000803e3d6000fd5b50611838565b805460038201546001830154611838926001600160a01b039182169261010090910490911690612a31565b80546003820154604080518581526101009093046001600160a01b031660208401528201527ff22517a5eae9f54be712c3150eca5ba925d233687b223c2ebf89272f12ee08659060600160405180910390a1600681015460018201546001600160a01b031660009081526007602052604090206002015481118015906118be5750804710155b156119345760018201546001600160a01b0316600090815260076020526040812060020180548392906118f2908490613dda565b909155505081546040516101009091046001600160a01b0316906108fc8315029083906000818181858888f19350505050158015610fc6573d6000803e3d6000fd5b8154604080518581526101009092046001600160a01b0316602083015281018290527f5562f3770dc6771b10ced979e143188578972781dc3cb3ad66c125e7d1797c869060600160405180910390a15b505050565b6000546001600160a01b031633146119e35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a4565b6001600160a01b038116611a5f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107a4565b611a6881611bb4565b50565b6000828152600a602090815260408083206005909252822083519192909160259085908390611a9c57611a9c613df1565b6020026020010151611aae9190613ea6565b835460ff821665010000000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffff821681178655919250600091611b2991859164ffffffffff908116911617611b06856002613dcb565b6003870154885491909216151591611b249164ffffffffff166114dc565b612ada565b6001840154845460028601546003870154885460408051938452602084019290925264ffffffffff169082015260ff86166060820152608081018490529293506001600160a01b0391821692610100909104909116907f31f298f8512cd20a0c9f7631142286da4f52772d89b405b5c68274c4c64cb4339060a00160405180910390a3505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b03163314611c765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a4565b6101908161ffff161115611cbc576040517f461e6e3b00000000000000000000000000000000000000000000000000000000815261ffff821660048201526024016107a4565b6001600160a01b03821660008181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac812910160405180910390a25050565b611d9760405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b60005474010000000000000000000000000000000000000000900460ff1615611e025760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107a4565b600260015403611e545760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107a4565b60026001556008546040517fcbe230c30000000000000000000000000000000000000000000000000000000081526001600160a01b0387811660048301529091169063cbe230c390602401602060405180830381865afa158015611ebc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee09190613eba565b1515600003611f26576040517f1e7c09c70000000000000000000000000000000000000000000000000000000081526001600160a01b03861660048201526024016107a4565b336001600160a01b03861615600081611f3f5734611f49565b611f498734613dda565b9050600082611f585787611f62565b611f628234613dda565b90506000611f6e6108fb565b90506064611f7d82600a613c45565b611f879190613c93565b611f919082613dda565b831015611fca576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038a1660009081526007602052604081206002018054859290611ff5908490613ccf565b9091555050612710821090508061202657506001600160a01b03891660009081526007602052604090206001015481105b1561206f576040517f8a8802470000000000000000000000000000000000000000000000000000000081526001600160a01b038a166004820152602481018290526044016107a4565b6008546040517f278b39de0000000000000000000000000000000000000000000000000000000081526001600160a01b038b81166004830152602482018a9052600092169063278b39de90604401602060405180830381865afa1580156120da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120fe9190613edc565b90508082111561215357831561214f576001600160a01b0385166108fc6121258385613dda565b6040518115909202916000818181858888f1935050505015801561214d573d6000803e3d6000fd5b505b8091505b506004546003546001600160a01b038b811660009081526007602052604081205490939190911691635d3b1d309162010000900467ffffffffffffffff16156121c4576001600160a01b038d1660009081526007602052604090205462010000900467ffffffffffffffff166121d2565b60025467ffffffffffffffff165b60025460405160e085901b7fffffffff00000000000000000000000000000000000000000000000000000000168152600481019390935267ffffffffffffffff90911660248301526c01000000000000000000000000810461ffff90811660448401526801000000000000000090910463ffffffff1660648301527f000000000000000000000000000000000000000000000000000000000000000016608482015260a4016020604051808303816000875af1158015612296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ba9190613edc565b90506000604051806101000160405280600015158152602001876001600160a01b031681526020018c6001600160a01b031681526020018381526020018481526020014381526020016000815260200185815250905060066000876001600160a01b03166001600160a01b03168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806005600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e0820151816006015590505060006001600160a01b0316600960009054906101000a90046001600160a01b03166001600160a01b031614612611576001600160a01b0388161580159061247e57506001600160a01b0386166000908152600660205260409020546001145b801561250e57506009546040517f18452cd80000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152909116906318452cd890602401602060405180830381865afa1580156124e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250c9190613eba565b155b15612598576009546040517fb94265b80000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301528a811660248301529091169063b94265b890604401600060405180830381600087803b15801561257b57600080fd5b505af115801561258f573d6000803e3d6000fd5b50505050612611565b6009546040517fce5cae920000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301529091169063ce5cae9290602401600060405180830381600087803b1580156125f857600080fd5b505af115801561260c573d6000803e3d6000fd5b505050505b8461262b5761262b6001600160a01b038c168730866131b5565b600180559a9950505050505050505050565b60005474010000000000000000000000000000000000000000900460ff166126a75760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016107a4565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60005474010000000000000000000000000000000000000000900460ff161561277a5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107a4565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586126f23390565b606061154b838360405180606001604052806027815260200161401f60279139613206565b6001600160a01b038216600090815260066020908152604080832080548251818502810185019093528083526060949383018282801561286557602002820191906000526020600020905b815481526020019060010190808311612851575b505083519394505050508381101561287b578093505b60008467ffffffffffffffff811115612896576128966135d5565b60405190808252806020026020018201604052801561292357816020015b61291060405180610100016040528060001515815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b8152602001906001900390816128b45790505b5090508415612a28576000825b61293a8785613dda565b811115612a25576005600086612951600185613dda565b8151811061296157612961613df1565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff811615158352046001600160a01b03908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015283518490849081106129f9576129f9613df1565b60200260200101819052508180612a0f90613e8c565b9250508080612a1d90613ef5565b915050612930565b50505b95945050505050565b6040516001600160a01b0383166024820152604481018290526119849084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526132fa565b82546000906001600160a01b036101008204169060ff16151560011480612b0857506001600160a01b038116155b15612b475784600201546040517f1a040cf00000000000000000000000000000000000000000000000000000000081526004016107a491815260200190565b600180860154600387015487547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690921787556001600160a01b03169081158615612fa5576000612b998388613dda565b90506000612ba785856133df565b90506000612bb586846133df565b90506000612bc38284613ccf565b9050612bcf818b613dda565b99506000612bdd8488613dda565b90506000612beb8487613dda565b90508615612c94576040516001600160a01b038b169083156108fc029084906000818181858888f19350505050612c8f5760028e015460408051918252602082018a905260608282018190526015908301527f47617320746f6b656e2073656e64206661696c656400000000000000000000006080830152517f2f47628dd4a5df2cb8dcf9bf22dcb68db93b798e9666e48454fdf5c3488c378d9181900360a00190a15b612e90565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b038b81166004830152602482018490528a169063a9059cbb906044016020604051808303816000875af1925050508015612d18575060408051601f3d908101601f19168201909252612d1591810190613eba565b60015b612d9457612d24613f0c565b806308c379a003612d885750612d38613f28565b80612d435750612d8a565b7f2f47628dd4a5df2cb8dcf9bf22dcb68db93b798e9666e48454fdf5c3488c378d8f600201548483604051612d7a93929190613fd0565b60405180910390a150612d96565b505b3d6000803e3d6000fd5b505b6008546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015260248101879052908a169063a9059cbb906044016020604051808303816000875af1925050508015612e1e575060408051601f3d908101601f19168201909252612e1b91810190613eba565b60015b612e8e57612e2a613f0c565b806308c379a003612d885750612e3e613f28565b80612e495750612d8a565b7ffa916ddbcce76584ab5323754780c39d03cd75048d5bfb4361e966a270d482528f600201548783604051612e8093929190613fd0565b60405180910390a150612e90565b505b6008546001600160a01b0316631f61502388612ead576000612eaf565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03808f1660048301528d16602482015260448101859052606481018790526084016000604051808303818588803b158015612f1c57600080fd5b505af193505050508015612f2e575060015b612f9a57612f3a613f0c565b806308c379a003612d885750612f4e613f28565b80612f595750612d8a565b7f4faefcbc151a3b06dfca7dd0353fc453e246fee39a129b0dd0f89255b8317a158f600201548383604051612f9093929190613fd0565b60405180910390a1505b5050505050506131a3565b60009550806130a8576008546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481018490529084169063a9059cbb906044016020604051808303816000875af1925050508015613036575060408051601f3d908101601f1916820190925261303391810190613eba565b60015b6130a657613042613f0c565b806308c379a003612d885750613056613f28565b806130615750612d8a565b7f6083085f60af3af3b5f0ac3fc19411dc014dff48425ef2707ebcf7059582e4528960020154848360405161309893929190613fd0565b60405180910390a1506130a8565b505b6008546001600160a01b0316633138809d826130c55760006130c7565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b0387166004820152602481018690526044016000604051808303818588803b15801561312557600080fd5b505af193505050508015613137575060015b6131a357613143613f0c565b806308c379a003612d885750613157613f28565b806131625750612d8a565b7fda6ed7532ab456201ccb34e59035ea00254ed76e71e7d47d04b4287b302153a88960020154848360405161319993929190613fd0565b60405180910390a1505b50505050506005929092018290555090565b6040516001600160a01b0380851660248301528316604482015260648101829052610fc69085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612a76565b60606001600160a01b0384163b6132855760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016107a4565b600080856001600160a01b0316856040516132a09190613fef565b600060405180830381855af49150503d80600081146132db576040519150601f19603f3d011682016040523d82523d6000602084013e6132e0565b606091505b50915091506132f082828661340b565b9695505050505050565b600061334f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166134449092919063ffffffff16565b805190915015611984578080602001905181019061336d9190613eba565b6119845760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107a4565b6001600160a01b0382166000908152600760205260408120546127109061154190849061ffff16613c45565b6060831561341a57508161154b565b82511561342a5782518084602001fd5b8160405162461bcd60e51b81526004016107a4919061400b565b6060613453848460008561345b565b949350505050565b6060824710156134d35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107a4565b6001600160a01b0385163b61352a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107a4565b600080866001600160a01b031685876040516135469190613fef565b60006040518083038185875af1925050503d8060008114613583576040519150601f19603f3d011682016040523d82523d6000602084013e613588565b606091505b509150915061359882828661340b565b979650505050505050565b6001600160a01b0381168114611a6857600080fd5b6000602082840312156135ca57600080fd5b813561154b816135a3565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff8211171561362a5761362a6135d5565b6040525050565b6000806040838503121561364457600080fd5b8235915060208084013567ffffffffffffffff8082111561366457600080fd5b818601915086601f83011261367857600080fd5b81358181111561368a5761368a6135d5565b8060051b915060405161369f85840182613604565b818152918301840191848101898411156136b857600080fd5b938501935b838510156136d457843581529385019385016136bd565b5080955050505050509250929050565b6000602082840312156136f657600080fd5b5035919050565b803567ffffffffffffffff8116811461371557600080fd5b919050565b63ffffffff81168114611a6857600080fd5b803561ffff8116811461371557600080fd5b6000806000806080858703121561375457600080fd5b61375d856136fd565b9350602085013561376d8161371a565b925061377b6040860161372c565b9396929550929360600135925050565b6000806040838503121561379e57600080fd5b82356137a9816135a3565b946020939093013593505050565b600080604083850312156137ca57600080fd5b82356137d5816135a3565b91506137e3602084016136fd565b90509250929050565b600080604083850312156137ff57600080fd5b823561380a816135a3565b91506137e36020840161372c565b803564ffffffffff8116811461371557600080fd5b6000806000806080858703121561384357600080fd5b61384c85613818565b9350602085013561385c816135a3565b9250604085013591506060850135613873816135a3565b939692955090935050565b6000806020838503121561389157600080fd5b823567ffffffffffffffff808211156138a957600080fd5b818501915085601f8301126138bd57600080fd5b8135818111156138cc57600080fd5b8660208260051b85010111156138e157600080fd5b60209290920196919550909350505050565b60005b8381101561390e5781810151838201526020016138f6565b83811115610fc65750506000910152565b600081518084526139378160208601602086016138f3565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156139be577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526139ac85835161391f565b94509285019290850190600101613972565b5092979650505050505050565b600080604083850312156139de57600080fd5b82356139e9816135a3565b915060208301356139f9816135a3565b809150509250929050565b60008060408385031215613a1757600080fd5b823591506137e360208401613818565b602080825282518282018190526000919060409081850190868401855b82811015613ad65781518051805115158652878101516001600160a01b0390811689880152878201511687870152606080820151908701526080808201519087015260a0808201519087015260c0808201519087015260e09081015190860152860151805164ffffffffff166101008601526020015160ff166101208501526101409093019290850190600101613a44565b5091979650505050505050565b805169ffffffffffffffffffff8116811461371557600080fd5b600080600080600060a08688031215613b1557600080fd5b613b1e86613ae3565b9450602086015193506040860151925060608601519150613b4160808701613ae3565b90509295509295909350565b805162ffffff8116811461371557600080fd5b60008060008060008060008060006101208a8c031215613b7f57600080fd5b8951613b8a8161371a565b60208b0151909950613b9b8161371a565b60408b0151909850613bac8161371a565b60608b0151909750613bbd8161371a565b60808b0151909650613bce8161371a565b9450613bdc60a08b01613b4d565b9350613bea60c08b01613b4d565b9250613bf860e08b01613b4d565b9150613c076101008b01613b4d565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000816000190483118215151615613c5f57613c5f613c16565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613ca257613ca2613c64565b500490565b600063ffffffff808316818516808303821115613cc657613cc6613c16565b01949350505050565b60008219821115613ce257613ce2613c16565b500190565b600181815b80851115613d22578160001904821115613d0857613d08613c16565b80851615613d1557918102915b93841c9390800290613cec565b509250929050565b600082613d39575060016113ae565b81613d46575060006113ae565b8160018114613d5c5760028114613d6657613d82565b60019150506113ae565b60ff841115613d7757613d77613c16565b50506001821b6113ae565b5060208310610133831016604e8410600b8410161715613da5575081810a6113ae565b613daf8383613ce7565b8060001904821115613dc357613dc3613c16565b029392505050565b600061154b60ff841683613d2a565b600082821015613dec57613dec613c16565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613e5557600080fd5b83018035915067ffffffffffffffff821115613e7057600080fd5b602001915036819003821315613e8557600080fd5b9250929050565b60006000198203613e9f57613e9f613c16565b5060010190565b600082613eb557613eb5613c64565b500690565b600060208284031215613ecc57600080fd5b8151801515811461154b57600080fd5b600060208284031215613eee57600080fd5b5051919050565b600081613f0457613f04613c16565b506000190190565b600060033d1115613f255760046000803e5060005160e01c5b90565b600060443d1015613f365790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715613f8457505050505090565b8285019150815181811115613f9c5750505050505090565b843d8701016020828501011115613fb65750505050505090565b613fc560208286010187613604565b509095945050505050565b838152826020820152606060408201526000612a28606083018461391f565b600082516140018184602087016138f3565b9190910192915050565b60208152600061154b602083018461391f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122086fc4d9a23556f56aff24f399dd692e1a85bf5c015329bb29420c8c3fb556b0c64736f6c634300080e00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572000000000000000000000000187de399100aa962f209aa78621f5138aca6111f00000000000000000000000019fdd2700876584c1899d9c4591aa2cdef82cc29000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff6340000000000000000000000001b8a25f73c9420dd507406c3a3816a276b62f56a

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

000000000000000000000000187de399100aa962f209aa78621f5138aca6111f00000000000000000000000019fdd2700876584c1899d9c4591aa2cdef82cc29000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff6340000000000000000000000001b8a25f73c9420dd507406c3a3816a276b62f56a

-----Decoded View---------------
Arg [0] : bankAddress (address): 0x187de399100aa962f209aa78621f5138aca6111f
Arg [1] : referralProgramAddress (address): 0x19fdd2700876584c1899d9c4591aa2cdef82cc29
Arg [2] : chainlinkCoordinatorAddress (address): 0xd5d517abe5cf79b7e95ec98db0f0277788aff634
Arg [3] : LINK_ETH_feedAddress (address): 0x1b8a25f73c9420dd507406c3a3816a276b62f56a

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000187de399100aa962f209aa78621f5138aca6111f
Arg [1] : 00000000000000000000000019fdd2700876584c1899d9c4591aa2cdef82cc29
Arg [2] : 000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff634
Arg [3] : 0000000000000000000000001b8a25f73c9420dd507406c3a3816a276b62f56a


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