This commit is contained in:
tim
2025-09-15 14:48:08 -04:00
parent 77784644ad
commit b53fc444cb
2 changed files with 5 additions and 18 deletions

View File

@@ -175,7 +175,6 @@ contract PartyPool is IPartyPool, ERC20, ReentrancyGuard {
bool isInitialDeposit = totalSupply() == 0 || lmsr.nAssets == 0;
require(lpTokenAmount > 0 || isInitialDeposit, "mint: zero LP amount");
console2.log('mint is init?', isInitialDeposit);
// Capture old pool size metric (scaled) by computing from current balances
uint256 oldScaled = 0;
@@ -201,31 +200,22 @@ contract PartyPool is IPartyPool, ERC20, ReentrancyGuard {
}
// Update cached balances for all assets
console2.log('updating balances');
int128[] memory newQInternal = new int128[](n);
for (uint i = 0; i < n; ) {
console2.log(i);
uint256 bal = IERC20(tokens[i]).balanceOf(address(this));
cachedUintBalances[i] = bal;
console2.log('floor');
console2.log(bal);
console2.log(bases[i]);
newQInternal[i] = _uintToInternalFloor(bal, bases[i]);
console2.log('internal');
// For initial deposit, record the actual deposited amounts
if (isInitialDeposit) {
depositAmounts[i] = bal;
}
console2.log('inc');
unchecked { i++; }
}
console2.log('balances updated');
// If first time, call init, otherwise update proportional change.
if (isInitialDeposit) {
console2.log('init lmsr');
// Initialize the stabilized LMSR state
lmsr.init(newQInternal, tradeFrac, targetSlippage);
} else {
@@ -242,7 +232,6 @@ contract PartyPool is IPartyPool, ERC20, ReentrancyGuard {
if (isInitialDeposit) {
// Initial provisioning: mint newScaled (as LP units)
actualLpToMint = newScaled;
console2.log('initial mint', actualLpToMint);
} else {
require(oldScaled > 0, "mint: oldScaled zero");
uint256 delta = (newScaled > oldScaled) ? (newScaled - oldScaled) : 0;
@@ -266,7 +255,6 @@ contract PartyPool is IPartyPool, ERC20, ReentrancyGuard {
require(actualLpToMint >= minAcceptable, "mint: insufficient LP minted");
}
console2.log('actualLpToMint', actualLpToMint);
require( actualLpToMint > 0, "mint: zero LP amount");
_mint(receiver, actualLpToMint);
emit Mint(payer, receiver, depositAmounts, actualLpToMint);