Openzeppelin Contract Wizard Doesn't work when selecting upgradeable

Hi

I tried the code generator on the openzeppelin wizard. However it doesn't seem to work so thought i would report it. Unless im doing something wrong.

OpenZeppelin Contracts Wizard

The vanilla code with no options works fine. I can run it in remix and the name and symbol properties are returned correctly.

However, when i click on upgradeability and select 'Transparent' and run this code in Remix. It doesn't seem to work. The name and symbol string's are not returned.

Anyone else experience this issue? Am i doing something wrong?

Without Upgrade - Works fine

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

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor() ERC20("MyToken", "MTK") {
        _mint(msg.sender, 1000 * 10 ** decimals());
    }

With upgrade - Doesnt work

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

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract MyToken is Initializable, ERC20Upgradeable {
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    function initialize() initializer public {
        __ERC20_init("MyToken", "MTK");

        _mint(msg.sender, 1000 * 10 ** decimals());
    }
}

Hi @apple8er, upgradeable contracts are not fully supported in Remix. It is possible to use them in Remix, but you would need some manual steps to deploy separate proxy contracts that point to the implementation.

For upgradeable contracts, you can use the Upgrades Plugins that help with deployments from Hardhat or Truffle scripts.

What are those manual steps?

I have seen that you can't even deploy in remix when selecting upgradeable. I missed that the first time since I already had Remix open. I prefer Remix even if I need to do this manually. There is literally no resource on how to do this. Even just a set of chronologically ordered links to various resources would be helpful. It may not be a full tutorial, but it is better than nothing.

Remix has a feature in progress to support deploying proxies so you should subscribe to that for updates.

If you want to do it manually, the steps would involve deploying the implementation using Remix, then loading the proxy contract that you want to use (e.g. ERC1967Proxy if using UUPS) and deploying that using Remix (where the constructor args are the deployed implementation address and an encoded function call for the initializer that you want to invoke (encoded using the initializer's function name and the initializer arguments)).

1 Like