pure kappa formulation: target slippage extracted into pool creator code

This commit is contained in:
tim
2025-09-23 19:08:14 -04:00
parent cd663105f4
commit b5eab7dad1
8 changed files with 198 additions and 290 deletions

View File

@@ -70,19 +70,16 @@ interface IPartyPool is IERC20Metadata {
/// @dev denominators()[i] is the base for tokens[i]. These bases are chosen by deployer and must match token decimals.
function denominators() external view returns (uint256[] memory);
/// @notice Trade fraction (Q64.64) representing a reference trade size as fraction of one asset's inventory.
/// @dev Used by the LMSR stabilization logic to compute target slippage.
function tradeFrac() external view returns (int128); // ABDK 64x64
/// @notice Target slippage (Q64.64) applied for the reference trade size specified by tradeFrac.
function targetSlippage() external view returns (int128); // ABDK 64x64
/// @notice Per-swap fee in parts-per-million (ppm). Fee is taken from input amounts before LMSR computations.
function swapFeePpm() external view returns (uint256);
/// @notice Flash-loan fee in parts-per-million (ppm) applied to flash borrow amounts.
function flashFeePpm() external view returns (uint256);
/// @notice Liquidity parameter κ (Q64.64) used by the LMSR kernel: b = κ * S(q)
/// @dev Pools are constructed with a κ value; this getter exposes the κ used by the pool.
function kappa() external view returns (int128);
/// @notice Mapping from token address => (index+1). A zero value indicates the token is not in the pool.
/// @dev Use index = tokenAddressToIndexPlusOne[token] - 1 when non-zero.
function tokenAddressToIndexPlusOne(IERC20) external view returns (uint);