pallet_xcm_benchmarks/fungible/mod.rs
1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Polkadot.
3
4// Polkadot is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Polkadot is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
16
17// Benchmarking for the `AssetTransactor` trait via `Fungible`.
18
19pub use pallet::*;
20
21#[cfg(feature = "runtime-benchmarks")]
22pub mod benchmarking;
23#[cfg(test)]
24mod mock;
25
26#[frame_support::pallet]
27pub mod pallet {
28 use frame_support::pallet_prelude::Get;
29 #[pallet::config]
30 pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config {
31 /// The type of `fungible` that is being used under the hood.
32 ///
33 /// This is useful for testing and checking.
34 type TransactAsset: frame_support::traits::fungible::Mutate<Self::AccountId>;
35
36 /// The account used to check assets being teleported.
37 type CheckedAccount: Get<Option<(Self::AccountId, xcm_builder::MintLocation)>>;
38
39 /// A trusted location which we allow teleports from, and the asset we allow to teleport.
40 type TrustedTeleporter: Get<Option<(xcm::latest::Location, xcm::latest::Asset)>>;
41
42 /// A trusted location where reserve assets are stored, and the asset we allow to be
43 /// reserves.
44 type TrustedReserve: Get<Option<(xcm::latest::Location, xcm::latest::Asset)>>;
45
46 /// Give me a fungible asset that your asset transactor is going to accept.
47 fn get_asset() -> xcm::latest::Asset;
48 }
49
50 #[pallet::pallet]
51 pub struct Pallet<T, I = ()>(_);
52}