Compare commits

..

294 Commits

Author SHA1 Message Date
264f00fe39 更新合约文档,翻译为中文以增强可读性,包括 AccessControl、Ownable、ERC20 和 IERC20 的相关说明。修正了一些注释以确保准确性和一致性。
Some checks failed
transpile upgradeable / transpile (push) Has been cancelled
2025-07-12 23:27:57 +08:00
bc8f775df2 Add Calldata variants of ECDSA.recover, ECDSA.tryRecover and SignatureChecker.isValidSignatureNow (#5788) 2025-07-11 16:57:04 +02:00
667bb9b5c3 Clarify documentation for IAccessManager.canCall (#5795) 2025-07-11 16:54:18 +02:00
5def3f7c7e Add reverseBits operations to Bytes.sol (#5724)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-07-10 10:36:41 -06:00
21cd7e8aa3 Add Memory utility library (#5189)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-07-10 09:15:27 +02:00
a5350ecdd3 Add Strings.toHexString(bytes) (#5761) 2025-07-09 14:20:46 -06:00
fd9bbaec30 Add ERC-7786 interface (#5737) 2025-07-09 21:50:48 +02:00
6ef73e3386 Add Account framework docs and guides (#5660) 2025-07-09 09:10:48 -06:00
a95d01c30d Address 5.4 audit documentation improvements (#5779) 2025-07-09 15:53:47 +02:00
ba35d580f4 Cause _addSigners to revert if it triggers a totalWeight overflow (#5790) 2025-07-09 09:08:13 +02:00
f9f7db03f3 Fix flaky test testFuzzFutureBlocks (#5783)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-07-06 18:49:39 +02:00
0aaa23e57d Minimize pragma for MultiSignerERC7913Weighted.sol (#5778) 2025-07-03 13:51:56 -06:00
5936cd8025 Improve naming consystency in EnumerableSet (#5776) 2025-07-03 13:29:43 -06:00
292b3542fc Do not emit an event when setSignerWeight is a no-op (#5775) 2025-07-03 13:19:29 -06:00
6e14ecc01a Fix typos in release-5.4 (#5777) 2025-07-03 16:36:12 +02:00
cc94ea4930 MultiSignerERC7913: prevent setting the threshold to zero (#5772) 2025-06-27 13:29:40 +02:00
1a87de9326 Use hardhat network helper to clear code blockhash test (#5768)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-26 10:50:39 -04:00
2422d7cf7f Update hardhat and hardhat-ethers dependencies (#5752)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-25 16:45:59 +02:00
387ce69e6b Add script to automatically minimize pragma (#5740)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-06-25 09:56:44 -04:00
56fe41c588 Update dependency halmos to v0.3.0 (#5763)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-25 10:50:09 +02:00
90117f33f0 Bump pbkdf2 from 3.1.2 to 3.1.3 (#5766)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-25 10:49:51 +02:00
b84db20fb2 Add checkpoint variant with uint256 keys and values (#5748)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-23 11:55:24 -04:00
6079eb3f01 Add signer constructors (#5757)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-06-20 13:09:28 +02:00
61f81e313c Annotate stateless cryptography contracts (#5756) 2025-06-20 11:49:06 +02:00
668221e314 Fix upgradeable workflow by not running the linter on transpiled output (#5754) 2025-06-19 14:11:57 +02:00
2909098755 ERC-7930 (#5736)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-06-19 09:17:04 +02:00
51da8ae490 Update dependency yargs to v18 (#5704)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-18 22:01:19 +02:00
6ccfb7b891 Update dependency node to v22 (#5616)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-18 14:41:05 +02:00
3eddace0cb Update dependency prettier-plugin-solidity to v2 (#5654)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-17 17:07:27 +02:00
800200d452 Add Codeowners (#5749) 2025-06-16 22:30:31 +02:00
f27019d48e Add draft- prefix to ERC-7821 (#5742) 2025-06-13 20:34:57 +02:00
7be5dde82d Add MultiSignerERC7913Weighted (#5718) 2025-06-12 20:09:50 +02:00
5c79432e40 ERC20Bridgable (ERC-7802) (#5735)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-06-11 18:19:56 -06:00
bbc4d7ae67 Fix pragma check for upgradeable test (#5738) 2025-06-11 14:28:35 -04:00
8dcc4b9e88 Improve test of Blockhash.sol: all cases on supported and unsupported chains (#5732) 2025-06-11 19:48:25 +02:00
78c8da8648 Update pragma check: validate by actually running the compiler (#5730)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-06-11 10:55:49 -06:00
e11cac459e Add draft- prefix to ERC-7579 and ERC-7739 related files (#5728)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-06-09 14:10:35 -06:00
13d9086d0b Minimize Solidity pragma versions for interface compatibility (#5727) 2025-06-09 10:38:05 -06:00
be547e4d14 Update language in legal disclaimer (#5720) 2025-06-06 17:28:26 -04:00
4d13a007e2 Rename isValidERC7913SignatureNow to isValidSignatureNow (#5719) 2025-06-06 10:07:22 +02:00
1d9400e053 Add ERC7913 signers and utilities (#5659)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-05 09:22:26 -06:00
8bff2a72d9 Add Governor extension GovernorNoncesKeyed to use NoncesKeyed for vote by sig (#5574)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-06-05 15:03:18 +02:00
b6a5e89de7 Fix docs references to cryptographic utilities (#5717) 2025-06-04 18:23:02 -06:00
37f873d50b Increase SignatureChecker minimum pragma to 0.8.24 (#5716) 2025-06-04 10:44:41 -06:00
b3d6f71d0c Fix typos (#5631)
Co-authored-by: Olexandr88 <radole1203@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Maxim Tiron <xzstnc@mail.ru>
2025-06-04 10:51:10 +02:00
d20b9e30bd Add paginated version of EnumerableSet.values() and EnumerableMap.keys() (#5713)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-06-04 09:33:00 +02:00
f45e9158b7 Reorder cryptography folder (#5711)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-06-03 21:40:34 -06:00
784d4f71b1 Add non-value types in EnumerableSet and EnumerableMap (#5658)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-03 16:26:06 +02:00
4bafedfe72 Update dependency lint-staged to v16 (#5679)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-06-03 09:28:34 +02:00
83d2a247be Add Account framework (#5657) 2025-06-02 08:22:57 -06:00
88962fb5ab Add EIP7702Utils (#5587) 2025-06-01 21:08:11 -06:00
a6ae04acf8 Refactor Blockhash lib (#5702) 2025-05-29 17:23:34 +02:00
a7d38c7a33 Revert #5663 changes that were missed in #5696 (#5703) 2025-05-27 14:44:59 -04:00
441b1c1c5b Remove legacy peer dependency npm tag (#5696) 2025-05-23 17:14:40 -06:00
8e3ea8b48d Update EIP712 upgradeable patch file (#5690)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-05-22 12:32:56 -06:00
48bd2864c6 Updated SignatureChecker NatSpec to better reflect EIP-7702 behavior (#5670) 2025-05-16 09:37:07 -06:00
de89798004 Add docs for the Time library (#5684)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-05-16 09:36:38 -06:00
ccde353a20 Document the non-zero delay enforcement in AccessControlDefaultAdminRules (#5687)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-05-15 15:30:37 -06:00
e34251682b Remove duplicated changesets (#5673) 2025-05-08 10:35:51 -04:00
633a1c85ca Rewrite assembly slot offset for consistency (#5325) 2025-05-07 13:54:42 -06:00
bdf8affec3 Upgrade hardhat to v2.24.0 (#5671) 2025-05-07 10:38:04 -06:00
4aaf40ac5d Remove unused imports with solhint plus extra rules (#5661) 2025-05-07 10:23:49 -06:00
6bcc3a470d Update dependency ethers to v6.14.0 (#5668)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-05-06 21:34:52 -06:00
a3a9e8cc3b Add ERC7739 and ERC7739Utils (#5664) 2025-05-06 12:47:36 -06:00
08566bfe0d Test ethers 6.13.6-beta.1, use solc 0.8.27 and prague EVM version (#5663) 2025-05-05 16:20:05 -06:00
9393147db7 Remove BlockhashMock (#5662) 2025-05-02 16:55:05 -04:00
d61a349165 Update lockfile (#5615)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-05-02 13:17:54 -06:00
1958f092b0 Bump elliptic and @ethersproject/signing-key (#5624)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-05-02 11:32:10 -06:00
b1e517cba2 Bump serialize-javascript, mocha and solidity-coverage (#5625)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-05-02 11:31:57 -06:00
3a52d35555 Bump base-x from 3.0.9 to 3.0.11 (#5655)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-02 11:13:45 -06:00
3e75ff1862 Add blockhash to docs (#5653)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-04-29 17:04:32 -06:00
6dd191a979 Add Blockhash library following EIP-2935 (#5642)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-04-29 16:05:27 -06:00
56c07e59c4 Show stack trace for failing foundry tests in CI (#5647) 2025-04-24 11:18:57 -04:00
da32fb3bd8 Add missing id-token: write permission in release pipeline (#5645)
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
2025-04-22 15:24:43 -06:00
3a14bcc783 Add provenance to NPM publish during release cycle (#5644) 2025-04-21 16:53:38 -06:00
aaf955de56 Migrate to inheritdoc (#5636)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-04-21 14:19:10 -04:00
06ea3b1b4e Add Slither reentrancy exception to GovernorTimelockAccess._queueOperations (#5643)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-04-21 12:02:30 -06:00
21c8312b02 Remove AccessControlNonRevokable mock and unnecesary changelog entry (#5635) 2025-04-10 12:15:42 -06:00
d183d9b07a Merge release-v5.3 branch (#5632)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
Co-authored-by: Joseph Delong <joseph@delong.me>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Renan Souza <renan.rodrigues.souza1@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Voronor <129545215+voronor@users.noreply.github.com>
Co-authored-by: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com>
Co-authored-by: Michalis Kargakis <kargakis@protonmail.com>
Co-authored-by: Bilog WEB3 <155262265+Bilogweb3@users.noreply.github.com>
Co-authored-by: Fallengirl <155266340+Fallengirl@users.noreply.github.com>
Co-authored-by: XxAlex74xX <30472093+XxAlex74xX@users.noreply.github.com>
Co-authored-by: PixelPilot <161360836+PixelPil0t1@users.noreply.github.com>
Co-authored-by: kilavvy <140459108+kilavvy@users.noreply.github.com>
Co-authored-by: Devkuni <155117116+detrina@users.noreply.github.com>
Co-authored-by: Danbo <140512416+dannbbb1@users.noreply.github.com>
Co-authored-by: Ann Wagner <chant_77_swirly@icloud.com>
Co-authored-by: comfsrt <155266597+comfsrt@users.noreply.github.com>
Co-authored-by: Bob <158583129+bouchmann@users.noreply.github.com>
Co-authored-by: JohnBonny <158583902+JohnBonny@users.noreply.github.com>
Co-authored-by: moonman <155266991+moooonman@users.noreply.github.com>
Co-authored-by: kazak <alright-epsilon8h@icloud.com>
Co-authored-by: Wei <ybxerlvqtx@rambler.ru>
Co-authored-by: Maxim Evtush <154841002+maximevtush@users.noreply.github.com>
Co-authored-by: Vitalyr <158586577+Vitaliyr888@users.noreply.github.com>
Co-authored-by: pendrue <158588659+pendrue@users.noreply.github.com>
Co-authored-by: Tronica <wudmytrotest404@gmail.com>
Co-authored-by: emmmm <155267286+eeemmmmmm@users.noreply.github.com>
Co-authored-by: bigbear <155267841+aso20455@users.noreply.github.com>
Co-authored-by: Tomás Andróil <tomasandroil@gmail.com>
Co-authored-by: GooseMatrix <155266802+GooseMatrix@users.noreply.github.com>
Co-authored-by: jasmy <3776356370@qq.com>
Co-authored-by: SITADRITA1 <mrlime2018@gmail.com>
Co-authored-by: Ocenka <testoviydiman1@gmail.com>
2025-04-09 20:47:07 +02:00
10a776bae6 Add v5.3 audit report (#5626) 2025-04-04 22:31:03 +02:00
aa29301672 Fix issue with detection of RIP7212 precompile (#5620)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-04-03 09:02:04 -06:00
450b833278 Group typo fixes #2 (#5561)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-04-01 14:23:19 -06:00
1873ecb38e Update dependency eslint-config-prettier to v10 (#5430)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-28 10:19:48 -06:00
952775e4f1 Implement ERC-7821 calldata compression in ERC7579Utils (#5602) 2025-03-27 09:27:34 +01:00
a31b4a438a Update lockfile (#5545)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-26 11:34:50 -06:00
5a5867e548 Bump axios from 1.7.4 to 1.8.4 (#5598)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-26 12:03:06 +01:00
1eb82eca85 ERC2771Context gas improvements (#5590)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-03-26 12:00:40 +01:00
0a77e54c30 Use Entrypoint's provided hashing function to support v0.8.0 change of hash (#5586)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-03-25 20:41:28 +01:00
d9933585b6 Use new tagged slither action release (#5600) 2025-03-24 19:40:07 -04:00
6015d7ef79 Use patched version of slither ci (#5594) 2025-03-20 16:25:30 +01:00
fda6b85f2c Improve error granularity of EnumerableMap behavior tests (#5581) 2025-03-13 15:40:36 +01:00
8a4eadea51 Add support for more types in Arrays.sol (#5568) 2025-03-13 13:44:41 +01:00
f740084582 Revert "Add Bytes32x2Set (#5442)" (#5569) 2025-03-11 17:16:41 +01:00
ca7a4e39de Group typo fixes (#5466)
Co-authored-by: Bilog WEB3 <155262265+Bilogweb3@users.noreply.github.com>
Co-authored-by: Fallengirl <155266340+Fallengirl@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: XxAlex74xX <30472093+XxAlex74xX@users.noreply.github.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: PixelPilot <161360836+PixelPil0t1@users.noreply.github.com>
Co-authored-by: kilavvy <140459108+kilavvy@users.noreply.github.com>
Co-authored-by: Devkuni <155117116+detrina@users.noreply.github.com>
Co-authored-by: Danbo <140512416+dannbbb1@users.noreply.github.com>
Co-authored-by: Ann Wagner <chant_77_swirly@icloud.com>
Co-authored-by: comfsrt <155266597+comfsrt@users.noreply.github.com>
Co-authored-by: Bob <158583129+bouchmann@users.noreply.github.com>
Co-authored-by: JohnBonny <158583902+JohnBonny@users.noreply.github.com>
Co-authored-by: moonman <155266991+moooonman@users.noreply.github.com>
Co-authored-by: kazak <alright-epsilon8h@icloud.com>
Co-authored-by: Wei <ybxerlvqtx@rambler.ru>
Co-authored-by: Maxim Evtush <154841002+maximevtush@users.noreply.github.com>
Co-authored-by: Vitalyr <158586577+Vitaliyr888@users.noreply.github.com>
Co-authored-by: pendrue <158588659+pendrue@users.noreply.github.com>
Co-authored-by: Tronica <wudmytrotest404@gmail.com>
Co-authored-by: emmmm <155267286+eeemmmmmm@users.noreply.github.com>
Co-authored-by: bigbear <155267841+aso20455@users.noreply.github.com>
Co-authored-by: Tomás Andróil <tomasandroil@gmail.com>
Co-authored-by: GooseMatrix <155266802+GooseMatrix@users.noreply.github.com>
Co-authored-by: jasmy <3776356370@qq.com>
Co-authored-by: SITADRITA1 <mrlime2018@gmail.com>
Co-authored-by: Ocenka <testoviydiman1@gmail.com>
2025-03-06 09:58:25 +01:00
fa995ef1fe Add espaceJSON to String.sol (#5508)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-03-03 15:31:43 +01:00
3882a09163 Update dependency halmos to v0.2.6 (#5515)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-28 22:24:09 +01:00
15653ff10e Bump undici (#5544)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 22:22:30 +01:00
71bc0f7774 Add function to update a leaf in a MerkleTree structure (#5453)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-02-28 21:22:56 +01:00
7276774f34 Add a governance extension that implements super quorum (#5492)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-02-28 21:13:07 +01:00
ddba55780a Update dependency globals to v16 (#5518)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-28 21:06:33 +01:00
a4b0d89900 MessageHashUtils: Add toDataWithIntendedValidatorHash(address, bytes32) (#5081)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-02-28 21:00:43 +01:00
a9b1f58b00 Add saturating (unsigned) math operations and optimize try operations (#5527) 2025-02-27 10:03:54 +01:00
506e1f827a Ensure cross-platform of coverage.sh (#5316) 2025-02-26 14:09:01 +01:00
f999ba42a1 Add 512bits add and mult operations (#5035) 2025-02-26 11:04:14 +01:00
2ed8956992 Add _initializableStorageSlot (#5337)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-02-24 15:40:42 +01:00
3bdc3a35c5 Add Arachnid's and Micah's deployer to the common contracts (#5519) 2025-02-21 22:54:43 +01:00
930598edfb Authority utils assembly (#5074) 2025-02-20 00:10:27 +08:00
9586aaf352 Support foundry v1.0 (#5511) 2025-02-15 20:54:49 +01:00
f281e98c94 Make TimelockController receive function virtual (#5506)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-02-14 09:28:26 +01:00
fa8bed68af Treat code-size warnings as errors (#5101)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-02-13 12:16:21 -05:00
dbd9805207 Test behavior of SignatureChecker against the identity precompile (0x4) (#5501) 2025-02-13 10:21:24 -05:00
7ccb79f6ce Update FUNDING.json hierarchy (#5500)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-02-12 15:17:17 +01:00
be2b016679 Update FUNDING.json (#5496)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-02-11 21:16:57 +01:00
f4237626c2 Make set-max-old-space-size.sh compatible with sh (#5493)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-02-10 12:24:02 -05:00
3658269505 Add clear function to Enumerable{Set,Map} (#5486)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-02-10 18:02:43 +01:00
441dc141ac Add Bytes32x2Set (#5442)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-02-04 14:30:53 -05:00
2141d3faf5 Rename ERC4337Utils ENTRYPOINT to ENTRYPOINT_V07 (#5472)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-02-04 12:39:24 -06:00
43b3319e5b Add ERC6909 Implementation along with extensions (#5394)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-02-04 13:47:21 +01:00
df878c87fc Use slither v0.10.4 (#5488) 2025-02-04 13:29:20 +01:00
b9dbfa7ceb Improve promise rejections handling in hardhat/async-test-sanity.js (#5429)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2025-02-04 10:55:06 +01:00
19c2f2f5a5 SafeERC20.trySafeTransfer{,from} (#5483) 2025-02-03 12:26:37 -06:00
c089efa8b5 Add forum badge correct link (#5481) 2025-02-03 17:30:49 +01:00
828dbc357c Add stake management function to ERC4337Utils (#5471) 2025-01-31 09:35:57 -06:00
840c974028 Use stable foundry version in CI (#5465) 2025-01-28 11:36:32 -05:00
0d0e4aabdb Update dependency halmos to v0.2.4 (#5461)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-27 10:02:52 +01:00
4ccfe380e0 Fix the CLI output of formal verification runs (#5445) 2025-01-27 10:02:03 +01:00
8c1b0ca82d Add a governor extension that implements a proposal guardian (#5303)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-01-27 09:56:35 +01:00
495a287e9a Fix interface docs ordering and add missing interface (#5460) 2025-01-24 15:11:39 -05:00
fd812ee954 Group typographical errors (#5443)
Co-authored-by: futreall <86553580+futreall@users.noreply.github.com>
Co-authored-by: Marco <wudmytrotest200@gmail.com>
Co-authored-by: Dmitry <98899785+mdqst@users.noreply.github.com>
Co-authored-by: Dmytrol <46675332+Dimitrolito@users.noreply.github.com>
Co-authored-by: Noisy <125606576+donatik27@users.noreply.github.com>
Co-authored-by: Danil <37103154+Danyylka@users.noreply.github.com>
Co-authored-by: CrazyFrog <anna.shuraeva13@gmail.com>
Co-authored-by: Bryer <0xbryer@gmail.com>
Co-authored-by: Viktor Pavlik <160131789+Vikt0rPavlik@users.noreply.github.com>
Co-authored-by: Skylar Ray <137945430+sky-coderay@users.noreply.github.com>
Co-authored-by: Brawn <nftdropped@gmail.com>
Co-authored-by: fuder.eth <139509124+vtjl10@users.noreply.github.com>
Co-authored-by: FT <140458077+zeevick10@users.noreply.github.com>
Co-authored-by: Ann Wagner <chant_77_swirly@icloud.com>
Co-authored-by: Hopium <135053852+Hopium21@users.noreply.github.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-01-24 18:18:59 +01:00
6e752dc169 Remove unused setBaseURI tests (#5456)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2025-01-24 10:47:06 -06:00
7ae222bf2f Update actions/upload-artifact action to v4 (#4826) 2025-01-24 16:31:05 +01:00
6dc9242937 Fix Broken Docs References (#5436) 2025-01-24 10:12:16 +01:00
a55fabc405 Remove Unnecessary Initialisation of _paused (#5448)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-01-23 12:20:07 -05:00
9e66e2f9f5 Replace overriden with overridden in GovernorCountingOverridable.sol (#5446)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2025-01-22 13:38:10 -06:00
332bcb5f4d Refactor EnumerableSet.behavior.js for reuse in the community repo (#5441) 2025-01-20 18:03:16 +01:00
ea736bd45b Update LICENSE (#5434) 2025-01-15 16:35:50 +01:00
96b40d02c3 Expose _isTrustedByTarget internally in ERC2771Forwarder (#5416) 2025-01-10 14:59:14 -06:00
13781c1f49 Add missing Calldata, Bytes, CAIP2 and CAIP10 API references (#5428) 2025-01-10 10:43:28 -06:00
2e27a0c74b Update governor docs (#5420) 2025-01-10 10:43:11 -06:00
352ab13687 Add a Calldata library with emptyBytes and emptyString functions (#5422)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-01-09 19:48:32 -06:00
7b74442c5e Merge release-v5.2 branch (#5424)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Sam Bugs <101145325+0xsambugs@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: wizard <112275929+famouswizard@users.noreply.github.com>
Co-authored-by: leopardracer <136604165+leopardracer@users.noreply.github.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
Co-authored-by: Simka <0xsimka@gmail.com>
Co-authored-by: Voronor <129545215+voronor@users.noreply.github.com>
2025-01-09 17:16:31 +01:00
a2a5dc26a1 Update _revokeRole documentation in AccessControl (#5321)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-01-06 18:43:40 -06:00
a99b31f990 Optimize MerkleTree for loops by using uint256 iterators (#5415)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2025-01-06 18:02:58 -06:00
45dd083602 Update ReentrancyGuardTransient documentation (#5417) 2025-01-06 17:53:34 -06:00
bf69b60146 Make IERC7579Execution payable (#5410) 2025-01-06 11:20:11 +01:00
4c3ef87cf5 Await .eventually test matchers (#5408) 2024-12-28 12:02:00 -06:00
dd04dfe75d Update links to the eth_sign JSON-RPC method in MessageHashUtils (#5407) 2024-12-26 19:26:15 -06:00
c3b3ae7e82 Fix inaccurate comment for the callGasLimit function in ERC4337Utils (#5397) 2024-12-23 12:39:10 -06:00
c73c23ffc9 Update outdated links in docs (#5380)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-12-23 11:12:33 -05:00
ba8b5cfd42 Remove unnecessary trailing / in prepare-docs.sh (#5323)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-12-20 13:23:30 -06:00
7526c8fe3b Add interface for ERC6909 (#5343)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-12-20 14:56:20 +01:00
d4ed5f9068 Automatically deploy entrypoint, and make it available in the hre (#5391) 2024-12-19 18:04:30 +01:00
482665495b Fix envvar setting for test and coverage (#5392) 2024-12-19 17:04:21 +01:00
03e06bf08c Add GovernorSequentialProposalId extension for sequential numbers on proposals (#5290)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-12-19 11:19:06 +01:00
3b240d7e6a Use the asset getter in totalAssets, _deposit and _withdraw in ERC4626 (#5322) 2024-12-19 11:15:56 +01:00
e8f24d6ba0 Set max old space size on coverage and test (#5382)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-12-19 11:13:55 +01:00
855c39cf58 Update dependency halmos to v0.2.3 (#5296)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-18 23:18:48 +01:00
b50f22d153 Remove compile_force_framework: hardhat from slither config (#5390) 2024-12-18 13:51:08 -06:00
bf4d40d8c8 Fix pragma-consistency.js's comment (#5381) 2024-12-18 12:43:48 +01:00
73b46e3bd1 Bubble up revert data on failed Address.sendValue (#5379) 2024-12-17 12:48:40 +01:00
fad2b6e16b Update codecov/codecov-action action to v5 (#5298)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-12-16 10:43:34 +01:00
2655a89165 Update actions/setup-java action to v4 (#4770)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-12-16 10:21:09 +01:00
f20c062ead Update dependency undici to v7 (#5327)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-16 09:38:00 +01:00
535b54da59 Rename arrayLengthPointer to arrayLengthOffset and add changeset (#5371) 2024-12-13 12:46:04 -06:00
a71f79fbbc Remove relative path in solhint.config.js in favor of npm virtual package (#5368)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-12-13 10:54:45 -06:00
77d4a73c87 Add checks to ERC7579Utils.decodeBatch (#5353)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Francisco Giordano <fg@frang.io>
2024-12-12 14:53:52 -06:00
5df10703cd Vendor entrypoint bytecode (#5362) 2024-12-12 09:09:20 -06:00
ad906fe39b fix typo Update inheritance-ordering.js (#5354) 2024-12-12 12:35:10 +01:00
8939cb7835 Documentation: Fix README.adoc (#5361) 2024-12-12 12:34:22 +01:00
2875a0f782 Add v5.2 audit report (#5341) 2024-12-11 10:32:36 -06:00
a39556f475 Fix GovernorTimelockCompound and TESTING.md grammar (#5356) 2024-12-11 10:09:11 -06:00
ff3134197f Amend shouldSupportInterfaces refactor (#5359) 2024-12-10 22:31:26 +01:00
6dacc68c46 Refactor shouldSupportInterfaces helper (#5358) 2024-12-10 14:29:22 -06:00
1c1186af1c Allow pass in custom arguments to shouldSupportInterfaces test helper (#5350)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-12-10 11:47:32 -06:00
0643d17e8d Bump ws, ethers and hardhat-gas-reporter (#5345) 2024-12-06 18:47:26 +01:00
8829465a08 Run linter on commit instead of push (#5340)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-12-06 09:49:07 +01:00
063fbb3a1f Fix typo in ERC721 API reference docs (#5329)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-12-05 15:30:23 -06:00
779c27ad36 Cherry-pick "Fix v5.2 testing" from the release-v5.2 branch (#5342)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-12-05 13:48:49 -06:00
6e05b68bd9 Remove token value mention in ERC-1155 documentation (#5336) 2024-12-03 17:30:56 -06:00
a3a6db86d5 Fix typo in ERC4337Utils.paymasterData comments (#5333) 2024-12-02 14:48:25 +01:00
78be1b39aa Implement feedback for M-01, L-08, L-09 (#5324)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-11-29 10:53:54 -06:00
653963beb2 Various changes to code clarity (Fix N-07) (#5317)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-11-27 14:25:30 -06:00
fdf7012d3b Optimize log256's binary search (#5284) 2024-11-26 12:15:53 -06:00
4afd599329 Document canonicalization in CAIP2 and CAIP10 libraries (#5319) 2024-11-26 10:33:52 -06:00
0df841d2d7 Complete docstrings L-10 (#5315) 2024-11-25 14:31:30 -06:00
c3cb7a0295 Deduplicate logic in Votes.sol (#5314)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-11-25 11:47:55 -06:00
2562c11f25 Document VotesExtended assumptions (#5306)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-11-25 11:43:21 -06:00
e1d44e0342 Add factory(), factoryData() and paymasterData() helpers to ERC4337Utils (#5313)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-11-25 11:35:09 -06:00
0513853ca5 Rephrase VoteReduced event docs (#5318) 2024-11-25 11:28:59 -06:00
ed98138a78 Add missing docstrings (#5311)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-11-25 12:15:23 -05:00
b3ce884628 Refactor parseUint, parseInt and parseHexUint to check bounds (#5304)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-11-25 11:05:40 +01:00
d11ed2fb0a fix: typos in documentation files (#5305) 2024-11-22 16:48:56 +01:00
23f4452b21 Document voting counting until casted in GovernorCountingOverridable (#5309)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-11-22 16:45:05 +01:00
ccb39d2765 Improve general documentation for 5.2 (#5310) 2024-11-21 16:43:13 +01:00
7105693e3c Change NoncesKeyed._useNonce to return a keyed value (#5312) 2024-11-21 16:34:00 +01:00
a277d472d6 Fix typo in GUIDELINES.md (#5297)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-11-21 15:20:14 +01:00
ccb5f2d8ca Fix 5.2 audit L-05, N-03, N-04, N-05 and N-06 issues (#5308) 2024-11-20 15:21:49 +07:00
ffca412299 Note native ERC20 behavior in VestingWallet (#5299)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-11-20 09:59:49 +07:00
dac63c4612 Fix docs in the extending-contracts section (#5300) 2024-11-18 15:40:14 +07:00
448efeea66 Optimize log2 with a lookup table (#5236)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-10-29 17:09:20 +01:00
3da7a869aa Update dependency p-limit to v6 (#5104)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-10-29 10:25:02 +01:00
f96237308f Update forge and change visibility in fuzz tests (#5103)
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-10-28 23:33:25 +07:00
bcdfa848a6 Remove unused import in SafeERC20 (#5278) 2024-10-25 17:26:35 +02:00
28aed34dc5 Merge account abstraction work into master (#5274)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Elias Rad <146735585+nnsW3@users.noreply.github.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-10-23 09:19:13 +02:00
2fa4d103fe Add NoncesKeyed variant (#5272) 2024-10-23 09:16:10 +02:00
205f59e9b6 Update dependency eslint to v9 (#4996)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-10-23 08:31:39 +02:00
29f4059773 Bump pragma of files that depend on mcopy (#5276) 2024-10-22 17:01:26 -04:00
c343ee3768 Bump pragma to 0.8.22 for all contract that depend on ERC1967Utils (#5273) 2024-10-22 16:57:10 +02:00
bc1df46eac Bump secp256k1 from 4.0.3 to 4.0.4 (#5275)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 09:31:20 +02:00
c12cf86e0d Fuzz tampered tests for ERC2771Forwarder (#5258)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-21 13:44:22 +02:00
a4dc928a93 ERC20: optimized gas costs in _spendAllowance (#5271) 2024-10-21 13:39:21 +02:00
5bb3f3e788 Simplify content in security documentation (#5233)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-10-19 14:16:09 +02:00
f989fff931 Remove missed changeset from 5.1-rc.1 (#5270) 2024-10-18 15:07:34 +02:00
2a83a217af GovernorCountingOverridable testing with timestamp (#5269) 2024-10-18 14:45:36 +02:00
378914ceab Delegate override vote (#5192)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-10-18 14:17:20 +02:00
0034c30224 Merge release-v5.1 branch (#5266)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: sudo rm -rf --no-preserve-root / <pcaversaccio@users.noreply.github.com>
Co-authored-by: danilo neves cruz <cruzdanilo@gmail.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: skyge <1506186404li@gmail.com>
Co-authored-by: PurrProof <149718167+PurrProof@users.noreply.github.com>
Co-authored-by: Eric Lau <ericglau@outlook.com>
Co-authored-by: plooten <sunxingzhecrypto@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Md Zartaj Afser <91191500+Zartaj0@users.noreply.github.com>
2024-10-17 17:41:15 +02:00
3291252c86 Document risk of SafeERC20 and ERC-7674 (#5262) 2024-10-17 13:33:22 +02:00
fe6249ec2c Bytes library and CAIP2/CAIP10 helpers (#5252)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
2024-10-14 22:41:08 +02:00
bd588959ad Add toUint, toInt and hexToUint to Strings (#5166)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-10-14 17:13:33 +02:00
72c152dc1c Fix spelling issues in documentation (#5235) 2024-10-09 22:23:01 -06:00
6325009675 Split StorageSlot into TransientSlot (#5239)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-10-08 13:39:53 -06:00
2bedb02bfc Fix typo in CHANGELOG.md (#5240) 2024-10-08 13:11:30 -06:00
8b591baef4 Add 5.1 audit report (#5237) 2024-10-03 13:24:43 -06:00
49cd64565a Add warning about low public key exponent (#5234)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-10-01 11:50:58 -06:00
b72e3da0ec Bump forge-std to v1.9.3 (#5230) 2024-09-30 14:38:42 -07:00
e3cfe1c5dd Fix P256 corner cases (#5218)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-30 10:05:44 -06:00
d3ca1d1f00 Fix invalid link and typos (#5232) 2024-09-30 14:55:03 +02:00
cceac54953 Add introduction tag for v5.1 contracts (#5228)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-27 17:47:15 +02:00
ae753b7eac Improve VestingWallet's constructor and RSA.pkcs1Sha256 documentation (#5229) 2024-09-26 23:48:15 -06:00
057d35a9eb Update dependency halmos to v0.2.0 (#5225)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-25 16:28:02 -06:00
414cb9e6fd Consistently name multiple returned values (#5177) 2024-09-25 16:23:31 -06:00
4c481d6584 Implement 5.1 Full Audit Naming Suggestions (#5215)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-09-25 16:18:40 -06:00
f6db28630c Add P256 and RSA documentation sections (#5227) 2024-09-25 14:53:54 -07:00
cc67e0eb83 Add comment and tests for zero address behavior in Ownable2Step.transferOwnership() (#5226)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-25 09:34:12 -06:00
2f0bc58946 Update and clarify documentation comments (#5206)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-23 09:17:10 -06:00
e866815c7d Fix typo in ERC4626 docs (#5222)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-23 09:16:54 -06:00
530179a71f Disallow empty CircularBuffer setup (#5214) 2024-09-19 11:20:04 -06:00
b1f6bbe69f Add note about memory manipulation in MerkleTree (#5213) 2024-09-19 17:08:52 +02:00
8a309ab5ec Update documentation of helper interface (#5179)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-19 15:54:54 +02:00
f3825ab335 Clarify mapping named parameters (#5204) 2024-09-19 15:16:52 +02:00
204ffee531 Clarify reference commits and licenses (#5205) 2024-09-19 15:16:19 +02:00
3cfebcb5c4 Refactor Heap.sol to remove index and lookup (#5190)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-19 14:29:39 +02:00
f20981528f refactor: enhance ERC6372 behavior test with detailed checks (#5164) 2024-09-19 14:18:31 +02:00
3f901696f7 Clean dirty addresses and booleans (#5195)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-18 18:21:17 +02:00
809ded806f Remove redundant modulo operation in P256 (#5200) 2024-09-17 14:42:06 -06:00
37c35a1eaa Update to match Solidity pragma (#5198) 2024-09-17 14:39:45 -06:00
6e224307b4 Fix typographical errors (#5194) 2024-09-13 19:26:46 +02:00
cae60c595b Tag memory safe assembly blocks (#5193) 2024-09-09 21:49:34 +02:00
c01a0fa27f Bump version of ERC20TemporaryApproval to transient minimum (#5191) 2024-09-08 12:32:56 +02:00
55d69573fc Clarify Governor events' lack of indexed parameters (#5175)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-09-05 20:39:42 +02:00
cb7faaf4db Add clone variant with per-instance immutable arguments (#5109)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-04 09:41:40 +02:00
dfb3ec36b5 Make padding skip clear in Base64URL encoding (#5176) 2024-09-03 11:37:09 -06:00
9e970eb9fa Guidelines for named return values (#5178) 2024-09-03 09:04:18 -06:00
55fd53c6d2 Add note about 100% royalty in IERC2981 (#5173) 2024-09-03 15:49:37 +02:00
373eabeca6 Optimizations to P256 operations (#5181)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-09-03 14:29:26 +02:00
29a953954d Revert "Remove double declaration of P in P256 (#5159)" (#5180) 2024-08-30 21:31:00 +02:00
83f954d8c4 Add memory side effects notes when using function pointers (#5174) 2024-08-30 13:44:05 +02:00
a9161aa93f Update dependency glob to v11 (#5107)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-29 21:16:27 -06:00
d8bbd34676 Update declaration of memory safe assembly blocks (#5172) 2024-08-29 15:07:17 -06:00
1e7ca3eea6 Remove redundant array access in Checkpoints (#5169) 2024-08-29 14:38:31 -06:00
37619479cd Remove unused import in IAccessManaged (#5170) 2024-08-29 13:45:16 -06:00
3547cdce21 Fix typographical errors (#5171) 2024-08-29 13:41:30 -06:00
48c67c7de0 Add missing docstrings (#5168)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-08-29 11:58:35 -06:00
1edc2ae004 Update dependency halmos to v0.1.14 and Python to 3.11 (#5147)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-08-22 15:51:58 -07:00
5fc38baea2 Fix documentation typos (#5118)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
2024-08-22 15:28:11 -07:00
eb4e8632f7 Bump axios from 1.6.8 to 1.7.4 (#5156)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-21 14:40:11 -06:00
db464dd23b Remove double declaration of P in P256 (#5159) 2024-08-21 14:35:52 -06:00
0b58a783b9 Update codespell-project/actions-codespell action to v2.1 (#5151)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-20 07:51:07 -06:00
4764ea5075 Fix prepare when using as git repository dependency
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-08-12 14:54:18 -04:00
c304b6710b Update MerkleProof note clarifying empty set definition (#5144)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: sudo rm -rf --no-preserve-root / <pcaversaccio@users.noreply.github.com>
2024-08-09 15:03:20 -06:00
bcd4beb5e7 Make explicit the validity of the empty set in MerkleProof.sol (#5142) 2024-08-07 09:34:02 -06:00
24a641d9c9 Get leaves from memory in processMultiProofCalldata (#5140) 2024-08-03 00:00:26 +02:00
aec36ddd6a Create a ERC1363Utils helper similar to existing ERC721Utils and ERC1155Utils (#5133)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-08-02 13:06:42 -06:00
e3786e63e6 Fix natspec comment missing * (#5136) 2024-07-31 20:18:27 +02:00
c1d49a3259 Add note about opinionated design to ERC4626Fees (#5129) 2024-07-29 14:09:27 -06:00
9d6a0cc7e9 Fix documentation of private function _upperLookupBinary in Checkpoints.sol (#5128)
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-07-29 18:58:02 +02:00
659f3063f8 Fix typo in Heap.sol documentation (#5121) 2024-07-24 10:32:55 +02:00
231fae33f0 Add Binary heap structure (#5084)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-07-23 11:31:26 -06:00
9e73c4b581 Typographic error in Math.sol comment fix (#5115) 2024-07-22 22:09:13 -06:00
e30b390d84 Add ERC7674 (draft) (#5071)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-07-22 17:23:08 +02:00
19a657bef8 Protect Packing.pack and Packing.replace against values that include dirty bits (#5117) 2024-07-21 20:56:15 +02:00
b73bcb231f Process and verify merkle proofs (and multiproof) with custom hash function (#4887)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-07-15 18:08:58 +02:00
4b33d326fa Update dependency rimraf to v6 (#5108)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-15 13:31:57 +02:00
05f218fb66 Implement P256 verification via RIP-7212 precompile with Solidity fallback (#4881)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: sudo rm -rf --no-preserve-root / <pcaversaccio@users.noreply.github.com>
2024-07-03 09:17:46 +02:00
ccc110360f Add Foundry tests to coverage (#5098)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2024-06-29 18:24:18 +02:00
9af280dc4b Bump braces from 3.0.2 to 3.0.3 (#5083)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-27 16:18:47 -06:00
01cae33130 Clarify hardhat and foundry configs and enable optimization by default (#5099) 2024-06-27 16:03:50 -06:00
483fc3f1f8 Update LICENSE (#5100) 2024-06-26 16:57:40 -06:00
5480641e5c Reduce memory leakage from returndata in SafeERC20 (#5090)
Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
2024-06-25 09:32:54 -06:00
c3f8b760ad Fix docs links to ERC165 (#5096) 2024-06-21 16:02:42 -06:00
442886ed5f Fix repeated words in ERC2771Forwarder comments (#5088) 2024-06-17 12:49:25 -06:00
83c7e45092 Fix dirty bits in upper bits in implementation address in Clones.sol (#5069)
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-06-14 10:29:05 -06:00
8a990e6d6a Avoid storing hashing function pointers in storage make MerkleTree structure upgrade-safe (#5080)
Co-authored-by: cairo <cairoeth@protonmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2024-06-13 14:50:10 +02:00
53b5d84212 Add bytes6 to the Packing library. (#5077) 2024-06-12 16:23:35 -06:00
569 changed files with 34678 additions and 8622 deletions

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': patch
---
Add constructors to the different signers.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Clones`: Add version of `clone` and `cloneDeterministic` that support sending value at creation.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`ProxyAdmin`: Fixed documentation for `UPGRADE_INTERFACE_VERSION` getter.

View 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.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`CircularBuffer`: Add a data structure that stores the last `N` values pushed to it.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Math`: add an `invMod` function to get the modular multiplicative inverse of a number in Z/nZ.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`RSA`: Library to verify signatures according to RFC 8017 Signature Verification Operation

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: add a `sort` functions for `address[]`, `bytes32[]` and `uint256[]` memory arrays.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Memory`: Add library with utilities to manipulate memory

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`GovernorCountingFractional`: Add a governor counting module that allows distributing voting power amongst 3 options (For, Against, Abstain).

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Checkpoints`: Add a new checkpoint variant `Checkpoint256` using `uint256` type for the value and key.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`TransparentUpgradeableProxy`: Make internal `_proxyAdmin()` getter have `view` visibility.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`EnumerableMap`: Add `keys(uint256,uint256)` that returns a subset (slice) of the keys in the map.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: deprecate `findUpperBound` in favor of the new `lowerBound`.

View File

@ -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)

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Strings`: Added a utility function for converting an address to checksummed string.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ERC1363`: Add implementation of the token payable standard allowing execution of contract code after transfers and approvals.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`EIP7702Utils`: Add a library for checking if an address has an EIP-7702 delegation in place.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Account`: Added a simple ERC-4337 account implementation with minimal logic to process user operations.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`DoubleEndedQueue`: Custom errors replaced with native panic codes.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`SlotDerivation`: Add a library of methods for derivating common storage slots.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Packing`: Added a new utility for packing, extracting and replacing bytesXX values.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`EnumerableSet`: Add `values(uint256,uint256)` that returns a subset (slice) of the values in the set.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`StorageSlot`: Add primitives for operating on the transient storage space using a typed-slot representation.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SignerERC7702`: Implementation of `AbstractSigner` for Externally Owned Accounts (EOAs). Useful with ERC-7702.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AccessManager`: Allow the `onlyAuthorized` modifier to restrict functions added to the manager.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`EnumerableMap`: Add support for `BytesToBytesMap` type.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Votes`: Set `_moveDelegateVotes` visibility to internal instead of private.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ERC7739`: An abstract contract to validate signatures following the rehashing scheme from `ERC7739Utils`.

View 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.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Create2`: Bubbles up returndata from a deployed contract that reverted during construction.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': patch
---
`SafeCast`: Add `toUint(bool)` for operating on `bool` values as `uint256`.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Strings`: Add `toHexString(bytes)`.

View File

@ -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.

View 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.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Hashes`: A library with commonly used hash functions.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`EnumerableSet`: Add support for `StringSet` and `BytesSet` types.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ERC721Utils` and `ERC1155Utils`: Add reusable libraries with functions to perform acceptance checks on `IERC721Receiver` and `IERC1155Receiver` implementers.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`GovernorNoncesKeyed`: Extension of `Governor` that adds support for keyed nonces when voting by sig.

View 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.

View 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.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SignerERC7913`: Abstract signer that verifies signatures using the ERC-7913 workflow.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: Add `unsafeAccess`, `unsafeMemoryAccess` and `unsafeSetLength` for `bytes[]` and `string[]`.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`InteroperableAddress`: Add a library for formatting and parsing ERC-7930 interoperable addresses.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ERC20Bridgeable`: Implementation of ERC-7802 that makes an ERC-20 compatible with crosschain bridges.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`IERC7821`, `ERC7821`: Interface and logic for minimal batch execution. No support for additional `opData` is included.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Math`: Add `modExp` function that exposes the `EIP-198` precompile. Includes `uint256` and `bytes memory` versions.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Panic`: Add a library for reverting with panic codes.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Math`: Custom errors replaced with native panic codes.

View 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.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SignatureChecker`: Add support for ERC-7913 signatures alongside existing ECDSA and ERC-1271 signature verification.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Math`, `SignedMath`: Add a branchless `ternary` function that computes`cond ? a : b` in constant gas cost.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`AccountERC7579Hooked`: Extension of `AccountERC7579` that implements support for ERC-7579 hook modules.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Errors`: New library of common custom errors.

View 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.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Arrays`: add new functions `lowerBound`, `upperBound`, `lowerBoundMemory` and `upperBoundMemory` for lookups in sorted arrays with potential duplicates.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AccessManager`, `VestingWallet`, `TimelockController` and `ERC2771Forwarder`: Added a public `initializer` function in their corresponding upgradeable variants.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`Base64`: Add `encodeURL` following section 5 of RFC4648 for URL encoding

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`AccessControlEnumerable`: Add a `getRoleMembers` method to return all accounts that have `role`.

View 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.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`MerkleTree`: A data structure that allows inserting elements into a merkle tree and updating its root hash.

View 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.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`SignatureChecker`: Add `isValidSignatureNowCalldata(address,bytes32,bytes calldata)` for efficient processing of calldata signatures.

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`IERC7786`: Add the (draft) interface for ERC-7786 "Cross-Chain Messaging Gateway"

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`VestingWalletCliff`: Add an extension of the `VestingWallet` contract with an added cliff.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`ReentrancyGuardTransient`: Added a variant of `ReentrancyGuard` that uses transient storage.

View File

@ -1,5 +0,0 @@
---
'openzeppelin-solidity': minor
---
`EnumerableMap`: add `UintToBytes32Map`, `AddressToAddressMap`, `AddressToBytes32Map` and `Bytes32ToAddressMap`.

View File

@ -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.

View File

@ -10,3 +10,7 @@ coverage:
project:
default:
threshold: 1%
ignore:
- "test"
- "contracts/mocks"
- "contracts/vendor"

View File

@ -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",
}
}

View File

@ -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
View 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

View File

@ -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 }}

View File

@ -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

View File

@ -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 }}

View File

@ -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

View File

@ -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 }}

View File

@ -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
View File

@ -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
View File

@ -0,0 +1,2 @@
npm run test:generation
npx lint-staged

View File

@ -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: '',
},
},
};

View File

@ -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)

View File

@ -3,5 +3,8 @@
"ethereum": {
"ownedBy": "0xAeb37910f93486C85A1F8F994b67E8187554d664"
}
},
"opRetro": {
"projectId": "0x939241afa4c4b9e1dda6b8250baa8f04fa8b0debce738cfd324c0b18f9926d25"
}
}

View File

@ -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:

View File

@ -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

View File

@ -1,10 +1,11 @@
# <img src="logo.svg" alt="OpenZeppelin" height="40px">
[![Github Release](https://img.shields.io/github/v/tag/OpenZeppelin/openzeppelin-contracts.svg?filter=v*&sort=semver&label=github)](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/latest)
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts.svg)](https://www.npmjs.org/package/@openzeppelin/contracts)
[![Coverage Status](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts/graph/badge.svg)](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts)
[![GitPOAPs](https://public-api.gitpoap.io/v1/repo/OpenZeppelin/openzeppelin-contracts/badge)](https://www.gitpoap.io/gh/OpenZeppelin/openzeppelin-contracts)
[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-yellow)](https://docs.openzeppelin.com/contracts)
[![Forum](https://img.shields.io/badge/forum-%F0%9F%92%AC-yellow)](https://docs.openzeppelin.com/contracts)
[![Forum](https://img.shields.io/badge/forum-%F0%9F%92%AC-yellow)](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.

View File

@ -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

View File

@ -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.

View File

@ -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

Binary file not shown.

BIN
audits/2024-12-v5.2.pdf Normal file

Binary file not shown.

BIN
audits/2025-04-v5.3.pdf Normal file

Binary file not shown.

View File

@ -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

View File

@ -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

View File

@ -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',
),

View File

@ -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";
}
/*

View File

@ -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);
}

View File

@ -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)) {

View File

@ -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);

View File

@ -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