swap amounts

This commit is contained in:
tim
2025-09-15 18:38:28 -04:00
parent f7e40eee06
commit 070717959e
6 changed files with 175 additions and 93 deletions

View File

@@ -60,7 +60,7 @@ interface IPartyPool is IERC20Metadata {
/// @notice Calculate the proportional deposit amounts required for a given LP token amount
/// @param lpTokenAmount The amount of LP tokens desired
/// @return depositAmounts Array of token amounts to deposit (rounded up)
function computeMintAmounts(uint256 lpTokenAmount) external view returns (uint256[] memory depositAmounts);
function mintDepositAmounts(uint256 lpTokenAmount) external view returns (uint256[] memory depositAmounts);
/// @notice Proportional mint (or initial supply if first call).
/// For initial supply: assumes tokens have already been transferred to the pool
@@ -74,7 +74,7 @@ interface IPartyPool is IERC20Metadata {
/// @notice Calculate the proportional withdrawal amounts for a given LP token amount
/// @param lpTokenAmount The amount of LP tokens to burn
/// @return withdrawAmounts Array of token amounts to withdraw (rounded down)
function computeBurnAmounts(uint256 lpTokenAmount) external view returns (uint256[] memory withdrawAmounts);
function burnReceiveAmounts(uint256 lpTokenAmount) external view returns (uint256[] memory withdrawAmounts);
/// @notice Burn LP tokens and withdraw the proportional basket to receiver.
/// Payer must own the LP tokens; withdraw amounts are computed from current proportions.
@@ -86,6 +86,15 @@ interface IPartyPool is IERC20Metadata {
// Swaps
/// @notice External view to quote exact-in swap amounts (gross input incl. fee and output), matching swap() computations
function swapAmounts(
uint256 i,
uint256 j,
uint256 maxAmountIn,
int128 limitPrice
) external view returns (uint256 amountIn, uint256 amountOut);
function swap(
address payer,
address receiver,
@@ -96,6 +105,13 @@ interface IPartyPool is IERC20Metadata {
uint256 deadline
) external returns (uint256 amountIn, uint256 amountOut);
/// @notice External view to quote swap-to-limit amounts (gross input incl. fee and output), matching swapToLimit() computations
function swapToLimitAmounts(
uint256 i,
uint256 j,
int128 limitPrice
) external view returns (uint256 amountIn, uint256 amountOut);
function swapToLimit(
address payer,
address receiver,