mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
decouple transaction payment and currency (#6912)
* wip: setup types * fix types * make tx payment pallet independent from balances * fix dependent tests * comments * restructure a bit and include more info * clean up ugly phantom * reduce complexity * minor doc improvements * use shorthand * doc * fix line lenght and style * readd BalanceOf * some clarifications and readability improvements * move balance type to OnChargeTransaction * remove noise * fix style * Apply suggestions from code review improved documentation Co-authored-by: Alexander Theißen <alex.theissen@me.com> * Improve naming and documentation Apply suggestions from code review Co-authored-by: Alexander Theißen <alex.theissen@me.com> * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * always call withdraw_fee * move NegativeImbalanceOf to payment module * fix unused import Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -29,6 +29,7 @@ use sp_io;
|
||||
use frame_support::{impl_outer_origin, impl_outer_event, parameter_types};
|
||||
use frame_support::traits::Get;
|
||||
use frame_support::weights::{Weight, DispatchInfo, IdentityFee};
|
||||
use pallet_transaction_payment::CurrencyAdapter;
|
||||
use std::cell::RefCell;
|
||||
use crate::{GenesisConfig, Module, Trait, decl_tests, tests::CallWithDispatchInfo};
|
||||
|
||||
@@ -97,8 +98,7 @@ parameter_types! {
|
||||
pub const TransactionByteFee: u64 = 1;
|
||||
}
|
||||
impl pallet_transaction_payment::Trait for Test {
|
||||
type Currency = Module<Test>;
|
||||
type OnTransactionPayment = ();
|
||||
type OnChargeTransaction = CurrencyAdapter<Module<Test>, ()>;
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
type WeightToFee = IdentityFee<u64>;
|
||||
type FeeMultiplierUpdate = ();
|
||||
|
||||
@@ -31,6 +31,7 @@ use frame_support::traits::{Get, StorageMapShim};
|
||||
use frame_support::weights::{Weight, DispatchInfo, IdentityFee};
|
||||
use std::cell::RefCell;
|
||||
use crate::{GenesisConfig, Module, Trait, decl_tests, tests::CallWithDispatchInfo};
|
||||
use pallet_transaction_payment::CurrencyAdapter;
|
||||
|
||||
use frame_system as system;
|
||||
impl_outer_origin!{
|
||||
@@ -97,8 +98,7 @@ parameter_types! {
|
||||
pub const TransactionByteFee: u64 = 1;
|
||||
}
|
||||
impl pallet_transaction_payment::Trait for Test {
|
||||
type Currency = Module<Test>;
|
||||
type OnTransactionPayment = ();
|
||||
type OnChargeTransaction = CurrencyAdapter<Module<Test>, ()>;
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
type WeightToFee = IdentityFee<u64>;
|
||||
type FeeMultiplierUpdate = ();
|
||||
|
||||
Reference in New Issue
Block a user