ERC-8486: Flash Loan Proxy

Abstract

This standard defines a proxy that coordinates execution sessions by temporarily caching a program and its associated calldata in transient storage. The proxy forwards the cached program to a fixed implementation through DELEGATECALL and uses a handler flag to control whether subsequent reentrant invocations are dispatched.

The program remains unchanged throughout an execution session, while the cached calldata is replaced on each accepted invocation. This enables a single implementation to coordinate callback-driven execution using different programs and calldata without deploying a new contract for each execution.

Motivation

Many advanced execution strategies require dynamically changing execution logic, particularly when interacting with external contracts that invoke callbacks during execution.

Traditionally, dynamically changing the execution logic of a contract may require deploying a new contract containing the desired runtime code. This introduces deployment costs, including contract creation and code-deposit costs.

Flash Loan Proxy separates the execution program from the implementation responsible for interpreting it. Instead of deploying a new contract for each program, callers provide the program as calldata. The proxy temporarily caches the program and forwards it to an implementation that interprets and executes it.

This design provides several benefits:

  • Dynamic execution programs: Different programs can be supplied for different execution sessions without deploying a new contract.
  • Callback coordination: The proxy can dispatch reentrant invocations to the same implementation while preserving the program associated with the current session.
  • Reduced deployment overhead: Programs are supplied as transaction data rather than deployed as contract code.
  • Flexible execution environments: The implementation can interpret native EVM bytecode, EOF-related representations, or other program formats supported by its execution engine.
  • Larger programs: The program size is not subject to the EIP-170 deployed-contract code-size limit merely because it is supplied as calldata. It remains subject to transaction and block resource limits.

The proxy does not define a programming language, virtual machine, or execution semantics. These are determined by the implementation.

Link to Github

2 Likes

The security section covers callback authentication, but authorization to start a session also needs an explicit trust model. At DEPTH_SLOT == 0, the reference proxy accepts a new program without checking the caller. With a permissionless interpreter that permits arbitrary external calls, another caller could submit a program that spends leftover proxy balances or uses a user’s remaining ERC-20 allowance via transferFrom. Clearing the transient cache leaves those balances and allowances intact.

A security note and a test with two different session initiators would help make this risk concrete. Could the ERC specify how initial callers are authorized or document the balance and approval restrictions needed for a permissionless deployment?

2 Likes

Thank you for pointing this out. We agree that session initialization is permissionless in the reference implementation and that clearing transient storage does not isolate persistent balances or token allowances between sessions.

This is intentional. Flash Loan Proxy is designed as a minimal, transparent execution coordinator rather than a custody or authorization layer. It does not establish ownership of assets, authenticate session initiators, or enforce isolation between execution sessions. These responsibilities are delegated to the implementation and the integrating system.

Consequently, a permissionless implementation that supports arbitrary external calls must be treated as a public execution endpoint. Any assets held by the proxy, or any outstanding token allowances granted to the proxy, may be consumed by any caller able to submit an appropriate program.

In the intended smart-account integration model, the account controls the execution context and supplies the necessary assets and permissions for each transaction. For example, it may transfer assets to the proxy, grant narrowly scoped approvals, invoke the proxy, and enforce post-execution conditions. Approvals should be revoked or otherwise constrained within the same atomic transaction where applicable. The account can also verify the resulting balances and other execution invariants before considering the operation successful.

The proxy itself does not require this integration model. Implementations may enforce their own authorization policies, while permissionless implementations may deliberately expose unrestricted execution.

We will clarify these trust assumptions in the Security Considerations section and include a test demonstrating that persistent balances and allowances are not isolated between different session initiators.

Say a wallet already supports one ERC-8486 proxy and wants to add a second one with a different interpreter. Which part of the integration can it reuse? A small example showing what stays the same across both would help me understand what the ERC standardizes in practice.

2 Likes

The reusable part is the execution-session coordination and integration lifecycle, not the interpreter or program format.

A wallet can reuse the same general integration logic across multiple proxies conforming to this standard:

  1. Select the target proxy.

  2. Prepare the required assets and permissions.

  3. Encode and submit the initial (program, data) payload.

  4. Allow the proxy to coordinate subsequent callback invocations.

  5. Verify post-execution conditions and revoke any remaining approvals.

For example, a wallet may use Proxy A with an EVM interpreter and Proxy B with an entirely different executor. Both follow the same proxy-level session lifecycle, but their programs and application-specific input formats may differ.

The standard does not require a wallet to embed the proxy mechanism directly. It may route execution to multiple proxy instances through an internal dispatcher, or interact with standalone proxies as external execution endpoints. The latter avoids requiring the wallet itself to expose additional reentrant execution paths, which can introduce significant security complexity.

We consider the standalone-proxy model a useful integration pattern: the wallet provides the necessary assets or narrowly scoped permissions, invokes the selected proxy, and verifies the resulting state. For permissionless implementations, these permissions must not remain available after the intended transaction. In particular, a separate EOA approval transaction followed by a later execution transaction is unsafe because the outstanding allowance can be consumed by another caller. Permit-based approvals or an authorization-controlled intermediary can be used when atomic approval and execution are required.

The ERC standardizes the proxy’s session coordination behavior while deliberately leaving program semantics, execution engines, wallet routing, and asset authorization to the implementation and integrating system.

1 Like

Checking a callback’s lender alone does not establish that the active program requested the loan. While HANDLER_SLOT is enabled, a contract called by the program could request an ERC-3156 loan with the proxy as receiver. The callback would come from the expected lender, but carry the other contract as initiator and its chosen data. Could the security section include a test showing the implementation rejecting this unsolicited callback because the initiator is unexpected?