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 ...
user avatar
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 ...
user avatar
  • 1,278
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 ...
user avatar
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 ...
user avatar
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 ...
user avatar
  • 2,958
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 ...
user avatar
  • 2,081
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....
user avatar
  • 51.2k
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 ...
user avatar
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 ...
user avatar
  • 29.1k
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 ...
user avatar
  • 51.2k
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 ...
user avatar
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 ...
user avatar
  • 3,237
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 "...
user avatar
  • 51.2k
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 ...
user avatar
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 ...
user avatar
  • 3,264
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 ...
user avatar
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
user avatar
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 ...
user avatar
1 vote
Accepted

strange revert on proxy pattern delegate call

Figured it out, calling another contract before changes the returndatasize.
user avatar
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() ...
user avatar
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
user avatar
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[...
user avatar
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 ...
user avatar
  • 1,278
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 ...
user avatar
  • 51.2k
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); } ...
user avatar
  • 51.2k

Only top scored, non community-wiki answers of a minimum length are eligible