pub struct Chain { /* private fields */ }Expand description
Chain the exchange is operating on.
Implementations§
Source§impl Chain
impl Chain
pub fn mainnet() -> Self
pub fn testnet() -> Self
Sourcepub fn custom(
chain_id: u64,
collateral_token: Address,
deployed_at_block: u64,
exchange: Address,
perpetuals: Vec<PerpetualId>,
) -> Self
pub fn custom( chain_id: u64, collateral_token: Address, deployed_at_block: u64, exchange: Address, perpetuals: Vec<PerpetualId>, ) -> Self
Chain the exchange is operating on, with the perpetual contracts to track.
An empty perpetuals list means every perpetual listed on the
exchange, discovered on-chain - see Chain::perpetuals.
pub fn chain_id(&self) -> u64
pub fn collateral_token(&self) -> Address
pub fn deployed_at_block(&self) -> u64
pub fn exchange(&self) -> Address
Sourcepub fn perpetuals(&self) -> &[PerpetualId] ⓘ
pub fn perpetuals(&self) -> &[PerpetualId] ⓘ
Perpetual contracts to track, empty (the default) meaning every perpetual listed on the exchange.
The exchange reports the set of listed contracts on-chain, so the SDK
does not need to be told: an empty list makes
state::SnapshotBuilder discover them at snapshot time. Configure it
explicitly only to deliberately track a subset.
Sourcepub fn with_perpetuals(self, perpetuals: Vec<PerpetualId>) -> Self
pub fn with_perpetuals(self, perpetuals: Vec<PerpetualId>) -> Self
Same chain, tracking only the given subset of perpetual contracts.
Sourcepub fn excluded_perpetuals(&self) -> &[PerpetualId] ⓘ
pub fn excluded_perpetuals(&self) -> &[PerpetualId] ⓘ
Perpetual contracts to leave out of on-chain discovery.
Applies to discovery only: an explicitly configured
Chain::perpetuals list is taken as given, exclusions and all, since
naming a contract is a clearer statement of intent than the default set
it would otherwise be filtered out of.
Sourcepub fn with_excluded_perpetuals(self, perpetuals: Vec<PerpetualId>) -> Self
pub fn with_excluded_perpetuals(self, perpetuals: Vec<PerpetualId>) -> Self
Same chain, skipping the given perpetual contracts when discovering the
set to track - see Chain::excluded_perpetuals.
Replaces the chain’s default exclusions rather than adding to them, so passing an empty list discovers everything the exchange lists.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chain
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnsafeUnpin for Chain
impl UnwindSafe for Chain
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