ERC-5115 Standardized Yield Token (SY) (SY Token)
Draft · Vaults & DeFi · created 2022-05-30
An ERC-20 extension standard that wraps yield-bearing assets, on which interest or rewards accrue, so that deposits, redemptions, and exchange rate lookups can all be handled through a single common interface. It aims to cover assets, such as LP tokens, that ERC-4626 cannot accommodate.
Why it is needed
Ethereum has many yield-bearing assets that accrue interest or rewards when deposited, such as lending deposits, liquidity provision, and staking. Because the mechanisms differ from one to another, building a service on top of another protocol's yield structure requires manual integration work each time. The vault standard ERC-4626 has resolved much of this fragmentation, but it cannot cover every yield structure. For example, an automated market maker's (AMM) liquidity token measures the pool's value in units of liquidity, and since that unit is not itself a token, it cannot be deposited directly. Assets where the deposit token and the unit used to measure pool value differ, and assets that by default produce a separate reward token, such as Compound's COMP, also fall outside its scope. This standard wraps even these kinds of assets so they can be handled through a single interface, aiming to minimize or eliminate the need for custom adapters when interacting with various forms of yield-bearing assets.
What to implement
function exchangeRate() external view returns (uint256 res);: Returns the latest exchange rate, scaled by 1e18, for converting an amount of SY tokens into an amount of the underlying asset.function getTokensIn() external view returns (address[] memory res);: Returns the list of addresses of all input tokens that can be used for deposits.function getTokensOut() external view returns (address[] memory res);: Returns the list of addresses of all output tokens that can be received upon redemption.function yieldToken() external view returns (address);: Returns the address of the underlying yield token that the SY wraps. If the implementation does not wrap a token, it may return the zero address.function previewDeposit(address tokenIn, uint256 amountTokenToDeposit) external view returns (uint256 amountSharesOut);: Previews the number of shares a given amount of tokenIn would yield if deposited.function previewRedeem(address tokenOut, uint256 amountSharesToRedeem) external view returns (uint256 amountTokenOut);: Previews the amount of tokenOut that would be received if a given amount of shares were redeemed.function name() external view returns (string memory);: Returns the token name. It should reflect the name of the underlying asset.function symbol() external view returns (string memory);: Returns the token symbol. It should reflect the symbol of the underlying asset.function decimals() external view returns (uint8);: Returns the token decimals. It should reflect the decimals of the underlying asset.
In depth
The GYGP model: a single framework for every yield structure
The spec first defines a generic Generic Yield Generating Pool (GYGP) model. The pool's value is denominated in asset units, and ownership of the pool is divided into shares units. As time passes, the pool's value grows, so each share comes to represent more asset value, at the ratio ExchangeRate(t) = TotalAsset(t) / TotalShares(t). A pool can earn n_rewards types of reward tokens (zero or more), distributed to users according to a fixed rule (e.g., proportional to shares). The source text presents a table of cases that fit this model, including Compound's cUSDC, Lido's wstETH, and SushiSwap LP tokens. A single SY token represents shares in a GYGP and lets you interact with that pool through a standard interface.
ERC-20 requirements and optional features
Every SY token must implement ERC-20 to represent shares in the underlying GYGP, and balanceOf, transfer, totalSupply, and similar functions must operate in share units. The metadata extension functions name, symbol, and decimals must also be implemented and must reflect the accounting asset of the underlying pool. ERC-2612 may be implemented to improve approval UX, and transfer and transferFrom calls may be made to revert in order to create a non-transferable SY. ERC-165 may optionally be implemented to aid integration detection.
deposit: two deposit paths
deposit converts amountTokenToDeposit of tokenIn into the asset, adds it to the pool, and mints SY shares to the receiver. If depositFromInternalBalance is false, the conversion happens after the caller has already sent the deposit token to the SY contract; if true, the tokens are pulled directly from the caller. It must revert if the resulting shares amountSharesOut is less than minSharesOut (e.g., deposit cap reached, slippage, insufficient approval). It must emit a Deposit event and must support the ERC-20 approve/transferFrom flow. If tokenIn is the chain's native currency (e.g., ETH), the function may be made payable.
redeem: converting shares into output tokens
redeem computes d_a = d_s x ExchangeRate(t) worth of asset from d_s shares according to the exchange rate, removes it from the pool, converts it into tokenOut, and pays it out. If burnFromInternalBalance is false, the user first sends shares to the SY contract and the contract burns the balance held internally; the source text describes this as a gas-efficient pattern similar to Uniswap V2. If true, shares are burned directly from the user. It must revert if the resulting token amount is less than minTokenOut, and it must emit a Redeem event.
exchangeRate precision and fee rules
exchangeRate returns the latest exchange rate for converting an amount of SY tokens into an amount of the underlying asset, scaled by a fixed factor of 1e18. It must hold that ExchangeRate(t_now) x syBalance / 1e18 = assetBalance. Fees charged on the underlying yield token inside the SY contract must not be included in this value. This single function lets an integrator consistently compute the asset value of shares.
Input/output token lists and yieldToken
getTokensIn returns the list of tokens that can be used for deposits, and getTokensOut returns the list of tokens that can be received upon redemption. Both must return at least one ERC-20 address and must never revert. Separating the deposit token from the unit of value measurement is a core flexibility of this standard; for example, an ETH vault could accept direct cETH deposits for gas efficiency or UX reasons. yieldToken returns the address of the underlying yield token being wrapped, and if the token is wrapped, it must reflect the exact address of the underlying token. The zero address may be returned only when the GYGP shares are implemented natively without wrapping another token.
Conservative estimation rules for preview functions
previewDeposit precomputes the shares received for depositing tokenIn, and previewRedeem precomputes the amount of tokenOut received for redeeming shares. Both functions must return a value less than or equal to the actual return value of deposit or redeem, and must never return a value greater than the actual value. Reverting should be limited to conditions under which minting or burning is actually prohibited (e.g., supply cap exceeded). This rule ensures estimates never appear larger than reality, so integrators can rely on them safely.
Relationship to ERC-4626
The source text regards ERC-4626 as a well-designed standard that most vaults should adopt. SY is meant to wrap assets that fall outside it: assets whose deposit token differs from its unit of account (such as AMM liquidity tokens), and assets that inherently produce reward tokens (such as Compound's COMP). It explains that SY can also wrap an ERC-4626 vault itself, and that reward handling, such as claiming multiple accumulated reward tokens, can be handled through SY extensions. The use cases cited in the source text include lending deposits, AMM liquidity provision, vaults, liquid staking, liquidity mining, and rebasing tokens.
Still in draft stage
This proposal's status is Draft. The content may change going forward, and the spec's function signatures and requirements are not finalized, so the latest source text should be checked before implementing or integrating.
Things to watch out for
- Risk of malicious implementations that only match the interface: Even if an implementation follows the interface, a malicious implementation can still put users at risk. Integrators such as wallets, aggregators, and other smart contract protocols are advised to review implementations to avoid exploits and potential loss of funds.
- Accuracy of the yieldToken address: yieldToken must strongly reflect the address of the underlying yield token being wrapped. The zero address may be returned only when the GYGP shares are implemented natively without wrapping another token. If a wrapped token's address is misrepresented, it can cause confusion about what the SY token represents, or be considered malicious.