Comments (5)
Hello @pegahcarter
If you want a version of Ownable
that uses a dedicated storage slot, you should consider using the upgradeable version.
from openzeppelin-contracts.
It appears that all of the storage is private in both cases with internal/external methods to access, so the only difference should be gas.
The main difference is that upgradeable contracts are upgradeable, just that. Of course, upgradeability comes with extra gas costs because they are exposed behind a proxy and can't take advantage of immutable variables, among other considerations.
Please refer to our Upgradeability docs so you can get more information.
Personally, I think the bottom line is that if you need an upgradeable contract, you'll have to inevitably deal with the extra costs, not even optimizing would help much and may be dangerous.
from openzeppelin-contracts.
Hey @Amxx thank you. Is there a reason why the upgradeable version isn't the de-facto?
from openzeppelin-contracts.
Smart Contracts are de-facto non-upgradeable, upgradeability is a set of quirks we make to simulate upgradeability, but it comes with a bunch of constraints and considerations.
Most projects are better off writing non-upgradeable code, and in our opinion, they should consciously go for upgradeability and not deal with their complexities by default.
from openzeppelin-contracts.
Are there additional costs to using the upgradeable Ownable
that makes it more beneficial to use the non-upgradeable version? It appears that all of the storage is private in both cases with internal/external methods to access, so the only difference should be gas.
from openzeppelin-contracts.
Related Issues (20)
- Online tools support custom Solidity versions HOT 1
- Ownable2Step doesn't call Ownable constructor HOT 1
- Mining Apps for quickest rise dividend
- Potentially redundant getVotes in Governor propose function HOT 1
- The natspec comment of IAccessControl regarding `RoleGranted` event should be updated HOT 1
- Improve gas efficiency of `SafeERC20.forceApprove` when the token returns a bool on approve
- Merge 4.9.6 and 5.0.2 changelog entry into master HOT 1
- Consider adding an ESLint rule for no async in describe blocks
- Test non-commutative internal node hashing functions in MerkleTree and Merkle Proof
- Consider removing the `_root` for the MerkleTree structure
- Keep ERC-20 balances and approval slots non-zero HOT 2
- HI// ALL OFF MY WALLETT HOT 1
- transferFrom, approve, safeTransferFrom function are payable function in the ERC721 Standard HOT 2
- Optimize BeaconProxy deployment costs avoiding storage writes HOT 2
- Add Flexible Voting to Governor HOT 4
- Transient Approval HOT 4
- Library for derivation of slots
- Add partial delegation to ERC20Votes
- Fixing "Invalid OpCode" Truffle Error with Openzeppelin Library Installed HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openzeppelin-contracts.