-
Hello! not completely sure what is going on here on Aptogotchi contract At this point we create a token with the account address as the token name https://github.com/aptos-labs/aptogotchi/blob/main/move/sources/aptogotchi.move#L149 Why do we create a struct and then move it under the token signer? why we dont just move the actual token we created? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
This implementation is kind of confusing, it would be clearer if we only have 1 name (user passed in), and use it as the token name in token creation, then we don't need to have |
Beta Was this translation helpful? Give feedback.
-
We did move the created token (the transfer_ref is from the created token) to the creator. Another reason Aptogotchi struct is useful is we can store the |
Beta Was this translation helpful? Give feedback.
-
Here's a simplified version of the code without defining |
Beta Was this translation helpful? Give feedback.
We did move the created token (the transfer_ref is from the created token) to the creator.
Another reason Aptogotchi struct is useful is we can store the
extend_ref
of the token (which is an object under the hood) in it.So we can add more structs to the token object later (e.g. have an
AptogotchiExtension
struct stores data like location, etc) or update token's name, description and URI. Since once the module is published, we cannot modify existing structs. Only way to store additional data about token is adding new struct to the object, and that requires us to save object'sextend_ref
.