contract MTB19Crowdsale is MintedCrowdsale, PausableCrowdsale, FinalizableCrowdsale, CappedCrowdsale {

   constructor(uint256 rate, address payable wallet, IERC20 token,
               uint256 openingTime, uint256 closingTime,
               uint256 cap
              ) public Crowdsale(rate, wallet, token)
                        TimedCrowdsale(openingTime, closingTime)
                        FinalizableCrowdsale()
                        CappedCrowdsale(cap) { }

   /**
     * @dev Overrides finalization of FinalizableCrowdsale. It stores the remaining tokens to the
            fundwallet and renounces minter role.
   */

   function _finalization() internal {

      uint256 remaining = ERC20Capped(address(token())).cap() - ERC20(address(token())).totalSupply();
      if (remaining > 0) ERC20Capped(address(super.token())).mint(super.wallet(), remaining);

      MinterRole(address(token())).renounceMinter();

      super._finalization();

   }

}
function _finalization() internal {

   uint256 remaining = ERC20Capped(address(token())).cap() - ERC20(address(token())).totalSupply();
   if (remaining > 0) ERC20Capped(address(super.token())).mint(super.wallet(), remaining);

   MinterRole(address(token())).renounceMinter();

   super._finalization();

}

/**
 * @dev Overrides finalization of FinalizableCrowdsale. It stores the remaining tokens to the
 fundwallet and renounces minter role.
 */