Skip to content

Commit fd9ed36

Browse files
Merge pull request #72 from bnb-party/issue-70
keep only external functions in Manageable
2 parents 1314cc1 + 9c2f50d commit fd9ed36

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

contracts/BNBPartyFee.sol

+34
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,38 @@ abstract contract BNBPartyFee is BNBPartyState {
125125
adjustedTicks = ticks;
126126
}
127127
}
128+
129+
/// @notice Internal function to withdraw LP fees from specified liquidity pools
130+
/// @param liquidityPools Array of liquidity pool addresses from which fees will be withdrawn
131+
/// @param manager The non-fungible position manager used to collect fees
132+
/// @dev Reverts if the liquidity pools array is empty
133+
function _withdrawLPFees(
134+
address[] calldata liquidityPools,
135+
INonfungiblePositionManager manager
136+
) internal {
137+
if (liquidityPools.length == 0) {
138+
revert ZeroLength();
139+
}
140+
for (uint256 i = 0; i < liquidityPools.length; ++i) {
141+
_collectFee(liquidityPools[i], manager); // Collects fees from each specified liquidity pool
142+
}
143+
}
144+
145+
/// @notice Internal function to collect LP fees from a specific liquidity pool
146+
/// @param liquidityPool Address of the liquidity pool from which fees will be collected
147+
/// @param manager The non-fungible position manager used to collect fees
148+
/// @dev Reverts if the provided liquidity pool address is zero
149+
function _collectFee(
150+
address liquidityPool,
151+
INonfungiblePositionManager manager
152+
) internal notZeroAddress(liquidityPool) {
153+
manager.collect(
154+
INonfungiblePositionManager.CollectParams({
155+
tokenId: lpToTokenId[liquidityPool],
156+
recipient: msg.sender,
157+
amount0Max: type(uint128).max,
158+
amount1Max: type(uint128).max
159+
})
160+
); // Collects fees from the specified liquidity pool
161+
}
128162
}

contracts/BNBPartyManageable.sol

-34
Original file line numberDiff line numberDiff line change
@@ -69,38 +69,4 @@ abstract contract BNBPartyManageable is BNBPartyFee, Pausable {
6969
function unpause() external onlyOwner {
7070
_unpause();
7171
}
72-
73-
/// @notice Internal function to withdraw LP fees from specified liquidity pools
74-
/// @param liquidityPools Array of liquidity pool addresses from which fees will be withdrawn
75-
/// @param manager The non-fungible position manager used to collect fees
76-
/// @dev Reverts if the liquidity pools array is empty
77-
function _withdrawLPFees(
78-
address[] calldata liquidityPools,
79-
INonfungiblePositionManager manager
80-
) internal {
81-
if (liquidityPools.length == 0) {
82-
revert ZeroLength();
83-
}
84-
for (uint256 i = 0; i < liquidityPools.length; ++i) {
85-
_collectFee(liquidityPools[i], manager); // Collects fees from each specified liquidity pool
86-
}
87-
}
88-
89-
/// @notice Internal function to collect LP fees from a specific liquidity pool
90-
/// @param liquidityPool Address of the liquidity pool from which fees will be collected
91-
/// @param manager The non-fungible position manager used to collect fees
92-
/// @dev Reverts if the provided liquidity pool address is zero
93-
function _collectFee(
94-
address liquidityPool,
95-
INonfungiblePositionManager manager
96-
) internal notZeroAddress(liquidityPool) {
97-
manager.collect(
98-
INonfungiblePositionManager.CollectParams({
99-
tokenId: lpToTokenId[liquidityPool],
100-
recipient: msg.sender,
101-
amount0Max: type(uint128).max,
102-
amount1Max: type(uint128).max
103-
})
104-
); // Collects fees from the specified liquidity pool
105-
}
10672
}

0 commit comments

Comments
 (0)