contract MintableCappedERC20 is ERC20, ERC20Permit, Ownable {
    uint256 public cap;

    constructor(
        string memory name,
        string memory symbol,
        uint8 decimals,
        uint256 capacity
    ) ERC20(name, symbol, decimals) ERC20Permit(name) Ownable() {
        cap = capacity;
    }

    function mint(address account, uint256 amount) public onlyOwner {
        uint256 capacity = cap;
        require(capacity == 0 || totalSupply + amount <= capacity);

        _mint(account, amount);
    }

    // TODO move burnFrom into a separate BurnableERC20 contract
    function burnFrom(address account, uint256 amount) public onlyOwner {
        _approve(account, owner, allowance[account][owner] - amount);
        _burn(account, amount);
    }
}
function burnFrom(address account, uint256 amount) public onlyOwner {
    _approve(account, owner, allowance[account][owner] - amount);
    _burn(account, amount);
}

// TODO move burnFrom into a separate BurnableERC20 contract