-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dev feature 3 + 6 - Mutable Templates & Non-Burnable or Non-transferable XOR condition #8
base: master
Are you sure you want to change the base?
Changes from all commits
6075419
86b4708
4ff8b26
35dbb88
d4857de
4d69ac0
e7a3241
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,17 @@ CONTRACT atomicassets : public contract { | |
ATTRIBUTE_MAP immutable_data | ||
); | ||
|
||
ACTION createtempl2( | ||
name authorized_creator, | ||
name collection_name, | ||
name schema_name, | ||
bool transferable, | ||
bool burnable, | ||
uint32_t max_supply, | ||
ATTRIBUTE_MAP immutable_data, | ||
ATTRIBUTE_MAP mutable_data | ||
); | ||
|
||
ACTION locktemplate( | ||
name authorized_editor, | ||
name collection_name, | ||
|
@@ -129,6 +140,12 @@ CONTRACT atomicassets : public contract { | |
ATTRIBUTE_MAP new_mutable_data | ||
); | ||
|
||
ACTION settempldata( | ||
name authorized_editor, | ||
name collection_name, | ||
int32_t template_id, | ||
ATTRIBUTE_MAP new_mutable_data | ||
); | ||
|
||
ACTION announcedepo( | ||
name owner, | ||
|
@@ -233,6 +250,14 @@ CONTRACT atomicassets : public contract { | |
ATTRIBUTE_MAP new_data | ||
); | ||
|
||
ACTION logsetdatatl( | ||
name collection_name, | ||
name schema_name, | ||
int32_t template_id, | ||
ATTRIBUTE_MAP old_data, | ||
ATTRIBUTE_MAP new_data | ||
); | ||
|
||
ACTION logbackasset( | ||
name asset_owner, | ||
uint64_t asset_id, | ||
|
@@ -295,6 +320,16 @@ CONTRACT atomicassets : public contract { | |
|
||
typedef multi_index <name("templates"), templates_s> templates_t; | ||
|
||
//Scope: collection_name | ||
TABLE template_data_s { | ||
int32_t template_id; | ||
name schema_name; | ||
vector <uint8_t> mutable_serialized_data; | ||
|
||
uint64_t primary_key() const { return (uint64_t) template_id; } | ||
}; | ||
|
||
typedef multi_index <name("templatedata"), template_data_s> template_data_t; | ||
|
||
//Scope: owner | ||
TABLE assets_s { | ||
|
@@ -370,6 +405,16 @@ CONTRACT atomicassets : public contract { | |
config_t config = config_t(get_self(), get_self().value); | ||
tokenconfigs_t tokenconfigs = tokenconfigs_t(get_self(), get_self().value); | ||
|
||
void internal_create_template( | ||
name authorized_creator, | ||
name collection_name, | ||
name schema_name, | ||
bool transferable, | ||
bool burnable, | ||
uint32_t max_supply, | ||
ATTRIBUTE_MAP & immutable_data, | ||
ATTRIBUTE_MAP mutable_data = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a reason not to use a reference for the mutable data when you're using one for the immutable data? I also don't really like the default value, I'd rather see that explicitly when calling the function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no reference for the mutable_data because the original createtempl action does not have a field for mutable_data (only immutable_data). It's only accessed by the new createtempl2 action. Just looks a bit cleaner this way, as the function doesn't have to create an empty ATTRIBUTE_MAP & pass that over (if it was by reference) |
||
); | ||
|
||
void internal_transfer( | ||
name from, | ||
|
@@ -408,4 +453,6 @@ CONTRACT atomicassets : public contract { | |
schemas_t get_schemas(name collection_name); | ||
|
||
templates_t get_templates(name collection_name); | ||
|
||
template_data_t get_template_data(name collection_name); | ||
}; |
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 calling this templatedata could be confusing, because template data already exists as part of the normal template table. A name that makes it clear this is referring to mutable template data would be better imo.
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 agree, wdy think about these: