PartyPoolView

This commit is contained in:
tim
2025-10-07 12:36:24 -04:00
parent 20af14c872
commit 677ce4886c
8 changed files with 245 additions and 214 deletions

View File

@@ -17,9 +17,6 @@ contract PartyPoolMintImpl is PartyPoolBase {
using LMSRStabilized for LMSRStabilized.State;
using SafeERC20 for IERC20;
// Events that mirror the main contract events
event Mint(address indexed payer, address indexed receiver, uint256[] depositAmounts, uint256 lpMinted);
event Burn(address indexed payer, address indexed receiver, uint256[] withdrawAmounts, uint256 lpBurned);
//
// Initialization Mint
@@ -57,7 +54,7 @@ contract PartyPoolMintImpl is PartyPoolBase {
require(lpMinted > 0, "initialMint: zero LP amount");
_mint(receiver, lpMinted);
emit Mint(address(0), receiver, depositAmounts, lpMinted);
emit IPartyPool.Mint(address(0), receiver, depositAmounts, lpMinted);
}
@@ -126,7 +123,7 @@ contract PartyPoolMintImpl is PartyPoolBase {
require(actualLpToMint >= minAcceptable, "mint: insufficient LP minted");
_mint(receiver, actualLpToMint);
emit Mint(payer, receiver, depositAmounts, actualLpToMint);
emit IPartyPool.Mint(payer, receiver, depositAmounts, actualLpToMint);
return actualLpToMint;
}
@@ -199,9 +196,15 @@ contract PartyPoolMintImpl is PartyPoolBase {
}
_burn(payer, lpAmount);
emit Burn(payer, receiver, withdrawAmounts, lpAmount);
emit IPartyPool.Burn(payer, receiver, withdrawAmounts, lpAmount);
}
/// @notice Calculate the proportional deposit amounts required for a given LP token amount
/// @dev Returns the minimum token amounts (rounded up) that must be supplied to receive lpTokenAmount
/// LP tokens at current pool proportions. If the pool is empty (initial deposit) returns zeros
/// because the initial deposit is handled by transferring tokens then calling mint().
/// @param lpTokenAmount The amount of LP tokens desired
/// @return depositAmounts Array of token amounts to deposit (rounded up)
function mintAmounts(uint256 lpTokenAmount,
uint256 numAssets, uint256 totalSupply, uint256[] memory cachedUintBalances) public pure
returns (uint256[] memory depositAmounts) {