Tax refund is calculated based on the wrong amount
Tax refund is calculated based on the wrong amount\\nAfter the private period has finished, users can claim a tax refund, based on their max tax free allocation.\\n```\\n        (s.share, left) = _claim(s);\\n        require(left > 0, "TokenSale: Nothing to claim");\\n        uint256 refundTaxAmount;\\n        if (s.taxAmount > 0) {\\n            uint256 tax = userTaxRate(s.amount, msg.sender);\\n            uint256 taxFreeAllc = _maxTaxfreeAllocation(msg.sender) * PCT_BASE;\\n            if (taxFreeAllc >= s.share) {\\n                refundTaxAmount = s.taxAmount;\\n            } else {\\n                refundTaxAmount = (left * tax) / POINT_BASE;\\n            }\\n            usdc.safeTransferFrom(marketingWallet, msg.sender, refundTaxAmount);\\n        }\\n```\\n\\nThe problem is that in case `s.share > taxFreeAllc`, the tax refund is calculated wrongfully. Not only it should refund the tax on the unused USDC amount, but it should also refund the tax for the tax-free allocation the user has.\\nImagine the following.\\nUser deposits 1000 USDC.\\nPrivate period finishes, token oversells. Only half of the user's money actually go towards the sell (s.share = 500 USDC, s.left = 500 USDC)\\nThe user has 400 USDC tax-free allocation\\nThe user must be refunded the tax for the 500 unused USDC, as well as their 400 USDC tax-free allocation. In stead, they're only refunded for the 500 unused USDC. (note, if the user had 500 tax-free allocation, they would've been refunded all tax)
change the code to the following:\\n```\\n                refundTaxAmount = ((left + taxFreeAllc) * tax) / POINT_BASE;\\n```\\n
Users are not refunded enough tax
```\\n        (s.share, left) = _claim(s);\\n        require(left > 0, "TokenSale: Nothing to claim");\\n        uint256 refundTaxAmount;\\n        if (s.taxAmount > 0) {\\n            uint256 tax = userTaxRate(s.amount, msg.sender);\\n            uint256 taxFreeAllc = _maxTaxfreeAllocation(msg.sender) * PCT_BASE;\\n            if (taxFreeAllc >= s.share) {\\n                refundTaxAmount = s.taxAmount;\\n            } else {\\n                refundTaxAmount = (left * tax) / POINT_BASE;\\n            }\\n            usdc.safeTransferFrom(marketingWallet, msg.sender, refundTaxAmount);\\n        }\\n```\\n