Deploying Upgradeable Proxies and Proxy Admin from Factory contract

So this should be ok right? Although is giving me out of gas on Hardhat.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./PlanetVault.sol";
import "./Planet.sol";

contract PlanetFactory is Ownable {
    string public version = "2.0";
    uint256 public planetCount = 0;
    address public settings;
    address immutable planetBeacon;

    mapping(uint256 => address) public planets;

    event Mint(address planet, uint256 planetId);

    constructor(address _settings, address upgrader) {
        settings = _settings;
        UpgradeableBeacon _planetBeacon = new UpgradeableBeacon(address(new Planet()));
        planetBeacon = address(_planetBeacon);

    /// @notice the function to mint a new vault
    /// @param _name the name of the planet
    /// @param _symbol the ticker of the planet
    /// @param _amount the amount of fractions
    /// @return the ID of the vault
    function mint(
        string memory _metaDataUri,
        string memory _name,
        string memory _symbol,
        uint256 _amount
    ) external onlyOwner returns (uint256) {
        BeaconProxy proxy = new BeaconProxy(

        address planetVault = address(
            new PlanetVault(address(proxy), msg.sender, settings)

        Planet(address(proxy)).mintPlanet(planetVault, "");

        emit Mint(address(proxy), planetCount);

        planets[planetCount] = address(proxy);

        return planetCount;

Yes it looks like it should work. What is it that's running out of gas?