abstract contract CappedCrowdsale is Crowdsale {
    using SafeMath for uint256;

    uint256 internal _cap;
    uint256 internal _minted;

    /**
     * @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
     * @param cap Max amount of wei to be contributed
     */
    constructor (uint256 cap) {
        require(cap > 0, "CappedCrowdsale: cap is 0");
        _cap = cap;
    }

    /**
     * @return the cap of the crowdsale.
     */
    function cap() public view returns (uint256) {
        return _cap;
    }

    /**
     * @return the minted of the crowdsale.
     */
    function minted() public view returns (uint256) {
        return _minted;
    }

    /**
     * @dev Checks whether the cap has been reached.
     * @return Whether the cap was reached
     */
    function capReached() public view returns (bool) {
        return _minted >= _cap;
    }

    function incrementMinted(uint256 amountOfTokens) internal virtual {
        _minted +=  amountOfTokens;
    }

    function currentMinted() public view returns (uint256) {
        return _minted;
    }
}
/**
 * @title CappedCrowdsale
 * @dev Crowdsale with a limit for total contributions.
 */
function capReached() public view returns (bool) {
        return _minted >= _cap;
    }
/**
 * @dev Checks whether the cap has been reached.
 * @return Whether the cap was reached
 */