Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [contract-upgrading]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
30 views

Unable to deploy Transparent Proxy contract to Polygon mainnet with Hardhat

I'm able to deploy this same contract to the Mumbai testnet and verify it and everything works fine. So I know that my script is working correctly. However each time I try to deploy to Polygon mainnet,...
BlackH3art's user avatar
0 votes
0 answers
22 views

Time-out when deploying a smart contract

I have two Node.js/ether projects that use the same code and dependencies to deploy an upgradeable smart contract written in Solidity. They use these lines: const contractFactory = new ethers....
mhaeusser's user avatar
0 votes
1 answer
41 views

How to implement Chainlink VRFv2 with Upgradeable Transparent Proxy smart contract?

I'm trying to implement Chainlink VRFv2 with my upgradeable smart contract, and none of the versions seem to work. Although I'm able to deploy the proxy correctly, when I'm trying to call function ...
BlackH3art's user avatar
0 votes
1 answer
46 views

Upgrading Smart Contracts with New Fields: How to Safely Modify Storage Layout

I'm working on upgrading my Ethereum smart contract, which utilizes upgradable smart contract patterns. Currently, I have a struct named GovernorCountingSimpleStorage with existing fields, and I want ...
Agilulfo's user avatar
1 vote
1 answer
39 views

How does the proxy contract gets the storage variables of Implementation contract?

I understand that proxies use delegatecall to execute the logic contract's function with its own storage. But what happens when we define any storage variables in the logic contract as well as ...
Solidity Nerd's user avatar
0 votes
0 answers
26 views

How to upgrade a struct in a UUPS upgrade pattern?

Let's say I have an upgradable contract (from openzeppelin UUPS wizard in this case) with a mapping address to struct like below: // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "...
Pacdac's user avatar
  • 80
0 votes
1 answer
35 views

Will upgrading a smart contract to inherit from a new base class cause potential storage conflicts with UUPS proxy pattern?

I have an ERC20 contract like so: contract myToken is ERC20BurnableUpgradeable, OwnableUpgradeable, UUPSUpgradeable, PausableUpgradeable { mapping(address => uint256) public totalSpent; ...
Barney Chambers's user avatar
0 votes
0 answers
10 views

Upgradable contract function not accessible

We have deployed the smart contract with proxy and using that proxy we have tried to upgrade the contract with some new functions. The contract is compiling and deploying and the upgrade process is ...
Blockchain Guy's user avatar
1 vote
1 answer
176 views

OZ transparent upgradeable proxy admin reverts when trying upgrade an implementation

I have this transparent upgradeable proxy deployed on sepolia - 0x2dFC2A866eac363cAFF516b5ce7aCd6bae1F21C1 This is the admin contract - 0x6d429719f78b146892403d06df677afa6f968d91 When I try to call ...
Zartaj Afser's user avatar
  • 4,096
0 votes
0 answers
61 views

Is it secure to have an `initialize` method in the proxy smart contract?

I have a question regarding the initialize function, usually found in the upgradable implementation contract as a replacement for the constructor. My question is that, from a security point of view, ...
Jdawg287's user avatar
1 vote
1 answer
23 views

i have an upgradable smart contract with 3 mappings, i set only the first two in the initialize function

i have an upgradable smart contract with 3 mappings, i set only the first two in the initialize function . pragma solidity ^0.8.0; contract ContractA { mapping(uint256 => address) public ...
noro meb's user avatar
  • 358
0 votes
0 answers
23 views

Upgradeable Proxy Pattern - using from other contract

I am trying to use the upgradable proxy pattern in mi contracts and at the end, i can call the setters ok, but the getters are not working. I have Clients that has a count value storage, a getCount ...
Maite Ibarburu's user avatar
0 votes
2 answers
82 views

UUPS proxy and file level constants, enums and structs compatibility

If i use UUPS upgradeable pattern and i define a couple of constants, enums and structs at the contract level, will those values still be available after an upgrade? I have 3 contracts and all 3 are ...
gabkov's user avatar
  • 113
0 votes
0 answers
130 views

How to deploy Upgradable Smart Contract on Tron Network

I have some time as a developer in ethereum based networks and actually making and deploying a smart contract with openzeppelin is very simple. The problems start when you go to the Tron network ...
darienmh's user avatar
0 votes
0 answers
21 views

What is the cost of upgrading a contract (openzepplin upgradable contracts) in the mainnet?

I'm a bit new to web3, right now trying to upgrade an upgradable contract using hardhat, but the funds on my wallet are never enough. According to what I have researched, as of today (June 5, 2023). ...
Multitut's user avatar
  • 101
0 votes
1 answer
345 views

Is it possible to change a constant variable value when using upgradeable pattern and deploying a new version?

The title is pretty self explanatory. Let's say I have a contract where I defined a constant variable and this contract is using some upgradeable pattern. When I deploy a new version of the contract, ...
gabkov's user avatar
  • 113
1 vote
3 answers
284 views

OpenZippelin upgradeability pattern | How can both implementation and proxy contracts share the same storage tho they were implemented independently?

Please bear with me in this. I tried to understand it myself, but I couldn't. I'm playing the Ethernaut challenges(a series of contracts hacking), and I'm solving the challenge 24 - Puzzle Wallet- ...
REZAZI MOHAMED ABDESSAMED's user avatar
0 votes
1 answer
24 views

How can i use https://github.com/odyslam/foundry-upgrades to make upgradable contract?

i am making a upgradable contract with foundry. I have deployed and verified the code. I was looking for a substitute for https://github.com/OpenZeppelin/openzeppelin-upgrades and suddenly got this: ...
Hacek 's user avatar
  • 657
1 vote
0 answers
38 views

Can we implement ERC2535 on already deployed contract?

I have a simple question. I have a transparent upgradeable proxy already deployed on the mainnet and I have also upgraded the implementation a few times. So, is it possible to somehow implement the ...
Zartaj Afser's user avatar
  • 4,096
2 votes
1 answer
442 views

onlyInitializing vs initializer in OpenZeppelin Upgradeable Contracts

I'm reading the OpenZeppelin documentation about upgradeable contracts, and I'm getting a bit confused with these modifiers: initializer onlyInitializing I think I understand how initializer works. ...
Alexander Herranz's user avatar
3 votes
1 answer
584 views

How many storage gaps to add at the end of Base Upgradeable Contracts?

I have read about adding Storage gaps at the end of Base Upgradeable Contracts for reserving storage slots. More detailed explaination in Openzeppelin Docs here. But what is the exact amount of ...
Pankaj Jagtap's user avatar
0 votes
1 answer
20 views

Can I build an AragonOSx plugin using the Diamond pattern?

While developing my governance plugin for Aragon OSx, I ran into the max contract size limit. To get past this issue I looked online and found the ERC-2535 Diamonds, Multi-Facet Proxy standard. I have ...
juliette_chevalier's user avatar
1 vote
0 answers
93 views

Testing Upgradeability fails with UUPS

Thank you in advance for helping me out with the blockage I'm facing here. I deployed an upgradeable contract, all tests went well except when I tested upgradeability. the contract is access control, ...
sasha's user avatar
  • 41
1 vote
1 answer
103 views

Can you inherit contracts on upgradable contract for the next version of deployment?

Say I use UUPS pattern and want to add ERC721 by inheriting it, is this possible? i.e. contract MyContractV1 is OwnableUpgradeable { and for the next version contract MyContractV2 is ...
bbusdriver's user avatar
  • 1,154
2 votes
1 answer
714 views

OpenZeppelin Initializable Error "Initializable: contract is not initializing" when calling initialize function for the first time

I have a contract that "is Initializable" and it is the base contract so I am using the onlyInitializing modifier. However, after I deploy my contract and call the initialize function I ...
Kate Johnson's user avatar
1 vote
3 answers
1k views

Testing upgradable contracts with hardhat-deploy

I want to properly and efficiently test a smart contract upgrade with hardhat-deploy. Currently, I'm experimenting with hardhat forking, both networks that is localhost and hardhat networks. I've ...
codewarriorr's user avatar
1 vote
1 answer
195 views

Why do we need to separate storage and logic layers for proxy patterns?

I'm recently learning proxy patterns (https://blog.openzeppelin.com/proxy-patterns/) and understand that although it is not possible to upgrade the code of your already deployed smart contract, it is ...
Will-Up-Vote-If-Good's user avatar
1 vote
1 answer
148 views

How to permission the initialize function in upgradeable contracts?

From what I understand, for UUPS proxies: the proxy contract is ERC1967Proxy.sol from OpenZeppelin Contracts and the implementation contract should inherit from UUPSUpgradeable.sol in OpenZeppelin ...
Ryan Sea's user avatar
  • 638
1 vote
2 answers
446 views

Cannot initialize variable in upgradable smart contract using initialize function

// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/...
Helmi Trabelsi's user avatar
0 votes
2 answers
433 views

Ethernaut Level 24 - Puzzle Wallet

I'm following the tutorial here: https://blog.dixitaditya.com/ethernaut-level-24-puzzle-wallet // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import ".....
Will-Up-Vote-If-Good's user avatar
0 votes
1 answer
321 views

How to deploy an upgradable erc20 properly

I have a simple ERC20Upgradable: import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol&...
Ritzy Dev's user avatar
  • 283
6 votes
2 answers
353 views

Do people have a strong preference for implementing EIP-2535 or OpenZeppelin's Proxy Upgrade Pattern?

Which use cases might lend themselves to one implementation versus the other?
Yan Digilov's user avatar
0 votes
1 answer
83 views

Does a smart contract at V2 or V3 indicate that it is an upgradeable contract?

Uniswap's smart contract is now known as "Uniswap V3" to delineate from earlier versions. Does this call sign imply that Uniswap V1 was an upgradeable contract all along? How about "...
user610620's user avatar
  • 1,528
0 votes
3 answers
130 views

Why would an upgradeable smart contract or bridge not be preferred?

A hackathon shows preference towards a bridge smart contract that is not upgradeable. Why would developers view this as an advantage when building a protocol or dapp? Wouldn't it sound better to say ...
user610620's user avatar
  • 1,528
2 votes
1 answer
265 views

What do we mean by collision prevention when we are writing proxy contract for a smart contract?

I am learning to write a proxy contract in Solidity. What do we mean by collision when writing proxy contract for a smart contract? I have some other questions as well , pls refer to comments inside ...
Gaurav Pant's user avatar
0 votes
1 answer
66 views

transferOwnership on Upgradable Contract

I try to use the Upgradable Contract and transferOwnership but i have an issue. What i want to do : vers1 of my contract deployProxy vers1 (with user1 : become the owner) deployed transferOwnership ...
Cryptopowa's user avatar
0 votes
2 answers
220 views

Deploy upgradable contracts using Remix

How can I deploy a contract that has the initialize method from Remix? I have just seen here that Remix now supports this feature but I haven't found any example I could follow.
Falcon Stakepool's user avatar
2 votes
1 answer
703 views

How to make UUPS upgradeable contracts modular

I have the following contract: import { UUPSUpgradeable } from "@openzeppelin-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import { OwnableUpgradeable } from "@openzeppelin-upgradeable/...
George Pickett's user avatar
0 votes
0 answers
17 views

Is it best to make all important functions in upgradable contracts virtual?

I want to be able to edit some functions during upgrades, and potentially solve errors. I can only override my previous function if it's virtual. Is it best to make all important functions virtual?
Gbolahan's user avatar
1 vote
0 answers
19 views

persist an array after UUPS upgrade

I have a contract that I'm attempting to store the tax rates on. The issue I'm running into is taxKeys will randomly reset to empty after UUPS upgrade. This is completely random as sometimes it will ...
john's user avatar
  • 111
1 vote
0 answers
233 views

UUPS upgradeable contract call fails with delegatecall error when calling newly added functions

I created an upgradeable contract adhering to the UUPS standard following this guide here. I then added some new functions, deployed the upgrade using the upgrades plugin upgrades.prepareUpgrade() ...
Inn0vative1's user avatar
1 vote
2 answers
239 views

Can someone give example what could go wrong if constructor is used in upgradable contracts?

I have been reading that logic contracts should use initialize method rather than a constructor since it's not a part of deployed bytecode. What I don't understand is what could go wrong if I use it. ...
Emrah's user avatar
  • 1,654
0 votes
2 answers
3k views

_disableInitializers() vs initializer vs reinitializer(uint8 version) in Openzeppelin/contracts-upgradeable?

Initializable.sol provides an initializer modifier and a _disableInitializers() internal function. I need help in understanding why a _disableInitializers() might be needed if we already have a ...
Abhik Banerjee's user avatar
0 votes
1 answer
40 views

Etherscan contract not updated even though contract updated

New to solidity. I updated my contract, but the changes and new functions are not showing in etherscan. is this normal?
user101153's user avatar
0 votes
2 answers
57 views

Upgrade Solidity contract

i am upgrading my contract to a new implementation. I was wondering if i mistakenly put wrong positions of variables in my new implementation and get my data corrupted, can i upgrade back to original ...
zOthix's user avatar
  • 121
0 votes
2 answers
2k views

upgradeble openzeppelin contracts - why the __gap is needed if you can add variables to the end?

https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps 1: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps explains why the __gap variable is needed, but https://docs....
Rony Tesler's user avatar
2 votes
0 answers
242 views

How can I create a factory of Upgradeable smart contracts?

I'm using OpenZeppelin hardhat plugin to deploy proxy contracts and I was asking myself how to achieve the same thing but from a contract. So for example I want to have a ProxyContractFactory that can ...
Allennick's user avatar
  • 253
0 votes
1 answer
308 views

I can't deploy my Upgradeable contract using truffle plugins

I'm trying to deploy the following smart contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; ...
Allennick's user avatar
  • 253
1 vote
0 answers
429 views

Upgrade ERC721 Contract

I've a question about an upgrade that I should apply to a contract that I deployed as upgradable (with openzeppelin Upgradable). I'm following the guidelines and best practices but I'm not sure the ...
Gerard-sol's user avatar
5 votes
1 answer
1k views

Difference between __init and __init_unchained

I am learning to develop upgradeable smart contracts using openzeppelin library for ERC721 and ERC1155 contracts. However, I don't understand what does the unchained function mean. More specifically ...
mzaidi's user avatar
  • 1,012