Omniscia Moby Audit

OptionsToken Code Style Findings

OptionsToken Code Style Findings

OTN-01C: Inefficient Iterator Type

Description:

The EVM is built to operate on 256-bit data slots and is inefficient when dealing with any data type less than that.

The referenced for loop utilizes a uint8 iterator unnecessarily.

Example:

contracts/tokens/OptionsToken.sol
67for (uint8 i = 0; i < length; i++) {
68 IOptionsMarket(optionsMarket).increaseAmountAndNotionalVolume(
69 underlyingAssetIndex,
70 expiry,
71 strikePrices[i],
72 amount,
73 notionalVolume
74 );
75}

Recommendation:

We advise its iterator to be set as uint256, optimizing each loop's increment cost.

Alleviation (b02fae335f62cc1f5f4236fb4d982ad16a32bd26):

This exhibit is no longer applicable as the code it was relevant to has been omitted from the codebase.

OTN-02C: Loop Iterator Optimization

Description:

The linked for loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X).

Example:

contracts/tokens/OptionsToken.sol
67for (uint8 i = 0; i < length; i++) {

Recommendation:

We advise the increment / decrement operation to be performed in an unchecked code block as the last statement within the for loop to optimize its execution cost.

Alleviation (b02fae335f62cc1f5f4236fb4d982ad16a32bd26):

This exhibit is no longer applicable as the code it was relevant to has been omitted from the codebase.