Skip to main content

PerpDeploy

Enum PerpDeploy 

Source
pub enum PerpDeploy {
Show 16 variants RegisterAsset2 { max_gas: Option<u64>, asset: NewAsset, margin_mode: MarginMode, dex: DexName, schema: Option<DexSchema>, }, RegisterAsset { max_gas: Option<u64>, asset: NewAsset, only_isolated: bool, dex: DexName, schema: Option<DexSchema>, }, SetOracle { dex: DexName, oracle_pxs: ByCoin<Dec>, mark_pxs: Vec<ByCoin<Dec>>, external_perp_pxs: ByCoin<Dec>, }, SetFundingMultipliers(ByCoin<Dec>), SetFundingInterestRates(ByCoin<Dec>), SetFundingClamps(ByCoin<Dec>), HaltTrading { coin: String, is_halted: bool, }, InsertMarginTable { dex: DexName, margin_table: MarginTable, }, SetMarginTableIds(ByCoin<u32>), SetFeeRecipient { dex: DexName, fee_recipient: Address, }, SetOpenInterestCaps(ByCoin<Option<u64>>), SetSubDeployers { dex: DexName, sub_deployers: Vec<SubDeployer>, }, SetMarginModes(ByCoin<MarginMode>), SetDeployerFees(ByCoin<DeployerFee>), SetPerpAnnotation { coin: String, annotation: Annotation, }, DisableDex(DexName),
}
Expand description

{"type":"perpDeploy",<variant>:..}. The constructors check what the docs rule out and take each per-coin list in any order, refusing a coin given twice; the lists go out sorted by coin, as the venue requires.

Variants§

§

RegisterAsset2

registerAsset2: an asset with a margin mode. With a schema it also creates the dex. max_gas is in native token wei; None (sent as null) pays the current auction price, and 0 uses a reserve deployment whether or not the auction has ended.

Fields

§max_gas: Option<u64>

The most native token wei to pay (maxGas); None, sent as null, pays the current auction price.

§asset: NewAsset

The asset to list (assetRequest).

§margin_mode: MarginMode

How the asset may be margined (marginMode).

§dex: DexName

The dex the asset is listed on.

§schema: Option<DexSchema>

The new dex’s schema when this asset creates the dex; None, sent as null, for an existing dex.

§

RegisterAsset

registerAsset: as RegisterAsset2, with onlyIsolated for the margin mode.

Fields

§max_gas: Option<u64>

The most native token wei to pay (maxGas); None, sent as null, pays the current auction price.

§asset: NewAsset

The asset to list (assetRequest).

§only_isolated: bool

Whether the asset is isolated margin only (onlyIsolated).

§dex: DexName

The dex the asset is listed on.

§schema: Option<DexSchema>

The new dex’s schema when this asset creates the dex; None, sent as null, for an existing dex.

§

SetOracle

setOracle: oracle prices, 0 to 2 lists of mark prices, and external perp prices for every asset. At least 2.5 seconds apart.

Fields

§dex: DexName

The dex the prices are for.

§oracle_pxs: ByCoin<Dec>

Oracle prices by coin (oraclePxs).

§mark_pxs: Vec<ByCoin<Dec>>

0 to 2 lists of mark prices by coin (markPxs).

§external_perp_pxs: ByCoin<Dec>

External perp prices by coin (externalPerpPxs).

§

SetFundingMultipliers(ByCoin<Dec>)

setFundingMultipliers, each from 0 to 10.

§

SetFundingInterestRates(ByCoin<Dec>)

setFundingInterestRates: 8 hour rates, each from -0.01 to 0.01.

§

SetFundingClamps(ByCoin<Dec>)

setFundingClamps: 8 hour clamps, each from 0 to 0.01.

§

HaltTrading

haltTrading: halts (true) or resumes (false) one asset.

Fields

§coin: String

The coin, dex:NAME.

§is_halted: bool

true halts the asset, false resumes it (isHalted).

§

InsertMarginTable

insertMarginTable.

Fields

§dex: DexName

The dex the table is for.

§margin_table: MarginTable

The table to insert (marginTable).

§

SetMarginTableIds(ByCoin<u32>)

setMarginTableIds, none of them 0.

§

SetFeeRecipient

setFeeRecipient.

Fields

§dex: DexName

The dex whose fees are paid out.

§fee_recipient: Address

The address the deployer’s fee share goes to (feeRecipient).

§

SetOpenInterestCaps(ByCoin<Option<u64>>)

setOpenInterestCaps: notional caps; None (sent as null) removes an asset’s custom cap.

§

SetSubDeployers

setSubDeployers.

Fields

§dex: DexName

The dex the grants are for.

§sub_deployers: Vec<SubDeployer>

The grants (subDeployers), at least one.

§

SetMarginModes(ByCoin<MarginMode>)

setMarginModes.

§

SetDeployerFees(ByCoin<DeployerFee>)

setDeployerFees. On mainnet, one change per 30 days.

§

SetPerpAnnotation

setPerpAnnotation.

Fields

§coin: String

The coin, dex:NAME.

§annotation: Annotation

The annotation, sent flat next to the coin.

§

DisableDex(DexName)

disableDex.

Implementations§

Source§

impl PerpDeploy

Source

pub fn register_asset2( dex: DexName, max_gas: Option<u64>, asset: NewAsset, margin_mode: MarginMode, schema: Option<DexSchema>, ) -> Result<Self, BadDeploy>

registerAsset2, refusing a negative oracle price.

Source

pub fn register_asset( dex: DexName, max_gas: Option<u64>, asset: NewAsset, only_isolated: bool, schema: Option<DexSchema>, ) -> Result<Self, BadDeploy>

registerAsset, refusing a negative oracle price.

Source

pub fn set_oracle<K: Into<String>>( dex: DexName, oracle_pxs: impl IntoIterator<Item = (K, Dec)>, mark_pxs: Vec<Vec<(K, Dec)>>, external_perp_pxs: impl IntoIterator<Item = (K, Dec)>, ) -> Result<Self, BadDeploy>

setOracle, refusing more than 2 mark price lists or a negative price.

Source

pub fn set_funding_multipliers<K: Into<String>>( multipliers: impl IntoIterator<Item = (K, Dec)>, ) -> Result<Self, BadDeploy>

setFundingMultipliers, each from 0 to 10.

Source

pub fn set_funding_interest_rates<K: Into<String>>( rates: impl IntoIterator<Item = (K, Dec)>, ) -> Result<Self, BadDeploy>

setFundingInterestRates, each from -0.01 to 0.01.

Source

pub fn set_funding_clamps<K: Into<String>>( clamps: impl IntoIterator<Item = (K, Dec)>, ) -> Result<Self, BadDeploy>

setFundingClamps, each from 0 to 0.01.

Source

pub fn set_margin_table_ids<K: Into<String>>( ids: impl IntoIterator<Item = (K, u32)>, ) -> Result<Self, BadDeploy>

setMarginTableIds, refusing id 0.

Source

pub fn set_open_interest_caps<K: Into<String>>( caps: impl IntoIterator<Item = (K, Option<u64>)>, ) -> Result<Self, BadDeploy>

setOpenInterestCaps; None removes an asset’s custom cap.

Source

pub fn set_sub_deployers( dex: DexName, sub_deployers: Vec<SubDeployer>, ) -> Result<Self, BadDeploy>

setSubDeployers, refusing an empty list.

Source

pub fn set_margin_modes<K: Into<String>>( modes: impl IntoIterator<Item = (K, MarginMode)>, ) -> Result<Self, BadDeploy>

setMarginModes.

Source

pub fn set_deployer_fees<K: Into<String>>( fees: impl IntoIterator<Item = (K, DeployerFee)>, ) -> Result<Self, BadDeploy>

setDeployerFees: each scale from 0 to 3, or from 0 up to (not including) 10 in growth mode.

Source

pub const fn kind(&self) -> PerpKind

The variant, by the key it travels under.

Source

pub fn body(&self) -> Value

The value under the variant’s key, keys in the order the docs and the venue’s clients write them.

Trait Implementations§

Source§

impl Clone for PerpDeploy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PerpDeploy

Source§

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

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

impl Eq for PerpDeploy

Source§

impl L1Action for PerpDeploy

Source§

fn action(&self) -> Map

The action’s keys and values in wire order, which is the hashed order.
Source§

fn msgpack(&self) -> Vec<u8> ⓘ

The action as msgpack bytes, the first part of the connection id’s hash.
Source§

fn wire(&self) -> String

The action as posted.
Source§

fn connection_id(&self, nonce: u64, vault: Option<Address>) -> [u8; 32]

connection_id of this action at nonce, for vault when it acts for one.
Source§

fn typed( &self, nonce: u64, vault: Option<Address>, network: Network, ) -> TypedStruct<'static>

The phantom agent struct the key signs for this action.
Source§

fn digest( &self, nonce: u64, vault: Option<Address>, network: Network, ) -> [u8; 32]

What the key signs for this action: the phantom agent’s digest under Domain::EXCHANGE.
Source§

fn wallet_json( &self, nonce: u64, vault: Option<Address>, network: Network, ) -> String

For a master wallet signing in the browser. It needs chain 1337.
Source§

fn body( &self, nonce: u64, signature: &Signature, vault: Option<Address>, ) -> String

The /exchange body: action, nonce, signature and vaultAddress, null when there is no vault.
Source§

impl PartialEq for PerpDeploy

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PerpDeploy

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
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

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

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

Source§

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

Compare self to key and return true if they are equal.
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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, 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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
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