Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

Background

ERC-7540 extends ERC-4626 by separating the request for a deposit or redemption from the call that completes it.

This article explains the proposal below.

I also write about other Ethereum proposals.

Overview

ERC-4626 deposits and redemptions settle atomically. ERC-7540 adds methods to create asynchronous requests and query their status. Users later claim the corresponding shares or assets through deposit, mint, withdraw, or redeem. Vaults can support asynchronous requests for deposits, redemptions, or both.

See the following article for background on ERC-4626.

[ERC-4626] The standard for tokenized vaults

Motivation

ERC-4626 made yield-bearing vaults more interoperable, but limits on immediately executable deposits and redemptions can prevent users from proceeding when the underlying process takes time.

  • Real-world asset protocols. Acquiring or liquidating tokenized real-world assets may take time.
  • Undercollateralized lending. Credit checks and underwriting can delay access to funds.
  • Cross-chain lending. Moving assets across bridges is subject to delays.
  • Liquid staking tokens. Validator withdrawal processing can delay redemption.
  • Insurance safety modules. Risk assessment and review can delay payouts.

Adding requests lets these systems use the vault interface even with asynchronous settlement. The existing claim methods remain available.

Specification

Definitions

Request

An instruction to deposit via requestDeposit or redeem via requestRedeem. The user can claim the result once the vault has processed the request.

Pending

The request has been submitted and awaits vault processing.

Claimable

The vault has processed the request. The user can claim shares for a deposit or underlying assets for a redemption.

Claimed

The user has completed the request by claiming shares or assets.

Claim functions

Vault methods that complete a request, such as deposit and mint after requestDeposit.

Asynchronous deposit vault

A vault that supports deposit requests. The resulting shares can be claimed once the request becomes Claimable.

Asynchronous redemption vault

A vault that supports redemption requests. The resulting assets can be claimed once the request becomes Claimable.

Fully asynchronous vault

A vault that processes both deposits and redemptions asynchronously.

Controller

The account that owns and manages a request and has the right to claim it.

Operator

An account the controller authorizes to manage requests on its behalf.

Asynchronous request flow

An ERC-7540 vault supports asynchronous deposits, asynchronous redemptions, or both. A side without asynchronous support retains the synchronous behavior defined in ERC-4626.

Changes for asynchronous deposit vaults

  1. deposit and mint claim shares. The assets already entered the vault through requestDeposit.
  2. previewDeposit and previewMint must revert for an asynchronous deposit flow.

Changes for asynchronous redemption vaults

  1. redeem and withdraw claim assets. The shares were already handled when the vault accepted requestRedeem.
  2. The ERC-4626 owner parameter in the claim functions is interpreted as the controller. The caller must be the controller or its approved operator.
  3. previewRedeem and previewWithdraw must revert for an asynchronous redemption flow.

Request lifecycle

Deposit and redemption requests progress through Pending, Claimable, and Claimed in order. The deposit example below illustrates the stages.

Deposit request flow

The user must make both a request and a claim, even if the calls are included in the same block. Settlement does not automatically send the output tokens.

State User action Vault action
Pending requestDeposit(assets, controller, owner) Call asset.transferFrom(owner, vault, assets) and add the assets to pendingDepositRequest[controller].
Claimable None. The vault processes the request. Move assets from pendingDepositRequest[controller] to claimableDepositRequest[controller].
Claimed deposit(assets, receiver, controller) Reduce claimableDepositRequest[controller] and credit shares to balanceOf[receiver].

maxDeposit changes with the claimable asset balance.

Why the Claimable state matters

A request must pass through Claimable. The controller or its operator calls the appropriate claim method to pull the output. The vault cannot push the shares or assets to the user in lieu of the claim.

Exchange rates in asynchronous vaults

The vault implementation determines the exchange rate and its treatment of fees and yield. Requests may earn no yield while Pending, and the exchange rate may change between requesting and claiming.

Request IDs

requestDeposit and requestRedeem return a requestId for tracking. Requests are identified by the combination of requestId and controller, so several controllers can share an ID.

Requests sharing a request ID

Requests with the same nonzero ID transition from Pending to Claimable together and use the same exchange rate. If they become partly Claimable, that change applies pro rata. This keeps processing consistent across the group.

Requests with different IDs

Different IDs can settle independently. The vault can choose when each group becomes Claimable and what exchange rate it uses.

The special case of request ID zero

With requestId == 0, the vault identifies requests only by controller and aggregates its Pending and Claimable amounts. A vault that returns zero for any request must return zero for all requests.

Functions

requestDeposit

javascript
function requestDeposit(uint256 assets, address controller, address owner) returns (uint256 requestId)

Moves assets from owner to the vault and creates a deposit request managed by controller. The return value is the requestId. Once the assets become Claimable, the controller claims shares through deposit or mint; the request must pass through Claimable. The rate implied by convertToShares(assets) can change. The caller must be owner or an operator the owner approved.

pendingDepositRequest

javascript
function pendingDepositRequest(uint256 requestId, address controller) view returns (uint256 assets)

Returns the Pending asset amount for a requestId and controller, excluding assets already Claimable. The value is caller-independent, and the query must not revert unless integer overflow occurs.

claimableDepositRequest

javascript
function claimableDepositRequest(uint256 requestId, address controller) view returns (uint256 assets)

Returns the Claimable asset amount for a requestId and controller, excluding Pending assets. The value is caller-independent, and the query must not revert unless integer overflow occurs.

requestRedeem

javascript
function requestRedeem(uint256 shares, address controller, address owner) returns (uint256 requestId)

Commits shares from owner to an asynchronous redemption request managed by controller. It returns the requestId. When the shares become Claimable, the controller can claim assets through redeem or withdraw; the request must pass through Claimable. The rate implied by convertToAssets(shares) can change. The caller must be the owner or an approved operator.

pendingRedeemRequest

javascript
function pendingRedeemRequest(uint256 requestId, address controller) view returns (uint256 shares)

Returns the Pending share amount for a requestId and controller, excluding Claimable shares. The value is caller-independent, and the query must not revert unless integer overflow occurs.

claimableRedeemRequest

javascript
function claimableRedeemRequest(uint256 requestId, address controller) view returns (uint256 shares)

Returns the Claimable share amount for a requestId and controller, excluding Pending shares. The value is caller-independent, and the query must not revert unless integer overflow occurs.

isOperator

javascript
function isOperator(address controller, address operator) view returns (bool status)

Returns whether operator is approved to act for controller.

setOperator

javascript
function setOperator(address operator, bool approved) returns (bool success)

Sets or clears the caller's approval for operator according to approved. It emits OperatorSet and returns whether the call succeeded.

deposit

javascript
function deposit(uint256 assets, address receiver, address controller)

Claims the shares corresponding to assets from the controller's Claimable deposit balance and sends them to receiver. The caller must be the controller or an approved operator. The claim emits Deposit with the controller as the first argument and the receiver as the second.

mint

javascript
function mint(uint256 shares, address receiver, address controller)

Claims the requested amount of shares for receiver using the controller's Claimable deposit balance. This ERC-4626 overload adds the controller argument. It reverts unless the caller is the controller or an approved operator. The claim emits Deposit with the controller and receiver in the first two positions.

Events

DepositRequest

javascript
event DepositRequest(
    address indexed controller,
    address indexed owner,
    uint256 indexed requestId,
    address sender,
    uint256 assets
);

Emitted when requestDeposit moves assets into the vault and creates a request. It identifies the controller who manages the request, the owner who supplied the assets, the requestId, the calling sender, and the amount of assets. The sender can be an operator and can differ from the owner.

RedeemRequest

javascript
event RedeemRequest(
    address indexed controller,
    address indexed owner,
    uint256 indexed requestId,
    address sender,
    uint256 shares
);

Emitted when requestRedeem commits shares and creates a request. It identifies the managing controller, the supplying owner, the requestId, the calling sender, and the amount of shares. The sender can be an operator acting for the owner.

OperatorSet

javascript
event OperatorSet(
    address indexed controller,
    address indexed operator,
    bool approved
);

Emitted by setOperator. The controller is the account setting the permission, operator is the account receiving or losing it, and approved indicates approval or revocation. The log can be emitted even if the approval value is unchanged.

ERC-165 support

An ERC-7540 vault implements supportsInterface from ERC-165, which lets external callers discover the features it supports.

See the following article for background on ERC-165.

[ERC-165] Checking support for a contract interface

  • 0xe3bc4e65 identifies operator management support, which all ERC-7540 vaults provide.
  • 0x2f0a18c5 identifies the required ERC-7575 vault interface.
  • 0xce3bbe50 identifies asynchronous deposit support.
  • 0x620ee8e4 identifies asynchronous redemption support.

A vault returns true for the relevant interface IDs.

ERC-7575 support

ERC-7540 vaults also implement ERC-7575, including the share method, which returns the vault share token address. This common interface helps other protocols integrate with the vault.

See the following article for background on ERC-7575.

[ERC-7575] Extending ERC-4626 to support multi-asset vaults

Additional notes

Request IDs and the decision to avoid ID-based claim methods

Requests resemble NFTs or semi-fungible tokens because they can be identified and change state. Requiring ERC-721 or ERC-1155 would expand the interface and constrain implementation. The combination of request ID and controller supports tracking with less complexity. Vaults that use ID zero can aggregate requests and use the familiar ERC-4626 claim methods without per-request tracking. A later standard could define explicit ID-based claims if needed.

Why request quantities are asymmetric

ERC-4626 offers symmetric operations for fixed quantities of assets and shares. An asynchronous request fixes whatever amount is known when submitted. Depositors request with a fixed asset amount, because the shares to mint depend on the future exchange rate. A redemption request fixes shares, because the assets available to withdraw can change. This asymmetry applies to submitting the request. Both corresponding claim methods remain available.

Vaults with only one asynchronous side

A liquid staking vault could accept assets synchronously and redeem asynchronously because unstaking through validators takes time. The standard allows each side to follow the flow appropriate to the application.

Why cancellation is outside the standard

Cancellation might be immediate for one vault and require separate settlement for another. It can be difficult when assets have already been committed to real-world assets or liquidity pools. Standardizing one cancellation mechanism would constrain vault design, so this proposal leaves cancellation to extensions or a separate standard.

Implementation flexibility

Vaults can track requests through internal accounting, aggregate globally or by user, or use representations based on ERC-20, ERC-721, or ERC-1155. For redemptions, the vault also decides whether a request accrues yield and whether its exchange rate is fixed or variable.

See the following article for background on ERC-20.

https://chaldene.net/erc20

See the following article for background on ERC-721.

https://chaldene.net/erc721

See the following article for background on ERC-1155.

https://chaldene.net/erc1155

Why vaults cannot claim automatically

Automatic claims could force a vault operator to pay execution costs for every user. If some implementations supported one-step settlement while others required two calls, integrations would have to handle both. The uniform request-and-claim flow makes the claim explicit.

Why request functions omit expected outputs

The exchange rate at claim time may be unknown at submission, so the methods cannot reliably report the assets or shares the user will receive. Likewise, some vaults cannot reliably predict processing time, so the request methods do not return an estimated timestamp.

Why there is no Claimable event

A vault may make requests Claimable in batches or based on elapsed time without executing a separate transaction at the transition. Requiring an event would restrict that flexibility.

Compatibility

ERC-7540 extends the ERC-4626 interface. The deposit, mint, redeem, and withdraw methods have different semantics on an asynchronous side, so integrations need to account for the request and claim lifecycle.

Reference implementation

js
// This code snippet is incomplete pseudocode used for example only and is no way intended to be used in production or guaranteed to be secure

mapping(address => uint256) public pendingDepositRequest;

mapping(address => uint256) public claimableDepositRequest;

mapping(address controller => mapping(address operator => bool)) public isOperator;

function requestDeposit(uint256 assets, address controller, address owner) external returns (uint256 requestId) {
    require(assets != 0);
    require(owner == msg.sender || isOperator[owner][msg.sender]);

    requestId = 0; // no requestId associated with this request

    asset.safeTransferFrom(owner, address(this), assets); // asset here is the Vault underlying asset

    pendingDepositRequest[controller] += assets;

    emit DepositRequest(controller, owner, requestId, msg.sender, assets);
    return requestId;
}

/**
 * Include some arbitrary transition logic here from Pending to Claimable
 */

function deposit(uint256 assets, address receiver, address controller) external returns (uint256 shares) {
    require(assets != 0);
    require(controller == msg.sender || isOperator[controller][msg.sender]);

    claimableDepositRequest[controller] -= assets; // underflow would revert if not enough claimable assets

    shares = convertToShares(assets); // this naive example uses the instantaneous exchange rate. It may be more common to use the rate locked in upon Claimable stage.

    balanceOf[receiver] += shares;

    emit Deposit(controller, receiver, assets, shares);
}

function setOperator(address operator, bool approved) public returns (bool) {
    isOperator[msg.sender][operator] = approved;
    emit OperatorSet(msg.sender, operator, approved);
    return true;
}

Security considerations

Asynchronous transitions add complexity. Vault implementations need clear state transition rules, appropriate access control, and invariant checks.

Visibility into state transitions

Users need to distinguish Pending, Claimable, and Claimed. Methods such as pendingDepositRequest and claimableDepositRequest report amounts for the current state, but a frontend or user may observe an older snapshot. This is distinct from an estimate of the final payout. Exchange rates can change before the claim, and the eventual amount depends on the vault's rate and fulfillment rules.

Requests stuck in Pending

If the vault does not fulfill a request, the user's assets or shares may remain locked. A vault could offer liquidity by representing Pending positions as ERC-20 or ERC-1155 tokens. It could also provide cancellation or return funds after a timeout. Such options add implementation complexity and are unavailable in some vaults.

Operator risks

Approving an operator delegates control over requests and claims. Within those permissions, an operator may choose a different receiver for underlying assets or claim shares on the user's behalf. This can expose funds if approval goes to an untrusted account. A vault implementation can limit the scope of delegated permissions, for example by restricting which requests an operator can manage.

Conclusion

ERC-7540 separates the submission and settlement of deposit and redemption requests while retaining ERC-4626's familiar claim methods.

Questions are welcome by direct message.

Twitter @cardene777

Find more of my writing and resources here.

https://chaldene.net/