Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added real-time staking rewards estimation and transaction simulation #195

Open
MKVEERENDRA opened this issue Feb 10, 2025 · 0 comments
Open

Comments

@MKVEERENDRA
Copy link

1. Real-Time Staking Rewards Estimation
This feature enables users to estimate their staking rewards by fetching the current APR from the Lido protocol's StakingRouter contract and calculating future rewards based on their balance and time period. It also retrieves historical reward distributions via Lido's subgraph API.

Key Components
getCurrentAPR : Fetches the APR using getStakingFeeAggregateDistributionE4Precision from the StakingRouter contract.
estimateRewards : Estimates rewards based on the user's stETH or wstETH balance and a specified time period.
getHistoricalRewards : Queries Lido's subgraph API to fetch past reward distributions for a given account.
Impact
This feature enhances the SDK by providing users with actionable insights into their staking performance, ensuring compatibility with the latest Lido protocol updates.

2. Transaction Simulation
This feature allows users to simulate transactions before executing them on-chain. It uses callStatic to validate transaction success and estimateGas to calculate gas usage without broadcasting the transaction.

Key Components
simulateTransaction : Simulates a transaction by calling its sendTransaction function with callStatic and estimates gas usage using estimateGas.
Impact
By simulating transactions, users can avoid failed transactions and wasted gas fees, improving the reliability and cost-effectiveness of their interactions with the Lido protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant