-
Notifications
You must be signed in to change notification settings - Fork 361
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
🥢 ERC20: _givePermit2InfiniteAllowance: true
#1226
base: main
Are you sure you want to change the base?
Conversation
Gas Snapshot Comparison Report
|
Dang, need to update the tests too. |
@atarpara help me update the tests |
based thx @atarpara |
Updated test, but I do not favor this because it will increase gas by default. The Solady ERC20 already has the permit functionality. So very less people use permit2. |
Most tokens will be used on L2 such that the convenience might be indeed worth the tradeoff. If we are shooting for hyperoptimization, then I would suggest we shuck off permit() and make it into an inheritable. **Additional thought does pose the question, why have both permit and permit2. Maybe Solady should just use permit2. |
Hmm… good point. @atarpara This extra gas is very concerning. Let’s marinate on this for at least a week. |
We can have both. For max compat. |
Ok, we shall only consider the gas overhead in the With Permit2 enabled, it costs about 20 more gas. An extra 21000 gas for the approve transaction is 1000 times more than this overhead. Hence, on overall, we save more gas. @atarpara |
I'll merge this when the Spearbit audit has been finalized. |
Description
uh, true?
Checklist
Ensure you completed all of the steps below before submitting your pull request:
forge fmt
?forge test
?Pull requests with an incomplete checklist will be thrown out.