Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💥 Add ERC-2981 Implementation #138

Merged
merged 25 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
167ee57
📖 Add `README` and `CHANGELOG` entries
pcaversaccio Jun 19, 2023
7aa3bdf
👷‍♂️ Enhance `white-list` in `awesome_bot`
pcaversaccio Jun 19, 2023
9cb9303
🔁 Use official param naming in interface definitions
pcaversaccio Jun 19, 2023
88c3150
♻️ `IERC2981` interface
pcaversaccio Jun 19, 2023
aecdf79
♻️ `IERC2981` interface wording
pcaversaccio Jun 19, 2023
6ae3c0d
📖 Add note on interface usage for `ERC721` and `ERC1155`
pcaversaccio Jun 19, 2023
2603649
💥 `ERC2981` Implementation
pcaversaccio Jun 19, 2023
2779b72
🔁 Bump Submodules
pcaversaccio Jun 19, 2023
a1a3bc9
Merge branch 'main' into erc2981
pcaversaccio Jun 20, 2023
318c13c
♻️ Wording
pcaversaccio Jun 20, 2023
c36c0c5
♻️ warning on default values
pcaversaccio Jun 20, 2023
276228c
♻️ Add `IERC2981Extended` test interface
pcaversaccio Jun 20, 2023
c56d689
💥 `ERC2981` unit tests
pcaversaccio Jun 20, 2023
41f85f6
💥 `ERC2981` fuzz tests
pcaversaccio Jun 20, 2023
7ee6a4d
💥 `ERC2981` invariant tests
pcaversaccio Jun 20, 2023
659c6ad
🔁 Bump Submodules
pcaversaccio Jun 21, 2023
060fdeb
♻️ singular wording
pcaversaccio Jun 21, 2023
6972c0f
♻️ code chore
pcaversaccio Jun 21, 2023
6b0a029
♻️ add `gas-snapshot`
pcaversaccio Jun 21, 2023
cfdee42
♻️ fix link
pcaversaccio Jun 22, 2023
d41882f
🔁 Bump submodules
pcaversaccio Jun 22, 2023
6afbd3e
🔁 Bump submodules
pcaversaccio Jun 22, 2023
d25d4cd
🔁 Bump `@openzeppelin/merkle-tree`
pcaversaccio Jun 22, 2023
1c7989e
🔁 Bump Submodules
pcaversaccio Jun 22, 2023
56c7c68
♻️ fix failing test
pcaversaccio Jun 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,49 @@ ERC20Test:testTransferOwnershipToZeroAddress() (gas: 16052)
ERC20Test:testTransferSuccess() (gas: 42469)
ERC20Test:testTransferToZeroAddress() (gas: 16677)
ERC20Test:testTransferZeroTokens() (gas: 24664)
ERC2981Invariants:invariantOwner() (runs: 256, calls: 3840, reverts: 3840)
ERC2981Test:testDeleteDefaultRoyaltyNonOwner() (gas: 10604)
ERC2981Test:testFuzzDeleteDefaultRoyaltyNonOwner(address) (runs: 256, μ: 13316, ~: 13316)
ERC2981Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 14064, ~: 14064)
ERC2981Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 24807, ~: 24807)
ERC2981Test:testFuzzResetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 93517, ~: 95784)
ERC2981Test:testFuzzResetTokenRoyaltyNonOwner(address) (runs: 256, μ: 13302, ~: 13302)
ERC2981Test:testFuzzRoyaltyInfoDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 78646, ~: 80271)
ERC2981Test:testFuzzRoyaltyInfoDeleteDefaultRoyalty(address,uint256,uint256,uint96,uint256) (runs: 256, μ: 62333, ~: 63541)
ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 119029, ~: 122195)
ERC2981Test:testFuzzRoyaltyInfoSetTokenRoyaltyUpdate(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 162071, ~: 166791)
ERC2981Test:testFuzzRoyaltyInfoUpdateDefaultRoyalty(address,address,uint256,uint256,uint96,uint256) (runs: 256, μ: 83952, ~: 85970)
ERC2981Test:testFuzzSetDefaultRoyaltyNonOwner(address) (runs: 256, μ: 15534, ~: 15534)
ERC2981Test:testFuzzSetDefaultRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21875, ~: 21665)
ERC2981Test:testFuzzSetTokenRoyaltyInvalidReceiver(address) (runs: 256, μ: 18725, ~: 18725)
ERC2981Test:testFuzzSetTokenRoyaltyNonOwner(address) (runs: 256, μ: 15598, ~: 15598)
ERC2981Test:testFuzzSetTokenRoyaltyTooHighFeeNumerator(uint96) (runs: 256, μ: 21917, ~: 21707)
ERC2981Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14226, ~: 14226)
ERC2981Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 29773, ~: 29773)
ERC2981Test:testHasOwner() (gas: 9663)
ERC2981Test:testInitialSetup() (gas: 459383)
ERC2981Test:testRenounceOwnershipNonOwner() (gas: 11007)
ERC2981Test:testRenounceOwnershipSuccess() (gas: 17804)
ERC2981Test:testResetTokenRoyalty() (gas: 91421)
ERC2981Test:testResetTokenRoyaltyNonOwner() (gas: 10720)
ERC2981Test:testRoyaltyInfoDefaultRoyalty() (gas: 72983)
ERC2981Test:testRoyaltyInfoDeleteDefaultRoyalty() (gas: 59691)
ERC2981Test:testRoyaltyInfoRoyaltyAmountOverflow() (gas: 66923)
ERC2981Test:testRoyaltyInfoSetTokenRoyalty() (gas: 116338)
ERC2981Test:testRoyaltyInfoSetTokenRoyaltyUpdate() (gas: 160955)
ERC2981Test:testRoyaltyInfoUpdateDefaultRoyalty() (gas: 79946)
ERC2981Test:testSetDefaultRoyaltyInvalidReceiver() (gas: 18025)
ERC2981Test:testSetDefaultRoyaltyNonOwner() (gas: 12888)
ERC2981Test:testSetDefaultRoyaltyTooHighFeeNumerator() (gas: 17520)
ERC2981Test:testSetTokenRoyaltyInvalidReceiver() (gas: 18035)
ERC2981Test:testSetTokenRoyaltyNonOwner() (gas: 12929)
ERC2981Test:testSetTokenRoyaltyTooHighFeeNumerator() (gas: 17629)
ERC2981Test:testSupportsInterfaceGasCost() (gas: 5635)
ERC2981Test:testSupportsInterfaceInvalidInterfaceId() (gas: 5511)
ERC2981Test:testSupportsInterfaceSuccess() (gas: 6263)
ERC2981Test:testTransferOwnershipNonOwner() (gas: 12772)
ERC2981Test:testTransferOwnershipSuccess() (gas: 22189)
ERC2981Test:testTransferOwnershipToZeroAddress() (gas: 15680)
ERC4626VaultInvariants:invariantTotalAssets() (runs: 256, calls: 3840, reverts: 2978)
ERC4626VaultInvariants:invariantTotalSupply() (runs: 256, calls: 3840, reverts: 2978)
ERC4626VaultTest:testCachedDomainSeparator() (gas: 7981)
Expand Down Expand Up @@ -625,8 +668,8 @@ SignatureCheckerTest:testEOAWithInvalidSignature2() (gas: 20268)
SignatureCheckerTest:testEOAWithInvalidSigner() (gas: 20501)
SignatureCheckerTest:testEOAWithTooHighSValue() (gas: 17257)
SignatureCheckerTest:testEOAWithValidSignature() (gas: 19600)
SignatureCheckerTest:testFuzzEIP1271WithInvalidSigner(string,string) (runs: 256, μ: 35943, ~: 35950)
SignatureCheckerTest:testFuzzEIP1271WithInvalidSigner(string,string) (runs: 256, μ: 35937, ~: 35950)
SignatureCheckerTest:testFuzzEIP1271WithValidSignature(string) (runs: 256, μ: 34486, ~: 34488)
SignatureCheckerTest:testFuzzEOAWithInvalidSignature(bytes,string) (runs: 256, μ: 16905, ~: 16900)
SignatureCheckerTest:testFuzzEOAWithInvalidSigner(string,string) (runs: 256, μ: 21582, ~: 21581)
SignatureCheckerTest:testFuzzEOAWithValidSignature(string,string) (runs: 256, μ: 20697, ~: 20696)
SignatureCheckerTest:testFuzzEOAWithInvalidSigner(string,string) (runs: 256, μ: 21580, ~: 21593)
SignatureCheckerTest:testFuzzEOAWithValidSignature(string,string) (runs: 256, μ: 20695, ~: 20708)
3 changes: 2 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ jobs:
awesome_bot ./*.md src/**/*.vy src/**/interfaces/*.vy \
test/**/*.sol test/**/interfaces/*.sol test/**/mocks/*.sol \
test/**/scripts/*.js scripts/*.py --allow-dupe --allow-redirect \
--request-delay 0.4 --white-list https://www.wagmi.xyz,https://github.com/pcaversaccio/snekmate/releases/tag/v0.0.3,https://github.com/pcaversaccio/snekmate/blob/v0.0.3
--request-delay 0.4 \
--white-list https://www.wagmi.xyz,https://github.com/pcaversaccio/snekmate/releases/tag/v0.0.3,https://github.com/pcaversaccio/snekmate/blob/v0.0.3,https://github.com/pcaversaccio/snekmate/compare/v0.0.2...v0.0.3
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

## [`0.0.3`](https://github.com/pcaversaccio/snekmate/releases/tag/v0.0.3) (Unreleased)

### 💥 New Features

- **Extensions**
- [`ERC2981`](https://github.com/pcaversaccio/snekmate/blob/v0.0.3/src/extensions/ERC2981.vy): An [`ERC-721`](https://eips.ethereum.org/EIPS/eip-721) and [`ERC-1155`](https://eips.ethereum.org/EIPS/eip-1155) compatible [`ERC-2981`](https://eips.ethereum.org/EIPS/eip-2981) reference implementation. ([#138](https://github.com/pcaversaccio/snekmate/pull/138))

### 🥢 Test Coverage

- **Utility Functions**
- [`MerkleProofVerificationTest`](https://github.com/pcaversaccio/snekmate/blob/v0.0.3/test/utils/MerkleProofVerification.t.sol): Add an additional test for a possible `multi_proof_verify` invariant violation. ([#137](https://github.com/pcaversaccio/snekmate/pull/137))

### 👀 Full Changelog

- [`v0.0.2...v0.0.3`](https://github.com/pcaversaccio/snekmate/compare/v0.0.2...v0.0.3)

## [`0.0.2`](https://github.com/pcaversaccio/snekmate/releases/tag/v0.0.2) (07-06-2023)

### 💥 New Features
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ src
│ ├─ Ownable2Step — "2-Step Ownership Transfer Functions"
│ ├─ AccessControl — "Multi-Role-Based Access Control Functions"
├─ extensions
│ ├─ ERC2981 — "ERC-721 and ERC-1155 Compatible ERC-2981 Reference Implementation"
│ ├─ ERC4626 — "Modern and Gas-Efficient ERC-4626 Tokenised Vault Implementation"
├─ tokens
│ ├─ ERC20 — "Modern and Gas-Efficient ERC-20 + EIP-2612 Implementation"
Expand Down Expand Up @@ -83,6 +84,7 @@ This repository contains [Foundry](https://github.com/foundry-rs/foundry)-based
| `Ownable` | ✅ | ✅ | ✅ |
| `Ownable2Step` | ✅ | ✅ | ✅ |
| `AccessControl` | ✅ | ✅ | ✅ |
| `ERC2981` | ✅ | ✅ | ✅ |
| `ERC4626` | ✅ | ✅ | ✅ |
| `ERC20` | ✅ | ✅ | ✅ |
| `ERC721` | ✅ | ✅ | ✅ |
Expand Down
2 changes: 1 addition & 1 deletion lib/create-util
2 changes: 1 addition & 1 deletion lib/prb-test
Submodule prb-test updated 1 files
+1 −1 src/Vm.sol
Loading