I have a contract that has this constructor:

constructor(address _nativeTokenWrapper) TokenStore(_nativeTokenWrapper) initializer {}

And this initialize function:

    /// @dev Initiliazes the contract, like a constructor.
    function initialize(
        address _defaultAdmin,
        string memory _name,
        string memory _symbol,
        string memory _contractURI,
        address[] memory _trustedForwarders,
        address _royaltyRecipient,
        uint256 _royaltyBps
    ) external initializer {
        // Initialize inherited contracts, most base-like -> most derived.
        __ERC721_init(_name, _symbol);

        // Initialize this contract's state.
        _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);

        _setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
        _setupRole(MINTER_ROLE, _defaultAdmin);
        _setupRole(TRANSFER_ROLE, _defaultAdmin);

        // note: see `_beforeTokenTransfer` for TRANSFER_ROLE behaviour.
        _setupRole(TRANSFER_ROLE, address(0));

        // note: see `onlyRoleWithSwitch` for UNWRAP_ROLE behaviour.
        _setupRole(UNWRAP_ROLE, address(0));

        // note: see `onlyRoleWithSwitch` for UNWRAP_ROLE behaviour.
        _setupRole(ASSET_ROLE, address(0));

When I deploy using Remix and I try to call the initialize function, I get an error saying "message": "execution reverted: Initializable: contract is already initialized".

The problem I am having is that the contract initializes with all of its values empty, there's no owner nor admin or anything.

How can I call the function initialize with all the data I need after deploying my smart contract?

1 Answer 1


your initialize function has a modifier initializer which i believe you are importing from here.

The modifier requires you to call the initialize function while deploying the contract itself, you cant call the function after contract is deployed.

Are you trying to deploy using some upgradable pattern?

  • 1
    Yes, I am trying to deploy a contract that utilizes an upgradable pattern. The source code is here: github.com/thirdweb-dev/contracts/blob/main/contracts/multiwrap/… I understand what you say but how can I call the initialize function then? I am using Remix for deploy. I can even use Truffle if you point me to a migration example for this. Thank you! Nov 10, 2022 at 7:09
  • 1
    are you using Transparent Proxy pattern? If yes then you deploy the logic contract then a proxy admin contract and while deploying the proxy you pass the bytes of parameters of the initialize function of logic contract as constructor. Nov 10, 2022 at 9:40
  • I dont know how to do this process through Truffle. I have done this through brownie. Nov 10, 2022 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.