```\nfunction fee(address token, address sender, uint256 amount, bytes4) public view returns (uint256) {\n    uint256 _minFee = minFee[token];\n    if (xABR.totalSupply() == 0 || baseFeeRateBP == 0 || amount == 0) {\n        return _minFee;\n    }\n    uint256 userShareBP = xABR.balanceOf(sender) * feeMultiplier * BP / xABR.totalSupply();\n\n    uint256 result = (amount * BP) / (userShareBP + (BP * BP / baseFeeRateBP));\n    if (_minFee > 0 && result < _minFee) {\n        return _minFee;\n    } else {\n        return result;\n    }\n}\n```\n