Assessment reports>Programmable Derivatives>Threat Model>_calculateFairUintPrice

Function: _calculateFairUintPrice(uint256[] prices, uint256[] weights, uint256 invariant, uint256 totalBPTSupply)

This function calculates the fair price of the pool in USD using the Balancer invariant formula.

Inputs

  • prices

    • Control: From latestRoundData.

    • Constraints: None.

    • Impact: Array of prices of the assets in the pool.

  • weights

    • Control: From latestRoundData.

    • Constraints: None.

    • Impact: Array of weights of the assets in the pool.

  • invariant

    • Control: From latestRoundData.

    • Constraints: None.

    • Impact: The invariant of the pool.

  • totalBPTSupply

    • Control: From latestRoundData.

    • Constraints: None.

    • Impact: The total supply of the pool.

Branches and code coverage

Intended branches

  • Calculate the price-weight power.

  • Calculate the fair price of the pool using the Balancer invariant formula.

Zellic © 2025Back to top ↑