flashLoan gas test

This commit is contained in:
tim
2025-10-07 15:57:04 -04:00
parent 457385e692
commit 12957aaa51
3 changed files with 8 additions and 17 deletions

View File

@@ -411,13 +411,13 @@ contract PartyPool is PartyPoolBase, ERC20External, IPartyPool {
{
IERC20 token = IERC20(tokenAddr);
require(amount <= token.balanceOf(address(this)));
uint256 tokenIndex = tokenAddressToIndexPlusOne[token] - 1;
(uint256 fee, ) = _computeFee(amount, FLASH_FEE_PPM);
// Compute protocol share of flash fee
if (PROTOCOL_FEE_PPM > 0 && fee > 0) {
uint256 protoShare = (fee * PROTOCOL_FEE_PPM) / 1_000_000; // floor
if (protoShare > 0) {
uint256 tokenIndex = tokenAddressToIndexPlusOne[token] - 1;
protocolFeesOwed[tokenIndex] += protoShare;
}
}
@@ -427,7 +427,6 @@ contract PartyPool is PartyPoolBase, ERC20External, IPartyPool {
require(token.transferFrom(address(receiver), address(this), amount + fee));
// Update cached balance for the borrowed token
uint256 tokenIndex = tokenAddressToIndexPlusOne[token] - 1;
uint256 balAfter = token.balanceOf(address(this));
_recordCachedBalance(tokenIndex, balAfter);