bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 1쪽 중 1쪽
Standardized Yield - A token standard for yield generating
mechanisms
Vu Nguyen∗
vu@pendle.finance
Long Vuong∗
longvh@pendle.finance
October 14, 2022
Abstract
DeFi has been growing rapidly with increasingly innovative protocols. Even with the variety of DeFi
protocols, the core utility that they provide largely remains the same: users generate yield by staking
or providing liquidity to the protocol. Despite this, most protocols build their yield generating
mechanisms differently, necessitating a manual integration every time a protocol builds on top of
another protocol’s yield generating mechanism. In this paper, we introduce a model to generalise all
yield generating mechanisms in DeFi. Using this model, we are proposing Standardized Yield (SY), a
new token standard to standardize the interaction with all yield generating mechanisms in DeFi.
*All authors contributed equally to this work
1
1 Overview
We will first introduce Generic Yield Generating Pool (GYGP), a model to describe most yield
generating mechanisms in DeFi, in section 2. Then, we will propose SY, a token standard for any
yield generating mechanism that conforms to the GYGP model. If yield generating mechanisms of
every protocol are converted into SY, it will enable unprecedented levels of composability in DeFi.
In section 4, we will talk about Simple GYGP, a subset of GYGP that is very common in DeFi.
In the last section, we will discuss the potential use cases for SY and their implications for DeFi
2 Generic Yield Generating Pool
In this section, we are introducing “Generic Yield Generating Pool”, a model for a family of yield
generating mechanisms, that should cover most of DeFi.
2.1 Definitions
pool In each yield generating mechanism, there is a central pool that contains value contributed by
users.
asset is a unit to measure the value of the pool. At time t, the pool has a total value of A(t) assets
share is a unit that represents ownership of the pool. At time t, there are S(t) shares in total.
reward tokens over time, the pool earns nrewards types of reward tokens ( nrewards ≥ 0). At time
t, Ri(t) is the amount of reward tokeni that has accumulated for the pool since t = 0
exchangeRate At time t, the exchange rate E(t) is simply how many assets each share is worth
E(t) = A(t)/S(t)
user At time t, each user u has su(t) shares in the pool, which is worth au(t) = su(t) ∗ E(t) assets.
At time t, user u will have accrued a total of rui (t) reward tokeni. The following always hold true:
S(t) =
X
su(t)
A(t) =
X
au(t)
Ri(t) =
X
rui (t)
2
2.2 State changes
Let’s denote t∗ as the timestamp of the previous state change before the current state change.
Over time, there can only be 3 types of events that will change the state of the pool:
1. A user u deposits da assets worth into the pool at time t (da could be negative, which means a
withdraw from the pool. da + au(t∗) ≥ 0). ds = da/E(t∗) new shares will be created and given
to user u (or removed and burned from user u when da is negative)
au(t) = au(t∗) + da
su(t) = su(t∗) + ds = su(t∗) + da/E(t∗)
A(t) = A(t∗) + da
S(t) = S(t∗) + ds = S(t∗) + da/E(t∗)
E(t) = A(t)/S(t) = E(t∗)
For the very first deposit at time t then S(t∗) = 0, E(t∗) = E0 which is a constant called initial
exchange rate
2. The pool earns da (or loses −da if da is negative) assets at time t. The exchange ratesimply
increases (or decreases if da is negative) due to the additional assets:
A(t) = A(t∗) + da
S(t) = S(t∗)
E(t) = A(t)/S(t) = E(t∗) + da/S(t∗)
For every user:
su(t) = su(t∗)
au(t) = au(t∗) + da
su(t∗)
S(t∗)
3. The pool earns dri (t)(dri (t) > 0) reward tokeni at time t
Ri(t) = Ri(t∗) + dri (t)
Every user will receive a certain amount of reward tokeni
rui (t) = rui (t∗) + driu (t)X
driu (t) = dri (t)
2.3 Examples
Yield generating
mechanism
USDC lending in
Compound
stake LOOKS in
Looksrare
stake 3crv in
Convex
asset USDC LOOKS 3crv pool’sliquidity D
shares cUSDC shares (in contract) 3crv LP token
reward tokens COMP WETH CR V + CVX
exchange rate Increases withUSDC lending yield increases withLOOKS rewards increases due toswap fees
3
3 SY: A token standard for GYGP
In this section, we are proposing SY, a token standard for any yield generating mechanism that
conforms to the GYGP model. On top of the definitions in 2.1.1, we need to define 2 more concepts:
Input tokens are tokens that can be converted into assets to enter the pool. Each SY can accept
several possible input tokenstokenini
Output tokens are tokens that can be redeemed from assets when exiting the pool. Each SY can
have several possible output tokenstokenouti
3.1 The SY Interface
Based on the definitions so far, we can introduce the interfaces for SY:
On top of the ERC20 interface, SY has the following functions:
e v e n t D e p o s i t (
a d d r e s s i n d e x e d c a l l e r ,
a d d r e s s i n d e x e d r e c e i v e r ,
a d d r e s s i n d e x e d t o k e n I n ,
u i n t 2 5 6 amountDeposited ,
u i n t 2 5 6 amountSYOut
) ;
e v e n t Redeem (
a d d r e s s i n d e x e d c a l l e r ,
a d d r e s s i n d e x e d r e c e i v e r ,
a d d r e s s i n d e x e d tokenOut ,
u i n t 2 5 6 amountSYToRedeem ,
u i n t 2 5 6 amountTokenOut
) ;
e v e n t ClaimRewardss ( a d d r e s s i n d e x e d u s e r , a d d r e s s [ ] rewardTokens , u i n t 2 5 6 [ ] rewardAmounts ) ;
f u n c t i o n d e p o s i t (
a d d r e s s r e c e i v e r ,
a d d r e s s t o k e n I n ,
u i n t 2 5 6 amountTokenToDeposit ,
u i n t 2 5 6 minSharesOut
) e x t e r n a l r e t u r n s ( u i n t 2 5 6 amountSharesOut ) ;
f u n c t i o n redeem (
a d d r e s s r e c e i v e r ,
u i n t 2 5 6 amountSharesToRedeem ,
a d d r e s s tokenOut ,
u i n t 2 5 6 minTokenOut
) e x t e r n a l r e t u r n s ( u i n t 2 5 6 amountTokenOut ) ;
f u n c t i o n r e d e e m A f t e r T r a n s f e r (
a d d r e s s r e c e i v e r ,
a d d r e s s tokenOut ,
u i n t 2 5 6 minTokenOut
) e x t e r n a l r e t u r n s ( u i n t 2 5 6 amountTokenOut ) ;
f u n c t i o n e x ch a n ge R at e ( ) e x t e r n a l view r e t u r n s ( u i n t 2 5 6 r e s ) ;
f u n c t i o n claimRewards ( a d d r e s s u s e r ) e x t e r n a l r e t u r n s ( u i n t 2 5 6 [ ] memory rewardAmounts ) ;
f u n c t i o n accruedRewards ( a d d r e s s u s e r ) e x t e r n a l view r e t u r n s ( u i n t 2 5 6 [ ] memory rewardAmounts ) ;
f u n c t i o n getRewardTokens ( ) e x t e r n a l view r e t u r n s ( a d d r e s s [ ] memory ) ;
4
f u n c t i o n y i e l d T o k e n ( ) e x t e r n a l view r e t u r n s ( a d d r e s s ) ;
f u n c t i o n g e t T o k e n s I n ( ) e x t e r n a l view r e t u r n s ( a d d r e s s [ ] memory r e s ) ;
f u n c t i o n getTokensOut ( ) e x t e r n a l view r e t u r n s ( a d d r e s s [ ] memory r e s ) ;
f u n c t i o n i s V a l i d T o k e n I n ( a d d r e s s t o k e n ) e x t e r n a l view r e t u r n s ( b o o l ) ;
f u n c t i o n i s V a l i d T o k e n O u t ( a d d r e s s t o k e n ) e x t e r n a l view r e t u r n s ( b o o l ) ;
f u n c t i o n p r e v i e w D e p o s i t ( a d d r e s s t o k e n I n , u i n t 2 5 6 amountTokenToDeposit )
e x t e r n a l
view
r e t u r n s ( u i n t 2 5 6 amountSharesOut ) ;
f u n c t i o n previewRedeem ( a d d r e s s tokenOut , u i n t 2 5 6 amountSharesToRedeem )
e x t e r n a l
view
r e t u r n s ( u i n t 2 5 6 amountTokenOut ) ;
enum AssetType {
T O K E N,
LIQUIDITY
}
f u n c t i o n a s s e t I n f o ( )
e x t e r n a l
view
r e t u r n s (
AssetType a s s e t T y p e ,
a d d r e s s a s s e t A d d r e s s ,
u i n t 8 a s s e t D e c i m a l s
) ;
3.2 Functions in the SY interface
3.2.1 deposit
f u n c t i o n d e p o s i t (
a d d r e s s r e c e i v e r ,
a d d r e s s t o k e n I n ,
u i n t 2 5 6 amountTokenToDeposit ,
u i n t 2 5 6 minSharesOut
) e x t e r n a l r e t u r n s ( u i n t 2 5 6 amountSharesOut ) ;
This function will deposit amountT okenT oDepositof input token i (tokenIn ) to mint new SY
shares.
This function will convert the amountT okenT oDepositof input tokeni into da worth of asset and
deposit this amount into the pool for the receiver, who will receive amountSharesOut of SY tokens
(shares), according to state change type 1 as defined in section 2.2
This function should revert if amountSharesOut < minSharesOut
3.2.2 redeemAf terT ransf er
f u n c t i o n r e d e e m A f t e r T r a n s f e r (
a d d r e s s r e c e i v e r ,
a d d r e s s tokenOut ,
u i n t 2 5 6 minTokenOut
) e x t e r n a l r e t u r n s ( u i n t 2 5 6 amountTokenOut ) ;
5
This function will use the floating amount ds of SY tokens ( shares) in the SY contract to redeem to
base token i (tokenOut). This pattern is similar to UniswapV2 which allows for more gas efficient
ways to interact with the contract.
This function will redeem the ds shares, which is equivalent to da = ds ∗ E(t) assets, from the pool,
according to state change type 1 as defined in section 2.2. The da assets is converted into exactly
amountT okenOutof base tokeni (tokenOut).
This function should revert if amountT okenOut < minT okenOut
3.2.3 redeem
f u n c t i o n redeem (
a d d r e s s r e c e i v e r ,
u i n t 2 5 6 amountSharesToRedeem ,
a d d r e s s tokenOut ,
u i n t 2 5 6 minTokenOut
) e x t e r n a l r e t u r n s ( u i n t 2 5 6 amountTokenOut ) ;
This function is similar to redeemAf terT ransf er, but will explicitly deposit
amountSharesT oRedeeminto the SY contract for the redemption.
3.2.4 claimRewards
f u n c t i o n claimRewards ( a d d r e s s u s e r ) e x t e r n a l r e t u r n s ( u i n t 2 5 6 [ ] memory rewardAmounts ) ;
Let’s say tlast is the last time this function was called for user u (user). At time t, for each reward
token i, this function will send the unclaimed reward tokens to user u, which is equal to:
routi = rui (t) − rui (tlast)
rewardAmounts is simply the array of routi
3.2.5 exchangeRate
f u n c t i o n e x c ha n ge R at e ( ) e x t e r n a l view r e t u r n s ( u i n t 2 5 6 r e s ) ;
At time t, this function returns E(t) ∗ 1e18
3.2.6 accruedRewards
f u n c t i o n accruedRewards ( a d d r e s s u s e r ) e x t e r n a l view r e t u r n s ( u i n t 2 5 6 [ ] memory rewardAmounts ) ;
At time t, this function returns an array of accrued rewards rui (t) − rui (tlast) for all the reward tokens.
3.2.7 yieldT oken
f u n c t i o n y i e l d T o k e n ( ) e x t e r n a l view r e t u r n s ( a d d r e s s ) ;
This read-only function returns the underlying yield token address.
3.2.8 getT okensIn
f u n c t i o n g e t T o k e n s I n ( ) e x t e r n a l view r e t u r n s ( a d d r e s s [ ] memory r e s ) ;
This read-only function returns the list of all input tokens
6
3.2.9 getT okensOut
f u n c t i o n getTokensOut ( ) e x t e r n a l view r e t u r n s ( a d d r e s s [ ] memory r e s ) ;
This read-only function returns the list of all output tokens
3.2.10 isV alidT okenIn
f u n c t i o n i s V a l i d T o k e n I n ( a d d r e s s t o k e n ) e x t e r n a l view r e t u r n s ( b o o l ) ;
This read-only function returns whether token is a compatible input token
3.2.11 isV alidT okenOut
f u n c t i o n i s V a l i d T o k e n O u t ( a d d r e s s t o k e n ) e x t e r n a l view r e t u r n s ( b o o l ) ;
This read-only function returns whether token is a compatible output token
3.2.12 getRewardT okens
f u n c t i o n getRewardTokens ( ) e x t e r n a l view r e t u r n s ( a d d r e s s [ ] memory ) ;
This read-only function returns the list of all reward tokens
3.2.13 previewDeposit
f u n c t i o n p r e v i e w D e p o s i t ( a d d r e s s t o k e n I n , u i n t 2 5 6 amountTokenToDeposit )
e x t e r n a l
view
r e t u r n s ( u i n t 2 5 6 amountSharesOut ) ;
This read-only function returns the amount of shares that a user would have received if they deposit
amountT okenT oDepositof tokenIn .
3.2.14 previewRedeem
f u n c t i o n previewRedeem ( a d d r e s s tokenOut , u i n t 2 5 6 amountSharesToRedeem )
e x t e r n a l
view
r e t u r n s ( u i n t 2 5 6 amountTokenOut ) ;
This read-only function returns the amount of tokenOut that a user would have received if they redeem
amountSharesT oRedeemof tokenOut.
3.2.15 assetInf o
f u n c t i o n a s s e t I n f o ( )
e x t e r n a l
view
r e t u r n s (
AssetType a s s e t T y p e ,
a d d r e s s a s s e t A d d r e s s ,
u i n t 8 a s s e t D e c i m a l s
) ;
This read-only function contains information to interpret what the asset is. assetDecimals is the
decimals to format asset balances.
For assetT ypeand assetAddress:
7
• If asset is an ERC20 token, assetT ype= 0, assetAddress is the asset token address
• If asset is liquidity of an AMM (like sqrt(k) in UniswapV2 forks), assetT ype= 1, assetAddress
is the address of the AMM pool
4 Simple GYGP
In this section, we will introduce Simple GYGP, a GYGP subset that describes most GYGPs in DeFi.
4.1 Definition
In the general mechanics of a GYGP, we have defined exactly how a change in asset balance of the
pool will be distributed among the users (in state change number 2 in Section 2.2). However, an
increase in reward tokensof the pool might be distributed in many different ways (in state change
number 3 in Section 2.2).
Simple GYGPs are GYGPs where an influx of rewards are immediately distributed equally among the
users, based on their current shares
More concretely, for state change number 3: when there is an earning of dri (t) ( dri (t) > 0) reward
token i at time t:
Ri(t) = Ri(t∗) + dri (t)
For every user, they get equally distributed based on their shares:
rui (t) = rui (t∗) + dri (t) × su(t)S(t)
Let’s define the SY reward indexrewardIndex i(T ) for reward token i at time T :
rewardIndex i(T ) =
TX
0
dri (t)
S(t)
We can see that for a user u who has the same amount of shares su from t1 to t2:
rui (t2) = rui (t1) + su × (rewardIndex i(t2) − rewardIndex i(t1)) (1)
This means that to implement a Simple GYGP, we can just store the global rewardIndex i(t) and each
user’s entitled rewards could be updated every time their amount of shares changes, according to the
formula above.
4.2 Examples of Simple GYGP
• Sushi’s Onsen rewards (in SUSHI) for stakers
• Compound’s COMP rewards for suppliers
• Looksrare’s WETH rewards for LOOKS stakers
• Traderjoe’s USDC rewards for sJOE stakers
4.3 Simple SY
The SY corresponding to Simple GYGP is simply known as Simple SY. Simple SY’s implementation
follows exactly how reward tokens are distributed according to Simple GYGP
8
5 Use cases for SY
5.1 Money markets
If a money market takes in yield generating tokens in the form of SY as collateral (like LP tokens,
or liquid staking tokens), it will be much easier to integrate the claiming of reward tokens as well as
accounting for the additional returns from the SY.
If the money market’s lending position follows SY itself, it will make it much easier for other protocols
to build on top of the lending positions.
5.2 Vaults
Vaults usually have to deal with various types of yield generating mechanisms. If all these mechanisms
follow the same SY standard, it will be much cleaner and easier to write the strategies.
5.3 Dapp aggregators
Any yield generating mechanisms that follow SY standard could be integrated in dapp aggregators like
Zapperfi and Zerion instantly, since the interfaces for querying, displaying and interacting with them
are exactly the same.
5.4 Wallets
Wallets will be able to show user positions and APYs easily in any SY that they participate in.
9프로젝트로 돌아가기