-
Notifications
You must be signed in to change notification settings - Fork 41
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
Address returnsGenerated being incorrect & add tests #119
Conversation
…ty by running yarn upgrade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsamuels453 Great job!!! Ben! Thank you very much for your contribution. I left some comments/questions.
@@ -1,4 +1,4 @@ | |||
#!/bin/sh | |||
. "$(dirname "$0")/_/husky.sh" | |||
|
|||
yarn lint:fix && git add -A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn lint:fix is still there; I removed git add -A because it kept including files in each commit that I did not want to commit yet. I kept running into issues where I would stage 1 or 2 files for commit, git commit them, then the commit includes every change that was in my working directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @bsamuels453 !!! Thanks for your contribution.
This PR fixes the issue reported here, and validates the fix using the new test suite. I can split the fix and tests into multiple PRs if needed.
The commit for the fix can be viewed here
This fix works by adding a balanceTokens field to VaultUpdate. This field reports on the balance of tokens managed by the Vault at the time of the update and is populated by vault.totalAssets();
The returnsGenerated field of VaultUpdate is now populated by comparing the balanceTokens of the previous update to the new balanceTokens. When taking token deposits and withdrawls into account, the difference between the balanceTokens of each update is a reliable proxy for recognized profit the vault has earned.
In addition, the logic for setting vault.latestUpdate, vault.balanceTokens, and vault.balanceTokensIdle has been moved to the createVaultUpdate function (previously this logic was duplicated in two separate spots).