Omniscia Flisko Audit

IDO Code Style Findings

IDO Code Style Findings

IDO-01C: File Structure

TypeSeverityLocation
Code StyleInformationalIDO.sol:L10-L16

Description:

The KSTStaking interface declared within IDO.sol can also be inherited by the actual KSTStaking.sol implementation.

Example:

contracts/IDO.sol
10interface KSTStaking {
11 function lock(address user, uint256 userUnlockTime) external;
12
13 function addIDO(address account) external;
14
15 function stakedBalance(address account) external view returns (uint256);
16}

Recommendation:

We advise the interface to be extracted from the file and set in its dedicated IKSTStaking.sol file, be renamed as IKSTStaking and imported by both IDO.sol and KSTStaking.sol and properly utilized.

Alleviation:

The interface was properly relocated to IKSTStaking.sol.

IDO-02C: Inexistent Error Messages

TypeSeverityLocation
Code StyleInformationalIDO.sol:L215, L228, L241, L254, L267

Description:

The linked require statements contain no error message specified.

Example:

contracts/IDO.sol
202require(
203 t1.allowedSwap[msg.sender],
204 "IDO: T1 not selected for swap"
205);
206require(
207 idoTokenAmount.add(t1.totalSwapped) <= tierTokenAlloc,
208 "IDO: T1 swap amount too big."
209);
210require(
211 block.timestamp >= t1.swapStart &&
212 block.timestamp <= t1.swapEnd,
213 "IDO: t1 swap start/end not time"
214);
215require(swap(swapTokenAmount));
216claimed[msg.sender] = Claimable(swapTokenAmount, idoTokenAmount, 0);
217t1.totalSwapped = t1.totalSwapped.add(idoTokenAmount);

Recommendation:

We advise one to be explicitly specified to aid in the debugging process of the smart contract system.

Alleviation:

Error messages were properly introduced to the linked require statements.

IDO-03C: Storage Read Optimizations

TypeSeverityLocation
Gas OptimizationInformationalIDO.sol:L105-L118

Description:

The constructor of the contract redundantly reads values from storage multiple times.

Example:

contracts/IDO.sol
105t1.swapStart = data[0];
106t1.swapEnd = t1.swapStart.add(data[10]);
107
108t2.swapStart = t1.swapEnd;
109t2.swapEnd = t2.swapStart.add(data[11]);
110
111t3.swapStart = t2.swapEnd;
112t3.swapEnd = t3.swapStart.add(data[12]);
113
114t4.swapStart = t3.swapEnd;
115t4.swapEnd = t4.swapStart.add(data[13]);
116
117t5.swapStart = t4.swapEnd;
118t5.swapEnd = t5.swapStart.add(data[14]);

Recommendation:

We advise an in-memory variable to be utilized instead that is incremented each time by the tier duration to ensure optimal execution of the contract's constructor.

Alleviation:

Our recommendation was followed whereby a dateEnd memory variable was introduced that is incremented before each tier value assignment.