@@ -11,17 +11,17 @@ user balance using the following equation:
11
11
` balanceOf(account) = shares[account] * totalPooledEther / totalShares ` .
12
12
Therefore, burning shares (e.g. decreasing the ` totalShares ` amount) increases stETH holders' balances.
13
13
14
- It's presumed that actual shares burning happens inside the ` Lido ` contract as a part of the ` AccountingOracleReport ` .
14
+ It's presumed that actual shares burning happens inside the ` Lido ` contract as a part of the ` AccountingOracle ` report .
15
15
` Burner ` provides a safe and deterministic way to incur a positive stETH token rebase by gradually
16
16
decreasing ` totalShares ` that can be correctly handled by 3rd party protocols integrated with stETH.
17
17
18
- ` Burner ` accepts burning requests by the following two ways:
18
+ ` Burner ` accepts burning requests in the following two ways:
19
19
20
- - Locking pre-approved stETH tokens by the caller with an assigned role.
20
+ - Locking pre-approved stETH tokens by the caller with an assigned role;
21
21
- Locking caller-provided stETH tokens.
22
22
23
23
Those burn requests are initially set by the contract to a pending state.
24
- Actual burning happens as part of an oracle (` AccountinOracle ` ) report handling by ` Lido ` to prevent
24
+ Actual burning happens as part of an oracle (` AccountingOracle ` ) report handling by ` Lido ` to prevent
25
25
additional fluctuations of the existing stETH token rebase period (~ 24h).
26
26
27
27
We also distinguish two types of shares burn requests:
@@ -30,13 +30,13 @@ between the two consecutive oracle reports);
30
30
* request to burn shares for any other cases (** non-cover** ).
31
31
32
32
The contract has two separate counters for the burnt shares: cover and non-cover ones. The contract is
33
- exclusive responsible for the stETH shares burning via by ` Lido ` and burning allowed only from the contract's
33
+ exclusively responsible for the stETH shares burning by ` Lido ` and burning allowed only from the contract's
34
34
own balance only.
35
35
36
36
## Shares burnt counters
37
37
38
38
The contract keeps count of all shares ever burned by way of maintaining two internal counters:
39
- ` totalCoverSharesBurnt ` and ` totalNonCoverSharesBurnt ` for cover and non-cover burns respectively.
39
+ ` totalCoverSharesBurnt ` and ` totalNonCoverSharesBurnt ` for cover and non-cover burns, respectively.
40
40
These counters are increased when actual stETH burn is performed as part of the Lido Oracle report.
41
41
42
42
This makes it possible to split any stETH rebase into two sub-components: the rewards-induced rebase
@@ -78,12 +78,20 @@ Returns the total non-cover shares ever burnt.
78
78
function getNonCoverSharesBurnt() external view returns (uint256)
79
79
```
80
80
81
- ### function getExcessStETH
81
+ ### Function: getExcessStETH
82
82
83
83
Returns the stETH amount belonging to the burner contract address but not marked for burning.
84
84
85
85
``` sol
86
- function getExcessStETH() external view return (uint256)
86
+ function getExcessStETH() external view returns (uint256)
87
+ ```
88
+
89
+ ### Function: getSharesRequestedToBurn
90
+
91
+ Returns numbers of cover and non-cover shares requested to burn.
92
+
93
+ ``` sol
94
+ function getSharesRequestedToBurn() external view returns (uint256 coverShares, uint256 nonCoverShares)
87
95
```
88
96
89
97
## Methods
@@ -95,47 +103,104 @@ Internally converts tokens amount into underlying shares amount and marks the co
95
103
for cover-backed burning by increasing the internal ` coverSharesBurnRequested ` counter.
96
104
97
105
``` sol
98
- function requestBurnMyStETHForCover(uint256 _stETH2Burn ) external
106
+ function requestBurnMyStETHForCover(uint256 _stETHAmountToBurn ) external
99
107
```
100
108
101
109
::: note
102
110
Reverts if any of the following is true:
103
- * ` msg.sender ` is not equal to the set upon construction ` voting ` address ;
104
- * no stETH provided (` _stETH2Burn == 0` );
111
+ * ` msg.sender ` is not a holder of ` REQUEST_BURN_MY_STETH_ROLE ` role ;
112
+ * no stETH provided (` _stETHAmountToBurn == 0` );
105
113
* no stETH transferred (allowance exceeded).
106
114
:::
107
115
108
116
#### Parameters:
109
117
110
- | Name | Type | Description |
111
- | ------------- | --------- | ----------------------------------------------- |
112
- | ` _stETH2Burn ` | ` uint256 ` | stETH tokens amount (not shares amount) to burn |
118
+ | Name | Type | Description |
119
+ | -------------------- | --------- | ----------------------------------------------- |
120
+ | ` _stETHAmountToBurn ` | ` uint256 ` | stETH tokens amount (not shares amount) to burn |
121
+
122
+ ### Function: requestBurnSharesForCover
123
+
124
+ Transfers stETH shares from ` _from ` and irreversibly locks these on the burner contract address.
125
+ Internally marks the shares amount for cover-backed burning by increasing the internal ` coverSharesBurnRequested ` counter.
126
+
127
+ Can be called only by a holder of ` REQUEST_BURN_SHARES_ROLE ` . After Lido V2 upgrade not actually called by any contract and supposed to be called by Lido DAO Agent in case of a need for cover.
128
+
129
+ ``` sol
130
+ function requestBurnSharesForCover(address _from, uint256 _sharesAmountToBurn)
131
+ ```
132
+
133
+ ::: note
134
+ Reverts if any of the following is true:
135
+ * ` msg.sender ` is not a holder of ` REQUEST_BURN_SHARES_ROLE ` role;
136
+ * no stETH shares provided (` _sharesAmountToBurn == 0 ` );
137
+ * no stETH shares transferred (allowance exceeded).
138
+ :::
139
+
140
+ #### Parameters:
141
+
142
+ | Name | Type | Description |
143
+ | --------------------- | --------- | ----------------------------------------------- |
144
+ | ` _from ` | ` address ` | address to transfer shares from |
145
+ | ` _sharesAmountToBurn ` | ` uint256 ` | shares amount (not stETH tokens amount) to burn |
113
146
114
147
### Function: requestBurnMyStETH
115
148
116
149
Transfers stETH tokens from the message sender and irreversibly locks these on the burner contract address.
117
150
Internally converts tokens amount into underlying shares amount and marks the converted amount for
118
- non-cover-backed burning by increasing the internal ` nonCoverSharesBurnRequested ` counter.
151
+ non-cover backed burning by increasing the internal ` nonCoverSharesBurnRequested ` counter.
152
+
153
+ ``` sol
154
+ function requestBurnMyStETH(uint256 _stETHAmountToBurn) external
155
+ ```
119
156
120
157
::: note
121
158
Reverts if any of the following is true:
122
- * ` msg.sender ` is not equal to the set upon construction ` voting ` address ;
123
- * no stETH provided (` _stETH2Burn == 0` );
159
+ * ` msg.sender ` is not a holder of ` REQUEST_BURN_MY_STETH_ROLE ` role ;
160
+ * no stETH provided (` _stETHAmountToBurn == 0` );
124
161
* no stETH transferred (allowance exceeded).
125
162
:::
126
163
127
164
#### Parameters:
128
165
129
- | Name | Type | Description |
130
- | ------------- | --------- | ----------------------------------------------- |
131
- | ` _stETH2Burn ` | ` uint256 ` | stETH tokens amount (not shares amount) to burn |
166
+ | Name | Type | Description |
167
+ | -------------------- | --------- | ----------------------------------------------- |
168
+ | ` _stETHAmountToBurn ` | ` uint256 ` | stETH tokens amount (not shares amount) to burn |
132
169
133
- ### function recoverExcessStETH
170
+ ### Function: requestBurnShares
171
+
172
+ Transfers stETH shares from ` _from ` and irreversibly locks these on the burner contract address.
173
+ Internally marks the shares amount for non-cover backed burning by increasing the internal ` nonCoverSharesBurnRequested ` counter.
174
+
175
+ Can be called only by a holder of ` REQUEST_BURN_SHARES_ROLE ` role which after
176
+ Lido V2 upgrade is either ` Lido ` or ` NodeOperatorsRegistry ` contract.
177
+ ` Lido ` needs this to request shares locked on the ` WithdrawalQueue ` and
178
+ ` NodeOperatorsRegistry ` needs it to request burning shares to penalize the rewards of misbehaving node operators.
179
+
180
+ ``` sol
181
+ function requestBurnShares(address _from, uint256 _sharesAmountToBurn)
182
+ ```
183
+
184
+ ::: note
185
+ Reverts if any of the following is true:
186
+ * ` msg.sender ` is not a holder of ` REQUEST_BURN_SHARES_ROLE ` role;
187
+ * no stETH shares provided (` _sharesAmountToBurn == 0 ` );
188
+ * no stETH shares transferred (allowance exceeded).
189
+ :::
190
+
191
+ #### Parameters:
192
+
193
+ | Name | Type | Description |
194
+ | --------------------- | --------- | ----------------------------------------------- |
195
+ | ` _from ` | ` address ` | address to transfer shares from |
196
+ | ` _sharesAmountToBurn ` | ` uint256 ` | shares amount (not stETH tokens amount) to burn |
197
+
198
+ ### Function: recoverExcessStETH
134
199
135
200
Transfers the excess stETH amount (e.g. belonging to the burner contract address but not marked for burning)
136
201
to the Lido treasury address (the ` DAO Agent ` contract) set upon the contract construction.
137
202
138
- Does nothing if the ` getExcessStETH ` view func returns 0 (zero), e.g . there is no excess stETH
203
+ Does nothing if the ` getExcessStETH ` view func returns 0 (zero), i.e . there is no excess stETH
139
204
on the contract's balance.
140
205
141
206
``` sol
@@ -154,7 +219,7 @@ function recoverERC20(address _token, uint256 _amount) external
154
219
Reverts if any of the following is true:
155
220
* ` _amount ` value is 0 (zero);
156
221
* ` _token ` address is 0 (zero);
157
- * ` _token ` address is equal to the ` stETH ` address (use ` recoverExcessStETH ` instead).
222
+ * ` _token ` address equals to the ` stETH ` address (use ` recoverExcessStETH ` instead).
158
223
:::
159
224
160
225
#### Parameters:
@@ -166,18 +231,48 @@ Reverts if any of the following is true:
166
231
167
232
### Function: recoverERC721
168
233
169
- Transfers a given ERC721-compatible NFT (defined by the contract address) belonging to the burner contract address
170
- to the Lido treasury (the ` DAO Agent ` ) address.
234
+ Transfers a given ERC721-compatible NFT (defined by the contract address) belonging
235
+ to the burner contract address to the Lido treasury (the ` DAO Agent ` ) address.
171
236
172
237
``` sol
173
238
function recoverERC721(address _token, uint256 _tokenId) external
174
239
```
175
240
176
241
::: note
177
- Reverts if ` _token ` address is 0 (zero).
242
+ Reverts if any of the following is true:
243
+ * ` _token ` address is 0 (zero);
244
+ * ` _token ` address equals to the ` stETH ` address (use ` recoverExcessStETH ` instead).
178
245
:::
179
246
247
+ #### Parameters:
248
+
180
249
| Name | Type | Description |
181
250
| ---------- | --------- | ------------------------------------------- |
182
251
| ` _token ` | ` address ` | ERC721-compatible token address to recover |
183
252
| ` _tokenId ` | ` uint256 ` | Token id to recover |
253
+
254
+
255
+ ### Function: commitSharesToBurn
256
+
257
+ Marks previously requested to burn cover and non-cover share as burnt.
258
+ Emits ` StETHBurnt ` event for the cover and non-cover shares marked as burnt.
259
+
260
+ This function is called by the ` Lido ` contract right before performing the actual shares burning.
261
+
262
+ If ` _sharesToBurn ` is 0 does nothing.
263
+
264
+ ``` sol
265
+ function commitSharesToBurn(uint256 _sharesToBurn) external
266
+ ```
267
+
268
+ ::: note
269
+ Reverts if any of the following is true:
270
+ * ` msg.sender ` address is NOT equal to the ` stETH ` address;
271
+ * ` _sharesToBurn ` is greater than the cover plus non-cover shares requested to burn.
272
+ :::
273
+
274
+ #### Parameters:
275
+
276
+ | Name | Type | Description |
277
+ | --------------- | --------- | ------------------------------------------------------ |
278
+ | ` _sharesToBurn ` | ` uint256 ` | Amount of cover plus non-cover shares to mark as burnt |
0 commit comments