QuickSwap and StellaSwap contest - p_crypt0's results

A concentrated liquidity DEX with dynamic fees.

General Information

Platform: Code4rena

Start Date: 26/09/2022

Pot Size: $50,000 USDC

Total HM: 13

Participants: 113

Period: 5 days

Judge: 0xean

Total Solo HM: 6

Id: 166

League: ETH

QuickSwap and StellaSwap

Findings Distribution

Researcher Performance

Rank: 68/113

Findings: 1

Award: $52.04

🌟 Selected for report: 0

🚀 Solo Findings: 0

QA

[Informational] Redundant IF statement in collect()

In AlgebraPool.sol, there is an excessive compulsion to check for fee reductions.

The initial if statement:

if (amount0 | amount1 != 0) { position.fees0 = positionFees0 - amount0; position.fees1 = positionFees1 - amount1; } if (amount0 > 0) { TransferHelper.safeTransfer(token0, recipient, amount0); } if (amount1 > 0) { TransferHelper.safeTransfer(token1, recipient, amount1); }

Original code is here

Can become:
if (amount0 > 0) { position.fees0 = positionFees0 - amount0; TransferHelper.safeTransfer(token0, recipient, amount0); } if (amount1 > 0) { position.fees1 = positionFees1 - amount1; TransferHelper.safeTransfer(token0, recipient, amount0); }

This is both more simple to read and more effiicient since it deals with one less if statement.

The bitwise | check in the first if statement is redundant, since it's essentially saying:

if amount0, or amount1, contains anything which isn't 0x000000 then update fees.

Getting rid of this check would not impact the function of the code, since the amounts are checked to be above zero straight after.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter