Dependency Graphs

Dependency graphs in IPOR Fusion are a mechanism that defines relationships between markets where one market's balance calculation depends on another market's balance. They ensure accurate asset valuation and prevent double-counting when markets have nested or interconnected positions.

Purpose

Dependency graphs serve three critical purposes in Fusion:

  1. Prevent Asset Double-Counting: When a market holds assets that are themselves tracked in another market (e.g., LP tokens staked in a gauge), dependency graphs ensure the underlying assets aren't counted twice in totalAssets() .

  2. Ensure Atomic Balance Updates: When a market balance changes, all dependent markets are automatically updated to maintain consistency across the vault's accounting system.

  3. Support Complex Market Relationships: Enable sophisticated DeFi strategies where positions span multiple protocols (e.g., lending markets depending on underlying asset markets, or LP token markets depending on constituent tokens).

Implementation

The dependency graph system is implemented through:

  • Storage Structure: A mapping from each market ID to an array of dependent market IDs.

  • Configuration Functions: updateDependencyBalanceGraphs() for setting up relationships.

  • Query Functions: getDependencyBalanceGraph() for retrieving dependencies.

Last updated

Was this helpful?