Skip to main content

PerpManagerInstance

Struct PerpManagerInstance 

Source
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.

Source

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.

Source

pub const fn address(&self) -> &Address

Returns a reference to the address.

Source

pub fn set_address(&mut self, address: Address)

Sets the address.

Source

pub fn at(self, address: Address) -> Self

Sets the address and returns self.

Source

pub const fn provider(&self) -> &P

Returns a reference to the provider.

Source§

impl<P: Clone, N> PerpManagerInstance<&P, N>

Source

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.

Source

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.

Source

pub fn createPerp( &self, params: <CreatePerpParams as SolType>::RustType, ) -> SolCallBuilder<&P, createPerpCall, N>

Creates a new call builder for the [createPerp] function.

Source

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.

Source

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.

Source

pub fn adjustNotional( &self, params: <AdjustNotionalParams as SolType>::RustType, ) -> SolCallBuilder<&P, adjustNotionalCall, N>

Creates a new call builder for the [adjustNotional] function.

Source

pub fn adjustMargin( &self, params: <AdjustMarginParams as SolType>::RustType, ) -> SolCallBuilder<&P, adjustMarginCall, N>

Creates a new call builder for the [adjustMargin] function.

Source

pub fn closePosition( &self, params: <ClosePositionParams as SolType>::RustType, ) -> SolCallBuilder<&P, closePositionCall, N>

Creates a new call builder for the [closePosition] function.

Source

pub fn increaseCardinalityCap( &self, perpId: FixedBytes<32>, newCardinalityCap: u16, ) -> SolCallBuilder<&P, increaseCardinalityCapCall, N>

Creates a new call builder for the [increaseCardinalityCap] function.

Source

pub fn registerFeesModule( &self, feesModule: Address, ) -> SolCallBuilder<&P, registerFeesModuleCall, N>

Creates a new call builder for the [registerFeesModule] function.

Source

pub fn registerMarginRatiosModule( &self, marginRatiosModule: Address, ) -> SolCallBuilder<&P, registerMarginRatiosModuleCall, N>

Creates a new call builder for the [registerMarginRatiosModule] function.

Source

pub fn registerLockupPeriodModule( &self, lockupPeriodModule: Address, ) -> SolCallBuilder<&P, registerLockupPeriodModuleCall, N>

Creates a new call builder for the [registerLockupPeriodModule] function.

Source

pub fn registerSqrtPriceImpactLimitModule( &self, sqrtPriceImpactLimitModule: Address, ) -> SolCallBuilder<&P, registerSqrtPriceImpactLimitModuleCall, N>

Creates a new call builder for the [registerSqrtPriceImpactLimitModule] function.

Source

pub fn isFeesRegistered( &self, feesModule: Address, ) -> SolCallBuilder<&P, isFeesRegisteredCall, N>

Creates a new call builder for the [isFeesRegistered] function.

Source

pub fn isMarginRatiosRegistered( &self, marginRatiosModule: Address, ) -> SolCallBuilder<&P, isMarginRatiosRegisteredCall, N>

Creates a new call builder for the [isMarginRatiosRegistered] function.

Source

pub fn isLockupPeriodRegistered( &self, lockupPeriodModule: Address, ) -> SolCallBuilder<&P, isLockupPeriodRegisteredCall, N>

Creates a new call builder for the [isLockupPeriodRegistered] function.

Source

pub fn isSqrtPriceImpactLimitRegistered( &self, sqrtPriceImpactLimitModule: Address, ) -> SolCallBuilder<&P, isSqrtPriceImpactLimitRegisteredCall, N>

Creates a new call builder for the [isSqrtPriceImpactLimitRegistered] function.

Source

pub fn setProtocolFee( &self, newProtocolFee: U24, ) -> SolCallBuilder<&P, setProtocolFeeCall, N>

Creates a new call builder for the [setProtocolFee] function.

Source

pub fn collectProtocolFees( &self, recipient: Address, ) -> SolCallBuilder<&P, collectProtocolFeesCall, N>

Creates a new call builder for the [collectProtocolFees] function.

Source

pub fn cfgs(&self, perpId: FixedBytes<32>) -> SolCallBuilder<&P, cfgsCall, N>

Creates a new call builder for the [cfgs] function.

Source

pub fn positions(&self, posId: U256) -> SolCallBuilder<&P, positionsCall, N>

Creates a new call builder for the [positions] function.

Source

pub fn nextPosId(&self) -> SolCallBuilder<&P, nextPosIdCall, N>

Creates a new call builder for the [nextPosId] function.

Source

pub fn protocolFee(&self) -> SolCallBuilder<&P, protocolFeeCall, N>

Creates a new call builder for the [protocolFee] function.

Source

pub fn cardinalityCap( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, cardinalityCapCall, N>

Creates a new call builder for the [cardinalityCap] function.

Source

pub fn timeWeightedAvgSqrtPriceX96( &self, perpId: FixedBytes<32>, lookbackWindow: u32, ) -> SolCallBuilder<&P, timeWeightedAvgSqrtPriceX96Call, N>

Creates a new call builder for the [timeWeightedAvgSqrtPriceX96] function.

Source

pub fn fundingPerSecondX96( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, fundingPerSecondX96Call, N>

Creates a new call builder for the [fundingPerSecondX96] function.

Source

pub fn utilFeePerSecX96( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, utilFeePerSecX96Call, N>

Creates a new call builder for the [utilFeePerSecX96] function.

Source

pub fn insurance( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, insuranceCall, N>

Creates a new call builder for the [insurance] function.

Source

pub fn takerOpenInterest( &self, perpId: FixedBytes<32>, ) -> SolCallBuilder<&P, takerOpenInterestCall, N>

Creates a new call builder for the [takerOpenInterest] function.

Source

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.

Source

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.

Source

pub fn quoteClosePosition( &self, posId: U256, ) -> SolCallBuilder<&P, quoteClosePositionCall, N>

Creates a new call builder for the [quoteClosePosition] function.

Source

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.

Source

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.

Source

pub fn name(&self) -> SolCallBuilder<&P, nameCall, N>

Creates a new call builder for the [name] function.

Source

pub fn symbol(&self) -> SolCallBuilder<&P, symbolCall, N>

Creates a new call builder for the [symbol] function.

Source

pub fn tokenURI(&self, tokenId: U256) -> SolCallBuilder<&P, tokenURICall, N>

Creates a new call builder for the [tokenURI] function.

Source

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.

Source

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.

Source

pub fn PerpCreated_filter(&self) -> Event<&P, PerpCreated, N>

Creates a new event filter for the PerpCreated event.

Source

pub fn PositionOpened_filter(&self) -> Event<&P, PositionOpened, N>

Creates a new event filter for the PositionOpened event.

Source

pub fn NotionalAdjusted_filter(&self) -> Event<&P, NotionalAdjusted, N>

Creates a new event filter for the NotionalAdjusted event.

Source

pub fn MarginAdjusted_filter(&self) -> Event<&P, MarginAdjusted, N>

Creates a new event filter for the MarginAdjusted event.

Source

pub fn PositionClosed_filter(&self) -> Event<&P, PositionClosed, N>

Creates a new event filter for the PositionClosed event.

Source

pub fn FeesModuleRegistered_filter(&self) -> Event<&P, FeesModuleRegistered, N>

Creates a new event filter for the FeesModuleRegistered event.

Source

pub fn MarginRatiosModuleRegistered_filter( &self, ) -> Event<&P, MarginRatiosModuleRegistered, N>

Creates a new event filter for the MarginRatiosModuleRegistered event.

Source

pub fn LockupPeriodModuleRegistered_filter( &self, ) -> Event<&P, LockupPeriodModuleRegistered, N>

Creates a new event filter for the LockupPeriodModuleRegistered event.

Source

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>

Source§

fn clone(&self) -> PerpManagerInstance<P, N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P, N> Debug for PerpManagerInstance<P, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P, N> Freeze for PerpManagerInstance<P, N>
where P: Freeze,

§

impl<P, N> RefUnwindSafe for PerpManagerInstance<P, N>

§

impl<P, N> Send for PerpManagerInstance<P, N>
where P: Send, N: Send,

§

impl<P, N> Sync for PerpManagerInstance<P, N>
where P: Sync, N: Sync,

§

impl<P, N> Unpin for PerpManagerInstance<P, N>
where P: Unpin, N: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more