Omniscia SaucerSwap Labs Audit
HTSLib Code Style Findings
HTSLib Code Style Findings
HTS-01C: Direct Hedera Token Service Interactions
| Type | Severity | Location |
|---|---|---|
| Standard Conformity | ![]() | HTSLib.sol: • I-1: L28 • I-2: L36 • I-3: L42 • I-4: L83 |
Description:
Per the official Solidity SDK implementation of Hedera, direct interactions with the pre-compile HederaTokenService can result in uncaught errors when performed via high-level interface based interactions.
Example:
25function mint(IHTS token, uint256 amount) internal returns (uint256) {26 require(amount <= uint64(type(int64).max), "AMOUNT_OVERFLOW");27 bytes[] memory metadata = new bytes[](0);28 (int64 responseCode, int256 newTotalSupply,) = HTS.mintToken(address(token), int64(int256(amount)), metadata);29 require(responseCode == HederaResponseCodes.SUCCESS, _errorMessage("MINT_FAILED_CODE_", responseCode));30 assert(newTotalSupply >= 0);31 return uint256(newTotalSupply);32}Recommendation:
We advise all interactions to be adjusted to low-level call interactions, ensuring that any potential underlying error in the pre-compile wraps to an UNKNOWN error.
Alleviation (785446ee095db8d42f50665408df09339b4513d8):
The codebase has undergone a significant refactor rendering this exhibit no longer applicable.
HTS-02C: Ineffectual Usage of Safe Arithmetics
| Type | Severity | Location |
|---|---|---|
| Language Specific | ![]() | HTSLib.sol: • I-1: L109 • I-2: L110 • I-3: L113 • I-4: L121 • I-5: L122 • I-6: L123 |
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.
Example:
108while (temp2 != 0) {109 digits++;110 temp2 /= 10;111}Recommendation:
Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.
Alleviation (785446ee095db8d42f50665408df09339b4513d8):
The codebase has undergone a significant refactor rendering this exhibit no longer applicable.
