5

Smart contracts are immutable (code cannot be changed) by design. Truffle and ZeppelinOS are platforms for the development of smart contracts for Ethereum based blockchains. Truffle migrate manages the deployment of contracts to blockchain(s). Each time you migrate a contract you deploy a new instance to a new public address. To use the new smart ...


4

In case of truffle the stored values will not remain in the upgraded contract whereas in proxy approach it is possible to obtain the stored values in the upgraded contract too. In truffle upgrade a new version of contract is being deployed to the network and we will be obtaining a new contract address. If try to console the contract address in migrations ...


4

It is simpler than you think: require(success, string (returndata)); See documentation for details. You may also forward raw bytes, but you will need to use assembly.


3

This is because Solidity sets up the variables in storage sequentially. So if you move the references of storage variables in the upgraded one, they'll be referring to the wrong slot in storage. Here's an example: contract StorageOriginal { uint public first = 10; uint public second = 20; } and contract StorageNew { uint public second; ...


2

Full name of the function being called is not passed to the smart contract, but only the first 4 bytes of the hash of function signature. These 4 bytes you can obtain as msg.sig. See documentation for details.


2

Yes, that is possible and not much different from usual development. What I understood is that one should send a transaction at Proxy contract (configured with the latest version of the contract) sending as msg.data the method of the upgradable contract that I want to execute. No, that is not the case. You should call you contract as usual using web3, ...


2

ZeppelinOS' unstructured storage, like most proxy patterns, works by presenting a front-end contract (the proxy) with its logic delegated to an implementation contract. This way, the balance (eth) and storage stays in the proxy even if its implementation changes. This is useful for many reasons, one being able to upgrade a production contract for bug-fixing ...


1

Silly me, I forgot to include the data object key... let result = await web3.eth.call({ from: user, to: this.MyContract.address, data: functionData //forgot data: });


1

As the writing of this, EtherScan has added an option for verifying proxy contracts. It can be found under More Options menu on the contract source code


1

Answer from the OpenZeppelin Community Forum: https://forum.openzeppelin.com/t/proxy-that-routes-to-multiple-logic-contracts-based-on-param/2595/2 Is there a reason that you can’t use OpenZeppelin upgradeable contracts and just have a single logic contract? See Upgrading Smart Contracts Learn guide. I would suggest looking at this first to see if it meets ...


1

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. I realize this is misleading about implementation details. Proxy - execution context. data goes here | | Implementation - logic After an upgrade, you ...


1

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 is located (state contract) and the second one is where the logic is located (proxy contract). The scenario is that the proxy contract is updating the data ...


1

The variables are declared constant which means they are hard-coded into the bytecode. As such, they don't occupy storage slots. The computed hashes are easily reproducible in implementation contracts given that the data to hash is known. The computed hashes amount to pseudo-random storage locations that are unlikely to be overwritten by implementation ...


1

The admin of the Proxy contract cannot call any functions on the proxied contract as they will NOT fallback. This is shown in the code excerpt of AdminUpgradeabilityProxy.sol below: modifier ifAdmin() { if (msg.sender == _admin()) { _; } else { _fallback(); } } So the solution is to call the proxied contract by some other account e....


1

It's a DSProxyFactory, which is a contract, which is a subtype of address. So you can pass an address to that constructor, and the address you pass is expected to point to a smart contract that implements the public interface described in DSProxyFactory.


1

This line: var count = Web3.eth.getTransactionCount(defaultAccount,'pending'); You're starting your count at the number of outstanding/pending transactions the node is aware of. That's the wrong queue. You could start here: var count = Web3.eth.getTransactionCount(defaultAccount); This will drop the next transaction on the nonce that follows the last ...


1

tl;dr the upgradeable part is the library which only contains logic, not storage. Only editing You can't do that since the interface in which you define your struct is linked to the storage contract on creation. This logic is designed to be able to make modifications in the library to existing functions, generally. Nontheless deleting the struct wouldn't ...


1

One issue is that you copy your data into memory starting at address 0. This will work for return sizes less than 64 bytes, but will start overwriting other memory at that point. Instead you should do something more like let m := mload(0x40) returndatacopy(m, 0, returndatasize) return(0, returndatasize)


1

I had similar issues and it was caused by two issues: _targetcontract is invalid: add "require(_targetcontract != 0)" parameters are not padded to 32 bytes: for example, some of the parameters like "uint8 v" in targetfunction are not aligned to 32 bytes. In my case, I found such parameters "disappeared" during the call.


1

1 - What are the advantages/disadvantages of the two techniques? The advantage of the first is, that you don't have to build bytes data yourself, the disadvantage is that you have to change it every time for every new function at the destination. 2 - How does one uses "Generic" proxy functions? I'm not sure how I construct the parameters value and data ...


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