ERC-7575 · Final · ERC · 2023-12-11
ERC-7575: Multi-Asset ERC-4626 Vaults
Lets several ERC-4626 vault entry points, each with its own asset, mint one shared external share token, by adding a `share()` method and a share-to-vault lookup.
What problem does it solve?
An ERC-4626 vault has exactly one asset and must itself be the ERC-20 share token. That fits a single-asset yield vault, but not a pool where users can enter with USDC or DAI and receive the same LP token, or a converter that turns one existing token into another.
ERC-7575 separates the share token from the vault. Each asset gets its own ERC-4626-style entry point, and all of them point at the same share token.
How it works
- Every vault adds
share(), which returns the address of the ERC-20 share token. It may be the vault itself (so ordinary ERC-4626 vaults comply by adding one function) or an external token. - If
shareis external, deposits must increaseshare.balanceOf(receiver)and exits must decreaseshare.balanceOf(owner)by the share amount. - ERC-7575 vaults implement ERC-4626 minus its ERC-20 functions and events. In a multi-asset setup the entry points should not be ERC-20s themselves, which avoids confusing front-ends.
- Pipes: a vault that converts between two external tokens, one-way (only
deposit/mint) or two-way. - The share token should expose
vault(asset)to find the entry point for an asset, and emitVaultUpdate(asset, vault)when that link changes. - ERC-165: vaults must return
truefor0x2f0a18c5; share tokens should support it and returntruefor0xf815c03d.
Sample code
Finding the entry point for a given asset and depositing (ethers v6):
import { Contract, Wallet, JsonRpcProvider, parseUnits } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const signer = new Wallet(process.env.PRIVATE_KEY!, provider);
const share = new Contract(shareAddress, [
"function vault(address asset) view returns (address)",
"function balanceOf(address) view returns (uint256)",
], provider);
const vaultAddr = await share.vault(usdcAddress); // entry point for USDC
const vault = new Contract(vaultAddr, [
"function share() view returns (address)",
"function deposit(uint256 assets, address receiver) returns (uint256)",
], signer);
console.log("same share token:", (await vault.share()) === shareAddress);
await (await vault.deposit(parseUnits("100", 6), signer.address)).wait(); // after approving USDC
console.log("shares:", await share.balanceOf(signer.address));
Things to know
- Final standard. ERC-7540 asynchronous vaults are required to implement ERC-7575.
- Vaults with an external share are not fully ERC-4626 compatible: they do not behave as ERC-20 tokens themselves, so integrations that call
balanceOfon the vault must call it onshare()instead. - Redeeming on behalf of someone else (
owner != msg.sender) is awkward when vault and share are separate, because ERC-20 allowances are held by the share token. The spec suggests making the vault a trusted forwarder of the share via ERC-2771. vault(asset)is optional (SHOULD), so it may be missing when the share token is an existing deployed contract.