Compare commits
294 Commits
transient/
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 264f00fe39 | |||
| bc8f775df2 | |||
| 667bb9b5c3 | |||
| 5def3f7c7e | |||
| 21cd7e8aa3 | |||
| a5350ecdd3 | |||
| fd9bbaec30 | |||
| 6ef73e3386 | |||
| a95d01c30d | |||
| ba35d580f4 | |||
| f9f7db03f3 | |||
| 0aaa23e57d | |||
| 5936cd8025 | |||
| 292b3542fc | |||
| 6e14ecc01a | |||
| cc94ea4930 | |||
| 1a87de9326 | |||
| 2422d7cf7f | |||
| 387ce69e6b | |||
| 56fe41c588 | |||
| 90117f33f0 | |||
| b84db20fb2 | |||
| 6079eb3f01 | |||
| 61f81e313c | |||
| 668221e314 | |||
| 2909098755 | |||
| 51da8ae490 | |||
| 6ccfb7b891 | |||
| 3eddace0cb | |||
| 800200d452 | |||
| f27019d48e | |||
| 7be5dde82d | |||
| 5c79432e40 | |||
| bbc4d7ae67 | |||
| 8dcc4b9e88 | |||
| 78c8da8648 | |||
| e11cac459e | |||
| 13d9086d0b | |||
| be547e4d14 | |||
| 4d13a007e2 | |||
| 1d9400e053 | |||
| 8bff2a72d9 | |||
| b6a5e89de7 | |||
| 37f873d50b | |||
| b3d6f71d0c | |||
| d20b9e30bd | |||
| f45e9158b7 | |||
| 784d4f71b1 | |||
| 4bafedfe72 | |||
| 83d2a247be | |||
| 88962fb5ab | |||
| a6ae04acf8 | |||
| a7d38c7a33 | |||
| 441b1c1c5b | |||
| 8e3ea8b48d | |||
| 48bd2864c6 | |||
| de89798004 | |||
| ccde353a20 | |||
| e34251682b | |||
| 633a1c85ca | |||
| bdf8affec3 | |||
| 4aaf40ac5d | |||
| 6bcc3a470d | |||
| a3a9e8cc3b | |||
| 08566bfe0d | |||
| 9393147db7 | |||
| d61a349165 | |||
| 1958f092b0 | |||
| b1e517cba2 | |||
| 3a52d35555 | |||
| 3e75ff1862 | |||
| 6dd191a979 | |||
| 56c07e59c4 | |||
| da32fb3bd8 | |||
| 3a14bcc783 | |||
| aaf955de56 | |||
| 06ea3b1b4e | |||
| 21c8312b02 | |||
| d183d9b07a | |||
| 10a776bae6 | |||
| aa29301672 | |||
| 450b833278 | |||
| 1873ecb38e | |||
| 952775e4f1 | |||
| a31b4a438a | |||
| 5a5867e548 | |||
| 1eb82eca85 | |||
| 0a77e54c30 | |||
| d9933585b6 | |||
| 6015d7ef79 | |||
| fda6b85f2c | |||
| 8a4eadea51 | |||
| f740084582 | |||
| ca7a4e39de | |||
| fa995ef1fe | |||
| 3882a09163 | |||
| 15653ff10e | |||
| 71bc0f7774 | |||
| 7276774f34 | |||
| ddba55780a | |||
| a4b0d89900 | |||
| a9b1f58b00 | |||
| 506e1f827a | |||
| f999ba42a1 | |||
| 2ed8956992 | |||
| 3bdc3a35c5 | |||
| 930598edfb | |||
| 9586aaf352 | |||
| f281e98c94 | |||
| fa8bed68af | |||
| dbd9805207 | |||
| 7ccb79f6ce | |||
| be2b016679 | |||
| f4237626c2 | |||
| 3658269505 | |||
| 441dc141ac | |||
| 2141d3faf5 | |||
| 43b3319e5b | |||
| df878c87fc | |||
| b9dbfa7ceb | |||
| 19c2f2f5a5 | |||
| c089efa8b5 | |||
| 828dbc357c | |||
| 840c974028 | |||
| 0d0e4aabdb | |||
| 4ccfe380e0 | |||
| 8c1b0ca82d | |||
| 495a287e9a | |||
| fd812ee954 | |||
| 6e752dc169 | |||
| 7ae222bf2f | |||
| 6dc9242937 | |||
| a55fabc405 | |||
| 9e66e2f9f5 | |||
| 332bcb5f4d | |||
| ea736bd45b | |||
| 96b40d02c3 | |||
| 13781c1f49 | |||
| 2e27a0c74b | |||
| 352ab13687 | |||
| 7b74442c5e | |||
| a2a5dc26a1 | |||
| a99b31f990 | |||
| 45dd083602 | |||
| bf69b60146 | |||
| 4c3ef87cf5 | |||
| dd04dfe75d | |||
| c3b3ae7e82 | |||
| c73c23ffc9 | |||
| ba8b5cfd42 | |||
| 7526c8fe3b | |||
| d4ed5f9068 | |||
| 482665495b | |||
| 03e06bf08c | |||
| 3b240d7e6a | |||
| e8f24d6ba0 | |||
| 855c39cf58 | |||
| b50f22d153 | |||
| bf4d40d8c8 | |||
| 73b46e3bd1 | |||
| fad2b6e16b | |||
| 2655a89165 | |||
| f20c062ead | |||
| 535b54da59 | |||
| a71f79fbbc | |||
| 77d4a73c87 | |||
| 5df10703cd | |||
| ad906fe39b | |||
| 8939cb7835 | |||
| 2875a0f782 | |||
| a39556f475 | |||
| ff3134197f | |||
| 6dacc68c46 | |||
| 1c1186af1c | |||
| 0643d17e8d | |||
| 8829465a08 | |||
| 063fbb3a1f | |||
| 779c27ad36 | |||
| 6e05b68bd9 | |||
| a3a6db86d5 | |||
| 78be1b39aa | |||
| 653963beb2 | |||
| fdf7012d3b | |||
| 4afd599329 | |||
| 0df841d2d7 | |||
| c3cb7a0295 | |||
| 2562c11f25 | |||
| e1d44e0342 | |||
| 0513853ca5 | |||
| ed98138a78 | |||
| b3ce884628 | |||
| d11ed2fb0a | |||
| 23f4452b21 | |||
| ccb39d2765 | |||
| 7105693e3c | |||
| a277d472d6 | |||
| ccb5f2d8ca | |||
| ffca412299 | |||
| dac63c4612 | |||
| 448efeea66 | |||
| 3da7a869aa | |||
| f96237308f | |||
| bcdfa848a6 | |||
| 28aed34dc5 | |||
| 2fa4d103fe | |||
| 205f59e9b6 | |||
| 29f4059773 | |||
| c343ee3768 | |||
| bc1df46eac | |||
| c12cf86e0d | |||
| a4dc928a93 | |||
| 5bb3f3e788 | |||
| f989fff931 | |||
| 2a83a217af | |||
| 378914ceab | |||
| 0034c30224 | |||
| 3291252c86 | |||
| fe6249ec2c | |||
| bd588959ad | |||
| 72c152dc1c | |||
| 6325009675 | |||
| 2bedb02bfc | |||
| 8b591baef4 | |||
| 49cd64565a | |||
| b72e3da0ec | |||
| e3cfe1c5dd | |||
| d3ca1d1f00 | |||
| cceac54953 | |||
| ae753b7eac | |||
| 057d35a9eb | |||
| 414cb9e6fd | |||
| 4c481d6584 | |||
| f6db28630c | |||
| cc67e0eb83 | |||
| 2f0bc58946 | |||
| e866815c7d | |||
| 530179a71f | |||
| b1f6bbe69f | |||
| 8a309ab5ec | |||
| f3825ab335 | |||
| 204ffee531 | |||
| 3cfebcb5c4 | |||
| f20981528f | |||
| 3f901696f7 | |||
| 809ded806f | |||
| 37c35a1eaa | |||
| 6e224307b4 | |||
| cae60c595b | |||
| c01a0fa27f | |||
| 55d69573fc | |||
| cb7faaf4db | |||
| dfb3ec36b5 | |||
| 9e970eb9fa | |||
| 55fd53c6d2 | |||
| 373eabeca6 | |||
| 29a953954d | |||
| 83f954d8c4 | |||
| a9161aa93f | |||
| d8bbd34676 | |||
| 1e7ca3eea6 | |||
| 37619479cd | |||
| 3547cdce21 | |||
| 48c67c7de0 | |||
| 1edc2ae004 | |||
| 5fc38baea2 | |||
| eb4e8632f7 | |||
| db464dd23b | |||
| 0b58a783b9 | |||
| 4764ea5075 | |||
| c304b6710b | |||
| bcd4beb5e7 | |||
| 24a641d9c9 | |||
| aec36ddd6a | |||
| e3786e63e6 | |||
| c1d49a3259 | |||
| 9d6a0cc7e9 | |||
| 659f3063f8 | |||
| 231fae33f0 | |||
| 9e73c4b581 | |||
| e30b390d84 | |||
| 19a657bef8 | |||
| b73bcb231f | |||
| 4b33d326fa | |||
| 05f218fb66 | |||
| ccc110360f | |||
| 9af280dc4b | |||
| 01cae33130 | |||
| 483fc3f1f8 | |||
| 5480641e5c | |||
| c3f8b760ad | |||
| 442886ed5f | |||
| 83c7e45092 | |||
| 8a990e6d6a | |||
| 53b5d84212 |
5
.changeset/all-geese-stand.md
Normal file
5
.changeset/all-geese-stand.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': patch
|
||||
---
|
||||
|
||||
Add constructors to the different signers.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Clones`: Add version of `clone` and `cloneDeterministic` that support sending value at creation.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': patch
|
||||
---
|
||||
|
||||
`ProxyAdmin`: Fixed documentation for `UPGRADE_INTERFACE_VERSION` getter.
|
||||
5
.changeset/clean-ways-push.md
Normal file
5
.changeset/clean-ways-push.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`AccountERC7579`: Extension of `Account` that implements support for ERC-7579 modules of type executor, validator, and fallback handler.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`CircularBuffer`: Add a data structure that stores the last `N` values pushed to it.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Math`: add an `invMod` function to get the modular multiplicative inverse of a number in Z/nZ.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`RSA`: Library to verify signatures according to RFC 8017 Signature Verification Operation
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Arrays`: add a `sort` functions for `address[]`, `bytes32[]` and `uint256[]` memory arrays.
|
||||
5
.changeset/dull-students-eat.md
Normal file
5
.changeset/dull-students-eat.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Memory`: Add library with utilities to manipulate memory
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`GovernorCountingFractional`: Add a governor counting module that allows distributing voting power amongst 3 options (For, Against, Abstain).
|
||||
5
.changeset/eight-radios-check.md
Normal file
5
.changeset/eight-radios-check.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Checkpoints`: Add a new checkpoint variant `Checkpoint256` using `uint256` type for the value and key.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': patch
|
||||
---
|
||||
|
||||
`TransparentUpgradeableProxy`: Make internal `_proxyAdmin()` getter have `view` visibility.
|
||||
5
.changeset/fine-frogs-bake.md
Normal file
5
.changeset/fine-frogs-bake.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`EnumerableMap`: Add `keys(uint256,uint256)` that returns a subset (slice) of the keys in the map.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Arrays`: deprecate `findUpperBound` in favor of the new `lowerBound`.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': patch
|
||||
---
|
||||
|
||||
`Create2`, `Clones`: Mask `computeAddress` and `cloneDeterministic` outputs to produce a clean value for an `address` type (i.e. only use 20 bytes)
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Strings`: Added a utility function for converting an address to checksummed string.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ERC1363`: Add implementation of the token payable standard allowing execution of contract code after transfers and approvals.
|
||||
5
.changeset/full-ways-help.md
Normal file
5
.changeset/full-ways-help.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`EIP7702Utils`: Add a library for checking if an address has an EIP-7702 delegation in place.
|
||||
5
.changeset/funny-years-yawn.md
Normal file
5
.changeset/funny-years-yawn.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Account`: Added a simple ERC-4337 account implementation with minimal logic to process user operations.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`DoubleEndedQueue`: Custom errors replaced with native panic codes.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`SlotDerivation`: Add a library of methods for derivating common storage slots.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Packing`: Added a new utility for packing, extracting and replacing bytesXX values.
|
||||
5
.changeset/hot-grapes-lie.md
Normal file
5
.changeset/hot-grapes-lie.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`EnumerableSet`: Add `values(uint256,uint256)` that returns a subset (slice) of the values in the set.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`StorageSlot`: Add primitives for operating on the transient storage space using a typed-slot representation.
|
||||
5
.changeset/lazy-poets-cheer.md
Normal file
5
.changeset/lazy-poets-cheer.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`SignerERC7702`: Implementation of `AbstractSigner` for Externally Owned Accounts (EOAs). Useful with ERC-7702.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`AccessManager`: Allow the `onlyAuthorized` modifier to restrict functions added to the manager.
|
||||
5
.changeset/long-hornets-mate.md
Normal file
5
.changeset/long-hornets-mate.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`EnumerableMap`: Add support for `BytesToBytesMap` type.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Votes`: Set `_moveDelegateVotes` visibility to internal instead of private.
|
||||
5
.changeset/lucky-donuts-scream.md
Normal file
5
.changeset/lucky-donuts-scream.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ERC7739`: An abstract contract to validate signatures following the rehashing scheme from `ERC7739Utils`.
|
||||
5
.changeset/major-feet-write.md
Normal file
5
.changeset/major-feet-write.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Bytes`: Add `reverseBytes32`, `reverseBytes16`, `reverseBytes8`, `reverseBytes4`, and `reverseBytes2` functions to reverse byte order for converting between little-endian and big-endian representations.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Create2`: Bubbles up returndata from a deployed contract that reverted during construction.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': patch
|
||||
---
|
||||
|
||||
`SafeCast`: Add `toUint(bool)` for operating on `bool` values as `uint256`.
|
||||
5
.changeset/new-days-tease.md
Normal file
5
.changeset/new-days-tease.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Strings`: Add `toHexString(bytes)`.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`SafeERC20`: Add "relaxed" function for interacting with ERC-1363 functions in a way that is compatible with EOAs.
|
||||
5
.changeset/nice-rings-wish.md
Normal file
5
.changeset/nice-rings-wish.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ERC7913P256Verifier` and `ERC7913RSAVerifier`: Ready to use ERC-7913 verifiers that implement key verification for P256 (secp256r1) and RSA keys.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Hashes`: A library with commonly used hash functions.
|
||||
5
.changeset/pink-dolls-shop.md
Normal file
5
.changeset/pink-dolls-shop.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`EnumerableSet`: Add support for `StringSet` and `BytesSet` types.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ERC721Utils` and `ERC1155Utils`: Add reusable libraries with functions to perform acceptance checks on `IERC721Receiver` and `IERC1155Receiver` implementers.
|
||||
5
.changeset/popular-geese-tan.md
Normal file
5
.changeset/popular-geese-tan.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`GovernorNoncesKeyed`: Extension of `Governor` that adds support for keyed nonces when voting by sig.
|
||||
5
.changeset/proud-tables-sip.md
Normal file
5
.changeset/proud-tables-sip.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ERC7739Utils`: Add a library that implements a defensive rehashing mechanism to prevent replayability of smart contract signatures based on the ERC-7739.
|
||||
5
.changeset/public-crabs-heal.md
Normal file
5
.changeset/public-crabs-heal.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`MultiSignerERC7913Weighted`: Extension of `MultiSignerERC7913` that supports assigning different weights to each signer, enabling more flexible governance schemes.
|
||||
5
.changeset/quiet-kiwis-feel.md
Normal file
5
.changeset/quiet-kiwis-feel.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`SignerERC7913`: Abstract signer that verifies signatures using the ERC-7913 workflow.
|
||||
5
.changeset/rare-shirts-unite.md
Normal file
5
.changeset/rare-shirts-unite.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Arrays`: Add `unsafeAccess`, `unsafeMemoryAccess` and `unsafeSetLength` for `bytes[]` and `string[]`.
|
||||
5
.changeset/rich-cows-repair.md
Normal file
5
.changeset/rich-cows-repair.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`InteroperableAddress`: Add a library for formatting and parsing ERC-7930 interoperable addresses.
|
||||
5
.changeset/ripe-bears-hide.md
Normal file
5
.changeset/ripe-bears-hide.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ERC20Bridgeable`: Implementation of ERC-7802 that makes an ERC-20 compatible with crosschain bridges.
|
||||
5
.changeset/rotten-apes-lie.md
Normal file
5
.changeset/rotten-apes-lie.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`IERC7821`, `ERC7821`: Interface and logic for minimal batch execution. No support for additional `opData` is included.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Math`: Add `modExp` function that exposes the `EIP-198` precompile. Includes `uint256` and `bytes memory` versions.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Panic`: Add a library for reverting with panic codes.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Math`: Custom errors replaced with native panic codes.
|
||||
5
.changeset/social-walls-obey.md
Normal file
5
.changeset/social-walls-obey.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`MultiSignerERC7913`: Implementation of `AbstractSigner` that supports multiple ERC-7913 signers with a threshold-based signature verification system.
|
||||
5
.changeset/sour-pens-shake.md
Normal file
5
.changeset/sour-pens-shake.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`SignatureChecker`: Add support for ERC-7913 signatures alongside existing ECDSA and ERC-1271 signature verification.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Math`, `SignedMath`: Add a branchless `ternary` function that computes`cond ? a : b` in constant gas cost.
|
||||
5
.changeset/strong-points-change.md
Normal file
5
.changeset/strong-points-change.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`AccountERC7579Hooked`: Extension of `AccountERC7579` that implements support for ERC-7579 hook modules.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Errors`: New library of common custom errors.
|
||||
5
.changeset/tame-bears-mix.md
Normal file
5
.changeset/tame-bears-mix.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`AbstractSigner`, `SignerECDSA`, `SignerP256`, and `SignerRSA`: Add an abstract contract and various implementations for contracts that deal with signature verification.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Arrays`: add new functions `lowerBound`, `upperBound`, `lowerBoundMemory` and `upperBoundMemory` for lookups in sorted arrays with potential duplicates.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`AccessManager`, `VestingWallet`, `TimelockController` and `ERC2771Forwarder`: Added a public `initializer` function in their corresponding upgradeable variants.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Base64`: Add `encodeURL` following section 5 of RFC4648 for URL encoding
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`AccessControlEnumerable`: Add a `getRoleMembers` method to return all accounts that have `role`.
|
||||
5
.changeset/violet-turtles-like.md
Normal file
5
.changeset/violet-turtles-like.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ECDSA`: Add `recoverCalldata` and `tryRecoverCalldata`, variants of `recover` and `tryRecover` that are more efficient when signatures are in calldata.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`MerkleTree`: A data structure that allows inserting elements into a merkle tree and updating its root hash.
|
||||
5
.changeset/wet-dodos-reply.md
Normal file
5
.changeset/wet-dodos-reply.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`Blockhash`: Add a library that provides access to historical block hashes using EIP-2935's history storage, extending the standard 256-block limit to 8191 blocks.
|
||||
5
.changeset/whole-plums-speak.md
Normal file
5
.changeset/whole-plums-speak.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`SignatureChecker`: Add `isValidSignatureNowCalldata(address,bytes32,bytes calldata)` for efficient processing of calldata signatures.
|
||||
5
.changeset/wild-baths-buy.md
Normal file
5
.changeset/wild-baths-buy.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`IERC7786`: Add the (draft) interface for ERC-7786 "Cross-Chain Messaging Gateway"
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`VestingWalletCliff`: Add an extension of the `VestingWallet` contract with an added cliff.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`ReentrancyGuardTransient`: Added a variant of `ReentrancyGuard` that uses transient storage.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`EnumerableMap`: add `UintToBytes32Map`, `AddressToAddressMap`, `AddressToBytes32Map` and `Bytes32ToAddressMap`.
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
'openzeppelin-solidity': minor
|
||||
---
|
||||
|
||||
`SignatureChecker`: refactor `isValidSignatureNow` to avoid validating ECDSA signatures if there is code deployed at the signer's address.
|
||||
@ -10,3 +10,7 @@ coverage:
|
||||
project:
|
||||
default:
|
||||
threshold: 1%
|
||||
ignore:
|
||||
- "test"
|
||||
- "contracts/mocks"
|
||||
- "contracts/vendor"
|
||||
|
||||
20
.eslintrc
20
.eslintrc
@ -1,20 +0,0 @@
|
||||
{
|
||||
"root": true,
|
||||
"extends" : [
|
||||
"eslint:recommended",
|
||||
"prettier",
|
||||
],
|
||||
"env": {
|
||||
"es2022": true,
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"mocha": true,
|
||||
},
|
||||
"globals" : {
|
||||
"artifacts": "readonly",
|
||||
"contract": "readonly",
|
||||
"web3": "readonly",
|
||||
"extendEnvironment": "readonly",
|
||||
"expect": "readonly",
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "${CI:-"false"}" != "true" ]; then
|
||||
npm run lint
|
||||
fi
|
||||
10
.github/CODEOWNERS
vendored
Normal file
10
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# List of approvers/reviewers for OpenZeppelin Contracts
|
||||
#
|
||||
# Get in touch with us via the OpenZeppelin Forum
|
||||
# https://forum.openzeppelin.com/
|
||||
#
|
||||
# Learn about CODEOWNERS file format:
|
||||
# https://help.github.com/en/articles/about-code-owners
|
||||
|
||||
# These owners will be the default owners for everything in the repo.
|
||||
* @OpenZeppelin/contracts
|
||||
11
.github/actions/gas-compare/action.yml
vendored
11
.github/actions/gas-compare/action.yml
vendored
@ -2,18 +2,18 @@ name: Compare gas costs
|
||||
description: Compare gas costs between branches
|
||||
inputs:
|
||||
token:
|
||||
description: github token
|
||||
description: GitHub token, required to access GitHub API
|
||||
required: true
|
||||
report:
|
||||
description: report to read from
|
||||
description: Path to the report to compare
|
||||
required: false
|
||||
default: gasReporterOutput.json
|
||||
out_report:
|
||||
description: report to read
|
||||
description: Path to save the output report
|
||||
required: false
|
||||
default: ${{ github.ref_name }}.gasreport.json
|
||||
ref_report:
|
||||
description: report to read from
|
||||
description: Path to the reference report for comparison
|
||||
required: false
|
||||
default: ${{ github.base_ref }}.gasreport.json
|
||||
|
||||
@ -44,7 +44,8 @@ runs:
|
||||
shell: bash
|
||||
- name: Save report
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gasreport
|
||||
overwrite: true
|
||||
path: ${{ inputs.out_report }}
|
||||
|
||||
4
.github/actions/setup/action.yml
vendored
4
.github/actions/setup/action.yml
vendored
@ -6,7 +6,7 @@ runs:
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 22.x
|
||||
- uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
@ -19,4 +19,4 @@ runs:
|
||||
- name: Install Foundry
|
||||
uses: foundry-rs/foundry-toolchain@v1
|
||||
with:
|
||||
version: nightly
|
||||
version: stable
|
||||
|
||||
3
.github/actions/storage-layout/action.yml
vendored
3
.github/actions/storage-layout/action.yml
vendored
@ -50,7 +50,8 @@ runs:
|
||||
shell: bash
|
||||
- name: Save artifacts
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: layout
|
||||
overwrite: true
|
||||
path: ${{ inputs.out_layout }}
|
||||
|
||||
20
.github/workflows/checks.yml
vendored
20
.github/workflows/checks.yml
vendored
@ -41,7 +41,9 @@ jobs:
|
||||
run: npm run test
|
||||
- name: Check linearisation of the inheritance graph
|
||||
run: npm run test:inheritance
|
||||
- name: Check proceduraly generated contracts are up-to-date
|
||||
- name: Check pragma validity
|
||||
run: npm run test:pragma -- --concurrency 1
|
||||
- name: Check procedurally generated contracts are up-to-date
|
||||
run: npm run test:generation
|
||||
- name: Compare gas costs
|
||||
uses: ./.github/actions/gas-compare
|
||||
@ -68,6 +70,8 @@ jobs:
|
||||
run: npm run test
|
||||
- name: Check linearisation of the inheritance graph
|
||||
run: npm run test:inheritance
|
||||
- name: Check pragma validity
|
||||
run: npm run test:pragma -- --concurrency 1
|
||||
- name: Check storage layout
|
||||
uses: ./.github/actions/storage-layout
|
||||
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change') }}
|
||||
@ -83,7 +87,7 @@ jobs:
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Run tests
|
||||
run: forge test -vv
|
||||
run: forge test -vvv
|
||||
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
@ -93,7 +97,7 @@ jobs:
|
||||
uses: ./.github/actions/setup
|
||||
- name: Run coverage
|
||||
run: npm run coverage
|
||||
- uses: codecov/codecov-action@v4
|
||||
- uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@ -114,19 +118,15 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: rm foundry.toml
|
||||
- uses: crytic/slither-action@v0.4.0
|
||||
with:
|
||||
node-version: 18.15
|
||||
slither-version: 0.10.1
|
||||
- uses: crytic/slither-action@v0.4.1
|
||||
|
||||
codespell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run CodeSpell
|
||||
uses: codespell-project/actions-codespell@v2.0
|
||||
uses: codespell-project/actions-codespell@v2.1
|
||||
with:
|
||||
check_hidden: true
|
||||
check_filenames: true
|
||||
skip: package-lock.json,*.pdf
|
||||
skip: package-lock.json,*.pdf,vendor
|
||||
|
||||
4
.github/workflows/formal-verification.yml
vendored
4
.github/workflows/formal-verification.yml
vendored
@ -10,7 +10,7 @@ on:
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
PIP_VERSION: '3.10'
|
||||
PIP_VERSION: '3.11'
|
||||
JAVA_VERSION: '11'
|
||||
SOLC_VERSION: '0.8.20'
|
||||
|
||||
@ -52,7 +52,7 @@ jobs:
|
||||
- name: Install python packages
|
||||
run: pip install -r fv-requirements.txt
|
||||
- name: Install java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
2
.github/workflows/release-cycle.yml
vendored
2
.github/workflows/release-cycle.yml
vendored
@ -131,6 +131,7 @@ jobs:
|
||||
environment: npm
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
if: needs.state.outputs.publish == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -153,6 +154,7 @@ jobs:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
TARBALL: ${{ steps.pack.outputs.tarball }}
|
||||
TAG: ${{ steps.pack.outputs.tag }}
|
||||
NPM_CONFIG_PROVENANCE: true
|
||||
- name: Create Github Release
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -37,6 +37,7 @@ npm-debug.log
|
||||
|
||||
# docs artifacts
|
||||
docs/modules/api
|
||||
build/site
|
||||
|
||||
# only used to package @openzeppelin/contracts
|
||||
contracts/build/
|
||||
|
||||
2
.husky/pre-commit
Executable file
2
.husky/pre-commit
Executable file
@ -0,0 +1,2 @@
|
||||
npm run test:generation
|
||||
npx lint-staged
|
||||
@ -10,4 +10,12 @@ module.exports = {
|
||||
fgrep: '[skip-on-coverage]',
|
||||
invert: true,
|
||||
},
|
||||
// Work around stack too deep for coverage
|
||||
configureYulOptimizer: true,
|
||||
solcOptimizerDetails: {
|
||||
yul: true,
|
||||
yulDetails: {
|
||||
optimizerSteps: '',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
194
CHANGELOG.md
194
CHANGELOG.md
@ -2,10 +2,117 @@
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- `ERC1967Utils`: Removed duplicate declaration of the `Upgraded`, `AdminChanged` and `BeaconUpgraded` events. These events are still available through the `IERC1967` interface located under the `contracts/interfaces/` directory. Minimum pragma version is now 0.8.21.
|
||||
- `Governor`, `GovernorCountingSimple`: The `_countVotes` virtual function now returns an `uint256` with the total votes casted. This change allows for more flexibility for partial and fractional voting. Upgrading users may get a compilation error that can be fixed by adding a return statement to the `_countVotes` function.
|
||||
- Update minimum pragma to 0.8.24 in `SignatureChecker`, `Governor` and Governor's extensions. ([#5716](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5716)).
|
||||
|
||||
### Custom error changes
|
||||
## 5.3.0 (2025-04-09)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- Replace `GovernorCountingOverridable.VoteReceipt` struct parameter member names `hasOverriden` and `overridenWeight` for `hasOverridden` and `overriddenWeight` respectively.
|
||||
|
||||
#### Custom error changes
|
||||
|
||||
- Replace `GovernorAlreadyOverridenVote` with `GovernorAlreadyOverriddenVote`.
|
||||
- Replace `GovernorOnlyProposer` with `GovernorUnableToCancel`.
|
||||
|
||||
### Changes by category
|
||||
|
||||
#### Account
|
||||
|
||||
- `ERC4337Utils`: Update the `hash` function to call `getUserOpHash` on the specified entrypoint and add an `ENTRYPOINT_V08` constant. ([#5614](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5614))
|
||||
- `ERC7579Utils`: Add ABI decoding checks on calldata bounds within `decodeBatch`. ([#5371](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5371))
|
||||
- `ERC7579Utils`: Replace `address(0)` with `address(this)` during execution for calldata compression efficiency. ([#5614](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5614))
|
||||
|
||||
#### Governance
|
||||
|
||||
- `IGovernor`: Add the `getProposalId` function to the governor interface. ([#5290](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5290))
|
||||
- `GovernorProposalGuardian`: Add a governance extension that defines a proposal guardian who can cancel proposals at any stage in their lifecycle. ([#5303](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5303))
|
||||
- `GovernorSequentialProposalId`: Adds a `Governor` extension that sequentially numbers proposal ids instead of using the hash. ([#5290](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5290))
|
||||
- `GovernorSuperQuorum`: Add a governance extension to support a super quorum. Proposals that meet the super quorum (and have a majority of for votes) advance to the `Succeeded` state before the proposal deadline. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
- `GovernorVotesSuperQuorumFraction`: Add a variant of the `GovernorSuperQuorum` extensions where the super quorum is expressed as a fraction of the total supply. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
- `TimelockController`: Receive function is now virtual. ([#5509](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5509))
|
||||
|
||||
#### Structures
|
||||
|
||||
- `EnumerableSet`: Add `clear` function to EnumerableSets which deletes all values in the set. ([#5486](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5486))
|
||||
- `EnumerableMap`: Add `clear` function to EnumerableMaps which deletes all entries in the map. ([#5486](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5486))
|
||||
- `MerkleTree`: Add an update function that replaces a previously inserted leaf with a new value, updating the tree root along the way. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
|
||||
#### Tokens
|
||||
|
||||
- `ERC4626`: Use the `asset` getter in `totalAssets`, `_deposit` and `_withdraw`. ([#5322](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5322))
|
||||
- `IERC6909`: Add the interface for ERC-6909. ([#5343](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5343))
|
||||
- `ERC6909`: Add a standard implementation of ERC6909. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394))
|
||||
- `ERC6909TokenSupply`: Add an extension of ERC6909 which tracks total supply for each token id. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394))
|
||||
- `ERC6909Metadata`: Add an extension of ERC6909 which adds metadata functionality. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394))
|
||||
- `ERC6909ContentURI`: Add an extension of ERC6909 which adds content URI functionality. ([#5394](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5394))
|
||||
- `SafeERC20`: Add `trySafeTransfer` and `trySafeTransferFrom` that do not revert and return false if the transfer is not successful. ([#5483](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5483))
|
||||
|
||||
#### Other
|
||||
|
||||
- `Address`: bubble up revert data on `sendValue` failed call. ([#5379](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5379))
|
||||
- `Calldata`: Library with `emptyBytes` and `emptyString` functions to generate empty `bytes` and `string` calldata types. ([#5422](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5422))
|
||||
- `ERC2771Forwarder`: Expose the `_isTrustedByTarget` internal function to check whether a target trusts the forwarder. ([#5416](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5416))
|
||||
- `Hashes`: Expose `efficientKeccak256` for hashing non-commutative pairs of bytes32 without allocating extra memory. ([#5442](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5442))
|
||||
- `Initializable`: Add `_initializableStorageSlot` function that returns a pointer to the storage struct. The function allows customizing with a custom storage slot with an `override`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
- `Math`: Add `add512`, `mul512` and `mulShr`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
- `Math`: Add saturating arithmetic operations `saturatingAdd`, `saturatingSub` and `saturatingMul`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
- `MessageHashUtils`: Add `toDataWithIntendedValidatorHash(address, bytes32)`. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
- `P256`: Adjust precompile detection in `verifyNative` to consider empty `returndata` on invalid verification. Previously, invalid signatures would've reverted with a `MissingPrecompile` error in chains with RIP-7212 support. ([#5620](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5620))
|
||||
- `Pausable`: Stop explicitly setting `paused` to `false` during construction. ([#5448](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5448))
|
||||
- `Strings`: Add `espaceJSON` that escapes special characters in JSON strings. ([#5526](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5526))
|
||||
|
||||
## 5.2.0 (2025-01-08)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
#### Custom error changes
|
||||
|
||||
This version comes with changes to the custom error identifiers. Contracts previously depending on the following errors should be replaced accordingly:
|
||||
|
||||
- Replace `Errors.FailedCall` with a bubbled-up revert reason in `Address.sendValue`.
|
||||
|
||||
### Changes by category
|
||||
|
||||
#### General
|
||||
|
||||
- Update some pragma directives to ensure that all file requirements match that of the files they import. ([#5273](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5273))
|
||||
|
||||
#### Account
|
||||
|
||||
- `ERC4337Utils`: Add a reusable library to manipulate user operations and interact with ERC-4337 contracts ([#5274](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5274))
|
||||
- `ERC7579Utils`: Add a reusable library to interact with ERC-7579 modular accounts ([#5274](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5274))
|
||||
|
||||
#### Governance
|
||||
|
||||
- `GovernorCountingOverridable`: Add a governor counting module that enables token holders to override the vote of their delegate. ([#5192](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5192))
|
||||
- `VotesExtended`: Create an extension of `Votes` which checkpoints balances and delegates. ([#5192](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5192))
|
||||
|
||||
### Proxy
|
||||
|
||||
- `Clones`: Add `cloneWithImmutableArgs` and `cloneDeterministicWithImmutableArgs` variants that create clones with per-instance immutable arguments. The immutable arguments can be retrieved using `fetchCloneArgs`. The corresponding `predictDeterministicWithImmutableArgs` function is also included. ([#5109](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5109))
|
||||
|
||||
### Tokens
|
||||
|
||||
- `ERC1363Utils`: Add helper similar to the existing `ERC721Utils` and `ERC1155Utils` ([#5133](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5133))
|
||||
|
||||
### Utils
|
||||
|
||||
- `Address`: bubble up revert data on `sendValue` failed call ([#5418](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5418))
|
||||
- `Bytes`: Add a library of common operations that operate on `bytes` objects. ([#5252](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5252))
|
||||
- `CAIP2` and `CAIP10`: Add libraries for formatting and parsing CAIP-2 and CAIP-10 identifiers. ([#5252](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5252))
|
||||
- `NoncesKeyed`: Add a variant of `Nonces` that implements the ERC-4337 entrypoint nonce system. ([#5272](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5272))
|
||||
- `Packing`: Add variants for packing `bytes10` and `bytes22` ([#5274](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5274))
|
||||
- `Strings`: Add `parseUint`, `parseInt`, `parseHexUint` and `parseAddress` to parse strings into numbers and addresses. Also provide variants of these functions that parse substrings, and `tryXxx` variants that do not revert on invalid input. ([#5166](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5166))
|
||||
|
||||
## 5.1.0 (2024-10-17)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- `ERC1967Utils`: Removed duplicate declaration of the `Upgraded`, `AdminChanged` and `BeaconUpgraded` events. These events are still available through the `IERC1967` interface located under the `contracts/interfaces/` directory. Minimum pragma version is now 0.8.21.
|
||||
- `Governor`, `GovernorCountingSimple`: The `_countVote` virtual function now returns an `uint256` with the total votes cast. This change allows for more flexibility for partial and fractional voting. Upgrading users may get a compilation error that can be fixed by adding a return statement to the `_countVote` function.
|
||||
|
||||
#### Custom error changes
|
||||
|
||||
This version comes with changes to the custom error identifiers. Contracts previously depending on the following errors should be replaced accordingly:
|
||||
|
||||
@ -14,6 +121,85 @@ This version comes with changes to the custom error identifiers. Contracts previ
|
||||
- Replace `Clones.Create2InsufficientBalance` with `Errors.InsufficientBalance`
|
||||
- Replace `Clones.ERC1167FailedCreateClone` with `Errors.FailedDeployment`
|
||||
- Replace `Clones.Create2FailedDeployment` with `Errors.FailedDeployment`
|
||||
- `SafeERC20`: Replace `Address.AddressEmptyCode` with `SafeERC20FailedOperation` if there is no code at the token's address.
|
||||
- `SafeERC20`: Replace generic `Error(string)` with `SafeERC20FailedOperation` if the returned data can't be decoded as `bool`.
|
||||
- `SafeERC20`: Replace generic `SafeERC20FailedOperation` with the revert message from the contract call if it fails.
|
||||
|
||||
### Changes by category
|
||||
|
||||
#### General
|
||||
|
||||
- `AccessManager`, `VestingWallet`, `TimelockController` and `ERC2771Forwarder`: Added a public `initializer` function in their corresponding upgradeable variants. ([#5008](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5008))
|
||||
|
||||
#### Access
|
||||
|
||||
- `AccessControlEnumerable`: Add a `getRoleMembers` method to return all accounts that have `role`. ([#4546](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4546))
|
||||
- `AccessManager`: Allow the `onlyAuthorized` modifier to restrict functions added to the manager. ([#5014](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5014))
|
||||
|
||||
#### Finance
|
||||
|
||||
- `VestingWalletCliff`: Add an extension of the `VestingWallet` contract with an added cliff. ([#4870](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4870))
|
||||
|
||||
#### Governance
|
||||
|
||||
- `GovernorCountingFractional`: Add a governor counting module that allows distributing voting power amongst 3 options (For, Against, Abstain). ([#5045](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5045))
|
||||
- `Votes`: Set `_moveDelegateVotes` visibility to internal instead of private. ([#5007](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5007))
|
||||
|
||||
#### Proxy
|
||||
|
||||
- `Clones`: Add version of `clone` and `cloneDeterministic` that support sending value at creation. ([#4936](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4936))
|
||||
- `TransparentUpgradeableProxy`: Make internal `_proxyAdmin()` getter have `view` visibility. ([#4688](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4688))
|
||||
- `ProxyAdmin`: Fixed documentation for `UPGRADE_INTERFACE_VERSION` getter. ([#5031](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5031))
|
||||
|
||||
#### Tokens
|
||||
|
||||
- `ERC1363`: Add implementation of the token payable standard allowing execution of contract code after transfers and approvals. ([#4631](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4631))
|
||||
- `ERC20TemporaryApproval`: Add an ERC-20 extension that implements temporary approval using transient storage, based on ERC7674 (draft). ([#5071](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5071))
|
||||
- `SafeERC20`: Add "relaxed" function for interacting with ERC-1363 functions in a way that is compatible with EOAs. ([#4631](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4631))
|
||||
- `SafeERC20`: Document risks of `safeIncreaseAllowance` and `safeDecreaseAllowance` when associated with ERC-7674. ([#5262](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5262))
|
||||
- `ERC721Utils` and `ERC1155Utils`: Add reusable libraries with functions to perform acceptance checks on `IERC721Receiver` and `IERC1155Receiver` implementers. ([#4845](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4845))
|
||||
- `ERC1363Utils`: Add helper similar to the existing ERC721Utils and ERC1155Utils. ([#5133](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5133))
|
||||
|
||||
#### Utils
|
||||
|
||||
- `Arrays`: add a `sort` functions for `address[]`, `bytes32[]` and `uint256[]` memory arrays. ([#4846](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4846))
|
||||
- `Arrays`: add new functions `lowerBound`, `upperBound`, `lowerBoundMemory` and `upperBoundMemory` for lookups in sorted arrays with potential duplicates. ([#4842](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4842))
|
||||
- `Arrays`: deprecate `findUpperBound` in favor of the new `lowerBound`. ([#4842](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4842))
|
||||
- `Base64`: Add `encodeURL` following section 5 of RFC4648 for URL encoding ([#4822](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4822))
|
||||
- `Comparator`: A library of comparator functions, useful for customizing the behavior of the Heap structure. ([#5084](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5084))
|
||||
- `Create2`: Bubbles up returndata from a deployed contract that reverted during construction. ([#5052](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5052))
|
||||
- `Create2`, `Clones`: Mask `computeAddress` and `cloneDeterministic` outputs to produce a clean value for an `address` type (i.e. only use 20 bytes) ([#4941](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4941))
|
||||
- `Errors`: New library of common custom errors. ([#4936](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4936))
|
||||
- `Hashes`: A library with commonly used hash functions. ([#3617](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3617))
|
||||
- `Packing`: Added a new utility for packing, extracting and replacing bytesXX values. ([#4992](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4992))
|
||||
- `Panic`: Add a library for reverting with panic codes. ([#3298](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3298))
|
||||
- `ReentrancyGuardTransient`: Added a variant of `ReentrancyGuard` that uses transient storage. ([#4988](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4988))
|
||||
- `Strings`: Added a utility function for converting an address to checksummed string. ([#5067](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5067))
|
||||
- `SlotDerivation`: Add a library of methods for derivating common storage slots. ([#4975](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4975))
|
||||
- `TransientSlot`: Add primitives for operating on the transient storage space using a typed-slot representation. ([#4980](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4980))
|
||||
|
||||
##### Cryptography
|
||||
|
||||
- `SignatureChecker`: refactor `isValidSignatureNow` to avoid validating ECDSA signatures if there is code deployed at the signer's address. ([#4951](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4951))
|
||||
- `MerkleProof`: Add variations of `verify`, `processProof`, `multiProofVerify` and `processMultiProof` (and equivalent calldata version) with support for custom hashing functions. ([#4887](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4887))
|
||||
- `P256`: Library for verification and public key recovery of P256 (aka secp256r1) signatures. ([#4881](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4881))
|
||||
- `RSA`: Library to verify signatures according to RFC 8017 Signature Verification Operation ([#4952](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4952))
|
||||
|
||||
#### Math
|
||||
|
||||
- `Math`: add an `invMod` function to get the modular multiplicative inverse of a number in Z/nZ. ([#4839](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4839))
|
||||
- `Math`: Add `modExp` function that exposes the `EIP-198` precompile. Includes `uint256` and `bytes memory` versions. ([#3298](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3298))
|
||||
- `Math`: Custom errors replaced with native panic codes. ([#3298](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3298))
|
||||
- `Math`, `SignedMath`: Add a branchless `ternary` function that computes`cond ? a : b` in constant gas cost. ([#4976](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4976))
|
||||
- `SafeCast`: Add `toUint(bool)` for operating on `bool` values as `uint256`. ([#4878](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4878))
|
||||
|
||||
#### Structures
|
||||
|
||||
- `CircularBuffer`: Add a data structure that stores the last `N` values pushed to it. ([#4913](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4913))
|
||||
- `DoubleEndedQueue`: Custom errors replaced with native panic codes. ([#4872](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4872))
|
||||
- `EnumerableMap`: add `UintToBytes32Map`, `AddressToAddressMap`, `AddressToBytes32Map` and `Bytes32ToAddressMap`. ([#4843](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4843))
|
||||
- `Heap`: A data structure that implements a heap-based priority queue. ([#5084](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5084))
|
||||
- `MerkleTree`: A data structure that allows inserting elements into a merkle tree and updating its root hash. ([#3617](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3617))
|
||||
|
||||
## 5.0.2 (2024-02-29)
|
||||
|
||||
@ -295,7 +481,7 @@ Instead, contracts now revert with custom errors. Systems that interact with sma
|
||||
|
||||
##### Relying on storage locations for retrieving data
|
||||
|
||||
After 5.0, the storage location of some variables were changed. This is the case for `Initializable` and all the upgradeable contracts since they now use namespaced storaged locations. Any system relying on storage locations for retrieving data or detecting capabilities should be updated to support these new locations.
|
||||
After 5.0, the storage location of some variables was changed. This is the case for `Initializable` and all the upgradeable contracts since they now use namespaced storage locations. Any system relying on storage locations for retrieving data or detecting capabilities should be updated to support these new locations.
|
||||
|
||||
## 4.9.6 (2024-02-29)
|
||||
|
||||
|
||||
@ -3,5 +3,8 @@
|
||||
"ethereum": {
|
||||
"ownedBy": "0xAeb37910f93486C85A1F8F994b67E8187554d664"
|
||||
}
|
||||
},
|
||||
"opRetro": {
|
||||
"projectId": "0x939241afa4c4b9e1dda6b8250baa8f04fa8b0debce738cfd324c0b18f9926d25"
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ Code must be thoroughly tested with quality unit tests.
|
||||
|
||||
We defer to the [Moloch Testing Guide](https://github.com/MolochVentures/moloch/tree/master/test#readme) for specific recommendations, though not all of it is relevant here. Note the introduction:
|
||||
|
||||
> Tests should be written, not only to verify correctness of the target code, but to be comprehensively reviewed by other programmers. Therefore, for mission critical Solidity code, the quality of the tests are just as important (if not more so) than the code itself, and should be written with the highest standards of clarity and elegance.
|
||||
> Tests should be written, not only to verify correctness of the target code, but to be comprehensively reviewed by other programmers. Therefore, for mission critical Solidity code, the quality of the tests is just as important (if not more so) than the code itself, and should be written to the highest standards of clarity and elegance.
|
||||
|
||||
Every addition or change to the code must come with relevant and comprehensive tests.
|
||||
|
||||
@ -55,7 +55,7 @@ External contributions must be reviewed separately by multiple maintainers.
|
||||
|
||||
Automation should be used as much as possible to reduce the possibility of human error and forgetfulness.
|
||||
|
||||
Automations that make use of sensitive credentials must use secure secret management, and must be strengthened against attacks such as [those on GitHub Actions worklows](https://github.com/nikitastupin/pwnhub).
|
||||
Automations that make use of sensitive credentials must use secure secret management, and must be strengthened against attacks such as [those on GitHub Actions workflows](https://github.com/nikitastupin/pwnhub).
|
||||
|
||||
Some other examples of automation are:
|
||||
|
||||
@ -131,6 +131,13 @@ In addition to the official Solidity Style Guide we have a number of other conve
|
||||
abstract contract AccessControl is ..., {
|
||||
```
|
||||
|
||||
* Return values are generally not named, unless they are not immediately clear or there are multiple return values.
|
||||
|
||||
```solidity
|
||||
function expiration() public view returns (uint256) { // Good
|
||||
function hasRole() public view returns (bool isMember, uint32 currentDelay) { // Good
|
||||
```
|
||||
|
||||
* Unchecked arithmetic blocks should contain comments explaining why overflow is guaranteed not to happen. If the reason is immediately apparent from the line above the unchecked block, the comment may be omitted.
|
||||
|
||||
* Custom errors should be declared following the [EIP-6093](https://eips.ethereum.org/EIPS/eip-6093) rationale whenever reasonable. Also, consider the following:
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2024 Zeppelin Group Ltd and contributors
|
||||
Copyright (c) 2016-2025 Zeppelin Group Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
# <img src="logo.svg" alt="OpenZeppelin" height="40px">
|
||||
|
||||
[](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/latest)
|
||||
[](https://www.npmjs.org/package/@openzeppelin/contracts)
|
||||
[](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts)
|
||||
[](https://www.gitpoap.io/gh/OpenZeppelin/openzeppelin-contracts)
|
||||
[](https://docs.openzeppelin.com/contracts)
|
||||
[](https://docs.openzeppelin.com/contracts)
|
||||
[](https://forum.openzeppelin.com/)
|
||||
|
||||
**A library for secure smart contract development.** Build on a solid foundation of community-vetted code.
|
||||
|
||||
@ -70,7 +71,7 @@ The guides in the [documentation site](https://docs.openzeppelin.com/contracts)
|
||||
* [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales).
|
||||
* [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools including non-overflowing math, signature verification, and trustless paying systems.
|
||||
|
||||
The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts's development in the [community forum](https://forum.openzeppelin.com).
|
||||
The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts' development in the [community forum](https://forum.openzeppelin.com).
|
||||
|
||||
Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/), which cover several common use cases and good practices. The following articles provide great background reading, though please note that some of the referenced tools have changed, as the tooling in the ecosystem continues to rapidly evolve.
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
# Releasing
|
||||
|
||||
OpenZeppelin Contracts uses a fully automated release process that takes care of compiling, packaging, and publishing the library, all of which is carried out in a clean CI environment (GitHub Actions), implemented in the ([`release-cycle`](.github/workflows/release-cycle.yml)) workflow. This helps to reduce the potential for human error and inconsistencies, and ensures that the release process is ongoing and reliable.
|
||||
OpenZeppelin Contracts uses a fully automated release process that takes care of compiling, packaging, and publishing the library, all of which is carried out in a clean CI environment (GitHub Actions), implemented in the [`release-cycle`](.github/workflows/release-cycle.yml) workflow. This helps to reduce the potential for human error and inconsistencies, and ensures that the release process is consistent and reliable.
|
||||
|
||||
## Changesets
|
||||
|
||||
[Changesets](https://github.com/changesets/changesets/) is used as part of our release process for `CHANGELOG.md` management. Each change that is relevant for the codebase is expected to include a changeset.
|
||||
[Changesets](https://github.com/changesets/changesets/) are used as part of our release process for `CHANGELOG.md` management. Each change that is relevant for the codebase is expected to include a changeset.
|
||||
|
||||
## Branching model
|
||||
|
||||
|
||||
@ -40,4 +40,4 @@ Note as well that the Solidity language itself only guarantees security updates
|
||||
|
||||
## Legal
|
||||
|
||||
Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. Your use of the project is also governed by the terms found at www.openzeppelin.com/tos (the "Terms"). As set out in the Terms, you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an on-going duty by any contributor, including OpenZeppelin, to correct any flaws or alert you to all or any of the potential risks of utilizing the project.
|
||||
Blockchain is a nascent technology and carries a high level of risk and uncertainty. OpenZeppelin makes certain software available under open source licenses, which disclaim all warranties in relation to the project and which limits the liability of OpenZeppelin. Subject to any particular licensing terms, your use of the project is governed by the terms found at [www.openzeppelin.com/tos](https://www.openzeppelin.com/tos) (the "Terms"). As set out in the Terms, you are solely responsible for any use of the project and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an ongoing duty by any contributor, including OpenZeppelin, to correct any issues or vulnerabilities or alert you to all or any of the risks of utilizing the project.
|
||||
|
||||
@ -20,7 +20,7 @@ The git commit hash we evaluated is:
|
||||
|
||||
# Disclaimer
|
||||
|
||||
The audit makes no statements or warrantees about utility of the code, safety of the code, suitability of the business model, regulatory regime for the business model, or any other statements about fitness of the contracts to purpose, or their bugfree status. The audit documentation is for discussion purposes only.
|
||||
The audit makes no statements or warranties about utility of the code, safety of the code, suitability of the business model, regulatory regime for the business model, or any other statements about fitness of the contracts to purpose, or their bug free status. The audit documentation is for discussion purposes only.
|
||||
|
||||
# Executive Summary
|
||||
|
||||
@ -90,7 +90,7 @@ We are still working through the confirmation protocol in `Shareable.sol`, but w
|
||||
This bug has a number of causes that need to be addressed:
|
||||
|
||||
1. `resetSpentToday` and `confirm` together do not limit the days on which the function can be called or (it appears) the number of times it can be called.
|
||||
1. Once a call has been confirmed and `execute`d it appears that it can be re-executed. This is not good.
|
||||
1. Once a call has been confirmed and executed it appears that it can be re-executed. This is not good.
|
||||
3. `confirmandCheck` doesn't seem to have logic about whether or not the function in question has been called.
|
||||
4. Even if it did, `revoke` would need updates and logic to deal with revocation requests after a function call had been completed.
|
||||
|
||||
@ -109,7 +109,7 @@ It would be nice to see how many payments are pending. This would imply a bit of
|
||||
|
||||
## Shareable Contract
|
||||
|
||||
We do not believe the `Shareable.sol` contract is ready for primetime. It is missing functions, and as written may be vulnerable to a reordering attack -- an attack in which a miner or other party "racing" with a smart contract participant inserts their own information into a list or mapping.
|
||||
We do not believe the `Shareable.sol` contract is ready for prime time. It is missing functions, and as written may be vulnerable to a reordering attack -- an attack in which a miner or other party "racing" with a smart contract participant inserts their own information into a list or mapping.
|
||||
|
||||
The confirmation and revocation code needs to be looked over with a very careful eye imagining extraordinarily bad behavior by shared owners before this contract can be called safe.
|
||||
|
||||
@ -159,7 +159,7 @@ Allows owner to set a public string of contract information. No issues.
|
||||
|
||||
This needs some work. Doesn't check if `_required <= len(_owners)` for instance, that would be a bummer. What if _required were like `MAX - 1`?
|
||||
|
||||
I have a general concern about the difference between `owners`, `_owners`, and `owner` in `Ownable.sol`. I recommend "Owners" be renamed. In general we do not recomment single character differences in variable names, although a preceding underscore is not uncommon in Solidity code.
|
||||
I have a general concern about the difference between `owners`, `_owners`, and `owner` in `Ownable.sol`. I recommend "Owners" be renamed. In general we do not recommend single character differences in variable names, although a preceding underscore is not uncommon in Solidity code.
|
||||
|
||||
Line 34: "this contract only has six types of events"...actually only two.
|
||||
|
||||
@ -224,7 +224,7 @@ Transfer() and transferFrom() use SafeMath functions, which will cause them to t
|
||||
|
||||
### SimpleToken
|
||||
|
||||
Sample instantiation of StandardToken. Note that in this sample, decimals is 18 and supply only 10,000, so the supply is a small fraction of a single nominal token.
|
||||
Sample instantiation of StandardToken. Note that in this sample, decimals is 18 and supply is only 10,000, so the supply is a small fraction of a single nominal token.
|
||||
|
||||
### CrowdsaleToken
|
||||
|
||||
|
||||
BIN
audits/2024-10-v5.1.pdf
Normal file
BIN
audits/2024-10-v5.1.pdf
Normal file
Binary file not shown.
BIN
audits/2024-12-v5.2.pdf
Normal file
BIN
audits/2024-12-v5.2.pdf
Normal file
Binary file not shown.
BIN
audits/2025-04-v5.3.pdf
Normal file
BIN
audits/2025-04-v5.3.pdf
Normal file
Binary file not shown.
@ -1,12 +1,15 @@
|
||||
# Audits
|
||||
|
||||
| Date | Version | Commit | Auditor | Scope | Links |
|
||||
| ------------ | ------- | --------- | ------------ | -------------------- | ----------------------------------------------------------- |
|
||||
| October 2023 | v5.0.0 | `b5a3e69` | OpenZeppelin | v5.0 Changes | [🔗](./2023-10-v5.0.pdf) |
|
||||
| May 2023 | v4.9.0 | `91df66c` | OpenZeppelin | v4.9 Changes | [🔗](./2023-05-v4.9.pdf) |
|
||||
| October 2022 | v4.8.0 | `14f98db` | OpenZeppelin | ERC4626, Checkpoints | [🔗](./2022-10-ERC4626.pdf) [🔗](./2022-10-Checkpoints.pdf) |
|
||||
| October 2018 | v2.0.0 | `dac5bcc` | LevelK | Everything | [🔗](./2018-10.pdf) |
|
||||
| March 2017 | v1.0.4 | `9c5975a` | New Alchemy | Everything | [🔗](./2017-03.md) |
|
||||
| Date | Version | Commit | Auditor | Scope | Links |
|
||||
| ------------- | ------- | -------------------------------------------------------------------------------- | ------------ | -------------------- | ----------------------------------------------------------- |
|
||||
| April 2025 | v5.3.0 | [`d4b2e98`](https://github.com/openzeppelin/openzeppelin-contracts/tree/d4b2e98) | OpenZeppelin | v5.3 Changes | [🔗](./2025-04-v5.3.pdf) |
|
||||
| December 2024 | v5.2.0 | [`98d28f9`](https://github.com/openzeppelin/openzeppelin-contracts/tree/98d28f9) | OpenZeppelin | v5.2 Changes | [🔗](./2024-12-v5.2.pdf) |
|
||||
| October 2024 | v5.1.0 | [`aba9ff6`](https://github.com/openzeppelin/openzeppelin-contracts/tree/aba9ff6) | OpenZeppelin | v5.1 Changes | [🔗](./2024-10-v5.1.pdf) |
|
||||
| October 2023 | v5.0.0 | [`b5a3e69`](https://github.com/openzeppelin/openzeppelin-contracts/tree/b5a3e69) | OpenZeppelin | v5.0 Changes | [🔗](./2023-10-v5.0.pdf) |
|
||||
| May 2023 | v4.9.0 | [`91df66c`](https://github.com/openzeppelin/openzeppelin-contracts/tree/91df66c) | OpenZeppelin | v4.9 Changes | [🔗](./2023-05-v4.9.pdf) |
|
||||
| October 2022 | v4.8.0 | [`14f98db`](https://github.com/openzeppelin/openzeppelin-contracts/tree/14f98db) | OpenZeppelin | ERC4626, Checkpoints | [🔗](./2022-10-ERC4626.pdf) [🔗](./2022-10-Checkpoints.pdf) |
|
||||
| October 2018 | v2.0.0 | [`dac5bcc`](https://github.com/openzeppelin/openzeppelin-contracts/tree/dac5bcc) | LevelK | Everything | [🔗](./2018-10.pdf) |
|
||||
| March 2017 | v1.0.4 | [`9c5975a`](https://github.com/openzeppelin/openzeppelin-contracts/tree/9c5975a) | New Alchemy | Everything | [🔗](./2017-03.md) |
|
||||
|
||||
# Formal Verification
|
||||
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
|
||||
These instructions detail the process for running Certora Verification Tool on OpenZeppelin Contracts.
|
||||
|
||||
Documentation for CVT and the specification language are available [here](https://certora.atlassian.net/wiki/spaces/CPD/overview).
|
||||
Documentation for CVT and the specification language is available [here](https://certora.atlassian.net/wiki/spaces/CPD/overview).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Follow the [Certora installation guide](https://docs.certora.com/en/latest/docs/user-guide/getting-started/install.html) in order to get the Certora Prover Package and the `solc` executable folder in your path.
|
||||
|
||||
> **Note**
|
||||
> An API Key is required for local testing. Although the prover will run on a Github Actions' CI environment on selected Pull Requests.
|
||||
> An API Key is required for local testing. Although the prover will run on a GitHub Actions' CI environment on selected Pull Requests.
|
||||
|
||||
## Running the verification
|
||||
|
||||
|
||||
@ -7,11 +7,16 @@
|
||||
// node certora/run.js AccessControl
|
||||
// node certora/run.js AccessControlHarness:AccessControl
|
||||
|
||||
const proc = require('child_process');
|
||||
const { PassThrough } = require('stream');
|
||||
const events = require('events');
|
||||
import { spawn } from 'child_process';
|
||||
import { PassThrough } from 'stream';
|
||||
import { once } from 'events';
|
||||
import path from 'path';
|
||||
import yargs from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
import pLimit from 'p-limit';
|
||||
import fs from 'fs/promises';
|
||||
|
||||
const argv = require('yargs')
|
||||
const argv = yargs(hideBin(process.argv))
|
||||
.env('')
|
||||
.options({
|
||||
all: {
|
||||
@ -21,7 +26,7 @@ const argv = require('yargs')
|
||||
spec: {
|
||||
alias: 's',
|
||||
type: 'string',
|
||||
default: __dirname + '/specs.json',
|
||||
default: path.resolve(import.meta.dirname, 'specs.json'),
|
||||
},
|
||||
parallel: {
|
||||
alias: 'p',
|
||||
@ -38,18 +43,20 @@ const argv = require('yargs')
|
||||
type: 'array',
|
||||
default: [],
|
||||
},
|
||||
}).argv;
|
||||
})
|
||||
.parse();
|
||||
|
||||
function match(entry, request) {
|
||||
const [reqSpec, reqContract] = request.split(':').reverse();
|
||||
return entry.spec == reqSpec && (!reqContract || entry.contract == reqContract);
|
||||
}
|
||||
|
||||
const specs = require(argv.spec).filter(s => argv.all || argv._.some(r => match(s, r)));
|
||||
const limit = require('p-limit')(argv.parallel);
|
||||
const specs = JSON.parse(fs.readFileSync(argv.spec, 'utf8')).filter(s => argv.all || argv._.some(r => match(s, r)));
|
||||
|
||||
const limit = pLimit(argv.parallel);
|
||||
|
||||
if (argv._.length == 0 && !argv.all) {
|
||||
console.error(`Warning: No specs requested. Did you forgot to toggle '--all'?`);
|
||||
console.error(`Warning: No specs requested. Did you forget to toggle '--all'?`);
|
||||
}
|
||||
|
||||
for (const r of argv._) {
|
||||
@ -64,12 +71,13 @@ if (process.exitCode) {
|
||||
}
|
||||
|
||||
for (const { spec, contract, files, options = [] } of specs) {
|
||||
limit(
|
||||
runCertora,
|
||||
spec,
|
||||
contract,
|
||||
files,
|
||||
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
|
||||
limit(() =>
|
||||
runCertora(
|
||||
spec,
|
||||
contract,
|
||||
files,
|
||||
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -79,7 +87,7 @@ async function runCertora(spec, contract, files, options = []) {
|
||||
if (argv.verbose) {
|
||||
console.log('Running:', args.join(' '));
|
||||
}
|
||||
const child = proc.spawn('certoraRun', args);
|
||||
const child = spawn('certoraRun', args);
|
||||
|
||||
const stream = new PassThrough();
|
||||
const output = collect(stream);
|
||||
@ -103,7 +111,7 @@ async function runCertora(spec, contract, files, options = []) {
|
||||
});
|
||||
|
||||
// wait for process end
|
||||
const [code, signal] = await events.once(child, 'exit');
|
||||
const [code, signal] = await once(child, 'exit');
|
||||
|
||||
// error
|
||||
if (code || signal) {
|
||||
@ -152,7 +160,7 @@ function writeEntry(spec, contract, success, url) {
|
||||
formatRow(
|
||||
spec,
|
||||
contract,
|
||||
success ? ':x:' : ':heavy_check_mark:',
|
||||
success ? ':heavy_check_mark:' : ':x:',
|
||||
url ? `[link](${url?.replace('/output/', '/jobStatus/')})` : 'error',
|
||||
url ? `[link](${url})` : 'error',
|
||||
),
|
||||
|
||||
@ -176,7 +176,7 @@ rule renounceRoleEffect(env e, bytes32 role) {
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: defaultAdmin is only affected by accepting an admin transfer or renoucing │
|
||||
│ Rule: defaultAdmin is only affected by accepting an admin transfer or renouncing │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noDefaultAdminChange(env e, method f, calldataarg args) {
|
||||
@ -188,7 +188,7 @@ rule noDefaultAdminChange(env e, method f, calldataarg args) {
|
||||
f.selector == sig:acceptDefaultAdminTransfer().selector ||
|
||||
f.selector == sig:renounceRole(bytes32,address).selector
|
||||
),
|
||||
"default admin is only affected by accepting an admin transfer or renoucing";
|
||||
"default admin is only affected by accepting an admin transfer or renouncing";
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -18,7 +18,7 @@ methods {
|
||||
*/
|
||||
ghost mapping(address => mathint) trackedMintAmount;
|
||||
ghost mapping(address => mathint) trackedBurnAmount;
|
||||
ghost mapping(address => mapping(address => mathint)) trackedTransferedAmount;
|
||||
ghost mapping(address => mapping(address => mathint)) trackedTransferredAmount;
|
||||
|
||||
function specUpdate(address from, address to, uint256 amount) {
|
||||
if (from == 0 && to == 0) { assert(false); } // defensive
|
||||
@ -28,7 +28,7 @@ function specUpdate(address from, address to, uint256 amount) {
|
||||
} else if (to == 0) {
|
||||
trackedBurnAmount[from] = amount;
|
||||
} else {
|
||||
trackedTransferedAmount[from][to] = amount;
|
||||
trackedTransferredAmount[from][to] = amount;
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,5 +51,5 @@ rule checkMintAndBurn(env e) {
|
||||
|
||||
assert trackedMintAmount[receiver] == to_mathint(amount);
|
||||
assert trackedBurnAmount[receiver] == amount + to_mathint(recipient == 0 ? fees : 0);
|
||||
assert (fees > 0 && recipient != 0) => trackedTransferedAmount[receiver][recipient] == to_mathint(fees);
|
||||
assert (fees > 0 && recipient != 0) => trackedTransferredAmount[receiver][recipient] == to_mathint(fees);
|
||||
}
|
||||
|
||||
@ -1,29 +1,25 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
|
||||
// OpenZeppelin Contracts (last updated v5.3.0) (access/AccessControl.sol)
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {IAccessControl} from "./IAccessControl.sol";
|
||||
import {Context} from "../utils/Context.sol";
|
||||
import {ERC165} from "../utils/introspection/ERC165.sol";
|
||||
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";
|
||||
|
||||
/**
|
||||
* @dev Contract module that allows children to implement role-based access
|
||||
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
|
||||
* members except through off-chain means by accessing the contract event logs. Some
|
||||
* applications may benefit from on-chain enumerability, for those cases see
|
||||
* {AccessControlEnumerable}.
|
||||
* @dev 合约模块,允许子合约实现基于角色的访问控制机制。这是一个轻量级版本,
|
||||
* 不允许枚举角色成员,除非通过链下方式访问合约事件日志。某些应用可能会受益于链上可枚举性,
|
||||
* 对于这些情况,请参见 {AccessControlEnumerable}。
|
||||
*
|
||||
* Roles are referred to by their `bytes32` identifier. These should be exposed
|
||||
* in the external API and be unique. The best way to achieve this is by
|
||||
* using `public constant` hash digests:
|
||||
* 角色通过其 `bytes32` 标识符来引用。这些应该在外部 API 中公开并且是唯一的。
|
||||
* 实现这一点的最佳方法是使用 `public constant` 哈希摘要:
|
||||
*
|
||||
* ```solidity
|
||||
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
|
||||
* ```
|
||||
*
|
||||
* Roles can be used to represent a set of permissions. To restrict access to a
|
||||
* function call, use {hasRole}:
|
||||
* 角色可以用来表示一组权限。要限制对函数调用的访问,请使用 {hasRole}:
|
||||
*
|
||||
* ```solidity
|
||||
* function foo() public {
|
||||
@ -32,19 +28,15 @@ import {ERC165} from "../utils/introspection/ERC165.sol";
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Roles can be granted and revoked dynamically via the {grantRole} and
|
||||
* {revokeRole} functions. Each role has an associated admin role, and only
|
||||
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
|
||||
* 角色可以通过 {grantRole} 和 {revokeRole} 函数动态授予和撤销。每个角色都有一个关联的管理员角色,
|
||||
* 只有具有角色管理员角色的账户才能调用 {grantRole} 和 {revokeRole}。
|
||||
*
|
||||
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
|
||||
* that only accounts with this role will be able to grant or revoke other
|
||||
* roles. More complex role relationships can be created by using
|
||||
* {_setRoleAdmin}.
|
||||
* 默认情况下,所有角色的管理员角色是 `DEFAULT_ADMIN_ROLE`,这意味着只有具有此角色的账户
|
||||
* 才能授予或撤销其他角色。可以使用 {_setRoleAdmin} 创建更复杂的角色关系。
|
||||
*
|
||||
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
|
||||
* grant and revoke this role. Extra precautions should be taken to secure
|
||||
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
|
||||
* to enforce additional security measures for this role.
|
||||
* 警告:`DEFAULT_ADMIN_ROLE` 也是其自身的管理员:它有权限授予和撤销这个角色。
|
||||
* 应该采取额外的预防措施来保护已被授予此角色的账户。我们建议使用 {AccessControlDefaultAdminRules}
|
||||
* 来为此角色强制执行额外的安全措施。
|
||||
*/
|
||||
abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
||||
struct RoleData {
|
||||
@ -57,39 +49,36 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
||||
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
|
||||
|
||||
/**
|
||||
* @dev Modifier that checks that an account has a specific role. Reverts
|
||||
* with an {AccessControlUnauthorizedAccount} error including the required role.
|
||||
* @dev 检查账户是否具有特定角色的修饰符。如果没有,则使用 {AccessControlUnauthorizedAccount} 错误
|
||||
* 回退,包括所需的角色。
|
||||
*/
|
||||
modifier onlyRole(bytes32 role) {
|
||||
_checkRole(role);
|
||||
_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC165-supportsInterface}.
|
||||
*/
|
||||
/// @inheritdoc IERC165
|
||||
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
|
||||
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns `true` if `account` has been granted `role`.
|
||||
* @dev 如果 `account` 已被授予 `role`,则返回 `true`。
|
||||
*/
|
||||
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
|
||||
return _roles[role].hasRole[account];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
|
||||
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
|
||||
* @dev 如果 `_msgSender()` 缺少 `role`,则使用 {AccessControlUnauthorizedAccount} 错误回退。
|
||||
* 重写此函数会改变 {onlyRole} 修饰符的行为。
|
||||
*/
|
||||
function _checkRole(bytes32 role) internal view virtual {
|
||||
_checkRole(role, _msgSender());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
|
||||
* is missing `role`.
|
||||
* @dev 如果 `account` 缺少 `role`,则使用 {AccessControlUnauthorizedAccount} 错误回退。
|
||||
*/
|
||||
function _checkRole(bytes32 role, address account) internal view virtual {
|
||||
if (!hasRole(role, account)) {
|
||||
@ -98,61 +87,57 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the admin role that controls `role`. See {grantRole} and
|
||||
* {revokeRole}.
|
||||
* @dev 返回控制 `role` 的管理员角色。请参见 {grantRole} 和 {revokeRole}。
|
||||
*
|
||||
* To change a role's admin, use {_setRoleAdmin}.
|
||||
* 要更改角色的管理员,请使用 {_setRoleAdmin}。
|
||||
*/
|
||||
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
|
||||
return _roles[role].adminRole;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Grants `role` to `account`.
|
||||
* @dev 将 `role` 授予给 `account`。
|
||||
*
|
||||
* If `account` had not been already granted `role`, emits a {RoleGranted}
|
||||
* event.
|
||||
* 如果 `account` 尚未被授予 `role`,则发出 {RoleGranted} 事件。
|
||||
*
|
||||
* Requirements:
|
||||
* 要求:
|
||||
*
|
||||
* - the caller must have ``role``'s admin role.
|
||||
* - 调用者必须具有 `role` 的管理员角色。
|
||||
*
|
||||
* May emit a {RoleGranted} event.
|
||||
* 可能发出 {RoleGranted} 事件。
|
||||
*/
|
||||
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
|
||||
_grantRole(role, account);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Revokes `role` from `account`.
|
||||
* @dev 从 `account` 撤销 `role`。
|
||||
*
|
||||
* If `account` had been granted `role`, emits a {RoleRevoked} event.
|
||||
* 如果 `account` 已被授予 `role`,则发出 {RoleRevoked} 事件。
|
||||
*
|
||||
* Requirements:
|
||||
* 要求:
|
||||
*
|
||||
* - the caller must have ``role``'s admin role.
|
||||
* - 调用者必须具有 `role` 的管理员角色。
|
||||
*
|
||||
* May emit a {RoleRevoked} event.
|
||||
* 可能发出 {RoleRevoked} 事件。
|
||||
*/
|
||||
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
|
||||
_revokeRole(role, account);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Revokes `role` from the calling account.
|
||||
* @dev 从调用账户撤销 `role`。
|
||||
*
|
||||
* Roles are often managed via {grantRole} and {revokeRole}: this function's
|
||||
* purpose is to provide a mechanism for accounts to lose their privileges
|
||||
* if they are compromised (such as when a trusted device is misplaced).
|
||||
* 角色通常通过 {grantRole} 和 {revokeRole} 进行管理:此函数的目的是为账户提供一种机制,
|
||||
* 在它们受到损害时(例如当受信任的设备丢失时)失去其特权。
|
||||
*
|
||||
* If the calling account had been revoked `role`, emits a {RoleRevoked}
|
||||
* event.
|
||||
* 如果调用账户的 `role` 已被撤销,则发出 {RoleRevoked} 事件。
|
||||
*
|
||||
* Requirements:
|
||||
* 要求:
|
||||
*
|
||||
* - the caller must be `callerConfirmation`.
|
||||
* - 调用者必须是 `callerConfirmation`。
|
||||
*
|
||||
* May emit a {RoleRevoked} event.
|
||||
* 可能发出 {RoleRevoked} 事件。
|
||||
*/
|
||||
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
|
||||
if (callerConfirmation != _msgSender()) {
|
||||
@ -163,9 +148,9 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Sets `adminRole` as ``role``'s admin role.
|
||||
* @dev 将 `adminRole` 设置为 `role` 的管理员角色。
|
||||
*
|
||||
* Emits a {RoleAdminChanged} event.
|
||||
* 发出 {RoleAdminChanged} 事件。
|
||||
*/
|
||||
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
|
||||
bytes32 previousAdminRole = getRoleAdmin(role);
|
||||
@ -174,11 +159,11 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
|
||||
* @dev 尝试将 `role` 授予给 `account` 并返回一个布尔值,指示是否授予了 `role`。
|
||||
*
|
||||
* Internal function without access restriction.
|
||||
* 内部函数,无访问限制。
|
||||
*
|
||||
* May emit a {RoleGranted} event.
|
||||
* 可能发出 {RoleGranted} 事件。
|
||||
*/
|
||||
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
|
||||
if (!hasRole(role, account)) {
|
||||
@ -191,11 +176,11 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
|
||||
* @dev 尝试从 `account` 撤销 `role` 并返回一个布尔值,指示是否撤销了 `role`。
|
||||
*
|
||||
* Internal function without access restriction.
|
||||
* 内部函数,无访问限制。
|
||||
*
|
||||
* May emit a {RoleRevoked} event.
|
||||
* 可能发出 {RoleRevoked} 事件。
|
||||
*/
|
||||
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
|
||||
if (hasRole(role, account)) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
|
||||
// OpenZeppelin Contracts (last updated v5.3.0) (access/IAccessControl.sol)
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
pragma solidity >=0.8.4;
|
||||
|
||||
/**
|
||||
* @dev External interface of AccessControl declared to support ERC-165 detection.
|
||||
@ -23,7 +23,7 @@ interface IAccessControl {
|
||||
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
|
||||
*
|
||||
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
|
||||
* {RoleAdminChanged} not being emitted signaling this.
|
||||
* {RoleAdminChanged} not being emitted to signal this.
|
||||
*/
|
||||
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
|
||||
|
||||
|
||||
@ -6,34 +6,29 @@ pragma solidity ^0.8.20;
|
||||
import {Context} from "../utils/Context.sol";
|
||||
|
||||
/**
|
||||
* @dev Contract module which provides a basic access control mechanism, where
|
||||
* there is an account (an owner) that can be granted exclusive access to
|
||||
* specific functions.
|
||||
* @dev 合约模块,提供基本的访问控制机制,其中有一个账户(所有者)可以被授予对特定函数的独占访问权限。
|
||||
*
|
||||
* The initial owner is set to the address provided by the deployer. This can
|
||||
* later be changed with {transferOwnership}.
|
||||
* 初始所有者设置为部署者提供的地址。这可以稍后通过 {transferOwnership} 更改。
|
||||
*
|
||||
* This module is used through inheritance. It will make available the modifier
|
||||
* `onlyOwner`, which can be applied to your functions to restrict their use to
|
||||
* the owner.
|
||||
* 此模块通过继承使用。它将提供修饰符 `onlyOwner`,可以应用于您的函数以限制它们仅供所有者使用。
|
||||
*/
|
||||
abstract contract Ownable is Context {
|
||||
address private _owner;
|
||||
|
||||
/**
|
||||
* @dev The caller account is not authorized to perform an operation.
|
||||
* @dev 调用者账户未被授权执行操作。
|
||||
*/
|
||||
error OwnableUnauthorizedAccount(address account);
|
||||
|
||||
/**
|
||||
* @dev The owner is not a valid owner account. (eg. `address(0)`)
|
||||
* @dev 所有者不是有效的所有者账户。(例如 `address(0)`)
|
||||
*/
|
||||
error OwnableInvalidOwner(address owner);
|
||||
|
||||
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
||||
|
||||
/**
|
||||
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
|
||||
* @dev 初始化合约,将部署者提供的地址设置为初始所有者。
|
||||
*/
|
||||
constructor(address initialOwner) {
|
||||
if (initialOwner == address(0)) {
|
||||
@ -43,7 +38,7 @@ abstract contract Ownable is Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Throws if called by any account other than the owner.
|
||||
* @dev 如果由所有者以外的任何账户调用则抛出异常。
|
||||
*/
|
||||
modifier onlyOwner() {
|
||||
_checkOwner();
|
||||
@ -51,14 +46,14 @@ abstract contract Ownable is Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the address of the current owner.
|
||||
* @dev 返回当前所有者的地址。
|
||||
*/
|
||||
function owner() public view virtual returns (address) {
|
||||
return _owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Throws if the sender is not the owner.
|
||||
* @dev 如果发送者不是所有者则抛出异常。
|
||||
*/
|
||||
function _checkOwner() internal view virtual {
|
||||
if (owner() != _msgSender()) {
|
||||
@ -67,19 +62,16 @@ abstract contract Ownable is Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Leaves the contract without owner. It will not be possible to call
|
||||
* `onlyOwner` functions. Can only be called by the current owner.
|
||||
* @dev 使合约没有所有者。将无法调用 `onlyOwner` 函数。只能由当前所有者调用。
|
||||
*
|
||||
* NOTE: Renouncing ownership will leave the contract without an owner,
|
||||
* thereby disabling any functionality that is only available to the owner.
|
||||
* 注意:放弃所有权将使合约没有所有者,从而禁用仅对所有者可用的任何功能。
|
||||
*/
|
||||
function renounceOwnership() public virtual onlyOwner {
|
||||
_transferOwnership(address(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Transfers ownership of the contract to a new account (`newOwner`).
|
||||
* Can only be called by the current owner.
|
||||
* @dev 将合约的所有权转移给新账户 (`newOwner`)。只能由当前所有者调用。
|
||||
*/
|
||||
function transferOwnership(address newOwner) public virtual onlyOwner {
|
||||
if (newOwner == address(0)) {
|
||||
@ -89,8 +81,7 @@ abstract contract Ownable is Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Transfers ownership of the contract to a new account (`newOwner`).
|
||||
* Internal function without access restriction.
|
||||
* @dev 将合约的所有权转移给新账户 (`newOwner`)。内部函数,无访问限制。
|
||||
*/
|
||||
function _transferOwnership(address newOwner) internal virtual {
|
||||
address oldOwner = _owner;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user