-
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
Transient Approval #4959
Comments
would be extra good with https://eips.ethereum.org/EIPS/eip-7609 ;) |
|
Thank you @wjmelements for your feedback
|
Anything can be done in assembly but in solidity it will compute the same hash twice to determine the slot. |
In some cases, an ERC20 approval is granted, that is then used in the same transaction. In that case, using storage is expensive, and potentially dangerous if approval persists.
The idea is to have, next to the normal allowance, a transient allowance.
This transient allowance can be set using a new "approveTransient" function that replicates the behavior of "approve" (minus the event)
When doing a transferFrom (or any operation that consumes allowance) the transient allowance is used first. If that is enough, no storage read or right is necessary. If transient allowance is not enough, normal (storage allowance is used)
If EOA multicall becomes available, either through EIP-3074 or EIP-5806, EOAs will be able to:
In a single transaction. This should save significant amount of gas over the same approach with storage based allowances.
No allowance is left after the tx, reducing risks.
That does not require any change from the consumer side (same transferFrom).
Implementation can be found here
The text was updated successfully, but these errors were encountered: