Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eip-2535.md #2908

Merged
merged 1 commit into from
Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions EIPS/eip-2535.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ A diamond has four standard external functions that can be called to show what f

## Upgrades and Immutability

A diamond can be immutable by not adding an external function to it that can add/replace/remove functions or by removing such functions.
A diamond can be immutable from inception by not adding any external functions that can add/replace/remove functions. [There are number of reasons to do this.](#different-kinds-of-diamonds)

A diamond can be upgraded if has a `diamondCut` external function or other function(s) that can add/replace/remove functions.
A diamond that is mutable can be made immutable by removing such functions.

A diamond can be upgraded if it has a diamondCut external function or other function(s) that can add/replace/remove functions.

## Facets and State Variables

Expand Down Expand Up @@ -232,9 +234,7 @@ An upgradeable diamond has the `diamondCut` function and/or possibly other funct
A finished diamond was an upgradeable diamond and had a number of upgrades. Then its `diamondCut` function and/or other upgrade functions were removed and upgrades are no longer possible. It is no longer possible to add/replace/remove functions. It has become an immutable diamond.

**Single Cut Diamond**
The specification section of the standard is careful not to say that a diamond *has* a `diamondCut` function. Instead it says a diamond *uses* a `diamondCut` function. This careful wording makes single cut diamonds and other patterns possible. A single cut diamond uses the `diamondCut` function in the constructor function of the diamond to add all functions to the diamond, but it does not add the `diamondCut` function to the diamond. This means that a single cut diamond is fully created in its constructor and once created can never be upgraded. It has the same immutability and trustless guarantees as a regular vanilla contract. Why would someone do this? There may be a number of reasons. The two use cases below are really good reasons.

The two use cases below assume that you want an immutable diamond:
A single cut diamond adds all functions to itself in its constructor function, but it does not add the `diamondCut` function or any other function that can add/replace/remove functions. This means that a single cut diamond is fully created in its constructor and once created can never be upgraded. It has the same immutability and trustless guarantees as a regular vanilla contract. Why would someone do this? There may be a number of reasons. The two use cases below are good reasons.

1. Your contract hits the max contract size limit. Make it into a single cut diamond. You still break your big contract into smaller facets, modularizing your code.
2. You start with an upgradeable diamond in your development and testing and upgrade it to your heart's delight. Reap the advantages of easy upgrading and a stable address as you work out new features, bugs and kinks. Release the upgradeable diamond on a test network with your application for beta testing and upgrade it when needed. This is iterative development. When it is solid then deploy it as a single cut diamond on the main network.
Expand Down