native currency fixes

This commit is contained in:
tim
2025-10-14 20:54:15 -04:00
parent 308227f251
commit 96535ed005
7 changed files with 66 additions and 60 deletions

View File

@@ -109,7 +109,7 @@ interface IPartyPool is IERC20Metadata {
/// Can only be called when the pool is uninitialized (totalSupply() == 0 or lmsr.nAssets == 0).
/// @param receiver address that receives the LP tokens
/// @param lpTokens The number of LP tokens to issue for this mint. If 0, then the number of tokens returned will equal the LMSR internal q total
function initialMint(address receiver, uint256 lpTokens) external returns (uint256 lpMinted);
function initialMint(address receiver, uint256 lpTokens) external payable returns (uint256 lpMinted);
/// @notice Proportional mint (or initial supply if first call).
/// @dev - For initial supply: assumes tokens have already been transferred to the pool prior to calling.
@@ -120,16 +120,16 @@ interface IPartyPool is IERC20Metadata {
/// @param lpTokenAmount desired amount of LP tokens to mint (ignored for initial deposit)
/// @param deadline timestamp after which the transaction will revert. Pass 0 to ignore.
/// @return lpMinted the actual amount of lpToken minted
function mint(address payer, address receiver, uint256 lpTokenAmount, uint256 deadline) external returns (uint256 lpMinted);
function mint(address payer, address receiver, uint256 lpTokenAmount, uint256 deadline) external payable returns (uint256 lpMinted);
/// @notice Burn LP tokens and withdraw the proportional basket to receiver.
/// @dev Payer must own or approve the LP tokens being burned. The function updates LMSR state
/// proportionally to reflect the reduced pool size after the withdrawal.
/// @dev This function forwards the call to the burn implementation via delegatecall
/// @param payer address that provides the LP tokens to burn
/// @param receiver address that receives the withdrawn tokens
/// @param lpAmount amount of LP tokens to burn (proportional withdrawal)
/// @param deadline timestamp after which the transaction will revert. Pass 0 to ignore.
function burn(address payer, address receiver, uint256 lpAmount, uint256 deadline) external returns (uint256[] memory withdrawAmounts);
/// @param unwrap if true and the native token is being withdrawn, it is unwraped and sent as native currency
function burn(address payer, address receiver, uint256 lpAmount, uint256 deadline, bool unwrap) external returns (uint256[] memory withdrawAmounts);
// Swaps
@@ -165,7 +165,8 @@ interface IPartyPool is IERC20Metadata {
uint256 outputTokenIndex,
uint256 maxAmountIn,
int128 limitPrice,
uint256 deadline
uint256 deadline,
bool unwrap
) external payable returns (uint256 amountIn, uint256 amountOut, uint256 fee);
/// @notice Swap up to the price limit; computes max input to reach limit then performs swap.
@@ -184,7 +185,8 @@ interface IPartyPool is IERC20Metadata {
uint256 inputTokenIndex,
uint256 outputTokenIndex,
int128 limitPrice,
uint256 deadline
uint256 deadline,
bool unwrap
) external payable returns (uint256 amountInUsed, uint256 amountOut, uint256 fee);
/// @notice Single-token mint: deposit a single token, charge swap-LMSR cost, and mint LP.
@@ -217,7 +219,8 @@ interface IPartyPool is IERC20Metadata {
address receiver,
uint256 lpAmount,
uint256 inputTokenIndex,
uint256 deadline
uint256 deadline,
bool unwrap
) external returns (uint256 amountOutUint);
/**