Omniscia Tokemak Network Audit
Pool Code Style Findings
Pool Code Style Findings
POO-01C: Redundant Assignment
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Pool.sol:L45 |
Description:
All variables in Solidity are initialized to a default value which in most cases is equivalent to the "0" of the respective type.
Example:
34function initialize(35 IERC20 _underlyer,36 IManager _manager,37 string memory _name,38 string memory _symbol39) public initializer {40 __Context_init_unchained();41 __Ownable_init_unchained();42 __ERC20_init_unchained(_name, _symbol);43 underlyer = _underlyer;44 manager = _manager;45 withheldLiquidity = 0;46}
Recommendation:
We advise the linked assignment to be omitted from the codebase safely as it is ineffectual.
Alleviation:
The redundant assignment was omitted from the codebase.
POO-02C: Redundant Nested Minimum
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Pool.sol:L66-L70 |
Description:
The require
conditional of withdraw
guarantees that requestedAmount
will be less-than-or-equal to requestedWithdrawals[msg.sender].amount
and as such, the minimum between requestedAmount
and underlyer.balanceOf(address(this))
will also uphold this condition.
Example:
61ire(62requestedAmount <= requestedWithdrawals[msg.sender].amount,63"WITHDRAW_INSUFFICIENT_BALANCE"64
65
66256 amount =67Math.min(68 requestedWithdrawals[msg.sender].amount,69 Math.min(underlyer.balanceOf(address(this)), requestedAmount)70);
Recommendation:
We advise the outer Math.min
invocation to be dropped entirely.
Alleviation:
The Math.min
invocation was dropped in favor of manual require
checks that also provide more descriptive error messages, thereby alleviating this exhibit.