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

Can't get HTS token address when creating the token using the interface IHederaTokenService #901

Open
ed-marquez opened this issue Aug 12, 2024 · 0 comments
Labels
bug Something isn't working HTS Hedera Token Service related

Comments

@ed-marquez
Copy link

Description

Problem:
When creating an HTS token using the interface IHederaTokenService, a developer can't get the token address using Ethers JS.

Context:

  • IHederaTokenService (see file here) has the function createNonFungibleToken which returns (int64 responseCode, address tokenAddress);
  • I currently have the JS code shown in the screenshot (see full code in this repo), which successfully creates the token calling the function createNonFungibleToken.
  • Despite the token creation working well, I can’t get the address of the newly created token using Ethers.
    -- Decomposing the transaction output does not return the responseCode or the tokenAddress. I think this works when creating the token through a wrapper/intermediary contract, but it doesn’t seem to work when calling the system contract using the interface…
    -- The logs of the tx receipt are empty and there are no events.

image

For devs working with Ethers/Hardhat, those tools only return a transaction hash (no tx ID).
The mirror node REST API supports querying transactions with our 48-byte form of the tx hash, not the Ethereum 32-bytes one. So querying mirror nodes with the tx hashed obtained would not be seamless either.

Possible Solution:

  • We are emitting a log for HTS transfers.
  • We could assimilate the creation of a new token as the creation of a new smart contract, so we can use the same format for the receipt. That would be something all the Ethereum tools can easily understand and work with out of the box, without having to rely on custom logs.

Thanks to everyone who provided feedback and input!

Steps to reproduce

  1. Run this repo with GitPod via this link: https://gitpod.io/?autostart=true#https://github.com/ed-marquez/hedera-example-create-tokens-via-contracts/tree/5351753720d3db77cfab098834527fae1eafa299
  2. Enter npx hardhat test on the terminal
  3. See the results of the 3rd test case

Additional context

No response

Hedera network

mainnet, testnet

Version

v0.52

Operating system

macOS

@ed-marquez ed-marquez added the bug Something isn't working label Aug 12, 2024
@Nana-EC Nana-EC added the HTS Hedera Token Service related label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working HTS Hedera Token Service related
Projects
Status: Sprint Backlog
Development

No branches or pull requests

2 participants