ERC-7535

ERC-7535 is an adaptation of ERC-4626 in which the underlying asset of the vault is the chain’s native asset (e.g. Ether) instead of an ERC-20 token. It keeps the ERC-4626 share-accounting model, rounding rules, and interface, so the same mental model, security considerations, and customizations apply, with a few native-asset specific differences.

ERC7535 is implemented as a thin extension of ERC4626: share accounting, rounding, the virtual-shares inflation mitigation, the preview functions, and the checks-effects-interactions withdraw path are all inherited.

Differences with ERC-4626

ERC7535 behaves like ERC4626, with the following changes:

  • asset() returns the placeholder address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE defined by ERC-7528, and the vault uses 18 decimals (those of the native asset) as its base before applying the optional decimals offset.

  • deposit and mint are payable. The native asset is provided as msg.value instead of being pulled with an ERC-20 transferFrom, so there is no allowance flow for the underlying asset. deposit(assets, receiver) deposits the entire msg.value and ignores its assets argument (per ERC-7535), minting previewDeposit(msg.value) shares; mint(shares, receiver) requires msg.value >= previewMint(shares).

  • Withdrawals and redemptions send the native asset out with a low-level call (Address.sendValue) instead of an ERC-20 transfer.

contract NativeVault is ERC7535 {
    constructor() ERC20("Native Vault", "nvETH") {}
}

To raise the resistance to the inflation attack, override _decimalsOffset() exactly as for ERC4626:

contract HardenedNativeVault is ERC7535 {
    constructor() ERC20("Hardened Native Vault", "hnvETH") {}

    function _decimalsOffset() internal pure override returns (uint8) {
        return 6;
    }
}
A vault backed by a wrapped native asset (such as WETH9) MUST NOT use this contract. Per ERC-7528 and ERC-7535 such a vault is a plain ERC-4626 over the wrapper ERC-20 and must report that wrapper’s address from asset().

How it extends ERC-4626

ERC-4626’s deposit and mint are declared payable on IERC4626 (this does not change their selectors or the ERC-165 interface id) and route through virtual hooks. ERC7535 overrides these hooks, and mint itself:

  • _enablePayableDeposit(): whether native value is accepted. The ERC4626 default returns false, so deposit and mint revert on any msg.value; ERC7535 overrides it to return true. A plain ERC-20 vault is therefore unchanged: it still rejects native value.

  • _transferIn / _transferOut: ERC7535 makes _transferIn a no-op (the value already arrived as msg.value) and routes _transferOut through Address.sendValue.

  • mint: ERC7535 refunds any excess msg.value after _deposit returns, through a dedicated _refund internal function rather than _transferOut, so that custom payout logic (such as unstaking before sending) does not apply to value that never became vault assets. See The msg.value requirement.

Accounting and msg.value

Because deposit and mint are payable, the deposited msg.value is already part of address(this).balance when the exchange rate is computed. This differs from an ERC-4626 vault, where the assets are only pulled in after the share amount is computed from the pre-deposit balance.

To keep the behavior identical, totalAssets() returns address(this).balance - msg.value. Outside a payable call msg.value is 0 and this is the full balance; inside deposit and mint it is the pre-call balance. The share conversion and preview functions are inherited unchanged from ERC4626, so a standalone previewDeposit(value) returns exactly the number of shares a subsequent deposit with msg.value == value mints.

Note that within a deposit or mint call, totalAssets() excludes the whole msg.value for the duration of the call. Custom logic that runs in that call after _mint (for example in a _deposit or _update override) sees the new totalSupply() against the pre-deposit totalAssets(). A reentrant call is not affected: it has its own msg.value. The excess of a mint is refunded after _deposit returns, so only code that runs in a mint override after super.mint sees a totalAssets() lowered by the refunded amount.

Security concern: Inflation attack

Native asset vaults are exposed to the same donation / inflation attack as ERC-4626 vaults, and ERC7535 uses the same mitigation: configurable virtual shares and assets parameterized by _decimalsOffset(). The default offset of 0 makes the attack non-profitable, and a larger offset makes it orders of magnitude more expensive than profitable.

Note that a native asset vault cannot keep its balance strictly equal to the sum of deposits: it can always be force-fed extra native asset, for example by being a block’s coinbase or through the SELFDESTRUCT opcode. totalAssets() is balance-based and therefore tracks such donations, exactly like a direct ERC-20 transfer would for an ERC-4626 vault; the defense is the virtual-offset mitigation, not internal balance accounting.

Security concern: Reentrancy

Sending the native asset out uses a low-level call via Address.sendValue, which forwards all remaining gas. The full-gas forward is deliberate: it keeps the vault compatible with smart-contract receivers (multisigs, account-abstraction wallets, proxies) whose receive() typically costs more than the spec’s suggested 2300-gas stipend. The reentrancy risk that the full-gas forward opens is handled by the inherited checks-effects-interactions ordering: on withdrawals and redemptions the shares are burned before the value is sent, so a reentrant call from the receiver observes a consistent, already-reduced share price. As in ERC4626, reentrancy safety relies on this ordering rather than on a reentrancy guard. Integrators adding custom logic to _deposit/_withdraw should preserve this ordering, or add an explicit reentrancy guard.

Plain native-asset transfers

Value must enter the vault through the standardized deposit or mint entry points so it is matched with newly issued shares. ERC7535 does not implement a receive() or fallback() function, so a plain native-asset transfer to the vault fails: .transfer reverts, and .send or call{value: x}("") return false. The value is never silently absorbed as a donation that would skew the next deposit’s exchange rate.

An integrator whose vault must accept plain native-asset payments (for example a rewards distributor that pays the vault periodically on a chain without beacon-layer withdrawals) can add a receive() function, accepting that such payments raise the share price for existing holders like a donation.

Note that protocol-level force-feeds cannot be prevented: native asset routed through SELFDESTRUCT or paid out as block-reward / coinbase tips does not execute any code on the vault and lands on address(this).balance. Because totalAssets() is balance-based, such donations are tracked exactly as a direct ERC-20 transfer would be for an ERC-4626 vault; the defense is the same virtual-offset math described in Security concern: Inflation attack.

The msg.value requirement

deposit(assets, receiver) deposits the entire msg.value and prices shares off it, ignoring the assets argument (per ERC-7535): there is no underpayment to revert on and no excess to retain, since the full value sent is always converted to previewDeposit(msg.value) shares. mint(shares, receiver) instead requires msg.value >= previewMint(shares) and reverts with the typed error ERC7535InsufficientNativeValue if too little is sent; any excess msg.value on a mint is refunded to the caller. The refund is sent at the end of mint, after the shares are minted, so that a reentrant call made during the refund sees a totalAssets() and totalSupply() that both account for the deposit. The refund forwards all remaining gas; a caller that cannot receive it only causes its own mint to revert. Prefer deposit over mint for an ETH-in flow, since deposit consumes exactly the value sent, while previewMint can shift between an off-chain quote and the on-chain transaction.

Override checklist

When customizing ERC7535, keep the following invariants in mind in addition to the inherited ERC-4626 ones:

  • totalAssets() overrides MUST exclude the in-flight msg.value (for example by building on super.totalAssets()). Otherwise deposit/mint price shares against a balance that already includes the value being deposited, and the depositor receives fewer shares than previewDeposit announced.

  • totalAssets() MUST NOT revert. When sourcing the total from an external oracle, wrap the call in try/catch and return a safe fallback. Overstating totalAssets() will make withdraw/redeem attempt to send more than address(this).balance and revert in Address.sendValue, locking exits until the balance catches up with the reported total.

  • _deposit overrides MUST NOT introduce an outbound native-asset call (such as the refund of excess msg.value) before _mint. While the deposited value is in the vault’s balance but the corresponding shares are not minted, a reentrant call (in which msg.value is 0) prices shares against an inflated totalAssets(), letting existing holders redeem at the expense of others.

  • Native asset sent out during deposit or mint (for example a fee paid from a _deposit override) is still subtracted through msg.value, so totalAssets() returns a value lowered by the amount sent for the rest of the call, and reverts if that amount exceeds the pre-deposit balance. Read totalAssets() before sending value out.

  • _withdraw overrides MUST preserve the checks-effects-interactions ordering (allowance spent and shares burned BEFORE the outbound transfer).

Off-chain previews must be performed before sending value, since the public view functions cannot account for an in-flight msg.value.