Omniscia Flisko Audit

IDOFactory Code Style Findings

IDOFactory Code Style Findings

IDF-01C: Inexplicable Contract-Level Variable

TypeSeverityLocation
Gas OptimizationInformationalIDOFactory.sol:L8, L19, L20

Description:

The IDOFactory contract is meant to act as a utility contract initializing a new deployment of the IDO and adding it to the KSTStaking contract. In doing so, a contract-level staking variable is assigned.

Example:

contracts/IDOFactory.sol
8KSTStaking public staking;
9function createIDO(
10 uint256[15] memory data,
11 address _idoToken,
12 address _staking,
13 address _swapToken,
14 uint256 _swapTokenPrice
15) public onlyOwner returns (address) {
16 IDO ido = new IDO(data, _idoToken, _staking, _swapToken);
17 ido.setSwapPrice(_swapTokenPrice);
18 ido.transferOwnership(msg.sender);
19 staking = KSTStaking(_staking);
20 staking.addIDO(address(ido));
21 emit IDOCreated(address(ido));
22 return address(ido);
23}

Recommendation:

We advise the assignment and corresponding contract-level variable to be omitted as they appear to bear no purpose in the overall contract system.

Alleviation:

The contract-level assignment was omitted and an in-memory declaration was introduced.