Omniscia Swisscoast Audit

BaseHST Code Style Findings

BaseHST Code Style Findings

BHS-01C: Inefficient Function Implementation

Description:

The BaseHST::_checkResponse function will either successfully execute and yield true, or revert.

Example:

packages/contracts/contracts/Dependencies/BaseHST.sol
34function _transfer(address token, address sender, address receiver, uint256 amount) internal returns (bool success) {
35 require(amount <= uint256(type(int64).max), "transfer amount exceeds int64 limits");
36 int64 safeAmount = int64(amount);
37 int responseCode = HederaTokenService.transferToken(token, sender, receiver, safeAmount);
38 emit Transfer(token, sender, receiver, safeAmount);
39 return _checkResponse(responseCode);
40}
41
42function _checkResponse(int responseCode) internal pure returns (bool) {
43 require(responseCode == HederaResponseCodes.SUCCESS, "ResponseCodeInvalid: provided code is not success");
44 return true;
45}

Recommendation:

We advise its return variable to be removed, ensuring that it is invoked as a validation function without requiring use of its return argument.

Alleviation (04618e407bddce5b22e9cadd787fd3334bd3afe6):

The BaseHST::_checkResponse function was updated to no longer yield a bool variable, addressing this exhibit.