use frame_support::traits::GenesisBuild;
use frame_support::{
ensure,
pallet_prelude::DispatchResult,
traits::{
tokens::{fungible, BalanceStatus as Status, DepositConsequence, WithdrawConsequence},
Currency, DefensiveSaturating, ExistenceRequirement,
ExistenceRequirement::{AllowDeath, KeepAlive},
Get, Imbalance, LockIdentifier, LockableCurrency, NamedReservableCurrency, OnUnbalanced,
ReservableCurrency, SignedImbalance, StoredMap, TryDrop, WithdrawReasons,
},
WeakBoundedVec,
};
#[frame_support::pallet]
pub mod pallet {
#[pallet::call]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
#[pallet::weight(T::WeightInfo::transfer())]
pub fn transfer()
#[pallet::weight(
T::WeightInfo::set_balance_creating()
.max(T::WeightInfo::set_balance_killing())
)]
pub fn set_balance()
#[pallet::weight(T::WeightInfo::force_transfer())]
pub fn force_transfer()
#[pallet::weight(T::WeightInfo::transfer_keep_alive())]
pub fn transfer_keep_alive()
#[pallet::weight(T::WeightInfo::transfer_all())]
pub fn transfer_all()
#[pallet::weight(T::WeightInfo::force_unreserve())]
pub fn force_unreserve()
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
Endowed,
DustLost,
Transfer,
BalanceSet,
Reserved,
Unreserved,
ReserveRepatriated,
Deposit,
Withdraw,
Slashed,
}
#[pallet::error]
pub enum Error<T, I = ()> {
VestingBalance,
LiquidityRestrictions,
InsufficientBalance,
ExistentialDeposit,
KeepAlive,
ExistingVestingSchedule,
DeadAccount,
ToomanyReserves,
}
#[pallet::storage]
#[pallet::getter(fn total_issuance)]
pub type TotalIssuance
#[pallet::storage]
#[pallet::getter(fn locks)]
pub type Locks<T: Config<I>, I: 'static = ()> = StorageMap<
_,
Blake2_128Concat,
T::AccountId,
WeakBoundedVec<BalanceLock<T::Balance>, T::MaxLocks>,
ValueQuery,
>;
}
#[pallet::storage]
#[pallet::getter(fn reserves)]
pub type Reserves
impl<T: Config<I>, I: 'static> Pallet<T, I>
pub fn free_balance
pub fn usable_balance
pub fn usable_balance_for_fees
pub fn reserved_balance
pub fn mutate_account
impl<T: Config<I>, I: 'static> fungible::Inspect<T::AccountId> for Pallet<T, I>
fn total_issuance()
fn minimum_balance()
fn balance(who: &T::AccountId)
fn reducible_balance()
fn can_deposit
fn can_withdraw
impl<T: Config<I>, I: 'static> fungible::Mutate<T::AccountId> for Pallet<T, I>
fn mint_into
fn burn_from
impl<T: Config<I>, I: 'static> fungible::Transfer<T::AccountId> for Pallet<T, I>
fn transfer
impl<T: Config<I>, I: 'static> fungible::Unbalanced<T::AccountId> for Pallet<T, I>
fn set_balance
fn set_total_issuance
impl<T: Config<I>, I: 'static> fungible::InspectHold<T::AccountId> for Pallet<T, I>
fn balance_on_hold
fn can_hold
impl<T: Config<I>, I: 'static> fungible::MutateHold<T::AccountId> for Pallet<T, I>
fn hold
fn release
fn transfer_held
impl<T: Config<I>, I: 'static> Currency<T::AccountId> for Pallet<T, I>
where
T::Balance: MaybeSerializeDeserialize + Debug,{}
impl<T: Config<I>, I: 'static> ReservableCurrency<T::AccountId> for Pallet<T, I>
where
T::Balance: MaybeSerializeDeserialize + Debug,{}
impl<T: Config<I>, I: 'static> NamedReservableCurrency<T::AccountId> for Pallet<T, I>
where
T::Balance: MaybeSerializeDeserialize + Debug,{}
impl<T: Config<I>, I: 'static> LockableCurrency<T::AccountId> for Pallet<T, I>
where
T::Balance: MaybeSerializeDeserialize + Debug,{}