Omniscia Kyo Finance Audit
TokenStreamEmitter Code Style Findings
TokenStreamEmitter Code Style Findings
TSE-01C: Illegible Value Literal Representation
Type | Severity | Location |
---|---|---|
Code Style | ![]() | TokenStreamEmitter.sol:L17 |
Description:
The referenced pendingOutputAmountCacheSlot
value is set to a value literal meant to correlate to the EIP-7201 representation of the "TokenStreamEmitter.pendingOutputAmountCacheSlot"
string whose validation is hindered due to the usage of the said literal.
Example:
17bytes32 private constant pendingOutputAmountCacheSlot = 0x9f1862abe01993f17760c1aaa1badf16579f4eccc1b84d72c709ceed3276aa00; // erc7201 "TokenStreamEmitter.pendingOutputAmountCached"
Recommendation:
We advise the assignment to be updated to the EIP-7201 expression as the variable can remain constant
if it utilizes calculations known at compile time.
Alleviation (17c8d4e59f398021156f6f9657ff278aae0462ae):
The Kyo Finance team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
TSE-02C: Redundant Interim Variable
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | TokenStreamEmitter.sol:L27 |
Description:
The referenced slot
variable declaration is inefficient as its value is immediately utilized in the ensuing line.
Example:
26function writeCache(address token, address account, uint128 value) private {27 TransientSlot.Uint256Slot slot = pendingOutputAmountCacheSlot.deriveMapping(token).deriveMapping(account).asUint256();28
29 slot.tstore(uint256(1 << 255) | value);30}
Recommendation:
We advise it to be removed and its reference to be replaced by its expression, optimizing the code's syntax and potentially its gas cost.
Alleviation (17c8d4e59f398021156f6f9657ff278aae0462ae):
The Kyo Finance team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.