The capping mechanism for Panther token leads to increased fees
Panther token has a cap in transfer sizes, so any transfer in the contract is limited beforehand:\\n```\\nfunction gulp(uint256 \\_minRewardAmount) external onlyEOAorWhitelist nonReentrant\\n{\\n uint256 \\_pendingReward = \\_getPendingReward();\\n if (\\_pendingReward > 0) {\\n  \\_withdraw(0);\\n }\\n uint256 \\_\\_totalReward = Transfers.\\_getBalance(rewardToken);\\n (uint256 \\_feeReward, uint256 \\_retainedReward) = \\_capFeeAmount(\\_\\_totalReward.mul(performanceFee) / 1e18);\\n Transfers.\\_pushFunds(rewardToken, buyback, \\_feeReward);\\n if (rewardToken != routingToken) {\\n  require(exchange != address(0), "exchange not set");\\n  uint256 \\_totalReward = Transfers.\\_getBalance(rewardToken);\\n  \\_totalReward = \\_capTransferAmount(rewardToken, \\_totalReward, \\_retainedReward);\\n  Transfers.\\_approveFunds(rewardToken, exchange, \\_totalReward);\\n  IExchange(exchange).convertFundsFromInput(rewardToken, routingToken, \\_totalReward, 1);\\n }\\n if (routingToken != reserveToken) {\\n  require(exchange != address(0), "exchange not set");\\n  uint256 \\_totalRouting = Transfers.\\_getBalance(routingToken);\\n  \\_totalRouting = \\_capTransferAmount(routingToken, \\_totalRouting, \\_retainedReward);\\n  Transfers.\\_approveFunds(routingToken, exchange, \\_totalRouting);\\n  IExchange(exchange).joinPoolFromInput(reserveToken, routingToken, \\_totalRouting, 1);\\n }\\n uint256 \\_totalBalance = Transfers.\\_getBalance(reserveToken);\\n \\_totalBalance = \\_capTransferAmount(reserveToken, \\_totalBalance, \\_retainedReward);\\n require(\\_totalBalance >= \\_minRewardAmount, "high slippage");\\n \\_deposit(\\_totalBalance);\\n}\\n```\\n\\nFees here are calculated from the full amount of rewards (__totalReward ):\\n```\\n(uint256 \\_feeReward, uint256 \\_retainedReward) = \\_capFeeAmount(\\_\\_totalReward.mul(performanceFee) / 1e18);\\n```\\n\\nBut in fact, if the amount of the rewards is too big, it will be capped, and the residuals will be “taxed” again during the next call of the `gulp` function. That behavior leads to multiple taxations of the same tokens, which means increased fees.
Resolution\\nThe client communicated this issue was addressed in commit 34c6b355795027d27ae6add7360e61eb6b01b91b.\\nThe best solution would be to cap `__totalReward` first and then calculate fees from the capped value.
```\\nfunction gulp(uint256 \\_minRewardAmount) external onlyEOAorWhitelist nonReentrant\\n{\\n uint256 \\_pendingReward = \\_getPendingReward();\\n if (\\_pendingReward > 0) {\\n  \\_withdraw(0);\\n }\\n uint256 \\_\\_totalReward = Transfers.\\_getBalance(rewardToken);\\n (uint256 \\_feeReward, uint256 \\_retainedReward) = \\_capFeeAmount(\\_\\_totalReward.mul(performanceFee) / 1e18);\\n Transfers.\\_pushFunds(rewardToken, buyback, \\_feeReward);\\n if (rewardToken != routingToken) {\\n  require(exchange != address(0), "exchange not set");\\n  uint256 \\_totalReward = Transfers.\\_getBalance(rewardToken);\\n  \\_totalReward = \\_capTransferAmount(rewardToken, \\_totalReward, \\_retainedReward);\\n  Transfers.\\_approveFunds(rewardToken, exchange, \\_totalReward);\\n  IExchange(exchange).convertFundsFromInput(rewardToken, routingToken, \\_totalReward, 1);\\n }\\n if (routingToken != reserveToken) {\\n  require(exchange != address(0), "exchange not set");\\n  uint256 \\_totalRouting = Transfers.\\_getBalance(routingToken);\\n  \\_totalRouting = \\_capTransferAmount(routingToken, \\_totalRouting, \\_retainedReward);\\n  Transfers.\\_approveFunds(routingToken, exchange, \\_totalRouting);\\n  IExchange(exchange).joinPoolFromInput(reserveToken, routingToken, \\_totalRouting, 1);\\n }\\n uint256 \\_totalBalance = Transfers.\\_getBalance(reserveToken);\\n \\_totalBalance = \\_capTransferAmount(reserveToken, \\_totalBalance, \\_retainedReward);\\n require(\\_totalBalance >= \\_minRewardAmount, "high slippage");\\n \\_deposit(\\_totalBalance);\\n}\\n```\\n