Platform: Code4rena
Start Date: 12/12/2022
Pot Size: $36,500 USDC
Total HM: 8
Participants: 103
Period: 7 days
Judge: berndartmueller
Id: 193
League: ETH
Rank: 57/103
Findings: 1
Award: $50.16
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xSmartContract
Also found by: 0xGusMcCrae, 8olidity, Bnke0x0, IllIllI, JC, RaymondFam, Rolezn, SleepingBugs, UNCHAIN, ahayashi, aviggiano, caventa, cozzetti, h0wl, helios, immeas, ladboy233, minhquanym, obront, rjs, rvierdiiev, shung, unforgiven, yixxas
50.16 USDC - $50.16
In Pair.sol#L79-L80, Pair.sol#L116-L117, Pair.sol#L119-L120 and Pair.sol#L188-L189 the comments say >
while the actual code is >=
.
In Pair.sol#L156-L157 the comments say <
while the actual code is <=
.
Recommendation: The comments and actual require() calls should be made consistent according to the specification.
Contracts should be deployed with a locked and up to date compiler version that they have been tested with thoroughly. It will help to ensure that the contracts are not deployed with an outdated Solidity compiler version that is known to have vulnerabilities or can cause unexpected behaviour.
Affected: Caviar.sol Pair.sol LpToken.sol SafeERC20Namer.sol
Recommendation: Lock the pragma version
Reference: https://swcregistry.io/docs/SWC-103
The merkleRoot
state variable i declared as bytes32
in Pair.sol#L25 later in Pair.sol#465 a comparision of merkleRoot
with bytes23(0)
is made
Recommendation: change the conversion to bytes32(0)
Both close
(Pair.sol#L343) and withdraw
(Pair.sol#L361) functions have the same require()
check repeated. In such case it is usually a good practice to use functions modifiers in order to increase code readability.
Recommendation: consider implementing a onlyOwner
function modifier that implements the duplicate require()
logic.
Multiple functions in Pair.sol
don't check token amount arguments:
remove
function does not check if lpTokenAmount
argument is greater than 0buy
function does not check if outputAmount
argument is greater than 0sell
function does not check if inputAmount
argument is greater than 0Recommendation: add require() statements checking the amount of tokens passed to the function call
#0 - c4-judge
2023-01-16T11:36:57Z
berndartmueller marked the issue as grade-b