Introduction
SDK usage examples for various practical cases.
stETH rewards accounting
The provided examples are useful to establish robust accounting for the stETH rebaseable token, learn more about stETH rebases. For some complicated scenarios of using collective accounts for multiples users (might be applicable for CEXes and custodian services), see the suggested reward attribution approaches.
Basic rebase tracking
- Example 1. Subscribe on the stETH token rebase events to track rewards updates
- Example 2. Get rewards accrued with the latest stETH token rebase for the chosen account
Reward history
- Example 3. Retrieve reward history for the chosen account using the event logs (recommended)
- Example 4. Retrieve reward history for the chosen account using the Subgraph indexer (alternative way)
- Example 5. Calculate the effective APR for the chosen account concerning the given period
- Example 6. Keep track of rewards accrued for the set of accounts