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

@@ -10,7 +10,8 @@ interface IPartyPlanner {
// Event emitted when a new pool is created
event PartyStarted(PartyPool indexed pool, string name, string symbol, IERC20[] tokens);
/// @notice Creates a new PartyPool instance and initializes it with initial deposits
/// @notice Creates a new PartyPool instance and initializes it with initial deposits (legacy signature).
/// @dev Deprecated in favour of the kappa-based overload below; kept for backwards compatibility.
/// @param name_ LP token name
/// @param symbol_ LP token symbol
/// @param _tokens token addresses (n)
@@ -27,7 +28,7 @@ interface IPartyPlanner {
/// @return pool Address of the newly created and initialized PartyPool
/// @return lpAmount Amount of LP tokens minted to the receiver
function createPool(
// Pool constructor args
// Pool constructor args (legacy)
string memory name_,
string memory symbol_,
IERC20[] memory _tokens,
@@ -45,6 +46,39 @@ interface IPartyPlanner {
uint256 deadline
) external returns (PartyPool pool, uint256 lpAmount);
/// @notice Creates a new PartyPool instance and initializes it with initial deposits (kappa-based).
/// @param name_ LP token name
/// @param symbol_ LP token symbol
/// @param _tokens token addresses (n)
/// @param _bases scaling bases for each token (n) - used when converting to/from internal 64.64 amounts
/// @param _kappa liquidity parameter κ in 64.64 fixed-point used to derive b = κ * S(q)
/// @param _swapFeePpm fee in parts-per-million, taken from swap input amounts before LMSR calculations
/// @param _flashFeePpm fee in parts-per-million, taken for flash loans
/// @param _stable if true and assets.length==2, then the optimization for 2-asset stablecoin pools is activated
/// @param payer address that provides the initial token deposits
/// @param receiver address that receives the minted LP tokens
/// @param initialDeposits amounts of each token to deposit initially
/// @param deadline Reverts if nonzero and the current blocktime is later than the deadline
/// @return pool Address of the newly created and initialized PartyPool
/// @return lpAmount Amount of LP tokens minted to the receiver
function createPool(
// Pool constructor args (kappa-based)
string memory name_,
string memory symbol_,
IERC20[] memory _tokens,
uint256[] memory _bases,
int128 _kappa,
uint256 _swapFeePpm,
uint256 _flashFeePpm,
bool _stable,
// Initial deposit information
address payer,
address receiver,
uint256[] memory initialDeposits,
uint256 initialLpAmount,
uint256 deadline
) external returns (PartyPool pool, uint256 lpAmount);
/// @notice Checks if a pool is supported
/// @param pool The pool address to check
/// @return bool True if the pool is supported, false otherwise