{
  "version": 2,
  "compiler": "sui 1.81.1-e04cf9aa915c",
  "source_digest": "edd8c717e8e05973a6d9857d2262ae32e50a691d580666d0613ee96e8577d31d",
  "sources": {
    "Move.toml": "[package]\nname = \"RockTheCoinSuiNftCreatorV2\"\nedition = \"2024.beta\"\n\n[dependencies]\nSui = { git = \"https://github.com/MystenLabs/sui.git\", subdir = \"crates/sui-framework/packages/sui-framework\", rev = \"e04cf9aa915cb6c069092733bebc3648755998e2\" }\nRockTheCoinSuiSuiteV1 = { local = \"../../sui-suite-v1/package\" }\n\n[addresses]\nrtc_asset = \"0x0\"\n\n[environments]\nmainnet = \"35834a8a\"\n",
    "sources/rtc_nft.move": "module rtc_asset::rtc_nft;\n\nuse std::string::{Self, String};\nuse sui::display;\nuse sui::event;\nuse sui::package;\nuse sui::transfer_policy;\nuse rtc_suite::collection::{Self, Collection};\n\npublic struct RTC_NFT has drop {}\npublic struct Nft has key, store {\n    id: UID, collection: ID, serial: u64, name: String, symbol: String,\n    description: String, image_url: String, metadata_uri: String, frozen: bool,\n}\npublic struct Created has copy, drop { quote_id: vector<u8>, creator: address, collection: ID, policy: ID }\npublic struct Minted has copy, drop { collection: ID, item: ID, serial: u64, recipient: address }\npublic struct Burned has copy, drop { collection: ID, item: ID, serial: u64 }\n\nconst INITIAL_MINT: u8 = 252;\nconst INITIAL_FROZEN: u8 = 251;\nconst RECIPIENT: address = @0x7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d7d;\nconst QUOTE_ID: vector<u8> = b\"RTC_SUITE_QUOTE_V1\";\nconst NAME: vector<u8> = b\"RTC_SUITE_NFT_NAME_V1\";\nconst SYMBOL: vector<u8> = b\"RTC_SUITE_NFT_SYMBOL_V1\";\nconst DESCRIPTION: vector<u8> = b\"RTC_SUITE_NFT_DESCRIPTION_V1\";\nconst IMAGE_URL: vector<u8> = b\"RTC_SUITE_NFT_IMAGE_V1\";\nconst METADATA_URI: vector<u8> = b\"RTC_SUITE_NFT_METADATA_V1\";\nconst MAXIMUM: u64 = 18446744073709551002;\nconst FLAGS: u64 = 9223372036854775001;\nconst ROYALTY: u16 = 65001;\nconst ROYALTY_MAXIMUM: u16 = 65002;\nconst OWNER: address = @0x7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c;\nconst ROYALTY_TO: address = @0x7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e;\nconst DELEGATES: vector<address> = vector[@0x7101];\nconst MASKS: vector<u64> = vector[7101];\n\n#[allow(deprecated_usage, lint(share_owned))]\nfun init(witness: RTC_NFT, ctx: &mut TxContext) {\n    assert!(QUOTE_ID.length() == 32 && (FLAGS & 14) == FLAGS, 1);\n    let publisher = package::claim(witness, ctx);\n    let mut display = display::new_with_fields<Nft>(&publisher,\n        vector[string::utf8(b\"name\"), string::utf8(b\"description\"),\n            string::utf8(b\"image_url\"), string::utf8(b\"link\")],\n        vector[string::utf8(b\"{name}\"), string::utf8(b\"{description}\"),\n            string::utf8(b\"{image_url}\"), string::utf8(b\"{metadata_uri}\")], ctx);\n    display.update_version(); transfer::public_freeze_object(display);\n    let (mut policy, cap) = transfer_policy::new<Nft>(&publisher, ctx);\n    // A frozen Publisher would let anyone create another policy for this type.\n    package::burn_publisher(publisher);\n    let mut collection = collection::new(&mut policy, cap, OWNER, DELEGATES, MASKS,\n        string::utf8(NAME), string::utf8(SYMBOL), string::utf8(DESCRIPTION),\n        string::utf8(IMAGE_URL), string::utf8(METADATA_URI), MAXIMUM,\n        (FLAGS & 2) != 0, (FLAGS & 4) != 0, ROYALTY, ROYALTY_TO,\n        ROYALTY_MAXIMUM, (FLAGS & 8) != 0, ctx);\n    event::emit(Created { quote_id: QUOTE_ID, creator: ctx.sender(),\n        collection: object::id(&collection), policy: object::id(&policy) });\n    assert!(INITIAL_MINT <= 1 && INITIAL_FROZEN <= 1 && RECIPIENT != @0x0, 1);\n    if (INITIAL_MINT == 1) mint(&mut collection, string::utf8(NAME),\n        string::utf8(DESCRIPTION), string::utf8(IMAGE_URL), string::utf8(METADATA_URI),\n        INITIAL_FROZEN == 1, RECIPIENT, ctx);\n    transfer::public_share_object(policy); transfer::public_share_object(collection);\n}\n\npublic fun mint(c: &mut Collection<Nft>, name: String, description: String,\n    image_url: String, metadata_uri: String, frozen: bool, recipient: address,\n    ctx: &mut TxContext) {\n    check_fields(&name, &description, &image_url, &metadata_uri);\n    assert!(recipient != @0x0, 1);\n    let (collection, serial) = collection::consume_ticket(collection::authorize_mint(c, ctx));\n    let nft = Nft { id: object::new(ctx), collection, serial, name,\n        symbol: string::utf8(SYMBOL), description, image_url, metadata_uri,\n        frozen: frozen || !collection::metadata_mutable(c) };\n    event::emit(Minted { collection, item: object::id(&nft), serial, recipient });\n    transfer::public_transfer(nft, recipient);\n}\n/// An owned NFT also needs its holder's approval as a mutable transaction input.\npublic fun update(c: &Collection<Nft>, nft: &mut Nft, name: String,\n    description: String, image_url: String, metadata_uri: String, freeze: bool,\n    ctx: &TxContext) {\n    collection::assert_metadata(c, ctx);\n    assert!(nft.collection == object::id(c) && !nft.frozen, 2);\n    check_fields(&name, &description, &image_url, &metadata_uri);\n    nft.name = name; nft.description = description; nft.image_url = image_url;\n    nft.metadata_uri = metadata_uri; nft.frozen = freeze;\n}\npublic fun freeze_item(nft: &mut Nft) { nft.frozen = true; }\npublic fun burn(c: &Collection<Nft>, nft: Nft) {\n    assert!(collection::burnable(c) && nft.collection == object::id(c), 3);\n    let Nft { id, collection, serial, name: _, symbol: _, description: _,\n        image_url: _, metadata_uri: _, frozen: _ } = nft;\n    event::emit(Burned { collection, item: object::uid_to_inner(&id), serial });\n    object::delete(id);\n}\nfun check_fields(name: &String, description: &String, image_url: &String, uri: &String) {\n    assert!(name.length() > 0 && name.length() <= 32 && description.length() <= 2000 &&\n        image_url.length() > 0 && image_url.length() <= 500 && uri.length() <= 600, 1);\n}\n#[test_only]\npublic fun init_for_testing(ctx: &mut TxContext) { init(RTC_NFT {}, ctx); }\n",
    "tests/creator_tests.move": "#[test_only]\nmodule rtc_asset::creator_tests;\n\nuse rtc_asset::rtc_nft::{Self, Nft};\nuse rtc_suite::collection::{Self, Collection};\nuse sui::package::Publisher;\nuse sui::test_scenario as ts;\nuse std::string::utf8;\n\n// scripts/test-sui-creators-v2.mjs patches only a temporary copy with the same\n// typed constants used by the customer transaction builder. Production source\n// and frozen library bytes are never changed by these native VM tests.\n#[test]\nfun initialization_mints_once_and_burns_the_publisher() {\n    let mut s = ts::begin(@0xa); rtc_nft::init_for_testing(s.ctx());\n    s.next_tx(@0xa);\n    assert!(!ts::has_most_recent_for_address<Publisher>(@0xa));\n    assert!(!ts::has_most_recent_immutable<Publisher>());\n    let c = s.take_shared<Collection<Nft>>();\n    assert!(collection::owner(&c) == @0xa && collection::minted(&c) == 1);\n    let item = s.take_from_sender<Nft>();\n    // A holder burn never reopens the lifetime collection cap.\n    rtc_nft::burn(&c, item); assert!(collection::minted(&c) == 1);\n    ts::return_shared(c); s.end();\n}\n\n#[test]\nfun a_holder_can_freeze_their_item_without_collection_authority() {\n    let mut s = ts::begin(@0xa); rtc_nft::init_for_testing(s.ctx());\n    s.next_tx(@0xa); let item = s.take_from_sender<Nft>();\n    transfer::public_transfer(item, @0xc);\n    s.next_tx(@0xc); let mut item = s.take_from_sender<Nft>();\n    rtc_nft::freeze_item(&mut item); rtc_nft::freeze_item(&mut item);\n    transfer::public_transfer(item, @0xa); s.end();\n}\n\n#[test]\n#[expected_failure(abort_code = 2, location = rtc_asset::rtc_nft)]\nfun holder_freeze_is_permanent_even_for_the_collection_owner() {\n    let mut s = ts::begin(@0xa); rtc_nft::init_for_testing(s.ctx());\n    s.next_tx(@0xa); let mut item = s.take_from_sender<Nft>();\n    rtc_nft::freeze_item(&mut item); let c = s.take_shared<Collection<Nft>>();\n    rtc_nft::update(&c, &mut item, utf8(b\"Changed\"), utf8(b\"\"),\n        utf8(b\"ipfs://image\"), utf8(b\"ipfs://metadata\"), false, s.ctx());\n    ts::return_shared(c); ts::return_to_sender(&s, item); s.end();\n}\n\n#[test]\n#[expected_failure(abort_code = 1, location = rtc_suite::authority)]\nfun outsiders_cannot_mint() {\n    let mut s = ts::begin(@0xa); rtc_nft::init_for_testing(s.ctx());\n    s.next_tx(@0xc); let mut c = s.take_shared<Collection<Nft>>();\n    rtc_nft::mint(&mut c, utf8(b\"Item\"), utf8(b\"\"), utf8(b\"ipfs://image\"),\n        utf8(b\"ipfs://metadata\"), false, @0xc, s.ctx());\n    ts::return_shared(c); s.end();\n}\n\n#[test]\n#[expected_failure(abort_code = 3, location = rtc_suite::collection)]\nfun initial_mint_consumes_the_lifetime_cap() {\n    let mut s = ts::begin(@0xa); rtc_nft::init_for_testing(s.ctx());\n    s.next_tx(@0xa); let mut c = s.take_shared<Collection<Nft>>();\n    rtc_nft::mint(&mut c, utf8(b\"Item 2\"), utf8(b\"\"), utf8(b\"ipfs://image\"),\n        utf8(b\"ipfs://metadata\"), false, @0xa, s.ctx());\n    rtc_nft::mint(&mut c, utf8(b\"Item 3\"), utf8(b\"\"), utf8(b\"ipfs://image\"),\n        utf8(b\"ipfs://metadata\"), false, @0xa, s.ctx());\n    ts::return_shared(c); s.end();\n}\n\n#[test]\nfun an_initial_item_can_be_updated_then_frozen() {\n    let mut s = ts::begin(@0xa); rtc_nft::init_for_testing(s.ctx());\n    s.next_tx(@0xa); let c = s.take_shared<Collection<Nft>>();\n    let mut item = s.take_from_sender<Nft>();\n    rtc_nft::update(&c, &mut item, utf8(b\"Changed\"), utf8(b\"Description\"),\n        utf8(b\"ipfs://changed\"), utf8(b\"ipfs://metadata2\"), true, s.ctx());\n    rtc_nft::burn(&c, item); ts::return_shared(c); s.end();\n}\n"
  }
}
