Rename upgrade-safe package to upgradeable

pull/2405/head
Francisco Giordano 4 years ago
parent 679b7d147c
commit 1a230e3aa5
  1. 2
      docs/modules/ROOT/nav.adoc
  2. 10
      docs/modules/ROOT/pages/upgradeable.adoc

@ -1,6 +1,6 @@
* xref:index.adoc[Overview] * xref:index.adoc[Overview]
* xref:extending-contracts.adoc[Extending Contracts] * xref:extending-contracts.adoc[Extending Contracts]
* xref:upgrade-safe.adoc[Using with Upgrades] * xref:upgradeable.adoc[Using with Upgrades]
* xref:releases-stability.adoc[Releases & Stability] * xref:releases-stability.adoc[Releases & Stability]

@ -2,7 +2,7 @@
If your contract is going to be deployed with upgradeability, such as using the xref:upgrades-plugins::index.adoc[OpenZeppelin Upgrades Plugins], you will need to use the Upgrade Safe variant of OpenZeppelin Contracts. If your contract is going to be deployed with upgradeability, such as using the xref:upgrades-plugins::index.adoc[OpenZeppelin Upgrades Plugins], you will need to use the Upgrade Safe variant of OpenZeppelin Contracts.
This variant is available as a separate package called `@openzeppelin/contracts-upgrade-safe`, which is hosted in the repository https://github.com/OpenZeppelin/openzeppelin-contracts-upgrade-safe[OpenZeppelin/openzeppelin-contracts-upgrade-safe]. This variant is available as a separate package called `@openzeppelin/contracts-upgradeable`, which is hosted in the repository https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable[OpenZeppelin/openzeppelin-contracts-upgradeable].
It follows all of the rules for xref:upgrades-plugins::writing-upgradeable.adoc[Writing Upgradeable Contracts]: constructors are replaced by initializer functions, state variables are initialized in initializer functions, and we additionally check for storage incompatibilities across minor versions. It follows all of the rules for xref:upgrades-plugins::writing-upgradeable.adoc[Writing Upgradeable Contracts]: constructors are replaced by initializer functions, state variables are initialized in initializer functions, and we additionally check for storage incompatibilities across minor versions.
@ -11,19 +11,19 @@ It follows all of the rules for xref:upgrades-plugins::writing-upgradeable.adoc[
=== Installation === Installation
```console ```console
$ npm install @openzeppelin/contracts-upgrade-safe $ npm install @openzeppelin/contracts-upgradeable
``` ```
=== Usage === Usage
The package replicates the structure of the main OpenZeppelin Contracts package, but every file and contract has the suffix `UpgradeSafe`. The package replicates the structure of the main OpenZeppelin Contracts package, but every file and contract has the suffix `Upgradeable`.
```diff ```diff
-import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; -import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
+import "@openzeppelin/contracts-upgrade-safe/token/ERC721/ERC721UpgradeSafe.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
-contract MyCollectible is ERC721 { -contract MyCollectible is ERC721 {
+contract MyCollectible is ERC721UpgradeSafe { +contract MyCollectible is ERC721Upgradeable {
``` ```
Constructors are replaced by internal initializer functions following the naming convention `+__{ContractName}_init+`. Since these are internal, you must always define your own public initializer function and call the parent initializer of the contract you extend. Constructors are replaced by internal initializer functions following the naming convention `+__{ContractName}_init+`. Since these are internal, you must always define your own public initializer function and call the parent initializer of the contract you extend.
Loading…
Cancel
Save