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

Findings: 2

Award: $76.06

🌟 Selected for report: 0

🚀 Solo Findings: 0

Report

Low

L-01: use two-step process for criticial address changes

Consider using a two-step process for transferring the ownership of a contract. While it costs a little more gas, it's safer than transferring directly.

Here's an example from the Compound Timelock contract: https://github.com/compound-finance/compound-protocol/blob/master/contracts/Timelock.sol#L45-L58

L-02: pool isn't initialized after creation

A pool has a initialize() function where the initial price is set and the pool is unlocked. Inside the simulation and deployment scripts, the function is never called. Uniswap uses a custom contract, PoolInitializer, to deploy pools where the initialize function is called right after deployment.

Gas Report

G-01: AlgebraPoolDeployer.owner can be immutable

The value is only set once in the constructor

G-02: if clause in AlgebraPool.collect() can be split up to save gas

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);
}

By splitting it up you save one if clause:

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