The withdraw function in sablierFlow.sol incorrectly transfers the total amount to a user instead of transferring the net amount after deducting the protocol fee. This results in the protocol fee not being properly accounted for in the transfer.
The function calculates the protocol fee and updates the protocol revenue, but it transfers the total amount to the recipient instead of the net amount after deducting the protocol fee.
The recipient receives the total amount instead of the net amount after deducting the protocol fee, leading to financial discrepancies in protocol state. Therefore protocol has less tokens than recorded
manual review
Modify the function to transfer the net amount to the recipient after deducting the protocol fee.
solidity
}
unchecked {
// Effect: update the aggregate balance.
aggregateBalance[token] -= (amount + protocolFeeAmount); // subtract total amount including fee from aggregate
}
// Interaction: perform the ERC-20 transfer.
token.safeTransfer({ to: to, value: amount - protocolFeeAmount }); // transfers net amount to recipient
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.