F-2024-0015·code-quality

Redundant conditions in WEDXIndexPortfolio

Acknowledgedindex-funddefirebalancing
TL;DR

deposit and setPortfolio guard supplyLendToken with checks that are already enforced inside supplyLendToken itself, so the outer condition is redundant.

Severity
INFO
Impact
LOW
Likelihood
LOW
Method
MManual review
CAT.
Complexity
LOW
Exploitability
LOW
02Section · Description

Description

The deposit and setPortfolio functions have a redundant check in order to call supplyLendToken:

solidity
if (
IWEDXlender(IWEDXGroup(_wedxGroupAddress).getLenderContractAddress()).isLoanPossible(tokenAddresses[i]) == true
&& totalAssets[tokenAddresses[i]] > 0
) {
supplyLendToken(tokenAddresses[i]);
}

This is unnecessary because the supplyLendToken function already includes these checks:

solidity
require(totalAssets[tokenAddress] > 0, "User does not have this token");
require(IWEDXlender(IWEDXGroup(_wedxGroupAddress).getLenderContractAddress()).isLoanPossible(tokenAddress), "Token is not available for lending");
03Section · Recommendation

Recommendation

Remove the redundant condition from the deposit and setPortfolio functions, as supplyLendToken already handles these validations internally. This will streamline the code and avoid unnecessary checks.

F-2024-0015

oog
zealynx

Smart Contract Security Digest

Monthly exploit breakdowns, audit checklists, and DeFi security research — straight to your inbox

© 2026 Zealynx