Open code423n4 opened 2 years ago
Unnecessary packing of strings
This only impacts the constructor. Since this does not impact end-users, it may be worth keeping the code as-is for readability.
Assembly block optimization
These changes may offer a small savings and be worth considering.
Gas report
Unnecessary packing of strings
In
ConsiderationBase.sol
there are strings that are redundantly being packed. Consider passing them as a single string.Assembly block optimization
In
GettersAndDerivers.sol
there is such assembly fragment of a block:Note that
offerArrPtr
is incremented before the loop and at the end of it. It is not used after the loop has finished its execution. Thus, the incrementation can be put as the first operation in the loop and deleted from before the loop. This will save deployment gas, decrease code size and save execution gas.Also, here such code can be found:
There are two possible optimization that can be used here. One, the first
mload
operation can be skipped by duplicating teh earlier read value from stack (before modifications) (here),The second possible optimization is to use bitwise shift instead of multiplication by a power of 2 - it's more gas efficient.