Omniscia Kyo Finance Audit

SmoothTokenStreamConsumer Code Style Findings

SmoothTokenStreamConsumer Code Style Findings

STS-01C: Ineffectual Usage of Safe Arithmetics

Description:

The linked mathematical operation is guaranteed to be performed safely by logical inference, such as surrounding conditionals evaluated in require checks or if-else constructs.

Example:

contracts/reward/SmoothTokenStreamConsumer.sol
69if (lockedAmount <= currentPendingInput) pendingAmount = currentPendingInput - lockedAmount;

Recommendation:

Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statement to be wrapped in an unchecked code block thereby optimizing its execution cost.

Alleviation (17c8d4e59f398021156f6f9657ff278aae0462ae):

The Kyo Finance team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.

STS-02C: Repetitive Value Literals

TypeSeverityLocation
Code StyleSmoothTokenStreamConsumer.sol:
I-1: L37
I-2: L62
I-3: L65
I-4: L66
I-5: L97
I-6: L102
I-7: L104
I-8: L105
I-9: L106

Description:

The linked value literals are repeated across the codebase multiple times.

Example:

contracts/reward/SmoothTokenStreamConsumer.sol
37require(decayRate_ > 0 && decayRate_ < 1e18, InvalidDecayRate(decayRate_));

Recommendation:

We advise each to be set to its dedicated constant variable instead, optimizing the legibility of the codebase.

In case some of the constant declarations have already been introduced, we advise them to be properly re-used across the code.

Alleviation (17c8d4e59f398021156f6f9657ff278aae0462ae):

The Kyo Finance team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.