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

View methods to preview rewards #23

Merged
merged 3 commits into from
Dec 4, 2024
Merged

View methods to preview rewards #23

merged 3 commits into from
Dec 4, 2024

Conversation

aalavandhan
Copy link
Member

@aalavandhan aalavandhan commented Nov 28, 2024

  • Remove the reward calculation logic from update accounting
  • Added a separate previewRewards view method
  • Added method to view unlock time schedule

@aalavandhan aalavandhan force-pushed the preview-methods branch 5 times, most recently from e4c5634 to 05cdd60 Compare December 2, 2024 18:52
@aalavandhan aalavandhan force-pushed the preview-methods branch 2 times, most recently from c6af76d to 2f6e2b2 Compare December 2, 2024 19:03
@aalavandhan aalavandhan changed the title Removed reward calc from critical path and moved to a view method View methods to preview rewards Dec 2, 2024
* @return Updated amount of distribution tokens to award, with any bonus included on the
* newly added tokens.
*/
function computeNewReward(
uint256 currentRewardTokens,
uint256 stakingShareSeconds,
uint256 stakeTimeSec
uint256 totalStakingShareSeconds_,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to send this in, when there's already a contract variable for it we could read from?

I assume it's to support hypothetical queries from the front end. Just want to make sure there's a use case for it, since it's a bit of a code smell to have this copied / naming conflict / etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to send this in when we run the preview. Because, totalStakingShareSeconds wouldn't have yet been committed on-chain.

@aalavandhan aalavandhan merged commit f5c6145 into master Dec 4, 2024
1 check passed
@aalavandhan aalavandhan deleted the preview-methods branch December 4, 2024 19:19
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

Successfully merging this pull request may close these issues.

2 participants