Closed code423n4 closed 2 years ago
struct QTokensDetails { address underlyingAsset; address strikeAsset; address oracle; uint256 shortStrikePrice; uint256 longStrikePrice; uint256 expiryTime; bool isCall; // <- move close to oracle }
struct QTokenInfo { address underlyingAsset; address strikeAsset; address oracle; uint256 strikePrice; uint256 expiryTime; bool isCall; // <- move close to oracle }
It's possible to save gas using external and calldata.
external
calldata
There are require messages bigger than 32 bytes. More than 32 bytes for message will incur an extra gas costs.
require
Change the incremental logic from i++ to ++i in order to save some opcodes:
i++
++i
Store constant math result into a constant variable.
constant
It's possible to avoid storage access a save gas using immutable keyword for the following variables:
immutable
Use uint8 in _getMonth instead of uint256.
Remove onlyRole modifier because it's called inside the for loop.
onlyRole
Score: 100
It's possible to save gas using
external
andcalldata
.There are
require
messages bigger than 32 bytes. More than 32 bytes for message will incur an extra gas costs.Change the incremental logic from
i++
to++i
in order to save some opcodes:Store
constant
math result into aconstant
variable.It's possible to avoid storage access a save gas using
immutable
keyword for the following variables:Use uint8 in _getMonth instead of uint256.
Remove
onlyRole
modifier because it's called inside the for loop.