paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

add account lifecycle callbacks to pallet-assets #14677

Open apopiak opened 1 year ago

apopiak commented 1 year ago

This PR introduces account lifecycle callbacks to pallet-assets. This allows reacting to the combination of asset and account id individually as opposed to the general account lifecycle of frame_system.

This is an exploratory PR to solicit feedback. Happy to adjust, fix tests and write a companion if this can move forward.

Motivation

We use orml-tokens mutation hooks to take actions on created and killed accounts, triggered here: https://github.com/open-web3-stack/open-runtime-module-library/blob/73b4ee04e402f240f270bfe83f59fc2837dbaf51/tokens/src/lib.rs#L791-L795)

in HydraDX: https://github.com/galacticcouncil/HydraDX-node/blob/24823f0e91d2dbe2bb7743404d7763d9296d7412/pallets/transaction-multi-payment/src/lib.rs#L467-L477

In order to use pallet-assets we would need similar hooks there.

Checklist

Polkadot companion: (if applicable)

Cumulus companion: (if applicable)

paritytech-cicd-pr commented 1 year ago

The CI pipeline was cancelled due to failure one of the required jobs. Job name: cargo-check-benches Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3284313

gilescope commented 1 year ago

I think this seems very reasonable.