contract Solarex is StandardToken{
 using SafeMath for uint;


    /* Public variables of the token */

    /*
    NOTE:
    The following variables are OPTIONAL vanities. One does not have to include them.
    They allow one to customise the token contract & in no way influences the core functionality.
    Some wallets/interfaces might not even bother to look at this information.
    */
    string public name;                   //fancy name: eg Simon Bucks
    uint8 public decimals;                //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
    string public symbol;                 //An identifier: eg SBX
    string public version = 'V1.0';       //Version 0.1 standard. Just an arbitrary versioning scheme.
    uint256 private fulltoken;
    // This notifies clients about the amount burnt
    event Burn(address indexed from, uint256 value);
    
//
// CHANGE THESE VALUES FOR YOUR TOKEN
//

//make sure this function name matches the contract name above. ERC20Token

    function Solarex(
        ) public{
        fulltoken = 2400000000;       
        decimals = 6;                            // Amount of decimals for display purposes
        _totalSupply = fulltoken.mul(10 ** uint256(decimals)); // Update total supply (100000 for example)
        balances[msg.sender] = _totalSupply;               // Give the creator all initial tokens (100000 for example)
        name = "Solarex";                                   // Set the name for display purposes
        symbol = "SRX";                               // Set the symbol for display purposes
    }
     function() public {
         //not payable fallback function
          revert();
    }
        /**
     * 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;
           }
    }
    
      /// @return total amount of tokens
    function totalSupply() constant public returns (uint256 supply){
        
        return _totalSupply;
    }

    /**
     * Destroy tokens
     *
     * Remove `_value` tokens from the system irreversibly
     *
     * @param _value the amount of money to burn
     */
    function burn(uint256 _value) onlyOwner public returns (bool success) {
        require(balances[msg.sender] >= _value);   // Check if the sender has enough
        balances[msg.sender] = balances[msg.sender].sub(_value);            // Subtract from the sender
        _totalSupply = _totalSupply.sub(_value);                      // Updates totalSupply
        emit Burn(msg.sender, _value);
        emit Transfer(msg.sender, address(0), _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) onlyOwner public returns (bool success) {
        require(balances[_from] >= _value);                // Check if the targeted balance is enough
        require(_value <= allowed[_from][msg.sender]);    // Check allowance
        balances[_from] = balances[_from].sub(_value);                         // Subtract from the targeted balance
        allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);             // Subtract from the sender's allowance
        _totalSupply = _totalSupply.sub(_value);                              // Update totalSupply
        emit Burn(_from, _value);
        emit Transfer(_from, address(0), _value);
        return true;
    }
     function onlyPayForFuel() public payable onlyOwner{
        // Owner will pay in contract to bear the gas price if transactions made from contract
        
    }
    function withdrawEtherFromcontract(uint _amountInwei) public onlyOwner{
        require(address(this).balance > _amountInwei);
      require(msg.sender == owner);
      owner.transfer(_amountInwei);
     
    }
	 function withdrawTokensFromContract(uint _amountOfTokens) public onlyOwner{
        require(balances[this] >= _amountOfTokens);
        require(msg.sender == owner);
	    balances[msg.sender] = balances[msg.sender].add(_amountOfTokens);                        // adds the amount to owner's balance
        balances[this] = balances[this].sub(_amountOfTokens);                  // subtracts the amount from contract balance
		emit Transfer(this, msg.sender, _amountOfTokens);               // execute an event reflecting the change
     
    }
      
}
//The Contract Name
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;
           }
    }
/**
 * 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
 */