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:
Albrecht
2020-10-30 13:27:04 +01:00
committed by GitHub
parent e1b56f8dd3
commit b7205d4ae0
7 changed files with 185 additions and 78 deletions
@@ -37,6 +37,7 @@ pub use frame_support::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
},
};
use pallet_transaction_payment::CurrencyAdapter;
/// Import the template pallet.
pub use template;
@@ -249,8 +250,7 @@ parameter_types! {
}
impl pallet_transaction_payment::Trait for Runtime {
type Currency = Balances;
type OnTransactionPayment = ();
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = ();