Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HTS' getTokenInfo and other getters view functions #1116

Open
acuarica opened this issue Dec 18, 2024 · 0 comments · May be fixed by #1127
Open

Make HTS' getTokenInfo and other getters view functions #1116

acuarica opened this issue Dec 18, 2024 · 0 comments · May be fixed by #1127
Assignees

Comments

@acuarica
Copy link
Contributor

The following getter functions are marked as non-view in the IHederaTokenService interface.

function getApproved(address token, uint256 serialNumber) external returns (int64 responseCode, address approved);
function isApprovedForAll(address token, address owner, address operator) external returns (int64 responseCode, bool approved);
function isFrozen(address token, address account) external returns (int64 responseCode, bool frozen);
function isKyc(address token, address account) external returns (int64 responseCode, bool kycGranted);
function getTokenCustomFees(address token) external returns (int64 responseCode, FixedFee[] memory fixedFees, FractionalFee[] memory fractionalFees, RoyaltyFee[] memory royaltyFees);
function getTokenDefaultFreezeStatus(address token) external returns (int64 responseCode, bool defaultFreezeStatus);
function getTokenDefaultKycStatus(address token) external returns (int64 responseCode, bool defaultKycStatus);
function getTokenExpiryInfo(address token) external returns (int64 responseCode, Expiry memory expiry);
function getFungibleTokenInfo(address token) external returns (int64 responseCode, FungibleTokenInfo memory fungibleTokenInfo);
function getTokenInfo(address token) external returns (int64 responseCode, TokenInfo memory tokenInfo);
function getTokenKey(address token, uint keyType) external returns (int64 responseCode, KeyValue memory key);
function getNonFungibleTokenInfo(address token, int64 serialNumber) external returns (int64 responseCode, NonFungibleTokenInfo memory nonFungibleTokenInfo);
function isToken(address token) external returns (int64 responseCode, bool isToken);
function getTokenType(address token) external returns (int64 responseCode, int32 tokenType);

However, because they are getters, they should not modify the token state, and hence they should be marked as view. This will improve usability because view functions are less restrictive, meaning they can be called from both view and non-view functions. Moreover, by making them view functions, they can be also called using eth_call RPC method to retrieve the corresponding value.

These methods should support being called as view. We need to ensure that no client code needs to be modified to ensure compatibility.

@acuarica acuarica self-assigned this Dec 20, 2024
@acuarica acuarica linked a pull request Dec 20, 2024 that will close this issue
2 tasks
@acuarica acuarica linked a pull request Dec 20, 2024 that will close this issue
2 tasks
@acuarica acuarica moved this from Backlog to Sprint Backlog in Smart Contract Sprint Board Dec 20, 2024
@acuarica acuarica moved this from Sprint Backlog to Tasks In Progress in Smart Contract Sprint Board Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Tasks In Progress
Development

Successfully merging a pull request may close this issue.

1 participant