@@ -30,6 +30,7 @@ contract LiquidUnstakePool is
30
30
uint16 public constant MAX_FEE = 500 ;
31
31
uint16 public minFee;
32
32
uint16 public maxFee;
33
+ uint16 public treasuryFee;
33
34
34
35
event AddLiquidity (
35
36
address indexed user ,
@@ -104,10 +105,12 @@ contract LiquidUnstakePool is
104
105
105
106
/// @notice Update min and max fees
106
107
/// @dev Min and max fees for swap mpETHForETH
107
- function updateSwapFees (uint16 _minFee , uint16 _maxFee ) public onlyOwner {
108
- if (_minFee == 0 || _minFee >= _maxFee || _maxFee > 1000 ) revert InvalidSwapFees ();
108
+ function updateSwapFees (uint16 _minFee , uint16 _maxFee , uint16 _treasuryFee ) public onlyOwner {
109
+ if (_minFee == 0 || _minFee >= _maxFee || _maxFee > 1000 || _treasuryFee > 7000 )
110
+ revert InvalidSwapFees ();
109
111
minFee = _minFee;
110
112
maxFee = _maxFee;
113
+ treasuryFee = _treasuryFee;
111
114
}
112
115
113
116
/// @notice Return the amount of ETH and mpETH equivalent to ETH in the pool
@@ -214,10 +217,10 @@ contract LiquidUnstakePool is
214
217
address payable staking = STAKING;
215
218
(uint256 amountOut , uint256 feeAmount ) = getAmountOut (_amount);
216
219
if (amountOut < _minOut) revert SwapMinOut (_minOut, amountOut);
217
- uint256 feeToTreasury = (feeAmount * 2500 ) / 10000 ;
220
+ uint256 feeToTreasury = (feeAmount * treasuryFee ) / 10000 ;
218
221
ethBalance -= amountOut;
219
222
IERC20Upgradeable (staking).safeTransferFrom (msg .sender , address (this ), _amount);
220
- IERC20Upgradeable (staking).safeTransfer (treasury, feeToTreasury);
223
+ if (feeToTreasury != 0 ) IERC20Upgradeable (staking).safeTransfer (treasury, feeToTreasury);
221
224
payable (msg .sender ).sendValue (amountOut);
222
225
emit Swap (msg .sender , _amount, amountOut, feeAmount, feeToTreasury);
223
226
return amountOut;
0 commit comments