ETH Price: $2,741.90 (-0.00%)

Contract

0x5B399540A3Cd4c6Cc017BEc2b9e29Eb008390aFc
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Finish57892722018-06-14 20:12:482443 days ago1529007168IN
0x5B399540...008390aFc
0 ETH0.000153487
Finish57877642018-06-14 14:03:372443 days ago1528985017IN
0x5B399540...008390aFc
0 ETH0.03612
Finish57877082018-06-14 13:46:052443 days ago1528983965IN
0x5B399540...008390aFc
0 ETH0.000453796
Transfer46192082017-11-25 11:59:472644 days ago1511611187IN
0x5B399540...008390aFc
0.01 ETH0.000421525
Set Betting Cond...46170222017-11-25 3:34:362645 days ago1511580876IN
0x5B399540...008390aFc
0 ETH0.000131484

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
57877082018-06-14 13:46:052443 days ago1528983965
0x5B399540...008390aFc
0.0001 ETH
57877082018-06-14 13:46:052443 days ago1528983965
0x5B399540...008390aFc
0.0099 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x4403e150...C9f58fC34
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
simplelottery

Compiler Version
v0.4.11+commit.68ef5810

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2017-11-25
*/

pragma solidity ^0.4.11;
contract simplelottery {
    enum State { Started, Locked }
    State public state = State.Started;
    struct Guess{
      address addr;
      //uint    guess;
    }
    uint arraysize=1000;
    uint constant maxguess=1000000;
    uint bettingprice = 1 ether;
    Guess[1000] guesses;
    uint    numguesses = 0;
    bytes32 curhash = '';
    uint _gameindex = 1;
    uint _starttime = 0;
    modifier inState(State _state) {
      require(state == _state);
      _;
    }
    address developer = 0x0;
    address _winner   = 0x0;
    event SentPrizeToWinner(address winner, uint money, uint gameindex, uint lotterynumber, uint starttime, uint finishtime);
    event SentDeveloperFee(uint amount, uint balance);
    
    function simplelottery() 
    {
      if(developer==address(0)){
        developer = msg.sender;
        state = State.Started;
        _starttime = block.timestamp;
      }
    }
    
    function setBettingCondition(uint _contenders, uint _bettingprice)
    {
      if(msg.sender != developer)
        return;
      arraysize  = _contenders;
      if(arraysize>1000)
        arraysize = 1000;
      bettingprice = _bettingprice;
    }
    
    function findWinner(uint value)
    {
      uint i = value % numguesses;
      _winner = guesses[i].addr;
    }
    
      function getMaxContenders() constant returns(uint){
      return arraysize;
    }

    function getBettingPrice() constant returns(uint){
      return bettingprice;
    }

    function getDeveloperAddress() constant returns(address)
    {
      return developer;
    }
    
    function getDeveloperFee() constant returns(uint)
    {
      uint developerfee = this.balance/100;
      return developerfee;
    }
    
    function getBalance() constant returns(uint)
    {
       return this.balance;
    }
    
    function getLotteryMoney() constant returns(uint)
    {
      uint developerfee = getDeveloperFee();
      uint prize = (this.balance - developerfee);
      return prize;
    }

    function getBettingStatus()
      constant
      returns (uint, uint, uint, uint, uint, uint, uint)
    {
      return ((uint)(state), _gameindex, _starttime, numguesses, getLotteryMoney(), this.balance, bettingprice);
    }



    function finish()
    {
      if(msg.sender != developer)
        return;
      _finish();
    }
    
    function _finish() private
    {
      state = State.Locked;
      uint block_timestamp = block.timestamp;
      uint lotterynumber = (uint(curhash)+block_timestamp)%(maxguess+1);
      findWinner(lotterynumber);
      uint prize = getLotteryMoney();
      uint numwinners = 1;
      uint remain = this.balance - (prize*numwinners);

      _winner.transfer(prize);
      SentPrizeToWinner(_winner, prize, _gameindex, lotterynumber, _starttime, block_timestamp);

      // give delveoper the money left behind
      developer.transfer(remain); 
      SentDeveloperFee(remain, this.balance);
      numguesses = 0;
      _gameindex++;
      state = State.Started;
      _starttime = block.timestamp;
    }
    
    function () payable
    {
        _addguess();
    }

    function addguess() 
      inState(State.Started)
      payable
    {
      _addguess();
    }
    
    function _addguess() private
      inState(State.Started)
    {
      require(msg.value >= bettingprice);
      curhash = sha256(block.timestamp, block.coinbase, block.difficulty, curhash);
      if((uint)(numguesses+1)<=arraysize) {
        guesses[numguesses++].addr = msg.sender;
        if((uint)(numguesses)>=arraysize){
          _finish();
        }
      }
    }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"findWinner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getBettingStatus","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getDeveloperAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getMaxContenders","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getBettingPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getDeveloperFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getLotteryMoney","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_contenders","type":"uint256"},{"name":"_bettingprice","type":"uint256"}],"name":"setBettingCondition","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"addguess","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"state","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finish","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"winner","type":"address"},{"indexed":false,"name":"money","type":"uint256"},{"indexed":false,"name":"gameindex","type":"uint256"},{"indexed":false,"name":"lotterynumber","type":"uint256"},{"indexed":false,"name":"starttime","type":"uint256"},{"indexed":false,"name":"finishtime","type":"uint256"}],"name":"SentPrizeToWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"balance","type":"uint256"}],"name":"SentDeveloperFee","type":"event"}]

Deployed Bytecode

0x606060405236156100b8576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305e49d1d146100c957806312065fe0146100e9578063179dfbf31461010f57806322a27f3b1461015f5780633bee8726146101b157806371b804ee146101d757806377482b18146101fd5780637842aded146102235780637847352a146102495780638f701eaa14610272578063c19d93fb1461027c578063d56b2889146102b0575b6100c75b6100c46102c2565b5b565b005b34156100d157fe5b6100e76004808035906020019091905050610445565b005b34156100f157fe5b6100f96104d7565b6040518082815260200191505060405180910390f35b341561011757fe5b61011f6104f7565b6040518088815260200187815260200186815260200185815260200184815260200183815260200182815260200197505050505050505060405180910390f35b341561016757fe5b61016f610567565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101b957fe5b6101c1610593565b6040518082815260200191505060405180910390f35b34156101df57fe5b6101e761059e565b6040518082815260200191505060405180910390f35b341561020557fe5b61020d6105a9565b6040518082815260200191505060405180910390f35b341561022b57fe5b6102336105db565b6040518082815260200191505060405180910390f35b341561025157fe5b6102706004808035906020019091908035906020019091905050610610565b005b61027a610696565b005b341561028457fe5b61028c6106d9565b6040518082600181111561029c57fe5b60ff16815260200191505060405180910390f35b34156102b857fe5b6102c06106ec565b005b60008060018111156102d057fe5b600060009054906101000a900460ff1660018111156102eb57fe5b1415156102f85760006000fd5b600254341015151561030a5760006000fd5b60024241446103ec54600060405160200152604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401838152602001826000191660001916815260200194505050505060206040518083038160008661646e5a03f1151561039b57fe5b5050604051805190506103ec816000191690555060015460016103eb5401111515610440573360036103eb6000815480929190600101919050556103e8811015156103e257fe5b0160005b5060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001546103eb5410151561043f5761043e610754565b5b5b5b5b50565b60006103eb548281151561045557fe5b0690506003816103e88110151561046857fe5b0160005b5060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166103f060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5050565b60003073ffffffffffffffffffffffffffffffffffffffff163190505b90565b6000600060006000600060006000600060009054906101000a900460ff16600181111561052057fe5b6103ed546103ee546103eb546105346105db565b3073ffffffffffffffffffffffffffffffffffffffff163160025496509650965096509650965096505b90919293949596565b60006103ef60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b90565b600060015490505b90565b600060025490505b90565b6000600060643073ffffffffffffffffffffffffffffffffffffffff16318115156105d057fe5b0490508091505b5090565b6000600060006105e96105a9565b9150813073ffffffffffffffffffffffffffffffffffffffff16310390508092505b505090565b6103ef60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561066d57610692565b816001819055506103e8600154111561068a576103e86001819055505b806002819055505b5050565b60008060018111156106a457fe5b600060009054906101000a900460ff1660018111156106bf57fe5b1415156106cc5760006000fd5b6106d46102c2565b5b5b50565b600060009054906101000a900460ff1681565b6103ef60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561074957610752565b610751610754565b5b565b600060006000600060006001600060006101000a81548160ff0219169083600181111561077d57fe5b02179055504294506001620f424001856103ec54600190040181151561079f57fe5b0693506107ab84610445565b6107b36105db565b9250600191508183023073ffffffffffffffffffffffffffffffffffffffff16310390506103f060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051809050600060405180830381858888f19350505050151561083a57fe5b7f16772b6ac3e9823e1f39326dbe356dac767fad821f4a2af003066838235e1bbd6103f060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846103ed54876103ee548a604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001868152602001858152602001848152602001838152602001828152602001965050505050505060405180910390a16103ef60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051809050600060405180830381858888f19350505050151561095157fe5b7ff758ff59202247fe26bd4bd951f620cf543dc36b500de667d055cb5816def873813073ffffffffffffffffffffffffffffffffffffffff1631604051808381526020018281526020019250505060405180910390a160006103eb819055506103ed600081548092919060010191905055506000600060006101000a81548160ff021916908360018111156109e257fe5b0217905550426103ee819055505b50505050505600a165627a7a723058209e8490a5179c96c678f45d2721d5eb2862af3bb9793d35cd13251dd702226f9c0029

Swarm Source

bzzr://9e8490a5179c96c678f45d2721d5eb2862af3bb9793d35cd13251dd702226f9c

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.