pub struct PoolInfo<T: Config<I>, I: 'static = ()> { /* private fields */ }Expand description
Represents a managed pool derived from an index.
PoolInfo aggregates capital, commission, and the collection of slots,
each of which represents a portion of the pool linked to underlying entries.
Unlike indexes, pools are mutable and can have their slot balances adjusted dynamically.
Pools are created from an IndexInfo (or Entries), allowing the
shares of each entry to be translated into slots within the pool.
Pool’s slot shares/variants can then be adjusted over time, while the pool’s commission and structure remain consistent.
Implementations§
Source§impl<T: Config<I>, I: 'static> PoolInfo<T, I>
impl<T: Config<I>, I: 'static> PoolInfo<T, I>
Sourcepub fn balance(&self) -> LazyBalanceOf<T, I>
pub fn balance(&self) -> LazyBalanceOf<T, I>
Returns the pool’s lazy balance.
Sourcepub fn capital(&self) -> T::Shares
pub fn capital(&self) -> T::Shares
Returns the pool’s total capital i.e., total shares of all slots.
Sourcepub fn commission(&self) -> T::Commission
pub fn commission(&self) -> T::Commission
Returns the pool’s commission i.e., manager’s share while resolving the pool’s commit.
Sourcepub fn slot_exists(&self, slot: &SlotDigest<T>) -> DispatchResult
pub fn slot_exists(&self, slot: &SlotDigest<T>) -> DispatchResult
Checks if a slot of digest exists in the pool.
Trait Implementations§
Source§impl<T: Config<I>, I: 'static> Decode for PoolInfo<T, I>
impl<T: Config<I>, I: 'static> Decode for PoolInfo<T, I>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
impl<T: Config<I>, I: 'static> DecodeWithMemTracking for PoolInfo<T, I>where
LazyBalanceOf<T, I>: DecodeWithMemTracking,
T::Shares: DecodeWithMemTracking,
T::Commission: DecodeWithMemTracking,
Slots<T, I>: DecodeWithMemTracking,
Source§impl<T: Config<I>, I: 'static> Encode for PoolInfo<T, I>
impl<T: Config<I>, I: 'static> Encode for PoolInfo<T, I>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
impl<T: Config<I>, I: 'static> EncodeLike for PoolInfo<T, I>
impl<T: Config<I>, I: 'static> Eq for PoolInfo<T, I>
Source§impl<T: Config<I>, I: 'static> MaxEncodedLen for PoolInfo<T, I>where
LazyBalanceOf<T, I>: MaxEncodedLen,
T::Shares: MaxEncodedLen,
T::Commission: MaxEncodedLen,
Slots<T, I>: MaxEncodedLen,
impl<T: Config<I>, I: 'static> MaxEncodedLen for PoolInfo<T, I>where
LazyBalanceOf<T, I>: MaxEncodedLen,
T::Shares: MaxEncodedLen,
T::Commission: MaxEncodedLen,
Slots<T, I>: MaxEncodedLen,
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Auto Trait Implementations§
impl<T, I> Freeze for PoolInfo<T, I>where
<T as Config<I>>::Shares: Freeze,
<T as Config<I>>::Commission: Freeze,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<BalanceAddon>>::Repr: Freeze,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: Freeze,
<T as Config<I>>::Bias: Freeze,
<T as Config<I>>::Time: Freeze,
impl<T, I> RefUnwindSafe for PoolInfo<T, I>where
<T as Config<I>>::Shares: RefUnwindSafe,
<T as Config<I>>::Commission: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<BalanceAddon>>::Repr: RefUnwindSafe,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: RefUnwindSafe,
<T as Config<I>>::Bias: RefUnwindSafe,
<T as Config<I>>::Time: RefUnwindSafe,
<T as Config<I>>::MaxIndexEntries: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceAsset>>::Bound: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceRational>>::Bound: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceTime>>::Bound: RefUnwindSafe,
<T as Config>::AccountId: RefUnwindSafe,
<T as Config<I>>::Position: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: RefUnwindSafe,
impl<T, I> Send for PoolInfo<T, I>where
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<BalanceAddon>>::Repr: Send,
<T as Config<I>>::MaxIndexEntries: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceAsset>>::Bound: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceRational>>::Bound: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceTime>>::Bound: Send,
<T as Config<I>>::Position: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: Send,
impl<T, I> Sync for PoolInfo<T, I>where
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<BalanceAddon>>::Repr: Sync,
<T as Config<I>>::MaxIndexEntries: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceAsset>>::Bound: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceRational>>::Bound: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceTime>>::Bound: Sync,
<T as Config<I>>::Position: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: Sync,
impl<T, I> Unpin for PoolInfo<T, I>where
<T as Config<I>>::Shares: Unpin,
<T as Config<I>>::Commission: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<BalanceAddon>>::Repr: Unpin,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: Unpin,
<T as Config<I>>::Bias: Unpin,
<T as Config<I>>::Time: Unpin,
<T as Config<I>>::MaxIndexEntries: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceAsset>>::Bound: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceRational>>::Bound: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceTime>>::Bound: Unpin,
<T as Config>::AccountId: Unpin,
<T as Config<I>>::Position: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: Unpin,
impl<T, I> UnsafeUnpin for PoolInfo<T, I>where
<T as Config<I>>::Shares: UnsafeUnpin,
<T as Config<I>>::Commission: UnsafeUnpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<BalanceAddon>>::Repr: UnsafeUnpin,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: UnsafeUnpin,
<T as Config<I>>::Bias: UnsafeUnpin,
<T as Config<I>>::Time: UnsafeUnpin,
impl<T, I> UnwindSafe for PoolInfo<T, I>where
<T as Config<I>>::Shares: UnwindSafe,
<T as Config<I>>::Commission: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<BalanceAddon>>::Repr: UnwindSafe,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: UnwindSafe,
<T as Config<I>>::Bias: UnwindSafe,
<T as Config<I>>::Time: UnwindSafe,
<T as Config<I>>::MaxIndexEntries: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceAsset>>::Bound: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceRational>>::Bound: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<BalanceTime>>::Bound: UnwindSafe,
<T as Config>::AccountId: UnwindSafe,
<T as Config<I>>::Position: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S> Codec for S
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
impl<Provider, Discriminant, T> DelegateVirtualDynBound<Provider, Discriminant> for Twhere
Provider: VirtualDynBound<Discriminant>,
Discriminant: DiscriminantTag,
impl<Provider, Discriminant, T> DelegateVirtualStaticBound<Provider, Discriminant> for Twhere
Provider: VirtualStaticBound<Discriminant>,
Discriminant: DiscriminantTag,
impl<T> Elastic for Twhere
T: RuntimeType + MaxEncodedLen,
impl<T> EncodeLike<&&T> for Twhere
T: Encode,
impl<T> EncodeLike<&T> for Twhere
T: Encode,
impl<T> EncodeLike<&mut T> for Twhere
T: Encode,
impl<T> EncodeLike<Arc<T>> for Twhere
T: Encode,
impl<T> EncodeLike<Box<T>> for Twhere
T: Encode,
impl<T> EncodeLike<Cow<'_, T>> for T
impl<T> EncodeLike<Rc<T>> for Twhere
T: Encode,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<S> FullCodec for Swhere
S: Decode + FullEncode,
impl<S> FullEncode for Swhere
S: Encode + EncodeLike,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U, Tag> IntoTag<U, Tag> for Twhere
U: FromTag<T, Tag>,
Tag: DiscriminantTag,
impl<T, U, Tag> IntoTag<U, Tag> for Twhere
U: FromTag<T, Tag>,
Tag: DiscriminantTag,
Source§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
impl<T> JsonSchemaMaybe for T
Source§impl<T, Time> Logging<Time> for Twhere
Time: Time,
impl<T, Time> Logging<Time> for Twhere
Time: Time,
Source§const FALLBACK_TARGET: &'static str = "routine"
const FALLBACK_TARGET: &'static str = "routine"
Default logging target if none is provided.
Most routines, especially offchain workers or background tasks, use this target for simplicity.
It allows a consistent place to look for routine logs without requiring every call to specify a target.
Note: This target is only a conveninence and may be somewhat vague. To ensure errors can still be traced accurately, the logged messages should include additional metadata (e.g., module name, error index, or contextual info) so that the source of the error can be identified even if the target is generic.
Source§type Logger = DispatchError
type Logger = DispatchError
The type taken and returned for logging.
We simply return the same DispatchError that was logged,
so logging does not change control flow or error propagation.
DispatchError is used because in Substrate it encompasses all
runtime errors - including module errors, token errors, arithmetic
issues, and transactional boundaries - making it the universal
substrate-side error representation.
Source§type Level = LogLevel
type Level = LogLevel
The log level type.
We use the LogLevel enum to standardize severity levels
(Info, Warn, Error, Debug) across all routine logs.
Source§fn log(
level: <T as Logging<Time>>::Level,
err: &<T as Logging<Time>>::Logger,
timestamp: Time,
target: Option<&str>,
fmt: Option<fn(Time, &<T as Logging<Time>>::Level, &str, &str) -> String>,
) -> <T as Logging<Time>>::Logger
fn log( level: <T as Logging<Time>>::Level, err: &<T as Logging<Time>>::Logger, timestamp: Time, target: Option<&str>, fmt: Option<fn(Time, &<T as Logging<Time>>::Level, &str, &str) -> String>, ) -> <T as Logging<Time>>::Logger
Source§fn info(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
fn info(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
Source§fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeRefUnwindSafe for Twhere
T: RefUnwindSafe,
impl<T> Member for T
impl<T> MetaAware for T
impl<T> Portable for T
impl<T> Probe for T
impl<T> RuntimeEnum for T
impl<T> RuntimeType for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moreimpl<T> StaticTypeInfo for Twhere
T: TypeInfo + 'static,
impl<T> Storable for Twhere
T: RuntimeType + 'static + EncodeLike,
Source§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.