Upgradable contract: How to pass tokenname and symbol during deployment without hardcoding it?

I am deploying an token using openzeppelins upgradable contracts. Below is an outline of the code.

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

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

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


This code was generated my the openzeppelin tool. How can this be modified so that i dont need to hardcode the token name and symbol, as i want to deploy multiple tokens via a script.

hey @Cathal_MacFadden, this should work

function initialize(string _name, string _symbol) initializer public {
        __ERC20_init(_name, _symbol);
1 Like

ah ok, i didnt know that the remix UI treated the initialize function as a special function and added the option to input the parameters.


i didn't understand sorry. What do you mean with this