Enum levana_perpswap_cosmos::prelude::MarketError

source ·
pub enum MarketError {
Show 26 variants InvalidInfiniteMaxGains { market_type: MarketType, direction: DirectionToBase, }, InvalidInfiniteTakeProfitPrice { market_type: MarketType, direction: DirectionToBase, }, MaxGainsTooLarge {}, WithdrawTooMuch { requested: NonZero<LpToken>, available: NonZero<LpToken>, }, InsufficientLiquidityForWithdrawal { requested_lp: NonZero<LpToken>, requested_collateral: NonZero<Collateral>, unlocked: Collateral, }, MissingPosition { id: String, }, TraderLeverageOutOfRange { low_allowed: Decimal256, high_allowed: Decimal256, new_leverage: Decimal256, current_leverage: Option<Decimal256>, }, CounterLeverageOutOfRange { low_allowed: Decimal256, high_allowed: Decimal256, new_leverage: Decimal256, current_leverage: Option<Decimal256>, }, MinimumDeposit { deposit_collateral: Collateral, deposit_usd: Usd, minimum_usd: Usd, }, Congestion { current_queue: u32, max_size: u32, reason: CongestionReason, }, MaxLiquidity { price_collateral_in_usd: PriceCollateralInUsd, current: Usd, deposit: Usd, max: Usd, }, DeltaNeutralityFeeAlreadyLong { cap: Number, sensitivity: Number, instant_before: Number, net_notional_before: Signed<Notional>, net_notional_after: Signed<Notional>, }, DeltaNeutralityFeeAlreadyShort { cap: Number, sensitivity: Number, instant_before: Number, net_notional_before: Signed<Notional>, net_notional_after: Signed<Notional>, }, DeltaNeutralityFeeNewlyLong { cap: Number, sensitivity: Number, instant_after: Number, net_notional_before: Signed<Notional>, net_notional_after: Signed<Notional>, }, DeltaNeutralityFeeNewlyShort { cap: Number, sensitivity: Number, instant_after: Number, net_notional_before: Signed<Notional>, net_notional_after: Signed<Notional>, }, DeltaNeutralityFeeLongToShort { cap: Number, sensitivity: Number, instant_before: Number, instant_after: Number, net_notional_before: Signed<Notional>, net_notional_after: Signed<Notional>, }, DeltaNeutralityFeeShortToLong { cap: Number, sensitivity: Number, instant_before: Number, instant_after: Number, net_notional_before: Signed<Notional>, net_notional_after: Signed<Notional>, }, LiquidityCooldown { ends_at: Timestamp, seconds_remaining: u64, }, PendingDeferredExec {}, VolatilePriceFeedTimeDelta { oldest: Timestamp, newest: Timestamp, }, LimitOrderAlreadyCanceling { order_id: Uint64, }, PositionAlreadyClosing { position_id: Uint64, }, NoPricePublishTimeFound, PositionAlreadyClosed { id: Uint64, close_time: Timestamp, reason: String, }, InsufficientLiquidityForUnlock { requested: NonZero<Collateral>, total_locked: Collateral, }, Liquidity { requested: NonZero<Collateral>, total_unlocked: Collateral, allowed: Collateral, },
}
Expand description

An error type for known market errors with potentially special error handling.

Variants§

§

InvalidInfiniteMaxGains

Fields

§market_type: MarketType
§

InvalidInfiniteTakeProfitPrice

Fields

§market_type: MarketType
§

MaxGainsTooLarge

§

WithdrawTooMuch

Fields

§requested: NonZero<LpToken>
§available: NonZero<LpToken>
§

InsufficientLiquidityForWithdrawal

Fields

§requested_lp: NonZero<LpToken>
§requested_collateral: NonZero<Collateral>
§unlocked: Collateral
§

MissingPosition

Fields

§

TraderLeverageOutOfRange

Fields

§low_allowed: Decimal256
§high_allowed: Decimal256
§new_leverage: Decimal256
§current_leverage: Option<Decimal256>
§

CounterLeverageOutOfRange

Fields

§low_allowed: Decimal256
§high_allowed: Decimal256
§new_leverage: Decimal256
§current_leverage: Option<Decimal256>
§

MinimumDeposit

Fields

§deposit_collateral: Collateral
§deposit_usd: Usd
§minimum_usd: Usd
§

Congestion

Fields

§current_queue: u32
§max_size: u32
§

MaxLiquidity

Fields

§price_collateral_in_usd: PriceCollateralInUsd
§current: Usd
§deposit: Usd
§max: Usd
§

DeltaNeutralityFeeAlreadyLong

Fields

§sensitivity: Number
§instant_before: Number
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeAlreadyShort

Fields

§sensitivity: Number
§instant_before: Number
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeNewlyLong

Fields

§sensitivity: Number
§instant_after: Number
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeNewlyShort

Fields

§sensitivity: Number
§instant_after: Number
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeLongToShort

Fields

§sensitivity: Number
§instant_before: Number
§instant_after: Number
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeShortToLong

Fields

§sensitivity: Number
§instant_before: Number
§instant_after: Number
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

LiquidityCooldown

Fields

§ends_at: Timestamp
§seconds_remaining: u64
§

PendingDeferredExec

§

VolatilePriceFeedTimeDelta

Fields

§oldest: Timestamp
§newest: Timestamp
§

LimitOrderAlreadyCanceling

Fields

§order_id: Uint64
§

PositionAlreadyClosing

Fields

§position_id: Uint64
§

NoPricePublishTimeFound

§

PositionAlreadyClosed

Fields

§close_time: Timestamp
§reason: String
§

InsufficientLiquidityForUnlock

Fields

§requested: NonZero<Collateral>
§total_locked: Collateral
§

Liquidity

Fields

§requested: NonZero<Collateral>

Total amount of liquidity requested to take from unlocked pool.

§total_unlocked: Collateral

Total amount of liquidity available in the unlocked pool.

§allowed: Collateral

Liquidity allowed to be taken for this action.

In particular, carry leverage may restrict the total amount of liquidity that can be used to ensure sufficient funds for cash-and-carry balancing operations.

Implementations§

source§

impl MarketError

source

pub fn into_anyhow(self) -> Error

Convert into an anyhow::Error.

This method will first convert into a PerpError and then wrap that in anyhow::Error.

source

pub fn try_from_anyhow(err: &Error) -> Result<Self>

Try to convert from an anyhow::Error.

Trait Implementations§

source§

impl Clone for MarketError

source§

fn clone(&self) -> MarketError

Returns a copy 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 Debug for MarketError

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for MarketError

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for MarketError

source§

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

Formats the value using the given formatter. Read more
source§

impl Error for MarketError

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl PartialEq for MarketError

source§

fn eq(&self, other: &MarketError) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for MarketError

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for MarketError

source§

impl StructuralPartialEq for MarketError

Auto Trait Implementations§

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
§

impl<U> As for U

§

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

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

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

source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> QueryResultExt for T
where T: Serialize,

source§

fn query_result(&self) -> Result<Binary, Error>

Convert the value to its JSON representation
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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

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

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,