Omniscia Sheesha Finance Audit

BaseVesting Code Style Findings

BaseVesting Code Style Findings

BVG-01C: Redundant Conditional

TypeSeverityLocation
Gas OptimizationInformationalBaseVesting.sol:L211

Description:

The first part of the else if conditional is guaranteed by the preceding if conditional and thus can be omitted.

Example:

contracts/BaseContracts/BaseVesting.sol
208if (currentTimeStamp < startDate) {
209 return 0;
210} else if (
211 currentTimeStamp >= startDate && currentTimeStamp < vestingTimeEnd
212) {
213 uint256 noOfDays = currentTimeStamp.sub(startDate).div(PERIOD);
214 uint256 currentUnlockedPercentage = noOfDays.mul(
215 everyDayReleasePercentage
216 );
217 return currentUnlockedPercentage;
218} else {
219 return PERCENTAGE;
220}

Recommendation:

We advise it to be omitted to reduce the gas cost of the function.

Alleviation:

The conditional was instead adjusted to omit the first case altogether. In the new implementation, execution of _calculateAvailablePercentage is impossible prior to the startDate indirectly due to the underflow of currentTimeStamp.sub(startDate), thus rendering the omission of the first clause safe.

BVG-02C: Redundant Visibility Specifiers

TypeSeverityLocation
Gas OptimizationInformationalBaseVesting.sol:L18, L19

Description:

The linked variables are contract-level constant declarations that are made available publicly via the public visibility specifier.

Example:

contracts/BaseContracts/BaseVesting.sol
18uint256 public constant PERIOD = 1 days;
19uint256 public constant PERCENTAGE = 1e20;

Recommendation:

We advise the visibility specifier to be omitted given that it currently generates redundant bytecode.

Alleviation:

Although the visibility specifiers were omitted, we advise them to be set as internal. This is due to inexistent specifiers having one defined by the compiler which may differ between compiler versions and thus cause discrepancies in the compiled bytecode output.

BVG-03C: Variable Typo

TypeSeverityLocation
Code StyleInformationalBaseVesting.sol:L141, L146

Description:

The variable percenageLP is incorrectly spelled.

Example:

contracts/BaseContracts/BaseVesting.sol
139/**
140 * @dev Returns current available rewards for investor
141 * @param percenageLP investor percenage for LP stake
142 * @param percentageNative investor percentage for Native stake
143 */
144function getRewardBalance(
145 address beneficiary,
146 uint256 percenageLP,
147 uint256 percentageNative
148) public view returns (uint256 amount) {

Recommendation:

We advise it to be corrected to percentageLP.

Alleviation:

The variable was properly renamed.