Skip to content

Simplistic trait #232

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

Merged
merged 6 commits into from
Aug 9, 2022
Merged

Simplistic trait #232

merged 6 commits into from
Aug 9, 2022

Conversation

guibescos
Copy link
Contributor

@guibescos guibescos commented Aug 9, 2022

PythStruct trait that basically binds some constants to each type of Pyth account.
Now functions that interact with all 3 of Pyth accounts can use the trait.
I turned load_mapping_account_mut and load_mapping_product_mut into load_checked<T: PythStruct>
and equally initialize_mapping_account and initialize_product_account into initialize_checked<T:PythStruct>

In the future, these functions should also perform the other checks (signatures, rent, program ownership). But I'm doing it incrementally.

@guibescos guibescos marked this pull request as ready for review August 9, 2022 16:04
jayantk
jayantk previously approved these changes Aug 9, 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.

nice!

@guibescos guibescos merged commit 13ba56f into main Aug 9, 2022
@guibescos guibescos deleted the traits2 branch August 9, 2022 19:02
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.

3 participants