I'm trying to change pallet_assets
to pallet_assets::<Instance1>
in preparation for more pallet instances. Commit here and compilation error here.
The trouble seems to come from the HandleCredit
impl, which assumes some pallet_assets::Config
, but doesn't reference any instance. I don't understand what it would need to do with an instance; it should take the assets from any configured Assets pallet (even if there are many). How can I fix this?
/// A `HandleCredit` implementation that naively transfers the fees to the block author.
/// Will drop and burn the assets in case the transfer fails.
pub struct AssetsToBlockAuthor<R>(PhantomData<R>);
impl<R> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R>> for AssetsToBlockAuthor<R>
where
R: pallet_authorship::Config + pallet_assets::Config,
AccountIdOf<R>:
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
{
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R>>) {
if let Some(author) = pallet_authorship::Pallet::<R>::author() {
// In case of error: Will drop the result triggering the `OnDrop` of the imbalance.
let _ = pallet_assets::Pallet::<R>::resolve(&author, credit);
}
}
}