Skip to content

Commit

Permalink
Merge pull request #127 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Jeday authored Apr 24, 2024
2 parents 6deda7d + a30880e commit cf258cd
Show file tree
Hide file tree
Showing 23 changed files with 1,008 additions and 2,225 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import { LidoSDK } from '@lidofinance/lido-ethereum-sdk';
import { LidoSDKStake } from '@lidofinance/lido-ethereum-sdk/stake';
```

✨ See also the [examples](./examples/Examples.md) provided for some more real-life applications.

## Initialization

Before using the SDK, you need to create an instance of the LidoSDK class:
Expand Down
19 changes: 19 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Examples

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](https://docs.lido.fi/contracts/lido/#rebase). For some complicated scenarios of using collective accounts for multiples users (might be applicable for CEXes and custodian services), see the suggested [reward attribution](https://hackmd.io/@lido/rewards-attribution) approaches.

### Basic rebase tracking

- [Example 1. Subscribe on the stETH token rebase events to track rewards updates](rewards/README.md#subscribe-on-the-steth-token-rebase-events-to-track-reward-updates)
- [Example 2. Get rewards accrued with the latest stETH token rebase for the chosen account](rewards/README.md#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)](rewards/README.mdretrieve-reward-history-for-the-particular-account-using-the-event-logs-recommended)
- [Example 4. Retrieve reward history for the chosen account using the Subgraph indexer (alternative way)](rewards/README.md#retrieve-reward-history-for-the-particular-account-using-the-subgraph-indexer-alternative-way)
- [Example 5. Calculate the effective APR for the chosen account concerning the given period](rewards/README.md#calculate-the-effective-apr-for-the-chosen-account-concerning-the-given-period)
- [Example 6. Keep track of rewards accrued for the set of accounts](rewards/README.md#keep-track-of-rewards-accrued-for-the-set-of-accounts)
4 changes: 4 additions & 0 deletions examples/rewards/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
48 changes: 48 additions & 0 deletions examples/rewards/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yalc
yalc.lock
tsconfig.tsbuildinfo

# playwright
/test-results/
/playwright-report/
/playwright/.cache/

# testing
/coverage

# generated
/generated

# next.js
/.next/
/out/

# production
/build
/dist

# misc
.DS_Store

# env
.env
.env.local
.env.production
.env.development

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

#ide
.vscode
.idea

/public/runtime/
Loading

0 comments on commit cf258cd

Please sign in to comment.