Asset Transaction Payment (#488)

* use new pallet name based genesis config names

* use custom substrate and update polkadot

* add initial asset-tx-payment pallet

* update cargo.toml

* add (failing) tests

* dispatch Calls instead of using Pallet functions

* fix fee-refund split

* add test for transaction payment with tip

* update cargo.lock

* update cargo.lock

* remove mint workaround and use Mutable trait

* extract fee charging logic into OnChargeAssetTransaction trait

* use asset-tx-payment in statemint runtime

* make extrinsics public

* make extrinsics public

* use ChargeAssetIdOf type alias

* update deps

* move back to AssetIdOf

* remove extra rpc_http_threads

* use different substrate branch

* Update pallets/asset-tx-payment/src/payment.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update pallets/asset-tx-payment/src/payment.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* remove overrides

* override substrate deps (again)

* increment spec_version and transaction_version (because we change transaction signing)

* remove direct dependency on pallet-balances from asset-tx-payment

* remove Assets pallet visibility workaround

* add docs and comments

* remove unused imports

* more docs

* add more debug asserts to document assumptions

* add test for tx payment from account with only assets

* add test for missing asset case

* extend test to cover non-sufficient assets

* add a test for Pays::No (refunded transaction)

* add type alias comments

* add more doc comments

* add asset-tx-payment to statemine and westmint

* improve formatting

* update license headers

* add default implementation of HandleCredit for ()

* update doc comments and format imports

* adjust Cargo.toml

* update cargo.lock

* cargo fmt

* cargo fmt

* cargo fmt

* cargo +nightly fmt

* add type alias for OnChargeTransaction

* cargo +nightly fmt

* convert ChargeAssetTxPayment from tuple struct to regular struct

* add more comments

* formatting

* adjust imports and comment

* cargo +nightly fmt

* reformat comment

* use ChargeTransactionPayment's own get_priority + update Substrate

* update Substrate and Polkadot

* cargo fmt

* cargo fmt

* add OperationalFeeMultiplier to asset tx payment tests

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* add doc links

* charge a minimum converted asset fee of 1 if the input fee is greater zero

* cargo +nightly fmt

* bump spec and transaction version

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Alexander Popiak
2021-10-11 11:57:37 +02:00
committed by GitHub
parent 2647053fd3
commit 3b1446d791
14 changed files with 1268 additions and 24 deletions
+27
View File
@@ -5047,6 +5047,28 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "pallet-asset-tx-payment"
version = "0.1.0"
dependencies = [
"frame-support",
"frame-system",
"pallet-assets",
"pallet-authorship",
"pallet-balances",
"pallet-transaction-payment",
"parity-scale-codec",
"scale-info",
"serde",
"serde_json",
"smallvec",
"sp-core",
"sp-io",
"sp-runtime",
"sp-std",
"sp-storage",
]
[[package]]
name = "pallet-assets"
version = "4.0.0-dev"
@@ -6114,6 +6136,8 @@ dependencies = [
"frame-support",
"frame-system",
"node-primitives",
"pallet-asset-tx-payment",
"pallet-assets",
"pallet-authorship",
"pallet-balances",
"pallet-collator-selection",
@@ -10724,6 +10748,7 @@ dependencies = [
"hex-literal 0.3.3",
"log",
"node-primitives",
"pallet-asset-tx-payment",
"pallet-assets",
"pallet-aura",
"pallet-authorship",
@@ -10789,6 +10814,7 @@ dependencies = [
"hex-literal 0.3.3",
"log",
"node-primitives",
"pallet-asset-tx-payment",
"pallet-assets",
"pallet-aura",
"pallet-authorship",
@@ -12225,6 +12251,7 @@ dependencies = [
"hex-literal 0.3.3",
"log",
"node-primitives",
"pallet-asset-tx-payment",
"pallet-assets",
"pallet-aura",
"pallet-authorship",