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

@@ -37,20 +37,19 @@ contract DeployMock is Script {
IPartyPool pool = new PartyPool(name, symbol, tokens, _bases, _tradeFrac, _targetSlippage, _feePpm, _feePpm); IPartyPool pool = new PartyPool(name, symbol, tokens, _bases, _tradeFrac, _targetSlippage, _feePpm, _feePpm);
console2.log('PartyPool', address(pool));
// initial mint // initial mint
mintAll(address(pool), 10_000); mintAll(address(pool), 10_000);
pool.mint(deployer, deployer, 0, 0); pool.mint(deployer, deployer, 0, 0);
console2.log('USXD', address(usxd));
console2.log('FUSD', address(fusd));
console2.log('DIVE', address(dive));
// give tokens to dev7 // give tokens to dev7
mintAll(devAccount7, 1_000_000); mintAll(devAccount7, 1_000_000);
vm.stopBroadcast(); vm.stopBroadcast();
console2.log('\nPartyPool', address(pool));
console2.log(' USXD', address(usxd));
console2.log(' FUSD', address(fusd));
console2.log(' DIVE', address(dive));
} }
address constant deployer = address(0x472358699872673459876); // anything address constant deployer = address(0x472358699872673459876); // anything

View File

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