Cally contest - Waze's results

Earn yield on your NFTs or tokens via covered call vaults.

General Information

Platform: Code4rena

Start Date: 10/05/2022

Pot Size: $50,000 USDC

Total HM: 13

Participants: 100

Period: 5 days

Judge: HardlyDifficult

Total Solo HM: 1

Id: 122

League: ETH

Cally

Findings Distribution

Researcher Performance

Rank: 52/100

Findings: 2

Award: $85.06

🌟 Selected for report: 0

🚀 Solo Findings: 0

#1 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/CallyNft.sol#L241 storage values data.length should get cached in memory for efficiency gas fee, and there are 2 data.length in line 244.

#2 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/CallyNft.sol#L244 i suggest to use "uint256 i" instead of "uint256 i=0" because default value of uint256 is 0. Use ++i instead of i++, pre-increment is cheaper abput 5 gas per iteration

#3 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L94-L95

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L282 If a variable is not set/initialized, it is assumed to have the default value (0 for uint). Explicitly initializing it with its default value is an anti-pattern and wastes gas.

#4 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L170

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L283

!= 0 costs less gas compared to > 0 for unsigned integers in require statements with the optimizer enabled (6 gas). So, I suggest changing > 0 with != 0

#5 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L167-L168 if you know the length of array, you can write the value. read the array length too expensive.

#6 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L217

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L220

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L328

Comparing to a constant (true or false) is a bit more expensive than directly checking the returned boolean value. I suggest using require(!vault.isExercied) instead of require(vault.isExercied == false), and require(!vault.isWithdrawing) instead of require(vault.isWithdrawing == false).

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