Skip to content

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.

@vercel
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.

3 participants