MEDIUM severity: The vulnerability is related to the calculation of the partial fill quote amount when calculating fe. The vulnerability is related to the calculation of the partial fill quote amount when calculating fees. The issue arises when the seller claims their payout, and the protocol/referrer fees are calculated based on the partial fill quote amount. The problem is that the partial fill quote amount is cal...

Vulnerable code:
```\nfunction claimBids(uint96 lotId_, uint64[] calldata bidIds_) external override nonReentrant {\n    // rest of code.\n\n    for (uint256 i = 0; i < bidClaimsLen; i++) {\n        Auction.BidClaim memory bidClaim = bidClaims[i];\n\n        if (bidClaim.payout > 0) {\n            _allocateQuoteFees(\n                protocolFee,\n                referrerFee,\n                bidClaim.referrer,\n                routing.seller,\n                routing.quoteToken,\n                bidClaim.paid\n            );\n        }\n    }\n```\n```\nfunction _allocateQuoteFees(\n    uint96 protocolFee_,\n    uint96 referrerFee_,\n    address referrer_,\n    address seller_,\n    ERC20 quoteToken_,\n    uint96 amount_\n) internal returns (uint96 totalFees) {\n    uint96 toReferrer;\n    uint96 toProtocol;\n\n    (toReferrer, toProtocol) = calculateQuoteFees(\n        protocolFee_, referrerFee_, referrer_!= address(0) && referrer_!= seller_, amount_\n    );\n\n    if (toReferrer > 0) {\n        rewards[referrer_][quoteToken_] += uint256(toReferrer);\n    }\n    if (toProtocol > 0) {\n        rewards[_protocol][quoteToken_] += uint256(toProtocol);\n\n    }\n\n    return toReferrer + toProtocol;\n}\n```\n```\nfunction claimProceeds(\n    uint96 lotId_,\n    bytes calldata callbackData_\n) external override nonReentrant {\n    uint96 totalInLessFees;\n    {\n        (, uint96 toProtocol) = calculateQuoteFees(\n            lotFees[lotId_].protocolFee, lotFees[lotId_].referrerFee, false, purchased_\n        );\n        unchecked {\n            totalInLessFees = purchased_ - toProtocol;\n        }\n    }\n```\n```\nfunction settle(uint96 lotId_) external override nonReentrant {\n    if (settlement.pfBidder!= address(0)) {\n        _allocateQuoteFees(\n            feeData.protocolFee,\n            feeData.referrerFee,\n            settlement.pfReferrer,\n            routing.seller,\n            routing.quoteToken,\n            Math.mulDivDown(settlement.pfPayout, settlement.totalIn, settlement.totalOut)\n        );\n    }\n}\n```\n```\ndiff --git a/moonraker/test/AuctionHouse/AuctionHouseTest.sol b/moonraker/test/AuctionHouse/AuctionHouseTest.sol\nindex 44e717d..9b32834 100644\n--- a/moonraker/test/AuctionHouse/AuctionHouseTest.sol\n+++ b/moonraker/test/AuctionHouse/AuctionHouseTest.sol\n\n@@ -6,6 @@ import {Test} from "forge-std/Test.sol";\n import {ERC20} from "solmate/tokens/ERC20.sol";\n import {Transfer} from "src/lib/Transfer.sol";\n import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";\n import {SafeCastLib} from "solmate/utils/SafeCastLib.sol";\n\n // Mocks\n import {MockAtomicAuctionModule} from "test/modules/Auction/MockAtomicAuctionModule.sol";\n\n@@ -134,6 @@ abstract contract AuctionHouseTest is Test, Permit2User {\n        _bidder = vm.addr(_bidderKey);\n\n        function testHash_SpecificPartialRounding() public {\n            uint bidAmount = 2999999999999999999997;\n            uint marginalPrice = 2556460687578254783645;\n            uint capacity = 1056499719758481066;\n            uint previousTotalAmount = 1000000000000000000;\n            uint baseScale = 1e18;\n\n            assert(FixedPointMathLib.mulDivDown(previousTotalAmount, baseScale, marginalPrice) < capacity);\n\n            uint capacityExpended = FixedPointMathLib.mulDivDown(previousTotalAmount, baseScale, marginalPrice);\n            assert(capacityExpended > capacity);\n\n            uint totalAmountIn = previousTotalAmount + bidAmount;\n            uint256 fullFill = FixedPointMathLib.mulDivDown(uint256(bidAmount), baseScale, marginalPrice);\n            uint256 excess = capacityExpended - capacity;\n\n            uint pfPayout = SafeCastLib.safeCastTo96(fullFill - excess);\n            uint pfRefund = SafeCastLib.safeCastTo96(FixedPointMathLib.mulDivDown(uint256(bidAmount), excess, fullFill));\n            totalAmountIn -= pfRefund;\n\n            uint usedContributionForQuoteFees;\n            {\n                uint totalOut = SafeCastLib.safeCastTo96(capacityExpended > capacity? capacity : capacityExpended);\n                usedContributionForQuoteFees = FixedPointMathLib\n```