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

Math Library for Combining Pyth Prices on Solidity #1719

Closed
wants to merge 3 commits into from

Conversation

holps-7
Copy link

@holps-7 holps-7 commented Jun 21, 2024

Description
This is an implementation to replicate the Math library from Solana that can combine 2 Pyth Prices into 1 (SOL:USD/ETH:USD=SOL/ETH)

Functions replicated in Solidity for Ethereum's combine library

  • getPriceInQuote

  • div

  • normalize

    • price and confidence are normalized to be between MIN_PD_V_I64 and MAX_PD_V_I64.
  • scaleToExponent

  • toUnsigned

    • Helper function to convert signed integers to unsigned and a sign bit, which simplifies some of the computations above.
  • Added additional check to Return 0 values instead of throwing error so that it can be handled gracefully by the caller

Copy link

vercel bot commented Jun 21, 2024

@holps-7 is attempting to deploy a commit to the pyth-web Team on Vercel.

A member of the Team first needs to authorize it.

@ali-bahjati ali-bahjati requested a review from jayantk June 21, 2024 11:12
@ali-bahjati
Copy link
Collaborator

We have decided to move forward with #1746

@ali-bahjati ali-bahjati closed this Aug 6, 2024
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