Contract 0xB9ea8Df7360a6931d162C014F69C42975DBE6054

 

TxHash Block Age From To Value [TxFee]
0x46b19db1d181022ba3b9486ef16f669d3c7ef09499ca2ac63c3a1869ce4e0e9d4802979446 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.0011066
0x615379d3892db4c2fd26d12c05e9762853c9b8fef21ab831ccdd626cb8ab14c54802935446 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.00110925
0xd1d4c3ef286350f40ac19c52464af18eca121c87166695f5eb369d0a53f7f68b4790976448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002740647
0x9ab25976f8dd5f2c620cc532345d75729028d3f8bd73301e83c00f65434580e74790962448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002740647
0xfd9294c2786b03aee6914eca3c6c522c6ea7f91077327c40b7803935af2b50d54790959448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002425647
0xbace1f9f8baf9ad9258f04fa9b5a1c70d6858a506c0af1ef53259e861db6059b4790957448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002425647
0x0ff13592b0231a4fd563d5071f257e9c38a3947ed384ba84c9e69db3cbcde2344790955448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002425647
0x20d237978f6cf14db0811272bade071c57a9da39cb0a1f42cc62750331c011b84790951448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002425647
0x1962a4d9191d0154a45c2d839c92cafaa4661650214cb2764c9b4b4d637607494790919448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002740647
0x0173d0c6503b704a27f61326221f5e5c52276231b5defadda553daf22c622d0f4790886448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002740647
0xab5c19aaeed4799db6a4d85074afc07f11ec17248c78819d010317dc42acac7c4790877448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  0xb9ea8df7360a6931d162c014f69c42975dbe60540 Ether0.002740647
0x82988fc3526875c11f9a93eb6b51496817fbb117f0e09c13f2249ed01999a7064790865448 days 17 hrs ago0x7d5de55b7aab2a9873e8754a88d78c433dfdfa51 IN  Contract Creation0 Ether0.016329999
[ Download CSV Export 

Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: SatanCoinRaffle
Compiler Version: v0.4.19+commit.c4cbbb05
Optimization Enabled: No
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.14;

contract Random {
  uint64 _seed = 0;

  // return a pseudo random number between lower and upper bounds
  // given the number of previous blocks it should hash.
  function random(uint64 upper) public returns (uint64 randomNumber) {
    _seed = uint64(sha3(sha3(block.blockhash(block.number), _seed), now));
    return _seed % upper;
  }
}

//This contract is written as a fix for the SatanCoin contract's raffle functionality
//The winning index of every round will be randomly generated here. Remaining SATAN coins will then be manually issued based on the results.
//The SatanCoin contract itself is located here: https://etherscan.io/address/0xCCcA48874780f9c42b162c9617bC6324c5142C22

contract SatanCoinRaffle {
    
   // address public constant satanCoinAddress = 0xCCcA48874780f9c42b162c9617bC6324c5142C22;
  address public constant randomAddress = 0x0230CfC895646d34538aE5b684d76Bf40a8B8B89;
  
    address public owner;
    
    Random public rand;
    
    struct RoundResults {
        uint roundNum;
        uint raffleAmount;
        bool raffleComplete;
        uint winnerIndex;
        address winner;
    }
    
    RoundResults[9] public roundResults;
    
    event RandomNumGenerated(uint64 _randomNum);
    event RoundSet(uint64 _coinNumBought, address );
    event RaffleIssued(uint _roundNumber, uint _amountWon, uint _winnerIndex);
    event WinnerSet(uint _roundNumber, uint _winnerIndex, address winner);
    
    modifier onlyOwner {
      require(msg.sender == owner);
      _;
    }

    
    function SatanCoinRaffle () {
        
      owner = msg.sender;

      rand = Random(randomAddress);
      
    }
   
   function random (uint64 upper) 
        private
        returns (uint64)
    {
    //uses random contract: https://etherscan.io/address/0x0230CfC895646d34538aE5b684d76Bf40a8B8B89
    // https://www.npmjs.com/package/eth-random
      uint64 randomNum = rand.random(upper);
      
      RandomNumGenerated(randomNum);
      
      return randomNum;
   }
   
   function setRound(uint roundNum, uint raffleAmount)
        public
        onlyOwner
   {
       require(roundNum < 9 && roundNum > 0);
       require(raffleAmount < 74 && raffleAmount > 0);
       require(!roundResults[roundNum-1].raffleComplete);
       
       roundResults[roundNum-1] = RoundResults(roundNum, raffleAmount, false, 0, address(0));
       
       assert(raffle(roundNum));
     
   }
   
   function setWinner(uint roundNum, address winner)
        public
        onlyOwner
        returns (bool)
   {
       require(roundNum < 9 && roundNum > 0);
       //the raffle must have already been run
       require(roundResults[roundNum-1].raffleComplete);
       //can only set winner once
       require(roundResults[roundNum-1].winner == address(0));
       
       /* winner address is set manually based on the winningIndex using the transaction history of the SatanCoin contract. 
       results may be compared with the contract itself here: https://etherscan.io/address/0xCCcA48874780f9c42b162c9617bC6324c5142C22 */
       roundResults[roundNum-1].winner = winner;
       WinnerSet(roundNum, roundResults[roundNum-1].winnerIndex, roundResults[roundNum-1].winner);
       
       return true;
   }
   
   function raffle (uint roundNum)
        internal
        returns (bool)
    {
        require(roundNum < 9 && roundNum > 0);
        //can only run a raffle once
        require(!roundResults[roundNum-1].raffleComplete);

       //the winning index is generated by random number
       roundResults[roundNum-1].winnerIndex = random(uint64(74-roundResults[roundNum-1].raffleAmount));
       roundResults[roundNum-1].raffleComplete = true;
       
       RaffleIssued(roundNum, roundResults[roundNum-1].raffleAmount, roundResults[roundNum-1].winnerIndex);
       return true;
    }
   
   
}

Contract ABI
[{"constant":true,"inputs":[],"name":"rand","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"roundNum","type":"uint256"},{"name":"raffleAmount","type":"uint256"}],"name":"setRound","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":"roundNum","type":"uint256"},{"name":"winner","type":"address"}],"name":"setWinner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"roundResults","outputs":[{"name":"roundNum","type":"uint256"},{"name":"raffleAmount","type":"uint256"},{"name":"raffleComplete","type":"bool"},{"name":"winnerIndex","type":"uint256"},{"name":"winner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"randomAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_randomNum","type":"uint64"}],"name":"RandomNumGenerated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_coinNumBought","type":"uint64"},{"indexed":false,"name":"","type":"address"}],"name":"RoundSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_roundNumber","type":"uint256"},{"indexed":false,"name":"_amountWon","type":"uint256"},{"indexed":false,"name":"_winnerIndex","type":"uint256"}],"name":"RaffleIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_roundNumber","type":"uint256"},{"indexed":false,"name":"_winnerIndex","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"WinnerSet","type":"event"}]

Contract Creation Code
6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550730230cfc895646d34538ae5b684d76bf40a8b8b89600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506109ec806100b36000396000f300606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633b3dca761461007d57806382ba614f146100d25780638da5cb5b146100fe5780639c62368314610153578063ac128f4f146101ad578063d5bee9f514610230575b600080fd5b341561008857600080fd5b610090610285565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100dd57600080fd5b6100fc60048080359060200190919080359060200190919050506102ab565b005b341561010957600080fd5b610111610465565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015e57600080fd5b610193600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061048a565b604051808215151515815260200191505060405180910390f35b34156101b857600080fd5b6101ce60048080359060200190919050506106cf565b60405180868152602001858152602001841515151581526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390f35b341561023b57600080fd5b610243610737565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561030657600080fd5b6009821080156103165750600082115b151561032157600080fd5b604a811080156103315750600081115b151561033c57600080fd5b60026001830360098110151561034e57fe5b6005020160020160009054906101000a900460ff1615151561036f57600080fd5b60a06040519081016040528083815260200182815260200160001515815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152506002600184036009811015156103c457fe5b60050201600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055506060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050506104598261074f565b151561046157fe5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104e757600080fd5b6009831080156104f75750600083115b151561050257600080fd5b60026001840360098110151561051457fe5b6005020160020160009054906101000a900460ff16151561053457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff1660026001850360098110151561055e57fe5b6005020160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156105a857600080fd5b816002600185036009811015156105bb57fe5b6005020160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fb7b2bbc07dcabe570d80f4135646f67d280d4b0757d55343b6863d4f5b145f378360026001860360098110151561063457fe5b600502016003015460026001870360098110151561064e57fe5b6005020160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a16001905092915050565b6002816009811015156106de57fe5b600502016000915090508060000154908060010154908060020160009054906101000a900460ff16908060030154908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905085565b730230cfc895646d34538ae5b684d76bf40a8b8b8981565b60006009821080156107615750600082115b151561076c57600080fd5b60026001830360098110151561077e57fe5b6005020160020160009054906101000a900460ff1615151561079f57600080fd5b6107c46002600184036009811015156107b457fe5b6005020160010154604a0361089f565b67ffffffffffffffff166002600184036009811015156107e057fe5b600502016003018190555060016002600184036009811015156107ff57fe5b6005020160020160006101000a81548160ff0219169083151502179055507f6a3f79f4952febc33b56db8421b3bff1d07ba456d1ec73592a81e1d3ab60f40b8260026001850360098110151561085157fe5b600502016001015460026001860360098110151561086b57fe5b600502016003015460405180848152602001838152602001828152602001935050505060405180910390a160019050919050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631a1a7993846000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561094f57600080fd5b6102c65a03f1151561096057600080fd5b5050506040518051905090507feabd11afa921d648437f4959b619ff3a3c938cf751513c7e3ffb741ae95897c981604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390a1809150509190505600a165627a7a72305820f4f43eac61a6328d6ea00cbb65113488fdf50be129880c66810d300c19e6c2bc0029


   Swarm Source:
bzzr://f4f43eac61a6328d6ea00cbb65113488fdf50be129880c66810d300c19e6c2bc
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.