Skip to content

Conversation

@ali-behjati
Copy link
Collaborator

@ali-behjati ali-behjati 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!

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.

@ali-behjati ali-behjati dismissed stale reviews from jayantk and tompntn via db98bef October 14, 2022 23:06
@ali-behjati ali-behjati merged commit 4f4f8c7 into main Oct 17, 2022
@ali-behjati ali-behjati 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.

4 participants