Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changes from 8 commits
a3526ac
1ed8f9e
7ec3435
e2fdbac
e9f03bd
78c280b
1cc7f54
c7303ec
54cb3ca
562ddf5
0bb98cb
5ab254c
bd0c52e
1a95520
7e9d024
16f2f15
2558c8f
de570d0
7121ff7
b973d98
e4b0e72
4516803
7c3f161
9ba0120
1081508
fb4d951
d7a6aaf
4c25b48
20048ca
e996ba4
b29e573
328b16b
08da709
12f63b3
81aca96
d037530
5ce49a4
a023cad
caabbf3
ca32b45
b982e2a
f404802
20bb47f
a475ffa
e26d5c0
2897abc
52923d1
42e17ee
c2e1a55
a036284
1e4f353
7b26030
7249414
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
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:
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.
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.
Why not
increaseBalance(…)
btw? It may be logical again to use a function that can be overridden (then a similar point with a decrease). But of course it can cost extra gas if it doesn't inlineThere 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.
If we use
_increaseBalance
here, there is another risk regarding overrides, which is that an extension overriding both_update
and_increaseBalance
may end up executing its logic twice. SeeERC721Votes
for example, which overrides both in order to use_transferVotingUnits
.To avoid that we could add a
_decreaseBalance
function, but we wanted to reduce the number of needed overrides, not increase it.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.
Maybe then give the function a name that more specifically reflects its purpose?
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.
Which one do you mean?
_update
?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.
_increaseBalance
Maybe like
_increaseBalanceUnsafe
,_increaseBalanceDirectly
,_increaseBalanceManually
or smth