forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from mangata-finance/feature/token-timeouts
Feature/token timeouts
- Loading branch information
Showing
18 changed files
with
4,801 additions
and
1,232 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[package] | ||
name = "pallet-transaction-payment-mangata" | ||
version = "4.0.0-dev" | ||
authors = ["Parity Technologies <admin@parity.io>"] | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
homepage = "https://substrate.io" | ||
repository = "https://github.com/paritytech/substrate/" | ||
description = "FRAME pallet to manage transaction payments" | ||
readme = "README.md" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ | ||
"derive", | ||
] } | ||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } | ||
serde = { version = "1.0.136", optional = true } | ||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } | ||
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } | ||
sp-core = { version = "6.0.0", default-features = false, path = "../../primitives/core" } | ||
sp-io = { version = "6.0.0", default-features = false, path = "../../primitives/io" } | ||
sp-runtime = { version = "6.0.0", default-features = false, path = "../../primitives/runtime" } | ||
sp-std = { version = "4.0.0", default-features = false, path = "../../primitives/std" } | ||
|
||
[dev-dependencies] | ||
serde_json = "1.0.79" | ||
pallet-balances = { version = "4.0.0-dev", path = "../balances" } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"codec/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"scale-info/std", | ||
"serde", | ||
"sp-core/std", | ||
"sp-io/std", | ||
"sp-runtime/std", | ||
"sp-std/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,16 @@ | ||
# Transaction Payment Pallet | ||
|
||
This pallet provides the basic logic needed to pay the absolute minimum amount needed for a | ||
transaction to be included. This includes: | ||
- _weight fee_: A fee proportional to amount of weight a transaction consumes. | ||
- _length fee_: A fee proportional to the encoded length of the transaction. | ||
- _tip_: An optional tip. Tip increases the priority of the transaction, giving it a higher | ||
chance to be included by the transaction queue. | ||
|
||
Additionally, this pallet allows one to configure: | ||
- The mapping between one unit of weight to one unit of fee via [`Config::WeightToFee`]. | ||
- A means of updating the fee for the next block, via defining a multiplier, based on the | ||
final state of the chain at the end of the previous block. This can be configured via | ||
[`Config::FeeMultiplierUpdate`] | ||
|
||
License: Apache-2.0 |
54 changes: 54 additions & 0 deletions
54
frame/transaction-payment-mangata/asset-tx-payment/Cargo.toml
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,54 @@ | ||
[package] | ||
name = "pallet-asset-tx-payment-mangata" | ||
version = "4.0.0-dev" | ||
authors = ["Parity Technologies <admin@parity.io>"] | ||
edition = "2021" | ||
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 = "6.0.0", default-features = false, path = "../../../primitives/core" } | ||
sp-io = { version = "6.0.0", default-features = false, path = "../../../primitives/io" } | ||
sp-runtime = { version = "6.0.0", default-features = false, path = "../../../primitives/runtime" } | ||
sp-std = { version = "4.0.0", 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-mangata = { version = "4.0.0-dev", default-features = false, path = ".." } | ||
|
||
# Other dependencies | ||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } | ||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } | ||
serde = { version = "1.0.136", optional = true } | ||
|
||
[dev-dependencies] | ||
serde_json = "1.0.79" | ||
|
||
sp-storage = { version = "6.0.0", 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-mangata/std", | ||
] | ||
try-runtime = ["frame-support/try-runtime"] |
21 changes: 21 additions & 0 deletions
21
frame/transaction-payment-mangata/asset-tx-payment/README.md
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-mangata`]. The | ||
included [`FungiblesAdapter`] (implementing [`OnChargeAssetTransaction`]) determines the fee | ||
amount by converting the fee calculated by [`pallet-transaction-payment-mangata`] 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.