-
Notifications
You must be signed in to change notification settings - Fork 298
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
Introduce OnNewTokenAccount
and OnKilledTokenAccount
Callbacks
#754
Introduce OnNewTokenAccount
and OnKilledTokenAccount
Callbacks
#754
Conversation
Aside: I was confused I had to include the changes in 34f50fc as they did not seem to have anything to do with this PR. Broken |
Update your Cargo.toml. That's due to bumping Substrate version |
traits/src/currency.rs
Outdated
@@ -643,6 +643,24 @@ impl<AccountId, CurrencyId, Balance> OnDust<AccountId, CurrencyId, Balance> for | |||
fn on_dust(_: &AccountId, _: CurrencyId, _: Balance) {} | |||
} | |||
|
|||
/// Handler for a newly created account | |||
pub trait OnNewTokenAccount<AccountId, CurrencyId> { |
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 don't really like the idea of bunch different traits for each individual purposes.
I think we can just reuse Happened<(&AccountId, CurrencyId)>
instead.
Otherwise we can have trait OnAccountUpdated { fn updated }
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.
Have a look. Not sure how I would get around the who.clone()
induced by the change to Happened
can you revert the |
This reverts commit 34f50fc.
…le-library into apopiak/on-new-account
CI failed, Blocked: paritytech/substrate#11608 |
@apopiak please merge master to fix the CI. |
…le-library into apopiak/on-new-account
…ime-module-library into apopiak/on-new-account
It would be useful for some features to be able to react to account creation in the tokens pallet that includes the currency for which an account was created.
This PR thus introduces an
OnNewTokenAccount
(and correspondingOnKilledTokenAccount
) callback to the pallet for other pallets to integrate with.