Crate brontes_pricing
source ·Expand description
BrontesBatchPricer
calculates and track the prices of tokens
on decentralized exchanges on a per-transaction basis. It builds and
maintains a main token graph which is used to derive smaller subgraphs used
to price tokens relative to a defined quote token.
§Core Functionality
§Subgraph Utilization
The system leverages subgraphs, which are smaller, focused graph structures extracted from the larger token graph. Subgraphs are built when a classified event occurs on a token. When this occurs a subgraph is made for the pair if one doesn’t already exist. This allows for fast computation of a tokens price. These subgraphs constantly update with new blocks, updating their nodes and edges to reflect new liquidity pools.
§Graph Management
The system adds new pools to the token graph as they appear in new blocks, ensuring that all valid trading paths are represented.
§Lazy Loading
New pools and their states are fetched as required
Re-exports§
pub use protocols::*;
Modules§
Structs§
AllPairGraph
Represents the interconnected network of token pairs in decentralized exchanges (DEXs), crucial for the BrontesBatchPricer system’s ability to analyze and calculate token prices.GraphManager
Is the manager for everything graph related. It is responsible for creating, updating, and maintaining the main token graph as well as its derived subgraphs.- a ordered buffer for holding state transitions for a block while the lazy loading of pools is being applied
- Manages the state of pools in the BrontesBatchPricer system, maintaining two types of state data: finalized and verification states.
- Manages subgraphs in the BrontesBatchPricer module, crucial for DEX pricing.
SubgraphVerifier
Manages the verification of subgraphs for token pairs in the BrontesBatchPricer system. It ensures the accuracy and relevance of subgraphs, which are essential for pricing tokens on DEXs.