Skip to content

Commit

Permalink
Return responseCode instead of success flag
Browse files Browse the repository at this point in the history
Signed-off-by: nikolay <n.atanasow94@gmail.com>
  • Loading branch information
natanasow committed Aug 7, 2023
1 parent e2eeecc commit be6a362
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
"name": "redirectForToken",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
"internalType": "int256",
"name": "responseCode",
"type": "int256"
},
{
"internalType": "bytes",
"name": "result",
"name": "response",
"type": "bytes"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2419,13 +2419,13 @@
"name": "redirectForToken",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
"internalType": "int64",
"name": "responseCode",
"type": "int64"
},
{
"internalType": "bytes",
"name": "result",
"name": "response",
"type": "bytes"
}
],
Expand Down
4 changes: 2 additions & 2 deletions artifacts/contracts/hts-precompile/KeyHelper.sol/Bits.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"contractName": "Bits",
"sourceName": "contracts/hts-precompile/KeyHelper.sol",
"abi": [],
"bytecode": "0x60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220fabc8592dec17eb236087ae7956eaca7998b9a65c1032a9187947e81b6d3ae8d64736f6c63430008140033",
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220fabc8592dec17eb236087ae7956eaca7998b9a65c1032a9187947e81b6d3ae8d64736f6c63430008140033",
"bytecode": "0x60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220623536fe183ec1c32d263cca46f76e250b99ab32cd18dfb668969df9d3bad46264736f6c63430008140033",
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220623536fe183ec1c32d263cca46f76e250b99ab32cd18dfb668969df9d3bad46264736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions contracts/hts-precompile/HederaTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,12 @@ abstract contract HederaTokenService {
/// Redirect for token
/// @param token The token address
/// @param encodedFunctionSelector The function selector from the ERC20 interface + the bytes input for the function called
function redirectForToken(address token, bytes memory encodedFunctionSelector) external returns (bool success, bytes memory result) {
(success, result) = precompileAddress.call(
function redirectForToken(address token, bytes memory encodedFunctionSelector) external returns (int responseCode, bytes memory response) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.redirectForToken.selector, token, encodedFunctionSelector)
);

emit CallResponseEvent(success, result);
(responseCode, response) = success ? abi.decode(result, (int32, bytes)) : (HederaResponseCodes.UNKNOWN, bytes(""));
}
}
2 changes: 1 addition & 1 deletion contracts/hts-precompile/IHederaTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -797,5 +797,5 @@ interface IHederaTokenService {

/// Initiates a Redirect For Token
/// @param encodedFunctionSelector The function selector from the ERC20 interface + the bytes input for the function called
function redirectForToken(address token, bytes memory encodedFunctionSelector) external returns (bool success, bytes memory result);
function redirectForToken(address token, bytes memory encodedFunctionSelector) external returns (int64 responseCode, bytes memory response);
}

0 comments on commit be6a362

Please sign in to comment.