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

Parse pyth benchmark prices aptos #1750

Closed

Conversation

lopeselio
Copy link

Pyth Module

Overview

The Pyth module provides functionality for parsing and validating price feeds from VAA (Verifiable Authenticated Account) data. This module ensures that the price feeds are within a specified publish time range and that all requested price IDs have corresponding valid updates.

Functions

1. parse_and_validate_price_feeds

Parses and validates price feeds within the specified publish time range.

Parameters:

  • price_infos: &vector<price_info::PriceInfo>
  • requested_price_ids: vector<vector>
  • min_publish_time: u64
  • max_publish_time: u64

Returns:

  • vector<price_feed::PriceFeed>

2. parse_price_feed_updates_from_vaa

Parses a single VAA and returns a vector of price feeds within the specified publish time range.

Parameters:

  • vaa: vector
  • requested_price_ids: vector<vector>
  • min_publish_time: u64
  • max_publish_time: u64

Returns:

  • vector<price_feed::PriceFeed>

3. parse_price_feed_updates

Public function to parse multiple price feed updates from VAA data.

Parameters:

  • update_data: vector<vector>
  • requested_price_ids: vector<vector>
  • min_publish_time: u64
  • max_publish_time: u64
  • fee: Coin

Returns:

  • vector<price_feed::PriceFeed>

Aptos Move Compile

image

Example Usage

// Example usage of the parse_price_feed_updates function
let update_data = vector[/* VAA data */];
let requested_price_ids = vector[/* price IDs */];
let min_publish_time: u64 = /* minimum publish time */;
let max_publish_time: u64 = /* maximum publish time */;
let fee = /* fee in AptosCoin */;

let valid_price_feeds = pyth::parse_price_feed_updates(
    update_data, requested_price_ids, min_publish_time, max_publish_time, fee
);

Copy link

vercel bot commented Jun 30, 2024

@lopeselio 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
Copy link
Collaborator

ali-bahjati commented Aug 6, 2024

We have decided to move forward with #1727

@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