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

ContractId.fromEvmAddress(0, 0, 0xAddress) as parameter for setSupplyKey in TokenUpdateTransaction seems to save a different value #2626

Open
mgarbs opened this issue Oct 30, 2024 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@mgarbs
Copy link

mgarbs commented Oct 30, 2024

Problem

When using the SDK method ContractId.fromEvmAddress() to convert an EVM address into a Hedera ContractId for TokenUpdate transactions (specifically to set the supply key), the resulting value becomes 0.0.0. This behavior occurs even when providing a valid deployed contract’s EVM address.

Description

When using the SDK method ContractId.fromEvmAddress() to convert an EVM address into a Hedera ContractId for TokenUpdate transactions (specifically to set the supply key), the resulting value of the updated supply key becomes 0.0.0. This behavior occurs even when providing a valid deployed contract’s EVM address.

Steps to Reproduce

  1. Deploy a smart contract to the Hedera network and retrieve the EVM address.
  2. Use the following code to convert the EVM address to a ContractId:

const contractId = ContractId.fromEvmAddress(0, 0, deployedContract0xAddress);

  1. Use the generated ContractId in a TokenUpdateTransaction to set the supply key:
    const transaction = new TokenUpdateTransaction()
        .setTokenId("0.0.5059257")
        .setSupplyKey(contractId);
  1. Observe that the supply key becomes 0.0.0 instead of the expected 0.0.xxxx.

Solution

I do not know what the best solution would be, but this is the way I was able to set the contract as the supply key

  • I queried the mirror node with the evm address and get the 0.0.xxx contractID
  • I used this value for setSupplyKey in TokenUpdateTransaction
  • Tx SUCCESS and it is the expected value

Alternatives

It would be nice if I could just pass something like const contractId = ContractId.fromEvmAddress(0, 0, deployedContract0xAddress) or PublicKey.fromStringECDSA(deployedContract0xAddress)

@mgarbs mgarbs added the enhancement New feature or request label Oct 30, 2024
@mgarbs mgarbs changed the title ContractId.fromEvmAddress(0, 0, 0xAddress) returns incorrect 0.0.0 key when used in TokenUpdate to update to rotate keys ContractId.fromEvmAddress(0, 0, 0xAddress) returns incorrect 0.0.0 key value when used in TokenUpdateTransaction to update to rotate keys Oct 30, 2024
@mgarbs mgarbs changed the title ContractId.fromEvmAddress(0, 0, 0xAddress) returns incorrect 0.0.0 key value when used in TokenUpdateTransaction to update to rotate keys ContractId.fromEvmAddress(0, 0, 0xAddress) returns incorrect 0.0.0 key value when used in TokenUpdateTransaction Oct 30, 2024
@mgarbs mgarbs changed the title ContractId.fromEvmAddress(0, 0, 0xAddress) returns incorrect 0.0.0 key value when used in TokenUpdateTransaction ContractId.fromEvmAddress(0, 0, 0xAddress) as parameter for setSupplyKey in TokenUpdateTransaction seems to save a different value Oct 31, 2024
@mgarbs mgarbs added the bug Something isn't working label Oct 31, 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 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant