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

Create a Math Library to Combine Pyth Prices in Solidity #1722

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Ayushjhax
Copy link

As of today, only developers using Pyth in Rust language can easily combine 2 Pyth Prices into 1 (SOL:USD/ETH:USD=SOL/ETH).

The goal of this pull request is to create a Math Library in Solidity to combine Pyth prices. This library will provide the necessary functions to perform operations on Pyth prices, such as:

getPriceInQuote: Calculates the price of an asset in a different quote currency.
getBorrowValuationPrice: Calculates the valuation of a collateral position.
getPriceInQuoteNoOld: Calculates the price of an asset in a different quote currency, ensuring the result is not older than the specified age.
getBorrowValuationPriceNoOld: Calculates the valuation of a collateral position, ensuring the result is not older than the specified age.

The implementation of this Math Library is inspired by the Rust-based Pyth SDK, ensuring compatibility between the two implementations.

This pull request will allow Solidity developers to easily combine Pyth prices, expanding the use of the Pyth Network in the Ethereum ecosystem.

The PythUtils library was updated to support the int256 price type instead of int64. This change ensures that the library can handle larger price values accurately.
Copy link

vercel bot commented Jun 21, 2024

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

A member of the Team first needs to authorize it.

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.

None yet

1 participant