How to deploy an UUPS smartcontract manually

Hello,

I work on compatible Evm chain but incompatible with ethereum classic tools (hardhat, metamask).

So I want to deploy an uups proxy contract but I need to do it manually and not with openzeppelin.

How properly do it ?

My try (proxy contract) :

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

contract MarketProxy is TransparentUpgradeableProxy {
    constructor(
        address _logic,
        address admin_,
        bytes memory _data
    ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}
}

Uups contract (cut):

contract Marketplace is
    OwnableUpgradeable,
    ERC721Holder,
    ERC1155Holder,
    ReentrancyGuardUpgradeable,
    UUPSUpgradeable
{

  function initialize(IStorage _storageContract) public initializer {
        console.log(
            "initialize market is %s for storage contract %s",
            msg.sender,
            address(_storageContract)
        );
        __Ownable_init();
        __ReentrancyGuard_init();
        __UUPSUpgradeable_init();

        storageContract = _storageContract;
        // 200 fees = 2%
        fee = 200;
        // 50 fees = 0.5% for personnal smartcontract
        feeUser = 50;
    }

    function _authorizeUpgrade(address) internal override onlyOwner {}

}

I try to launch some test with hardhat but my test failed, it seems to not redirect to my logiccontract :

How I launch my test :

  let abiStorage = ["function initialize()"];
    let abiMarket = ["function initialize(address _storageContract)"];

    // Deploy store
    const storage = await ethers.getContractFactory("Storage");
    const instanceStorage = await storage.deploy();
    await instanceStorage.deployed();

    let iface = new ethers.utils.Interface(abiStorage);
    var call = iface.encodeFunctionData("initialize", []);

    const storageProxy = await ethers.getContractFactory("StorageProxy");
    const instanceStorageProxy = await storageProxy.deploy(
      instanceStorage.address,
      dev4.address,
      call,
    );
    await instanceStorageProxy.deployed();

    console.log("storage address", instanceStorageProxy.address);

    // Deploy market
    const marketPlace = await ethers.getContractFactory("Marketplace");
    const instanceMarket = await marketPlace.deploy();
    await instanceMarket.deployed();

    let iface2 = new ethers.utils.Interface(abiMarket);
    var call2 = iface2.encodeFunctionData("initialize", [
      instanceStorageProxy.address,
    ]);
    const proxyMarket = await ethers.getContractFactory("MarketProxy");
    market = await proxyMarket.deploy(
      instanceMarket.address,
      dev4.address,
      call2,
    );
    await market.deployed();

I see Initialize log on my console but if I call getOwner on market contract I have :

ReferenceError: Cannot access 'owner' before initialization

If I call a function on market :

market.connect(...).createAuction is not a function

Functionnal test with hardhat and openzepelin proxy :

beforeEach(async function () {
    [owner, dev2, dev3, dev4] = await ethers.getSigners();
    const NFT = await ethers.getContractFactory("HydraNft");
    nft = await NFT.deploy();
    await nft.deployed();

    // Deploy store
    const storage = await ethers.getContractFactory("Storage");
    const instanceStorage = await upgrades.deployProxy(storage);
    await instanceStorage.deployed();

    console.log("storage address", instanceStorage.address);

    // Deploy market
    const marketPlace = await ethers.getContractFactory("Marketplace");
    market = await upgrades.deployProxy(marketPlace, [instanceStorage.address]);
    await market.deployed();

    console.log("market address", market.address);
  });

I think I need to deploy proxyadmin maybe, maybe my initialize call is incorrect, anyone can help me ?

My bad I just resolve my problem, we need to reattach the proxy to market contract, because hardhat don't find method in contract proxy

My test initialize :

 var nft;
  var market;
  var owner, dev2, dev3, dev4;
  beforeEach(async function () {
    [owner, dev2, dev3, dev4] = await ethers.getSigners();
    const NFT = await ethers.getContractFactory("HydraNft");
    nft = await NFT.deploy();
    await nft.deployed();

    let abiStorage = ["function initialize()"];
    let abiMarket = ["function initialize(address _storageContract)"];

    // Deploy store
    const storage = await ethers.getContractFactory("Storage");
    const instanceStorage = await storage.deploy();
    await instanceStorage.deployed();

    let iface = new ethers.utils.Interface(abiStorage);
    var call = iface.encodeFunctionData("initialize", []);

    const storageProxy = await ethers.getContractFactory("StorageProxy");
    const instanceStorageProxy = await storageProxy.deploy(
      instanceStorage.address,
      dev4.address,
      call,
    );
    await instanceStorageProxy.deployed();

    console.log("storage address", instanceStorageProxy.address);

    // Deploy market
    const marketPlace = await ethers.getContractFactory("Marketplace");
    const instanceMarket = await marketPlace.deploy();
    await instanceMarket.deployed();

    console.log("marketplace address", instanceMarket.address);

    let iface2 = new ethers.utils.Interface(abiMarket);
    var call2 = iface2.encodeFunctionData("initialize", [
      instanceStorageProxy.address,
    ]);
    const proxyMarket = await ethers.getContractFactory("MarketProxy");
    var resultProxy = await proxyMarket.deploy(
      instanceMarket.address,
      dev4.address,
      call2,
    );
    await resultProxy.deployed();

    market = marketPlace.attach(resultProxy.address);

    let ownerContract = await market.connect(dev2).owner();
    console.log("owner market", ownerContract);
  });