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

Findings: 2

Award: $76.09

🌟 Selected for report: 0

🚀 Solo Findings: 0

emit SHOULD STAY AT END OF THE FUNCTION

This will prevent services that watch the event log from falling victim to re-entrance style attacks. Using emit at end makes transaction event logs produced chronologically sensible. https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraFactory.sol#L79 77: function setOwner(address _owner) external override onlyOwner { 78: require(owner != _owner); 79: emit Owner(_owner); 80: owner = _owner; } https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraFactory.sol#L86 https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraFactory.sol#L93

NO ERROR MESSAGE PROVIDED

In require there is no error message function will revert if required condition is not fulfilled without any error. https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraFactory.sol#L43 require(msg.sender == owner); https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraFactory.sol#L62 https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraFactory.sol#L92

Recommendation use appropriate error in require so that user will now the cause of revert.

interfaces/IAlgebraPoolDeployer.sol IS NEVER USED

In AlgebraPool contract IAlgebraPoolDeployer.sol is never used it can be removed. Unless there is a plan to use it in the future.

INSTEAD OF USING > 0 YOU SHOULD USE != 0

In this if statement it is checking if communityFee > 0 but communityFee is uint245 which can't be less then 0 so instead of using > 0 use !=0 it will save gas. https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraPool.sol#L667 if (communityFee > 0) { There are lot of them in code i didn't mentioned all of them.

ABI.ENCODE() is less efficient than ABI.encodedpacked()

Changing abi.encode function to abi.encodePacked can save gas since the abi.encode function pads extra null bytes at the end of the call data, which is unnecessary. Also, in general, abi.encodePacked is more gas-efficient. pool = address(uint256(keccak256(abi.encodePacked(hex'ff', poolDeployer, keccak256(abi.encode(token0, token1)), POOL_INIT_CODE_HASH)))); You can check this for more https://github.com/code-423n4/2022-09-quickswap/blob/main/src/core/contracts/AlgebraFactory.sol#L123

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