The Sablier protocol allows third-party protocols to use Sablier streams and, if desired, charge a fee of up to 10% of the total amount streamed. Unfortunately, the prb library used for calculating the broker fee doesn't calculate the correct fee for tokens with > 18 decimals. As a result, it reverts even when brokers try to charge only a 1% fee.
The createWithDurations and createWithTimestamps functions of all types of streams call the Helpers::checkAndCalculateBrokerFee function to calculate the broker fee based on the total amount users stream. The protocol limits the broker fee using the MAX_BROKER_FEE constant variable, which is restricted to tokens with 18 decimals. If users use tokens with > 18 decimals, this function reverts and throws a SablierV2Lockup_BrokerFeeTooHigh error. This prevents users from streaming tokens with > 18 decimals.
Brokers will not be able to charge even a 1% fee when the user uses tokens with > 18 decimals for streams, and this will prevent third-party protocols from using Sablier for payment streaming.
Put this code in any file and run the test with command bun run test --mt test_checkAndCalculateBrokerFee -vvv
Manual Review, Foundry
Make sure the prb library performs correct calculations for tokens with > 18 decimals.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.