Omniscia Brokoli Network Audit

VestedClaim Code Style Findings

VestedClaim Code Style Findings

VCM-01C: Conditional Optimization

Description:

The linked conditional can be optimized by setting it as inclusive.

Example:

contracts/claim/VestedClaim.sol
34if (timeSinceClaim <= 90 days) {
35 unlockedAmount = _totalAmount.mul(20).div(100);
36} else if (timeSinceClaim > 90 days + 455 days) {
37 unlockedAmount = _totalAmount;
38} else {
39 uint256 unlockedOnClaim = _totalAmount.mul(20).div(100);
40 uint256 vestable = _totalAmount.sub(unlockedOnClaim);
41 uint256 daysSince = timeSinceClaim.sub(90 days) / 1 days;
42
43 unlockedAmount = vestable.mul(daysSince).div(455).add(
44 unlockedOnClaim
45 );
46}

Recommendation:

We advise it to be done so as the equality condition will still yield the same result in the calculations that follow.

VCM-02C: Redundant Usage of SafeMath

Description:

The linked contract utilizes SafeMath when it is compiled with a pragma version of 0.8.X.

Example:

contracts/claim/VestedClaim.sol
2pragma solidity 0.8.9;
3
4import "./BaseClaim.sol";
5
6contract VestedClaim is BaseClaim {
7 using SafeMath for uint256;

Recommendation:

Given that safe arithmetics are toggled on by default in these versions, we advise the usage of SafeMath to be omitted from the codebase as it incurs an additional gas cost at verbosal benefit.