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

Add functions to update collection name and max supply #78

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

JohnChangUK
Copy link
Member

Description

Add support for:

  • Update collection name
  • Update collection max supply

migration/sources/migration.move Outdated Show resolved Hide resolved
@@ -45,6 +47,14 @@ module minter::collection_properties {
tokens_transferable_by_collection_owner: CollectionProperty,
}

#[resource_group_member(group = aptos_framework::object::ObjectGroup)]
struct CollectionPropertiesV2 has copy, drop, key {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a reason we can't add this to CollectionProperties? Is it because this is an upgrade to an already deployed contract?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right.

mutable_name: bool,
mutable_max_supply: bool,
): CollectionPropertiesV2 {
CollectionPropertiesV2 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this need access control?

Copy link
Collaborator

Choose a reason for hiding this comment

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

does this need to emit an event?

Copy link
Member Author

@JohnChangUK JohnChangUK Jun 18, 2024

Choose a reason for hiding this comment

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

This just creates the resource. We emit an event when they initialize this for the collection.
No need for access control, anyone can create this for a resource they own. This is just a struct with values.

mutable_max_supply: bool,
) acquires CollectionPropertiesV2 {
let property = &mut authorized_borrow_mut_v2(collection_owner, collection).mutable_max_supply;
set_property(property, mutable_max_supply, string::utf8(b"mutable_max_supply"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it too late for us to deprecate something like event Mutation? Why don't we just define a new event type for each new type of mutation? mutated_field_name feels typo-prone.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is fine, we do this for collection module in Aptos and don't see any problems with this.

Copy link
Collaborator

@jillxuu jillxuu left a comment

Choose a reason for hiding this comment

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

as discussed, both clients who're using token minter on mainnet are fine with redeployment, lets redeploy with fields added to the original collectionproperties

@JohnChangUK JohnChangUK merged commit 82e68ef into main Jun 18, 2024
4 of 7 checks passed
@JohnChangUK JohnChangUK deleted the collection_nam branch June 18, 2024 18:15
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.

3 participants