QuickSwap and StellaSwap contest - Olivierdem'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: 59/113

Findings: 2

Award: $76.06

🌟 Selected for report: 0

🚀 Solo Findings: 0

1. Give a error message for 'require(poolByPair[token0][token1] == address(0))' (line 63 of ./core/contracts/AlgebraFactory.sol). The 2 first require of the function do not need a error message, but the require checking if the pool already exists should return a small message to explain why the tx fails if it fails. 2. Use longer and less confusing error message in the requires (ex: 'IIAM2', 'IIL2', 'IIAM', 'LOK', as error message, decrease the overall readability of the code).

1. Do not use '+=' ('_position.fees0 += fees0', found line 257 and 258 of ./core/contract/AlgebraPool.sol). Instead use "_position.fees0 = _position.fees0 + fees0" in order to save some gas. 3. Use '> 0' instead of '!= 0' to save some gas. ('require(gamma1 != 0 && gamma2 != 0 && volumeGamma != 0, 'Gammas must be > 0')' should be 'require(gamma1 > 0 && gamma2 > 0 && volumeGamma > 0, 'Gammas must be > 0')', found line 110 in /core/contracts/AlgebraFactory.sol) (saves 36 gas per use). 4. Use assembly to write storage value. Line 358 in _updatePositionTicksAndFees() of ./core/contracts/AlgebraPool.sol, instead of "globalState.timepointIndex = newTimepointIndex;", use assembly {sstore(globalState.timepointIndex, newTimepointIndex)} to save gas. 5. Do not use '-=' ('amountRequired -= (step.input + step.feeAmount).toInt256();' line 801 ./core/contract/AlgebraPool.sol). Instead use "amountRequired = amountRequired - (step.input + step.feeAmount).toInt256()"; 6. Splitting require() that use '&&' saves gas (found line 110 of ./src/core/contracts/AlgebraFactory.sol). 7. Using uint smaller than 32 bytes incurs overhead. Each operation involving a uint8 costs an extra 22-28 gas (found line 925 in ./core/contracts/AlgebraPool.sol). 8. Use private rather than public for constants, for exemple the poolDeployer address of AlgebraFactory (found 20 of /Users/olivierdemeaux/Desktop/Code/Auditing/2022-09-quickswap/src/core/contracts/AlgebraFactory.sol).
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