contract ERC20Capped is ERC20Mintable {
    uint256 internal _cap;
    bool public isFinishMint;

    /**
     * Returns the cap on the token's total supply.
     */
    function cap() public view returns (uint256) {
        return _cap;
    }

    /**
     *  See `ERC20Mintable.mint`.
     *
     * Requirements:
     *
     * - `value` must not cause the total supply to go over the cap.
     */
    function _mint(address account, uint256 value) internal {
        require(!isFinishMint, "ERC20Capped: minting has been finished");
        require(totalSupply().add(value) <= _cap, "ERC20Capped: cap exceeded");
        if(totalSupply().add(value) == _cap) {
            isFinishMint = true;
        }
        super._mint(account, value);
    }

    function finishMint() public onlyOwner {
        require(!isFinishMint, "ERC20Capped: minting has been finished");
        isFinishMint = true;
    }
}
/**
 *  Extension of `ERC20Mintable` that adds a cap to the supply of tokens.
 */
function _mint(address account, uint256 value) internal {
    require(!isFinishMint, "ERC20Capped: minting has been finished");
    require(totalSupply().add(value) <= _cap, "ERC20Capped: cap exceeded");
    if(totalSupply().add(value) == _cap) {
        isFinishMint = true;
    }
    super._mint(account, value);
}

/**
 *  See `ERC20Mintable.mint`.
 *
 * Requirements:
 *
 * - `value` must not cause the total supply to go over the cap.
 */