Skip to main content

TestPerp

Struct TestPerp 

Source
pub struct TestPerp<'e> {
    pub id: PerpetualId,
    pub name: String,
    pub price_converter: Converter,
    pub size_converter: Converter,
    pub leverage_converter: Converter,
    pub exchange: &'e TestExchange,
}

Fields§

§id: PerpetualId§name: String§price_converter: Converter§size_converter: Converter§leverage_converter: Converter§exchange: &'e TestExchange

Implementations§

Source§

impl<'e> TestPerp<'e>

Source

pub async fn with_mark_price(self, price: UD64) -> Self

Source

pub async fn with_min_post(self, min: U256) -> Self

Source

pub async fn with_min_settle(self, min: U256) -> Self

Source

pub async fn unpause(self) -> Self

Source

pub async fn set_maintenance_margin( &self, maintenance_margin: UD64, ) -> PendingTransactionBuilder<Ethereum>

Source

pub async fn set_mark_price( &self, price: UD64, ) -> PendingTransactionBuilder<Ethereum>

Source

pub async fn set_funding_rate( &self, price: u32, rate: i32, ) -> PendingTransactionBuilder<Ethereum>

Source

pub async fn with_legacy_fees(self, taker_fee: UD64, maker_fee: UD64) -> Self

Sets this contract’s fees through the pre-v1.1.7.4 per-contract setters, for use with TestExchange::new_at_previous_version.

The current contract has no equivalent - fees live in the keyed schedules and these setters were removed - so this reverts against it. Emits the deprecated TakerFeeUpdated/MakerFeeUpdated events.

Source

pub async fn set_fee_schedule( &self, taker_fees: [UD64; 8], maker_fees: [UD64; 8], ) -> PendingTransactionBuilder<Ethereum>

Sets a custom fee schedule for this perpetual contract, eight (taker, maker) rates indexed by an account’s fee tier.

v1.1.7.4 split the one-shot custom-schedule setter into value-set + repoint, done here back to back. Use Self::set_own_fee_schedule_values and Self::use_own_fee_schedule to exercise the two halves apart.

Source

pub async fn set_own_fee_schedule_values( &self, taker_fees: [UD64; 8], maker_fees: [UD64; 8], )

Writes the rates of the schedule keyed by this contract’s id, without pointing the contract at it - schedule values and the pointer into them are independent.

Source

pub async fn use_own_fee_schedule(&self) -> PendingTransactionBuilder<Ethereum>

Points this perpetual contract at the schedule keyed by its own id, see Self::set_own_fee_schedule_values.

Source

pub async fn set_rwa_default_fee(&self) -> PendingTransactionBuilder<Ethereum>

Repoints this perpetual contract at the exchange-wide RWA default fee schedule.

Source

pub async fn order( &self, account_id: AccountId, request: OrderRequest, ) -> PendingTransactionBuilder<Ethereum>

Posts an order via the V1 entrypoint, which carries no builder attribution.

Source

pub async fn order_v2( &self, account_id: AccountId, request: OrderRequest, ) -> PendingTransactionBuilder<Ethereum>

Posts an order via the V2 entrypoint, carrying the request’s builder attribution if any.

Source

pub async fn orders_v2( &self, account_id: AccountId, requests: Vec<OrderRequest>, revert_on_fail: bool, ) -> PendingTransactionBuilder<Ethereum>

Posts a batch of orders via the V2 entrypoint, carrying each request’s builder attribution if any.

Source

pub async fn orders( &self, account_id: AccountId, requests: Vec<OrderRequest>, ) -> PendingTransactionBuilder<Ethereum>

Trait Implementations§

Source§

impl<'e> Debug for TestPerp<'e>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'e> !RefUnwindSafe for TestPerp<'e>

§

impl<'e> !UnwindSafe for TestPerp<'e>

§

impl<'e> Freeze for TestPerp<'e>

§

impl<'e> Send for TestPerp<'e>

§

impl<'e> Sync for TestPerp<'e>

§

impl<'e> Unpin for TestPerp<'e>

§

impl<'e> UnsafeUnpin for TestPerp<'e>

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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> 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: Sized + 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: Sized + 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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