ERC-7887 · Draft · ERC · 2025-02-18
ERC-7887: Cancelation for ERC-7540 Tokenized Vaults
Adds a cancel-then-claim flow to ERC-7540 asynchronous vaults, so a user whose deposit or redeem Request is stuck in Pending can get their assets or shares back.
What problem does it solve?
ERC-7540 lets an ERC-4626 vault process deposits and redemptions asynchronously: the user submits a Request, it sits in Pending until the vault fulfils it, and then the user claims. That suits vaults backed by things that settle slowly, such as long-dated real-world assets.
The catch is that ERC-7540 has no way out. Once assets or shares are locked in a Request, the user must wait for fulfilment, which can take a long time. ERC-7887 adds a standard cancelation flow so integrators can offer "cancel my request" the same way across vaults.
How it works
Cancelation mirrors the ERC-7540 lifecycle: Pending → Claimable → Claimed.
| Step | Deposit side | Redeem side |
|---|---|---|
| Ask to cancel | cancelDepositRequest(requestId, controller) |
cancelRedeemRequest(requestId, controller) |
| Is it pending? | pendingCancelDepositRequest(requestId, controller) → bool |
pendingCancelRedeemRequest(...) → bool |
| How much is claimable? | claimableCancelDepositRequest(...) → assets |
claimableCancelRedeemRequest(...) → shares |
| Collect | claimCancelDepositRequest(requestId, receiver, controller) |
claimCancelRedeemRequest(requestId, receiver, controller) |
Key rules:
- A cancelation covers the full pending Request.
- The vault may move a cancelation straight from Pending to Claimable (a synchronous cancel), but it must never skip the Claim step. Users pull their assets or shares; the vault never pushes them.
- While a deposit cancelation is Pending,
requestDepositmust revert for that controller; the same applies to redeem. This keeps the vault's state easy for integrators to read. controllermust bemsg.senderor an operator the controller approved (the ERC-7540 operator model).- Events are emitted on cancel and on claim.
Vaults must implement ERC-165: 0x8bf840e3 signals deposit cancelation support and 0xe76cffc7 signals redeem cancelation support.
Sample code
Interface for the deposit side, plus a front-end check (ethers v6):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC7887Deposit {
function cancelDepositRequest(uint256 requestId, address controller) external;
function pendingCancelDepositRequest(uint256 requestId, address controller)
external view returns (bool isPending);
function claimableCancelDepositRequest(uint256 requestId, address controller)
external view returns (uint256 assets);
function claimCancelDepositRequest(uint256 requestId, address receiver, address controller)
external;
}
import { Contract } from "ethers";
const vault = new Contract(vaultAddress, [
"function supportsInterface(bytes4) view returns (bool)",
"function cancelDepositRequest(uint256,address)",
"function claimableCancelDepositRequest(uint256,address) view returns (uint256)",
"function claimCancelDepositRequest(uint256,address,address)",
], signer);
if (await vault.supportsInterface("0x8bf840e3")) {
await (await vault.cancelDepositRequest(0n, me)).wait();
// ...later, once the vault has processed the cancelation
if ((await vault.claimableCancelDepositRequest(0n, me)) > 0n) {
await vault.claimCancelDepositRequest(0n, me, me);
}
}
Things to know
- Status is Draft; names and interface IDs may still change.
- The draft has some loose ends (for example, event names in the method text differ from the Events section, and the redeem claim text says "assets" where shares are meant). Check the latest spec before implementing.
- Cancelation is itself asynchronous: requesting it does not return funds immediately, and new Requests are blocked until it resolves.
- Security considerations are inherited from ERC-7540.