1
1
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
2
2
deleted file mode 100644
3
- index 35ad097ff..000000000
3
+ index 35ad097f..00000000
4
4
--- a/.github/ISSUE_TEMPLATE/bug_report.md
5
5
+++ /dev/null
6
6
@@ -1,21 +0,0 @@
@@ -26,7 +26,7 @@ index 35ad097ff..000000000
26
26
-
27
27
- <!-- We will be able to better help if you provide a minimal example that triggers the bug. -->
28
28
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
29
- index 4018cef29..d343a53d8 100644
29
+ index 4018cef2..d343a53d 100644
30
30
--- a/.github/ISSUE_TEMPLATE/config.yml
31
31
+++ b/.github/ISSUE_TEMPLATE/config.yml
32
32
@@ -1,4 +1,8 @@
@@ -40,7 +40,7 @@ index 4018cef29..d343a53d8 100644
40
40
about: Ask in the OpenZeppelin Forum
41
41
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
42
42
deleted file mode 100644
43
- index ff596b0c3..000000000
43
+ index ff596b0c..00000000
44
44
--- a/.github/ISSUE_TEMPLATE/feature_request.md
45
45
+++ /dev/null
46
46
@@ -1,14 +0,0 @@
@@ -59,48 +59,48 @@ index ff596b0c3..000000000
59
59
- <!-- Make sure that you have reviewed the OpenZeppelin Contracts Contributor Guidelines. -->
60
60
- <!-- https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md -->
61
61
diff --git a/README.md b/README.md
62
- index 60d0a430a..0e4f91a6d 100644
62
+ index 60d0a430..0e4f91a6 100644
63
63
--- a/README.md
64
64
+++ b/README.md
65
65
@@ -19,6 +19,9 @@
66
66
> [!IMPORTANT]
67
67
> OpenZeppelin Contracts uses semantic versioning to communicate backwards compatibility of its API and storage layout. For upgradeable contracts, the storage layout of different major versions should be assumed incompatible, for example, it is unsafe to upgrade from 4.9.3 to 5.0.0. Learn more at [Backwards Compatibility](https://docs.openzeppelin.com/contracts/backwards-compatibility).
68
-
68
+
69
69
+ +> [!NOTE]
70
70
+ +> You are looking at the upgradeable variant of OpenZeppelin Contracts. Be sure to review the documentation on [Using OpenZeppelin Contracts with Upgrades](https://docs.openzeppelin.com/contracts/upgradeable).
71
71
+ +
72
72
## Overview
73
-
73
+
74
74
### Installation
75
75
@@ -26,7 +29,7 @@
76
76
#### Hardhat (npm)
77
-
77
+
78
78
```
79
79
- $ npm install @openzeppelin/contracts
80
80
+ $ npm install @openzeppelin/contracts-upgradeable
81
81
```
82
-
82
+
83
83
#### Foundry (git)
84
84
@@ -38,10 +41,10 @@ $ npm install @openzeppelin/contracts
85
85
> Foundry installs the latest version initially, but subsequent `forge update` commands will use the `master` branch.
86
-
86
+
87
87
```
88
88
- $ forge install OpenZeppelin/openzeppelin-contracts
89
89
+ $ forge install OpenZeppelin/openzeppelin-contracts-upgradeable
90
90
```
91
-
91
+
92
92
- Add `@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/` in `remappings.txt.`
93
93
+ Add `@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/` in `remappings.txt.`
94
-
94
+
95
95
### Usage
96
-
96
+
97
97
@@ -50,10 +53,11 @@ Once installed, you can use the contracts in the library by importing them:
98
98
```solidity
99
99
pragma solidity ^0.8.20;
100
-
100
+
101
101
- import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
102
102
+ import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
103
-
103
+
104
104
- contract MyCollectible is ERC721 {
105
105
- constructor() ERC721("MyCollectible", "MCO") {
106
106
+ contract MyCollectible is ERC721Upgradeable {
@@ -110,15 +110,15 @@ index 60d0a430a..0e4f91a6d 100644
110
110
}
111
111
```
112
112
diff --git a/contracts/package.json b/contracts/package.json
113
- index 3682eadeb..4f870d094 100644
113
+ index 70ae73bc..ef659873 100644
114
114
--- a/contracts/package.json
115
115
+++ b/contracts/package.json
116
116
@@ -1,5 +1,5 @@
117
117
{
118
118
- "name": "@openzeppelin/contracts",
119
119
+ "name": "@openzeppelin/contracts-upgradeable",
120
120
"description": "Secure Smart Contract library for Solidity",
121
- "version": "5.2 .0",
121
+ "version": "5.3 .0",
122
122
"files": [
123
123
@@ -13,7 +13,7 @@
124
124
},
@@ -140,30 +140,35 @@ index 3682eadeb..4f870d094 100644
140
140
+ }
141
141
}
142
142
diff --git a/contracts/utils/cryptography/EIP712.sol b/contracts/utils/cryptography/EIP712.sol
143
- index bcb67c87a..7195c3bbd 100644
143
+ index c39954e3..fe681f87 100644
144
144
--- a/contracts/utils/cryptography/EIP712.sol
145
145
+++ b/contracts/utils/cryptography/EIP712.sol
146
146
@@ -4,7 +4,6 @@
147
147
pragma solidity ^0.8.20;
148
-
148
+
149
149
import {MessageHashUtils} from "./MessageHashUtils.sol";
150
150
- import {ShortStrings, ShortString} from "../ShortStrings.sol";
151
151
import {IERC5267} from "../../interfaces/IERC5267.sol";
152
-
152
+
153
153
/**
154
- @@ -28,30 +27,18 @@ import {IERC5267} from "../../interfaces/IERC5267.sol";
155
- * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
156
- * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
157
- * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
154
+ @@ -25,33 +24,20 @@ import {IERC5267} from "../../interfaces/IERC5267.sol";
155
+ * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
156
+ * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
157
+ *
158
+ - * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
159
+ - * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
160
+ - * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
158
161
- *
159
162
- * @custom:oz-upgrades-unsafe-allow state-variable-immutable
163
+ + * NOTE: The upgradeable version of this contract does not use an immutable cache and recomputes the domain separator
164
+ + * each time {_domainSeparatorV4} is called. That is cheaper than accessing a cached version in cold storage.
160
165
*/
161
166
abstract contract EIP712 is IERC5267 {
162
167
- using ShortStrings for *;
163
168
-
164
169
bytes32 private constant TYPE_HASH =
165
170
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
166
-
171
+
167
172
- // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
168
173
- // invalidate the cached domain separator if the chain id changes.
169
174
- bytes32 private immutable _cachedDomainSeparator;
@@ -174,7 +179,7 @@ index bcb67c87a..7195c3bbd 100644
174
179
bytes32 private immutable _hashedName;
175
180
+ /// @custom:oz-renamed-from _HASHED_VERSION
176
181
bytes32 private immutable _hashedVersion;
177
-
182
+
178
183
- ShortString private immutable _name;
179
184
- ShortString private immutable _version;
180
185
- // slither-disable-next-line constable-states
@@ -183,10 +188,10 @@ index bcb67c87a..7195c3bbd 100644
183
188
- string private _versionFallback;
184
189
+ string private _name;
185
190
+ string private _version;
186
-
191
+
187
192
/**
188
193
* @dev Initializes the domain separator and parameter caches.
189
- @@ -66,29 +53 ,23 @@ abstract contract EIP712 is IERC5267 {
194
+ @@ -66,29 +52 ,23 @@ abstract contract EIP712 is IERC5267 {
190
195
* contract upgrade].
191
196
*/
192
197
constructor(string memory name, string memory version) {
@@ -205,7 +210,7 @@ index bcb67c87a..7195c3bbd 100644
205
210
+ _hashedName = 0;
206
211
+ _hashedVersion = 0;
207
212
}
208
-
213
+
209
214
/**
210
215
* @dev Returns the domain separator for the current chain.
211
216
*/
@@ -217,14 +222,14 @@ index bcb67c87a..7195c3bbd 100644
217
222
- }
218
223
+ return _buildDomainSeparator();
219
224
}
220
-
225
+
221
226
function _buildDomainSeparator() private view returns (bytes32) {
222
227
- return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
223
228
+ return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));
224
229
}
225
-
230
+
226
231
/**
227
- @@ -127 ,6 +108 ,10 @@ abstract contract EIP712 is IERC5267 {
232
+ @@ -125 ,6 +105 ,10 @@ abstract contract EIP712 is IERC5267 {
228
233
uint256[] memory extensions
229
234
)
230
235
{
@@ -235,7 +240,7 @@ index bcb67c87a..7195c3bbd 100644
235
240
return (
236
241
hex"0f", // 01111
237
242
_EIP712Name(),
238
- @@ -141 ,22 +126 ,62 @@ abstract contract EIP712 is IERC5267 {
243
+ @@ -139 ,22 +123 ,62 @@ abstract contract EIP712 is IERC5267 {
239
244
/**
240
245
* @dev The name parameter for the EIP712 domain.
241
246
*
@@ -250,7 +255,7 @@ index bcb67c87a..7195c3bbd 100644
250
255
+ function _EIP712Name() internal view virtual returns (string memory) {
251
256
+ return _name;
252
257
}
253
-
258
+
254
259
/**
255
260
* @dev The version parameter for the EIP712 domain.
256
261
*
@@ -309,7 +314,7 @@ index bcb67c87a..7195c3bbd 100644
309
314
}
310
315
}
311
316
diff --git a/package.json b/package.json
312
- index f9e7d9205..c35020d51 100644
317
+ index eeeaf0bc..65581c54 100644
313
318
--- a/package.json
314
319
+++ b/package.json
315
320
@@ -34,7 +34,7 @@
@@ -322,15 +327,15 @@ index f9e7d9205..c35020d51 100644
322
327
"keywords": [
323
328
"solidity",
324
329
diff --git a/remappings.txt b/remappings.txt
325
- index 304d1386a..a1cd63bee 100644
330
+ index 304d1386..a1cd63be 100644
326
331
--- a/remappings.txt
327
332
+++ b/remappings.txt
328
333
@@ -1 +1,2 @@
329
334
- @openzeppelin/contracts/=contracts/
330
335
+ @openzeppelin/contracts-upgradeable/=contracts/
331
336
+ @openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
332
337
diff --git a/test/utils/cryptography/EIP712.test.js b/test/utils/cryptography/EIP712.test.js
333
- index 2b6e7fa97..268e0d29d 100644
338
+ index 2b6e7fa9..268e0d29 100644
334
339
--- a/test/utils/cryptography/EIP712.test.js
335
340
+++ b/test/utils/cryptography/EIP712.test.js
336
341
@@ -47,27 +47,6 @@ describe('EIP712', function () {
@@ -359,5 +364,5 @@ index 2b6e7fa97..268e0d29d 100644
359
364
- });
360
365
- }
361
366
});
362
-
367
+
363
368
it('hash digest', async function () {
0 commit comments