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

[NFT Standard] #963

Merged
merged 23 commits into from
Oct 21, 2023
Merged

[NFT Standard] #963

merged 23 commits into from
Oct 21, 2023

Conversation

WGB5445
Copy link
Collaborator

@WGB5445 WGB5445 commented Oct 14, 2023

@vercel
Copy link

vercel bot commented Oct 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Oct 20, 2023 1:52pm

@WGB5445 WGB5445 marked this pull request as draft October 14, 2023 18:55
@WGB5445 WGB5445 marked this pull request as ready for review October 16, 2023 16:00
Copy link
Contributor

@jolestar jolestar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user how to hold or transfer NFT?

crates/rooch-framework/sources/nft/nft.move Outdated Show resolved Hide resolved
crates/rooch-framework/sources/nft/display.move Outdated Show resolved Hide resolved
@WGB5445
Copy link
Collaborator Author

WGB5445 commented Oct 17, 2023

The user how to hold or transfer NFT?

Yes, I haven't added the transfer yet

Here I still have some questions about Object

When transferring Object, must it be limited to the current Module?

If this function is not turned on, whether the NFT is an Object means the unique ObjectID


public fun assert_collection_exist_of_id(collectionID: ObjectID, ctx: & Context){
assert!( context::exist_object(ctx, collectionID), ErrorCollectionNotExist);
context::borrow_object<Collection>(ctx,collectionID);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused borrow

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused borrow

Because it is necessary to determine that the Object corresponding to the Object ID is the current type

This should be refactored after the subsequent Object module upgrade.


public fun assert_mutator_exist_of_id(objectId: ObjectID, ctx: &Context) {
assert!(context::exist_object(ctx, objectId), ErrorMutatorNotExist);
context::borrow_object<MutatorRef>(ctx, objectId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused borrow

@baichuan3
Copy link
Collaborator

Will this version of nft consider implementing Royalty?

remove_extend_internal(mutator, ctx)
}

public fun contains_display(mutator: &ObjectRef<MutatorRef>, ctx: &mut Context): bool{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all functions need to pass in ObjectRef. For example, the contains function can pass in ObjectRef?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all functions need to pass in ObjectRef. For example, the contains function can pass in ObjectRef?

This has been changed to struct because there are still some problems with the current use of Object

@@ -142,6 +143,12 @@ module moveos_std::context {
obj_ref
}

#[private_generics(T)]
public fun new_single_object<T: key>(self: &mut Context, value: T): ObjectRef<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_singleton_object?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_singleton_object?

Fixed

@jolestar jolestar linked an issue Oct 19, 2023 that may be closed by this pull request
@@ -142,6 +143,12 @@ module moveos_std::context {
obj_ref
}

#[private_generics(T)]
public fun new_singleton_object<T: key>(self: &mut Context, value: T): ObjectRef<T> {
let object_id = object::singleton_object_id<T>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is a singleton object, do we need to check whether the object exists?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is a singleton object, do we need to check whether the object exists?

Because the ObjectID will be the same, new should not appear the second one, and better error information can be added.

simple_map::borrow(&display_ref.sample_map, key)
}

public fun borrow_mut<T>(self: &mut ObjectRef<Display<T>>, key: &String): &mut String {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly provide an update method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly provide an update method?

In fact, whether the ObjectRef can be obtained is controlled by the Module creator, so there will be no problem

rooch_framework = "0x3"

[dev-addresses]
creator = "0x42"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example project supports two named_address: rooch_examples & $project_dir.
So the creator needs to change to nft.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jolestar jolestar merged commit d7b1870 into rooch-network:main Oct 21, 2023
4 checks passed
@WGB5445 WGB5445 deleted the NFT branch October 21, 2023 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Object] Proposal to Introduce Singleton Pattern [Framework] NFT standard
4 participants