marginal price views

This commit is contained in:
tim
2025-09-20 16:18:41 -04:00
parent 10d432070d
commit cd663105f4
3 changed files with 97 additions and 0 deletions

View File

@@ -224,6 +224,22 @@ interface IPartyPool is IERC20Metadata {
uint256 deadline
) external returns (uint256 amountOutUint);
/// @notice Marginal price of `base` denominated in `quote` as Q64.64.
/// @dev Returns the LMSR marginal price p_quote / p_base in ABDK 64.64 fixed-point format.
/// Useful for off-chain quoting; raw 64.64 value is returned (no scaling to token units).
/// @param baseTokenIndex index of the base asset (e.g., ETH)
/// @param quoteTokenIndex index of the quote asset (e.g., USD)
/// @return price Q64.64 value equal to quote per base (p_quote / p_base)
function price(uint256 baseTokenIndex, uint256 quoteTokenIndex) external view returns (int128);
/// @notice Price of one LP token denominated in `quote` as Q64.64.
/// @dev Computes LMSR poolPrice (quote per unit internal qTotal) and scales it to LP units:
/// returns price_per_LP = poolPrice_quote * (totalSupply() / qTotal) in ABDK 64.64 format.
/// The returned value is raw Q64.64 and represents quote units per one LP token unit.
/// @param quoteTokenIndex index of the quote asset in which to denominate the LP price
/// @return price Q64.64 value equal to quote per LP token unit
function poolPrice(uint256 quoteTokenIndex) external view returns (int128);
/// @notice Compute repayment amounts (principal + flash fee) for a proposed flash loan.
/// @param loanAmounts array of per-token loan amounts; must match the pool's token ordering.
/// @return repaymentAmounts array where repaymentAmounts[i] = loanAmounts[i] + ceil(loanAmounts[i] * flashFeePpm)