Pre-auditThree days of senior audit time for $1,500, credited in full toward your Zealynx audit.3 audit days, credited toward your auditSee how →
L-16·

Inefficient payout transfer check in `payOff()`

Not reportedoptionsleverageblack-scholes
TL;DR

The payOff function of OperationalTreasury.sol calculates the net profit (netAmount) by subtracting fees (feesUSD) from the gross profit (pnl).

Severity
LOW
Method
MManual review
CAT.

The payOff function of OperationalTreasury.sol calculates the net profit (netAmount) by subtracting fees (feesUSD) from the gross profit (pnl). However, the final transfer of this net profit to the user is conditional on the gross profit (pnl) being positive, rather than the net amount (netAmount) itself:

solidity
uint256 netAmount = pnl - feesUSD;
// ...
if (pnl > 0) baseSetUp.token.safeTransfer(account, netAmount);

This logic is inefficient because even if the gross profit (pnl) is positive, the net amount (netAmount = pnl - feesUSD) can be zero if the calculated fees equal the profit. In such a case where pnl > 0 but netAmount == 0, the condition if (pnl > 0) still evaluates to true, leading to an unnecessary safeTransfer call attempting to transfer zero. Attempting a zero-value transfer wastes gas without changing any state.

Modify the condition to check if netAmount is strictly greater than zero before attempting the transfer.

02Section · Report provenance

Report provenance

Published by Pashov Audit Group, with Carlos (Bloqarl) participating as a contractor. The source report states that its fixes review was not fully completed; no final remediation disposition is recorded for this finding. Read the full report.

L-16