Omniscia Vector Finance Audit

MainStaking Code Style Findings

MainStaking Code Style Findings

MSG-01C: Redundant Timestamp Offset

TypeSeverityLocation
Gas OptimizationInformationalMainStaking.sol:L198, L333

Description:

The linked timestamp offsets for deposits and withdrawals are redundant as the value of block.timestamp is evaluated wtihin the stakingStable implementation.

Example:

contracts/MainStaking.sol
194IStableStaking(stakingStable).deposit(
195 token,
196 amount,
197 address(this),
198 block.timestamp + 60
199);

Recommendation:

We advise the addition to be omitted to optimize the gas cost of the functions.

Alleviation:

The block.timestamp is now properly passed in as is.

MSG-02C: Redundant memory Pointer

TypeSeverityLocation
Gas OptimizationInformationalMainStaking.sol:L290

Description:

The linked memory pointer is redundant as only the size member of poolInfo is utilized.

Example:

contracts/MainStaking.sol
289if (verbose && !(computeAPR == address(0))) {
290 Pool memory poolInfo = pools[token];
291 (APR, decimals) = IComputeAPR(computeAPR).computeAPRStable(
292 token,
293 ptp,
294 afterFee,
295 poolInfo.size
296 );
297 emit RewardPaid(rewarder, ptp, afterFee, APR, decimals);
298}

Recommendation:

We advise it to be set to storage instead to optimize the function's gas cost.

Alleviation:

The linked pointed was correctly adjusted to storage.