Skip to main content

Module margin

Module margin 

Source
Expand description

Leverage and margin on a perp: the leverage and mode a position takes, isolated margin in and out, and the margin tables that cap leverage by size. The account-wide mode is crate::account::settings::mode.

Re-exports§

pub use isolated::UpdateIsolatedMargin;
pub use isolated::add_margin;
pub use isolated::margin;
pub use isolated::remove_margin;
pub use leverage::MarginMode;
pub use leverage::UpdateLeverage;
pub use leverage::leverage;
pub use leverage::update_leverage;
pub use leverage::update_leverage_for;
pub use tables::FLAT_TABLES_BELOW;
pub use tables::LeverageError;
pub use tables::MarginTable;
pub use tables::MarginTier;
pub use tables::checked_leverage;

Modules§

isolated
updateIsolatedMargin: USDC into or out of an isolated position.
leverage
updateLeverage: the leverage and margin mode of a perp position, main dex or HIP-3, checked against the perp’s meta and margin table, or against a ticket’s Market, before anything is signed.
tables
Margin tables and the leverage a perp allows, checked before anything is signed. A perp names its table by marginTableId; an id under FLAT_TABLES_BELOW is a single tier at that leverage, never listed. The main dex and every HIP-3 dex read them the same way.