Skip to content

Transient Approval #4959

@Amxx

Description

@Amxx

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:

  • set transient allowance
  • use that allowance in defi (swap) ?
    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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions