-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Migrate token objects into the framework at 0x4 #7277
Conversation
39c8ce2
to
e009be7
Compare
@@ -0,0 +1,13 @@ | |||
[package] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make this a new package vs merging into aptos-token? This would require making sure aptos-token-objects is supported as a new package in many places (genesis, release-tooling, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the better approach... the constructs at 0x3 share names and would all be but confusing to co-exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call though... I need to actually run a local node and ensure that it is taken in otherwise this change won't impact devnet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest ensuring both genesis and framework upgrade work. Otherwise, this would potentially bypass tests, compat checks, etc. which can somehow break the release process down the line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new package just because of shared names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry users would end up even more confused.
object::address_to_object<AptosCollection>(collection_addr) | ||
} | ||
|
||
entry fun set_collection_description_call( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer required now that #7090 is getting merged soon. set_collection_description can become public fun. Similar comment for other functions here
} | ||
|
||
#[test(creator = @0x123)] | ||
entry fun est_property_remove(creator: &signer) acquires AptosCollection, AptosToken { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing t at the beginning of test name
e009be7
to
bc68f50
Compare
@@ -192,48 +192,6 @@ module aptos_token_objects::collection { | |||
} | |||
} | |||
|
|||
/// Entry function for creating a collection | |||
public entry fun create_collection( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to remove
@@ -247,7 +247,7 @@ module aptos_token_objects::property_map { | |||
let (type, value) = read(object, key); | |||
assert!( | |||
type == type_info::type_name<V>(), | |||
error::invalid_argument(ETYPE_INVALID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use 2 different errors for the 2 remaining uses of ETYPE_INVALID as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is the right error and they appear in different contexts. This was intended to be mismatch, but copypasta, I guess
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -151,6 +151,9 @@ module aptos_token_objects::collection { | |||
royalty::init(&constructor_ref, option::extract(&mut royalty)) | |||
}; | |||
|
|||
let transfer_ref = object::generate_transfer_ref(&constructor_ref); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Can you add a comment here explaining that transferring collection objects is disabled as it's meaningless - the new owner wouldn't gain any control over the collection.
@@ -562,11 +546,11 @@ module token_objects::aptos_token { | |||
collection: String, | |||
name: String, | |||
key: String, | |||
type: String, | |||
type_: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮💨
let aptos_token = authorized_borrow(&token, signer::address_of(creator)); | ||
assert!( | ||
option::is_some(&aptos_token.property_mutator_ref), | ||
are_properties_mutable(token), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the rationale behind this change? Basically you use a bool
of a collection to decide whether tokens in this collection has properties mutable and store a mutable_ref in all tokens? Why do you have this ref. My guess is for potential upgrade to control each one individually but not sure how this can work later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figure it is okay to just make this a collection level configuration for our no-code solution... the code complexity here isn't great and it is mostly just a bunch of control flags.. so I became a little oppressive here and there.
@@ -0,0 +1,13 @@ | |||
[package] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new package just because of shared names?
0375413
to
9bb3ecf
Compare
construct the container for aptos-token-objects migrate examples token-objects to framework/aptos-token-objects
if a user attempts to freeze, unfreeze a soul bound token for which the collection enables freeze, unfreeze, they would get a weird error.
The current abigen depends on TypeTags to represent abis. Unfortunately this excludes it from representing any generic entry function. That should NOT prevent us from writing these entry functions in Move or in the framework. The current code creates that unnecessary restriction, so instead of panicing, just return none as if it cannot understand it.
upgrade to more effective interfaces -- still need to improve both the abigen in move and then the rust sdk builder
56f0c93
to
b649d89
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
* Named Objects * Named tokens * Named collections * Moved auth key generation back into the account_address module from ed25519 for multi-ed as that's where it was defined for other frameworks
* this validates much of the token objects code * demonstrates a means to read objects efficiently using python * how to perform property type operations * read from property types * how to tie your shoes
56f0c93
to
8b74f89
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
❌ Forge suite
|
Will start working immediately on writing / updating the appropriate AIPs.