Add OnAssetCreated and OnAssetDestroyed hook#32
Merged
ParthDesai merged 3 commits intomainfrom Mar 19, 2024
Merged
Conversation
girazoki
reviewed
Mar 15, 2024
| AssetIdToForeignAsset::<T>::insert(&asset_id, &foreign_asset); | ||
| ForeignAssetToAssetId::<T>::insert(&foreign_asset, &asset_id); | ||
|
|
||
| T::OnForeignAssetCreated::on_asset_created(&foreign_asset, &asset_id, &min_balance); |
Collaborator
There was a problem hiding this comment.
I dont see a reason why we would need the min_balance here, I guess we can leave it out for now
Contributor
Author
There was a problem hiding this comment.
My idea was to make it general purpose. If particular kind of hook does not require min_balance, it can just ignore, I guess.
Collaborator
There was a problem hiding this comment.
I think we can make that more generic in the future if we would like, but I guess it's ok if we leave it as well
girazoki
reviewed
Mar 15, 2024
| } | ||
|
|
||
| /// Test hook that records the hook invocation with exact params | ||
| pub struct NoteDownHook<ForeignAsset, AssetId, AssetBalance>( |
girazoki
reviewed
Mar 15, 2024
girazoki
approved these changes
Mar 15, 2024
Collaborator
|
Probably we want @RomarQ or @librelois to rview |
7071c9a to
625a5fb
Compare
RomarQ
reviewed
Mar 19, 2024
RomarQ
reviewed
Mar 19, 2024
RomarQ
reviewed
Mar 19, 2024
RomarQ
reviewed
Mar 19, 2024
RomarQ
approved these changes
Mar 19, 2024
Contributor
RomarQ
left a comment
There was a problem hiding this comment.
Added a few comments for renaming Multilocation toLocation, apart from that, the PR looks good 👍
RomarQ
approved these changes
Mar 19, 2024
ParthDesai
added a commit
to moondance-labs/moonkit
that referenced
this pull request
Mar 19, 2024
* add OnAssetCreated and OnAssetDestroyed hook * no-op implementation of ForeignAssetCreatedHook and ForeignAssetDestroyedHook for () * replace MultiLocation with Location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
OnForeignAssetCreatedandOnForeignAssetDestroyedhook in foreign asset creator pallet which allows adding hooks during runtime construction to be called when a foreign asset is created or destroyed.I have modified tests to add checks to make sure hook is invoked with right parameters.