Skip to content

Commit 9f466af

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

File tree

1 file changed

+108
-24
lines changed

1 file changed

+108
-24
lines changed

docs/contracts/burner.md

Lines changed: 108 additions & 24 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,42 +103,93 @@ 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
107+
```
108+
109+
:::note
110+
Reverts if any of the following is true:
111+
* `msg.sender` is not a holder of `REQUEST_BURN_MY_STETH_ROLE` role;
112+
* no stETH provided (`_stETHAmountToBurn == 0`);
113+
* no stETH transferred (allowance exceeded).
114+
:::
115+
116+
#### Parameters:
117+
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` which after Lido V2 upgrade is either
128+
* `Lido` contract (this contract actually burns shares accumulated on the `Burner` contract upon `AccountingOracle` report)
129+
* or `NodeOperatorsRegistry` contract (needed for penalizing node operators rewards).
130+
131+
```sol
132+
function requestBurnSharesForCover(address _from, uint256 _sharesAmountToBurn)
99133
```
100134

101135
:::note
102136
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`);
137+
* `msg.sender` is not a holder of `REQUEST_BURN_SHARES_ROLE` role;
138+
* no stETH provided (`_stETHAmountToBurn == 0`);
105139
* no stETH transferred (allowance exceeded).
106140
:::
107141

108142
#### Parameters:
109143

110-
| Name | Type | Description |
111-
| ------------- | --------- | ----------------------------------------------- |
112-
| `_stETH2Burn` | `uint256` | stETH tokens amount (not shares amount) to burn |
144+
| Name | Type | Description |
145+
| -------------------- | --------- | ----------------------------------------------- |
146+
| `_from` | `address` | address to transfer shares from |
147+
| `_stETHAmountToBurn` | `uint256` | shares amount (not stETH tokens amount) to burn |
113148

114149
### Function: requestBurnMyStETH
115150

116151
Transfers stETH tokens from the message sender and irreversibly locks these on the burner contract address.
117152
Internally converts tokens amount into underlying shares amount and marks the converted amount for
118153
non-cover-backed burning by increasing the internal `nonCoverSharesBurnRequested` counter.
119154

155+
```sol
156+
function requestBurnMyStETH(uint256 _stETHAmountToBurn) external
157+
```
158+
120159
:::note
121160
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`);
161+
* `msg.sender` is not a holder of `REQUEST_BURN_MY_STETH_ROLE` role;
162+
* no stETH provided (`_stETHAmountToBurn == 0`);
124163
* no stETH transferred (allowance exceeded).
125164
:::
126165

127166
#### Parameters:
128167

129-
| Name | Type | Description |
130-
| ------------- | --------- | ----------------------------------------------- |
131-
| `_stETH2Burn` | `uint256` | stETH tokens amount (not shares amount) to burn |
168+
| Name | Type | Description |
169+
| -------------------- | --------- | ----------------------------------------------- |
170+
| `_stETHAmountToBurn` | `uint256` | stETH tokens amount (not shares amount) to burn |
171+
172+
### Function: requestBurnShares
173+
174+
Transfers stETH shares from `_from` and irreversibly locks these on the burner contract address.
175+
Internally marks the shares amount for non-cover backed burning by increasing the internal `nonCoverSharesBurnRequested` counter.
132176

133-
### function recoverExcessStETH
177+
Can be called only by a holder of `REQUEST_BURN_SHARES_ROLE` which after Lido V2 upgrade is either
178+
* `Lido` contract (this contract actually burns shares accumulated on the `Burner` contract upon `AccountingOracle` report)
179+
* or `NodeOperatorsRegistry` contract (needed for penalizing node operators rewards).
180+
181+
```sol
182+
function requestBurnShares(address _from, uint256 _sharesAmountToBurn)
183+
```
184+
185+
:::note
186+
Reverts if any of the following is true:
187+
* `msg.sender` is not a holder of `REQUEST_BURN_SHARES_ROLE` role;
188+
* no stETH provided (`_stETHAmountToBurn == 0`);
189+
* no stETH transferred (allowance exceeded).
190+
:::
191+
192+
### Function: recoverExcessStETH
134193

135194
Transfers the excess stETH amount (e.g. belonging to the burner contract address but not marked for burning)
136195
to the Lido treasury address (the `DAO Agent` contract) set upon the contract construction.
@@ -154,7 +213,7 @@ function recoverERC20(address _token, uint256 _amount) external
154213
Reverts if any of the following is true:
155214
* `_amount` value is 0 (zero);
156215
* `_token` address is 0 (zero);
157-
* `_token` address is equal to the `stETH` address (use `recoverExcessStETH` instead).
216+
* `_token` address equals to the `stETH` address (use `recoverExcessStETH` instead).
158217
:::
159218

160219
#### Parameters:
@@ -166,18 +225,43 @@ Reverts if any of the following is true:
166225

167226
### Function: recoverERC721
168227

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.
228+
Transfers a given ERC721-compatible NFT (defined by the contract address) belonging
229+
to the burner contract address to the Lido treasury (the `DAO Agent`) address.
171230

172231
```sol
173232
function recoverERC721(address _token, uint256 _tokenId) external
174233
```
175234

176235
:::note
177-
Reverts if `_token` address is 0 (zero).
236+
Reverts if any of the following is true:
237+
* `_token` address is 0 (zero);
238+
* `_token` address equals to the `stETH` address (use `recoverExcessStETH` instead).
178239
:::
179240

180241
| Name | Type | Description |
181242
| ---------- | --------- | ------------------------------------------- |
182243
| `_token` | `address` | ERC721-compatible token address to recover |
183244
| `_tokenId` | `uint256` | Token id to recover |
245+
246+
247+
### Function: commitSharesToBurn
248+
249+
Marks previously requested to burn cover and non-cover share as burnt.
250+
Emits `StETHBurnt` event for the cover and non-cover shared marked as burnt.
251+
This function is called by the `Lido` contract right before performing the actual shares burning.
252+
253+
If `_sharesToBurn` is 0 does nothing.
254+
255+
```sol
256+
function commitSharesToBurn(uint256 _sharesToBurn) external
257+
```
258+
259+
:::note
260+
Reverts if any of the following is true:
261+
* `msg.sender` address is NOT equal to the `stETH` address
262+
* `_sharesToBurn` is greater than the cover and non-cover shares requested to burn
263+
:::
264+
265+
| Name | Type | Description |
266+
| --------------- | --------- | ------------------------------------------------------ |
267+
| `_sharesToBurn` | `uint256` | Amount of cover plus non-cover shares to mark as burnt |

0 commit comments

Comments
 (0)