Contract 0x31EDcD915e695AdAF782c482b9816613b347AC8c 1

 

Contract Overview

Balance:
87.862748469351321153 MATIC

MATIC Value:
$78.70 (@ $0.90/MATIC)

Token:
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x26b7b892caf28f802c1e82d0adfed1b329a7cce9e5e9a8f59cb0b4f6c36ee87aWager365614242022-12-08 3:11:249 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.707627865150705 MATIC0.009878196655 33.270451441
0xc28aa9802b731c48924c6b02d2c4a70217325b9cef1f696eea5f4017520ab650Wager365613912022-12-08 3:10:1410 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c0.70772578631759 MATIC0.009948252997 33.50640606
0xfca8d6b6ab9357d9ceeca49962c76e3b051fd1ecb3ba731b454b3b4030b0bc7cWager365613762022-12-08 3:09:4411 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c0.707807634961925 MATIC0.010006810476 33.703631709
0xc7760a840d206d7711269baa2a335df1e69867ea0108f412c9c48e60288a3a10Wager365613172022-12-08 3:07:4213 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c0.708208479979245 MATIC0.010298818448 34.687134812
0x2ba533dd9e691f3ddd54294e03cc589d54f239bfb66a7aad986c29a540b40ee6Wager365612382022-12-08 3:05:0015 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c0.709472959975495 MATIC0.011198244183 37.716463067
0x990556c44371b3be36bb573e5e0613a399c8b73cfe1cc3a9f26bf43ab4026f42Wager365612232022-12-08 3:04:3016 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c0.7104143110105 MATIC0.011871720738 39.984778814
0x097b5ab187ccf81eef1701c2361b8946c2a8512180b41cef0cede686cd27561aWager365611002022-12-08 2:56:2624 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c2.817974288430055 MATIC0.01012604039 34.105206331
0xc01d747a6197b1093209295568cba2646190e9f287eb05351a2b36ffc890f5e8Wager365610332022-12-08 2:54:0126 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c2.81751589268225 MATIC0.009798087504 33.000638264
0x8ce031ed6134868489d910a9fd45bb190a1fb6905acc11543533b08d61744264Wager365570142022-12-08 0:29:272 hrs 51 mins ago0x863c5bf79bb048958f35636cc3455cd61766c36a IN  0x31edcd915e695adaf782c482b9816613b347ac8c0.717554332751281 MATIC0.009797898013 33.000000046
0x2517e4f9b82b116e59ef9d2f66b8fd4ebd389fa3556abe0d66f04fd040dd2036Wager365568502022-12-08 0:23:472 hrs 57 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.017554332776596 MATIC0.009797898031 33.000000105
0xd43027f03634601c74436875e37ec4dd363659e100138b75661fd8baad3a25c1Wager365568202022-12-08 0:22:472 hrs 58 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.017554332794441 MATIC0.009797898044 33.00000015
0x7b2bd002c0dffb33b609594aeaed8ba2083b78cbfbaa5ac4040a6ea3852ef808Wager365567922022-12-08 0:21:472 hrs 59 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.017554332796101 MATIC0.009797898045 33.000000154
0xcf6e1a167bb87e0460aeeec08f0990f265e2a0a4b9a139079a90c9e16c94d47cWager365567772022-12-08 0:21:172 hrs 59 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.017554332781576 MATIC0.009797898035 33.000000119
0xc800bc8ca635d5e2c4a4d32f4ef5e8789b90f7ab07e72423b083f203c933540cWager365567582022-12-08 0:20:393 hrs ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.017554332777426 MATIC0.009797898032 33.000000109
0x8a9553dee8feb294932ad19efd51d62fd8b0c8217fd495e2f4d9a97208d62f3eWager365567442022-12-08 0:20:113 hrs ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.017554332786556 MATIC0.009797898038 33.000000131
0xc0c58da4e97d7a4f630c148e8155f668701f96a7f829c0c7f52cf3c7bd0ff1eaWager365567252022-12-08 0:19:293 hrs 1 min ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c2.017554332781576 MATIC0.009797898035 33.000000119
0x30eb253ccbd0d2d3bd9d13153f695558bdf72e4ec5467f0016f8469abc842633Wager365566912022-12-08 0:18:213 hrs 2 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.317554332789876 MATIC0.009797898041 33.000000139
0x5294d25ba61b0f7aaac17c0258f08007688fe525e8d83f2904f9b338840f68d2Wager365566352022-12-08 0:16:253 hrs 4 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c3.917554332809381 MATIC0.009797898055 33.000000186
0x73ac99a9d73fafb5880163c06f6a23144cd2586bdca1faca81979d72722800d4Wager365566162022-12-08 0:15:473 hrs 5 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.317554332791536 MATIC0.009797898042 33.000000143
0xb3a594164080604ce928fe0e56efb75b9b14723c28847952f7869156f3524addWager365566032022-12-08 0:15:173 hrs 5 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.317554332781991 MATIC0.009797898035 33.00000012
0x2db7899d21e6eb8623e7a6b6244add4e49bc5f5727f1b2e389b337fd7b1b45e1Wager365565822022-12-08 0:14:353 hrs 6 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.317554332781161 MATIC0.009797898035 33.000000118
0x305c39c362bdecd60f84a4318e35c641ea62abcc44f5af395cca8b3624cbfbedWager365565672022-12-08 0:14:053 hrs 6 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.317554332778671 MATIC0.009797898032 33.00000011
0xf268a06d90203fc2898d12586218b15ececec103be8bfa9cfe599a83426280e5Wager365565342022-12-08 0:12:553 hrs 8 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c4.217554332790291 MATIC0.009797898041 33.00000014
0xe4ff1229b1f34a829d981bab5a8efb49f8bfccc3c5fd60e6767ca9f89caa132fWager365565012022-12-08 0:11:493 hrs 9 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c1.417788694083611 MATIC0.009965568581 33.564726148
0x4cc18961d72f0fcc2be9b83822f40d871d14054499a717e7c24fb1133ed5800cWager365564752022-12-08 0:10:483 hrs 10 mins ago0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d2 IN  0x31edcd915e695adaf782c482b9816613b347ac8c3.617554332954216 MATIC0.009797898158 33.000000535
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xa5f3de0f9b5703f750e02bc2e0d5cfa25a433b72123614a0ecc43fadaca596ff365614302022-12-08 3:11:369 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.0507 MATIC
0xa5f3de0f9b5703f750e02bc2e0d5cfa25a433b72123614a0ecc43fadaca596ff365614302022-12-08 3:11:369 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c0x863c5bf79bb048958f35636cc3455cd61766c36a1.6393 MATIC
0x8f324f36e6b22fef18f845152175aad4c1f809cc11fb13c9532841ac87bdf8c5365613972022-12-08 3:10:2610 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.69 MATIC
0x9fbbe7f0b706ba604c7b3f3eb6c8677c3b5e2f491dff053610a0ee91707ce446365613822022-12-08 3:09:5611 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.69 MATIC
0xb8535695edbff219d03075ae4dcf888dfab1c189129ce9f31afca242cafc252c365613242022-12-08 3:07:5613 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.0207 MATIC
0xb8535695edbff219d03075ae4dcf888dfab1c189129ce9f31afca242cafc252c365613242022-12-08 3:07:5613 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c0x863c5bf79bb048958f35636cc3455cd61766c36a0.6693 MATIC
0xeb83bfc2316eab61c44372e423768319a0746efb979ae9269508d0e168bc0e57365612432022-12-08 3:05:1015 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.0207 MATIC
0xeb83bfc2316eab61c44372e423768319a0746efb979ae9269508d0e168bc0e57365612432022-12-08 3:05:1015 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c0x863c5bf79bb048958f35636cc3455cd61766c36a0.6693 MATIC
0x47f847cc113892546705ab1beb58d2edf90066224bbe1bb03daf35d7aa6785bd365612282022-12-08 3:04:4016 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.0207 MATIC
0x47f847cc113892546705ab1beb58d2edf90066224bbe1bb03daf35d7aa6785bd365612282022-12-08 3:04:4016 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c0x863c5bf79bb048958f35636cc3455cd61766c36a0.6693 MATIC
0xdb79141827170880b3aaaca1199c0f16c071c48f9a98e3064ccbc3f2b5ded479365611052022-12-08 2:56:4624 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e2.8 MATIC
0x88e6e018d80f2bee497b0f34c242294899c7c19c1a82045fde9e82f0f42721df365610392022-12-08 2:54:1326 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.084 MATIC
0x88e6e018d80f2bee497b0f34c242294899c7c19c1a82045fde9e82f0f42721df365610392022-12-08 2:54:1326 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c0x863c5bf79bb048958f35636cc3455cd61766c36a2.716 MATIC
0xbe4da9b29acacee8cb57b76e79b7ccb6c97a4609dd3f7a7ea6b2cb744be47f8a365570212022-12-08 0:29:412 hrs 51 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.7 MATIC
0x1f46cc0e0f4584b7e432c32c025b414ff7aa1c3c63d83c555bd1eb29118b1208365568572022-12-08 0:24:012 hrs 56 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1 MATIC
0x556374a9dd2e5617fc2384e77d204f93df2bb5649d92263227ca73bb663e69a8365568272022-12-08 0:23:012 hrs 57 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1 MATIC
0x3ae518bdab3f22b9b99c7e363245275dd99b96eb253ab03a2be60e18da57a9f6365567992022-12-08 0:22:012 hrs 58 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1 MATIC
0x7f44d241447b8ebb78f43c1e5fbb12beea8ab597ed24657737fd0d16e0e27ae3365567842022-12-08 0:21:312 hrs 59 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1 MATIC
0x82ea9293b5635c821ad6891878275839413caf026f5bd7b25452d63d441cb811365567632022-12-08 0:20:493 hrs ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1 MATIC
0xf19cbaef61f70a34c58893ed70cb3407fdd9aa751dbd5b81c85afbf91f9bb986365567492022-12-08 0:20:213 hrs ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1 MATIC
0x6b5dd0aaa519de0417866c2af16ab6fbe04c7de9e7755243710122be45dda132365567312022-12-08 0:19:413 hrs 1 min ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e2 MATIC
0xc1f9668877653eaea8dde80f2903361287c2e5e9a1334f84828f687038bf5e9d365566992022-12-08 0:18:373 hrs 2 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1.3 MATIC
0xa831e3bc5473e7ee427ee893bbdc51d87ebb959fc1b4effeb8e59245fa6ee4f7365566402022-12-08 0:16:353 hrs 4 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e0.117 MATIC
0xa831e3bc5473e7ee427ee893bbdc51d87ebb959fc1b4effeb8e59245fa6ee4f7365566402022-12-08 0:16:353 hrs 4 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c0xd45625ae36f22e5c0e5103e4d62f511fba1fe3d23.783 MATIC
0x29d12af21dd1e69f8b20f77ac7f59bbdf49c0d95b9b85a4bceec2299df8a5d5e365566232022-12-08 0:16:013 hrs 4 mins ago 0x31edcd915e695adaf782c482b9816613b347ac8c 0x999b6d28a9e78c4be13d51469c49585d6d25be5e1.3 MATIC
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Dice

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 80000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 15 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

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

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

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

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

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

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

  function version() external view returns (uint256);

  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;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 10 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./Address.sol";

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

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

pragma solidity 0.8.17;

/// @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 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.
    /// @param fees Bet amount and bet profit fees amount.
    function cashIn(
        address tokenAddress,
        uint256 amount,
        uint256 fees
    ) 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);

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

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

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

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

pragma solidity 0.8.17;

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

/// @title BetSwirl's Dice game
/// @notice The game is played with a 100 sided dice. The game's goal is to guess whether the lucky number will be above your chosen number.
/// @author Romuald Hog (based on Yakitori's Dice)
contract Dice is Game {
    /// @notice Full dice bet information struct.
    /// @param bet The Bet struct information.
    /// @param diceBet The Dice bet struct information.
    /// @dev Used to package bet information for the front-end.
    struct FullDiceBet {
        Bet bet;
        DiceBet diceBet;
    }

    /// @notice Dice bet information struct.
    /// @param cap The chosen dice number.
    /// @param rolled The rolled dice number.
    struct DiceBet {
        uint8 cap;
        uint8 rolled;
    }

    /// @notice Maps bets IDs to chosen and rolled dice numbers.
    mapping(uint256 => DiceBet) public diceBets;

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

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

    /// @notice Provided cap is not within 1 and 99 included.
    /// @param minCap The minimum cap.
    /// @param maxCap The maximum cap.
    error CapNotInRange(uint8 minCap, uint8 maxCap);

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

    /// @notice Calculates the target payout amount.
    /// @param betAmount Bet amount.
    /// @param cap The chosen dice number.
    /// @return The target payout amount.
    function _getPayout(uint256 betAmount, uint8 cap)
        private
        pure
        returns (uint256)
    {
        return (betAmount * 100) / (100 - cap);
    }

    /// @notice Creates a new bet and stores the chosen dice number.
    /// @param cap The chosen dice number.
    /// @param token Address of the token.
    /// @param tokenAmount The number of tokens bet.
    function wager(
        uint8 cap,
        address token,
        uint256 tokenAmount
    ) external payable whenNotPaused {
        /// Dice cap 1 gives 99% chance.
        /// Dice cap 99 gives 1% chance.
        if (cap == 0 || cap > 99) {
            revert CapNotInRange(1, 99);
        }

        Bet memory bet = _newBet(token, tokenAmount, _getPayout(10000, cap));
        diceBets[bet.id].cap = cap;

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

    /// @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
    {
        uint256 startGas = gasleft();

        DiceBet storage diceBet = diceBets[id];
        Bet storage bet = bets[id];

        uint8 rolled = uint8((randomWords[0] % 100) + 1);
        diceBet.rolled = rolled;
        uint256 payout = _resolveBet(
            bet,
            rolled > diceBet.cap ?
                _getPayout(bet.amount, diceBet.cap) : 0
        );

        emit Roll(
            bet.id,
            bet.user,
            bet.token,
            bet.amount,
            diceBet.cap,
            rolled,
            payout
        );

        _accountVRFCost(bet, startGas);
    }

    /// @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 (FullDiceBet[] memory)
    {
        Bet[] memory lastBets = _getLastUserBets(user, dataLength);
        FullDiceBet[] memory lastDiceBets = new FullDiceBet[](lastBets.length);
        for (uint256 i; i < lastBets.length; i++) {
            lastDiceBets[i] = FullDiceBet(
                lastBets[i],
                diceBets[lastBets[i].id]
            );
        }
        return lastDiceBets;
    }
}

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

pragma solidity 0.8.17;

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

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

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

// import "hardhat/console.sol";

interface IVRFCoordinatorV2 is VRFCoordinatorV2Interface {
    function getFeeConfig()
        external
        view
        returns (
            uint32 fulfillmentFlatFeeLinkPPMTier1,
            uint32 fulfillmentFlatFeeLinkPPMTier2,
            uint32 fulfillmentFlatFeeLinkPPMTier3,
            uint32 fulfillmentFlatFeeLinkPPMTier4,
            uint32 fulfillmentFlatFeeLinkPPMTier5,
            uint24 reqsForTier2,
            uint24 reqsForTier3,
            uint24 reqsForTier4,
            uint24 reqsForTier5
        );
}

/// @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 user;
        address token;
        uint256 id;
        uint256 amount;
        uint256 blockNumber;
        uint256 payout;
        uint256 vrfCost;
    }

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

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

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

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

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

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

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

    /// @notice Maps user addresses to VRF overcharged cost.
    mapping(address => uint256) public userOverchargedVRFCost;

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

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

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

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

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

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

    /// @notice Emitted after the user's overcharged VRF cost amount is transfered.
    /// @param user Address of the user.
    /// @param overchargedVRFCost Number of tokens refunded.
    event DistributeOverchargedVRFCost(
        address indexed user,
        uint256 overchargedVRFCost
    );

    /// @notice Emitted after the overcharged VRF cost amount is accounted.
    /// @param user Address of the user.
    /// @param overchargedVRFCost Number of tokens overcharged.
    event AccountOverchargedVRFCost(
        address indexed user,
        uint256 overchargedVRFCost
    );

    /// @notice No user's overcharged Chainlink fee.
    error NoOverchargedVRFCost();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return newBet;
    }

    /// @notice Calculates the overcharged VRF cost based on the gas consumed.
    /// @param bet The Bet struct information.
    /// @param startGas Gas amount at start.
    function _accountVRFCost(Bet storage bet, uint256 startGas) internal {
        (, int256 weiPerUnitLink, , , ) = _LINK_ETH_feed.latestRoundData();
        if (weiPerUnitLink < 0) {
            weiPerUnitLink = 0;
        }
        // Get Chainlink VRF v2 fee amount.
        (
            uint32 fulfillmentFlatFeeLinkPPMTier1,
            ,
            ,
            ,
            ,
            ,
            ,
            ,

        ) = _chainlinkConfig.chainlinkCoordinator.getFeeConfig();
        // Calculates the VRF premium fee in ETH
        uint256 chainlinkPremium = ((1e12 *
            uint256(fulfillmentFlatFeeLinkPPMTier1) *
            uint256(weiPerUnitLink)) / 1e18);
            
        // Calculate the gas fee (adding the estimated gas spent after this calculation) + premium
        uint256 actualVRFCost = (tx.gasprice *
            (startGas - gasleft() + _chainlinkConfig.gasAfterCalculation)) +
            chainlinkPremium;

        // If the actual VRF cost is higher than what the player paid.
        if (actualVRFCost > bet.vrfCost) {
            actualVRFCost = bet.vrfCost;
        } else {
            // Otherwise credits it to his account.
            uint256 overchargedVRFCost = bet.vrfCost - actualVRFCost;
            userOverchargedVRFCost[bet.user] += overchargedVRFCost;
            bet.vrfCost = actualVRFCost;
            emit AccountOverchargedVRFCost(bet.user, overchargedVRFCost);
        }

        // Credits the actual VRF cost to fund the VRF subscription.
        tokens[bet.token].VRFFees += actualVRFCost;
    }

    /// @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 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, uint256 payout)
        internal
        returns (uint256)
    {
        if (bet.resolved == true || bet.id == 0) {
            revert NotPendingBet();
        }
        bet.resolved = true;

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

        uint256 betAmount = bet.amount;
        bool isGasToken = bet.token == address(0);

        if (payout > betAmount) {
            // The user has won more than his bet
            address user = bet.user;

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

            payout -= fee;

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

            // Transfer the payout from the bank, the bet amount fee to the bank, and account fees.
            bank.payout{value: isGasToken ? betAmountFee : 0}(
                user,
                token,
                profitPayout,
                fee
            );
        } else if (payout > 0) {
            // The user has won something smaller than his bet
            address user = bet.user;

            uint256 fee = _getFees(token, payout);
            payout -= fee;
            uint256 bankCashIn = betAmount - payout;

            // Transfer the bet amount payout to the player
            if (isGasToken) {
                Address.sendValue(payable(user), payout);
            } else {
                IERC20(token).safeTransfer(user, payout);
                // Transfer the lost bet amount and fee to the bank
                IERC20(token).safeTransfer(address(bank), bankCashIn);
            }

            bank.cashIn{value: isGasToken ? bankCashIn : 0}(
                token,
                bankCashIn,
                fee
            );
        } else {
            // The user did not win anything
            if (!isGasToken) {
                IERC20(token).safeTransfer(address(bank), betAmount);
            }
            bank.cashIn{value: isGasToken ? betAmount : 0}(token, betAmount, 0);
        }

        bet.payout = payout;
        return payout;
    }

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

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

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

        return userBets;
    }

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

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

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

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

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

    /// @notice Withdraw user's overcharged Chainlink fees.
    function withdrawOverchargedVRFCost(address user) external {
        uint256 overchargedVRFCost = userOverchargedVRFCost[user];
        if (overchargedVRFCost == 0) {
            revert NoOverchargedVRFCost();
        }

        delete userOverchargedVRFCost[user];
        Address.sendValue(payable(user), overchargedVRFCost);
        emit DistributeOverchargedVRFCost(user, overchargedVRFCost);
    }

    /// @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 || bet.id == 0) {
            revert NotPendingBet();
        } else if (block.number < bet.blockNumber + 30) {
            revert NotFulfilled();
        }

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

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

        uint256 chainlinkVRFCost = bet.vrfCost;
        if (bet.token == address(0)) {
            Address.sendValue(payable(bet.user), bet.amount + chainlinkVRFCost);
        } else {
            IERC20(bet.token).safeTransfer(bet.user, bet.amount);
            Address.sendValue(payable(bet.user), chainlinkVRFCost);
        }

        emit BetRefunded(id, bet.user, bet.amount, chainlinkVRFCost);
    }

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"bankAddress","type":"address"},{"internalType":"address","name":"chainlinkCoordinatorAddress","type":"address"},{"internalType":"address","name":"LINK_ETH_feedAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[{"internalType":"uint8","name":"minCap","type":"uint8"},{"internalType":"uint8","name":"maxCap","type":"uint8"}],"name":"CapNotInRange","type":"error"},{"inputs":[],"name":"ExcessiveHouseEdge","type":"error"},{"inputs":[],"name":"ForbiddenToken","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[{"internalType":"int256","name":"linkWei","type":"int256"}],"name":"InvalidLinkWeiPrice","type":"error"},{"inputs":[],"name":"NoOverchargedVRFCost","type":"error"},{"inputs":[],"name":"NotFulfilled","type":"error"},{"inputs":[],"name":"NotPendingBet","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"TokenHasPendingBets","type":"error"},{"inputs":[{"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"UnderMinBetAmount","type":"error"},{"inputs":[],"name":"WrongGasValueToCoverFee","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"overchargedVRFCost","type":"uint256"}],"name":"AccountOverchargedVRFCost","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"},{"indexed":false,"internalType":"uint256","name":"chainlinkVRFCost","type":"uint256"}],"name":"BetRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"overchargedVRFCost","type":"uint256"}],"name":"DistributeOverchargedVRFCost","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeTokenVRFFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vrfCost","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"cap","type":"uint8"}],"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":"uint8","name":"cap","type":"uint8"},{"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":"uint16","name":"requestConfirmations","type":"uint16"},{"indexed":false,"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"gasAfterCalculation","type":"uint256"}],"name":"SetChainlinkConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"SetHouseEdge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"SetVRFCallbackGasLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"bank","outputs":[{"internalType":"contract IBank","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bets","outputs":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"diceBets","outputs":[{"internalType":"uint8","name":"cap","type":"uint8"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainlinkConfig","outputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"contract IVRFCoordinatorV2","name":"chainlinkCoordinator","type":"address"},{"internalType":"uint256","name":"gasAfterCalculation","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getChainlinkVRFCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"dataLength","type":"uint256"}],"name":"getLastUserBets","outputs":[{"components":[{"components":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address","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":"uint8","name":"cap","type":"uint8"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"internalType":"struct Dice.DiceBet","name":"diceBet","type":"tuple"}],"internalType":"struct Dice.FullDiceBet[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"hasPendingBets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"refundBet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"gasAfterCalculation","type":"uint256"}],"name":"setChainlinkConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"setHouseEdge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"setVRFCallbackGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"uint16","name":"houseEdge","type":"uint16"},{"internalType":"uint64","name":"pendingCount","type":"uint64"},{"internalType":"uint32","name":"VRFCallbackGasLimit","type":"uint32"},{"internalType":"uint256","name":"VRFFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userOverchargedVRFCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"cap","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"wager","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"withdrawOverchargedVRFCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawTokensVRFFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040523480156200001157600080fd5b5060405162003f9f38038062003f9f8339810160408190526200003491620001d8565b82826001838262000045336200016b565b6000805460ff60a01b191690556001600160a01b0390811660805260018055811615806200007a57506001600160a01b038316155b806200008d57506001600160a01b038416155b15620000ac5760405163e6c4247b60e01b815260040160405180910390fd5b61ffff821615801590620000c657506101f48261ffff1611155b620001175760405162461bcd60e51b815260206004820152601e60248201527f57726f6e6720436861696e6c696e6b204e756d52616e646f6d576f7264730000604482015260640160405180910390fd5b6001600160a01b0393841660c052600480549385166001600160a01b0319909416939093179092556002805461ffff909216620100000263ffff0000199092169190911790551660a0525062000222915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001d357600080fd5b919050565b600080600060608486031215620001ee57600080fd5b620001f984620001bb565b92506200020960208501620001bb565b91506200021960408501620001bb565b90509250925092565b60805160a05160c051613cf2620002ad6000396000818161041b01528181610a180152818161188f01528181611a3b01528181611b3601528181611c230152818161281d01528181612844015281816129c8015281816129ef01528181612aeb0152612b12015260008181610ce70152612bfa0152600081816106c7015261072f0152613cf26000f3fe6080604052600436106101805760003560e01c806378bcde22116100d6578063ac9650d81161007f578063e32fe50411610059578063e32fe504146105d5578063e4860339146105f5578063f2fde38b1461068f57600080fd5b8063ac9650d81461055b578063c2fb579f14610588578063e1fdb4b4146105b557600080fd5b80638456cb59116100b05780638456cb59146104fb5780638da5cb5b14610510578063982c3fdd1461053b57600080fd5b806378bcde22146104625780637d0807d71461048257806382b0c00b146104db57600080fd5b8063594043fd11610138578063707cd55e11610112578063707cd55e146103d4578063715018a6146103f457806376cdb03b1461040957600080fd5b8063594043fd1461031f5780635c975abb146103845780637038942f146103b457600080fd5b8063277d35af11610169578063277d35af1461027e5780634031e85b146102b957806342258eca146102cc57600080fd5b80631fe543e31461018557806322af00fa146101a7575b600080fd5b34801561019157600080fd5b506101a56101a03660046133a0565b6106af565b005b3480156101b357600080fd5b506102236101c2366004613488565b6006602081905260009182526040909120805460018201546002830154600384015460048501546005860154959096015460ff85169661010090950473ffffffffffffffffffffffffffffffffffffffff9081169694169492939192919088565b60408051981515895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295909616948701949094526060860192909252608085015260a084015260c083015260e0820152610100015b60405180910390f35b34801561028a57600080fd5b506102ab6102993660046134c3565b60096020526000908152604090205481565b604051908152602001610275565b6101a56102c73660046134e0565b61076f565b3480156102d857600080fd5b506103056102e7366004613488565b600a6020526000908152604090205460ff8082169161010090041682565b6040805160ff938416815292909116602083015201610275565b34801561032b57600080fd5b5061037461033a3660046134c3565b73ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604090205462010000900467ffffffffffffffff16151590565b6040519015158152602001610275565b34801561039057600080fd5b5060005474010000000000000000000000000000000000000000900460ff16610374565b3480156103c057600080fd5b506101a56103cf3660046134c3565b6108a5565b3480156103e057600080fd5b506101a56103ef3660046134c3565b610989565b34801561040057600080fd5b506101a5610ad1565b34801561041557600080fd5b5061043d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610275565b34801561046e57600080fd5b506101a561047d36600461353e565b610ae5565b34801561048e57600080fd5b506002546003546004546005546040805161ffff9095168552602085019390935273ffffffffffffffffffffffffffffffffffffffff909116918301919091526060820152608001610275565b3480156104e757600080fd5b506101a56104f6366004613573565b610c1f565b34801561050757600080fd5b506101a5610ca7565b34801561051c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661043d565b34801561054757600080fd5b506102ab6105563660046134c3565b610ce2565b34801561056757600080fd5b5061057b6105763660046135a6565b610ef5565b6040516102759190613689565b34801561059457600080fd5b506105a86105a3366004613709565b610feb565b6040516102759190613735565b3480156105c157600080fd5b506101a56105d0366004613488565b611175565b3480156105e157600080fd5b506101a56105f036600461380e565b6113e4565b34801561060157600080fd5b506106566106103660046134c3565b6008602052600090815260409020805460019091015461ffff82169162010000810467ffffffffffffffff16916a010000000000000000000090910463ffffffff169084565b6040805161ffff909516855267ffffffffffffffff909316602085015263ffffffff909116918301919091526060820152608001610275565b34801561069b57600080fd5b506101a56106aa3660046134c3565b611483565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610761576040517f1cf993f400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b61076b828261153a565b5050565b610777611697565b60ff8316158061078a575060638360ff16115b156107cb576040517f8a4b39a70000000000000000000000000000000000000000000000000000000081526001600482015260636024820152604401610758565b60006107e383836107de6127108861171c565b611748565b606081810180516000908152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff8b169081179091558286015182870151945160808089015160e08a0151875193845295830152948101939093529482015293945073ffffffffffffffffffffffffffffffffffffffff9283169392909116917f26f00ccf4a53c10f46f9e750cfb709eb6a2beba8fab751d9d2a2d99feadaaf58910160405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526009602052604081205490819003610905576040517f8ab4c5d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600960205260408120556109358282611fa6565b8173ffffffffffffffffffffffffffffffffffffffff167f3f206d449945dd03c1742ee98a9c5b872ac6c165788363e06af2796dd5de1f548260405161097d91815260200190565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040902060010154801561076b5773ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822060010191909155517fdc17c9ca0000000000000000000000000000000000000000000000000000000081526004810191909152610a89917f0000000000000000000000000000000000000000000000000000000000000000169063dc17c9ca90602401602060405180830381865afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a839190613847565b82611fa6565b8173ffffffffffffffffffffffffffffffffffffffff167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af568260405161097d91815260200190565b610ad9612105565b610ae36000612186565b565b610aed612105565b6101908161ffff161115610b2d576040517f70b5774c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602052604090205462010000900467ffffffffffffffff1615610b9a576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac812910161097d565b610c27612105565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff851690811790915560038390556005829055604080519182526020820184905281018290527fdb0c33bbe22ccb7d7c379a53ef932b131d6fb1b3bd0a7cfe7247d9513ba2a22a9060600160405180910390a1505050565b610caf612105565b60005474010000000000000000000000000000000000000000900460ff1615610cda57610ae36121fb565b610ae3612278565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610d50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d74919061387e565b50505091505060008113610db7576040517f43d4cf6600000000000000000000000000000000000000000000000000000000815260048101829052602401610758565b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015610e29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4d91906138e1565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610e7891906139c6565b610e8291906139c6565b610e8c9190613a0c565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260086020526040902054610ed3906a0100000000000000000000900463ffffffff166201c138613a20565b610ee39063ffffffff163a6139c6565b610eed9190613a3d565b949350505050565b60608167ffffffffffffffff811115610f1057610f10613371565b604051908082528060200260200182016040528015610f4357816020015b6060815260200190600190039081610f2e5790505b50905060005b82811015610fe357610fb330858584818110610f6757610f67613a50565b9050602002810190610f799190613a7f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506122e792505050565b828281518110610fc557610fc5613a50565b60200260200101819052508080610fdb90613aeb565b915050610f49565b505b92915050565b60606000610ff9848461230c565b90506000815167ffffffffffffffff81111561101757611017613371565b6040519080825280602002602001820160405280156110aa57816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e0830182905261010083018290526101208301829052825282518084019093528083526020808401919091528101919091528152602001906001900390816110355790505b50905060005b825181101561116c5760405180604001604052808483815181106110d6576110d6613a50565b60200260200101518152602001600a60008685815181106110f9576110f9613a50565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525460ff808216835261010090910416918101919091529052825183908390811061114e5761114e613a50565b6020026020010181905250808061116490613aeb565b9150506110b0565b50949350505050565b6000818152600660205260409020805460ff1615156001148061119a57506002810154155b156111d1576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60048101546111e190601e613a3d565b43101561121a576040517f07bc6c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181015473ffffffffffffffffffffffffffffffffffffffff166000908152600860205260409020805462010000900467ffffffffffffffff1681600261126183613b23565b825467ffffffffffffffff9182166101009390930a92830291909202199091161790555081547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811783556003830154600584015560068301549083015473ffffffffffffffffffffffffffffffffffffffff16611319578254600384015461131491610100900473ffffffffffffffffffffffffffffffffffffffff169061130f908490613a3d565b611fa6565b611378565b8254600384015460018501546113519273ffffffffffffffffffffffffffffffffffffffff918216926101009091049091169061256b565b825461137890610100900473ffffffffffffffffffffffffffffffffffffffff1682611fa6565b825460038401546040805187815261010090930473ffffffffffffffffffffffffffffffffffffffff166020840152820152606081018290527fe282fd838bb937af0c0f54e49ba5f86229ed0c90344c3cc4e2135cb673493e699060800160405180910390a150505050565b6113ec612105565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a010000000000000000000063ffffffff87169081029190911790915591519182527f9edb52532d26512950c91a14b132f6df3cd06bfb49e795e03e56736121cd24a8910161097d565b61148b612105565b73ffffffffffffffffffffffffffffffffffffffff811661152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610758565b61153781612186565b50565b60005a6000848152600a6020908152604080832060069092528220855193945090929091906064908690839061157257611572613a50565b60200260200101516115849190613b65565b61158f906001613a3d565b835460ff80831661010081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff8416811788559394506000936115f9938793918216911617106115e057600061263f565b600385015486546115f4919060ff1661171c565b61263f565b6001840154845460028601546003870154885460408051938452602084019290925260ff9081168383015287166060830152608082018590525193945073ffffffffffffffffffffffffffffffffffffffff92831693610100909204909216917f326deeefddbbeec0f2c3cabe67c30b881c1328c2208cf3541243d3cb67472249919081900360a00190a361168e8386612bf6565b50505050505050565b60005474010000000000000000000000000000000000000000900460ff1615610ae3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610758565b6000611729826064613b79565b60ff166117378460646139c6565b6117419190613a0c565b9392505050565b6117be604051806101000160405280600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081525090565b6117c6611697565b600260015403611832576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610758565b600260015573ffffffffffffffffffffffffffffffffffffffff8481166000818152600860205260409081902090517fcbe230c30000000000000000000000000000000000000000000000000000000081526004810192909252917f0000000000000000000000000000000000000000000000000000000000000000169063cbe230c390602401602060405180830381865afa1580156118d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fa9190613b92565b15806119095750805461ffff16155b15611940576040517fc455905500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff8616156000816119665734611970565b6119708734613bb4565b905060008261197f5787611989565b6119898234613bb4565b905060006119968a610ce2565b905060646119a582600a6139c6565b6119af9190613a0c565b6119b99082613bb4565b8310156119f2576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506040517ff6b2a2f100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063f6b2a2f190602401602060405180830381865afa158015611a84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa89190613bc7565b905080821015611ae7576040517f022558f400000000000000000000000000000000000000000000000000000000815260048101829052602401610758565b6040517f278b39de00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152602482018a90526000917f00000000000000000000000000000000000000000000000000000000000000009091169063278b39de90604401602060405180830381865afa158015611b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba39190613bc7565b905080831115611bc5578415611bc157611bc18661130f8386613bb4565b8092505b5050600480546003546040517f279e341500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d81169482019490945260009392831692635d3b1d3092917f00000000000000000000000000000000000000000000000000000000000000009091169063279e341590602401602060405180830381865afa158015611c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c909190613be0565b6002548a5460405160e086901b7fffffffff00000000000000000000000000000000000000000000000000000000168152600481019490945267ffffffffffffffff909216602484015261ffff80821660448501526a010000000000000000000090920463ffffffff16606484015262010000900416608482015260a4016020604051808303816000875af1158015611d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d519190613bc7565b905060006040518061010001604052806000151581526020018773ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff16815260200183815260200184815260200143815260200160008152602001858152509050600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806006600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e0820151816006015590505086600001600281819054906101000a900467ffffffffffffffff1680929190611f4690613c0a565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505084611f9457611f9473ffffffffffffffffffffffffffffffffffffffff8c16873086612eba565b600180559a9950505050505050505050565b80471015612010576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610758565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461206a576040519150601f19603f3d011682016040523d82523d6000602084013e61206f565b606091505b5050905080612100576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610758565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ae3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610758565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612203612f1e565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b612280611697565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861224e3390565b60606117418383604051806060016040528060278152602001613c9660279139612fa2565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260076020908152604080832080548251818502810185019093528083526060949383018282801561237857602002820191906000526020600020905b815481526020019060010190808311612364575b505083519394505050508381101561238e578093505b60008467ffffffffffffffff8111156123a9576123a9613371565b60405190808252806020026020018201604052801561245057816020015b61243d604051806101000160405280600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081525090565b8152602001906001900390816123c75790505b5090508415612562576000825b6124678785613bb4565b81111561255f57600660008661247e600185613bb4565b8151811061248e5761248e613a50565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff8116151583520473ffffffffffffffffffffffffffffffffffffffff908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e0820152835184908490811061253357612533613a50565b6020026020010181905250818061254990613aeb565b925050808061255790613c31565b91505061245d565b50505b95945050505050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526121009084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526130ca565b815460009060ff1615156001148061265957506002830154155b15612690576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117845583015473ffffffffffffffffffffffffffffffffffffffff166000818152600860205260409020805467ffffffffffffffff620100009091041690600261270183613b23565b825467ffffffffffffffff9182166101009390930a9283029190920219909116179055506003840154600185015473ffffffffffffffffffffffffffffffffffffffff16158185111561292b578554610100900473ffffffffffffffffffffffffffffffffffffffff1660006127778488613bb4565b9050600061278586866131d6565b9050600061279387846131d6565b905060006127a18284613a3d565b90506127ad818b613bb4565b995060006127bb8489613bb4565b905060006127c98487613bb4565b905087156127e0576127db8783611fa6565b612842565b61280173ffffffffffffffffffffffffffffffffffffffff8b16888461256b565b61284273ffffffffffffffffffffffffffffffffffffffff8b167f00000000000000000000000000000000000000000000000000000000000000008761256b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631f6150238961288a57600061288c565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff808c1660048301528e16602482015260448101859052606481018790526084016000604051808303818588803b15801561290657600080fd5b505af115801561291a573d6000803e3d6000fd5b505050505050505050505050612be6565b8415612aca578554610100900473ffffffffffffffffffffffffffffffffffffffff16600061295a85886131d6565b90506129668188613bb4565b965060006129748886613bb4565b9050831561298b576129868389611fa6565b6129ed565b6129ac73ffffffffffffffffffffffffffffffffffffffff8716848a61256b565b6129ed73ffffffffffffffffffffffffffffffffffffffff87167f00000000000000000000000000000000000000000000000000000000000000008361256b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f85612a35576000612a37565b825b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8a16600482015260248101859052604481018690526064016000604051808303818588803b158015612aa957600080fd5b505af1158015612abd573d6000803e3d6000fd5b5050505050505050612be6565b80612b1057612b1073ffffffffffffffffffffffffffffffffffffffff84167f00000000000000000000000000000000000000000000000000000000000000008461256b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f82612b58576000612b5a565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8716600482015260248101869052600060448201526064016000604051808303818588803b158015612bcc57600080fd5b505af1158015612be0573d6000803e3d6000fd5b50505050505b5050505060059190910181905590565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015612c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c87919061387e565b5050509150506000811215612c9a575060005b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015612d0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3091906138e1565b505050505050505090506000670de0b6b3a7640000838363ffffffff1664e8d4a51000612d5d91906139c6565b612d6791906139c6565b612d719190613a0c565b90506000816002600301545a612d879088613bb4565b612d919190613a3d565b612d9b903a6139c6565b612da59190613a3d565b90508560060154811115612dbe57506006850154612e70565b6000818760060154612dd09190613bb4565b8754610100900473ffffffffffffffffffffffffffffffffffffffff16600090815260096020526040812080549293508392909190612e10908490613a3d565b909155505060068701829055865460405182815261010090910473ffffffffffffffffffffffffffffffffffffffff16907fab2ddf26d0afffee84a37c11fdb1fe69dc5c541f00f62051ec706e71871638c89060200160405180910390a2505b60018087015473ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604081209091018054839290612ead908490613a3d565b9091555050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052612f189085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016125bd565b50505050565b60005474010000000000000000000000000000000000000000900460ff16610ae3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610758565b606073ffffffffffffffffffffffffffffffffffffffff84163b613048576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610758565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516130709190613c66565b600060405180830381855af49150503d80600081146130ab576040519150601f19603f3d011682016040523d82523d6000602084013e6130b0565b606091505b50915091506130c082828661320f565b9695505050505050565b600061312c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166132629092919063ffffffff16565b805190915015612100578080602001905181019061314a9190613b92565b612100576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610758565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600860205260408120546127109061173790849061ffff166139c6565b6060831561321e575081611741565b82511561322e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107589190613c82565b6060610eed84846000858573ffffffffffffffffffffffffffffffffffffffff85163b6132eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610758565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133149190613c66565b60006040518083038185875af1925050503d8060008114613351576040519150601f19603f3d011682016040523d82523d6000602084013e613356565b606091505b509150915061336682828661320f565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156133b357600080fd5b8235915060208084013567ffffffffffffffff808211156133d357600080fd5b818601915086601f8301126133e757600080fd5b8135818111156133f9576133f9613371565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110858211171561343c5761343c613371565b60405291825284820192508381018501918983111561345a57600080fd5b938501935b828510156134785784358452938501939285019261345f565b8096505050505050509250929050565b60006020828403121561349a57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461153757600080fd5b6000602082840312156134d557600080fd5b8135611741816134a1565b6000806000606084860312156134f557600080fd5b833560ff8116811461350657600080fd5b92506020840135613516816134a1565b929592945050506040919091013590565b803561ffff8116811461353957600080fd5b919050565b6000806040838503121561355157600080fd5b823561355c816134a1565b915061356a60208401613527565b90509250929050565b60008060006060848603121561358857600080fd5b61359184613527565b95602085013595506040909401359392505050565b600080602083850312156135b957600080fd5b823567ffffffffffffffff808211156135d157600080fd5b818501915085601f8301126135e557600080fd5b8135818111156135f457600080fd5b8660208260051b850101111561360957600080fd5b60209290920196919550909350505050565b60005b8381101561363657818101518382015260200161361e565b50506000910152565b6000815180845261365781602086016020860161361b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156136fc577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526136ea85835161363f565b945092850192908501906001016136b0565b5092979650505050505050565b6000806040838503121561371c57600080fd5b8235613727816134a1565b946020939093013593505050565b602080825282518282018190526000919060409081850190868401855b828110156137ef57815180518051151586528781015173ffffffffffffffffffffffffffffffffffffffff90811689880152878201511687870152606080820151908701526080808201519087015260a0808201519087015260c0808201519087015260e09081015190860152860151805160ff908116610100870152602090910151166101208501526101409093019290850190600101613752565b5091979650505050505050565b63ffffffff8116811461153757600080fd5b6000806040838503121561382157600080fd5b823561382c816134a1565b9150602083013561383c816137fc565b809150509250929050565b60006020828403121561385957600080fd5b8151611741816134a1565b805169ffffffffffffffffffff8116811461353957600080fd5b600080600080600060a0868803121561389657600080fd5b61389f86613864565b94506020860151935060408601519250606086015191506138c260808701613864565b90509295509295909350565b805162ffffff8116811461353957600080fd5b60008060008060008060008060006101208a8c03121561390057600080fd5b895161390b816137fc565b60208b015190995061391c816137fc565b60408b015190985061392d816137fc565b60608b015190975061393e816137fc565b60808b015190965061394f816137fc565b945061395d60a08b016138ce565b935061396b60c08b016138ce565b925061397960e08b016138ce565b91506139886101008b016138ce565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417610fe557610fe5613997565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613a1b57613a1b6139dd565b500490565b63ffffffff818116838216019080821115610fe357610fe3613997565b80820180821115610fe557610fe5613997565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613ab457600080fd5b83018035915067ffffffffffffffff821115613acf57600080fd5b602001915036819003821315613ae457600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613b1c57613b1c613997565b5060010190565b600067ffffffffffffffff821680613b3d57613b3d613997565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b600082613b7457613b746139dd565b500690565b60ff8281168282160390811115610fe557610fe5613997565b600060208284031215613ba457600080fd5b8151801515811461174157600080fd5b81810381811115610fe557610fe5613997565b600060208284031215613bd957600080fd5b5051919050565b600060208284031215613bf257600080fd5b815167ffffffffffffffff8116811461174157600080fd5b600067ffffffffffffffff808316818103613c2757613c27613997565b6001019392505050565b600081613c4057613c40613997565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60008251613c7881846020870161361b565b9190910192915050565b602081526000611741602083018461363f56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203699f7ec913279657d7f583b3df784ac63ad1027b6a217d8ea10ee82a9a2ca1464736f6c63430008110033000000000000000000000000999b6d28a9e78c4be13d51469c49585d6d25be5e000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802

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

000000000000000000000000999b6d28a9e78c4be13d51469c49585d6d25be5e000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802

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

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


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