Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Asset Transaction Payment (#488)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Oct 11, 2021
1 parent eff56f6 commit 3520acc
Show file tree
Hide file tree
Showing 14 changed files with 1,268 additions and 24 deletions.
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"client/network",
"client/pov-recovery",
"client/service",
"pallets/asset-tx-payment",
"pallets/aura-ext",
"pallets/collator-selection",
"pallets/dmp-queue",
Expand Down
51 changes: 51 additions & 0 deletions pallets/asset-tx-payment/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[package]
name = "pallet-asset-tx-payment"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "Apache-2.0"
homepage = "https://substrate.dev"
repository = "https://github.com/paritytech/cumulus/"
description = "pallet to manage transaction payments in assets"
readme = "README.md"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
# Substrate dependencies
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

# 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.101", optional = true }

[dev-dependencies]
smallvec = "1.4.1"
serde_json = "1.0.41"
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master" }

[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"]

0 comments on commit 3520acc

Please sign in to comment.