Submitted by zanderbyte, also found by 0xlucky, 0xNirix, 0XRolko, 0xStalin, Abhan, Agontuk, aster, BajagaSec, BenRai, c0pp3rscr3w3r, ChainSentry, DanielArmstrong, DharkArtz, Drynooo, elvin-a-block, EPSec, franfran20, Gaurav2811, Gaurav2811, Gosho, inh3l, JustUzair, JustUzair, KupiaSec, Lamsy, macart224, macart224, newspacexyz, nslavchev, ogKapten, oualidpro, oualidpro, Rampage, Rhaydden, rspadi, Ryonen, Sabit, sl1, smbv-1923, TheFabled, TheKhans, Uddercover, udo, udo, wickie0x, xKeywordx, y0ng0p3, YouCrossTheLineAlfie, and zia_d_k
https://github.com/code-423n4/2024-12-secondswap/blob/214849c3517eb26b31fe194bceae65cb0f52d2c0/contracts/SecondSwap_Marketplace.sol#L480-#L483
When a purchase of listed tokens is performed, the caller can provide a referral address. This address should receive a referral fee as a reward for introducing users to the project. According to the dev team, the referral payment will be done off-chain. 
However, in the current implementation, the referralFeeCost calculations are incorrect, which results in much higher fees (ou to 90% of buyersFeeTotal) for the referral than expected.
Assume the default protocol values for buyerFee = 250 and referralFee = 1000. Lets say a user wants to purchase tokens worth 1000 USDT. The buyer fee will be charged on the baseAmount, and for simplicity, we can assume that the _amount is not affected by any discount.
The buyerFeeTotal is calculated as: 
buyerFeeTotal = (1000e6 * 250) / 10000 = 25e6
The referrallFeeCost is calculated as:
Substituting the values:
This resulted in a referral fee of 22.5e6 which is much higher than expected.
The referralFeeCost should be calculated as a percentage of buyerFeeTotal.
The correct calculation should be:
This will result in referralFee = 2.5e6 (exactly 10% of buyerFeeTotal)
