Platform: Code4rena
Start Date: 11/11/2022
Pot Size: $36,500 USDC
Total HM: 5
Participants: 62
Period: 3 days
Judge: berndartmueller
Id: 181
League: ETH
Rank: 56/62
Findings: 1
Award: $22.22
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: ReyAdmirado
Also found by: 0x4non, 0xRoxas, 0xab00, Awesome, Aymen0909, Bnke0x0, Deivitto, Diana, IllIllI, Rahoz, RaymondFam, Rolezn, Sathish9098, ajtra, aphak5010, aviggiano, c3phas, carlitox477, ch0bu, cryptostellar5, erictee, lukris02, martin, rotcivegaf, saian, shark, trustindistrust, zaskoh
22.2155 USDC - $22.22
Some functions only call by external should declare at external visibility.
https://github.com/code-423n4/2022-11-non-fungible/blob/323b7cbf607425dd81da96c0777c8b12e800305d/contracts/Pool.sol#L58 https://github.com/code-423n4/2022-11-non-fungible/blob/323b7cbf607425dd81da96c0777c8b12e800305d/contracts/Pool.sol#L44
In function incrementNonce
we should use ++ to save gas
function incrementNonce() external { ++nonces[msg.sender]; emit NonceIncremented(msg.sender, nonces[msg.sender]); }
Variable Exchange.isOpen
now switch between 0-1
We should consider to change it to 1-2 because convert from non-zero to non-zero is cheaper than non-zero to zero
According to EIP-1087: https://eips.ethereum.org/EIPS/eip-1087, it take 20,000 gas to set a slot from 0 to non-zero with SSTORE while it takes only 5000 gas for any other change
uint256 public isOpen = 1; modifier whenOpen() { require(isOpen == 2, "Closed"); _; } function open() external onlyOwner { isOpen = 2; emit Opened(); } function close() external onlyOwner { isOpen = 1; emit Closed(); }
#0 - c4-judge
2022-11-17T14:12:43Z
berndartmueller marked the issue as grade-b