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

[pyth_oracle] Allow add_product to create product metadata #332

Merged
merged 8 commits into from
Jan 31, 2023

Conversation

guibescos
Copy link
Contributor

@guibescos guibescos commented Jan 24, 2023

Right now creating a product and adding metadata requires add_product and upd_product. This PR aims to allow initializing the metadata when you call add_product.
It is backwards compatible. If you call add_product the old way, the program will see that as empty metadata so the behavior will be the same as previously.

This PR is meant to enable some deterministic keys for product accounts in the future.

@guibescos guibescos changed the title Guibescos/refactor [pyth_oracle] Allow add_product to create product metadata Jan 30, 2023
@guibescos guibescos marked this pull request as ready for review January 30, 2023 20:03
@guibescos guibescos force-pushed the guibescos/refactor branch 2 times, most recently from 18dea3f to 5698c78 Compare January 31, 2023 02:31
jayantk
jayantk previously approved these changes Jan 31, 2023
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.

nice

@@ -83,5 +84,7 @@ pub fn add_product(
)? + mapping_data.number_of_products
* try_convert::<_, u32>(size_of::<Pubkey>())?;

update_product_metadata(instruction_data, new_product_account, hdr.version)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Document the instruction data format in the doc comment for this function.

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