mock fix
This commit is contained in:
@@ -37,20 +37,19 @@ contract DeployMock is Script {
|
||||
|
||||
IPartyPool pool = new PartyPool(name, symbol, tokens, _bases, _tradeFrac, _targetSlippage, _feePpm, _feePpm);
|
||||
|
||||
console2.log('PartyPool', address(pool));
|
||||
|
||||
// initial mint
|
||||
mintAll(address(pool), 10_000);
|
||||
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
|
||||
mintAll(devAccount7, 1_000_000);
|
||||
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user