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

Implement foreign asset transaction fees #1022

Merged
merged 23 commits into from
Jul 18, 2023
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
21 changes: 21 additions & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions docs/changelog_for_devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ https://keepachangelog.com/en/1.0.0/ and ⚠️ marks changes that might break
components which query the chain's storage, the extrinsics or the runtime
APIs/RPC interface.

## v0.4.0

[#1022]: https://github.com/zeitgeistpm/zeitgeist/pull/1022

- Use pallet-asset-tx-payment for allowing to pay transaction fees in foreign
currencies ([#1022]). This requires each transaction to specify the fee
payment token with `asset_id` (`None` is ZTG).

## v0.3.9

[#1011]: https://github.com/zeitgeistpm/zeitgeist/pull/1011
Expand Down
1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ path = "./src/main.rs"
substrate-build-script-utils = { branch = "polkadot-v0.9.32", git = "https://github.com/paritytech/substrate" }

[dependencies]
pallet-asset-tx-payment = { branch = "polkadot-v0.9.32", git = "https://github.com/paritytech/substrate" }
pallet-transaction-payment = { branch = "polkadot-v0.9.32", git = "https://github.com/paritytech/substrate" }
pallet-transaction-payment-rpc = { branch = "polkadot-v0.9.32", git = "https://github.com/paritytech/substrate" }
pallet-transaction-payment-rpc-runtime-api = { branch = "polkadot-v0.9.32", git = "https://github.com/paritytech/substrate" }
Expand Down
9 changes: 7 additions & 2 deletions node/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2023 Forecasting Technologies LTD.
// Copyright 2021-2022 Zeitgeist PM LLC.
//
// This file is part of Zeitgeist.
Expand Down Expand Up @@ -174,6 +175,7 @@ pub fn create_benchmark_extrinsic_zeitgeist<
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2);

let extra: zeitgeist_runtime::SignedExtra = (
zeitgeist_runtime::CheckNonZeroSender::<zeitgeist_runtime::Runtime>::new(),
zeitgeist_runtime::CheckSpecVersion::<zeitgeist_runtime::Runtime>::new(),
Expand All @@ -184,7 +186,7 @@ pub fn create_benchmark_extrinsic_zeitgeist<
),
zeitgeist_runtime::CheckNonce::<zeitgeist_runtime::Runtime>::from(nonce.into()),
zeitgeist_runtime::CheckWeight::<zeitgeist_runtime::Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<zeitgeist_runtime::Runtime>::from(0),
pallet_asset_tx_payment::ChargeAssetTxPayment::<zeitgeist_runtime::Runtime>::from(0, None),
);

let raw_payload = zeitgeist_runtime::SignedPayload::from_raw(
Expand Down Expand Up @@ -232,6 +234,7 @@ pub fn create_benchmark_extrinsic_battery_station<
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2);

let extra: battery_station_runtime::SignedExtra = (
battery_station_runtime::CheckNonZeroSender::<battery_station_runtime::Runtime>::new(),
battery_station_runtime::CheckSpecVersion::<battery_station_runtime::Runtime>::new(),
Expand All @@ -242,7 +245,9 @@ pub fn create_benchmark_extrinsic_battery_station<
),
battery_station_runtime::CheckNonce::<battery_station_runtime::Runtime>::from(nonce.into()),
battery_station_runtime::CheckWeight::<battery_station_runtime::Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<battery_station_runtime::Runtime>::from(0),
pallet_asset_tx_payment::ChargeAssetTxPayment::<battery_station_runtime::Runtime>::from(
0, None,
),
);

let raw_payload = battery_station_runtime::SignedPayload::from_raw(
Expand Down
3 changes: 3 additions & 0 deletions runtime/battery-station/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ orml-benchmarking = { branch = "polkadot-v0.9.32", default-features = false, opt
orml-currencies = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/open-web3-stack/open-runtime-module-library" }
orml-tokens = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/open-web3-stack/open-runtime-module-library" }
orml-traits = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/open-web3-stack/open-runtime-module-library" }
pallet-asset-tx-payment = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/paritytech/substrate" }
pallet-balances = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/paritytech/substrate" }
pallet-bounties = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/paritytech/substrate" }
pallet-collective = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/paritytech/substrate" }
Expand Down Expand Up @@ -225,6 +226,7 @@ std = [
"orml-currencies/std",
"orml-tokens/std",
"orml-traits/std",
"pallet-asset-tx-payment/std",
"pallet-balances/std",
"pallet-bounties/std",
"pallet-collective/std",
Expand Down Expand Up @@ -342,6 +344,7 @@ try-runtime = [
"pallet-preimage/try-runtime",

# Money runtime pallets
"pallet-asset-tx-payment/try-runtime",
"pallet-balances/try-runtime",
"pallet-bounties/try-runtime",
"pallet-transaction-payment/try-runtime",
Expand Down
1 change: 0 additions & 1 deletion runtime/battery-station/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ use frame_support::{
};
use frame_system::EnsureRoot;
use pallet_collective::{EnsureProportionAtLeast, PrimeDefaultVote};
use pallet_transaction_payment::ChargeTransactionPayment;
use sp_runtime::{
traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256},
DispatchError,
Expand Down
2 changes: 2 additions & 0 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ frame-support = { branch = "polkadot-v0.9.32", default-features = false, git = "
frame-system = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/paritytech/substrate" }
orml-currencies = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/open-web3-stack/open-runtime-module-library" }
orml-tokens = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/open-web3-stack/open-runtime-module-library" }
pallet-asset-tx-payment = { branch = "polkadot-v0.9.32", default-features = false, git = "https://github.com/paritytech/substrate" }
pallet-author-inherent = { default-features = false, git = "https://github.com/zeitgeistpm/external", optional = true }
pallet-author-mapping = { default-features = false, git = "https://github.com/zeitgeistpm/external", optional = true }
pallet-author-slot-filter = { default-features = false, git = "https://github.com/zeitgeistpm/external", optional = true }
Expand Down Expand Up @@ -47,6 +48,7 @@ std = [
"frame-support/std",
"orml-currencies/std",
"orml-tokens/std",
"pallet-asset-tx-payment/std",
"pallet-author-inherent?/std",
"pallet-author-mapping?/std",
"pallet-author-slot-filter?/std",
Expand Down
Loading
Loading