pub struct PerpManagerInstance<P, N = Ethereum> { /* private fields */ }Expand description
A PerpManager instance.
Contains type-safe methods for interacting with an on-chain instance of the
PerpManager contract located at a given address, using a given
provider P.
If the contract bytecode is available (see the sol!
documentation on how to provide it), the deploy and deploy_builder methods can
be used to deploy a new instance of the contract.
See the module-level documentation for all the available methods.
Implementations§
Source§impl<P: Provider<N>, N: Network> PerpManagerInstance<P, N>
Instantiation and getters/setters.
impl<P: Provider<N>, N: Network> PerpManagerInstance<P, N>
Instantiation and getters/setters.
Sourcepub const fn new(address: Address, __provider: P) -> Self
pub const fn new(address: Address, __provider: P) -> Self
Creates a new wrapper around an on-chain PerpManager contract instance.
See the wrapper’s documentation for more details.
Sourcepub fn set_address(&mut self, address: Address)
pub fn set_address(&mut self, address: Address)
Sets the address.
Source§impl<P: Clone, N> PerpManagerInstance<&P, N>
impl<P: Clone, N> PerpManagerInstance<&P, N>
Sourcepub fn with_cloned_provider(self) -> PerpManagerInstance<P, N>
pub fn with_cloned_provider(self) -> PerpManagerInstance<P, N>
Clones the provider and returns a new instance with the cloned provider.
Source§impl<P: Provider<N>, N: Network> PerpManagerInstance<P, N>
Function calls.
impl<P: Provider<N>, N: Network> PerpManagerInstance<P, N>
Function calls.
Sourcepub fn call_builder<C: SolCall>(&self, call: &C) -> SolCallBuilder<&P, C, N>
pub fn call_builder<C: SolCall>(&self, call: &C) -> SolCallBuilder<&P, C, N>
Creates a new call builder using this contract instance’s provider and address.
Note that the call can be any function call, not just those defined in this contract. Prefer using the other methods for building type-safe contract calls.
Sourcepub fn createPerp(
&self,
params: <CreatePerpParams as SolType>::RustType,
) -> SolCallBuilder<&P, createPerpCall, N>
pub fn createPerp( &self, params: <CreatePerpParams as SolType>::RustType, ) -> SolCallBuilder<&P, createPerpCall, N>
Creates a new call builder for the [createPerp] function.
Sourcepub fn openMakerPos(
&self,
perpId: FixedBytes<32>,
params: <OpenMakerPositionParams as SolType>::RustType,
) -> SolCallBuilder<&P, openMakerPosCall, N>
pub fn openMakerPos( &self, perpId: FixedBytes<32>, params: <OpenMakerPositionParams as SolType>::RustType, ) -> SolCallBuilder<&P, openMakerPosCall, N>
Creates a new call builder for the [openMakerPos] function.
Sourcepub fn openTakerPos(
&self,
perpId: FixedBytes<32>,
params: <OpenTakerPositionParams as SolType>::RustType,
) -> SolCallBuilder<&P, openTakerPosCall, N>
pub fn openTakerPos( &self, perpId: FixedBytes<32>, params: <OpenTakerPositionParams as SolType>::RustType, ) -> SolCallBuilder<&P, openTakerPosCall, N>
Creates a new call builder for the [openTakerPos] function.
Sourcepub fn adjustNotional(
&self,
params: <AdjustNotionalParams as SolType>::RustType,
) -> SolCallBuilder<&P, adjustNotionalCall, N>
pub fn adjustNotional( &self, params: <AdjustNotionalParams as SolType>::RustType, ) -> SolCallBuilder<&P, adjustNotionalCall, N>
Creates a new call builder for the [adjustNotional] function.
Sourcepub fn adjustMargin(
&self,
params: <AdjustMarginParams as SolType>::RustType,
) -> SolCallBuilder<&P, adjustMarginCall, N>
pub fn adjustMargin( &self, params: <AdjustMarginParams as SolType>::RustType, ) -> SolCallBuilder<&P, adjustMarginCall, N>
Creates a new call builder for the [adjustMargin] function.
Sourcepub fn closePosition(
&self,
params: <ClosePositionParams as SolType>::RustType,
) -> SolCallBuilder<&P, closePositionCall, N>
pub fn closePosition( &self, params: <ClosePositionParams as SolType>::RustType, ) -> SolCallBuilder<&P, closePositionCall, N>
Creates a new call builder for the [closePosition] function.
Sourcepub fn increaseCardinalityCap(
&self,
perpId: FixedBytes<32>,
newCardinalityCap: u16,
) -> SolCallBuilder<&P, increaseCardinalityCapCall, N>
pub fn increaseCardinalityCap( &self, perpId: FixedBytes<32>, newCardinalityCap: u16, ) -> SolCallBuilder<&P, increaseCardinalityCapCall, N>
Creates a new call builder for the [increaseCardinalityCap] function.
Sourcepub fn registerFeesModule(
&self,
feesModule: Address,
) -> SolCallBuilder<&P, registerFeesModuleCall, N>
pub fn registerFeesModule( &self, feesModule: Address, ) -> SolCallBuilder<&P, registerFeesModuleCall, N>
Creates a new call builder for the [registerFeesModule] function.
Sourcepub fn registerMarginRatiosModule(
&self,
marginRatiosModule: Address,
) -> SolCallBuilder<&P, registerMarginRatiosModuleCall, N>
pub fn registerMarginRatiosModule( &self, marginRatiosModule: Address, ) -> SolCallBuilder<&P, registerMarginRatiosModuleCall, N>
Creates a new call builder for the [registerMarginRatiosModule] function.
Sourcepub fn registerLockupPeriodModule(
&self,
lockupPeriodModule: Address,
) -> SolCallBuilder<&P, registerLockupPeriodModuleCall, N>
pub fn registerLockupPeriodModule( &self, lockupPeriodModule: Address, ) -> SolCallBuilder<&P, registerLockupPeriodModuleCall, N>
Creates a new call builder for the [registerLockupPeriodModule] function.
Sourcepub fn registerSqrtPriceImpactLimitModule(
&self,
sqrtPriceImpactLimitModule: Address,
) -> SolCallBuilder<&P, registerSqrtPriceImpactLimitModuleCall, N>
pub fn registerSqrtPriceImpactLimitModule( &self, sqrtPriceImpactLimitModule: Address, ) -> SolCallBuilder<&P, registerSqrtPriceImpactLimitModuleCall, N>
Creates a new call builder for the [registerSqrtPriceImpactLimitModule] function.
Sourcepub fn isFeesRegistered(
&self,
feesModule: Address,
) -> SolCallBuilder<&P, isFeesRegisteredCall, N>
pub fn isFeesRegistered( &self, feesModule: Address, ) -> SolCallBuilder<&P, isFeesRegisteredCall, N>
Creates a new call builder for the [isFeesRegistered] function.
Sourcepub fn isMarginRatiosRegistered(
&self,
marginRatiosModule: Address,
) -> SolCallBuilder<&P, isMarginRatiosRegisteredCall, N>
pub fn isMarginRatiosRegistered( &self, marginRatiosModule: Address, ) -> SolCallBuilder<&P, isMarginRatiosRegisteredCall, N>
Creates a new call builder for the [isMarginRatiosRegistered] function.
Sourcepub fn isLockupPeriodRegistered(
&self,
lockupPeriodModule: Address,
) -> SolCallBuilder<&P, isLockupPeriodRegisteredCall, N>
pub fn isLockupPeriodRegistered( &self, lockupPeriodModule: Address, ) -> SolCallBuilder<&P, isLockupPeriodRegisteredCall, N>
Creates a new call builder for the [isLockupPeriodRegistered] function.
Sourcepub fn isSqrtPriceImpactLimitRegistered(
&self,
sqrtPriceImpactLimitModule: Address,
) -> SolCallBuilder<&P, isSqrtPriceImpactLimitRegisteredCall, N>
pub fn isSqrtPriceImpactLimitRegistered( &self, sqrtPriceImpactLimitModule: Address, ) -> SolCallBuilder<&P, isSqrtPriceImpactLimitRegisteredCall, N>
Creates a new call builder for the [isSqrtPriceImpactLimitRegistered] function.
Sourcepub fn setProtocolFee(
&self,
newProtocolFee: U24,
) -> SolCallBuilder<&P, setProtocolFeeCall, N>
pub fn setProtocolFee( &self, newProtocolFee: U24, ) -> SolCallBuilder<&P, setProtocolFeeCall, N>
Creates a new call builder for the [setProtocolFee] function.
Sourcepub fn collectProtocolFees(
&self,
recipient: Address,
) -> SolCallBuilder<&P, collectProtocolFeesCall, N>
pub fn collectProtocolFees( &self, recipient: Address, ) -> SolCallBuilder<&P, collectProtocolFeesCall, N>
Creates a new call builder for the [collectProtocolFees] function.
Sourcepub fn cfgs(&self, perpId: FixedBytes<32>) -> SolCallBuilder<&P, cfgsCall, N>
pub fn cfgs(&self, perpId: FixedBytes<32>) -> SolCallBuilder<&P, cfgsCall, N>
Creates a new call builder for the [cfgs] function.
Sourcepub fn positions(&self, posId: U256) -> SolCallBuilder<&P, positionsCall, N>
pub fn positions(&self, posId: U256) -> SolCallBuilder<&P, positionsCall, N>
Creates a new call builder for the [positions] function.
Sourcepub fn nextPosId(&self) -> SolCallBuilder<&P, nextPosIdCall, N>
pub fn nextPosId(&self) -> SolCallBuilder<&P, nextPosIdCall, N>
Creates a new call builder for the [nextPosId] function.
Sourcepub fn protocolFee(&self) -> SolCallBuilder<&P, protocolFeeCall, N>
pub fn protocolFee(&self) -> SolCallBuilder<&P, protocolFeeCall, N>
Creates a new call builder for the [protocolFee] function.
Sourcepub fn cardinalityCap(
&self,
perpId: FixedBytes<32>,
) -> SolCallBuilder<&P, cardinalityCapCall, N>
pub fn cardinalityCap( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, cardinalityCapCall, N>
Creates a new call builder for the [cardinalityCap] function.
Sourcepub fn timeWeightedAvgSqrtPriceX96(
&self,
perpId: FixedBytes<32>,
lookbackWindow: u32,
) -> SolCallBuilder<&P, timeWeightedAvgSqrtPriceX96Call, N>
pub fn timeWeightedAvgSqrtPriceX96( &self, perpId: FixedBytes<32>, lookbackWindow: u32, ) -> SolCallBuilder<&P, timeWeightedAvgSqrtPriceX96Call, N>
Creates a new call builder for the [timeWeightedAvgSqrtPriceX96] function.
Sourcepub fn fundingPerSecondX96(
&self,
perpId: FixedBytes<32>,
) -> SolCallBuilder<&P, fundingPerSecondX96Call, N>
pub fn fundingPerSecondX96( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, fundingPerSecondX96Call, N>
Creates a new call builder for the [fundingPerSecondX96] function.
Sourcepub fn utilFeePerSecX96(
&self,
perpId: FixedBytes<32>,
) -> SolCallBuilder<&P, utilFeePerSecX96Call, N>
pub fn utilFeePerSecX96( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, utilFeePerSecX96Call, N>
Creates a new call builder for the [utilFeePerSecX96] function.
Sourcepub fn insurance(
&self,
perpId: FixedBytes<32>,
) -> SolCallBuilder<&P, insuranceCall, N>
pub fn insurance( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, insuranceCall, N>
Creates a new call builder for the [insurance] function.
Sourcepub fn takerOpenInterest(
&self,
perpId: FixedBytes<32>,
) -> SolCallBuilder<&P, takerOpenInterestCall, N>
pub fn takerOpenInterest( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, takerOpenInterestCall, N>
Creates a new call builder for the [takerOpenInterest] function.
Sourcepub fn quoteOpenMakerPosition(
&self,
perpId: FixedBytes<32>,
params: <OpenMakerPositionParams as SolType>::RustType,
) -> SolCallBuilder<&P, quoteOpenMakerPositionCall, N>
pub fn quoteOpenMakerPosition( &self, perpId: FixedBytes<32>, params: <OpenMakerPositionParams as SolType>::RustType, ) -> SolCallBuilder<&P, quoteOpenMakerPositionCall, N>
Creates a new call builder for the [quoteOpenMakerPosition] function.
Sourcepub fn quoteOpenTakerPosition(
&self,
perpId: FixedBytes<32>,
params: <OpenTakerPositionParams as SolType>::RustType,
) -> SolCallBuilder<&P, quoteOpenTakerPositionCall, N>
pub fn quoteOpenTakerPosition( &self, perpId: FixedBytes<32>, params: <OpenTakerPositionParams as SolType>::RustType, ) -> SolCallBuilder<&P, quoteOpenTakerPositionCall, N>
Creates a new call builder for the [quoteOpenTakerPosition] function.
Sourcepub fn quoteClosePosition(
&self,
posId: U256,
) -> SolCallBuilder<&P, quoteClosePositionCall, N>
pub fn quoteClosePosition( &self, posId: U256, ) -> SolCallBuilder<&P, quoteClosePositionCall, N>
Creates a new call builder for the [quoteClosePosition] function.
Sourcepub fn quoteSwap(
&self,
perpId: FixedBytes<32>,
zeroForOne: bool,
isExactIn: bool,
amount: U256,
sqrtPriceLimitX96: U160,
) -> SolCallBuilder<&P, quoteSwapCall, N>
pub fn quoteSwap( &self, perpId: FixedBytes<32>, zeroForOne: bool, isExactIn: bool, amount: U256, sqrtPriceLimitX96: U160, ) -> SolCallBuilder<&P, quoteSwapCall, N>
Creates a new call builder for the [quoteSwap] function.
Sourcepub fn quoteTwoSwaps(
&self,
perpId: FixedBytes<32>,
first: <SwapConfig as SolType>::RustType,
second: <SwapConfig as SolType>::RustType,
) -> SolCallBuilder<&P, quoteTwoSwapsCall, N>
pub fn quoteTwoSwaps( &self, perpId: FixedBytes<32>, first: <SwapConfig as SolType>::RustType, second: <SwapConfig as SolType>::RustType, ) -> SolCallBuilder<&P, quoteTwoSwapsCall, N>
Creates a new call builder for the [quoteTwoSwaps] function.
Sourcepub fn name(&self) -> SolCallBuilder<&P, nameCall, N>
pub fn name(&self) -> SolCallBuilder<&P, nameCall, N>
Creates a new call builder for the [name] function.
Sourcepub fn symbol(&self) -> SolCallBuilder<&P, symbolCall, N>
pub fn symbol(&self) -> SolCallBuilder<&P, symbolCall, N>
Creates a new call builder for the [symbol] function.
Sourcepub fn tokenURI(&self, tokenId: U256) -> SolCallBuilder<&P, tokenURICall, N>
pub fn tokenURI(&self, tokenId: U256) -> SolCallBuilder<&P, tokenURICall, N>
Creates a new call builder for the [tokenURI] function.
Sourcepub fn ownerOf(&self, tokenId: U256) -> SolCallBuilder<&P, ownerOfCall, N>
pub fn ownerOf(&self, tokenId: U256) -> SolCallBuilder<&P, ownerOfCall, N>
Creates a new call builder for the [ownerOf] function.
Source§impl<P: Provider<N>, N: Network> PerpManagerInstance<P, N>
Event filters.
impl<P: Provider<N>, N: Network> PerpManagerInstance<P, N>
Event filters.
Sourcepub fn event_filter<E: SolEvent>(&self) -> Event<&P, E, N>
pub fn event_filter<E: SolEvent>(&self) -> Event<&P, E, N>
Creates a new event filter using this contract instance’s provider and address.
Note that the type can be any event, not just those defined in this contract. Prefer using the other methods for building type-safe event filters.
Sourcepub fn PerpCreated_filter(&self) -> Event<&P, PerpCreated, N>
pub fn PerpCreated_filter(&self) -> Event<&P, PerpCreated, N>
Creates a new event filter for the PerpCreated event.
Sourcepub fn PositionOpened_filter(&self) -> Event<&P, PositionOpened, N>
pub fn PositionOpened_filter(&self) -> Event<&P, PositionOpened, N>
Creates a new event filter for the PositionOpened event.
Sourcepub fn NotionalAdjusted_filter(&self) -> Event<&P, NotionalAdjusted, N>
pub fn NotionalAdjusted_filter(&self) -> Event<&P, NotionalAdjusted, N>
Creates a new event filter for the NotionalAdjusted event.
Sourcepub fn MarginAdjusted_filter(&self) -> Event<&P, MarginAdjusted, N>
pub fn MarginAdjusted_filter(&self) -> Event<&P, MarginAdjusted, N>
Creates a new event filter for the MarginAdjusted event.
Sourcepub fn PositionClosed_filter(&self) -> Event<&P, PositionClosed, N>
pub fn PositionClosed_filter(&self) -> Event<&P, PositionClosed, N>
Creates a new event filter for the PositionClosed event.
Sourcepub fn FeesModuleRegistered_filter(&self) -> Event<&P, FeesModuleRegistered, N>
pub fn FeesModuleRegistered_filter(&self) -> Event<&P, FeesModuleRegistered, N>
Creates a new event filter for the FeesModuleRegistered event.
Sourcepub fn MarginRatiosModuleRegistered_filter(
&self,
) -> Event<&P, MarginRatiosModuleRegistered, N>
pub fn MarginRatiosModuleRegistered_filter( &self, ) -> Event<&P, MarginRatiosModuleRegistered, N>
Creates a new event filter for the MarginRatiosModuleRegistered event.
Sourcepub fn LockupPeriodModuleRegistered_filter(
&self,
) -> Event<&P, LockupPeriodModuleRegistered, N>
pub fn LockupPeriodModuleRegistered_filter( &self, ) -> Event<&P, LockupPeriodModuleRegistered, N>
Creates a new event filter for the LockupPeriodModuleRegistered event.
Sourcepub fn SqrtPriceImpactLimitModuleRegistered_filter(
&self,
) -> Event<&P, SqrtPriceImpactLimitModuleRegistered, N>
pub fn SqrtPriceImpactLimitModuleRegistered_filter( &self, ) -> Event<&P, SqrtPriceImpactLimitModuleRegistered, N>
Creates a new event filter for the SqrtPriceImpactLimitModuleRegistered event.
Trait Implementations§
Source§impl<P: Clone, N: Clone> Clone for PerpManagerInstance<P, N>
impl<P: Clone, N: Clone> Clone for PerpManagerInstance<P, N>
Source§fn clone(&self) -> PerpManagerInstance<P, N>
fn clone(&self) -> PerpManagerInstance<P, N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<P, N> Freeze for PerpManagerInstance<P, N>where
P: Freeze,
impl<P, N> RefUnwindSafe for PerpManagerInstance<P, N>where
P: RefUnwindSafe,
N: RefUnwindSafe,
impl<P, N> Send for PerpManagerInstance<P, N>
impl<P, N> Sync for PerpManagerInstance<P, N>
impl<P, N> Unpin for PerpManagerInstance<P, N>
impl<P, N> UnsafeUnpin for PerpManagerInstance<P, N>where
P: UnsafeUnpin,
impl<P, N> UnwindSafe for PerpManagerInstance<P, N>where
P: UnwindSafe,
N: 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> 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