Questions tagged [contract-upgrading]
The contract-upgrading tag has no usage guidance.
90
questions
0
votes
0
answers
16
views
Not able to upgrade contract using UUPS proxy in remix
I want to upgrade my contract. My contract inherits UUPS proxy. While I am upgrading contract through remix, it is redirecting me to hit function upgradeTo but the case is that upgradeTo doesn't ...
1
vote
1
answer
23
views
How can I remove upgradability in case of UUPS proxy?
I have my contract which inteherits UUPS upgradability. Now due to some issues, I want to completely remove UUPS proxy and implement transparent proxy.
Any way I can do this?
3
votes
1
answer
23
views
What can be the workaround to work with the new `Initializable` contract?
If we are using the initializable contract before OZ 0.5.0 for our transparent Upgradeable proxy.
It had two variables in slot 0.
uint8 private _initialized;
bool private _initializing;
Now in OZ 0.5....
0
votes
0
answers
22
views
Smart Contract version update doubts
It is possible to update smart contracts using unstructured storage. But I have some doubts.
Would it keep the same address as the first SC?
Would it keep the persistence of the log information, or ...
1
vote
0
answers
57
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,...
0
votes
0
answers
47
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....
0
votes
1
answer
65
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 ...
0
votes
1
answer
180
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 ...
1
vote
1
answer
68
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 ...
0
votes
0
answers
46
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 "...
1
vote
1
answer
50
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;
...
0
votes
0
answers
12
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 ...
2
votes
1
answer
284
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 ...
1
vote
1
answer
31
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 ...
0
votes
2
answers
100
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 ...
0
votes
1
answer
438
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, ...
1
vote
3
answers
351
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- ...
0
votes
1
answer
29
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: ...
1
vote
0
answers
39
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 ...
2
votes
1
answer
569
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. ...
3
votes
1
answer
721
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 ...
0
votes
1
answer
25
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 ...
1
vote
0
answers
110
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, ...
1
vote
1
answer
118
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 ...
2
votes
1
answer
824
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 ...
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 ...
1
vote
1
answer
224
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 ...
1
vote
1
answer
182
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 ...
1
vote
2
answers
537
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/...
0
votes
2
answers
508
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 ".....
0
votes
1
answer
352
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&...
7
votes
2
answers
406
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?
0
votes
1
answer
92
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 "...
0
votes
3
answers
156
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 ...
2
votes
1
answer
306
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 ...
0
votes
1
answer
76
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 ...
0
votes
2
answers
317
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.
2
votes
1
answer
767
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/...
0
votes
0
answers
27
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?
1
vote
0
answers
23
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 ...
1
vote
0
answers
244
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() ...
1
vote
2
answers
322
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.
...
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 ...
0
votes
1
answer
47
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?
0
votes
2
answers
75
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 ...
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....
2
votes
0
answers
253
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 ...
0
votes
1
answer
321
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";
...
1
vote
0
answers
431
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 ...
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 ...