Skip to content

Introduce OnNewTokenAccount and OnKilledTokenAccount Callbacks#754

Merged
shaunxw merged 12 commits into
open-web3-stack:masterfrom
apopiak:apopiak/on-new-account
Jun 7, 2022
Merged

Introduce OnNewTokenAccount and OnKilledTokenAccount Callbacks#754
shaunxw merged 12 commits into
open-web3-stack:masterfrom
apopiak:apopiak/on-new-account

Conversation

@apopiak

@apopiak apopiak commented May 29, 2022

Copy link
Copy Markdown
Contributor

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 corresponding OnKilledTokenAccount) callback to the pallet for other pallets to integrate with.

@apopiak

apopiak commented May 29, 2022

Copy link
Copy Markdown
Contributor Author

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 master?

@xlc

xlc commented May 29, 2022

Copy link
Copy Markdown
Member

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 master?

Update your Cargo.toml. That's due to bumping Substrate version

Comment thread traits/src/currency.rs Outdated
}

/// Handler for a newly created account
pub trait OnNewTokenAccount<AccountId, CurrencyId> {

Copy link
Copy Markdown
Member

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 }

Copy link
Copy Markdown
Contributor Author

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

@xlc xlc requested review from shaunxw and zqhxuyuan May 30, 2022 10:08
Comment thread tokens/src/lib.rs
@xlc

xlc commented Jun 6, 2022

Copy link
Copy Markdown
Member

can you revert the can_deposit change and fix the build?

@zjb0807

zjb0807 commented Jun 7, 2022

Copy link
Copy Markdown
Member

CI failed, Blocked: paritytech/substrate#11608

@zjb0807

zjb0807 commented Jun 7, 2022

Copy link
Copy Markdown
Member

@apopiak please merge master to fix the CI.

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.

5 participants