contract size fix
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user