From 4a8a68c0c0ed7e40fd27cafe1f50d701e36ee15f Mon Sep 17 00:00:00 2001
From: WGB5445 <919603023@qq.com>
Date: Sun, 15 Oct 2023 19:21:02 +0800
Subject: [PATCH] add Display

---
 .../sources/nft/collection.move               |  9 ++++
 .../rooch-framework/sources/nft/display.move  | 42 +++++++++++++++++++
 crates/rooch-framework/sources/nft/nft.move   | 27 ++++++++++++
 3 files changed, 78 insertions(+)

diff --git a/crates/rooch-framework/sources/nft/collection.move b/crates/rooch-framework/sources/nft/collection.move
index cb8fb59556..793989a8e7 100644
--- a/crates/rooch-framework/sources/nft/collection.move
+++ b/crates/rooch-framework/sources/nft/collection.move
@@ -73,6 +73,7 @@ module rooch_framework::collection{
             creator,
             collection
         );
+
         event::emit(
             ctx,
             CreateCollectionEvent {
@@ -98,6 +99,14 @@ module rooch_framework::collection{
         mutator_ref
     }
 
+    public fun destroy_mutator_ref(mutator_ref :ObjectRef<MutatorRef>):ObjectID{
+        assert_mutator_exist_of_ref(&mutator_ref);
+        let MutatorRef {
+            collection
+        } = object_ref::remove(mutator_ref);
+        collection
+    }
+
     public fun get_collection_id(mutator: &ObjectRef<MutatorRef>): ObjectID{
         assert_mutator_exist_of_ref(mutator);
         let mutator_object_ref = object_ref::borrow(mutator);
diff --git a/crates/rooch-framework/sources/nft/display.move b/crates/rooch-framework/sources/nft/display.move
index e69de29bb2..27486d1516 100644
--- a/crates/rooch-framework/sources/nft/display.move
+++ b/crates/rooch-framework/sources/nft/display.move
@@ -0,0 +1,42 @@
+module rooch_framework::display{
+    use std::ascii::String;
+    use moveos_std::simple_map;
+
+    struct Display has key, store,drop,copy {
+        sample_map: simple_map::SimpleMap<String, String>
+    }
+
+    public fun new (): Display {
+        Display {
+            sample_map: simple_map::create()
+        }
+    }
+
+    public fun set (self: &mut Display, key: String, value: String) {
+        simple_map::add(&mut self.sample_map, key, value);
+    }
+
+    public fun borrow (self: & Display, key: String): &String {
+        simple_map::borrow(&mut self.sample_map, &key)
+    }
+
+    public fun borrow_mut (self: &mut Display, key: String): &mut String {
+        simple_map::borrow_mut(&mut self.sample_map, &key)
+    }
+
+    public fun remove (self: &mut Display, key: String) {
+        simple_map::remove(&mut self.sample_map, &key);
+    }
+
+    public fun keys (self: & Display): vector<String> {
+        simple_map::keys(& self.sample_map)
+    }
+
+    public fun values (self: & Display): vector<String> {
+        simple_map::values(& self.sample_map)
+    }
+
+    public fun contains_key (self: & Display, key: String) -> bool {
+        simple_map::contains(& self.sample_map, key)
+    }
+}
\ No newline at end of file
diff --git a/crates/rooch-framework/sources/nft/nft.move b/crates/rooch-framework/sources/nft/nft.move
index 1977b1e473..9ee1b2475d 100644
--- a/crates/rooch-framework/sources/nft/nft.move
+++ b/crates/rooch-framework/sources/nft/nft.move
@@ -94,6 +94,33 @@ module rooch_framework::nft {
         mutator_ref
     }
 
+    public fun destroy_mutator_ref(mutator_ref :ObjectRef<MutatorRef>):ObjectID{
+        assert_mutator_exist_of_ref(&mutator_ref);
+        let MutatorRef {
+            nft
+        } = object_ref::remove(mutator_ref);
+        nft
+    }
+
+    public fun generate_burner_ref(nft_object_ref: &ObjectRef<NFT>, ctx: &mut Context):ObjectRef<BurnerRef>{
+        let burner_ref = context::new_object_with_owner(
+            ctx,
+            object_ref::owner(nft_object_ref),
+            BurnerRef {
+                nft: object_ref::id(nft_object_ref),
+            }
+        );
+        burner_ref
+    }
+
+    public fun destroy_burner_ref(burner_ref :ObjectRef<BurnerRef>):ObjectID{
+        assert_burner_exist_of_ref(&burner_ref);
+        let BurnerRef {
+            nft
+        } = object_ref::remove(burner_ref);
+        nft
+    }
+
     // assert
     public fun assert_nft_exist_of_id(objectId: ObjectID, ctx: &Context) {
         assert!(context::exist_object(ctx, objectId), ENftNotExist);