contract IndividuallyCappedCrowdsale is Crowdsale {
    using SafeMath for uint256;

    mapping(address => uint256) private _contributions;
    // mapping(address => uint256) private _caps;
    uint256 public individualCap;

    constructor(uint256 _individualCap) public {
        individualCap = _individualCap;
    }

    /**
     * @dev Returns the amount contributed so far by a specific beneficiary.
     * @param beneficiary Address of contributor
     * @return Beneficiary contribution so far
     */
    function getContribution(address beneficiary)
        public
        view
        returns (uint256)
    {
        return _contributions[beneficiary];
    }

    /**
     * @dev Extend parent behavior requiring purchase to respect the beneficiary's funding cap.
     * @param beneficiary Token purchaser
     * @param weiAmount Amount of wei contributed
     */
    function _preValidatePurchase(address beneficiary, uint256 weiAmount)
        internal
        view
    {
        super._preValidatePurchase(beneficiary, weiAmount);
        // solhint-disable-next-line max-line-length
        // require(_contributions[beneficiary].add(weiAmount) <= _caps[beneficiary], "IndividuallyCappedCrowdsale: beneficiary's cap exceeded");
        require(
            _contributions[beneficiary].add(weiAmount) <= individualCap,
            "IndividuallyCappedCrowdsale: beneficiary's cap exceeded"
        );
    }

    /**
     * @dev Extend parent behavior to update beneficiary contributions.
     * @param beneficiary Token purchaser
     * @param weiAmount Amount of wei contributed
     */
    function _updatePurchasingState(address beneficiary, uint256 weiAmount)
        internal
    {
        super._updatePurchasingState(beneficiary, weiAmount);
        _contributions[beneficiary] = _contributions[beneficiary].add(
            weiAmount
        );
    }
}
/**
 * @title IndividuallyCappedCrowdsale
 * @dev Crowdsale with per-beneficiary caps.
 */
function _preValidatePurchase(address beneficiary, uint256 weiAmount)
    internal
    view
{
    super._preValidatePurchase(beneficiary, weiAmount);
    // solhint-disable-next-line max-line-length
    // require(_contributions[beneficiary].add(weiAmount) <= _caps[beneficiary], "IndividuallyCappedCrowdsale: beneficiary's cap exceeded");
    require(
        _contributions[beneficiary].add(weiAmount) <= individualCap,
        "IndividuallyCappedCrowdsale: beneficiary's cap exceeded"
    );
}

/**
 * @dev Extend parent behavior requiring purchase to respect the beneficiary's funding cap.
 * @param beneficiary Token purchaser
 * @param weiAmount Amount of wei contributed
 */