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

[Bug] AptosCoin does not have a paired metadata #14033

Closed
JoeruCodes opened this issue Jul 17, 2024 · 3 comments
Closed

[Bug] AptosCoin does not have a paired metadata #14033

JoeruCodes opened this issue Jul 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@JoeruCodes
Copy link

JoeruCodes commented Jul 17, 2024

🐛 Bug

According to the documentation it says that for migration reasons all coins automatically have a paired_metadata counterpart, but AptosCoin type doesnt seem to have one when 0x1::coin::paired_metadata is called.

https://aptos.dev/en/build/smart-contracts/fungible-asset

To reproduce

Code snippet to reproduce

    use aptos_framework::aptos_coin::AptosCoin;
    #[test]
    fun test_paired_metadata_for_apt(){
        assert!(option::is_some(&coin::paired_metadata<AptosCoin>()), 1);
    }

Stack trace/error message

┌── test_paired_metadata_for_apt ──────
│ error[E11001]: test failure
│     ┌─ /sources/deployer.move:160:9
│     │
│ 159 │     fun test_paired_metadata_for_apt(){
│     │         ---------------------------- In this function in <addr>::deployer
│ 160 │         assert!(option::is_some(&coin::paired_metadata<AptosCoin>()), 0);
│     │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Test was not expected to error, but it aborted with code 0 originating in the module <addr>::deployer rooted here

Expected Behavior

The assert shouldn't fail and instead of being empty, the option should have the paired metadata of the AptosCoin.

System information

Please complete the following information:

  • Aptos 3.5.0
  • Move
  • PopOS!
@JoeruCodes JoeruCodes added the bug Something isn't working label Jul 17, 2024
@JoeruCodes JoeruCodes changed the title [Bug] APT Coin does not have a paired metadata [Bug] AptosCoin does not have a paired metadata Jul 17, 2024
@JoeruCodes
Copy link
Author

JoeruCodes commented Jul 22, 2024

This function should create fungible_asset in the coin_conversion_table and may resolve this issue the only problem is that, I can't do it in my smart contract as it requires aptos_framework (0x1) as a signer...

Calling this function in the init_module function in the aptos_coin module should virtually solve this problem

image

@lightmark
Copy link
Contributor

If this is for test, can you see #12028 ?
you can all ensure_initialized_with_fa_metadata_for_test before test your own code.

@JoeruCodes
Copy link
Author

I see thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants