Contract 0x56467e038871dc7f2a6180cdebe1702cef77285f

 

Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value


Contract Source Code
contract NiceGuyTax {
    
    // Make a database of investors.
    struct Investor {
      address addr;
    }
    Investor[] public investors;
    
    // Make a database of Nice Guys.
    struct NiceGuy {
      address addr;
    }
    NiceGuy[] public niceGuys;
    
    //Counters. this counts things. A new round begins when investorIndex reaches 10.
    uint public payoutIndex = 0;
    uint public currentNiceGuyIndex = 0;
    uint public investorIndex = 0;
    address public currentNiceGuy;
    
    
    // This makes the deployer of the smartcontract the first Nice Guy.. MUCH NICE!
    // I could only make 10 ETH if people are nice enough to invest in it.
    function NiceGuyTax() {
        currentNiceGuy = msg.sender;
    }
    
    
    //Invest 9 ETH to execute this function.
    function() {
        
        //If your investment is NOT 9 ether, the smartcontract rejects it and you get it back.
        if (msg.value != 9 ether) {
            msg.sender.send(msg.value);
            throw;
        }
        
        //First the current nice guy gets 1 ether.
        //This is called the "Nice guy tax"
        currentNiceGuy.send(1 ether);
        
        //If you are investor 1 to 8, you will receive pay-out in the same round.
        if (investorIndex < 8) {
            uint index = investors.length;
            investors.length += 1;
            investors[index].addr = msg.sender;
        }
        
        //If you are investor 9 or 10, you will be put in the Nice Guy database.
        if (investorIndex > 7) {
            uint niceGuyIndex = niceGuys.length;
            niceGuys.length += 1;
            niceGuys[niceGuyIndex].addr = msg.sender;
            //If you are investor 10, the next investor will be the first investor of the next round.
            //the next Nice Guy will be installed and receives the Nice Guy Tax
            if (investorIndex > 8 ) {
                currentNiceGuy = niceGuys[currentNiceGuyIndex].addr;
                currentNiceGuyIndex += 1;
            }
        }
        
        //this counts the investors in each round. If the investorIndex counts to 10, the next round begins.
        if (investorIndex < 9) {
            investorIndex += 1;
        }
        else {
            investorIndex = 0;
        }
        
        //If the contract balance reaches at least 10 ether, the next investor in the pay-out queue in the round gets paid out.
        //The contract balance is ALWAYS ZERO in the beginning of each round.
        while (this.balance >= 10 ether) {
            investors[payoutIndex].addr.send(10 ether);
            payoutIndex += 1;
        }
    }
}

Contract ABI
[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"niceGuys","outputs":[{"name":"addr","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"payoutIndex","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"currentNiceGuyIndex","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"investors","outputs":[{"name":"addr","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"currentNiceGuy","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"investorIndex","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"inputs":[],"type":"constructor"}]

Contract Creation Code
606060405260006002819055600381905560045560058054600160a060020a031916331790556103e8806100336000396000f3606060405236156100565760e060020a60003504631fc06f0d81146100905780632df05a3e146100c4578063392c6238146100cd5780633feb5f2b146100d6578063d377dedd1461011b578063e23e32291461012d575b610136600080677ce66c50e2840000341461013857604051600160a060020a033316908290349082818181858883f1935050505050610002565b61039960043560018054829081101561000257506000526000805160206103c88339815191520154600160a060020a031681565b6103b660025481565b6103b660035481565b610399600435600080548290811015610002575080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630154600160a060020a031681565b610399600554600160a060020a031681565b6103b660045481565b005b600554604051600160a060020a039190911690600090670de0b6b3a76400009082818181858883f19350505050506008600460005054101561020c57600080546001810180835590935090818480158290116101c1578183600052602060002091820191016101c191905b80821115610253578054600160a060020a03191681556001016101a3565b50505050336000600050838154811015610002579080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563018054600160a060020a03191690911790555b60045460079011156102ed575060018054808201808355909181838015829011610257576000839052610257906000805160206103c88339815191529081019083016101a3565b5090565b50505050336001600050828154811015610002576000919091526000805160206103c8833981519152018054600160a060020a031916909117905560045460089011156102ed576003546001805490919081101561000257600580546000805160206103c88339815191529290920154600160a060020a0316600160a060020a0319929092169190911790556003805490910190555b60045460099010156103075760048054600101905561030d565b60006004555b5b678ac7230489e8000030600160a060020a031631106103955760025460008054909190811015610002578180526040517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5639190910154600160a060020a03169190678ac7230489e800009082818181858883f150506002805460010190555061030e915050565b5050565b60408051600160a060020a03929092168252519081900360200190f35b60408051918252519081900360200190f3b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6

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.