Skip to content

Commit bcdd8ec

Browse files
committed
feat: update Burner docs after V2 upgrade
1 parent 3c9bc50 commit bcdd8ec

File tree

1 file changed

+121
-26
lines changed

1 file changed

+121
-26
lines changed

docs/contracts/burner.md

Lines changed: 121 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ user balance using the following equation:
1111
`balanceOf(account) = shares[account] * totalPooledEther / totalShares`.
1212
Therefore, burning shares (e.g. decreasing the `totalShares` amount) increases stETH holders' balances.
1313

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.
1515
`Burner` provides a safe and deterministic way to incur a positive stETH token rebase by gradually
1616
decreasing `totalShares` that can be correctly handled by 3rd party protocols integrated with stETH.
1717

18-
`Burner` accepts burning requests by the following two ways:
18+
`Burner` accepts burning requests in the following two ways:
1919

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;
2121
- Locking caller-provided stETH tokens.
2222

2323
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
2525
additional fluctuations of the existing stETH token rebase period (~24h).
2626

2727
We also distinguish two types of shares burn requests:
@@ -30,13 +30,13 @@ between the two consecutive oracle reports);
3030
* request to burn shares for any other cases (**non-cover**).
3131

3232
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
3434
own balance only.
3535

3636
## Shares burnt counters
3737

3838
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.
4040
These counters are increased when actual stETH burn is performed as part of the Lido Oracle report.
4141

4242
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.
7878
function getNonCoverSharesBurnt() external view returns (uint256)
7979
```
8080

81-
### function getExcessStETH
81+
### Function: getExcessStETH
8282

8383
Returns the stETH amount belonging to the burner contract address but not marked for burning.
8484

8585
```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)
8795
```
8896

8997
## Methods
@@ -95,47 +103,104 @@ Internally converts tokens amount into underlying shares amount and marks the co
95103
for cover-backed burning by increasing the internal `coverSharesBurnRequested` counter.
96104

97105
```sol
98-
function requestBurnMyStETHForCover(uint256 _stETH2Burn) external
106+
function requestBurnMyStETHForCover(uint256 _stETHAmountToBurn) external
99107
```
100108

101109
:::note
102110
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`);
105113
* no stETH transferred (allowance exceeded).
106114
:::
107115

108116
#### Parameters:
109117

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 |
113146

114147
### Function: requestBurnMyStETH
115148

116149
Transfers stETH tokens from the message sender and irreversibly locks these on the burner contract address.
117150
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+
```
119156

120157
:::note
121158
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`);
124161
* no stETH transferred (allowance exceeded).
125162
:::
126163

127164
#### Parameters:
128165

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 |
132169

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
134199

135200
Transfers the excess stETH amount (e.g. belonging to the burner contract address but not marked for burning)
136201
to the Lido treasury address (the `DAO Agent` contract) set upon the contract construction.
137202

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
139204
on the contract's balance.
140205

141206
```sol
@@ -154,7 +219,7 @@ function recoverERC20(address _token, uint256 _amount) external
154219
Reverts if any of the following is true:
155220
* `_amount` value is 0 (zero);
156221
* `_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).
158223
:::
159224

160225
#### Parameters:
@@ -166,18 +231,48 @@ Reverts if any of the following is true:
166231

167232
### Function: recoverERC721
168233

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.
171236

172237
```sol
173238
function recoverERC721(address _token, uint256 _tokenId) external
174239
```
175240

176241
:::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).
178245
:::
179246

247+
#### Parameters:
248+
180249
| Name | Type | Description |
181250
| ---------- | --------- | ------------------------------------------- |
182251
| `_token` | `address` | ERC721-compatible token address to recover |
183252
| `_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

Comments
 (0)