contract XRTToken is XRTStandards {

    uint256 public initialSupply;
    string public name;                   // Token Name
    uint8 public decimals;                // How many decimals to show. To be standard complicant keep it 18
    string public symbol;                 // An identifier: eg SBX, XPR etc..
    string public version; 
    uint256 public unitsOneEthCanBuy;     // How many units of your coin can be bought by 1 ETH?
    uint256 public totalEthInWei;         // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here.  
    address public fundsWallet;           // Where should the raised ETH go?

    // This is a constructor function 
    // which means the following function name has to match the contract name declared above
    function XRTToken(uint256 _initialSupply, string t_name, string t_symbol,string t_version, uint8 decimalsUnits,uint256 OneEthValue) public {
        initialSupply = _initialSupply;
        decimals = decimalsUnits;                                               // Amount of decimals for display purposes (CHANGE THIS)
        totalSupply = initialSupply*10**uint256(decimals);                        // Update total supply (1000 for example) (CHANGE THIS)
        balances[msg.sender] = totalSupply;               // Give the creator all initial tokens. This is set to 1000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS)
        name = t_name;                                   // Set the name for display purposes (CHANGE THIS)
        symbol = t_symbol;                                             // Set the symbol for display purposes (CHANGE THIS)
        unitsOneEthCanBuy = OneEthValue*10**uint256(decimals);                                    
        fundsWallet = msg.sender;
        version = t_version;                                  
    }

    function() payable{
        if (msg.value == 0) { return; }

        totalEthInWei = totalEthInWei + msg.value;
        uint256 amount = msg.value * unitsOneEthCanBuy;
        if (balances[fundsWallet] < amount) {
            return;
        }

        balances[fundsWallet] = balances[fundsWallet] - amount;
        balances[msg.sender] = balances[msg.sender] + amount;

        Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain

        //Transfer ether to fundsWallet
        fundsWallet.transfer(msg.value);                               
    }

    /* Approves and then calls the receiving contract */
    function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
        tokenRecipient spender = tokenRecipient(_spender);
        //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
        //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
        //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
        if(approve(_spender,_value)){
            require(_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
            return true;
        }    
    }
}
function XRTToken(uint256 _initialSupply, string t_name, string t_symbol,string t_version, uint8 decimalsUnits,uint256 OneEthValue) public {
    initialSupply = _initialSupply;
    decimals = decimalsUnits;                                               // Amount of decimals for display purposes (CHANGE THIS)
    totalSupply = initialSupply*10**uint256(decimals);                        // Update total supply (1000 for example) (CHANGE THIS)
    balances[msg.sender] = totalSupply;               // Give the creator all initial tokens. This is set to 1000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS)
    name = t_name;                                   // Set the name for display purposes (CHANGE THIS)
    symbol = t_symbol;                                             // Set the symbol for display purposes (CHANGE THIS)
    unitsOneEthCanBuy = OneEthValue*10**uint256(decimals);                                    
    fundsWallet = msg.sender;
    version = t_version;                                  
}

// Where should the raised ETH go?
// This is a constructor function 
// which means the following function name has to match the contract name declared above