contract CoinFiToken is StandardToken, Ownable {
    string public constant name = "CoinFi";
    string public constant symbol = "COFI";
    uint8 public constant decimals = 18;

    // 300 million tokens minted
    uint256 public constant INITIAL_SUPPLY = 300000000 * (10 ** uint256(decimals));

    // Indicates whether token transfer is enabled
    bool public transferEnabled = false;

    // Specifies airdrop contract address which can transfer tokens before unlock
    address public airdropAddress;

    modifier onlyWhenTransferEnabled() {
        if (!transferEnabled) {
            require(msg.sender == owner || msg.sender == airdropAddress);
        }
        _;
    }

    function CoinFiToken() public {
        totalSupply_ = INITIAL_SUPPLY;
        balances[msg.sender] = INITIAL_SUPPLY;
        Transfer(0x0, msg.sender, INITIAL_SUPPLY);
    }

    /**
     * Enables everyone to start transferring their tokens.
     * This can only be called by the token owner.
     */
    function enableTransfer() external onlyOwner {
        transferEnabled = true;
    }

    /**
     * Disables the ability to transfer tokens except by owner.
     * This can only be called by the token owner.
     */
    function disableTransfer() external onlyOwner {
        transferEnabled = false;
    }

    /**
     * Sets the airdrop contract address which is allowed to transfer before unlock.
     * This can only be called by the token owner.
     */
    function setAirdropAddress(address _airdropAddress) external onlyOwner {
        airdropAddress = _airdropAddress;
    }

    /**
     * Overrides the ERC20Basic transfer() function to only allow token transfers after enableTransfer() is called.
     */
    function transfer(address _to, uint256 _value) public onlyWhenTransferEnabled returns (bool) {
        return super.transfer(_to, _value);
    }

    /**
     * Overrides the ERC20Basic transferFrom() function to only allow token transfers after enableTransfer() is called.
     */
    function transferFrom(address _from, address _to, uint256 _value) public onlyWhenTransferEnabled returns (bool) {
        return super.transferFrom(_from, _to, _value);
    }
}
function transferFrom(address _from, address _to, uint256 _value) public onlyWhenTransferEnabled returns (bool) {
    return super.transferFrom(_from, _to, _value);
}

/**
 * Overrides the ERC20Basic transferFrom() function to only allow token transfers after enableTransfer() is called.
 */