Omniscia SaucerSwap Labs Audit

SafeHederaTokenService Code Style Findings

SafeHederaTokenService Code Style Findings

SHT-01C: Discrepant Implementation of Safe Disassociation

TypeSeverityLocation
Code StyleSafeHederaTokenService.sol:L59-L65

Description:

The SafeHederaTokenService::safeDissociateToken function is misspelled and does not follow the convention of the remaining safe-prefixed functions that invoke the HederaTokenService implementation and apply sanitization on the responseCode.

Impact:

The current code style employed by the function is discrepant to the remaining codebase and uses value-literals instead of configurational variables.

Example:

contracts/hedera/SafeHederaTokenService.sol
59function safeDissociateToken(address token) internal {
60 (bool success, bytes memory result) = address(0x167).call(
61 abi.encodeWithSignature("dissociateToken(address,address)", address(this), token));
62 require(success, "HTS Precompile: CALL_EXCEPTION");
63 int32 responseCode = abi.decode(result, (int32));
64 require(responseCode == 22, 'dissocate fail');
65}

Recommendation:

We advise the SafeHederaTokenService::safeDissociateToken function to invoke HederaTokenService::dissociateToken and to sanitize its responseCode as being equal to HederaResponseCodes.SUCCESS, standardizing the contract's style.

Alleviation (a2c5a0b913a7ddc21ff96f97fa51f2820a5da7ec):

The code's style has been standardized as advised, invoking the HederaTokenService::dissociateToken function directly and sanitizing the output as being HederaResponseCodes::SUCCESS per our recommendation.

SHT-02C: Redundant Parenthesis Statements

TypeSeverityLocation
Code StyleSafeHederaTokenService.sol:L35, L41, L47, L54

Description:

The referenced statements are redundantly wrapped in parenthesis' (()).

Example:

contracts/hedera/SafeHederaTokenService.sol
35(responseCode) = HederaTokenService.associateTokens(account, tokens);

Recommendation:

We advise them to be safely omitted, increasing the legibility of the codebase.

Alleviation (a2c5a0b913a7ddc21ff96f97fa51f2820a5da7ec):

All referenced redundant parenthesis statements have been omitted safely.