more gas optimization; protocol fee enabled by default in tests
This commit is contained in:
@@ -87,9 +87,12 @@ contract PartyPoolSwapImpl is PartyPoolBase {
|
||||
}
|
||||
}
|
||||
|
||||
// Update caches to effective balances
|
||||
_recordCachedBalance(inputTokenIndex, balIAfter);
|
||||
_recordCachedBalance(outputTokenIndex, balJAfter);
|
||||
// Update caches to effective balances (inline _recordCachedBalance)
|
||||
require(balIAfter >= protocolFeesOwed[inputTokenIndex], "balance < protocol owed");
|
||||
cachedUintBalances[inputTokenIndex] = balIAfter - protocolFeesOwed[inputTokenIndex];
|
||||
|
||||
require(balJAfter >= protocolFeesOwed[outputTokenIndex], "balance < protocol owed");
|
||||
cachedUintBalances[outputTokenIndex] = balJAfter - protocolFeesOwed[outputTokenIndex];
|
||||
|
||||
// Apply swap to LMSR state with the internal amounts
|
||||
lmsr.applySwap(inputTokenIndex, outputTokenIndex, amountInInternalMax, amountOutInternal);
|
||||
|
||||
Reference in New Issue
Block a user