Remove "available since" comments (#4424)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -13,8 +13,6 @@ import {Math} from "../math/Math.sol";
|
||||
*
|
||||
* To create a history of checkpoints define a variable type \`Checkpoints.Trace*\` in your contract, and store a new
|
||||
* checkpoint for the current transaction block using the {push} function.
|
||||
*
|
||||
* _Available since v4.5._
|
||||
*/
|
||||
`;
|
||||
|
||||
|
||||
@ -1,65 +1,8 @@
|
||||
const assert = require('assert');
|
||||
const format = require('../format-lines');
|
||||
const { range } = require('../../helpers');
|
||||
|
||||
const LENGTHS = range(8, 256, 8).reverse(); // 248 → 8 (in steps of 8)
|
||||
|
||||
// Returns the version of OpenZeppelin Contracts in which a particular function was introduced.
|
||||
// This is used in the docs for each function.
|
||||
const version = (selector, length) => {
|
||||
switch (selector) {
|
||||
case 'toUint(uint)': {
|
||||
switch (length) {
|
||||
case 8:
|
||||
case 16:
|
||||
case 32:
|
||||
case 64:
|
||||
case 128:
|
||||
return '2.5';
|
||||
case 96:
|
||||
case 224:
|
||||
return '4.2';
|
||||
default:
|
||||
assert(LENGTHS.includes(length));
|
||||
return '4.7';
|
||||
}
|
||||
}
|
||||
case 'toInt(int)': {
|
||||
switch (length) {
|
||||
case 8:
|
||||
case 16:
|
||||
case 32:
|
||||
case 64:
|
||||
case 128:
|
||||
return '3.1';
|
||||
default:
|
||||
assert(LENGTHS.includes(length));
|
||||
return '4.7';
|
||||
}
|
||||
}
|
||||
case 'toUint(int)': {
|
||||
switch (length) {
|
||||
case 256:
|
||||
return '3.0';
|
||||
default:
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
case 'toInt(uint)': {
|
||||
switch (length) {
|
||||
case 256:
|
||||
return '3.0';
|
||||
default:
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
};
|
||||
|
||||
const header = `\
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
@ -109,8 +52,6 @@ const toUintDownCast = length => `\
|
||||
* Requirements:
|
||||
*
|
||||
* - input must fit into ${length} bits
|
||||
*
|
||||
* _Available since v${version('toUint(uint)', length)}._
|
||||
*/
|
||||
function toUint${length}(uint256 value) internal pure returns (uint${length}) {
|
||||
if (value > type(uint${length}).max) {
|
||||
@ -132,8 +73,6 @@ const toIntDownCast = length => `\
|
||||
* Requirements:
|
||||
*
|
||||
* - input must fit into ${length} bits
|
||||
*
|
||||
* _Available since v${version('toInt(int)', length)}._
|
||||
*/
|
||||
function toInt${length}(int256 value) internal pure returns (int${length} downcasted) {
|
||||
downcasted = int${length}(value);
|
||||
@ -151,8 +90,6 @@ const toInt = length => `\
|
||||
* Requirements:
|
||||
*
|
||||
* - input must be less than or equal to maxInt${length}.
|
||||
*
|
||||
* _Available since v${version('toInt(uint)', length)}._
|
||||
*/
|
||||
function toInt${length}(uint${length} value) internal pure returns (int${length}) {
|
||||
// Note: Unsafe cast below is okay because \`type(int${length}).max\` is guaranteed to be positive
|
||||
@ -170,8 +107,6 @@ const toUint = length => `\
|
||||
* Requirements:
|
||||
*
|
||||
* - input must be greater than or equal to 0.
|
||||
*
|
||||
* _Available since v${version('toUint(int)', length)}._
|
||||
*/
|
||||
function toUint${length}(int${length} value) internal pure returns (uint${length}) {
|
||||
if (value < 0) {
|
||||
|
||||
@ -1,22 +1,15 @@
|
||||
const format = require('../format-lines');
|
||||
const { capitalize, unique } = require('../../helpers');
|
||||
const { capitalize } = require('../../helpers');
|
||||
|
||||
const TYPES = [
|
||||
{ type: 'address', isValueType: true, version: '4.1' },
|
||||
{ type: 'bool', isValueType: true, name: 'Boolean', version: '4.1' },
|
||||
{ type: 'bytes32', isValueType: true, version: '4.1' },
|
||||
{ type: 'uint256', isValueType: true, version: '4.1' },
|
||||
{ type: 'string', isValueType: false, version: '4.9' },
|
||||
{ type: 'bytes', isValueType: false, version: '4.9' },
|
||||
{ type: 'address', isValueType: true },
|
||||
{ type: 'bool', isValueType: true, name: 'Boolean' },
|
||||
{ type: 'bytes32', isValueType: true },
|
||||
{ type: 'uint256', isValueType: true },
|
||||
{ type: 'string', isValueType: false },
|
||||
{ type: 'bytes', isValueType: false },
|
||||
].map(type => Object.assign(type, { struct: (type.name ?? capitalize(type.type)) + 'Slot' }));
|
||||
|
||||
const VERSIONS = unique(TYPES.map(t => t.version)).map(
|
||||
version =>
|
||||
`_Available since v${version} for ${TYPES.filter(t => t.version == version)
|
||||
.map(t => `\`${t.type}\``)
|
||||
.join(', ')}._`,
|
||||
);
|
||||
|
||||
const header = `\
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
@ -43,8 +36,6 @@ pragma solidity ^0.8.19;
|
||||
* }
|
||||
* }
|
||||
* \`\`\`
|
||||
*
|
||||
${VERSIONS.map(s => ` * ${s}`).join('\n')}
|
||||
*/
|
||||
`;
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ index df141192..1cf90ad1 100644
|
||||
"keywords": [
|
||||
"solidity",
|
||||
diff --git a/contracts/utils/cryptography/EIP712.sol b/contracts/utils/cryptography/EIP712.sol
|
||||
index d94e956a..b2d3546f 100644
|
||||
index ff34e814..a9d08d5c 100644
|
||||
--- a/contracts/utils/cryptography/EIP712.sol
|
||||
+++ b/contracts/utils/cryptography/EIP712.sol
|
||||
@@ -4,7 +4,6 @@
|
||||
@ -137,10 +137,10 @@ index d94e956a..b2d3546f 100644
|
||||
import {IERC5267} from "../../interfaces/IERC5267.sol";
|
||||
|
||||
/**
|
||||
@@ -29,28 +28,18 @@ import {IERC5267} from "../../interfaces/IERC5267.sol";
|
||||
@@ -27,28 +26,18 @@ import {IERC5267} from "../../interfaces/IERC5267.sol";
|
||||
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
|
||||
* separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
|
||||
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
|
||||
*
|
||||
* _Available since v3.4._
|
||||
- *
|
||||
- * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
|
||||
*/
|
||||
@ -170,7 +170,7 @@ index d94e956a..b2d3546f 100644
|
||||
|
||||
/**
|
||||
* @dev Initializes the domain separator and parameter caches.
|
||||
@@ -65,29 +54,23 @@ abstract contract EIP712 is IERC5267 {
|
||||
@@ -63,29 +52,23 @@ abstract contract EIP712 is IERC5267 {
|
||||
* contract upgrade].
|
||||
*/
|
||||
constructor(string memory name, string memory version) {
|
||||
@ -208,7 +208,7 @@ index d94e956a..b2d3546f 100644
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,6 +111,10 @@ abstract contract EIP712 is IERC5267 {
|
||||
@@ -124,6 +107,10 @@ abstract contract EIP712 is IERC5267 {
|
||||
uint256[] memory extensions
|
||||
)
|
||||
{
|
||||
@ -219,14 +219,12 @@ index d94e956a..b2d3546f 100644
|
||||
return (
|
||||
hex"0f", // 01111
|
||||
_EIP712Name(),
|
||||
@@ -142,26 +129,62 @@ abstract contract EIP712 is IERC5267 {
|
||||
@@ -138,22 +125,62 @@ abstract contract EIP712 is IERC5267 {
|
||||
/**
|
||||
* @dev The name parameter for the EIP712 domain.
|
||||
*
|
||||
- * NOTE: By default this function reads _name which is an immutable value.
|
||||
- * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
|
||||
- *
|
||||
- * _Available since v5.0._
|
||||
+ * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
|
||||
+ * are a concern.
|
||||
*/
|
||||
@ -244,7 +242,10 @@ index d94e956a..b2d3546f 100644
|
||||
- * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
|
||||
+ * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
|
||||
+ * are a concern.
|
||||
+ */
|
||||
*/
|
||||
- // solhint-disable-next-line func-name-mixedcase
|
||||
- function _EIP712Version() internal view returns (string memory) {
|
||||
- return _version.toStringWithFallback(_versionFallback);
|
||||
+ function _EIP712Version() internal view virtual returns (string memory) {
|
||||
+ return _version;
|
||||
+ }
|
||||
@ -272,13 +273,9 @@ index d94e956a..b2d3546f 100644
|
||||
+
|
||||
+ /**
|
||||
+ * @dev The hash of the version parameter for the EIP712 domain.
|
||||
*
|
||||
- * _Available since v5.0._
|
||||
+ *
|
||||
+ * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.
|
||||
*/
|
||||
- // solhint-disable-next-line func-name-mixedcase
|
||||
- function _EIP712Version() internal view returns (string memory) {
|
||||
- return _version.toStringWithFallback(_versionFallback);
|
||||
+ */
|
||||
+ function _EIP712VersionHash() internal view returns (bytes32) {
|
||||
+ string memory version = _EIP712Version();
|
||||
+ if (bytes(version).length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user