Issues minting coin

Hi all,

I’m trying to test minting a new coin on SUI and after using sui client publish --gas-budget 100000000 I get the following errors:

error[E03001]: address with no value
┌─ ./sources/test_token.move:1:8

1 │ module fungible_tokens::testtoken {
│ ^^^^^^^^^^^^^^^ address ‘fungible_tokens’ is not assigned a value. Try assigning it a value when calling the compiler

error[Sui E01001]: invalid object construction
┌─ /Users/koots/.move/https___github_com_MystenLabs_sui_git_framework__testnet/crates/sui-framework/packages/sui-framework/sources/deny_list.move:138:32

138 │ let deny_list_object = DenyList {
│ ╭────────────────────────────────^
139 │ │ id: object::sui_deny_list_object_id(),
│ │ – --------------------------------- Non fresh UID from this position
│ │ │
│ │ The UID must come directly from sui::object::new. Or for tests, it can come from sui::test_scenario::new_object
140 │ │ lists,
141 │ │ };
│ ╰─────────^ Invalid object creation without a newly created UID.

Failed to build Move modules: Compilation error.

My .move file contains:

module fungible_tokens::testtoken {
    use std::option;
    use sui::coin::{Self};
    use sui::transfer;
    use sui::tx_context::{Self, TxContext};

    // Name matches the module name, but in UPPERCASE
    struct TESTTOKEN has drop {}

    // Module initializer is called once on module publish.
    // A treasury cap is sent to the publisher, who then controls minting and burning.
    fun init(witness: TESTTOKEN, ctx: &mut TxContext) {
        let (treasury, metadata) = coin::create_currency(witness, 9, b"TESTTICKER", b"TESTTOKEN", b"", option::none(), ctx);
        transfer::public_freeze_object(metadata);
        transfer::public_transfer(treasury, tx_context::sender(ctx))
    }

    // Manager can mint new TESTTOKEN tokens
    public entry fun mint(
        treasury: &mut coin::TreasuryCap<TESTTOKEN>, amount: u64, recipient: address, ctx: &mut TxContext
    ) {
        coin::mint_and_transfer(treasury, amount, recipient, ctx)
    }

    // Manager can burn TESTTOKEN tokens
    public entry fun burn(treasury: &mut coin::TreasuryCap<TESTTOKEN>, coin: coin::Coin<TESTTOKEN>) {
        coin::burn(treasury, coin);
    }
}

I’ve removed and reinstalled sui cli using the brew tap, so should be on the latest version etc and I have tried on both devnet and mainnet and get the same errors.

Thanks!

2 Likes

Hi @ jameskc

Thanks for reporting this. You might need to install Sui from the devnet or testnet branch, due to some incompatibility between network versions and the CLI. We fixed it and tap should now supply the CLI that fixed that issue (iirc), but here’s another way you could install sui if you have cargo installed.
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui

2 Likes