    function _getDiscountedPrice(Listing storage listing, uint256 _amount) private view returns (uint256) {
        uint256 discountedPrice = listing.pricePerUnit;

        if (listing.discountType == DiscountType.LINEAR) {
            discountedPrice = (discountedPrice * (BASE - ((_amount * listing.discountPct) / listing.total))) / BASE;
        } else if (listing.discountType == DiscountType.FIX) {
            discountedPrice = (discountedPrice * (BASE - listing.discountPct)) / BASE;
        }
        return discountedPrice;
    }
    function _handleTransfers(
        Listing storage listing,
        uint256 _amount,
        uint256 discountedPrice,
        uint256 bfee,
        uint256 sfee,
        address _referral
    ) private returns (uint256 buyerFeeTotal, uint256 sellerFeeTotal, uint256 referralFeeCost) {
@>        uint256 baseAmount = (_amount * discountedPrice) /
            uint256(
                10 **
                    (
                        IERC20Extended(
                            address(
                                IVestingManager(IMarketplaceSetting(marketplaceSetting).vestingManager())
                                    .getVestingTokenAddress(listing.vestingPlan)
                            )
                        ).decimals()
                    )
            ); // 3.1. Rounding issue leads to total drain of vesting entries
@>        require(baseAmount > 0, "SS_Marketplace: Amount too little"); // 3.1. Rounding issue leads to total drain of vesting entries
...
        it.only("can not buy with discounted price", async function () {
            const { 
                vesting, 
                token, 
                marketplace, 
                marketplaceSetting, 
                user1, 
                manager
            } = await loadFixture(deployProxyFixture);
            const [user2, user3] = await hre.viem.getWalletClients();
    
            // Test parameters
            const amount = parseEther("1") / 1000n;
            const cost = 1200n; // 0,0012 $
            const discountPct = BigInt(4000); // 20% discount
            const listingType = 1;  // Single fill
            const discountType = 2; // Fixed discount
            const maxWhitelist = BigInt(0);
            const privateListing = false;
            const minPurchaseAmt = parseEther("1") / 1000n;
    
            const updatedSettings = await manager.read.vestingSettings([vesting.address]);
            expect(updatedSettings[0]).to.be.true; // Check if sellable is true
    
            // List vesting
            await marketplace.write.listVesting([
                vesting.address, 
                amount, 
                cost, 
                discountPct, 
                listingType, 
                discountType, 
                maxWhitelist,
                token.address, 
                minPurchaseAmt,
                privateListing
            ], { account: user1.account });

            // // Make purchase => revert
            await expect(marketplace.write.spotPurchase([
                vesting.address,
                BigInt(0),
                amount,
                "0x0000000000000000000000000000000000000000"
            ], {account: user3.account}))
            .to.reverted;

});
