Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/token timeouts #65

Merged
merged 2 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 188 additions & 126 deletions Cargo.lock

Large diffs are not rendered by default.

2,216 changes: 1,110 additions & 1,106 deletions Cargo.toml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions frame/transaction-payment-mangata/Cargo.toml
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"]
16 changes: 16 additions & 0 deletions frame/transaction-payment-mangata/README.md
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 frame/transaction-payment-mangata/asset-tx-payment/Cargo.toml
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 frame/transaction-payment-mangata/asset-tx-payment/README.md
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
Loading