Git Product home page Git Product logo

Comments (5)

Amxx avatar Amxx commented on June 14, 2024 1

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.

ernestognw avatar ernestognw commented on June 14, 2024 1

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.

pegahcarter avatar pegahcarter commented on June 14, 2024

Hey @Amxx thank you. Is there a reason why the upgradeable version isn't the de-facto?

from openzeppelin-contracts.

ernestognw avatar ernestognw commented on June 14, 2024

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.

pegahcarter avatar pegahcarter commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.