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

Use previewPoints on contract to compute APY #390

Merged
merged 3 commits into from
Jul 6, 2023

Conversation

shahthepro
Copy link
Collaborator

  • Gets the veOGVReceived from contract (Fixes Unexpected veOGV amount #342)
  • Fixes under-reporting of APY calculation (Need someone to verify the APY)

@rafaelugolini rafaelugolini temporarily deployed to ousd-governa-shah-fix-a-7ftqtf July 5, 2023 19:58 Inactive
useEffect(() => {
if (!contracts.loaded) return;

let done = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not familiar with this pattern for how you are using done, what are you trying to solve? Just running the go function once?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just defensive programming. go is an async function. It's possible that the component might rerender before the function completes execution. If it does, then setState will throw a bunch of console errors because it's trying to update state of a detached component. When the component demounts, done is set to true and the state isn't updated in that case

Copy link
Member

@sparrowDom sparrowDom left a comment

Choose a reason for hiding this comment

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

great job at simplifying it and making it correct 💪

client/pages/claim.tsx Show resolved Hide resolved
@rafaelugolini rafaelugolini temporarily deployed to ousd-governa-shah-fix-a-nr9d26 July 6, 2023 06:43 Inactive
@micahalcorn micahalcorn removed their request for review July 6, 2023 06:46
@shahthepro shahthepro merged commit 58faa97 into master Jul 6, 2023
3 checks passed
@shahthepro shahthepro deleted the shah/fix-apy-calc-everywhere branch July 6, 2023 06:49
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.

Unexpected veOGV amount
4 participants