6
votes
Accepted
Difference between __init and __init_unchained
From OpenZeppelin's docs, there is the following section:
Initializer functions are not linearized by the compiler like constructors. Because of this, each __{ContractName}_init function embeds the ...
5
votes
Accepted
couldnt understand implementaion of UpgradeabilityProxyFactory
The simplest way to initialize your contract is to use the interactive commands when creating the contract using openzeppelin create.
You will be asked ? Do you want to call a function on the ...
4
votes
"onlyOwner" Function restrict the call from child contract
Sammu Sundar.
It happens because your Logic contract is not an owner/creator of the Storage contract (from what I understood).
In this case, it would be better to introduce an additional access ...
4
votes
Accepted
Does function order also matter when writing upgradeable smart contracts?
TLDR: Only affects variables
ZeppelinOS does upgradability by using the proxy pattern, you can actually change the way it behaves, depending on the specific implementation the order of variables may ...
3
votes
Solidity 0.6.0 and address(f) to f.address
This change is about external function types. As you can read in the Breaking Changes:
Conversions from external function types to address are now
disallowed. Instead external function types have ...
2
votes
Accepted
ZepplinOS: Where to set owner of the contract?
I think it'd better to explicit the owner via input param like below, instead of using msg.sender since msg.sender might be not what we intend to set because zos use contract proxy to make it ...
2
votes
Accepted
How do Proxy Upgraded Logic Contracts Share Data
It might be cognitively useful to think of the proxy contract importing bytecode from the logic contracts for its own use because they execute in the context of the proxy and use the proxy for storage....
2
votes
How do Proxy Upgraded Logic Contracts Share Data
Upgradability in smart contracts is nice feature that gives you the option to upgrade your logic and keep the contract data safe. Let's take for example we have 2 contracts first one is where the data ...
2
votes
Accepted
Am I locked to one solc version for upgradeable smart contracts?
From Solidity the documentation:
The layout of state variables in storage is considered to be part of the external interface of Solidity due to the fact that storage pointers can be passed to ...
2
votes
Accepted
A proxy for an upgradeable contract returns a wrong value
You have probably guessed you have a fundamental issue with the storage. I will try to explain.
The whole idea of a "proxy" is that the proxy is running, so everything that happens unfolds ...
2
votes
Upgradability of smart contract
As a matter of fact, there are various architectural patterns to solve this problem.
Yes, smart contracts are immutable. But the trick is that you can use multiple smart contracts together to create ...
2
votes
Accepted
Does it make sense to use OpenZepplin's upgradeable contract
It really depends of your use case and your users expectations. An upgradable contract means that there is an owner that can change the functions of the contract. If your users expect that your ...
2
votes
Accepted
How to make Solidity Contracts Upgradable with a mapping and state variables?
First the short answers:
As we know the mappings can grow, how to allot a slot for them, and what would be the setters and getters look like?
You could define a hash function that uses both a "...
2
votes
Need help reducing contract size for ERC721Upgradeable Proxy Contract
Move all your image processing functions to a library and deploy separately.
They do not require access to storage and it is very clean to keep that code separate.
There's also other fancy ways to get ...
1
vote
Upgrade Solidity contract
You can, but it depends on what you mess up. If you accidentally change the total supply or some balances, you'll have to change them back. If you just upgrade to the zero address for instance and ...
1
vote
Does it make sense to have an upgradeable smart contract?
I would say no. And simply importing the libraries is not enough - you have to implement the upgradability properly, if you want it to work.
The kind of logic you described can be easily integrated in ...
1
vote
Initialize function is not invoked during deployment of upgradeable contract
Seems, this is the solution - verification
https://medium.com/etherscan-blog/and-finally-proxy-contract-support-on-etherscan-693e3da0714b
1
vote
When upgrading contracts can you change the logic inside functions?
Yes. If you are using the proxy delegate pattern, your upgrade would work!
One important rule is to avoid overwriting your state. So, in your case, your contracts would break if you added a new ...
1
vote
Accepted
strange revert on proxy pattern delegate call
Figured it out, calling another contract before changes the returndatasize.
1
vote
Call method of another contract from one contract in upgradable smartcontract
You can use one of the 2 following options:
Via interface contract:
ContractA.sol:
pragma solidity ^0.5.11;
contract A {
uint256 public testVariable = 5;
function getTestVariable() ...
1
vote
Accepted
Forward all function calls and arguments to another contract
You can simply view the code of upgradable contracts already deployed to mainnet:
BUSD Token
AMPL Token
USDC Token
REP Token
TUSD Token
SNX Token
JRT Token
1
vote
Tokens & Smart Contract "Upgrade"
Yes. You can implement a simple logic in your contract for that:
For example:
mapping(address => bool) public hacker;
function doSomething() public {
require(!hacker[...
1
vote
ERC930 and data upgradability
You may want to look at OpenZeppelin SDK to see if this meets your needs for upgradeable contracts: https://docs.openzeppelin.com/sdk/2.5/
If you have questions on using OpenZeppelin you can ask in ...
1
vote
Accepted
Contract change registry
This is conceptually off. Possibly a hidden assumption is that modifying your code is an option.
I'll explain the default conditions and then touch on some edgy workarounds.
Default case
...
1
vote
Can abstract contracts in solidity have state variables?
You can go like that:
contract StorageInterface {
bool public b;
function set(bytes32 key, bytes32 value) public;
function get(bytes32 key) public returns(bytes32);
}
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
contract-upgrading × 55solidity × 25
upgrading × 15
openzeppelin × 13
openzeppelin-contracts × 11
contract-development × 10
proxy-contracts × 8
contract-design × 6
erc-20 × 4
openzeppelin-sdk × 4
delegatecall × 3
addresses × 2
erc-721 × 2
inheritance × 2
hardhat × 2
interfaces × 2
web3js × 1
truffle × 1
transactions × 1
blockchain × 1
remix × 1
ether × 1
contract-deployment × 1
contract-invocation × 1
etherscan × 1