contract XCToken is StandardToken,SafeMath,Ownable {

    // metadata
    string public constant name = "TTC Token";
    string public constant symbol = "TTC";
    uint256 public constant decimals = 8;
    string public version = "1.0";
    
    // total cap
    uint256 public constant tokenCreationCap = 2000 * (10**6) * 10**decimals;
    // init amount
    uint256 public constant tokenCreationInit = 1000 * (10**6) * 10**decimals;
    // The amount of XCTokens that can be mint
    uint256 public constant tokenMintCap = 1000 * (10**6) * 10**decimals;
    // The amount of XCTokens that have been minted
    uint256 public tokenMintedSupply;
    
    address public initDepositAccount;
    address public mintDepositAccount;
    
	bool public mintFinished;
	
	event Mint(uint256 amount);
	event MintFinished();

    function XCToken(
        address _initFundDepositAccount,
        address _mintFundDepositAccount
        ) {
        initDepositAccount = _initFundDepositAccount;
        mintDepositAccount = _mintFundDepositAccount;
        balances[initDepositAccount] = tokenCreationInit;
        totalSupply = tokenCreationInit;
        tokenMintedSupply = 0;
        mintFinished = false;
    }
    
    modifier canMint() {
		if(mintFinished) throw;
		_;
	}
	
    // The remaining amount of tokens that can be minted.
	function remainMintTokenAmount() constant returns (uint256 remainMintTokenAmount) {
	    return safeSub(tokenMintCap, tokenMintedSupply);
	}

	// mint token
	function mint(uint256 _tokenAmount) onlyOwner canMint returns (bool) {
		if(_tokenAmount <= 0) throw;
		uint256 checkedSupply = safeAdd(tokenMintedSupply, _tokenAmount);
		if(checkedSupply > tokenMintCap) throw;
		if(checkedSupply == tokenMintCap){ // mint finish
		    mintFinished = true;
		    MintFinished();
		}
		tokenMintedSupply = checkedSupply;
		totalSupply = safeAdd(totalSupply, _tokenAmount);
		balances[mintDepositAccount] = safeAdd(balances[mintDepositAccount], _tokenAmount);
		Mint(_tokenAmount);
		return true;
	}
	
	// Do not allow direct deposits.
    function () external {
        throw;
    }
	
}
function remainMintTokenAmount() constant returns (uint256 remainMintTokenAmount) {
    return safeSub(tokenMintCap, tokenMintedSupply);
}

// The remaining amount of tokens that can be minted.