frame_support/
traits.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// 	http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Traits and associated utilities for use in the FRAME environment.
19//!
20//! NOTE: If you're looking for `parameter_types`, it has moved in to the top-level module.
21
22pub mod tokens;
23pub use tokens::{
24	currency::{
25		ActiveIssuanceOf, Currency, InspectLockableCurrency, LockIdentifier, LockableCurrency,
26		NamedReservableCurrency, ReservableCurrency, TotalIssuanceOf, VestedTransfer,
27		VestingSchedule,
28	},
29	fungible, fungibles,
30	imbalance::{Imbalance, OnUnbalanced, SignedImbalance},
31	nonfungible, nonfungible_v2, nonfungibles, nonfungibles_v2, BalanceStatus,
32	ExistenceRequirement, Locker, WithdrawReasons,
33};
34
35mod members;
36#[allow(deprecated)]
37pub use members::{AllowAll, DenyAll, Filter};
38pub use members::{
39	AsContains, ChangeMembers, Contains, ContainsLengthBound, ContainsPair, Equals, Everything,
40	EverythingBut, FromContains, FromContainsPair, InitializeMembers, InsideBoth, IsInVec, Nothing,
41	RankedMembers, RankedMembersSwapHandler, SortedMembers, TheseExcept,
42};
43
44mod validation;
45pub use validation::{
46	DisabledValidators, EstimateNextNewSession, EstimateNextSessionRotation, FindAuthor,
47	KeyOwnerProofSystem, Lateness, OneSessionHandler, ValidatorRegistration, ValidatorSet,
48	ValidatorSetWithIdentification, VerifySeal,
49};
50
51mod error;
52pub use error::PalletError;
53
54mod filter;
55pub use filter::{ClearFilterGuard, FilterStack, FilterStackGuard, InstanceFilter};
56
57mod misc;
58pub use misc::{
59	defensive_prelude::{self, *},
60	AccountTouch, Backing, ConstBool, ConstI128, ConstI16, ConstI32, ConstI64, ConstI8, ConstInt,
61	ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, ConstUint, DefensiveMax, DefensiveMin,
62	DefensiveSaturating, DefensiveTruncateFrom, DefensiveTruncateInto, EqualPrivilegeOnly,
63	EstimateCallFee, ExecuteBlock, Get, GetBacking, GetDefault, HandleLifetime, InherentBuilder,
64	IsInherent, IsSubType, IsType, Len, OffchainWorker, OnKilledAccount, OnNewAccount,
65	PrivilegeCmp, RewardsReporter, SameOrOther, SignedTransactionBuilder, Time, TryCollect,
66	TryDrop, TypedGet, UnixTime, VariantCount, VariantCountOf, WrapperKeepOpaque, WrapperOpaque,
67};
68#[allow(deprecated)]
69pub use misc::{PreimageProvider, PreimageRecipient};
70#[doc(hidden)]
71pub use misc::{DEFENSIVE_OP_INTERNAL_ERROR, DEFENSIVE_OP_PUBLIC_ERROR};
72
73mod stored_map;
74pub use stored_map::{StorageMapShim, StoredMap};
75mod randomness;
76pub use randomness::Randomness;
77pub mod reality;
78
79mod metadata;
80pub use metadata::{
81	CallMetadata, CrateVersion, GetCallIndex, GetCallMetadata, GetCallName, GetStorageVersion,
82	NoStorageVersionSet, PalletInfo, PalletInfoAccess, PalletInfoData, PalletsInfoAccess,
83	StorageVersion, STORAGE_VERSION_STORAGE_KEY_POSTFIX,
84};
85
86mod hooks;
87#[allow(deprecated)]
88pub use hooks::GenesisBuild;
89pub use hooks::{
90	BeforeAllRuntimeMigrations, BuildGenesisConfig, Hooks, IntegrityTest, OnFinalize, OnGenesis,
91	OnIdle, OnInitialize, OnPoll, OnRuntimeUpgrade, OnTimestampSet, PostInherents,
92	PostTransactions, PreInherents, UncheckedOnRuntimeUpgrade,
93};
94
95pub mod schedule;
96mod storage;
97#[cfg(feature = "experimental")]
98pub use storage::MaybeConsideration;
99pub use storage::{
100	Consideration, ConstantStoragePrice, Disabled, Footprint, Incrementable, Instance,
101	LinearStoragePrice, PartialStorageInfoTrait, StorageInfo, StorageInfoTrait, StorageInstance,
102	TrackedStorageKey, WhitelistedStorageKeys,
103};
104
105mod dispatch;
106#[allow(deprecated)]
107pub use dispatch::EnsureOneOf;
108pub use dispatch::{
109	AsEnsureOriginWithArg, Authorize, CallerTrait, EitherOf, EitherOfDiverse, EnsureOrigin,
110	EnsureOriginEqualOrHigherPrivilege, EnsureOriginWithArg, MapSuccess, NeverEnsureOrigin,
111	OriginTrait, TryMapSuccess, TryWithMorphedArg, UnfilteredDispatchable,
112};
113
114mod voting;
115pub use voting::{ClassCountOf, NoOpPoll, PollStatus, Polling, VoteTally};
116
117mod preimages;
118pub use preimages::{Bounded, BoundedInline, FetchResult, QueryPreimage, StorePreimage};
119
120mod messages;
121pub use messages::{
122	BatchFootprint, BatchesFootprints, EnqueueMessage, EnqueueWithOrigin, ExecuteOverweightError,
123	HandleMessage, NoopServiceQueues, ProcessMessage, ProcessMessageError, QueueFootprint,
124	QueueFootprintQuery, QueuePausedQuery, ServiceQueues, TransformOrigin,
125};
126
127mod safe_mode;
128pub use safe_mode::{SafeMode, SafeModeError, SafeModeNotify};
129
130mod tx_pause;
131pub use tx_pause::{TransactionPause, TransactionPauseError};
132
133pub mod dynamic_params;
134
135pub mod tasks;
136pub use tasks::Task;
137
138mod proving;
139pub use proving::*;
140
141#[cfg(feature = "try-runtime")]
142mod try_runtime;
143#[cfg(feature = "try-runtime")]
144pub use try_runtime::{
145	Select as TryStateSelect, TryDecodeEntireStorage, TryDecodeEntireStorageError, TryState,
146	UpgradeCheckSelect,
147};