Sponsored Link:   SHIFT.cash - 1st ever car title loan platform on blockchain. Join NOW.
Contract Overview | SlotGame
ETH Balance: 3.698 Ether
ETH USD Value: $2,682.83 (@ $725.48/ETH)
No Of Transactions: 57 txns
Misc
Address Watch Add To Watch List
Contract Creator 0x00a5908bb2bfb745323c016faf2e6a8546f26a84at txn 0xada9fab27d5d34c04f233e7cf7f50cceb79586921e336de3d0b99630808abcd0
Token Tracker
  Latest 25 txns from a total Of 57 transactions View All

TxHash Age From To Value [TxFee]
0xd29d1d68ecfafd9ae388c0a33173e77e465f78f87cccd4d9d35aa197a48525b149 days 1 hr ago0xdc15cb4018fa067f03a370b5300a0fab9c01dc47  IN   SlotGame0.1 Ether0.0016596
0xfe47602d48d79daaf0a16c0418e36226a842205c26fddb306f86c2b81948da7f69 days 15 hrs ago0xea2bd1f61f9ae6f97252a7ecf520a8614933f9d9  IN   SlotGame0.01 Ether0.012
0xa759f8f34fcaa1cb3b9a9699c70566fd40cc628bb821e09d2cd4bcc7b223d1b580 days 3 hrs ago0x00acbe4b95628275a52f265a844a4ee91f62ee68  IN   SlotGame0.1 Ether0.00142758
0x591f21741b4bd00e703882387bc6037b1519c454e281edf2632c007ea35ee7ff80 days 3 hrs ago0x00007e8cbd56b7711df167c1ee3a6cfac3b06122  IN   SlotGame2 Ether0.012799479
0x9c75aaed408689877c10b654ec4705ed3f8d26e847668ec4d27c6c750cd594f880 days 3 hrs ago0x00018a95be12f56f59c44ccfd90bc90a1857379f  IN   SlotGame1 Ether0.006814269
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce68180 days 3 hrs ago0x00007e8cbd56b7711df167c1ee3a6cfac3b06122  IN   SlotGame1 Ether0.009347856
0xfbb25217ce69ee55738f60fdf03fd13651a7c3aff31966094d6a6a1acdd6a75f80 days 4 hrs ago0x00007e8cbd56b7711df167c1ee3a6cfac3b06122  IN   SlotGame3 Ether0.018784689
0x2c9b869bfdf1fd33eacd8265918bffd886e85fee88d7221b2d12ec5a98b964a080 days 4 hrs ago0x00018a95be12f56f59c44ccfd90bc90a1857379f  IN   SlotGame1.6 Ether0.010720395
0x5cfe9d02a6f056c650f3e57efc91e2137496e955097c96ad8fa078a6611accef80 days 4 hrs ago0x0072c6415107ac515041fbbc7ba224c5c31c45b9  IN   SlotGame4 Ether0.021
0x38560f7203fe23041dc21faaf20288e74ed8bf3fc154828de030981c2610d81980 days 4 hrs ago0x0072c6415107ac515041fbbc7ba224c5c31c45b9  IN   SlotGame3 Ether0.0084
0x6e0222cc9590f77dbc00c502bc43e67c6de3fb56b44f51c29aaa83fc6e968fbe80 days 4 hrs ago0x00018a95be12f56f59c44ccfd90bc90a1857379f  IN   SlotGame1.5 Ether0.0042
0x6843f457a3a188de577b4aedb224a60d79c99ea6d156157a8984112686953d2e80 days 4 hrs ago0x0072c6415107ac515041fbbc7ba224c5c31c45b9  IN   SlotGame3 Ether0.0042
0xd616aa436318e0c9ae5dbb799b24384afb7b5bd4ab9bf0dd4ca7c7b078388aa880 days 4 hrs ago0x0072c6415107ac515041fbbc7ba224c5c31c45b9  IN   SlotGame4 Ether0.0042
0x9b6c0b9661c4e00c9d64f554100aa14eec432d819ad9ff74fc2bae235a90903180 days 4 hrs ago0x00018a95be12f56f59c44ccfd90bc90a1857379f  IN   SlotGame2.984755218 Ether0.015244782
0xdb0148d2709442f3cb35234faf3f93793fbf97a54d2738576f05489e455997b180 days 4 hrs ago0x00bd966f31f2badf38e4bd5da49e095e34f1923f  IN   SlotGame0.1 Ether0.00142758
0x909ddc2f98a2f91adad216f8907e96f67a76e0284ddb5f2cfe45e4066c9c0d7680 days 4 hrs ago0x0072c6415107ac515041fbbc7ba224c5c31c45b9  IN   SlotGame3 Ether0.0042
0x00b2814e9c68c52d4a2f1db96cdfaa6d81849d00a66c0459e66b4ab1dff5969380 days 4 hrs ago0x00007e8cbd56b7711df167c1ee3a6cfac3b06122  IN   SlotGame0.1 Ether0.00142758
0x0910f10f0454b3be30973e93b5170360f63e86926fd7144c6ab9fe44dfb6ec5380 days 5 hrs ago0x00491323b153828d1e45dcda2a0c87cbed9172d2  IN   SlotGame0.1 Ether0.00142758
0xc09441540ecfe8d6277ee1e08061fe090e35f45fdcad598ec2c1a431bd67b8ff80 days 5 hrs ago0x0072c6415107ac515041fbbc7ba224c5c31c45b9  IN   SlotGame0.2 Ether0.002026101
0xa163ff75ce2a005639056cfe80c894b26a8abbabf508ed65c9d0c894560b2a4380 days 5 hrs ago0x0083ecede87fcebf2cecbb622425cda4ebf43f3f  IN   SlotGame0.2 Ether0.002026101
0xc386a9ad08d0864a12ddac2d68bb2d947455bbfbf708a9078da89494bef3b67480 days 5 hrs ago0x00bd966f31f2badf38e4bd5da49e095e34f1923f  IN   SlotGame0.1 Ether0.00142758
0xd28b81c9f1c048dc63786544da198a42141384c85b18429321d474327c01d67b80 days 5 hrs ago0x00491323b153828d1e45dcda2a0c87cbed9172d2  IN   SlotGame0.1 Ether0.00142758
0x56a3566db8ac49562af2b54964f81832f80f7f18f523f9e754d3b4417ea31f8280 days 5 hrs ago0x00acbe4b95628275a52f265a844a4ee91f62ee68  IN   SlotGame0.2 Ether0.002026101
0xd800b820c06610d125c52646953b92e6227982e42c2d1ddf397e609c303a724380 days 5 hrs ago0x00acbe4b95628275a52f265a844a4ee91f62ee68  IN   SlotGame0.2111 Ether0.002481801
0xcd93899c2eb262d6fb319eaedc023f0fa71104df7c46319ab9465af98690c20180 days 5 hrs ago0x00007e8cbd56b7711df167c1ee3a6cfac3b06122  IN   SlotGame0.3 Ether0.002624622
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
  Latest 22 Internal Transactions

ParentTxHash Block Age From To Value
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061220.002 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.249 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061220.5 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061220.5 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061220.5 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061220.5 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061220.5 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061221 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061222 Ether
0x1df24286275287a98b5ea7f778fdfc93b81adb1d856634fc67919b6ebe3ce681431937080 days 3 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00007e8cbd56b7711df167c1ee3a6cfac3b061224 Ether
0xd800b820c06610d125c52646953b92e6227982e42c2d1ddf397e609c303a7243431914980 days 5 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x00acbe4b95628275a52f265a844a4ee91f62ee680.0111 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.002 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.249 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.5 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.5 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.5 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.5 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b90.5 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b91 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b92 Ether
0x7ff7510fe2fe88de0b1cd7faae8256c1ea0a6ac3b16cfbd6c7c42f23bd53a8ce431861980 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a0x0072c6415107ac515041fbbc7ba224c5c31c45b94 Ether
0xada9fab27d5d34c04f233e7cf7f50cceb79586921e336de3d0b99630808abcd0431858280 days 10 hrs ago0xd6b3d9e44f767f0c178f60d24fb186ba49bc444a  Contract Creation0 Ether
[ Download CSV Export  ] 
Warning: The compiled contract might be susceptible to ZeroFunctionSelector (very low-severity) Solidity compiler bugs.

Contract Source Code Verified
Contract Name: Slot
Compiler Version: v0.4.17+commit.bdeb9e52
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.17;

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // assert(b > 0); // Solidity automatically throws when dividing by 0
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }
}

/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
    uint256 public totalSupply;
    function balanceOf(address who) constant returns (uint256);
    function transfer(address to, uint256 value) returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
}

/**
 * @title Basic token
 * @dev Basic version of StandardToken, with no allowances. 
 */
contract BasicToken is ERC20Basic {
    using SafeMath for uint256;

    mapping(address => uint256) balances;

    /**
    * @dev transfer token for a specified address
    * @param _to The address to transfer to.
    * @param _value The amount to be transferred.
    */
    function transfer(address _to, uint256 _value) returns (bool) {
        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        Transfer(msg.sender, _to, _value);
        return true;
    }

    /**
    * @dev Gets the balance of the specified address.
    * @param _owner The address to query the the balance of. 
    * @return An uint256 representing the amount owned by the passed address.
    */
    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balances[_owner];
    }

}

/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
    function allowance(address owner, address spender) constant returns (uint256);
    function transferFrom(address from, address to, uint256 value) returns (bool);
    function approve(address spender, uint256 value) returns (bool);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
    address public owner;

    /**
    * @dev The Ownable constructor sets the original `owner` of the contract to the sender
    * account.
    */
    function Ownable() {
        owner = msg.sender;
    }

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

    /**
    * @dev Allows the current owner to transfer control of the contract to a newOwner.
    * @param newOwner The address to transfer ownership to.
    */
    function transferOwnership(address newOwner) onlyOwner {
        if (newOwner != address(0)) {
            owner = newOwner;
        }
    }

}

/**
 * @title Standard ERC20 token
 *
 * @dev Implementation of the basic standard token.
 * @dev https://github.com/ethereum/EIPs/issues/20
 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
 */
contract StandardMintableToken is ERC20, BasicToken, Ownable {

    mapping (address => mapping (address => uint256)) allowed;
  
    event Mint(address indexed to, uint256 amount);
    event MintFinished();

    bool public mintingFinished = false;

    modifier canMint() {
        require(!mintingFinished);
        _;
    }

    /**
    * @dev Transfer tokens from one address to another
    * @param _from address The address which you want to send tokens from
    * @param _to address The address which you want to transfer to
    * @param _value uint256 the amout of tokens to be transfered
    */
    function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
        var _allowance = allowed[_from][msg.sender];

        // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
        // require (_value <= _allowance);

        balances[_to] = balances[_to].add(_value);
        balances[_from] = balances[_from].sub(_value);
        allowed[_from][msg.sender] = _allowance.sub(_value);
        Transfer(_from, _to, _value);
        return true;
    }

    /**
    * @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
    * @param _spender The address which will spend the funds.
    * @param _value The amount of tokens to be spent.
    */
    function approve(address _spender, uint256 _value) returns (bool) {

    // To change the approve amount you first have to reduce the addresses`
    //  allowance to zero by calling `approve(_spender, 0)` if it is not
    //  already 0 to mitigate the race condition described here:
    //  https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
    require((_value == 0) || (allowed[msg.sender][_spender] == 0));

        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    /**
    * @dev Function to check the amount of tokens that an owner allowed to a spender.
    * @param _owner address The address which owns the funds.
    * @param _spender address The address which will spend the funds.
    * @return A uint256 specifing the amount of tokens still avaible for the spender.
    */
    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }
  
   /**
   * @dev Function to mint tokens
   * @param _to The address that will receive the minted tokens.
   * @param _amount The amount of tokens to mint.
   * @return A boolean that indicates if the operation was successful.
   */
    function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
        totalSupply = totalSupply.add(_amount);
        balances[_to] = balances[_to].add(_amount);
        Mint(_to, _amount);
        Transfer(0x0, _to, _amount); // so it is displayed properly on EtherScan
        return true;
    }
    
    /**
    * @dev Function to stop minting new tokens.
    * @return True if the operation was successful.
    */
    function finishMinting() onlyOwner returns (bool) {
        mintingFinished = true;
        MintFinished();
        return true;
    }

}

/**
 * @title Slot Ticket
 * @dev Simple ERC20 Token example, with mintable token creation
 * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
 */
 
contract SlotTicket is StandardMintableToken {

    string public name = "Slot Ticket";
    uint8 public decimals = 0;
    string public symbol = "TICKET";
    string public version = "0.7";

    function destroy() onlyOwner {
        selfdestruct(owner);
    }
}

/**  
 *  @title Slot
 *  @dev every participant has an account index, the winners are picked from here
 *  all winners are picked in order from the single random int 
 *  needs to be cleared after every game 
 */
     
contract Slot is Ownable {
    using SafeMath for uint256;

    uint8   constant SIZE =           100;        // size of the lottery
    uint32  constant JACKPOT_CHANCE = 1000000;    // one in a million
    uint32  constant INACTIVITY =     160000;     // blocks after which refunds can be claimed
    uint256 constant PRICE =          100 finney;
    uint256 constant JACK_DIST =      249 finney;
    uint256 constant DIV_DIST =       249 finney;
    uint256 constant GAS_REFUND =     2 finney;

    /* 
    *  every participant has an account index, the winners are picked from here
    *  all winners are picked in order from the single random int 
    *  needs to be cleared after every game
    */
    mapping (uint => mapping (uint => address)) public participants; // game number => counter => address
    SlotTicket public ticket; // this is a receipt for the ticket, it wont affect the prize distribution
    uint256 public jackpotAmount;
    uint256 public gameIndex;
    uint256 public gameStartedAtBlock;
    address public fund; // address to send dividends
    uint256[8] public prizes = [4 ether, 
                                2 ether,
                                1 ether, 
                                500 finney, 
                                500 finney, 
                                500 finney, 
                                500 finney, 
                                500 finney];
    uint256 counter;

    event ParticipantAdded(address indexed _participant, uint256 indexed _game, uint256 indexed _number);
    event PrizeAwarded(uint256 indexed _game , address indexed _winner, uint256 indexed _amount);
    event JackpotAwarded(uint256 indexed _game, address indexed _winner, uint256 indexed _amount);
    event GameRefunded(uint256 _game);

    function Slot(address _fundAddress) payable { // address _ticketAddress
        ticket = new SlotTicket();
        fund = _fundAddress;

        jackpotAmount = msg.value;
        gameIndex = 0;
        counter = 0;
        gameStartedAtBlock = block.number;
    }

    function() payable {
        buyTicketsFor(msg.sender);
    }

    function buyTicketsFor(address _beneficiary) public payable {
        require(_beneficiary != 0x0);
        require(msg.value >= PRICE);

        // calculate number of tickets, issue tokens and add participant
        // every (PRICE) buys a ticket, the rest is returned
        uint256 change = msg.value%PRICE;
        uint256 numberOfTickets = msg.value.sub(change).div(PRICE);
        ticket.mint(_beneficiary, numberOfTickets);
        addParticipant(_beneficiary, numberOfTickets);

        // Return change to msg.sender
        msg.sender.transfer(change);
    }

    /* private functions */

    function addParticipant(address _participant, uint256 _numberOfTickets) private {
        // if number of tickets exceeds the size of the game, tickets are added to next game

        for (uint256 i = 0; i < _numberOfTickets; i++) {
            // using gameIndex instead of counter/SIZE since games can be cancelled
            participants[gameIndex][counter%SIZE] = _participant; 
            ParticipantAdded(_participant, gameIndex, counter%SIZE);

            // msg.sender triggers the drawing of lots
            if (++counter%SIZE == 0) {
                awardPrizes();
                // Split the rest, increase game number
                distributeRemaining();
                increaseGame();
            }
            // loop continues if there are more tickets
        }
    }
    
    function awardPrizes() private {
        uint256 hashNumber = uint256(keccak256(block.blockhash(block.number-1)));

        // get the winning number
        uint256 winnerIndex = hashNumber%SIZE;

        // get jackpot winner, hash result of last two digit number (index) with 4 preceding zeroes will win
        uint256 jackpotNumber = hashNumber%JACKPOT_CHANCE;
        if (winnerIndex == jackpotNumber) {
            distributeJackpot(winnerIndex);
        }

        // loop throught the prizes 
        for (uint8 i = 0; i < prizes.length; i++) {
            // GAS: 21000 Paid for every transaction. (prizes.length)
            participants[gameIndex][winnerIndex%SIZE].transfer(prizes[i]); // msg.sender pays the gas, he's refunded later, % to wrap around
            PrizeAwarded(gameIndex, participants[gameIndex][winnerIndex%SIZE], prizes[i]);

            // increment index to the next winner to receive the next prize
            winnerIndex++;
        }
    }

    function distributeJackpot(uint256 _winnerIndex) private {
        uint256 amount = jackpotAmount;
        jackpotAmount = 0; // later on in the code sequence funds will be added

        participants[gameIndex][_winnerIndex].transfer(amount);
        JackpotAwarded(gameIndex,  participants[gameIndex][_winnerIndex], amount);
    }

    function distributeRemaining() private {
        jackpotAmount = jackpotAmount.add(JACK_DIST);   // add to jackpot
        fund.transfer(DIV_DIST);                        // dividends are paid to SLOT investors
        msg.sender.transfer(GAS_REFUND);                // repay gas to msg.sender
    }

    function increaseGame() private {
        gameIndex++;
        gameStartedAtBlock = block.number;
    }

    /* public functions */

    function spotsLeft() public constant returns (uint8 spots) {
        return SIZE - uint8(counter%SIZE);
    }

    function refundPlayersAfterVeryLongGame() public {
        require(block.number.sub(gameStartedAtBlock) >= INACTIVITY);
        require(counter%SIZE != 0); // nothing to refund
        // refunds for everybody can be requested after the game has gone (INACTIVITY) blocks without a conclusion
        
        // Checks-Effects-Interactions pattern to avoid re-entrancy
        uint256 _size = counter%SIZE; // not counter.size, but modulus of SIZE
        counter -= _size;

        for (uint8 i = 0; i < _size; i++) {
            participants[gameIndex][i].transfer(PRICE);
        }

        GameRefunded(gameIndex);
        increaseGame();
    }

    function destroy() public onlyOwner {
        require(this.balance < 1 ether);

        ticket.destroy();
        selfdestruct(owner);
    }
    
    function changeTicketOwner(address _newOwner) public onlyOwner {
        require(_newOwner != 0x0);
        // in case of new contract, old token can still be used
        // the token contract owner is the slot contract itself
        ticket.transferOwnership(_newOwner);
    }
    
    function changeFund(address _newFund) public onlyOwner {
        require(_newFund != 0x0);
        // changes the place to send dividends to SLOT investors
        fund = _newFund;
    }
    
    function changeTicket(address _newTicket) public onlyOwner {
        require(_newTicket != 0x0);
        ticket = SlotTicket(_newTicket); // still owner of the ticket needs to changed to work
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"gameStartedAtBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"spotsLeft","outputs":[{"name":"spots","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newTicket","type":"address"}],"name":"changeTicket","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gameIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newFund","type":"address"}],"name":"changeFund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ticket","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"participants","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"destroy","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":"_newOwner","type":"address"}],"name":"changeTicketOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"}],"name":"buyTicketsFor","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"jackpotAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fund","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"prizes","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"refundPlayersAfterVeryLongGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_fundAddress","type":"address"}],"payable":true,"stateMutability":"payable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_participant","type":"address"},{"indexed":true,"name":"_game","type":"uint256"},{"indexed":true,"name":"_number","type":"uint256"}],"name":"ParticipantAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_game","type":"uint256"},{"indexed":true,"name":"_winner","type":"address"},{"indexed":true,"name":"_amount","type":"uint256"}],"name":"PrizeAwarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_game","type":"uint256"},{"indexed":true,"name":"_winner","type":"address"},{"indexed":true,"name":"_amount","type":"uint256"}],"name":"JackpotAwarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_game","type":"uint256"}],"name":"GameRefunded","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60606040526101006040519081016040908152673782dace9d9000008252671bc16d674ec800006020830152670de0b6b3a7640000908201526706f05b59d3b20000606082018190526080820181905260a0820181905260c0820181905260e0820152610070906007906008610107565b5060405160208061183f8339810160405280805160008054600160a060020a03191633600160a060020a031617905591506100ab9050610151565b604051809103906000f08015156100c157600080fd5b60028054600160a060020a03928316600160a060020a031991821617909155600680549390921692169190911790553460035560006004819055600f554360055561017e565b8260088101928215610141579160200282015b82811115610141578251829067ffffffffffffffff1690559160200191906001019061011a565b5061014d929150610161565b5090565b604051610b9e80610ca183390190565b61017b91905b8082111561014d5760008155600101610167565b90565b610b148061018d6000396000f300606060405236156100ca5763ffffffff60e060020a6000350416631f2d62bc81146100d55780634b960794146100fa5780634bee09e1146101235780635654a34114610142578063681b742f146101555780636cc25db71461017457806381fb1fb4146101a357806383197ef0146101bc5780638da5cb5b146101cf5780639246177b146101e2578063a162c04c14610201578063b1eac37e14610215578063b60d428814610228578063eccb3a4f1461023b578063edfe676b14610251578063f2fde38b14610264575b6100d333610283565b005b34156100e057600080fd5b6100e86103a3565b60405190815260200160405180910390f35b341561010557600080fd5b61010d6103a9565b60405160ff909116815260200160405180910390f35b341561012e57600080fd5b6100d3600160a060020a03600435166103b7565b341561014d57600080fd5b6100e8610416565b341561016057600080fd5b6100d3600160a060020a036004351661041c565b341561017f57600080fd5b61018761047b565b604051600160a060020a03909116815260200160405180910390f35b34156101ae57600080fd5b61018760043560243561048a565b34156101c757600080fd5b6100d36104b0565b34156101da57600080fd5b61018761054b565b34156101ed57600080fd5b6100d3600160a060020a036004351661055a565b6100d3600160a060020a0360043516610283565b341561022057600080fd5b6100e86105f1565b341561023357600080fd5b6101876105f7565b341561024657600080fd5b6100e8600435610606565b341561025c57600080fd5b6100d361061a565b341561026f57600080fd5b6100d3600160a060020a0360043516610715565b600080600160a060020a038316151561029b57600080fd5b67016345785d8a00003410156102b057600080fd5b67016345785d8a0000340691506102e567016345785d8a00006102d9348563ffffffff61076b16565b9063ffffffff61077d16565b600254909150600160a060020a03166340c10f19848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561034757600080fd5b6102c65a03f1151561035857600080fd5b505050604051805190505061036d8382610794565b600160a060020a03331682156108fc0283604051600060405180830381858888f19350505050151561039e57600080fd5b505050565b60055481565b600f54606490819006900390565b60005433600160a060020a039081169116146103d257600080fd5b600160a060020a03811615156103e757600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045481565b60005433600160a060020a0390811691161461043757600080fd5b600160a060020a038116151561044c57600080fd5b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031681565b6001602090815260009283526040808420909152908252902054600160a060020a031681565b60005433600160a060020a039081169116146104cb57600080fd5b670de0b6b3a7640000600160a060020a03301631106104e957600080fd5b600254600160a060020a03166383197ef06040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561052857600080fd5b6102c65a03f1151561053957600080fd5b5050600054600160a060020a03169050ff5b600054600160a060020a031681565b60005433600160a060020a0390811691161461057557600080fd5b600160a060020a038116151561058a57600080fd5b600254600160a060020a031663f2fde38b8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156105da57600080fd5b6102c65a03f115156105eb57600080fd5b50505050565b60035481565b600654600160a060020a031681565b6007816008811061061357fe5b0154905081565b6000806202710063ffffffff1661063c6005544361076b90919063ffffffff16565b101561064757600080fd5b600f5460649006151561065957600080fd5b5050600f8054606481069081900390915560005b818160ff1610156106d457600454600090815260016020908152604080832060ff8516845290915280822054600160a060020a0316919067016345785d8a00009051600060405180830381858888f1935050505015156106cc57600080fd5b60010161066d565b7f3f089de9d7a24f4fa13fc08c92aea5efef51005bfc944583d8062c43f78672b860045460405190815260200160405180910390a161071161085a565b5050565b60005433600160a060020a0390811691161461073057600080fd5b600160a060020a03811615610768576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60008282111561077757fe5b50900390565b600080828481151561078b57fe5b04949350505050565b60005b8181101561039e57600480546000908152600160209081526040808320600f805460649081900686529190935292819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0389169081179091559154935492909306927f39f165c675335f87dc85b7fd0a2dc035f56fb1d320cfdb4d24c94ef678d2e2a7905160405180910390a4600f80546001019081905560649006151561085257610842610869565b61084a610990565b61085261085a565b600101610797565b60048054600101905543600555565b60008060008060014303406040519081526020016040519081900390209350606484069250620f424084069150818314156108a7576108a783610a1b565b5060005b60088160ff1610156105eb576004546000908152600160209081526040808320606487068452909152902054600160a060020a03166108fc600760ff8416600881106108f357fe5b01549081150290604051600060405180830381858888f19350505050151561091a57600080fd5b600760ff82166008811061092a57fe5b015460045460008181526001602090815260408083206064890684529091529081902054600160a060020a031691907ff0594d38dd7623b3da8f16f26b64fefca68a75046d6fc9b91a1433ef089f39d9905160405180910390a4600192830192016108ab565b6003546109ab90670374a02e4512800063ffffffff610ad216565b600355600654600160a060020a03166000670374a02e45128000604051600060405180830381858888f1935050505015156109e557600080fd5b600160a060020a033316600066071afd498d0000604051600060405180830381858888f193505050501515610a1957600080fd5b565b60038054600091829055600454825260016020908152604080842085855290915291829020549091600160a060020a039091169082156108fc0290839051600060405180830381858888f193505050501515610a7657600080fd5b600454600081815260016020908152604080832086845290915290819020548392600160a060020a03909116917fc48dc5fbc1c2db25b93547f67e9f74e2b0a8cd64c6e6e45ef1a308d0f86a9058905160405180910390a45050565b600082820183811015610ae157fe5b93925050505600a165627a7a7230582026b4490d0929cd14c78dfc5f309f7237661c18e2f71fc3f64cb577369824b15a0029606060409081526004805460ff191690558051908101604052600b81527f536c6f74205469636b657400000000000000000000000000000000000000000060208201526005908051610055929160200190610110565b506006805460ff1916905560408051908101604052600681527f5449434b45540000000000000000000000000000000000000000000000000000602082015260079080516100a7929160200190610110565b5060408051908101604052600381527f302e370000000000000000000000000000000000000000000000000000000000602082015260089080516100ef929160200190610110565b5060028054600160a060020a03191633600160a060020a03161790556101ab565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061015157805160ff191683800117855561017e565b8280016001018555821561017e579182015b8281111561017e578251825591602001919060010190610163565b5061018a92915061018e565b5090565b6101a891905b8082111561018a5760008155600101610194565b90565b6109e4806101ba6000396000f300606060405236156100e35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100e857806306fdde031461010f578063095ea7b31461019957806318160ddd146101bb57806323b872dd146101e0578063313ce5671461020857806340c10f191461023157806354fd4d501461025357806370a08231146102665780637d64bcb41461028557806383197ef0146102985780638da5cb5b146102ad57806395d89b41146102dc578063a9059cbb146102ef578063dd62ed3e14610311578063f2fde38b14610336575b600080fd5b34156100f357600080fd5b6100fb610355565b604051901515815260200160405180910390f35b341561011a57600080fd5b61012261035e565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015e578082015183820152602001610146565b50505050905090810190601f16801561018b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a457600080fd5b6100fb600160a060020a03600435166024356103fc565b34156101c657600080fd5b6101ce6104a2565b60405190815260200160405180910390f35b34156101eb57600080fd5b6100fb600160a060020a03600435811690602435166044356104a8565b341561021357600080fd5b61021b6105bb565b60405160ff909116815260200160405180910390f35b341561023c57600080fd5b6100fb600160a060020a03600435166024356105c4565b341561025e57600080fd5b6101226106ca565b341561027157600080fd5b6101ce600160a060020a0360043516610735565b341561029057600080fd5b6100fb610750565b34156102a357600080fd5b6102ab6107ad565b005b34156102b857600080fd5b6102c06107d6565b604051600160a060020a03909116815260200160405180910390f35b34156102e757600080fd5b6101226107e5565b34156102fa57600080fd5b6100fb600160a060020a0360043516602435610850565b341561031c57600080fd5b6101ce600160a060020a036004358116906024351661090f565b341561034157600080fd5b6102ab600160a060020a036004351661093a565b60045460ff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103f45780601f106103c9576101008083540402835291602001916103f4565b820191906000526020600020905b8154815290600101906020018083116103d757829003601f168201915b505050505081565b600081158061042e5750600160a060020a03338116600090815260036020908152604080832093871683529290522054155b151561043957600080fd5b600160a060020a03338116600081815260036020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b600160a060020a0380841660009081526003602090815260408083203385168452825280832054938616835260019091528120549091906104ef908463ffffffff61099016565b600160a060020a038086166000908152600160205260408082209390935590871681522054610524908463ffffffff6109a616565b600160a060020a03861660009081526001602052604090205561054d818463ffffffff6109a616565b600160a060020a03808716600081815260036020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3506001949350505050565b60065460ff1681565b60025460009033600160a060020a039081169116146105e257600080fd5b60045460ff16156105f257600080fd5b600054610605908363ffffffff61099016565b6000908155600160a060020a038416815260016020526040902054610630908363ffffffff61099016565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a282600160a060020a031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103f45780601f106103c9576101008083540402835291602001916103f4565b600160a060020a031660009081526001602052604090205490565b60025460009033600160a060020a0390811691161461076e57600080fd5b6004805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b60025433600160a060020a039081169116146107c857600080fd5b600254600160a060020a0316ff5b600254600160a060020a031681565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103f45780601f106103c9576101008083540402835291602001916103f4565b600160a060020a033316600090815260016020526040812054610879908363ffffffff6109a616565b600160a060020a0333811660009081526001602052604080822093909355908516815220546108ae908363ffffffff61099016565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60025433600160a060020a0390811691161461095557600080fd5b600160a060020a0381161561098d576002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60008282018381101561099f57fe5b9392505050565b6000828211156109b257fe5b509003905600a165627a7a72305820bf5f54140692199ee632c449298ea39c49f526970017f7a5f4790578f182df5d00290000000000000000000000000072c6415107ac515041fbbc7ba224c5c31c45b9

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

-----Decoded View---------------
Found 1 constructor arguments :
Arg [0] : 0000000000000000000000000072C6415107aC515041fbBc7BA224c5c31C45b9


   Swarm Source:
bzzr://bf5f54140692199ee632c449298ea39c49f526970017f7a5f4790578f182df5d

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.