contract TKCToken is StandardToken {
	/**
     * Boolean contract states
     */
	bool public preIco = false; //Pre-ico state
	
	address public owner = 0x0;

    function () {
        //if ether is sent to this address, send it back.
        throw;
    }

    string public name;
    uint8 public decimals;
    string public symbol;
    string public version = 'H1.0';

    function TKCToken() {
        balances[msg.sender] = 280000000000000;
        totalSupply = 280000000000000;
        name = "TKC";
        decimals = 6;
        symbol = "TKC";
		
		owner = msg.sender;
    }
	
	function price() returns (uint){
        return 1853;
    }
	
	function buy() public payable returns(bool) {
        processBuy(msg.sender, msg.value);

        return true;
    }

    function processBuy(address _to, uint256 _value) internal returns(bool) {
        require(_value>0);

        // Count expected tokens price
        uint tokens = _value * price();

        // Total tokens should be more than user want's to buy
        require(balances[owner]>tokens);

        // Add tokens to user balance and remove from totalSupply
        balances[_to] = safeAdd(balances[_to], tokens);
        // Remove sold tokens from total supply count
        balances[owner] = safeSub(balances[owner], tokens);

        // /* Emit log events */
        Transfer(owner, _to, tokens);

        return true;
    }
	
	function bounty(uint256 price) internal returns (uint256) {
		if (preIco) {
			return price + (price * 40/100);
        } else {
			return price + (price * 25/100);
        }
    }
	
	/**
     * Transfer bounty to target address from bounty pool
     */
	function sendBounty(address _to, uint256 _value) onlyOwner() {
        balances[_to] = safeAdd(balances[_to], _value);
        // /* Emit log events */
        Transfer(owner, _to, _value);
    }
	
    function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);

        if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
        return true;
    }
	
	/**
     * Pre-ico state.
     */
    function setPreIco() onlyOwner() {
        preIco = true;
    }

    function unPreIco() onlyOwner() {
        preIco = false;
    }

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

}
function sendBounty(address _to, uint256 _value) onlyOwner() {
       balances[_to] = safeAdd(balances[_to], _value);
       // /* Emit log events */
       Transfer(owner, _to, _value);
   }

/**
 * Transfer bounty to target address from bounty pool
 */