Skip to content

feat(target_chains/ethereum): implement TWAP calculation directly in Pyth contract #2611

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

Merged
merged 2 commits into from
Apr 24, 2025

Conversation

cctdaniel
Copy link
Contributor

@cctdaniel cctdaniel commented Apr 24, 2025

Summary

Migrated calculateTwap function from PythUtils.sol to Pyth.sol and removed the external dependency on PythUtils library. The function implementation remains identical but is now directly part of the Pyth contract.

Rationale

  • Reduces external dependencies by internalizing the TWAP calculation logic
  • Simplifies deployment process by removing need to deploy and link the PythUtils library

How has this been tested?

  • Current tests cover my changes
    • The existing test suite covers TWAP calculation functionality
    • No behavioral changes were made to the code, only moved location
  • Added new tests
    • Not needed as functionality remains unchanged
  • Manually tested the code
    • Verified the function signature and implementation match exactly
    • Confirmed removal of PythUtils import and dependency

The changes are purely organizational - moving code from an external library to the main contract without modifying the implementation. All existing tests that exercise TWAP functionality will continue to work as before since the calculation logic remains identical.

Copy link

vercel bot commented Apr 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 24, 2025 4:00am
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 4:00am
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 4:00am
insights ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 4:00am
proposals ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 4:00am
staking ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 4:00am

@cctdaniel cctdaniel changed the title feat(pyth): implement TWAP calculation directly in Pyth contract feat(target_chains/evm): implement TWAP calculation directly in Pyth contract Apr 24, 2025
@cctdaniel cctdaniel changed the title feat(target_chains/evm): implement TWAP calculation directly in Pyth contract feat(target_chains/ethereum): implement TWAP calculation directly in Pyth contract Apr 24, 2025
@cctdaniel cctdaniel merged commit 05cdc67 into main Apr 24, 2025
10 checks passed
@cctdaniel cctdaniel deleted the migrate-evm-twap branch April 24, 2025 07:09
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