event changes: SwapMint/BurnSwap replace rather than augment the regular Mint/Burn events; All swapping events have lpFee and protocolFee

This commit is contained in:
tim
2025-10-21 14:42:40 -04:00
parent 11ae6f2a4b
commit 538f778f51
4 changed files with 54 additions and 31 deletions

View File

@@ -424,12 +424,8 @@ contract PartyPoolMintImpl is PartyPoolBase {
// Use natural ERC20 function since base contract inherits from ERC20
_mint(receiver, actualLpToMint);
// Emit SwapMint event with gross transfer, net input and fee (planned exact-in)
emit IPartyPool.SwapMint(payer, receiver, inputTokenIndex, totalTransfer, amountInUint, feeUintActual);
// Emit standard Mint event which records deposit amounts and LP minted
emit IPartyPool.Mint(payer, receiver, new uint256[](n), actualLpToMint);
// Note: depositAmounts array omitted (empty) since swapMint uses single-token input
emit IPartyPool.SwapMint(payer, receiver, _tokens[inputTokenIndex],
totalTransfer, actualLpToMint, feeUintActual-protoShare, protoShare);
return actualLpToMint;
}
@@ -524,7 +520,8 @@ contract PartyPoolMintImpl is PartyPoolBase {
}
// Transfer the payout to receiver via centralized helper
_sendTokenTo(_tokens[inputTokenIndex], receiver, amountOutUint, unwrap);
IERC20 inputToken = _tokens[inputTokenIndex];
_sendTokenTo(inputToken, receiver, amountOutUint, unwrap);
// Burn LP _tokens from payer (authorization via allowance)
if (msg.sender != payer) {
@@ -545,9 +542,6 @@ contract PartyPoolMintImpl is PartyPoolBase {
newQInternal[idx] = _uintToInternalFloor(newBal, _bases[idx]);
}
// Emit BurnSwap with public-facing info only (do not expose ΔS or LP burned)
emit IPartyPool.BurnSwap(payer, receiver, inputTokenIndex, amountOutUint);
// If entire pool drained, deinit; else update proportionally
bool allZero = true;
for (uint256 idx = 0; idx < n; idx++) {
@@ -559,7 +553,9 @@ contract PartyPoolMintImpl is PartyPoolBase {
_lmsr.updateForProportionalChange(newQInternal);
}
emit IPartyPool.Burn(payer, receiver, new uint256[](n), lpAmount);
emit IPartyPool.BurnSwap(payer, receiver, inputToken, lpAmount, amountOutUint,
feeTokenUint-protoShare, protoShare);
return amountOutUint;
}