-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Use the _update mechanism in ERC721 #4377
Use the _update mechanism in ERC721 #4377
Conversation
🦋 Changeset detectedLatest commit: 7249414 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I realized that the constraints are reading I think As a side note, |
I would argue that its the constrain that reads Now I currently see 4 constraints:
We could encode these 4 into an enum, and inside I'm not sure I fully understand what you propose, but it appears to include preparing some encoding ... I wouldn't want the result to be too complex. |
It will be invisible in |
The only constrain that does a |
if (from != address(0)) { | ||
delete _tokenApprovals[tokenId]; | ||
unchecked { | ||
_balances[from] -= 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_balances[from] -= 1; | |
--_balances[from]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively:
_balances[from] -= 1; | |
_balances[from]--; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer -= 1
and += 1
. @Amxx what is your preference here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+= 1
/ -= 1
is what we currently have, and I kept it. If I was to write the contract from scratch today, I would use --
and ++
, but I don't have a strong preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We agreed to keep it as it is because it's not a highly meaningful change. We might reconsider once this PR is done so we can correctly measure the gas savings.
Keeping this convo open and closing the other one.
We still need to update the Changeset at |
@ernestognw There is an alternative to this PR in #4419. I would like to avoid the use of function pointers introduced in this PR. |
e782f4e
to
5ab254c
Compare
Closing in favor of #4419. |
Fixes LIB-628
Issues to fix:
I fixed these using
__unsafe_increaseBalance
as a hook. It actually works well for that usecase.Fixes #4136.
Closes #4405 (superceded).
Closes #4169 (superceded).
Closes #4144 (superceded).
PR Checklist
npx changeset add
)