code-423n4 / 2022-05-cally-findings

2 stars 0 forks source link

QA Report #296

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Low severity issues

Incorrect revert message

In contracts/src/Cally.sol#L169 the revert message is false - "Reserve strike too small". If reverts, it is too large. Additionally, a sharp inequality is used - someone may want just to present a price and skip the dutch auction - then equality would be useful.

Non-critical issues

Use !value instead of value == false

To increase readability, negate bool values instead of ensuring they are false. This is a best practice.

Cally.sol#L217

Cally.sol#L220

Cally.sol#L328

Economic calculations unnecessarily use approximations

In Cally.getDutchAuctionStrike(...) there are fixed-point calculations. At first progress is approximated, then used in calculations. It would be more precise to inline the calculation in the strike calculation.

Instead of:

        uint256 progress = (1e18 * delta) / AUCTION_DURATION;
        uint256 auctionStrike = (progress * progress * startingStrike) / (1e18 * 1e18);

write:

        uint256 auctionStrike = (delta * delta * startingStrike) / (AUCTION_DURATION * AUCTION_DURATION);
HardlyDifficult commented 2 years ago

Merging with https://github.com/code-423n4/2022-05-cally-findings/issues/299