contract size fix

This commit is contained in:
tim
2025-10-19 15:46:41 -04:00
parent d55be28cba
commit b64f5f6648
2 changed files with 26 additions and 16 deletions

View File

@@ -146,4 +146,24 @@ contract PartyPoolSwapImpl is PartyPoolBase {
require(amountOutUint > 0, "swapToLimit: output zero");
}
/// @notice Transfer all protocol fees to the configured protocolFeeAddress and zero the ledger.
/// @dev Anyone can call; must have protocolFeeAddress != address(0) to be operational.
function collectProtocolFees(address dest) external nonReentrant {
require(dest != address(0), "collect: zero addr");
uint256 n = _tokens.length;
for (uint256 i = 0; i < n; i++) {
uint256 owed = _protocolFeesOwed[i];
if (owed == 0) continue;
uint256 bal = IERC20(_tokens[i]).balanceOf(address(this));
require(bal >= owed, "collect: fee > bal");
_protocolFeesOwed[i] = 0;
// update cached to effective onchain minus owed
_cachedUintBalances[i] = bal - owed;
// transfer owed _tokens to protocol destination via centralized helper
_sendTokenTo(_tokens[i], dest, owed, false);
}
}
}