diff --git a/contracts/src/Pounders/abstracts/AFees.sol b/contracts/src/Pounders/abstracts/AFees.sol index e3373eb..842f138 100644 --- a/contracts/src/Pounders/abstracts/AFees.sol +++ b/contracts/src/Pounders/abstracts/AFees.sol @@ -36,6 +36,8 @@ abstract contract AFees is Owned2Step { */ address public feeRecipient; + uint256 public redemptionFeeMin; + uint256 public redemptionFeeMax; uint256 public protocolFee; diff --git a/contracts/src/Pounders/abstracts/APounder.sol b/contracts/src/Pounders/abstracts/APounder.sol index 06e12c0..0500537 100644 --- a/contracts/src/Pounders/abstracts/APounder.sol +++ b/contracts/src/Pounders/abstracts/APounder.sol @@ -150,6 +150,7 @@ abstract contract APounder is Owned2Step, ERC20, AIncentiveClaimer, AProtocolCla ILocker.LockedBalance memory lockData, uint256 assets, address receiver, + uint256 feeMin, uint256 feeMax ) internal returns (uint256 feeAmount) { if (assets == 0) revert Errors.ZeroAmount(); @@ -161,7 +162,7 @@ abstract contract APounder is Owned2Step, ERC20, AIncentiveClaimer, AProtocolCla uint256 waitTime = unlockTime - block.timestamp; if (feeMax != 0) { - uint256 feePercent = feeMax - ((feeMax * waitTime) / MAX_REDEMPTION_TIME); + uint256 feePercent = feeMax - (((feeMax - feeMin) * waitTime) / MAX_REDEMPTION_TIME); feeAmount = (assets * feePercent) / FEE_DENOMINATOR; } @@ -197,19 +198,20 @@ abstract contract APounder is Owned2Step, ERC20, AIncentiveClaimer, AProtocolCla ILocker.LockedBalance[] memory lockData = _lockedBalances(); uint256 totalAssets; uint256 feeAmount; - // TODO add feeMin + uint256 feeMin = redemptionFeeMin; uint256 feeMax = redemptionFeeMax; for (uint256 i; i < lockLen; ++i) { totalAssets += assets[i]; - feeAmount += _initiateRedemption(lockData[lockIndexes[i]], assets[i], receiver, feeMax); + feeAmount += _initiateRedemption(lockData[lockIndexes[i]], assets[i], receiver, feeMin, feeMax); } // Burn pxCVX - reverts if sender balance is insufficient _burn(msg.sender, totalAssets - feeAmount); if (feeAmount != 0) { - // TODO Transfer fees + // Transfer the fee to the feeRecipient + SafeTransferLib.safeTransfer(address(asset), feeRecipient, feeAmount); } }