Skip to content

Commit ef6d59d

Browse files
committed
LiquidPool updatable treasuryFee
1 parent 7c639fc commit ef6d59d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

contracts/LiquidUnstakePool.sol

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ contract LiquidUnstakePool is
3030
uint16 public constant MAX_FEE = 500;
3131
uint16 public minFee;
3232
uint16 public maxFee;
33+
uint16 public treasuryFee;
3334

3435
event AddLiquidity(
3536
address indexed user,
@@ -104,10 +105,12 @@ contract LiquidUnstakePool is
104105

105106
/// @notice Update min and max fees
106107
/// @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();
109111
minFee = _minFee;
110112
maxFee = _maxFee;
113+
treasuryFee = _treasuryFee;
111114
}
112115

113116
/// @notice Return the amount of ETH and mpETH equivalent to ETH in the pool
@@ -214,10 +217,10 @@ contract LiquidUnstakePool is
214217
address payable staking = STAKING;
215218
(uint256 amountOut, uint256 feeAmount) = getAmountOut(_amount);
216219
if (amountOut < _minOut) revert SwapMinOut(_minOut, amountOut);
217-
uint256 feeToTreasury = (feeAmount * 2500) / 10000;
220+
uint256 feeToTreasury = (feeAmount * treasuryFee) / 10000;
218221
ethBalance -= amountOut;
219222
IERC20Upgradeable(staking).safeTransferFrom(msg.sender, address(this), _amount);
220-
IERC20Upgradeable(staking).safeTransfer(treasury, feeToTreasury);
223+
if (feeToTreasury != 0) IERC20Upgradeable(staking).safeTransfer(treasury, feeToTreasury);
221224
payable(msg.sender).sendValue(amountOut);
222225
emit Swap(msg.sender, _amount, amountOut, feeAmount, feeToTreasury);
223226
return amountOut;

0 commit comments

Comments
 (0)