Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Emit events related to asset mutations #14099

Merged
merged 4 commits into from
May 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion frame/assets/src/impl_fungibles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,37 @@ impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId
}
}

impl<T: Config<I>, I: 'static> fungibles::Mutate<<T as SystemConfig>::AccountId> for Pallet<T, I> {}
impl<T: Config<I>, I: 'static> fungibles::Mutate<<T as SystemConfig>::AccountId> for Pallet<T, I> {
fn done_mint_into(
asset_id: Self::AssetId,
beneficiary: &<T as SystemConfig>::AccountId,
amount: Self::Balance,
) {
Self::deposit_event(Event::Issued { asset_id, owner: beneficiary.clone(), amount })
}

fn done_burn_from(
asset_id: Self::AssetId,
target: &<T as SystemConfig>::AccountId,
balance: Self::Balance,
) {
Self::deposit_event(Event::Burned { asset_id, owner: target.clone(), balance: actual });
}

fn done_transfer(
asset_id: Self::AssetId,
source: &<T as SystemConfig>::AccountId,
dest: &<T as SystemConfig>::AccountId,
amount: Self::Balance,
) {
Self::deposit_event(Event::Transferred {
asset_id,
from: source.clone(),
to: dest.clone(),
amount,
});
}
}
impl<T: Config<I>, I: 'static> fungibles::Balanced<<T as SystemConfig>::AccountId>
for Pallet<T, I>
{
Expand Down