contract REKT is StandardToken, Ownable {
    string  public  constant name = "REKT";
    string  public  constant symbol = "REKT";
    uint    public  constant decimals = 18;

    address public  tokenSaleContract;

    modifier validDestination( address to ) {
        require(to != address(0x0));
        require(to != address(this) );
        _;
    }

    function REKT( uint tokenTotalAmount, address admin ) {
        // Mint all tokens. Then disable minting forever.
        balances[msg.sender] = tokenTotalAmount.div(2);
        balances[admin] = tokenTotalAmount.div(2);
        totalSupply = tokenTotalAmount;
        Transfer(address(0x0), msg.sender, tokenTotalAmount);

        tokenSaleContract = msg.sender;
        transferOwnership(admin); // admin could drain tokens that were sent here by mistake
    }

    function transfer(address _to, uint _value)
    validDestination(_to)
    returns (bool) {
        return super.transfer(_to, _value);
    }

    function setTokenSaleContract(address _tokenSaleContract) onlyOwner {
        tokenSaleContract = _tokenSaleContract;
    }

    function transferFrom(address _from, address _to, uint _value)
    validDestination(_to)
    returns (bool) {
        return super.transferFrom(_from, _to, _value);
    }

    event Burn(address indexed _burner, uint _value);

    function burn(uint _value)
    returns (bool){
        balances[msg.sender] = balances[msg.sender].sub(_value);
        totalSupply = totalSupply.sub(_value);
        Burn(msg.sender, _value);
        Transfer(msg.sender, address(0x0), _value);
        return true;
    }

    // save some gas by making only one contract call
    function burnFrom(address _from, uint256 _value)
    returns (bool) {
        assert( transferFrom( _from, msg.sender, _value ) );
        return burn(_value);
    }

    function emergencyERC20Drain( ERC20 token, uint amount ) onlyOwner {
        token.transfer( owner, amount );
    }
}
function burnFrom(address _from, uint256 _value)
returns (bool) {
    assert( transferFrom( _from, msg.sender, _value ) );
    return burn(_value);
}

// save some gas by making only one contract call