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

feat: Creates design doc for enabling access to hts token evm address #3258

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
36 changes: 36 additions & 0 deletions docs/design/hts_address_tx_receipt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# HTS Token Creation via SystemContract Receipt Enhancement

## Purpose
The purpose of this enhancement is to improve the interoperability between Hedera Token Service (HTS) and Ethereum-compatible tools, like ethers, by ensuring access to the necessary information about newly created tokens, in this case token address. This change specifically addresses the gap in Web3 tooling support when creating tokens through HTS precompile contracts, making user experience smoother.


## Problem Statement
When users create tokens (fungible and non-fungible) by directly calling the 0x167 contract there is no way for to get the contract address of the newly created token via ethers. This is because the transaction receipt's contractAddress field is not being populated with the HTS token address, since essentially the operations is just a contract call, but not a contract create (deploy).
Nana-EC marked this conversation as resolved.
Show resolved Hide resolved

## Current Behaviour

Currently, when creating a token via HTS the address of the system contract is returned as a contractAddress in the transaction receipt.

## Proposed Solution

### Technical Details

1. Function Signature Detection

Detect in the transactionResponse from the mirror node, if the transaction was calling any of the HTS method e.g createFungibleToken/createNonFungibleToken etc.
konstantinabl marked this conversation as resolved.
Show resolved Hide resolved

N.B Currently, HTS supports both v1 and v2 security model function selectors
konstantinabl marked this conversation as resolved.
Show resolved Hide resolved

1. Extract the token address from the call_result field in the transaction response.
Nana-EC marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What approach are you intending to utilize to extract?
Is it just brute force string manipulation or are you using additional logic to parse the bytes into an expected format and pull the address from that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brute force manipulation I would say, Improved the description


2. Add the token address to the receipt


konstantinabl marked this conversation as resolved.
Show resolved Hide resolved
## Testing Requirements

1. Unit tests
konstantinabl marked this conversation as resolved.
Show resolved Hide resolved
1. Test token creation function signature detection

2. Acceptance tests
1. Test fungible token creation flow via ethers and correct receipt response
konstantinabl marked this conversation as resolved.
Show resolved Hide resolved
2. Test non fungible token creation flow via ethers and correct receipt response
Loading