Fast Khaki Raccoon
Medium
When applying the fees depositFromPairedLpToken
applies admin and yield fees:
uint256 _adminAmt = _getAdminFeeFromAmount(_amountTkn);
_amountTkn -= _adminAmt;
if (LEAVE_AS_PAIRED_LP_TOKEN) {
(, uint256 _yieldBurnFee) = _getYieldFees();
uint256 _burnAmount = (_amountTkn * _yieldBurnFee) / PROTOCOL_FEE_ROUTER.protocolFees().DEN();
_adminAmt += _burnAmount;
_amountTkn -= _burnAmount;
if (_adminAmt > 0) {
_processAdminFee(_adminAmt);
}
_depositRewards(PAIRED_LP_TOKEN, _amountTkn);
return;
}
However due to the order they are applied the yield fee is proportionality reduced by the admin fee, resulting in lower yield fee, thus lower burn amount.
Applying yield fee on the already lowered amount (by the admin fee)
uint256 _adminAmt = _getAdminFeeFromAmount(_amountTkn);
_amountTkn -= _adminAmt; // amount is lowered by admin fee
if (LEAVE_AS_PAIRED_LP_TOKEN) {
(, uint256 _yieldBurnFee) = _getYieldFees();
// yield fee applied on the already lowered amount
uint256 _burnAmount = (_amountTkn * _yieldBurnFee) / PROTOCOL_FEE_ROUTER.protocolFees().DEN();
No response
No response
- Both fees are 10%
- Deposit of 1000 tokens is made
_amountTkn
is reduced by 10% to 900- yield fee is calculated as 10% out of 900, which is 90
Total fees are 190 (19%), even thought they are 10% each -> 20% total Yield fee is 10% lower due to the sequential fee.
Yield fee is proportionality lower, due to using the already lowered amount.
No response
Apply the yield fee on the full amount, then decrease it by both fees.