Create a Math Library to Combine Pyth Prices in Solidity #1722
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.