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

add validate_core_asset fn #28

Merged
merged 9 commits into from
Oct 30, 2024
Merged

add validate_core_asset fn #28

merged 9 commits into from
Oct 30, 2024

Conversation

samuelvanderwaal
Copy link
Contributor

No description provided.

@samuelvanderwaal samuelvanderwaal marked this pull request as ready for review October 28, 2024 18:51
let (mut royalties, collection) =
if let UpdateAuthority::Collection(asset_collection) = asset.update_authority {
// Collection account must be provided.
if maybe_collection_info.is_none() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: could be cleaner with a match on maybe_collection_info

royalty_fee_bps,
royalty_enforced: true,
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

So this will replace validate_asset right? If so, remember to remove validate_asset from all uses + toolbox goforward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I've removed it from toolbox now and have it removed from AMM in an open PR.

royalty_enforced: true,
})
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the biggest difference that this now:

  1. Validates maybe_collection_info always
  2. Extracts whitelist_creators + royalty_fee_bps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main differences are 1) it fetches the verified creators plugin in addition to royalties and 2) returns the data more generically so it can be used for both royalty and whitelist validation purposes.

The checks are the same:

  • asset is owned by mpl-core
  • asset is valid AssetV1
  • if collection is passed in it's owned by mpl-core and is a valid CollectionV1
  • collection on the asset, must match passed in collection, if present on the asset

I'll add more explicit account type checks for good measure.

@samuelvanderwaal samuelvanderwaal merged commit 480ec1b into main Oct 30, 2024
1 check passed
@samuelvanderwaal samuelvanderwaal deleted the feat/validate-asset branch October 30, 2024 01:22
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