-
Notifications
You must be signed in to change notification settings - Fork 12
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 OnAssetCreated
and OnAssetDestroyed
hook
#32
Conversation
@@ -152,6 +176,8 @@ pub mod pallet { | |||
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see a reason why we would need the min_balance here, I guess we can leave it out for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea was to make it general purpose. If particular kind of hook does not require min_balance
, it can just ignore, I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
} | ||
|
||
/// Test hook that records the hook invocation with exact params | ||
pub struct NoteDownHook<ForeignAsset, AssetId, AssetBalance>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Probably we want @RomarQ or @librelois to rview |
7071c9a
to
625a5fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments for renaming Multilocation
toLocation
, apart from that, the PR looks good 👍
* add OnAssetCreated and OnAssetDestroyed hook * no-op implementation of ForeignAssetCreatedHook and ForeignAssetDestroyedHook for () * replace MultiLocation with Location
Description
This PR adds
OnForeignAssetCreated
andOnForeignAssetDestroyed
hook 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.