Omniscia Olive Audit

Pool Code Style Findings

Pool Code Style Findings

POO-01C: Inefficient Re-Entrancy Guard

Description:

The linked re-entrancy guard is custom made and utilizes a bool to signal its status.

Example:

contracts/pools/Pool.sol
36modifier nonReentrant() {
37 require(!_entered, "ReentrancyGuard: reentrant call");
38 _entered = true;
39 _;
40 _entered = false;
41}

Recommendation:

We advise a similar paradigm to OpenZeppelin's ReentrancyGuard contract to be utilized whereby the guard value is represented at both instances (entered / not entered) by a non-zero value to ensure gas optimization.

Alleviation:

The OpenZeppelin ReentrancyGuard implementation is now properly utilized in the codebase.

POO-02C: Redundant Usage of SafeMath

TypeSeverityLocation
Gas OptimizationPool.sol:L21

Description:

The project's code is compiled with a compiler version beyond 0.8.X which has built-in safe arithmetics toggled on by default.

Example:

contracts/pools/Pool.sol
3pragma solidity 0.8.4;
4pragma experimental ABIEncoderV2;
5
6import "../interfaces/ILiquidityPool.sol";
7import "../interfaces/IManager.sol";
8import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
9import {SafeMathUpgradeable as SafeMath} from "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
10import {MathUpgradeable as Math} from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
11import {OwnableUpgradeable as Ownable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
12import {ERC20Upgradeable as ERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
13import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
14import {SafeERC20Upgradeable as SafeERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
15import {PausableUpgradeable as Pausable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
16import "../interfaces/events/BalanceUpdateEvent.sol";
17
18import "hardhat/console.sol";
19
20contract Pool is ILiquidityPool, Initializable, ERC20, Ownable, Pausable {
21 using SafeMath for uint256;

Recommendation:

We advise the codebase to omit the usage of SafeMath in favor of reduced gas costs.

Alleviation:

The redundant usage of SafeMath has been safely omitted from the codebase.