Open code423n4 opened 2 years ago
use prefix ++i instead of i++ and no need to init i, better if used unchecked too https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/CallyNft.sol#L244-L245
prefer uint256 over other uint types, using smaller uint types doesn't save gas rather increase gas cost https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L76-L79
can mark functions with onlyOwner modifier payable to save more gas as they don't pose risk for user funds loss.
onlyOwner
gas1:
use prefix ++i instead of i++ and no need to init i, better if used unchecked too https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/CallyNft.sol#L244-L245
gas2:
prefer uint256 over other uint types, using smaller uint types doesn't save gas rather increase gas cost https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L76-L79
gas3:
can mark functions with
onlyOwner
modifier payable to save more gas as they don't pose risk for user funds loss.