Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
33c4d65
Initial forge tests
drinkcoffee Jan 10, 2025
35ba4ac
Added initial test
drinkcoffee Jan 10, 2025
84bad32
Create initial performance tests
drinkcoffee Jan 13, 2025
5c9f3a9
Mint at 15K per block to max out the blocks
drinkcoffee Jan 13, 2025
80bce5d
Added more tests
drinkcoffee Jan 14, 2025
0f14037
Add more tests
drinkcoffee Jan 14, 2025
bf0837f
Revise import order
drinkcoffee Jan 15, 2025
f70f480
Initial compiling version of PsiV2
drinkcoffee Jan 16, 2025
011ccb4
Resolved issues with PsiV2
drinkcoffee Jan 17, 2025
47c0079
Fixed issue with determing existance of an NFT
drinkcoffee Jan 17, 2025
f72216a
Improve documentation. Prefill by 160K
drinkcoffee Jan 20, 2025
dedbc6b
Migrate ERC721 tests to forge
drinkcoffee Jan 29, 2025
5861530
Improve ERC 721 test coverage
drinkcoffee Jan 29, 2025
e48d49c
Added more tests
drinkcoffee Jan 31, 2025
a74fa1b
Add more tests and remove dead code
drinkcoffee Feb 3, 2025
f5c0f86
Added documentation for ERC721PsiV2
drinkcoffee Feb 4, 2025
3f56c1b
Added more tests
drinkcoffee Feb 5, 2025
540e221
Change solidity version
drinkcoffee Feb 6, 2025
c53427a
Merge branch 'main' into peter-solidity-version
drinkcoffee Feb 6, 2025
bea8ee7
Merge branch 'peter-solidity-version' into peter-erc721-perf
drinkcoffee Feb 6, 2025
ce033e3
Add more tests
drinkcoffee Feb 6, 2025
36c41e7
Added transferFrom tests
drinkcoffee Feb 6, 2025
59b6c1a
Added more tests
drinkcoffee Feb 7, 2025
6912c29
Rename files
drinkcoffee Feb 7, 2025
4045cac
Merge branch 'main' into peter-erc721-perf
drinkcoffee Feb 7, 2025
0f31fa1
Add documentation for ERC 721 contracts
drinkcoffee Feb 7, 2025
2be5039
Fix prettier issues
drinkcoffee Feb 9, 2025
c5f3ec5
Fix solidity version and remove dead code
drinkcoffee Feb 10, 2025
0cc0e1b
Add solhint support for PsiV2
drinkcoffee Feb 10, 2025
e7e359c
Fixed last Slither warning
drinkcoffee Feb 10, 2025
df57fa4
Remove temporary file
drinkcoffee Feb 10, 2025
a6f485c
Remove dead code
drinkcoffee Feb 10, 2025
78bf98b
Improve test coverage
drinkcoffee Feb 10, 2025
af2bca0
Resolve solhint issues
drinkcoffee Feb 10, 2025
0506c39
erc721v2-audit
rytimx Feb 18, 2025
9c17a6b
remove corpus
rytimx Feb 18, 2025
71b28fa
updated test cases
rytimx Feb 21, 2025
73ee829
Fix build issues
drinkcoffee Feb 24, 2025
c0ca6a4
Fix up sub-modules
drinkcoffee Feb 24, 2025
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
Prev Previous commit
Next Next commit
Added documentation for ERC721PsiV2
  • Loading branch information
drinkcoffee committed Feb 4, 2025
commit f5c0f867894c2e4a82e02c63d0f73ebac595e45f
22 changes: 17 additions & 5 deletions contracts/token/erc721/erc721psi/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Immutable Contracts
# Immutable ERC721 Mint by Quantity Implementation Contracts

Forked from https://github.com/estarriolvetch/ERC721Psi.
The ERC721Psi code in this directory was forked from https://github.com/estarriolvetch/ERC721Psi, with the changes listed in the ERC721Psi Changelog section below.

## Changelog
- changed `_safeMint(address to, uint256 quantity) internal virtual` to call `ERC721PSI._mint` explicitly to avoid calling ERC721 methods when both are imported in a child contract
- changed `_safeMint(address to, uint256 quantity, bytes memory _data` to call `ERC721PSI._mint` explicitly to avoid calling ERC721 methods when both are imported in a child contract
The ERC721PsiV2 leverages the ERC721Psi code, slightly increasing the minting gas usage but reducing the gas usage for most other functions. The differences between the ERC721Psi and ERC721PsiV2 are listed in the section ERC721PsiV2 and ERC721Psi Differences section.


## ERC721Psi Differences From Upstream

- ERC721Psi: changed `_safeMint(address to, uint256 quantity) internal virtual` to call `ERC721PSI._mint` explicitly to avoid calling ERC721 methods when both are imported in a child contract
- ERC721Psi: changed `_safeMint(address to, uint256 quantity, bytes memory _data` to call `ERC721PSI._mint` explicitly to avoid calling ERC721 methods when both are imported in a child contract


## ERC721PsiV2 and ERC721Psi Differences

- Switched from `solidity-bits'` `BitMaps` implementation to using the `TokenGroup` struct. In `ERC721Psi`, `BitMaps` are used as arrays of bits that have to be traversed. One `TokenGroup` struct holds the token ids for a 256 NFTs. The first NFT in a group is at a multiple of 256. The owner of an NFT for a `TokenGroup` is the `defaultOwner` specified in the `TokenGroup` struct, unless the owner is specified in the `tokenOwners` map. The result of this change is that the owner of a token can be determined using a deterministic amount of gas for `ERC721PsiV2`.
- In `ERC721Psi`, newly minted NFTs are minted to the next available token id. In `ERC721PsiV2`, newly minted NFTs are minted to the next token id that is a multiple of 256. This means that each new mint by quantity is minted to a new token group.
- For `ERC721PsiV2`, when the mint by quantity request is not a multiple of 256 NFTs, there are unused token ids. These token ids are added to a `burned` map in the `TokenGroup`, thus making those token ids unavailable.
- In `ERC721PsiV2`, the balances of account holders and the total supply are maintained as state variables, rather than calculating them when needed, as they are in `ERC721Psi`. The result of this change is that `balanceOf` and `totalSupply` use a deterministic amount of gas.