pub struct FeeScheduleRegistry { /* private fields */ }Expand description
Every fee schedule the exchange resolves fees from, keyed by
FeeScheduleKey.
Populated on snapshotting with the two exchange-wide schedules
(FeeScheduleKey::Default and FeeScheduleKey::RwaDefault) plus the
custom schedule of every perpetual the snapshot tracks, then kept up to date
by FeeScheduleSet / DefaultPerpFeeScheduleSet /
DefaultRwaFeeScheduleSet.
The registry holds the rates; which schedule a perpetual resolves its fees
from is the perpetual’s own state (the key of
crate::state::Perpetual::fee_schedule), moved only by
PerpFeeSchedIdSet. Rewriting a schedule therefore reaches a perpetual only
if that perpetual is currently pointing at it.
Implementations§
Source§impl FeeScheduleRegistry
impl FeeScheduleRegistry
Sourcepub fn default_schedule(&self) -> FeeSchedule
pub fn default_schedule(&self) -> FeeSchedule
Exchange-wide default schedule, shared by every perpetual contract that has not been repointed at another one.
Sourcepub fn rwa_default_schedule(&self) -> FeeSchedule
pub fn rwa_default_schedule(&self) -> FeeSchedule
Exchange-wide default schedule for real-world assets.
Sourcepub fn custom_schedules(&self) -> &HashMap<PerpetualId, FeeSchedule>
pub fn custom_schedules(&self) -> &HashMap<PerpetualId, FeeSchedule>
Custom schedules, by the id of the perpetual contract each is keyed by.
Covers the perpetuals known when the snapshot was built, plus any picked
up from a FeeScheduleSet since; a perpetual listed after the snapshot
appears here only once its own schedule is written.
Sourcepub fn schedules(&self) -> impl Iterator<Item = FeeSchedule>
pub fn schedules(&self) -> impl Iterator<Item = FeeSchedule>
Every registered schedule: the exchange-wide default, the RWA default, then the custom ones ordered by the perpetual id each is keyed by.
Sourcepub fn get(&self, key: FeeScheduleKey) -> Option<FeeSchedule>
pub fn get(&self, key: FeeScheduleKey) -> Option<FeeSchedule>
Schedule registered under the given key, None for a custom schedule
that has never been observed.
Trait Implementations§
Source§impl Clone for FeeScheduleRegistry
impl Clone for FeeScheduleRegistry
Source§fn clone(&self) -> FeeScheduleRegistry
fn clone(&self) -> FeeScheduleRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FeeScheduleRegistry
impl RefUnwindSafe for FeeScheduleRegistry
impl Send for FeeScheduleRegistry
impl Sync for FeeScheduleRegistry
impl Unpin for FeeScheduleRegistry
impl UnsafeUnpin for FeeScheduleRegistry
impl UnwindSafe for FeeScheduleRegistry
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more