contract size fix
This commit is contained in:
@@ -80,7 +80,6 @@ contract PartyPool is PartyPoolBase, OwnableExternal, ERC20External, IPartyPool
|
|||||||
PartyPoolSwapImpl private immutable SWAP_IMPL;
|
PartyPoolSwapImpl private immutable SWAP_IMPL;
|
||||||
function swapMintImpl() external view returns (PartyPoolSwapImpl) { return SWAP_IMPL; }
|
function swapMintImpl() external view returns (PartyPoolSwapImpl) { return SWAP_IMPL; }
|
||||||
|
|
||||||
|
|
||||||
/// @inheritdoc IPartyPool
|
/// @inheritdoc IPartyPool
|
||||||
function getToken(uint256 i) external view returns (IERC20) { return _tokens[i]; }
|
function getToken(uint256 i) external view returns (IERC20) { return _tokens[i]; }
|
||||||
|
|
||||||
@@ -474,22 +473,13 @@ contract PartyPool is PartyPoolBase, OwnableExternal, ERC20External, IPartyPool
|
|||||||
/// @notice Transfer all protocol fees to the configured protocolFeeAddress and zero the ledger.
|
/// @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.
|
/// @dev Anyone can call; must have protocolFeeAddress != address(0) to be operational.
|
||||||
function collectProtocolFees() external nonReentrant {
|
function collectProtocolFees() external nonReentrant {
|
||||||
address dest = PROTOCOL_FEE_ADDRESS;
|
bytes memory data = abi.encodeWithSelector(
|
||||||
require(dest != address(0), "collect: zero addr");
|
PartyPoolSwapImpl.collectProtocolFees.selector,
|
||||||
|
PROTOCOL_FEE_ADDRESS
|
||||||
|
);
|
||||||
|
Address.functionDelegateCall(address(MINT_IMPL), data);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _swapAmountsForExactInput(uint256 i, uint256 j, int128 a, int128 limitPrice) internal virtual view
|
function _swapAmountsForExactInput(uint256 i, uint256 j, int128 a, int128 limitPrice) internal virtual view
|
||||||
returns (int128 amountIn, int128 amountOut) {
|
returns (int128 amountIn, int128 amountOut) {
|
||||||
|
|||||||
@@ -146,4 +146,24 @@ contract PartyPoolSwapImpl is PartyPoolBase {
|
|||||||
require(amountOutUint > 0, "swapToLimit: output zero");
|
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