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

wasp-cli register-erc20-native-token foundry-sn #3063

Open
DiePutze5853 opened this issue Nov 9, 2023 · 5 comments
Open

wasp-cli register-erc20-native-token foundry-sn #3063

DiePutze5853 opened this issue Nov 9, 2023 · 5 comments

Comments

@DiePutze5853
Copy link

DiePutze5853 commented Nov 9, 2023

Thank you for the PR #3059 @jorgemmsilva !
My wallets in Firefly and Wasp-CLI now generate the same addresses.

Now I have a new problem:
I have created an alias and native token via Firefly and tried to register the token on the chain, but when calling the register-erc20-native-token command I'm getting this error:

Request 0xd6d4438347d81c544e13e14cf7e4171d0dc327d7b409ecabf1700dda9e379e630000:
  Kind: on-ledger
  Sender: rms1qzeuc74k8k7x0gzl6khd9mkucvwv224ftkmzw6pk789tfe6lg7nwqvpvyz3
  Contract Hname: 07cb02c1 (evm)
  Function Hname: c7c436e2 (registerERC20NativeToken)
  Arguments:
    "t": 0x4f4e45
    "d": 0x00
    "fs": 0x01000000
    "n": 0x4f6e65
  Error: foundry with serial number 1 not owned by caller
  Gas budget: 10211500
  Gas burned: 10000
  Gas fee charged: 10000
  Storage deposit charged: 0

Total 0 events

I think this might be due to the fact that I'm calling the wasp-cli command from my wallet address instead of the alias address?

For further reference:
wallet address
alias address

@jorgemmsilva
Copy link
Contributor

I'm sorry for the confusion, we need to improve the documentation and UX with regards to native assets massively.

You should be able to register that alias/foundry output on the chain using the following command:

wasp-cli register-erc20-native-token-on-remote-chain

https://wiki.iota.org/wasp-evm/reference/core-contracts/evm/#registererc20nativetokenonremotechain

@DiePutze5853
Copy link
Author

Mhmm that still didn't work for me.

Created a new wallet in wasp-cli and firefly and then minted the alias and native tokens in firefly.

.\wasp-cli.exe chain register-erc20-native-token-on-remote-chain -s --foundry-sn 1 --target "shimmerevm-testnet" --ticker-symbol "DUST" --token-decimals 0 --token-name "Dust"

Request 0x3cdd9463a349ae3abe1e7eed96db4671058a952a27a1d37604354a744d6b90910000:
  Kind: on-ledger
  Sender: rms1qrkweypvkdql99xjsk6gnpvpwa94pcly59vmshq026fksx796g3xxvhf732
  Contract Hname: 07cb02c1 (evm)
  Function Hname: 08732fb1 (registerERC20NativeTokenOnRemoteChain)
  Arguments:
    "A": 0x0842f7da9bdb55b3ec87e5ac1a1e6d88e16768663fde5eca3429eb6f579cc538ac
    "d": 0x00
    "fs": 0x01000000
    "n": 0x44757374
    "t": 0x44555354
  Error: foundry with serial number 1 not owned by caller
  Gas budget: 141100
  Gas burned: 10000
  Gas fee charged: 10000
  Storage deposit charged: 0

Total 0 events

Hex seed: 0xbfd3dcd415cc049d7e47e32864071340c56ede076b9021724de99e4c29bded39e29f5d6659db05e6234fe1d8a30536c69261f49af9ffe5eec53dd3425a15692f
Alias
Wallet

What is the difference between the --target and --chain flags for the register-erc20-native-token-on-remote-chain command?
When should I use register-erc20-native-token-on-remote-chain and when register-erc20-native-token?

@jorgemmsilva
Copy link
Contributor

Sigh, you're right.
It seems that function is intended to register a foundry that was created on some chain on another (target) chain.
Even myself get confused with the current state of registering L1 assets 😓 .

Right now the only way to actually register it is to make a request on behalf of your alias, and invoke registerERC20ExternalNativeToken on the chain. (there is no wasp-cli helper for this).

The UX sucks right now, this is because the Chain cannot see outputs that don't belong directly to it.
With Iota2.0 we will have a way to prove the contents of outputs, and that should make this whole process more streamlined.

The simplest way, as it stands right now, is to use the chain itself to create a foundry/mint native tokens and then call register-erc20-native-token. (In the future we might do this registering automatically)

Thank you for reporting the issue, it is important to us to identify sore spots like this in the UX and address them 👍

@DiePutze5853
Copy link
Author

Thanks for the response @jorgemmsilva

Is there documentation on how to encode the metadata of the transaction for on-ledger-requests?
I guess if I know in which order the arguments have to be encoded in the metadata field of the transaction I could just send the on-ledger-request with iota-sdk?

I also tried adding a register-erc721-nft-collection command to wasp-cli, but I always get Error: NFTID not found when trying to register a collection. I've sent the collection NFT to the chain as mentioned in a comment in evmimpl/impl.go.
I noticed NFTs aren't listed at all when looking at the total assets of the chain, even though I can see 78 deposited NFTs on the shimmer explorer . Am I doing something wrong, or is registering native NFT collections simply not supported yet?

@jorgemmsilva
Copy link
Contributor

you can find the request metadata specs here: iotaledger/tips#155

That endpoint will only show fungible tokens, to see NFTs that belong to some account, you need to use:

/v1/chains/{chainID}/core/accounts/account/{agentID}/nfts

To call registerERC721NFTCollection you do need to deposit the NFT to the chain and call that function with the same account that owns the collectionNFT. You can find an example of how it should work in this test: https://github.com/iotaledger/wasp/blob/develop/packages/vm/core/evm/evmtest/evm_test.go#L903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants