This repository was archived by the owner on May 22, 2023. It is now read-only.
forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving
pallet-asset-tx-payment
from cumulus to substrate (paritytec…
…h#10127) * Moving `pallet-asset-tx-payment` from cumulus * move pallet-asset-tx-payment into transaction payment directory * cargo +nightly fmt * Adding `pallet-asset-tx-payment` to node runtime I had to change the Balance type to u128. Also harmonised that pallet's version * Updating cargo.lock after merge * forgot this * Adding tx-payment signature * Missed one more * `transaction-payment` replaced in`SignedExtension` by `asset-tx-payment` and not added * Fixing benches * add test to verify that we don't charge on post-dispatch if we didn't on pre-dispatch * add (failing) test for asset tx payment of unsigned extrinsics * fix test by removing debug_assert * cargo +nightly fmt * typo in `Cargo.lock` * Object defined twice in lock file * cargo update * remove todo * Apply formatting suggestions from code review Co-authored-by: Kian Paimani <[email protected]> * Refactoring `post_dispatch` of `asset-tx-payment` to reuse `post_dispatch` of `transaction-payment` if the fee asset is native Removing unneeded imports. * Removing redundant `TODO` * Reverting an accidental bump of `impl-serde` from `0.3.1` to `0.3.2` * Revert unneeded changes to `cargo.lock` * Update frame/transaction-payment/asset-tx-payment/src/payment.rs Co-authored-by: Kian Paimani <[email protected]> * Fixing cargo fmt Reverting changes which broke cargo fmt Co-authored-by: Alexander Popiak <[email protected]> Co-authored-by: Alexander Popiak <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
- Loading branch information
1 parent
3d4f186
commit 4581dd9
Showing
16 changed files
with
1,346 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[package] | ||
name = "pallet-asset-tx-payment" | ||
version = "4.0.0-dev" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2018" | ||
license = "Apache-2.0" | ||
homepage = "https://substrate.io" | ||
repository = "https://github.com/paritytech/substrate/" | ||
description = "pallet to manage transaction payments in assets" | ||
readme = "README.md" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
# Substrate dependencies | ||
sp-core = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/core" } | ||
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/io" } | ||
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/runtime" } | ||
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/std" } | ||
|
||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" } | ||
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" } | ||
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, path = ".." } | ||
|
||
# Other dependencies | ||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } | ||
scale-info = { version = "1.0", default-features = false, features = ["derive"] } | ||
serde = { version = "1.0.126", optional = true } | ||
|
||
[dev-dependencies] | ||
smallvec = "1.7.0" | ||
serde_json = "1.0.68" | ||
|
||
sp-storage = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/storage" } | ||
|
||
pallet-assets = { version = "4.0.0-dev", path = "../../assets" } | ||
pallet-authorship = { version = "4.0.0-dev", path = "../../authorship" } | ||
pallet-balances = { version = "4.0.0-dev", path = "../../balances" } | ||
|
||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"serde", | ||
"codec/std", | ||
"sp-std/std", | ||
"sp-runtime/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"sp-io/std", | ||
"sp-core/std", | ||
"pallet-transaction-payment/std", | ||
] | ||
try-runtime = ["frame-support/try-runtime"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# pallet-asset-tx-payment | ||
|
||
## Asset Transaction Payment Pallet | ||
|
||
This pallet allows runtimes that include it to pay for transactions in assets other than the | ||
native token of the chain. | ||
|
||
### Overview | ||
It does this by extending transactions to include an optional `AssetId` that specifies the asset | ||
to be used for payment (defaulting to the native token on `None`). It expects an | ||
[`OnChargeAssetTransaction`] implementation analogously to [`pallet-transaction-payment`]. The | ||
included [`FungiblesAdapter`] (implementing [`OnChargeAssetTransaction`]) determines the fee | ||
amount by converting the fee calculated by [`pallet-transaction-payment`] into the desired | ||
asset. | ||
|
||
### Integration | ||
This pallet wraps FRAME's transaction payment pallet and functions as a replacement. This means | ||
you should include both pallets in your `construct_runtime` macro, but only include this | ||
pallet's [`SignedExtension`] ([`ChargeAssetTxPayment`]). | ||
|
||
License: Apache-2.0 |
Oops, something went wrong.