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

feat: twap-like function for balance #1

Merged
merged 11 commits into from
Sep 17, 2024
Merged

feat: twap-like function for balance #1

merged 11 commits into from
Sep 17, 2024

Conversation

heswithme
Copy link
Collaborator

Pull Request Summary

  • Pre-commit & Formatting: Updated .pre-commit-config.yaml and pyproject.toml to use a 120 character line width.
  • New Contract: Added contracts/TWAP.vy for time-weighted rate tracking using trapezoidal interpolation.
  • RewardsHandler Update: Adjusted contracts/RewardsHandler.vy to integrate time-weighted rate calculations.
  • Tests: Added tests/unitary/test_twap.py to validate the TWAP functionality and correctness.

@AlbertoCentonze AlbertoCentonze changed the title twap.vy feat: twap-like function for balance Sep 16, 2024
Copy link
Collaborator

@AlbertoCentonze AlbertoCentonze left a comment

Choose a reason for hiding this comment

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

Nice job!

We need to find a better name for this, since as we discussed, we're not talking about price. Maybe TWAB?

You're missing a mamushi format pass! Don't format there's a bug with 0.3.10 files.

Regarding the organisation of unit tests what I like to do is (will document this later):

  • one folder per contract/module (i.e. RewardsHandler.vy goes into tests/unitary/rewards_handler
  • in the folder, one file per function, both internal and externals (i.e. tests/unitary/rewards_handler/test_<function_name>)
  • one test per branch (happy path is called test_default_behavior)

.flake8 Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
contracts/TWAP.vy Outdated Show resolved Hide resolved
contracts/TWAP.vy Outdated Show resolved Hide resolved
contracts/TWAP.vy Outdated Show resolved Hide resolved
contracts/TWAP.vy Outdated Show resolved Hide resolved
contracts/TWAP.vy Outdated Show resolved Hide resolved
@AlbertoCentonze AlbertoCentonze merged commit 141c3da into main Sep 17, 2024
1 check passed
@AlbertoCentonze AlbertoCentonze deleted the twap-sketch branch September 17, 2024 11:57
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