Skip to content

Commit

Permalink
feat: token expiry info support introduced (#151)
Browse files Browse the repository at this point in the history
Signed-off-by: Mariusz Jasuwienas <[email protected]>
  • Loading branch information
arianejasuwienas committed Jan 8, 2025
1 parent 53dd17f commit 6b564b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion contracts/HtsSystemContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {IERC20Events, IERC20} from "./IERC20.sol";
import {IERC721, IERC721Events} from "./IERC721.sol";
import {IHRC719} from "./IHRC719.sol";
import {IHederaTokenService} from "./IHederaTokenService.sol";
import {IDestructible} from "./IDestructible.sol";

address constant HTS_ADDRESS = address(0x167);

Expand Down Expand Up @@ -284,13 +283,21 @@ contract HtsSystemContract is IHederaTokenService, IERC20Events, IERC721Events {

function getTokenDefaultKycStatus(address token)
htsCall external returns (int64 responseCode, bool defaultKycStatus) {
require(token != address(0), "getTokenDefaultKycStatus: invalid address");
(responseCode, _tokenInfo) = IHederaTokenService.getTokenInfo(token);
require(responseCode == 22, "getTokenDefaultKycStatus: failure");
defaultKycStatus = _tokenInfo.defaultKycStatus;
}

function getTokenExpiryInfo(address token) htsCall external returns (int64 responseCode, Expiry memory expiry) {
require(token != address(0), "getTokenExpiryInfo: invalid address");
(responseCode, _tokenInfo) = IHederaTokenService.getTokenInfo(token);
expiry = _tokenInfo.token.expiry;
}

function getTokenDefaultFreezeStatus(address token)
htsCall external returns (int64 responseCode, bool defaultFreezeStatus) {
require(token != address(0), "getTokenDefaultFreezeStatus: invalid address");
(responseCode, _tokenInfo) = IHederaTokenService.getTokenInfo(token);
require(responseCode == 22, "getTokenDefaultFreezeStatus: failure");
defaultFreezeStatus = _tokenInfo.token.freezeDefault;
Expand Down
6 changes: 3 additions & 3 deletions contracts/IHederaTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,9 @@ interface IHederaTokenService {
/// @param token The token address to check
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return expiry Expiry info for `token`
// function getTokenExpiryInfo(address token)
// external
// returns (int64 responseCode, Expiry memory expiry);
function getTokenExpiryInfo(address token)
external
returns (int64 responseCode, Expiry memory expiry);

/// Query fungible token info
/// @param token The token address to check
Expand Down

0 comments on commit 6b564b5

Please sign in to comment.