TYPE_MISMATCH" on Mainnet publish #329
Replies: 3 comments 11 replies
-
I can reproduce this one my end. Here's the simplest code to reproduce. The issue happens at the defining module my_management_addr::test_app {
use aptos_framework::fungible_asset::{Self, MintRef, TransferRef, BurnRef, Metadata};
use aptos_framework::object::{Self, Object};
use aptos_framework::primary_fungible_store;
use std::string;
use std::option;
/// Only fungible asset metadata owner can make changes.
const ENOT_OWNER: u64 = 1;
/// The FA coin is paused.
const EPAUSED: u64 = 2;
const ASSET_SYMBOL: vector<u8> = b"NYC";
/// Hold refs to control the minting, transfer and burning of fungible assets.
struct ManagedFungibleAsset has key {
mint_ref: MintRef,
transfer_ref: TransferRef,
burn_ref: BurnRef,
}
/// Initialize metadata object and store the refs.
fun init_module(admin: &signer) {
let constructor_ref = &object::create_named_object(admin, ASSET_SYMBOL);
primary_fungible_store::create_primary_store_enabled_fungible_asset(
constructor_ref,
option::none(),
string::utf8(b"NYC Coin"), /* name */
string::utf8(ASSET_SYMBOL), /* symbol */
8, /* decimals */
string::utf8(b"https://aptos-metadata.s3.us-east-2.amazonaws.com/xxxxx"), /* icon */
string::utf8(b"http://xxxxx"), /* project */
);
// Create mint/burn/transfer refs to allow creator to manage the fungible asset.
let mint_ref = fungible_asset::generate_mint_ref(constructor_ref);
let burn_ref = fungible_asset::generate_burn_ref(constructor_ref);
let transfer_ref = fungible_asset::generate_transfer_ref(constructor_ref);
let metadata_object_signer = object::generate_signer(constructor_ref);
move_to(
&metadata_object_signer,
ManagedFungibleAsset { mint_ref, transfer_ref, burn_ref }
);
}
#[view]
/// Return the address of the managed fungible asset that's created when this module is deployed.
// Change return type from Metadata to ObjectCore can make publish work.
public fun get_metadata(): Object<Metadata> {
let asset_address = object::create_object_address(&@my_management_addr, ASSET_SYMBOL);
object::address_to_object(asset_address)
}
} |
Beta Was this translation helpful? Give feedback.
-
if it helps, this code is forked from here: |
Beta Was this translation helpful? Give feedback.
-
There have been some recent changes to dynamic dispatch code in the framework. Is it possible you are building against the newer version of the AptosFramework, but trying to run on MainNet (which has a slightly older version deployed)? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Discord user ID
plnkerxd
Describe your question in detail.
getting this error on mainnet publish, Testnet and devnet worked fine:
"Error": "Simulation failed with status: TYPE_MISMATCH"
here is move.toml:
`
[package]
name = "xxx_token"
version = "1.0.0"
authors = []
[addresses]
my_management_addr='xxxx'
[dev-addresses]
[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git",
subdir = "aptos-move/framework/aptos-framework",
rev = "mainnet" }
[dev-dependencies]
`
here is the module:
`
module my_management_addr::xxx_token {
use aptos_framework::fungible_asset::{Self, MintRef, TransferRef, BurnRef, Metadata, FungibleAsset};
use aptos_framework::object::{Self, Object};
use aptos_framework::primary_fungible_store;
use aptos_framework::function_info;
use aptos_framework::dispatchable_fungible_asset;
use std::error;
use std::signer;
use std::string::{Self, utf8};
use std::option;
}
`
What error, if any, are you getting?
% aptos move publish
Compiling, may take a little while to download git dependencies...
FETCHING GIT DEPENDENCY https://github.com/aptos-labs/aptos-core.git
INCLUDING DEPENDENCY AptosFramework
INCLUDING DEPENDENCY AptosStdlib
INCLUDING DEPENDENCY MoveStdlib
BUILDING nameless_token
package size 5608 bytes
{
"Error": "Simulation failed with status: TYPE_MISMATCH"
}
What have you tried or looked at? Or how can we reproduce the error?
No response
Which operating system are you using?
macOS
Which SDK or tool are you using? (if any)
N/A
Describe your environment or tooling in detail
Using aptos CLI
Beta Was this translation helpful? Give feedback.
All reactions