Omniscia DAFI Audit

TokenPool Code Style Findings

TokenPool Code Style Findings

TPL-01C: Type Optimization

TypeSeverityLocation
Code StyleInformationalTokenPool.sol:L34, L37

Description:

The tokenToRescue argument can be set as IERC20 without affecting the logic of the function.

Example:

contracts/TokenPool.sol
34function rescueFunds(address tokenToRescue, address to, uint256 amount) external onlyWhitelist returns (bool) {
35 require(address(token) != tokenToRescue, 'TokenPool: Cannot claim token held by the contract');
36
37 return IERC20(tokenToRescue).transfer(to, amount);
38}

Recommendation:

We advise it to be done so avoiding the address and IERC20 casts of token and tokenToRescue respectively.

Alleviation:

The tokenToRescue variable was properly set as IERC20 but it is redundantly cast again in the ensuing line, defeating the purpose of the type specifier.

TPL-02C: Variable Mutability Specifier

TypeSeverityLocation
Gas OptimizationInformationalTokenPool.sol:L12, L15

Description:

The token variable is assigned to only once during the contract's constructor.

Example:

contracts/TokenPool.sol
14constructor(IERC20 _token) {
15 token = _token;
16}

Recommendation:

We advise it to be set as immutable greatly optimizing the contract's gas cost.

Alleviation:

The immutable attribute was properly set for the token variable greatly optimizing the codebase.