7 lines
23 KiB
HTML
7 lines
23 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `state` mod in crate `mango_v4`."><title>mango_v4::state - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-c4dbdcde0fbd8430.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-db279b6232be9c13.css"><link rel="stylesheet" disabled href="../../static.files/dark-cf923f49f397b216.css"><link rel="stylesheet" disabled href="../../static.files/ayu-be46fdc453a55015.css"><script src="../../static.files/storage-3891ce972e3a2bf8.js"></script><script defer src="../../static.files/main-98a684e84ae5b08b.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../mango_v4/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../mango_v4/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Module state</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#constants">Constants</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">mango_v4</a>::<wbr><a class="mod" href="#">state</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/mango_v4/state/mod.rs.html#1-25">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="switchboard_v1_devnet_oracle/index.html" title="mod mango_v4::state::switchboard_v1_devnet_oracle">switchboard_v1_devnet_oracle</a></div></li><li><div class="item-name"><a class="mod" href="switchboard_v2_mainnet_oracle/index.html" title="mod mango_v4::state::switchboard_v2_mainnet_oracle">switchboard_v2_mainnet_oracle</a></div></li></ul><h2 id="macros" class="small-section-header"><a href="#macros">Macros</a></h2><ul class="item-table"><li><div class="item-name"><a class="macro" href="macro.account_seeds.html" title="macro mango_v4::state::account_seeds">account_seeds</a></div></li><li><div class="item-name"><a class="macro" href="macro.bank_seeds.html" title="macro mango_v4::state::bank_seeds">bank_seeds</a></div></li><li><div class="item-name"><a class="macro" href="macro.group_seeds.html" title="macro mango_v4::state::group_seeds">group_seeds</a></div></li><li><div class="item-name"><a class="macro" href="macro.serum_market_seeds.html" title="macro mango_v4::state::serum_market_seeds">serum_market_seeds</a></div></li></ul><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AnyEvent.html" title="struct mango_v4::state::AnyEvent">AnyEvent</a></div></li><li><div class="item-name"><a class="struct" href="struct.AnyNode.html" title="struct mango_v4::state::AnyNode">AnyNode</a></div></li><li><div class="item-name"><a class="struct" href="struct.Bank.html" title="struct mango_v4::state::Bank">Bank</a></div></li><li><div class="item-name"><a class="struct" href="struct.BookSide.html" title="struct mango_v4::state::BookSide">BookSide</a></div></li><li><div class="item-name"><a class="struct" href="struct.BookSideIter.html" title="struct mango_v4::state::BookSideIter">BookSideIter</a></div><div class="desc docblock-short">Iterates the fixed and oracle_pegged OrderTrees simultaneously, allowing users to
|
||
walk the orderbook without caring about where an order came from.</div></li><li><div class="item-name"><a class="struct" href="struct.BookSideIterItem.html" title="struct mango_v4::state::BookSideIterItem">BookSideIterItem</a></div></li><li><div class="item-name"><a class="struct" href="struct.BookSideOrderHandle.html" title="struct mango_v4::state::BookSideOrderHandle">BookSideOrderHandle</a></div><div class="desc docblock-short">Reference to a node in a book side component</div></li><li><div class="item-name"><a class="struct" href="struct.DynamicAccount.html" title="struct mango_v4::state::DynamicAccount">DynamicAccount</a></div></li><li><div class="item-name"><a class="struct" href="struct.EventQueue.html" title="struct mango_v4::state::EventQueue">EventQueue</a></div></li><li><div class="item-name"><a class="struct" href="struct.EventQueueHeader.html" title="struct mango_v4::state::EventQueueHeader">EventQueueHeader</a></div></li><li><div class="item-name"><a class="struct" href="struct.FillEvent.html" title="struct mango_v4::state::FillEvent">FillEvent</a></div></li><li><div class="item-name"><a class="struct" href="struct.FreeNode.html" title="struct mango_v4::state::FreeNode">FreeNode</a></div></li><li><div class="item-name"><a class="struct" href="struct.Group.html" title="struct mango_v4::state::Group">Group</a></div></li><li><div class="item-name"><a class="struct" href="struct.InnerNode.html" title="struct mango_v4::state::InnerNode">InnerNode</a></div><div class="desc docblock-short">InnerNodes and LeafNodes compose the binary tree of orders.</div></li><li><div class="item-name"><a class="struct" href="struct.LeafNode.html" title="struct mango_v4::state::LeafNode">LeafNode</a></div><div class="desc docblock-short">LeafNodes represent an order in the binary tree</div></li><li><div class="item-name"><a class="struct" href="struct.MangoAccount.html" title="struct mango_v4::state::MangoAccount">MangoAccount</a></div></li><li><div class="item-name"><a class="struct" href="struct.MangoAccountDynamicHeader.html" title="struct mango_v4::state::MangoAccountDynamicHeader">MangoAccountDynamicHeader</a></div></li><li><div class="item-name"><a class="struct" href="struct.MangoAccountFixed.html" title="struct mango_v4::state::MangoAccountFixed">MangoAccountFixed</a></div></li><li><div class="item-name"><a class="struct" href="struct.MintInfo.html" title="struct mango_v4::state::MintInfo">MintInfo</a></div></li><li><div class="item-name"><a class="struct" href="struct.OracleConfig.html" title="struct mango_v4::state::OracleConfig">OracleConfig</a></div></li><li><div class="item-name"><a class="struct" href="struct.OracleConfigParams.html" title="struct mango_v4::state::OracleConfigParams">OracleConfigParams</a></div></li><li><div class="item-name"><a class="struct" href="struct.OracleState.html" title="struct mango_v4::state::OracleState">OracleState</a></div></li><li><div class="item-name"><a class="struct" href="struct.Order.html" title="struct mango_v4::state::Order">Order</a></div><div class="desc docblock-short">Perp order parameters</div></li><li><div class="item-name"><a class="struct" href="struct.OrderTreeIter.html" title="struct mango_v4::state::OrderTreeIter">OrderTreeIter</a></div><div class="desc docblock-short">Iterate over orders in order (bids=descending, asks=ascending)</div></li><li><div class="item-name"><a class="struct" href="struct.OrderTreeNodes.html" title="struct mango_v4::state::OrderTreeNodes">OrderTreeNodes</a></div><div class="desc docblock-short">A binary tree on AnyNode::key()</div></li><li><div class="item-name"><a class="struct" href="struct.OrderTreeRoot.html" title="struct mango_v4::state::OrderTreeRoot">OrderTreeRoot</a></div></li><li><div class="item-name"><a class="struct" href="struct.Orderbook.html" title="struct mango_v4::state::Orderbook">Orderbook</a></div></li><li><div class="item-name"><a class="struct" href="struct.OutEvent.html" title="struct mango_v4::state::OutEvent">OutEvent</a></div></li><li><div class="item-name"><a class="struct" href="struct.PerpMarket.html" title="struct mango_v4::state::PerpMarket">PerpMarket</a></div></li><li><div class="item-name"><a class="struct" href="struct.PerpOpenOrder.html" title="struct mango_v4::state::PerpOpenOrder">PerpOpenOrder</a></div></li><li><div class="item-name"><a class="struct" href="struct.PerpPosition.html" title="struct mango_v4::state::PerpPosition">PerpPosition</a></div></li><li><div class="item-name"><a class="struct" href="struct.Serum3Market.html" title="struct mango_v4::state::Serum3Market">Serum3Market</a></div></li><li><div class="item-name"><a class="struct" href="struct.Serum3MarketIndexReservation.html" title="struct mango_v4::state::Serum3MarketIndexReservation">Serum3MarketIndexReservation</a></div></li><li><div class="item-name"><a class="struct" href="struct.Serum3Orders.html" title="struct mango_v4::state::Serum3Orders">Serum3Orders</a></div></li><li><div class="item-name"><a class="struct" href="struct.StablePriceModel.html" title="struct mango_v4::state::StablePriceModel">StablePriceModel</a></div><div class="desc docblock-short">Maintains a “stable_price” based on the oracle price.</div></li><li><div class="item-name"><a class="struct" href="struct.StubOracle.html" title="struct mango_v4::state::StubOracle">StubOracle</a></div></li><li><div class="item-name"><a class="struct" href="struct.TokenPosition.html" title="struct mango_v4::state::TokenPosition">TokenPosition</a></div></li></ul><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.BookSideOrderTree.html" title="enum mango_v4::state::BookSideOrderTree">BookSideOrderTree</a></div></li><li><div class="item-name"><a class="enum" href="enum.CheckLiquidatable.html" title="enum mango_v4::state::CheckLiquidatable">CheckLiquidatable</a></div></li><li><div class="item-name"><a class="enum" href="enum.EventType.html" title="enum mango_v4::state::EventType">EventType</a></div></li><li><div class="item-name"><a class="enum" href="enum.IxGate.html" title="enum mango_v4::state::IxGate">IxGate</a></div><div class="desc docblock-short">Enum for lookup into ix gate
|
||
note:
|
||
total ix files 56,
|
||
ix files included 48,
|
||
ix files not included 8,</div></li><li><div class="item-name"><a class="enum" href="enum.NodeTag.html" title="enum mango_v4::state::NodeTag">NodeTag</a></div></li><li><div class="item-name"><a class="enum" href="enum.OracleType.html" title="enum mango_v4::state::OracleType">OracleType</a></div></li><li><div class="item-name"><a class="enum" href="enum.OrderParams.html" title="enum mango_v4::state::OrderParams">OrderParams</a></div></li><li><div class="item-name"><a class="enum" href="enum.OrderState.html" title="enum mango_v4::state::OrderState">OrderState</a></div></li><li><div class="item-name"><a class="enum" href="enum.OrderTreeType.html" title="enum mango_v4::state::OrderTreeType">OrderTreeType</a></div></li><li><div class="item-name"><a class="enum" href="enum.PlaceOrderType.html" title="enum mango_v4::state::PlaceOrderType">PlaceOrderType</a></div></li><li><div class="item-name"><a class="enum" href="enum.PostOrderType.html" title="enum mango_v4::state::PostOrderType">PostOrderType</a></div></li><li><div class="item-name"><a class="enum" href="enum.Side.html" title="enum mango_v4::state::Side">Side</a></div></li><li><div class="item-name"><a class="enum" href="enum.SideAndOrderTree.html" title="enum mango_v4::state::SideAndOrderTree">SideAndOrderTree</a></div><div class="desc docblock-short">SideAndOrderTree is a storage optimization, so we don’t need two bytes for the data</div></li></ul><h2 id="constants" class="small-section-header"><a href="#constants">Constants</a></h2><ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.DAY.html" title="constant mango_v4::state::DAY">DAY</a></div></li><li><div class="item-name"><a class="constant" href="constant.DAY_I80F48.html" title="constant mango_v4::state::DAY_I80F48">DAY_I80F48</a></div></li><li><div class="item-name"><a class="constant" href="constant.FEE_BUYBACK_QUOTE_TOKEN_INDEX.html" title="constant mango_v4::state::FEE_BUYBACK_QUOTE_TOKEN_INDEX">FEE_BUYBACK_QUOTE_TOKEN_INDEX</a></div><div class="desc docblock-short">The token index used in AccountBuybackFeesWithMngo to exchange for MNGO</div></li><li><div class="item-name"><a class="constant" href="constant.FREE_ORDER_SLOT.html" title="constant mango_v4::state::FREE_ORDER_SLOT">FREE_ORDER_SLOT</a></div></li><li><div class="item-name"><a class="constant" href="constant.HOUR.html" title="constant mango_v4::state::HOUR">HOUR</a></div></li><li><div class="item-name"><a class="constant" href="constant.INSURANCE_TOKEN_INDEX.html" title="constant mango_v4::state::INSURANCE_TOKEN_INDEX">INSURANCE_TOKEN_INDEX</a></div><div class="desc docblock-short">The token index used for the insurance fund.</div></li><li><div class="item-name"><a class="constant" href="constant.MAX_BANKS.html" title="constant mango_v4::state::MAX_BANKS">MAX_BANKS</a></div></li><li><div class="item-name"><a class="constant" href="constant.MAX_NUM_EVENTS.html" title="constant mango_v4::state::MAX_NUM_EVENTS">MAX_NUM_EVENTS</a></div></li><li><div class="item-name"><a class="constant" href="constant.MAX_ORDERTREE_NODES.html" title="constant mango_v4::state::MAX_ORDERTREE_NODES">MAX_ORDERTREE_NODES</a></div></li><li><div class="item-name"><a class="constant" href="constant.MINIMUM_MAX_RATE.html" title="constant mango_v4::state::MINIMUM_MAX_RATE">MINIMUM_MAX_RATE</a></div></li><li><div class="item-name"><a class="constant" href="constant.PERP_SETTLE_TOKEN_INDEX.html" title="constant mango_v4::state::PERP_SETTLE_TOKEN_INDEX">PERP_SETTLE_TOKEN_INDEX</a></div><div class="desc docblock-short">The token index used for settling perp markets.</div></li><li><div class="item-name"><a class="constant" href="constant.QUOTE_DECIMALS.html" title="constant mango_v4::state::QUOTE_DECIMALS">QUOTE_DECIMALS</a></div></li><li><div class="item-name"><a class="constant" href="constant.QUOTE_NATIVE_TO_UI.html" title="constant mango_v4::state::QUOTE_NATIVE_TO_UI">QUOTE_NATIVE_TO_UI</a></div></li><li><div class="item-name"><a class="constant" href="constant.QUOTE_TOKEN_INDEX.html" title="constant mango_v4::state::QUOTE_TOKEN_INDEX">QUOTE_TOKEN_INDEX</a></div><div class="desc docblock-short">This token index is supposed to be the token that oracles quote in.</div></li><li><div class="item-name"><a class="constant" href="constant.YEAR_I80F48.html" title="constant mango_v4::state::YEAR_I80F48">YEAR_I80F48</a></div></li></ul><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.DerefOrBorrow.html" title="trait mango_v4::state::DerefOrBorrow">DerefOrBorrow</a></div></li><li><div class="item-name"><a class="trait" href="trait.DerefOrBorrowMut.html" title="trait mango_v4::state::DerefOrBorrowMut">DerefOrBorrowMut</a></div></li><li><div class="item-name"><a class="trait" href="trait.DynamicHeader.html" title="trait mango_v4::state::DynamicHeader">DynamicHeader</a></div><div class="desc docblock-short">Header is created by scanning and parsing the dynamic portion of the account.
|
||
This stores useful information e.g. offsets to easily seek into dynamic content.</div></li><li><div class="item-name"><a class="trait" href="trait.MangoAccountLoader.html" title="trait mango_v4::state::MangoAccountLoader">MangoAccountLoader</a></div><div class="desc docblock-short">Trait to allow a AccountLoader<MangoAccountFixed> to create an accessor for the full account.</div></li><li><div class="item-name"><a class="trait" href="trait.QueueHeader.html" title="trait mango_v4::state::QueueHeader">QueueHeader</a></div></li></ul><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.compute_equity.html" title="fn mango_v4::state::compute_equity">compute_equity</a></div></li><li><div class="item-name"><a class="fn" href="fn.determine_oracle_type.html" title="fn mango_v4::state::determine_oracle_type">determine_oracle_type</a></div></li><li><div class="item-name"><a class="fn" href="fn.fixed_price_data.html" title="fn mango_v4::state::fixed_price_data">fixed_price_data</a></div><div class="desc docblock-short">Creates price data for a fixed order’s price</div></li><li><div class="item-name"><a class="fn" href="fn.fixed_price_lots.html" title="fn mango_v4::state::fixed_price_lots">fixed_price_lots</a></div><div class="desc docblock-short">Retrieves the price (in lots) from a fixed order’s price data</div></li><li><div class="item-name"><a class="fn" href="fn.new_node_key.html" title="fn mango_v4::state::new_node_key">new_node_key</a></div><div class="desc docblock-short">Creates a binary tree node key.</div></li><li><div class="item-name"><a class="fn" href="fn.oracle_pegged_price_data.html" title="fn mango_v4::state::oracle_pegged_price_data">oracle_pegged_price_data</a></div><div class="desc docblock-short">Creates price data for an oracle pegged order from the price offset</div></li><li><div class="item-name"><a class="fn" href="fn.oracle_pegged_price_offset.html" title="fn mango_v4::state::oracle_pegged_price_offset">oracle_pegged_price_offset</a></div><div class="desc docblock-short">Retrieves the price offset (in lots) from an oracle pegged order’s price data</div></li><li><div class="item-name"><a class="fn" href="fn.oracle_price_and_state.html" title="fn mango_v4::state::oracle_price_and_state">oracle_price_and_state</a></div><div class="desc docblock-short">Returns the price of one native base token, in native quote tokens</div></li><li><div class="item-name"><a class="fn" href="fn.power_of_ten.html" title="fn mango_v4::state::power_of_ten">power_of_ten</a></div></li><li><div class="item-name"><a class="fn" href="fn.rank_orders.html" title="fn mango_v4::state::rank_orders">rank_orders</a></div><div class="desc docblock-short">Compares the <code>fixed</code> and <code>oracle_pegged</code> order and returns the one that would match first.</div></li></ul><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.MangoAccountLoadedRef.html" title="type mango_v4::state::MangoAccountLoadedRef">MangoAccountLoadedRef</a></div><div class="desc docblock-short">Useful when loading from bytes</div></li><li><div class="item-name"><a class="type" href="type.MangoAccountLoadedRefCell.html" title="type mango_v4::state::MangoAccountLoadedRefCell">MangoAccountLoadedRefCell</a></div><div class="desc docblock-short">Useful when loading from RefCell, like from AccountInfo</div></li><li><div class="item-name"><a class="type" href="type.MangoAccountLoadedRefCellMut.html" title="type mango_v4::state::MangoAccountLoadedRefCellMut">MangoAccountLoadedRefCellMut</a></div><div class="desc docblock-short">Useful when loading from RefCell, like from AccountInfo</div></li><li><div class="item-name"><a class="type" href="type.MangoAccountRef.html" title="type mango_v4::state::MangoAccountRef">MangoAccountRef</a></div><div class="desc docblock-short">Full reference type, useful for borrows</div></li><li><div class="item-name"><a class="type" href="type.MangoAccountRefMut.html" title="type mango_v4::state::MangoAccountRefMut">MangoAccountRefMut</a></div><div class="desc docblock-short">Full reference type, useful for borrows</div></li><li><div class="item-name"><a class="type" href="type.MangoAccountValue.html" title="type mango_v4::state::MangoAccountValue">MangoAccountValue</a></div><div class="desc docblock-short">Fully owned MangoAccount, useful for tests</div></li><li><div class="item-name"><a class="type" href="type.NodeHandle.html" title="type mango_v4::state::NodeHandle">NodeHandle</a></div></li><li><div class="item-name"><a class="type" href="type.PerpMarketIndex.html" title="type mango_v4::state::PerpMarketIndex">PerpMarketIndex</a></div></li><li><div class="item-name"><a class="type" href="type.Serum3MarketIndex.html" title="type mango_v4::state::Serum3MarketIndex">Serum3MarketIndex</a></div></li><li><div class="item-name"><a class="type" href="type.TokenIndex.html" title="type mango_v4::state::TokenIndex">TokenIndex</a></div></li></ul></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="mango_v4" data-themes="" data-resource-suffix="" data-rustdoc-version="1.69.0 (84c898d65 2023-04-16)" data-search-js="search-8a59a8356673ec1f.js" data-settings-js="settings-f0c5c39777a9a2f6.js" data-settings-css="settings-0bcba95ff279c1db.css" ></div></body></html> |