mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 23:31:07 +00:00
fix AssetsToBlockAuthor
This commit is contained in:
@@ -71,17 +71,18 @@ where
|
||||
|
||||
/// 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>
|
||||
pub struct AssetsToBlockAuthor<R, I = ()>(PhantomData<(R, I)>);
|
||||
impl<R, I> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R, I>> for AssetsToBlockAuthor<R>
|
||||
where
|
||||
R: pallet_authorship::Config + pallet_assets::Config,
|
||||
I: 'static,
|
||||
R: pallet_authorship::Config + pallet_assets::Config<I>,
|
||||
AccountIdOf<R>:
|
||||
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
|
||||
{
|
||||
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R>>) {
|
||||
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R, I>>) {
|
||||
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);
|
||||
let _ = pallet_assets::Pallet::<R, I>::resolve(&author, credit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,14 +535,16 @@ impl pallet_collator_selection::Config for Runtime {
|
||||
|
||||
impl pallet_asset_tx_payment::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
// TODO
|
||||
// TODO https://github.com/paritytech/substrate/issues/12724
|
||||
// This should be able to take assets from any pallet instance.
|
||||
type Fungibles = (ForeignAssets, TrustBackedAssets);
|
||||
type Fungibles = TrustBackedAssets;
|
||||
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
|
||||
(
|
||||
ForeignAssets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
||||
TrustBackedAssets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
||||
),
|
||||
pallet_assets::BalanceToAssetBalance<
|
||||
Balances,
|
||||
Runtime,
|
||||
ConvertInto,
|
||||
pallet_assets::Instance1,
|
||||
>,
|
||||
AssetsToBlockAuthor<Runtime>,
|
||||
>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user