Contract Overview
Balance: 0 Ether
Transactions: 1 txn
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Warning: The compiled contract might be susceptible to EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) Solidity compiler bugs.

Contract Source Code Verified (Exact match)
Contract Name: IamRich
Compiler Version: v0.4.19+commit.c4cbbb05
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.16;

contract owned {
    address public owner;

    function owned() public {
        owner = msg.sender;
    }

    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    function transferOwnership(address newOwner) onlyOwner public {
        owner = newOwner;
    }
}

interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }

contract TokenERC20 {
    // Public variables of the token
	string public constant name = "I am RICH";
    string public constant symbol = "RICH";
    uint8 public constant decimals = 6;
    // 18 decimals is the strongly suggested default, avoid changing it
    uint256 public totalSupply;

    // This creates an array with all balances
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;

    // This generates a public event on the blockchain that will notify clients
    event Transfer(address indexed from, address indexed to, uint256 value);

    // This notifies clients about the amount burnt
    event Burn(address indexed from, uint256 value);

    /**
     * Constrctor function
     *
     * Initializes contract with initial supply tokens to the creator of the contract
     */
    function TokenERC20( ) public {
        totalSupply = 100000 * 10 ** uint256(decimals);  // Update total supply with the decimal amount
        balanceOf[msg.sender] = totalSupply;                // Give the creator all initial tokens
    }

    /**
     * Internal transfer, only can be called by this contract
     */
    function _transfer(address _from, address _to, uint256 _value) internal {
        // Prevent transfer to 0x0 address. Use burn() instead
        require(_to != 0x0);
        // Check if the sender has enough
        require(balanceOf[_from] >= _value);
        // Check for overflows
        require(balanceOf[_to] + _value > balanceOf[_to]);
        // Save this for an assertion in the future
        uint previousBalances = balanceOf[_from] + balanceOf[_to];
        // Subtract from the sender
        balanceOf[_from] -= _value;
        // Add the same to the recipient
        balanceOf[_to] += _value;
        Transfer(_from, _to, _value);
        // Asserts are used to use static analysis to find bugs in your code. They should never fail
        assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
    }

    /**
     * Transfer tokens
     *
     * Send `_value` tokens to `_to` from your account
     *
     * @param _to The address of the recipient
     * @param _value the amount to send
     */
    function transfer(address _to, uint256 _value) public {
        _transfer(msg.sender, _to, _value);
    }

    /**
     * Transfer tokens from other address
     *
     * Send `_value` tokens to `_to` in behalf of `_from`
     *
     * @param _from The address of the sender
     * @param _to The address of the recipient
     * @param _value the amount to send
     */
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowance[_from][msg.sender]);     // Check allowance
        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }

    /**
     * Set allowance for other address
     *
     * Allows `_spender` to spend no more than `_value` tokens in your behalf
     *
     * @param _spender The address authorized to spend
     * @param _value the max amount they can spend
     */
    function approve(address _spender, uint256 _value) public
        returns (bool success) {
        allowance[msg.sender][_spender] = _value;
        return true;
    }

    /**
     * Set allowance for other address and notify
     *
     * Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
     *
     * @param _spender The address authorized to spend
     * @param _value the max amount they can spend
     * @param _extraData some extra information to send to the approved contract
     */
    function approveAndCall(address _spender, uint256 _value, bytes _extraData)
        public
        returns (bool success) {
        tokenRecipient spender = tokenRecipient(_spender);
        if (approve(_spender, _value)) {
            spender.receiveApproval(msg.sender, _value, this, _extraData);
            return true;
        }
    }

    /**
     * Destroy tokens
     *
     * Remove `_value` tokens from the system irreversibly
     *
     * @param _value the amount of money to burn
     */
    function burn(uint256 _value) public returns (bool success) {
        require(balanceOf[msg.sender] >= _value);   // Check if the sender has enough
        balanceOf[msg.sender] -= _value;            // Subtract from the sender
        totalSupply -= _value;                      // Updates totalSupply
        Burn(msg.sender, _value);
        return true;
    }

    /**
     * Destroy tokens from other account
     *
     * Remove `_value` tokens from the system irreversibly on behalf of `_from`.
     *
     * @param _from the address of the sender
     * @param _value the amount of money to burn
     */
    function burnFrom(address _from, uint256 _value) public returns (bool success) {
        require(balanceOf[_from] >= _value);                // Check if the targeted balance is enough
        require(_value <= allowance[_from][msg.sender]);    // Check allowance
        balanceOf[_from] -= _value;                         // Subtract from the targeted balance
        allowance[_from][msg.sender] -= _value;             // Subtract from the sender's allowance
        totalSupply -= _value;                              // Update totalSupply
        Burn(_from, _value);
        return true;
    }
}

/******************************************/
/*       ADVANCED TOKEN STARTS HERE       */
/******************************************/

contract IamRich is owned, TokenERC20 {

    uint256 public buyPrice = 10 * 1 ether; //10 eth

    uint public boughtNum = 0;
    /* Initializes contract with initial supply tokens to the creator of the contract */
    function IamRich() TokenERC20() public {}

	function () payable public {
        uint amount = (msg.value  * (10 ** uint256(decimals))) / buyPrice; 
        boughtNum++;
        _transfer(owner, msg.sender, amount);              // makes the transfers
    }
		
	
    /* Internal transfer, only can be called by this contract */
    function _transfer(address _from, address _to, uint256 _value) internal {
        require (_to != 0x0);                               // Prevent transfer to 0x0 address. Use burn() instead
        require (balanceOf[_from] >= _value);               // Check if the sender has enough
        require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
        balanceOf[_from] -= _value;                         // Subtract from the sender
        balanceOf[_to] += _value;                           // Add the same to the recipient
        Transfer(_from, _to, _value);
    }

    /// @notice Create `mintedAmount` tokens and send it to `target`
    /// @param target Address to receive the tokens
    /// @param mintedAmount the amount of tokens it will receive
    function mintToken(address target, uint256 mintedAmount) onlyOwner public {
        balanceOf[target] += mintedAmount;
        totalSupply += mintedAmount;
        Transfer(0, owner, mintedAmount);
        Transfer(owner, target, mintedAmount);
    }

    /// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
    /// @param newBuyPrice Price users can buy from the contract
    function setPrices(uint256 newBuyPrice) onlyOwner public {
        buyPrice = newBuyPrice;
    }
	

    /// @notice Buy tokens from contract by sending ether
    function buy() payable public {
        uint amount = (msg.value  * (10 ** uint256(decimals))) / buyPrice; 
        _transfer(owner, msg.sender, amount);              // makes the transfers
    }
	
	function kill() onlyOwner public {
        if (msg.sender == owner)
        selfdestruct(owner);
    }
	
	function donate(uint amount) payable onlyOwner public
	{
		if (msg.sender == owner) msg.sender.transfer(amount * 0.1 ether);  
	}

  
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"target","type":"address"},{"name":"mintedAmount","type":"uint256"}],"name":"mintToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"}],"name":"burnFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"buyPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newBuyPrice","type":"uint256"}],"name":"setPrices","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"boughtNum","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"donate","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","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":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052678ac7230489e800006004556000600555341561002057600080fd5b60008054600160a060020a033316600160a060020a03199091168117825564174876e80060018190559082526002602052604090912055610b93806100666000396000f30060606040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610159578063095ea7b3146101e357806318160ddd1461021957806323b872dd1461023e578063313ce5671461026657806341c0e1b51461028f57806342966c68146102a457806370a08231146102ba57806379c65068146102d957806379cc6790146102fb5780638620410b1461031d5780638da5cb5b1461033057806395d89b411461035f578063a3201daa14610372578063a6f2ae3a14610388578063a9059cbb14610390578063cae9ca51146103b2578063dd62ed3e14610417578063f1018c6f1461043c578063f14faf6f1461044f578063f2fde38b1461045a575b60045460009034620f42400281151561013157fe5b600580546001019055600054919004915061015690600160a060020a03163383610479565b50005b341561016457600080fd5b61016c610544565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a8578082015183820152602001610190565b50505050905090810190601f1680156101d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ee57600080fd5b610205600160a060020a036004351660243561057b565b604051901515815260200160405180910390f35b341561022457600080fd5b61022c6105ab565b60405190815260200160405180910390f35b341561024957600080fd5b610205600160a060020a03600435811690602435166044356105b1565b341561027157600080fd5b610279610628565b60405160ff909116815260200160405180910390f35b341561029a57600080fd5b6102a261062d565b005b34156102af57600080fd5b61020560043561066f565b34156102c557600080fd5b61022c600160a060020a03600435166106fa565b34156102e457600080fd5b6102a2600160a060020a036004351660243561070c565b341561030657600080fd5b610205600160a060020a03600435166024356107cf565b341561032857600080fd5b61022c6108ab565b341561033b57600080fd5b6103436108b1565b604051600160a060020a03909116815260200160405180910390f35b341561036a57600080fd5b61016c6108c0565b341561037d57600080fd5b6102a26004356108f7565b6102a2610917565b341561039b57600080fd5b6102a2600160a060020a036004351660243561094b565b34156103bd57600080fd5b61020560048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061095a95505050505050565b341561042257600080fd5b61022c600160a060020a0360043581169060243516610a8c565b341561044757600080fd5b61022c610aa9565b6102a2600435610aaf565b341561046557600080fd5b6102a2600160a060020a0360043516610b1d565b600160a060020a038216151561048e57600080fd5b600160a060020a038316600090815260026020526040902054819010156104b457600080fd5b600160a060020a038216600090815260026020526040902054818101116104da57600080fd5b600160a060020a038084166000818152600260205260408082208054869003905592851680825290839020805485019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a3505050565b60408051908101604052600981527f4920616d20524943480000000000000000000000000000000000000000000000602082015281565b600160a060020a033381166000908152600360209081526040808320938616835292905220819055600192915050565b60015481565b600160a060020a038084166000908152600360209081526040808320339094168352929052908120548211156105e657600080fd5b600160a060020a038085166000908152600360209081526040808320339094168352929052208054839003905561061e848484610479565b5060019392505050565b600681565b60005433600160a060020a0390811691161461064857600080fd5b60005433600160a060020a039081169116141561066d57600054600160a060020a0316ff5b565b600160a060020a0333166000908152600260205260408120548290101561069557600080fd5b600160a060020a03331660008181526002602052604090819020805485900390556001805485900390557fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a2506001919050565b60026020526000908152604090205481565b60005433600160a060020a0390811691161461072757600080fd5b600160a060020a0380831660009081526002602052604080822080548501905560018054850190558154909216917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a3600054600160a060020a0380841691167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a35050565b600160a060020a038216600090815260026020526040812054829010156107f557600080fd5b600160a060020a038084166000908152600360209081526040808320339094168352929052205482111561082857600080fd5b600160a060020a038084166000818152600260209081526040808320805488900390556003825280832033909516835293905282902080548590039055600180548590039055907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a250600192915050565b60045481565b600054600160a060020a031681565b60408051908101604052600481527f5249434800000000000000000000000000000000000000000000000000000000602082015281565b60005433600160a060020a0390811691161461091257600080fd5b600455565b60045460009034620f42400281151561092c57fe5b600054919004915061094890600160a060020a03163383610479565b50565b610956338383610479565b5050565b600083610967818561057b565b15610a845780600160a060020a0316638f4ffcb1338630876040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a1d578082015183820152602001610a05565b50505050905090810190601f168015610a4a5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610a6b57600080fd5b6102c65a03f11515610a7c57600080fd5b505050600191505b509392505050565b600360209081526000928352604080842090915290825290205481565b60055481565b60005433600160a060020a03908116911614610aca57600080fd5b60005433600160a060020a039081169116141561094857600160a060020a03331667016345785d8a0000820280156108fc0290604051600060405180830381858888f19350505050151561094857600080fd5b60005433600160a060020a03908116911614610b3857600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a723058209da003da8a7c3530d06fc5495ebe327be6e80880b555e2cb4eb52ccecd72ddd80029

   Swarm Source:
bzzr://9da003da8a7c3530d06fc5495ebe327be6e80880b555e2cb4eb52ccecd72ddd8

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward