-
Notifications
You must be signed in to change notification settings - Fork 351
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
USDC v3 #338
base: master
Are you sure you want to change the base?
USDC v3 #338
Conversation
"ERC20: transfer amount exceeds allowance" | ||
); | ||
_transfer(from, to, value); | ||
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value); |
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.
While you're at it, can save 5k more gas on swaps and contract interactions by using infinite approval gas optimization!!
Something like this:
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value); | |
if (allowed[from][msg.sender] != uint(-1)) { | |
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value); | |
} |
Reference
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.
in this moment I am euphoric
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.
@phil-ociraptor in your suggestion aren't you missing a ]
?
L121 of your suggestion 👇
if (allowed[from][msg.sender] != uint(-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.
🦅 👀
great catch! updated
Thanks for the PR, this is really cool. We would really love to reduce gas fees. At this point though I'm not sure we can get rid of the blacklist functionality as-is. Such change will require a broader discussion including legal and regulatory compliance teams. Packing it into the high bit as you suggested https://twitter.com/alex_kroeger/status/1485756038502510593?s=21 might be more appealing as it preserves the existing functionality and should provide similar gas savings. |
USDC v3 reduces gas costs for users by replacing blacklist checks on
transfer
,transferFrom
, andapprove
with afreezeBalance
admin function.Please check out this post on mirror.xyz for more context about these proposed changes.