zlsecure3 / review_Aark

0 stars 0 forks source link

it could be more readable by factoring out `-1` in `FuturesLogic::_updateUserStatus` function #29

Open zlsecure3 opened 1 year ago

zlsecure3 commented 1 year ago

subject

it could be more readable by factoring out -1 in FuturesLogic::_updateUserStatus function

description

change

        account.paidValue +=
            -MathUtil.mul(
                market.accFundingFactor - position.lastAccFundingFactor,
                position.qty,
                Constants.VALUE_DECIMALS,
                Constants.QTY_DECIMALS,
                Constants.VALUE_DECIMALS
            ) -
            vars.signedNotionalValue -
            int256(feeDistribution.total);

to

        account.paidValue -=
            MathUtil.mul(
                market.accFundingFactor - position.lastAccFundingFactor,
                position.qty,
                Constants.VALUE_DECIMALS,
                Constants.QTY_DECIMALS,
                Constants.VALUE_DECIMALS
            ) +
            vars.signedNotionalValue +
            int256(feeDistribution.total);

for better readability and also saves a bit gas.

recommendation

Apply the above optimization

locations

severity

Informational

damage

exploitability

category

Code Style


system_generated: auditor:alansh submission_id:1771409842

zlsecure3 commented 1 year ago

grading (edit)


submission_id:1771409842


review_type:GRADING


result: TBD-yes,no


rating: TBD-123


comment: TBD-Rejected,Accepted by Secure3.


severity: TBD-Critical,Medium,Low,Informational


category:


description:


zlsecure3 commented 1 year ago

client feedback (manual copy)


submission_id:1771409842


review_type:CLIENT_FEEDBACK


result: TBD-yes,no


severity: TBD-Critical,Medium,Low,Informational


comment:


zlsecure3 commented 1 year ago

client feedback decision(edit)


submission_id:1771409842


review_type:CLIENT_FEEDBACK_DECISION


result: TBD-yes,no,yes-honored,no-honored


severity: TBD-Critical,Medium,Low,Informational


comment: