Skip to content

Commit 1375a7b

Browse files
authored
Feat: yPools Update (yearn#525)
* first pass at yPools updates * fix: clean up * feat: complete update of yPools docs * fix: clean up * fix: remove issue_body.md * fix: contractDataContext change suggestion
1 parent bbfe514 commit 1375a7b

File tree

23 files changed

+1470
-149
lines changed

23 files changed

+1470
-149
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# yPools Contract Addresses
2+
3+
A list of all the current yPool contract addresses.
4+
5+
## yETH contract Address
6+
7+
| Name | Address |
8+
|--------------------------------------------------|-------------------------------------|
9+
| yETH | [`0x1BED97CBC3c24A4fb5C069C6E311a967386131f7`](https://etherscan.io/address/0x1BED97CBC3c24A4fb5C069C6E311a967386131f7) |
10+
| st-yETH | [`0x583019fF0f430721aDa9cfb4fac8F06cA104d0B4`](https://etherscan.io/address/0x583019fF0f430721aDa9cfb4fac8F06cA104d0B4) |
11+
| Pool | [`0x2cced4ffA804ADbe1269cDFc22D7904471aBdE63`](https://etherscan.io/address/0x2cced4ffA804ADbe1269cDFc22D7904471aBdE63) |
12+
| | |
13+
| Management | [`0xbBBBBbbB6B942883EAd4976882C99201108c784d`](https://etherscan.io/address/0xbBBBBbbB6B942883EAd4976882C99201108c784d) |
14+
| Guardian | [`0xDC775e813cDB38a4f02c4BAd3942319088018eFA`](https://etherscan.io/address/0xDC775e813cDB38a4f02c4BAd3942319088018eFA) |
15+
| | |
16+
| Protocol Owned Liquidity | [`0x929401e30Aab6bd648dEf2d30FF44952BaB04478`](https://etherscan.io/address/0x929401e30Aab6bd648dEf2d30FF44952BaB04478) |
17+
| Bootstrap: Deposit, Vote, Claim Incentives | [`0x41B994C192183793bB9cc35bAAb8bD9C6885c6bf`](https://etherscan.io/address/0x41B994C192183793bB9cc35bAAb8bD9C6885c6bf) |
18+
| Bootstrap: Claim st-yETH | [`0x7cf484D9d16BA26aB3bCdc8EC4a73aC50136d491`](https://etherscan.io/address/0x7cf484D9d16BA26aB3bCdc8EC4a73aC50136d491) |
19+
| Rate Providers | [`0x4e322aeAf355dFf8fb9Fd5D18F3D87667E8f8316`](https://etherscan.io/address/0x4e322aeAf355dFf8fb9Fd5D18F3D87667E8f8316) |
20+
| | |
21+
| Inclusion Vote | ['0x6bc0878939669339e82dbFa13d260c89230f2c31'](https://etherscan.io/address/0x6bc0878939669339e82dbFa13d260c89230f2c31) |
22+
| Executor | ['0x71258Ee726644f1D52d6A9F5E11C21d1E38c2bF1'](https://etherscan.io/address/0x71258Ee726644f1D52d6A9F5E11C21d1E38c2bF1) |
23+
| GenericGovernor | ['0xB7a528CF6D36F736Fa678A629b98A427d43E5ba5'](https://etherscan.io/address/0xB7a528CF6D36F736Fa678A629b98A427d43E5ba5) |
24+
25+
> Due to a redeploy of st-yETH during the bootstrap process the first st-yETH contract has been deprecated, use the `Bootstrap: Claim st-yETH` contract to claim the new version if you participated in the bootstrap phase.
26+
27+
Find more information about the yPools Roles, modes, and privileges [here](/developers/ypools/ypools-roles)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
rpcCalls:
3+
- name: 'yPools Governance'
4+
chain: '1'
5+
address: '0xB7a528CF6D36F736Fa678A629b98A427d43E5ba5'
6+
abiName: 'yPoolsGenericGovernorABI'
7+
methods:
8+
- 'epoch'
9+
- 'propose_open'
10+
- 'vote_open'
11+
- 'genesis'
12+
13+
14+
sidebar_label: Adding Assets to yETH
15+
---
16+
<!-- markdownlint-disable MD037 -->
17+
18+
# Adding Assets to yETH
19+
20+
:::info[Prerequisites]
21+
22+
You will need access to the necessary governance contracts and a sufficient voting weight of at least 100 to create proposals. You can check your voting weight [here](https://etherscan.io/address/0x583019fF0f430721aDa9cfb4fac8F06cA104d0B4#readContract#F13).
23+
24+
:::
25+
26+
:::yearnData[Live yETH Governance Info]
27+
28+
<GovDataYPools/>
29+
30+
:::
31+
32+
## Step 1: Enable One-Off Inclusion Vote
33+
34+
Since the adoption of [this proposal](https://snapshot.org/#/ylsd.eth/proposal/0x139698bed7752b80a16bb6d2fc0d9e8c82b622916ded2f064022be3c46ec9bb4), inclusion voting is off by default and needs to be enabled for the next epoch. Here is how you do that.
35+
36+
To enable a one-off inclusion vote, a governance call must be made to the `set_enable_epoch(next_epoch)` function on the [InclusionVote contract](https://etherscan.io/address/0x6bc0878939669339e82dbFa13d260c89230f2c31#code). This requires crafting and getting a governance proposal approved. Follow the instructions below:
37+
38+
1. Create the text of your proposal and pin it to IPFS. The ipfs_hash should point to a document hosted on IPFS with details explaining the proposal and its rationale. You can host your own IPFS document or use a provider like [Piñata](https://pinata.cloud/). For this, you should explain why you want to enable an inclusion vote, what assets you want to propose, etc.
39+
40+
2. Generate a script by calling the `script(_to, _data)` view function on the yPools [Executor contract](https://etherscan.io/address/0x71258Ee726644f1D52d6A9F5E11C21d1E38c2bF1#readContract#F1). In this case, you want this script to call `set_enable_epoch()` on the InclusionVote contract with the value of the next epoch.
41+
42+
- Set the`_to(address)` field to the [InclusionVote contract](../../addresses/ypools-contracts.md#yeth-contract-addresses): `0x6bc0878939669339e82dbFa13d260c89230f2c31`.
43+
- Then create the ABI-encoded data for the function `set_enable_epoch()` with the argument set to the next epoch. Below is a ABI encoding widget that you can use. It should be pre-populated with the correct contract and function, but you need to enter the next epoch into the "Function Argument" box. The current epoch should be listed at the top of this page in the `Live Governance Info` admonition. Just add 1 to that number. Then hit "Encode" and take the output from the widget and put it in the `_data(bytes)` field on etherscan.
44+
- Click `query` and copy the result.
45+
46+
<!-- get next epoch value for functionArg. get epoch from rpc call passed to wrapper -->
47+
<AbiEncodingWidget defaultAbi='yPoolsInclusionVoteABI' defaultFunction='set_enable_epoch'/>
48+
49+
3. You can now create the proposal via the [proposal page](https://yeth.yearn.fi/propose) or directly by calling the `propose(ipfs_hash, script)` function on the [GenericGovernor contract](https://etherscan.io/address/0xB7a528CF6D36F736Fa678A629b98A427d43E5ba5). Enter the IPFS pin and the script value that you created in steps one and 2.
50+
51+
4. Once the proposal is created, the governance process will need to:
52+
- Approve the proposal.
53+
- Execute the set_enable_epoch(next_epoch) function to enable the inclusion vote for the next epoch.
54+
55+
## Step 2: Apply for Inclusion
56+
57+
To apply to have an LST included in yETH's basket of tokens, you will need to fill out the application form and pay a non-refundable application fee. Any token that has applied for inclusion and has a rate provider set by Yearn will be eligible for the inclusion vote that was enabled above.
58+
59+
## Step 3: Outcome
60+
61+
Once the vote is complete, the winner (if any) will be included into yETH.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
sidebar_label: Overview
3+
---
4+
5+
# yETH Overview
6+
7+
yETH is a user-governed yPool consisting of various Ethereum Liquid Staking Derivatives (LSTs).
8+
9+
The yETH protocol is an Automated Market Maker (AMM) for LSTs. Each LST in the yETH pool is priced according to the amount of [beacon chain](https://ethereum.org/en/upgrades/beacon-chain/) ETH it represents. This lets users deposit their LSTs into the pool and receive yETH tokens pegged 1:1 with beacon chain ETH. Users can also stake their yETH tokens to mint st-yETH, accrue yield, and participate in yETH governance.
10+
11+
This AMM model, combined with the governance and incentive mechanisms of the yETH protocol, aims to provide an optimal risk-adjusted yield for ETH staking by dynamically adjusting the weights of the LSTs in the pool. It also offers users flexibility with single-sided deposits and withdrawals, and maintains the pool's balance and diversification through a weight management system.
12+
13+
The yETH protocol is governed by its users who can vote to adjust the weights of the LSTs in the pool, helping to maximize yield and mitigate risks associated with individual LSTs.
14+
15+
All yields generated by yETH go to Staked yETH (st-yETH) holders, making yETH an ideal token for Liquidity Providing in stableswap pools like those on Curve. To acquire yETH, users can mint yETH by depositing LSTs or swap against the yETH/ETH Curve pool.
16+
17+
yETH follows the standard [yPools](../ypools-overview) specification for
18+
19+
- [Staked Tokens](../ypools-overview.md#staked-ytokens)
20+
- [Staked Token User Vote Weight](../ypools-overview.md#st-ytoken-user-vote-weight)
21+
- [Pool Weights for each LST](../ypools-overview.md#pool-weights-for-each-lst)
22+
- [Single Sided Deposits and Withdrawals](../ypools-overview.md#single-sided-deposits-and-withdrawals)
23+
24+
<PrettyLink>[Source Code Repo](https://github.com/yearn/yETH)</PrettyLink>
25+
<PrettyLink>[yETH Specification](https://github.com/yearn/yETH/blob/main/SPECIFICATION.md)</PrettyLink>
26+
<PrettyLink>[yETH dApp](https://yeth.yearn.fi)</PrettyLink>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# yPools Overview
2+
3+
## Definitions
4+
5+
- **yToken**: A token received when depositing an LST into its corresponding yPool. (e.g. yETH)
6+
- **st-yToken**: A token received when staking a yToken. (e.g. st-yETH)
7+
8+
## Overview
9+
10+
yPools are user-governed liquidity pool tokens consisting of various like-kind Liquid Staking Derivatives (LSTs).
11+
12+
The yPools protocol is an Automated Market Maker (AMM) for LSTs. Each LST in the pool is priced according to the amount of underlying assets it represents. This lets users deposit their LSTs into the pool and receive yPool tokens pegged 1:1 with the underlying. Users can also stake their yPool tokens to mint st-yTokens, accrue yield, and participate in their respective yToken governance.
13+
14+
This AMM model, combined with the governance and incentive mechanisms of the yPools protocol, aims to provide an optimal risk-adjusted yield for LST staking by dynamically adjusting the weights of the LSTs in the pool. It also offers users flexibility with single-sided deposits and withdrawals, and maintains the pool's balance and diversification through a weight management system.
15+
16+
Each yPool is governed by its users who can vote to adjust the weights of the LSTs in the pool, helping to maximize yield and mitigate risks associated with individual LSTs.
17+
18+
All yields generated by a yPool go to the Staked yPool token holders, making yTokens an ideal token for Liquidity Providing in stableswap pools like those on Curve. To acquire a yToken, users can mint it by depositing LSTs or swap against the Curve pool.
19+
20+
## Staked yTokens
21+
22+
Users stake their yTokens to mint staked versions (st-yToken), accrue yield, and can later unstake to receive the yToken back according to their earnings. Stakers receive all yield and slashings from the underlying yield sources and earn incentives if they participate and vote in their respective yPool governance.
23+
24+
By bundling LSTs, yPools aims to generate the best risk-adjusted yield from LSTs. Through protocol governance, st-yToken users can readjust pool weights to maximize yield while mitigating catastrophic scenarios where one or several LSTs in the composition suffer adverse events like de-pegging or security incidents.
25+
26+
### st-yToken User Vote Weight
27+
28+
Each user has an internal vote weight that increases asymptotically to the user's share count. After `t` seconds, their vote weight is `s * t / (t + t_half)` where `s` is the number of shares and `t_half` is the voting half-time. The voting half-time variable determines the time it takes until half the voting weight is reached for a staker.
29+
30+
The user's external vote weight equals the internal vote weight at the end of the previous week.
31+
32+
For yETH, you can find the current voting half-time on [Etherscan](https://etherscan.io/address/0x583019fF0f430721aDa9cfb4fac8F06cA104d0B4#readContract#F20) in seconds. Thus the wait to get to half of your st-yETH voting power is 60 days.
33+
34+
## Pool Weights For Each LST
35+
36+
Each Liquid Staking Derivative (LST) has an assigned weight representing its proportion in the pool. The weight management system ensures that the pool remains diversified and balanced. As an LST performs well or gains popularity, its weight in the pool may increase, attracting more liquidity and providing better returns. Conversely, if an LST underperforms or faces issues, its weight may decrease, reducing its impact on the overall pool performance. This dynamic adjustment helps maintain an optimal risk-adjusted yield for yPool users.
37+
38+
For each epoch, users can vote to adjust the weights of the LSTs in the pool. The voting process also involves a "do nothing" option, allowing the current weight distribution to remain unchanged. If a new LST is added during the voting process, it starts at 0% weight and gradually increases to 1% in the first epoch. In the subsequent epoch, they participate like all other LSTs.
39+
40+
:::note[Example]
41+
42+
Suppose we have four LSTs: A, B, C, and D with weights 10%, 20%, 30%, and 40% respectively in epoch n. For the next epoch (n+1), C has incentives worth $100.
43+
44+
The voting outcome for epoch n+1 is:
45+
46+
- Do nothing: 30%
47+
- A: 7%
48+
- B: 10%
49+
- C: 43%
50+
- D: 10%
51+
52+
Here's how the voting outcome affects the weights:
53+
54+
1. The "do nothing" vote is distributed to the current weight, reducing the total redistribution to 7%.
55+
2. The incentives for voting are distributed only to those who explicitly voted for a particular LST, making the incentive system more effective.
56+
3. If a new LST, say E, is added during the voting process, they start at 0% weight and do not fight for the 7% redistribution. They are gradually increased to 1% in the first epoch. In the next epoch, they participate like all other LSTs.
57+
58+
:::
59+
60+
## Single-Sided Deposits and Withdrawals
61+
62+
Single-sided deposits and withdrawals allow users to add or remove a specific asset from the pool. This differs from balanced operations where users deposit or withdraw a proportionate amount of all assets in the pool. Single-sided operations can be more convenient but may also incur bonuses or penalties.
63+
64+
### Single-Sided Deposits
65+
66+
When a user makes a single-sided deposit, they add a specific amount of one asset to the pool. The system calculates the equivalent amount of yPool tokens to mint based on the current rate of the deposited asset.
67+
68+
However, single-sided deposits can distort the balance of assets in the pool. The system applies a deposit penalty if the deposited asset's weight increases above its target weight due to the deposit. This penalty reduces the amount of yPool tokens minted for the depositor, making the deposit operation more expensive. The penalty serves as an incentive for users to maintain the balance of assets in the pool.
69+
70+
Conversely, the system applies a deposit bonus if the deposited asset's weight is below its target weight. This bonus increases the yPool tokens minted for the depositor, making the deposit operation cheaper. The bonus serves as an incentive for users to restore the balance of assets in the pool.
71+
72+
### Single-Sided Withdrawals
73+
74+
Users who make a single-sided withdrawal burn a specific amount of yPool tokens to withdraw one asset from the pool. The system calculates the amount of the asset to send based on the current rate.
75+
76+
Like single-sided deposits, single-sided withdrawals can also distort the balance of assets in the pool. If the withdrawn asset's weight decreases below its target weight due to the withdrawal, the system applies a withdrawal penalty. This penalty reduces the amount of the asset sent to the withdrawer, making the withdrawal operation more expensive.
77+
78+
Conversely, the system applies a withdrawal bonus if the withdrawn asset's weight exceeds its target weight. This bonus increases the amount of the asset sent to the withdrawer, effectively making the withdrawal operation cheaper.
79+
80+
:::note[Example]
81+
82+
Let's consider a pool with two assets, A and B, with a target weight of 50%. Due to market fluctuations, the current weights are 60% for A and 40% for B.
83+
84+
- If a user deposits asset A, they will incur a deposit penalty because the deposit increases the weight of A above its target weight. The system will mint fewer yPool tokens for the depositor than the rate would suggest.
85+
- If a user deposits asset B, they will receive a deposit bonus because the deposit brings the weight of B closer to its target weight. The system will mint more yPool tokens for the depositor than the rate would suggest.
86+
- If a user withdraws asset A, they will receive a withdrawal bonus because the withdrawal brings the weight of A closer to its target weight. The system will send more asset A to the withdrawer than the rate would suggest.
87+
- If a user withdraws asset B, they will incur a withdrawal penalty because the withdrawal decreases the weight of B below its target weight. The system will send less asset B to the withdrawer than the rate would suggest.
88+
89+
:::
90+
91+
For a deeper dive into the math behind the calculation of yPool weighted stable swap check this paper: https://github.com/yearn/yETH/blob/main/whitepaper/derivation.pdf
92+
93+
## Protocol Specs
94+
95+
- The yETH specification can be found in the source repo: https://github.com/yearn/yETH/blob/main/SPECIFICATION.md
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# yPools Roles and Modes
2+
3+
## Management Role
4+
5+
Trusted addresses with privileged access for limited operations. Should eventually be replaced by a smart contract:
6+
7+
- Can start a gradual weight change, as long as no weight change is active yet.
8+
- Can whitelist a new asset, which sets an initial weight, sets the rate provider, and requires an initial deposit. New assets can only be whitelisted if no weight change has been scheduled yet.
9+
- Can update the rate provider for every whitelisted asset.
10+
- Can approve rate increases above 10%.
11+
- Can update the staking contract.
12+
- Can set the pool swap fee.
13+
- Can set the tolerance range.
14+
- Can set the new management address.
15+
- Can set the new guardian addresses.
16+
- Can trigger `pause mode`.
17+
- Can trigger `killed mode`.
18+
19+
## Guardian Role
20+
21+
Trusted addresses with emergency privileges:
22+
23+
- Can trigger pause mode.
24+
25+
### Pause mode
26+
27+
> This mode is to be activated in the event of extreme market conditions or detected suspicious behavior, either in the protocol itself or in the underlying LST tokens that back it.
28+
29+
- No user may swap assets with the contract.
30+
- No user may deposit assets into the contract.
31+
- Users may only withdraw assets in a balanced manner, single-sided withdrawals are not allowed.
32+
- Weights, rates, and rate providers cannot be updated during this mode.
33+
- Management or guardian can undo pause mode to resume normal operation.
34+
35+
### Killed mode
36+
37+
> This mode is to be activated in the event of critical failures, whether in the protocol itself or in any of the underlying LST tokens that back it. This can also be used to migrate to a new version of the yETH protocol.
38+
39+
- No user may deposit assets into the contract.
40+
- Users may only withdraw assets in a balanced manner.
41+
- The reward controller may not update the beacon chain amounts.
42+
- Pause mode may not be undone.
43+
44+
There is no way to undo `killed mode`.

0 commit comments

Comments
 (0)