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

Update price feed structure + cascade changes #77

Merged
merged 9 commits into from
Oct 17, 2022

Conversation

ali-bahjati
Copy link
Collaborator

@ali-bahjati ali-bahjati commented Oct 10, 2022

This PR updates the PriceFeed struct to be like so:

pub struct PriceFeed {
    pub id:    PriceIdentifier,
    price:     Price,
    ema_price: Price,
}

and changes the Price to include publish_time:

pub struct Price {
    pub price:        i64,
    pub conf:         u64,
    pub expo:         i32,
    pub publish_time: UnixTimestamp,
}

All of the utility functions for Price that have multiple prices (like mul) will return the minimum publish time as the resulting publish time.

The rest of the changes are fixing its downstream dependencies, removing old tests for staleness checks, and adding new tests for the new PriceAccount to PriceFeed conversion.

jayantk
jayantk previously approved these changes Oct 10, 2022
jayantk
jayantk previously approved these changes Oct 10, 2022
jayantk
jayantk previously approved these changes Oct 10, 2022
Copy link
Contributor

@tompntn tompntn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

examples/cw-contract/src/contract.rs Show resolved Hide resolved
pyth-sdk/schema/price_feed.json Outdated Show resolved Hide resolved
pyth-sdk/schema/price_feed.json Outdated Show resolved Hide resolved
pyth-sdk-solana/examples/get_accounts.rs Show resolved Hide resolved
pyth-sdk-solana/src/state.rs Outdated Show resolved Hide resolved
pyth-sdk/src/price.rs Outdated Show resolved Hide resolved
pyth-sdk/src/price.rs Show resolved Hide resolved
tompntn
tompntn previously approved these changes Oct 14, 2022
jayantk
jayantk previously approved these changes Oct 14, 2022
Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. please merge this before addressing the minor comment -- it's a small thing and that will make this easier to review.

pyth-sdk/src/lib.rs Outdated Show resolved Hide resolved
@ali-bahjati ali-bahjati dismissed stale reviews from jayantk and tompntn via db98bef October 14, 2022 23:06
@ali-bahjati ali-bahjati merged commit 4f4f8c7 into main Oct 17, 2022
@ali-bahjati ali-bahjati deleted the abehjati/update-price-feed-structure branch October 17, 2022 14:32
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

3 participants