Omniscia Steer Protocol Audit
QuickSwapMultiPositionLiquidityManager Code Style Findings
QuickSwapMultiPositionLiquidityManager Code Style Findings
QSM-01C: Generic Typographic Mistake
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | QuickSwapMultiPositionLiquidityManager.sol:L413 |
Description:
The referenced line contains a typographical mistake (i.e. private variable without an underscore prefix) or generic documentational error (i.e. copy-paste) that should be corrected.
Example:
413// Shares is always >= totalShares so no risk of uint128 overflow here.Recommendation:
We advise this to be done so to enhance the legibility of the codebase.
Alleviation (0c3f85c7c11805ac412fe291f5681bef26da7244):
The referenced comment has been omitted, addressing this exhibit.
QSM-02C: Inefficient Usage of Storage Space
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | QuickSwapMultiPositionLiquidityManager.sol:L15, L36-L38 |
Description:
The LiquidityPositions structure utilized in QuickSwapMultiPositionLiquidityManager is inefficient as it will store multiple dynamic arrays of sub-256-bit elements.
Example:
15LiquidityPositions internal positions;16
17// Types18
19/// @dev The vault's position data. At any given moment this represents20/// all active positions inside the pool.21/// Each lowerTick is the lower bound of the position at that index.22/// Each upperTick is the upper bound of the position at that index.23/// Each relativeWeight is the relative weight of the position at that index,24/// relative to the other positions.25/// So for example if LiquidityPositions is26/// {27/// lowerTicks: [0, 20, 40],28/// upperTicks: [10, 30, 50],29/// relativeWeights: [1, 2, 3]30/// }31/// then that means the vault has 3 positions:32/// 1. 0-10 with relative weight 133/// 2. 20-30 with relative weight 234/// 3. 40-50 with relative weight 335struct LiquidityPositions {36 int24[] lowerTick;37 int24[] upperTick;38 uint16[] relativeWeight;39}Recommendation:
We advise the code to introduce a LiquidityPosition struct that contains the int24, int24, and uint16 entries and the positions member of the contract to be made a LiquidityPosition[] dynamic array.
In this case, a single SSTORE would be required per position rather than three in the current iteration, greatly reducing the gas cost of the contract.
Alleviation (0c3f85c7c11805ac412fe291f5681bef26da7244):
The Steer Protocol team evaluated this exhibit but opted not to apply it in the current iteration of the codebase as it would require significant changes throughout the contract's logic.
QSM-03C: Redundant Convoluted Logic Structure
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | QuickSwapMultiPositionLiquidityManager.sol:L274-L280 |
Description:
The referenced code block will evaluate an if condition, revert if it evaluates to true, and evaluate a require check in its else clause.
Example:
274if (_positions.lowerTick[i - 1] > _positions.lowerTick[i]) {275 revert();276} else {277 require(278 _positions.upperTick[i - 1] < _positions.upperTick[i]279 );280}Recommendation:
We advise the logic structure to be replaced by a single require check, increasing the code's legibility while decreasing its gas cost.
Alleviation (0c3f85c7c11805ac412fe291f5681bef26da7244):
The referenced structure has been optimized to a single require check per our recommendation.
QSM-04C: Repetitive Value Literals
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | QuickSwapMultiPositionLiquidityManager.sol:L143, L145, L371, L375 |
Description:
The linked value literals are repeated across the codebase multiple times.
Example:
143FullMath.mulDiv(balance0, totalWeight, 1e4),Recommendation:
We advise each to be set to its dedicated constant variable instead optimizing the legibility of the codebase.
Alleviation (0c3f85c7c1):
The Steer Protocol team has stated that they do not wish to introduce constant declarations to the contract in fear of increasing its bytecode size.
All variables declared as constant are compilation artefacts and do not affect the contract's bytecode size. As such, we consider this exhibit addressed but advise the Steer Protocol team to reconsider applying it.
Alleviation (b1b5eabd4d):
All repetitive value literals have been properly defined as constant variables in the QuickSwapBaseLiquidityManager dependency of the contract, alleviating this exhibit in full.
