Omniscia Platypus Finance Audit

MasterPlatypus Static Analysis Findings

MasterPlatypus Static Analysis Findings

MPS-01S: Enumerable Set Optimization

TypeSeverityLocation
Gas OptimizationInformationalMasterPlatypus.sol:L154, L179

Description:

The code currently evaluates the contains check to see if an _lpToken already exists in the set before adding it.

Example:

contracts/MasterPlatypus.sol
154require(!lpTokens.contains(address(_lpToken)), 'add: LP already added');
155
156// update all pools
157massUpdatePools();
158
159// update last time rewards were calculated to now
160uint256 lastRewardTimestamp = block.timestamp > startTimestamp ? block.timestamp : startTimestamp;
161
162// add _allocPoint to total alloc points
163totalAllocPoint = totalAllocPoint + _allocPoint;
164
165// update PoolInfo with the new LP
166poolInfo.push(
167 PoolInfo({
168 lpToken: _lpToken,
169 allocPoint: _allocPoint,
170 lastRewardTimestamp: lastRewardTimestamp,
171 accPtpPerShare: 0,
172 rewarder: _rewarder,
173 sumOfFactors: 0,
174 accPtpPerFactorShare: 0
175 })
176);
177
178// add lpToken to the lpTokens enumerable set
179lpTokens.add(address(_lpToken));

Recommendation:

We advise the add function to be utilized directly in the require check as the bool it yields indicates whether the element was newly added or not.

Alleviation:

The Platypus team considered this exhibit but opted not to apply a remediation for it.

MPS-02S: Test Imports

TypeSeverityLocation
Language SpecificInformationalMasterPlatypus.sol:L15

Description:

The linked import utilizes a debugging file.

Example:

contracts/MasterPlatypus.sol
15import 'hardhat/console.sol';

Recommendation:

We advise it to be omitted from the codebase.

Alleviation:

The test imports no longer exist in the codebase.