ETH Price: $2,532.35 (-0.09%)

Contract

0x047a68fc8AAa9109346c726C696986f4B5792658
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw Funds73841862019-03-17 3:57:351992 days ago1552795055IN
0x047a68fc...4B5792658
0 ETH0.00006832
Settle Game65117512018-10-14 5:37:252146 days ago1539495445IN
0x047a68fc...4B5792658
0 ETH0.000241536
Place Game65117472018-10-14 5:36:342146 days ago1539495394IN
0x047a68fc...4B5792658
0.05 ETH0.00086354.2
Transfer64535702018-10-04 19:21:172156 days ago1538680877IN
0x047a68fc...4B5792658
0.99993727 ETH0.000063123
Withdraw Funds64535212018-10-04 19:09:182156 days ago1538680158IN
0x047a68fc...4B5792658
0 ETH0.000034391.011
Transfer64473652018-10-03 19:15:172157 days ago1538594117IN
0x047a68fc...4B5792658
0.99991227 ETH0.000084164
Withdraw Funds64473572018-10-03 19:13:282157 days ago1538594008IN
0x047a68fc...4B5792658
0 ETH0.000065921.9375
Settle Game64036182018-09-26 15:01:592164 days ago1537974119IN
0x047a68fc...4B5792658
0 ETH0.0011054924.13903411
Settle Game64036152018-09-26 15:01:092164 days ago1537974069IN
0x047a68fc...4B5792658
0 ETH0.0014765124.09375
Place Game64036142018-09-26 15:00:532164 days ago1537974053IN
0x047a68fc...4B5792658
0.01 ETH0.0020260716.0625
Place Game64036122018-09-26 15:00:332164 days ago1537974033IN
0x047a68fc...4B5792658
0.01 ETH0.0004265814
Settle Game64036122018-09-26 15:00:332164 days ago1537974033IN
0x047a68fc...4B5792658
0 ETH0.0014765124.09375
Place Game64036102018-09-26 14:59:442164 days ago1537973984IN
0x047a68fc...4B5792658
0.01 ETH0.0020260716.0625
Place Game64036082018-09-26 14:58:162164 days ago1537973896IN
0x047a68fc...4B5792658
0.01 ETH0.0022670116.0625
Refund Bet64002932018-09-26 1:53:182164 days ago1537926798IN
0x047a68fc...4B5792658
0 ETH0.0008606923.4
Settle Game63978312018-09-25 16:18:442165 days ago1537892324IN
0x047a68fc...4B5792658
0 ETH0.0008450118
Place Game63978272018-09-25 16:17:022165 days ago1537892222IN
0x047a68fc...4B5792658
0.02 ETH0.0017076412
Settle Game63976582018-09-25 15:37:472165 days ago1537889867IN
0x047a68fc...4B5792658
0 ETH0.0006880317.1
Place Game63976532018-09-25 15:36:292165 days ago1537889789IN
0x047a68fc...4B5792658
0.05 ETH0.001906210
Settle Game63969902018-09-25 12:58:212165 days ago1537880301IN
0x047a68fc...4B5792658
0 ETH0.0005025112.77462707
Place Game63969842018-09-25 12:57:022165 days ago1537880222IN
0x047a68fc...4B5792658
0.05 ETH0.001349358.51641804
Settle Game63969752018-09-25 12:54:512165 days ago1537880091IN
0x047a68fc...4B5792658
0 ETH0.0005133612.77462707
Place Game63969702018-09-25 12:53:462165 days ago1537880026IN
0x047a68fc...4B5792658
0.09 ETH0.0041979322
Settle Game63969592018-09-25 12:51:162165 days ago1537879876IN
0x047a68fc...4B5792658
0 ETH0.0004822312
Place Game63969552018-09-25 12:50:352165 days ago1537879835IN
0x047a68fc...4B5792658
0.09 ETH0.001624518.51641804
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
73841862019-03-17 3:57:351992 days ago1552795055
0x047a68fc...4B5792658
10.82249695 ETH
65117512018-10-14 5:37:252146 days ago1539495445
0x047a68fc...4B5792658
1 wei
64535212018-10-04 19:09:182156 days ago1538680158
0x047a68fc...4B5792658
1 ETH
64473572018-10-03 19:13:282157 days ago1538594008
0x047a68fc...4B5792658
1 ETH
64036182018-09-26 15:01:592164 days ago1537974119
0x047a68fc...4B5792658
1 wei
64036152018-09-26 15:01:092164 days ago1537974069
0x047a68fc...4B5792658
0.02 ETH
64036122018-09-26 15:00:332164 days ago1537974033
0x047a68fc...4B5792658
0.02 ETH
64002932018-09-26 1:53:182164 days ago1537926798
0x047a68fc...4B5792658
0.5 ETH
63978312018-09-25 16:18:442165 days ago1537892324
0x047a68fc...4B5792658
1 wei
63976582018-09-25 15:37:472165 days ago1537889867
0x047a68fc...4B5792658
1 wei
63969902018-09-25 12:58:212165 days ago1537880301
0x047a68fc...4B5792658
0.06 ETH
63969752018-09-25 12:54:512165 days ago1537880091
0x047a68fc...4B5792658
1 wei
63969592018-09-25 12:51:162165 days ago1537879876
0x047a68fc...4B5792658
1 wei
63969312018-09-25 12:45:392165 days ago1537879539
0x047a68fc...4B5792658
0.22 ETH
63969132018-09-25 12:41:152165 days ago1537879275
0x047a68fc...4B5792658
1 wei
63968642018-09-25 12:28:132165 days ago1537878493
0x047a68fc...4B5792658
0.2 ETH
63968442018-09-25 12:22:282165 days ago1537878148
0x047a68fc...4B5792658
0.2 ETH
63968142018-09-25 12:15:372165 days ago1537877737
0x047a68fc...4B5792658
0.14 ETH
63967892018-09-25 12:09:182165 days ago1537877358
0x047a68fc...4B5792658
1 wei
63967762018-09-25 12:06:482165 days ago1537877208
0x047a68fc...4B5792658
0.42 ETH
63967552018-09-25 11:59:592165 days ago1537876799
0x047a68fc...4B5792658
0.1 ETH
63967412018-09-25 11:56:482165 days ago1537876608
0x047a68fc...4B5792658
0.1 ETH
63967282018-09-25 11:53:262165 days ago1537876406
0x047a68fc...4B5792658
0.3 ETH
63966852018-09-25 11:43:192165 days ago1537875799
0x047a68fc...4B5792658
0.3 ETH
63966482018-09-25 11:36:432165 days ago1537875403
0x047a68fc...4B5792658
0.4 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BitrngDice

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-08-23
*/

pragma solidity ^0.4.17;

contract BitrngDice {
  // Ownership.
  address public owner;
  address private nextOwner;

  // The address corresponding to a private key used to sign placeBet commits.
  address public secretSigner;

  // Minimum and maximum bets.
  uint constant MIN_AMOUNT = 0.01 ether;
  uint constant MAX_AMOUNT_BIG_SMALL = 1 ether;
  uint constant MAX_AMOUNT_SAME = 0.05 ether;
  uint constant MAX_AMOUNT_NUMBER = 0.1 ether;

  // EVM `BLOCKHASH` opcode can query no further than 256 blocks into the
  // past. Given that settleBet uses block hash of placeBet as one of
  // complementary entropy sources, we cannot process bets older than this
  // threshold. On rare occasions dice2.win croupier may fail to invoke
  // settleBet in this timespan due to technical issues or extreme Ethereum
  // congestion; such bets can be refunded via invoking refundBet.
  uint constant BET_EXPIRATION_BLOCKS = 250;

  // Max bets in one game.
  uint8 constant MAX_BET = 5;

  // Max bet types.
  uint8 constant BET_MASK_COUNT = 22;

  // Bet flags.
  uint24 constant BET_BIG = uint24(1 << 21);
  uint24 constant BET_SMALL = uint24(1 << 20);
  uint24 constant BET_SAME_1 = uint24(1 << 19);
  uint24 constant BET_SAME_2 = uint24(1 << 18);
  uint24 constant BET_SAME_3 = uint24(1 << 17);
  uint24 constant BET_SAME_4 = uint24(1 << 16);
  uint24 constant BET_SAME_5 = uint24(1 << 15);
  uint24 constant BET_SAME_6 = uint24(1 << 14);
  uint24 constant BET_4 = uint24(1 << 13);
  uint24 constant BET_5 = uint24(1 << 12);
  uint24 constant BET_6 = uint24(1 << 11);
  uint24 constant BET_7 = uint24(1 << 10);
  uint24 constant BET_8 = uint24(1 << 9);
  uint24 constant BET_9 = uint24(1 << 8);
  uint24 constant BET_10 = uint24(1 << 7);
  uint24 constant BET_11 = uint24(1 << 6);
  uint24 constant BET_12 = uint24(1 << 5);
  uint24 constant BET_13 = uint24(1 << 4);
  uint24 constant BET_14 = uint24(1 << 3);
  uint24 constant BET_15 = uint24(1 << 2);
  uint24 constant BET_16 = uint24(1 << 1);
  uint24 constant BET_17 = uint24(1);

  // Funds that are locked in potentially winning bets. Prevents contract from
  // committing to bets it cannot pay out.
  uint public lockedInBets;

  // Set false to disable betting.
  bool public enabled = true;

  // Some deliberately invalid address to initialize the secret signer with.
  // Forces maintainers to invoke setSecretSigner before processing any bets.
  address constant DUMMY_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

  // The game struct, only supports 5 bet.
  struct Game{
    address gambler;
    uint40 placeBlockNumber; // block number contains place bet txn
    uint bet1Amount;
    uint bet2Amount;
    uint bet3Amount;
    uint bet4Amount;
    uint bet5Amount;
    uint24 mask; // bet flags ored together
  }

  // Mapping from commits to all currently active & processed bets.
  mapping (uint => Game) games;

  // Mapping for bet type to odds
  mapping (uint24 => uint8) odds;

  // Mapping for bet number results;
  mapping (uint24 => uint8) betNumberResults;

  // Mapdding for bet same number results
  mapping (uint24 => uint8) betSameResults;

  // Events that are issued to make statistic recovery easier.
  event FailedPayment(address indexed beneficiary, uint amount);
  event Payment(address indexed beneficiary, uint amount);

  constructor () public {
    owner = msg.sender;
    secretSigner = DUMMY_ADDRESS;

    // init odds
    odds[BET_SMALL] = 2;
    odds[BET_BIG] = 2;

    odds[BET_SAME_1] = 150;
    odds[BET_SAME_2] = 150;
    odds[BET_SAME_3] = 150;
    odds[BET_SAME_4] = 150;
    odds[BET_SAME_5] = 150;
    odds[BET_SAME_6] = 150;

    odds[BET_9] = 6;
    odds[BET_10] = 6;
    odds[BET_11] = 6;
    odds[BET_12] = 6;

    odds[BET_8] = 8;
    odds[BET_13] = 8;

    odds[BET_7] = 12;
    odds[BET_14] = 12;

    odds[BET_6] = 14;
    odds[BET_15] = 14;

    odds[BET_5] = 18;
    odds[BET_16] = 18;

    odds[BET_4] = 50;
    odds[BET_17] = 50;

    // init results
    betNumberResults[BET_9] = 9;
    betNumberResults[BET_10] = 10;
    betNumberResults[BET_11] = 11;
    betNumberResults[BET_12] = 12;

    betNumberResults[BET_8] = 8;
    betNumberResults[BET_13] = 13;

    betNumberResults[BET_7] = 7;
    betNumberResults[BET_14] = 14;

    betNumberResults[BET_6] = 6;
    betNumberResults[BET_15] = 15;

    betNumberResults[BET_5] = 5;
    betNumberResults[BET_16] = 16;

    betNumberResults[BET_4] = 4;
    betNumberResults[BET_17] = 17;

    betSameResults[BET_SAME_1] = 1;
    betSameResults[BET_SAME_2] = 2;
    betSameResults[BET_SAME_3] = 3;
    betSameResults[BET_SAME_4] = 4;
    betSameResults[BET_SAME_5] = 5;
    betSameResults[BET_SAME_6] = 6;

  }

  // Place game
  //
  // Betmask - flags for each bet, total 22 bits.
  // betAmount - 5 bet amounts in Wei
  // commitLastBlock -  block number when `commit` expires
  // commit -  sha3 of `reveal`
  // r, s - components of ECDSA signature of (commitLastBlock, commit).
  //        Used to check commit is generated by `secretSigner`
  //
  // Game states:
  //  amount == 0 && gambler == 0 - 'clean' (can place a bet)
  //  amount != 0 && gambler != 0 - 'active' (can be settled or refunded)
  //  amount == 0 && gambler != 0 - 'processed' (can clean storage)
  function placeGame(
    uint24 betMask,
    uint bet1Amount,
    uint bet2Amount,
    uint bet3Amount,
    uint bet4Amount,
    uint bet5Amount,
    uint commitLastBlock,
    uint commit,
    bytes32 r,
    bytes32 s
  ) external payable
  {
    // Is game enabled ?
    require (enabled, "Game is closed");
    // Check payed amount and sum of place amount are equal.
    require (bet1Amount + bet2Amount + bet3Amount + bet4Amount + bet5Amount == msg.value,
      "Place amount and payment should be equal.");

    // Check that the game is in 'clean' state.
    Game storage game = games[commit];
    require (game.gambler == address(0),
      "Game should be in a 'clean' state.");

    // Check that commit is valid. It has not expired and its signature is valid.
    // r = signature[0:64]
    // s = signature[64:128]
    // v = signature[128:130], always 27
    require (block.number <= commitLastBlock, "Commit has expired.");
    bytes32 signatureHash = keccak256(abi.encodePacked(uint40(commitLastBlock), commit));
    require (secretSigner == ecrecover(signatureHash, 27, r, s), "ECDSA signature is not valid.");

    // Try to lock amount.
    _lockOrUnlockAmount(
      betMask,
      bet1Amount,
      bet2Amount,
      bet3Amount,
      bet4Amount,
      bet5Amount,
      1
    );

    // Store game parameters on blockchain.
    game.placeBlockNumber = uint40(block.number);
    game.mask = uint24(betMask);
    game.gambler = msg.sender;
    game.bet1Amount = bet1Amount;
    game.bet2Amount = bet2Amount;
    game.bet3Amount = bet3Amount;
    game.bet4Amount = bet4Amount;
    game.bet5Amount = bet5Amount;
  }

  function settleGame(uint reveal, uint cleanCommit) external {
    // `commit` for bet settlement can only be obtained by hashing a `reveal`.
    uint commit = uint(keccak256(abi.encodePacked(reveal)));
    // Fetch bet parameters into local variables (to save gas).
    Game storage game = games[commit];
    uint bet1Amount = game.bet1Amount;
    uint bet2Amount = game.bet2Amount;
    uint bet3Amount = game.bet3Amount;
    uint bet4Amount = game.bet4Amount;
    uint bet5Amount = game.bet5Amount;
    uint placeBlockNumber = game.placeBlockNumber;
    address gambler = game.gambler;
    uint24 betMask = game.mask;

    // Check that bet is in 'active' state.
    require (
      bet1Amount != 0 ||
      bet2Amount != 0 ||
      bet3Amount != 0 ||
      bet4Amount != 0 ||
      bet5Amount != 0,
      "Bet should be in an 'active' state");

    // Check that bet has not expired yet (see comment to BET_EXPIRATION_BLOCKS).
    require (block.number > placeBlockNumber, "settleBet in the same block as placeBet, or before.");
    require (block.number <= placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM.");

    // Move bet into 'processed' state already.
    game.bet1Amount = 0;
    game.bet2Amount = 0;
    game.bet3Amount = 0;
    game.bet4Amount = 0;
    game.bet5Amount = 0;

    // The RNG - combine "reveal" and blockhash of placeBet using Keccak256. Miners
    // are not aware of "reveal" and cannot deduce it from "commit" (as Keccak256
    // preimage is intractable), and house is unable to alter the "reveal" after
    // placeBet have been mined (as Keccak256 collision finding is also intractable).
    uint entropy = uint(
      keccak256(abi.encodePacked(reveal, blockhash(placeBlockNumber)))
    );

    uint winAmount = _getWinAmount(
      uint8((entropy % 6) + 1),
      uint8(((entropy >> 10) % 6) + 1),
      uint8(((entropy >> 20) % 6) + 1),
      betMask,
      bet1Amount,
      bet2Amount,
      bet3Amount,
      bet4Amount,
      bet5Amount
    );

    // Unlock the bet amount, regardless of the outcome.
    _lockOrUnlockAmount(
      betMask,
      bet1Amount,
      bet2Amount,
      bet3Amount,
      bet4Amount,
      bet5Amount,
      0
    );

    // Send the funds to gambler.
    if(winAmount > 0){
      sendFunds(gambler, winAmount);
    }else{
      sendFunds(gambler, 1 wei);
    }

    // Clear storage of some previous bet.
    if (cleanCommit == 0) {
        return;
    }
    clearProcessedBet(cleanCommit);
  }

  // Refund transaction - return the bet amount of a roll that was not processed in a
  // due timeframe. Processing such blocks is not possible due to EVM limitations (see
  // BET_EXPIRATION_BLOCKS comment above for details). In case you ever find yourself
  // in a situation like this, just contact the dice2.win support, however nothing
  // precludes you from invoking this method yourself.
  function refundBet(uint commit) external {
    // Check that bet is in 'active' state.
    Game storage game = games[commit];
    uint bet1Amount = game.bet1Amount;
    uint bet2Amount = game.bet2Amount;
    uint bet3Amount = game.bet3Amount;
    uint bet4Amount = game.bet4Amount;
    uint bet5Amount = game.bet5Amount;

    // Check that bet is in 'active' state.
    require (
      bet1Amount != 0 ||
      bet2Amount != 0 ||
      bet3Amount != 0 ||
      bet4Amount != 0 ||
      bet5Amount != 0,
      "Bet should be in an 'active' state");

    // Check that bet has already expired.
    require (block.number > game.placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM.");

    // Move bet into 'processed' state already.
    game.bet1Amount = 0;
    game.bet2Amount = 0;
    game.bet3Amount = 0;
    game.bet4Amount = 0;
    game.bet5Amount = 0;

    // Unlock the bet amount.
    _lockOrUnlockAmount(
      game.mask,
      bet1Amount,
      bet2Amount,
      bet3Amount,
      bet4Amount,
      bet5Amount,
      0
    );

    // Send the refund.
    sendFunds(game.gambler, bet1Amount + bet2Amount + bet3Amount + bet4Amount + bet5Amount);
  }

  // Helper routine to move 'processed' bets into 'clean' state.
  function clearProcessedBet(uint commit) private {
      Game storage game = games[commit];

      // Do not overwrite active bets with zeros; additionally prevent cleanup of bets
      // for which commit signatures may have not expired yet (see whitepaper for details).
      if (
        game.bet1Amount != 0 ||
        game.bet2Amount != 0 ||
        game.bet3Amount != 0 ||
        game.bet4Amount != 0 ||
        game.bet5Amount != 0 ||
        block.number <= game.placeBlockNumber + BET_EXPIRATION_BLOCKS
      ) {
          return;
      }

      // Zero out the remaining storage (amount was zeroed before, delete would consume 5k
      // more gas).
      game.placeBlockNumber = 0;
      game.mask = 0;
      game.gambler = address(0);
  }

  // A helper routine to bulk clean the storage.
  function clearStorage(uint[] cleanCommits) external {
      uint length = cleanCommits.length;

      for (uint i = 0; i < length; i++) {
          clearProcessedBet(cleanCommits[i]);
      }
  }

  // Send funds.
  function sendFunds(address beneficiary, uint amount) private {
    if (beneficiary.send(amount)) {
      emit Payment(beneficiary, amount);
    } else {
      emit FailedPayment(beneficiary, amount);
    }
  }

  // Get actual win amount.
  // dice1, dice2, dice3 - dice from 1 to 6
  function _getWinAmount(
    uint8 dice1,
    uint8 dice2,
    uint8 dice3,
    uint24 betMask,
    uint bet1Amount,
    uint bet2Amount,
    uint bet3Amount,
    uint bet4Amount,
    uint bet5Amount
  )
  private view returns (uint winAmount)
  {
    uint8 betCount = 0;
    uint24 flag = 0;
    uint8 sum = dice1 + dice2 + dice3;
    uint8 i = 0;

    for (i = 0; i < BET_MASK_COUNT; i++) {
      flag = uint24(1) << i;
      if(uint24(betMask & flag) == 0){
        continue;
      }else{
        betCount += 1;
      }
      if(i < 14){
        if(sum == betNumberResults[flag]){
          winAmount += odds[flag] * _nextAmount(
            betCount,
            bet1Amount,
            bet2Amount,
            bet3Amount,
            bet4Amount,
            bet5Amount
          );
        }
        continue;
      }
      if(i >= 14 && i < 20){
        if(dice1 == betSameResults[flag] && dice1 == dice2 && dice1 == dice3){
          winAmount += odds[flag] * _nextAmount(
            betCount,
            bet1Amount,
            bet2Amount,
            bet3Amount,
            bet4Amount,
            bet5Amount
          );
        }
        continue;
      }
      if(
        i == 20 &&
        (sum >= 4 && sum <= 10)  &&
        (dice1 != dice2 || dice1 != dice3 || dice2 != dice3)
      ){
        winAmount += odds[flag] * _nextAmount(
          betCount,
          bet1Amount,
          bet2Amount,
          bet3Amount,
          bet4Amount,
          bet5Amount
        );
      }
      if(
        i == 21 &&
        (sum >= 11 && sum <= 17)  &&
        (dice1 != dice2 || dice1 != dice3 || dice2 != dice3)
      ){
        winAmount += odds[flag] * _nextAmount(
          betCount,
          bet1Amount,
          bet2Amount,
          bet3Amount,
          bet4Amount,
          bet5Amount
        );
      }
      if(betCount == MAX_BET){
        break;
      }
    }
  }

  // Choose next amount by bet count
  function _nextAmount(
    uint8 betCount,
    uint bet1Amount,
    uint bet2Amount,
    uint bet3Amount,
    uint bet4Amount,
    uint bet5Amount
  )
  private pure returns (uint amount)
  {
    if(betCount == 1){
      return bet1Amount;
    }
    if(betCount == 2){
      return bet2Amount;
    }
    if(betCount == 3){
      return bet3Amount;
    }
    if(betCount == 4){
      return bet4Amount;
    }
    if(betCount == 5){
      return bet5Amount;
    }
  }


  // lock = 1, lock
  // lock = 0, unlock
  function _lockOrUnlockAmount(
    uint24 betMask,
    uint bet1Amount,
    uint bet2Amount,
    uint bet3Amount,
    uint bet4Amount,
    uint bet5Amount,
    uint8 lock
  )
  private
  {
    uint8 betCount;
    uint possibleWinAmount;
    uint betBigSmallWinAmount = 0;
    uint betNumberWinAmount = 0;
    uint betSameWinAmount = 0;
    uint24 flag = 0;
    for (uint8 i = 0; i < BET_MASK_COUNT; i++) {
      flag = uint24(1) << i;
      if(uint24(betMask & flag) == 0){
        continue;
      }else{
        betCount += 1;
      }
      if(i < 14 ){
        betNumberWinAmount = _assertAmount(
          betCount,
          bet1Amount,
          bet2Amount,
          bet3Amount,
          bet4Amount,
          bet5Amount,
          MAX_AMOUNT_NUMBER,
          odds[flag],
          betNumberWinAmount
        );
        continue;
      }
      if(i >= 14 && i < 20){
        betSameWinAmount = _assertAmount(
          betCount,
          bet1Amount,
          bet2Amount,
          bet3Amount,
          bet4Amount,
          bet5Amount,
          MAX_AMOUNT_SAME,
          odds[flag],
          betSameWinAmount
        );
        continue;
      }
      if(i >= 20){
         betBigSmallWinAmount = _assertAmount(
          betCount,
          bet1Amount,
          bet2Amount,
          bet3Amount,
          bet4Amount,
          bet5Amount,
          MAX_AMOUNT_BIG_SMALL,
          odds[flag],
          betBigSmallWinAmount
        );
        continue;
      }
      if(betCount == MAX_BET){
        break;
      }
    }
    if(betSameWinAmount >= betBigSmallWinAmount){
      possibleWinAmount += betSameWinAmount;
    }else{
      possibleWinAmount += betBigSmallWinAmount;
    }
    possibleWinAmount += betNumberWinAmount;

    // Check that game has valid number of bets
    require (betCount > 0 && betCount <= MAX_BET,
      "Place bet count should be within range.");

    if(lock == 1){
      // Lock funds.
      lockedInBets += possibleWinAmount;
      // Check whether contract has enough funds to process this bet.
      require (lockedInBets <= address(this).balance,
        "Cannot afford to lose this bet.");
    }else{
      // Unlock funds.
      lockedInBets -= possibleWinAmount;
      require (lockedInBets >= 0,
        "Not enough locked in amount.");
    }
  }

  function _max(uint amount, uint8 odd, uint possibleWinAmount)
  private pure returns (uint newAmount)
  {
    uint winAmount = amount * odd;
    if( winAmount > possibleWinAmount){
      return winAmount;
    }else{
      return possibleWinAmount;
    }
  }

  function _assertAmount(
    uint8 betCount,
    uint amount1,
    uint amount2,
    uint amount3,
    uint amount4,
    uint amount5,
    uint maxAmount,
    uint8 odd,
    uint possibleWinAmount
  )
  private pure returns (uint amount)
  {
    string memory warnMsg = "Place bet amount should be within range.";
    if(betCount == 1){
      require (amount1 >= MIN_AMOUNT && amount1 <= maxAmount, warnMsg);
      return _max(amount1, odd, possibleWinAmount);
    }
    if(betCount == 2){
      require (amount2 >= MIN_AMOUNT && amount2 <= maxAmount, warnMsg);
      return _max(amount2, odd, possibleWinAmount);
    }
    if(betCount == 3){
      require (amount3 >= MIN_AMOUNT && amount3 <= maxAmount, warnMsg);
      return _max(amount3, odd, possibleWinAmount);
    }
    if(betCount == 4){
      require (amount4 >= MIN_AMOUNT && amount4 <= maxAmount, warnMsg);
      return _max(amount4, odd, possibleWinAmount);
    }
    if(betCount == 5){
      require (amount5 >= MIN_AMOUNT && amount5 <= maxAmount, warnMsg);
      return _max(amount5, odd, possibleWinAmount);
    }
  }

  // Standard modifier on methods invokable only by contract owner.
  modifier onlyOwner {
      require (msg.sender == owner, "OnlyOwner methods called by non-owner.");
      _;
  }

  // Standard contract ownership transfer implementation,
  function approveNextOwner(address _nextOwner) external onlyOwner {
    require (_nextOwner != owner, "Cannot approve current owner.");
    nextOwner = _nextOwner;
  }

  function acceptNextOwner() external {
    require (msg.sender == nextOwner, "Can only accept preapproved new owner.");
    owner = nextOwner;
  }

  // Fallback function deliberately left empty. It's primary use case
  // is to top up the bank roll.
  function () public payable {
  }

  // See comment for "secretSigner" variable.
  function setSecretSigner(address newSecretSigner) external onlyOwner {
    secretSigner = newSecretSigner;
  }

  // Funds withdrawal to cover team costs.
  function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
    require (withdrawAmount <= address(this).balance, "Increase amount larger than balance.");
    require (lockedInBets + withdrawAmount <= address(this).balance, "Not enough funds.");
    sendFunds(beneficiary, withdrawAmount);
  }

  // Contract may be destroyed only when there are no ongoing bets,
  // either settled or refunded. All funds are transferred to contract owner.
  function kill() external onlyOwner {
      require (lockedInBets == 0, "All bets should be processed (settled or refunded) before self-destruct.");
      selfdestruct(owner);
  }

  // Close or open the game.
  function enable(bool _enabled) external onlyOwner{
    enabled = _enabled;
  }

}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"enabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"secretSigner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_enabled","type":"bool"}],"name":"enable","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"reveal","type":"uint256"},{"name":"cleanCommit","type":"uint256"}],"name":"settleGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"beneficiary","type":"address"},{"name":"withdrawAmount","type":"uint256"}],"name":"withdrawFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"acceptNextOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"betMask","type":"uint24"},{"name":"bet1Amount","type":"uint256"},{"name":"bet2Amount","type":"uint256"},{"name":"bet3Amount","type":"uint256"},{"name":"bet4Amount","type":"uint256"},{"name":"bet5Amount","type":"uint256"},{"name":"commitLastBlock","type":"uint256"},{"name":"commit","type":"uint256"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"placeGame","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_nextOwner","type":"address"}],"name":"approveNextOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newSecretSigner","type":"address"}],"name":"setSecretSigner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lockedInBets","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"commit","type":"uint256"}],"name":"refundBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cleanCommits","type":"uint256[]"}],"name":"clearStorage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"FailedPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Payment","type":"event"}]

60806040526004805460ff1916600117905534801561001d57600080fd5b5060008054600160a060020a0319908116331782556002805490911673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1781557fa2e41e7c343eea6fdd467a0323afb97d2b74d272d77e13a23624cedde8f323b8805460ff1990811683179091557fc9827e4a01026efbd77c30c72a535558dda50e2eb0761e571bfa00922a82362180548216831790557f0ebd9e4be1b2b86ed03080b0486991ecf4e2a58445f38115e53f8fdc59eb5fc08054821660969081179091557fba7a7881e9e2b8ccb216a80780e71bf199c7e4b80361e6900946013c1013bd7e80548316821790557f9e94a6569f2d40825bef1fbd7363e9f97d51450b0dc59d59e2c995383dddfef480548316821790557fd1d52c00325414bad3b96ea2d4c91854ec6ef2eee48ae703944c19467fa94f0f80548316821790557f938033bc8baf45528ee6a799ab8fe098f1b75a5dd0d730fc9432141e5793335580548316821790557fa5a912620f5ae2878d2d53b4ba25f32de60b360036f35cb3cc9261e6ccbf38918054831690911790557f7b83707e63368c193ac735870b6718348c54aa391c2a0c9c5d0aa0cdec074eff8054821660069081179091557fe88c6d20e10af62aabb42c56ecad3aa0e9a8ce42bb84e4e634e80a0ca98bd48c80548316821790557f4240f17fb051dafa455c6aa776bee6356d3085a349731ff3af9967143e7399d880548316821790557f8962290a7218a9ad62224806fc2c8bf61f46f0c0289c25ddd8bb0f483a96003280548316821790557fb29f850db3636ac0c738910696357ccf04bdcf9eecb591427ec2a19c4d0307388054831660089081179091557f6fac4587033fa036e2426ad0134940d3a683633cc2b2b7862f39195344f163d180548416821790557f9d131fda71c6caac784400d61891024902ff93d46c7fbec9e2fdacefb3dcb0f480548416600c9081179091557fb8d683c9d414f481826f3e7fe14b3ac6ae8c73450778287390c4bb8cb9f2e80b80548516821790557f1d796281d056e9ce44c2d8d6d9c9f228097b1b4fdcdc44478efca7f7a5d9fb3480548516600e9081179091557fc5069e24aaadb2addc3e52e868fcf3f4f8acf5a87e24300992fd4540c2a87eed80548616821790557fc02926598b8ed20edcb67ada393e92ac3eb31e0f05ee8aee1b9c764771769c458054861660129081179091557f8819ef417987f8ae7a81f42cdfb18815282fe989326fbff903d13cf0e03ace298054871690911790557fc7f562323bfdfda87ed9001641051511dc5c56678af0d9e79bbe5b961e543a4a8054861660329081179091557f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a318054871690911790557f2e1febecf191011d2a05db76b12e7026d26fe76b3d45e2783fe41c798f726a488054861660091790557f5d7fa289fe0cce3684f388c19bfa7a0aaa2c98a5c74839d3148ac362bccbc70b80548616600a1790557fd31ae269d794bfdd05724c515dd1572473bc3e008185aeed575a790faac90bb380548616600b1790557f977c7c98651e0e2a752fb735f769df5240153cd477a3baa861921344a2ddde90805486169092179091557f2a9415d08c0c16e17c81d1ddd07c87b75cf5938c1315af07b6f3e822070a851280548516831790557ffdb0fc5c292af6bc7c9afb28ca8e0549b4de965653a829548475c76a1d5c400c80548516600d1790557f1dfa52e24e182d887f3b686250ff0fa32553b2cc8f55f6d21772f3a055bdda688054851660071790557f4b1bf46c9f1bd48ff8274d40bad76a6615cb6c59a637d451a3994194b2db86be8054851690911790557f942705f9c06f4df3a200755be087029419ecae0f261868de4338de3d3e1d045080548416831790557fb805995a7ec585a251200611a61d179cfd7fb105e1ab17dc415a7336783786f780548416600f1790557fcf84dc7c980b3196b0f098d13844d89e5df2e5e2787fd089de97e4b32ae6f4d88054841660059081179091557fb7c774451310d1be4108bc180d1b52823cb0ee0274a6c0081bcaf94f115fb96d8054851660101790557f499b5523d134c1f96cbffae8d928ddc73ca7ef12a69907179c5190d5650e08da8054851660049081179091557fb39221ace053465ec3453ce2b36430bd138b997ecea25c1043da0c366812b8288054861660111790556020929092527fa78fbe23ba4f230175b4524b489347633c4cff464e312952a3365c32594de05e8054851660011790557f9d0018f14b8c74bd28d99580dfff274b9efd7857cd08983c4c18d805d4cb0bda805485169095179094557f1c72a80d09bc24fb6c5c20317c613d317305b7afa5a26c1393fed66aeceac5008054841660031790557fddfcb30f16970af3c2ca11538a9790050424f597e99b8fd290cad3cc144801578054841690911790557f92da497b5ce6eef851d337460283a9a78967d9e174f4ca2f0a9f9dac26913000805483169093179092556140009092527f94658ccc5d4d01a0fc73742665878fe1cac1cedf0e9c670693b74174e06e8c428054909216179055611c88806107646000396000f3006080604052600436106100cf5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663238dafe081146100d157806341c0e1b5146100fa5780634d61537f1461010f5780634df68ada146101405780638da5cb5b1461015a5780639ff930881461016f578063c10753291461018a578063d06c54fb146101ae578063d0c7b012146101c3578063d579fd44146101f0578063d702087f14610211578063df88126f14610232578063e1fdb4b414610259578063ef11554214610271575b005b3480156100dd57600080fd5b506100e6610291565b604080519115158252519081900360200190f35b34801561010657600080fd5b506100cf61029a565b34801561011b57600080fd5b506101246103b0565b60408051600160a060020a039092168252519081900360200190f35b34801561014c57600080fd5b506100cf60043515156103bf565b34801561016657600080fd5b50610124610436565b34801561017b57600080fd5b506100cf600435602435610445565b34801561019657600080fd5b506100cf600160a060020a0360043516602435610850565b3480156101ba57600080fd5b506100cf61099e565b6100cf62ffffff6004351660243560443560643560843560a43560c43560e4356101043561012435610a45565b3480156101fc57600080fd5b506100cf600160a060020a0360043516610e3c565b34801561021d57600080fd5b506100cf600160a060020a0360043516610f35565b34801561023e57600080fd5b50610247610fc8565b60408051918252519081900360200190f35b34801561026557600080fd5b506100cf600435610fce565b34801561027d57600080fd5b506100cf60048035602481019101356111b2565b60045460ff1681565b600054600160a060020a031633146102fe576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b600354156103a2576040805160e560020a62461bcd02815260206004820152604860248201527f416c6c20626574732073686f756c642062652070726f6365737365642028736560448201527f74746c6564206f7220726566756e64656429206265666f72652073656c662d6460648201527f657374727563742e000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b600054600160a060020a0316ff5b600254600160a060020a031681565b600054600160a060020a03163314610423576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b6004805460ff1916911515919091179055565b600054600160a060020a031681565b6000806000806000806000806000806000808d604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106104a65780518252601f199092019160209182019101610487565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600190049b50600560008d81526020019081526020016000209a508a6001015499508a6002015498508a6003015497508a6004015496508a6005015495508a60000160149054906101000a900464ffffffffff1664ffffffffff1694508a60000160009054906101000a9004600160a060020a031693508a60060160009054906101000a900462ffffff16925089600014158061056f57508815155b8061057957508715155b8061058357508615155b8061058d57508515155b1515610609576040805160e560020a62461bcd02815260206004820152602260248201527f4265742073686f756c6420626520696e20616e2027616374697665272073746160448201527f7465000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b438510610686576040805160e560020a62461bcd02815260206004820152603360248201527f736574746c6542657420696e207468652073616d6520626c6f636b206173207060448201527f6c6163654265742c206f72206265666f72652e00000000000000000000000000606482015290519081900360840190fd5b60fa8501431115610707576040805160e560020a62461bcd02815260206004820152602260248201527f426c6f636b686173682063616e2774206265207175657269656420627920455660448201527f4d2e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008b6001018190555060008b6002018190555060008b6003018190555060008b6004018190555060008b600501819055508d8540604051602001808381526020018260001916600019168152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106107995780518252601f19909201916020918201910161077a565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912094506107f6925060069150849050066001016006610400850406600101600662100000860406600101868e8e8e8e8e6111e7565b9050610808838b8b8b8b8b600061142e565b60008111156108205761081b84826116ef565b61082b565b61082b8460016116ef565b8c151561083757610840565b6108408d6117a0565b5050505050505050505050505050565b600054600160a060020a031633146108b4576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b3031811115610932576040805160e560020a62461bcd028152602060048201526024808201527f496e63726561736520616d6f756e74206c6172676572207468616e2062616c6160448201527f6e63652e00000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60035430319082011115610990576040805160e560020a62461bcd02815260206004820152601160248201527f4e6f7420656e6f7567682066756e64732e000000000000000000000000000000604482015290519081900360640190fd5b61099a82826116ef565b5050565b600154600160a060020a03163314610a14576040805160e560020a62461bcd02815260206004820152602660248201527f43616e206f6e6c792061636365707420707265617070726f766564206e6577206044820152600080516020611c1d833981519152606482015290519081900360840190fd5b6001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b600454600090819060ff161515610aa6576040805160e560020a62461bcd02815260206004820152600e60248201527f47616d6520697320636c6f736564000000000000000000000000000000000000604482015290519081900360640190fd5b8a8a018901880187013414610b2b576040805160e560020a62461bcd02815260206004820152602960248201527f506c61636520616d6f756e7420616e64207061796d656e742073686f756c642060448201527f626520657175616c2e0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008581526005602052604090208054909250600160a060020a031615610bc2576040805160e560020a62461bcd02815260206004820152602260248201527f47616d652073686f756c6420626520696e20612027636c65616e27207374617460448201527f652e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b43861015610c1a576040805160e560020a62461bcd02815260206004820152601360248201527f436f6d6d69742068617320657870697265642e00000000000000000000000000604482015290519081900360640190fd5b8585604051602001808364ffffffffff1664ffffffffff167b01000000000000000000000000000000000000000000000000000000028152600501828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c9d5780518252601f199092019160209182019101610c7e565b51815160209384036101000a6000190180199092169116179052604080519290940182900382206000808452838301808752829052601b84870152606084018c9052608084018b905294519097506001965060a080840196509194601f19820194509281900390910191865af1158015610d1b573d6000803e3d6000fd5b5050604051601f190151600254600160a060020a039081169116149050610d8c576040805160e560020a62461bcd02815260206004820152601d60248201527f4543445341207369676e6174757265206973206e6f742076616c69642e000000604482015290519081900360640190fd5b610d9c8c8c8c8c8c8c600161142e565b50805460068201805462ffffff191662ffffff9d909d169c909c17909b553378ffffffffff000000000000000000000000000000000000000019909b16740100000000000000000000000000000000000000004364ffffffffff16021773ffffffffffffffffffffffffffffffffffffffff19169a909a178a55505050506001860194909455600285019290925560038401556004830155600590910155565b600054600160a060020a03163314610ea0576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b600054600160a060020a0382811691161415610f06576040805160e560020a62461bcd02815260206004820152601d60248201527f43616e6e6f7420617070726f76652063757272656e74206f776e65722e000000604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610f99576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60035481565b600081815260056020819052604090912060018101546002820154600383015460048401549484015493949293919290918415158061100c57508315155b8061101657508215155b8061102057508115155b8061102a57508015155b15156110a6576040805160e560020a62461bcd02815260206004820152602260248201527f4265742073686f756c6420626520696e20616e2027616374697665272073746160448201527f7465000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b855464ffffffffff740100000000000000000000000000000000000000009091041660fa014311611147576040805160e560020a62461bcd02815260206004820152602260248201527f426c6f636b686173682063616e2774206265207175657269656420627920455660448201527f4d2e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60006001870181905560028701819055600387018190556004870181905560058701819055600687015461118c9162ffffff909116908790879087908790879061142e565b85546111a990600160a060020a03168686018501840183016116ef565b50505050505050565b8060005b818110156111e1576111d98484838181106111cd57fe5b905060200201356117a0565b6001016111b6565b50505050565b600080808b8b018a01815b601660ff8216101561141d5760ff811660020a92508a831662ffffff16151561121a57611415565b600184019350600e8160ff1610156112805762ffffff831660009081526007602052604090205460ff8381169116141561127b5761125c848b8b8b8b8b611857565b62ffffff841660009081526006602052604090205460ff160294909401935b611415565b600e8160ff1610158015611297575060148160ff16105b156112ee5762ffffff831660009081526008602052604090205460ff8f811691161480156112ca57508c60ff168e60ff16145b80156112db57508b60ff168e60ff16145b1561127b5761125c848b8b8b8b8b611857565b8060ff166014148015611314575060048260ff16101580156113145750600a8260ff1611155b801561134757508c60ff168e60ff1614158061133657508b60ff168e60ff1614155b8061134757508b60ff168d60ff1614155b156113795761135a848b8b8b8b8b611857565b62ffffff841660009081526006602052604090205460ff160294909401935b8060ff16601514801561139f5750600b8260ff161015801561139f575060118260ff1611155b80156113d257508c60ff168e60ff161415806113c157508b60ff168e60ff1614155b806113d257508b60ff168d60ff1614155b15611404576113e5848b8b8b8b8b611857565b62ffffff841660009081526006602052604090205460ff160294909401935b60ff8416600514156114155761141d565b6001016111f2565b505050509998505050505050505050565b60008080808080805b601660ff8216101561156d5760ff811660020a91508d821662ffffff16151561145f57611565565b600187019650600e8160ff1610156114b05762ffffff82166000908152600660205260409020546114a99088908f908f908f908f908f9067016345785d8a00009060ff168c6118be565b9350611565565b600e8160ff16101580156114c7575060148160ff16105b1561150a5762ffffff82166000908152600660205260409020546115039088908f908f908f908f908f9066b1a2bc2ec500009060ff168b6118be565b9250611565565b601460ff8216106115545762ffffff821660009081526006602052604090205461154d9088908f908f908f908f908f90670de0b6b3a76400009060ff168d6118be565b9450611565565b60ff8716600514156115655761156d565b600101611437565b84831061157d5794820194611582565b948401945b94830194600060ff881611801561159d5750600560ff881611155b1515611619576040805160e560020a62461bcd02815260206004820152602760248201527f506c6163652062657420636f756e742073686f756c642062652077697468696e60448201527f2072616e67652e00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b8760ff166001141561168c576003805487019081905530311015611687576040805160e560020a62461bcd02815260206004820152601f60248201527f43616e6e6f74206166666f726420746f206c6f73652074686973206265742e00604482015290519081900360640190fd5b610840565b600380548790039081905560001115610840576040805160e560020a62461bcd02815260206004820152601c60248201527f4e6f7420656e6f756768206c6f636b656420696e20616d6f756e742e00000000604482015290519081900360640190fd5b604051600160a060020a0383169082156108fc029083906000818181858888f193505050501561175d57604080518281529051600160a060020a038416917fd4f43975feb89f48dd30cabbb32011045be187d1e11c8ea9faa43efc35282519919081900360200190a261099a565b604080518281529051600160a060020a038416917fac464fe4d3a86b9121261ac0a01dd981bfe0777c7c9d9c8f4473d31a9c0f9d2d919081900360200190a25050565b600081815260056020526040902060018101541515806117c35750600281015415155b806117d15750600381015415155b806117df5750600481015415155b806117ed5750600581015415155b8061181c5750805464ffffffffff740100000000000000000000000000000000000000009091041660fa014311155b156118265761099a565b805460068201805462ffffff1916905578ffffffffffffffffffffffffffffffffffffffffffffffffff1916905550565b60008660ff166001141561186c5750846118b4565b8660ff166002141561187f5750836118b4565b8660ff16600314156118925750826118b4565b8660ff16600414156118a55750816118b4565b8660ff16600514156118b45750805b9695505050505050565b60408051606081018252602881527f506c6163652062657420616d6f756e742073686f756c6420626520776974686960208201527f6e2072616e67652e00000000000000000000000000000000000000000000000091810191909152600090600160ff8c1614156119e257662386f26fc100008a101580156119405750848a11155b819015156119cf5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561199457818101518382015260200161197c565b50505050905090810190601f1680156119c15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506119db8a8585611bf8565b9150611bea565b8a60ff1660021415611a6457662386f26fc100008910158015611a055750848911155b81901515611a585760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db898585611bf8565b8a60ff1660031415611ae657662386f26fc100008810158015611a875750848811155b81901515611ada5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db888585611bf8565b8a60ff1660041415611b6857662386f26fc100008710158015611b095750848711155b81901515611b5c5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db878585611bf8565b8a60ff1660051415611bea57662386f26fc100008610158015611b8b5750848611155b81901515611bde5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db868585611bf8565b509998505050505050505050565b600060ff8316840282811115611c1057809150611c14565b8291505b50939250505056006f776e65722e00000000000000000000000000000000000000000000000000004f6e6c794f776e6572206d6574686f64732063616c6c6564206279206e6f6e2da165627a7a72305820644563a8ebe8a9c10af3ee09144a5d01616af6a11df193f5bc3a96cf084c77f10029

Deployed Bytecode

0x6080604052600436106100cf5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663238dafe081146100d157806341c0e1b5146100fa5780634d61537f1461010f5780634df68ada146101405780638da5cb5b1461015a5780639ff930881461016f578063c10753291461018a578063d06c54fb146101ae578063d0c7b012146101c3578063d579fd44146101f0578063d702087f14610211578063df88126f14610232578063e1fdb4b414610259578063ef11554214610271575b005b3480156100dd57600080fd5b506100e6610291565b604080519115158252519081900360200190f35b34801561010657600080fd5b506100cf61029a565b34801561011b57600080fd5b506101246103b0565b60408051600160a060020a039092168252519081900360200190f35b34801561014c57600080fd5b506100cf60043515156103bf565b34801561016657600080fd5b50610124610436565b34801561017b57600080fd5b506100cf600435602435610445565b34801561019657600080fd5b506100cf600160a060020a0360043516602435610850565b3480156101ba57600080fd5b506100cf61099e565b6100cf62ffffff6004351660243560443560643560843560a43560c43560e4356101043561012435610a45565b3480156101fc57600080fd5b506100cf600160a060020a0360043516610e3c565b34801561021d57600080fd5b506100cf600160a060020a0360043516610f35565b34801561023e57600080fd5b50610247610fc8565b60408051918252519081900360200190f35b34801561026557600080fd5b506100cf600435610fce565b34801561027d57600080fd5b506100cf60048035602481019101356111b2565b60045460ff1681565b600054600160a060020a031633146102fe576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b600354156103a2576040805160e560020a62461bcd02815260206004820152604860248201527f416c6c20626574732073686f756c642062652070726f6365737365642028736560448201527f74746c6564206f7220726566756e64656429206265666f72652073656c662d6460648201527f657374727563742e000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b600054600160a060020a0316ff5b600254600160a060020a031681565b600054600160a060020a03163314610423576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b6004805460ff1916911515919091179055565b600054600160a060020a031681565b6000806000806000806000806000806000808d604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106104a65780518252601f199092019160209182019101610487565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600190049b50600560008d81526020019081526020016000209a508a6001015499508a6002015498508a6003015497508a6004015496508a6005015495508a60000160149054906101000a900464ffffffffff1664ffffffffff1694508a60000160009054906101000a9004600160a060020a031693508a60060160009054906101000a900462ffffff16925089600014158061056f57508815155b8061057957508715155b8061058357508615155b8061058d57508515155b1515610609576040805160e560020a62461bcd02815260206004820152602260248201527f4265742073686f756c6420626520696e20616e2027616374697665272073746160448201527f7465000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b438510610686576040805160e560020a62461bcd02815260206004820152603360248201527f736574746c6542657420696e207468652073616d6520626c6f636b206173207060448201527f6c6163654265742c206f72206265666f72652e00000000000000000000000000606482015290519081900360840190fd5b60fa8501431115610707576040805160e560020a62461bcd02815260206004820152602260248201527f426c6f636b686173682063616e2774206265207175657269656420627920455660448201527f4d2e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008b6001018190555060008b6002018190555060008b6003018190555060008b6004018190555060008b600501819055508d8540604051602001808381526020018260001916600019168152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106107995780518252601f19909201916020918201910161077a565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912094506107f6925060069150849050066001016006610400850406600101600662100000860406600101868e8e8e8e8e6111e7565b9050610808838b8b8b8b8b600061142e565b60008111156108205761081b84826116ef565b61082b565b61082b8460016116ef565b8c151561083757610840565b6108408d6117a0565b5050505050505050505050505050565b600054600160a060020a031633146108b4576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b3031811115610932576040805160e560020a62461bcd028152602060048201526024808201527f496e63726561736520616d6f756e74206c6172676572207468616e2062616c6160448201527f6e63652e00000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60035430319082011115610990576040805160e560020a62461bcd02815260206004820152601160248201527f4e6f7420656e6f7567682066756e64732e000000000000000000000000000000604482015290519081900360640190fd5b61099a82826116ef565b5050565b600154600160a060020a03163314610a14576040805160e560020a62461bcd02815260206004820152602660248201527f43616e206f6e6c792061636365707420707265617070726f766564206e6577206044820152600080516020611c1d833981519152606482015290519081900360840190fd5b6001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b600454600090819060ff161515610aa6576040805160e560020a62461bcd02815260206004820152600e60248201527f47616d6520697320636c6f736564000000000000000000000000000000000000604482015290519081900360640190fd5b8a8a018901880187013414610b2b576040805160e560020a62461bcd02815260206004820152602960248201527f506c61636520616d6f756e7420616e64207061796d656e742073686f756c642060448201527f626520657175616c2e0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008581526005602052604090208054909250600160a060020a031615610bc2576040805160e560020a62461bcd02815260206004820152602260248201527f47616d652073686f756c6420626520696e20612027636c65616e27207374617460448201527f652e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b43861015610c1a576040805160e560020a62461bcd02815260206004820152601360248201527f436f6d6d69742068617320657870697265642e00000000000000000000000000604482015290519081900360640190fd5b8585604051602001808364ffffffffff1664ffffffffff167b01000000000000000000000000000000000000000000000000000000028152600501828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c9d5780518252601f199092019160209182019101610c7e565b51815160209384036101000a6000190180199092169116179052604080519290940182900382206000808452838301808752829052601b84870152606084018c9052608084018b905294519097506001965060a080840196509194601f19820194509281900390910191865af1158015610d1b573d6000803e3d6000fd5b5050604051601f190151600254600160a060020a039081169116149050610d8c576040805160e560020a62461bcd02815260206004820152601d60248201527f4543445341207369676e6174757265206973206e6f742076616c69642e000000604482015290519081900360640190fd5b610d9c8c8c8c8c8c8c600161142e565b50805460068201805462ffffff191662ffffff9d909d169c909c17909b553378ffffffffff000000000000000000000000000000000000000019909b16740100000000000000000000000000000000000000004364ffffffffff16021773ffffffffffffffffffffffffffffffffffffffff19169a909a178a55505050506001860194909455600285019290925560038401556004830155600590910155565b600054600160a060020a03163314610ea0576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b600054600160a060020a0382811691161415610f06576040805160e560020a62461bcd02815260206004820152601d60248201527f43616e6e6f7420617070726f76652063757272656e74206f776e65722e000000604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610f99576040805160e560020a62461bcd0281526020600482015260266024820152600080516020611c3d8339815191526044820152600080516020611c1d833981519152606482015290519081900360840190fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60035481565b600081815260056020819052604090912060018101546002820154600383015460048401549484015493949293919290918415158061100c57508315155b8061101657508215155b8061102057508115155b8061102a57508015155b15156110a6576040805160e560020a62461bcd02815260206004820152602260248201527f4265742073686f756c6420626520696e20616e2027616374697665272073746160448201527f7465000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b855464ffffffffff740100000000000000000000000000000000000000009091041660fa014311611147576040805160e560020a62461bcd02815260206004820152602260248201527f426c6f636b686173682063616e2774206265207175657269656420627920455660448201527f4d2e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60006001870181905560028701819055600387018190556004870181905560058701819055600687015461118c9162ffffff909116908790879087908790879061142e565b85546111a990600160a060020a03168686018501840183016116ef565b50505050505050565b8060005b818110156111e1576111d98484838181106111cd57fe5b905060200201356117a0565b6001016111b6565b50505050565b600080808b8b018a01815b601660ff8216101561141d5760ff811660020a92508a831662ffffff16151561121a57611415565b600184019350600e8160ff1610156112805762ffffff831660009081526007602052604090205460ff8381169116141561127b5761125c848b8b8b8b8b611857565b62ffffff841660009081526006602052604090205460ff160294909401935b611415565b600e8160ff1610158015611297575060148160ff16105b156112ee5762ffffff831660009081526008602052604090205460ff8f811691161480156112ca57508c60ff168e60ff16145b80156112db57508b60ff168e60ff16145b1561127b5761125c848b8b8b8b8b611857565b8060ff166014148015611314575060048260ff16101580156113145750600a8260ff1611155b801561134757508c60ff168e60ff1614158061133657508b60ff168e60ff1614155b8061134757508b60ff168d60ff1614155b156113795761135a848b8b8b8b8b611857565b62ffffff841660009081526006602052604090205460ff160294909401935b8060ff16601514801561139f5750600b8260ff161015801561139f575060118260ff1611155b80156113d257508c60ff168e60ff161415806113c157508b60ff168e60ff1614155b806113d257508b60ff168d60ff1614155b15611404576113e5848b8b8b8b8b611857565b62ffffff841660009081526006602052604090205460ff160294909401935b60ff8416600514156114155761141d565b6001016111f2565b505050509998505050505050505050565b60008080808080805b601660ff8216101561156d5760ff811660020a91508d821662ffffff16151561145f57611565565b600187019650600e8160ff1610156114b05762ffffff82166000908152600660205260409020546114a99088908f908f908f908f908f9067016345785d8a00009060ff168c6118be565b9350611565565b600e8160ff16101580156114c7575060148160ff16105b1561150a5762ffffff82166000908152600660205260409020546115039088908f908f908f908f908f9066b1a2bc2ec500009060ff168b6118be565b9250611565565b601460ff8216106115545762ffffff821660009081526006602052604090205461154d9088908f908f908f908f908f90670de0b6b3a76400009060ff168d6118be565b9450611565565b60ff8716600514156115655761156d565b600101611437565b84831061157d5794820194611582565b948401945b94830194600060ff881611801561159d5750600560ff881611155b1515611619576040805160e560020a62461bcd02815260206004820152602760248201527f506c6163652062657420636f756e742073686f756c642062652077697468696e60448201527f2072616e67652e00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b8760ff166001141561168c576003805487019081905530311015611687576040805160e560020a62461bcd02815260206004820152601f60248201527f43616e6e6f74206166666f726420746f206c6f73652074686973206265742e00604482015290519081900360640190fd5b610840565b600380548790039081905560001115610840576040805160e560020a62461bcd02815260206004820152601c60248201527f4e6f7420656e6f756768206c6f636b656420696e20616d6f756e742e00000000604482015290519081900360640190fd5b604051600160a060020a0383169082156108fc029083906000818181858888f193505050501561175d57604080518281529051600160a060020a038416917fd4f43975feb89f48dd30cabbb32011045be187d1e11c8ea9faa43efc35282519919081900360200190a261099a565b604080518281529051600160a060020a038416917fac464fe4d3a86b9121261ac0a01dd981bfe0777c7c9d9c8f4473d31a9c0f9d2d919081900360200190a25050565b600081815260056020526040902060018101541515806117c35750600281015415155b806117d15750600381015415155b806117df5750600481015415155b806117ed5750600581015415155b8061181c5750805464ffffffffff740100000000000000000000000000000000000000009091041660fa014311155b156118265761099a565b805460068201805462ffffff1916905578ffffffffffffffffffffffffffffffffffffffffffffffffff1916905550565b60008660ff166001141561186c5750846118b4565b8660ff166002141561187f5750836118b4565b8660ff16600314156118925750826118b4565b8660ff16600414156118a55750816118b4565b8660ff16600514156118b45750805b9695505050505050565b60408051606081018252602881527f506c6163652062657420616d6f756e742073686f756c6420626520776974686960208201527f6e2072616e67652e00000000000000000000000000000000000000000000000091810191909152600090600160ff8c1614156119e257662386f26fc100008a101580156119405750848a11155b819015156119cf5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561199457818101518382015260200161197c565b50505050905090810190601f1680156119c15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506119db8a8585611bf8565b9150611bea565b8a60ff1660021415611a6457662386f26fc100008910158015611a055750848911155b81901515611a585760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db898585611bf8565b8a60ff1660031415611ae657662386f26fc100008810158015611a875750848811155b81901515611ada5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db888585611bf8565b8a60ff1660041415611b6857662386f26fc100008710158015611b095750848711155b81901515611b5c5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db878585611bf8565b8a60ff1660051415611bea57662386f26fc100008610158015611b8b5750848611155b81901515611bde5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561199457818101518382015260200161197c565b506119db868585611bf8565b509998505050505050505050565b600060ff8316840282811115611c1057809150611c14565b8291505b50939250505056006f776e65722e00000000000000000000000000000000000000000000000000004f6e6c794f776e6572206d6574686f64732063616c6c6564206279206e6f6e2da165627a7a72305820644563a8ebe8a9c10af3ee09144a5d01616af6a11df193f5bc3a96cf084c77f10029

Swarm Source

bzzr://644563a8ebe8a9c10af3ee09144a5d01616af6a11df193f5bc3a96cf084c77f1

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.